Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add "use client" directive in components where it's needed #4452

Merged
merged 1 commit into from Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .babel-preset.js
Expand Up @@ -33,6 +33,12 @@ const plugins = [
// modules and avoid modules that prevent tree-shaking:
// https://github.com/lodash/lodash/issues/4119
'lodash',
[
'transform-next-use-client',
{
customClientImports: ['useAutoControlledValue', 'useEventCallback', 'useMergedRefs'],
},
],
// CJS modules are not tree-shakable in any bundler by default
// https://github.com/formium/tsdx#using-lodash
(isESBuild || isUMDBuild) && [
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -102,6 +102,7 @@
"babel-plugin-filter-imports": "^4.0.0",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-transform-next-use-client": "^1.1.1",
"babel-plugin-transform-react-handled-props": "^2.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-rename-import": "^2.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/addons/Confirm/Confirm.js
@@ -1,6 +1,6 @@
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { customPropTypes, getUnhandledProps } from '../../lib'
import Button from '../../elements/Button'
Expand Down
2 changes: 1 addition & 1 deletion src/addons/Pagination/Pagination.js
@@ -1,6 +1,6 @@
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
createPaginationItems,
Expand Down
17 changes: 5 additions & 12 deletions src/addons/Portal/Portal.js
Expand Up @@ -2,7 +2,7 @@ import EventStack from '@semantic-ui-react/event-stack'
import keyboardKey from 'keyboard-key'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
customPropTypes,
Expand All @@ -25,17 +25,17 @@ const debug = makeDebugger('portal')
function Portal(props) {
const {
children,
closeOnDocumentClick,
closeOnEscape,
closeOnDocumentClick = true,
closeOnEscape = true,
closeOnPortalMouseLeave,
closeOnTriggerBlur,
closeOnTriggerClick,
closeOnTriggerMouseLeave,
eventPool,
eventPool = 'default',
mountNode,
mouseEnterDelay,
mouseLeaveDelay,
openOnTriggerClick,
openOnTriggerClick = true,
openOnTriggerFocus,
openOnTriggerMouseEnter,
} = props
Expand Down Expand Up @@ -378,13 +378,6 @@ Portal.propTypes = {
triggerRef: customPropTypes.ref,
}

Portal.defaultProps = {
closeOnDocumentClick: true,
closeOnEscape: true,
eventPool: 'default',
openOnTriggerClick: true,
}

Portal.Inner = PortalInner

export default Portal
2 changes: 1 addition & 1 deletion src/addons/Portal/PortalInner.js
@@ -1,6 +1,6 @@
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'
import { createPortal } from 'react-dom'

import { isBrowser, makeDebugger, useEventCallback } from '../../lib'
Expand Down
2 changes: 1 addition & 1 deletion src/addons/Portal/usePortalElement.js
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'
import ReactIs from 'react-is'

import { useMergedRefs } from '../../lib'
Expand Down
2 changes: 1 addition & 1 deletion src/addons/Portal/utils/useTrigger.js
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'

import { useMergedRefs } from '../../../lib'
import validateTrigger from './validateTrigger'
Expand Down
2 changes: 1 addition & 1 deletion src/addons/Portal/utils/validateTrigger.js
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'
import * as ReactIs from 'react-is'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/addons/Radio/Radio.js
@@ -1,4 +1,4 @@
import React from 'react'
import * as React from 'react'

import { getUnhandledProps } from '../../lib'
import Checkbox from '../../modules/Checkbox'
Expand Down
2 changes: 1 addition & 1 deletion src/addons/Select/Select.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import Dropdown from '../../modules/Dropdown'

Expand Down
2 changes: 1 addition & 1 deletion src/addons/TextArea/TextArea.js
@@ -1,6 +1,6 @@
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps, useMergedRefs } from '../../lib'

Expand Down
2 changes: 1 addition & 1 deletion src/addons/TransitionablePortal/TransitionablePortal.js
@@ -1,6 +1,6 @@
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import Portal from '../Portal'
import Transition from '../../modules/Transition'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Breadcrumb/Breadcrumb.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { childrenUtils, customPropTypes, getUnhandledProps, getComponentType, SUI } from '../../lib'
import BreadcrumbDivider from './BreadcrumbDivider'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Breadcrumb/BreadcrumbDivider.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Breadcrumb/BreadcrumbSection.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/Form.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps, SUI, useKeyOnly, useWidthProp } from '../../lib'
import FormButton from './FormButton'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormButton.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'
import Button from '../../elements/Button'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormCheckbox.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'
import Checkbox from '../../modules/Checkbox'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormDropdown.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'
import Dropdown from '../../modules/Dropdown'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormGroup.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
customPropTypes,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormInput.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'
import Input from '../../elements/Input'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormRadio.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'
import Radio from '../../addons/Radio'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormSelect.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'
import Select from '../../addons/Select'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Form/FormTextArea.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'
import TextArea from '../../addons/TextArea'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Grid/Grid.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
customPropTypes,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Grid/GridColumn.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
customPropTypes,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Grid/GridRow.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
customPropTypes,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Menu/Menu.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Menu/MenuHeader.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { childrenUtils, customPropTypes, getComponentType, getUnhandledProps } from '../../lib'

Expand Down
2 changes: 1 addition & 1 deletion src/collections/Menu/MenuItem.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Menu/MenuMenu.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { childrenUtils, customPropTypes, getComponentType, getUnhandledProps } from '../../lib'

Expand Down
2 changes: 1 addition & 1 deletion src/collections/Message/Message.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Message/MessageContent.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { childrenUtils, customPropTypes, getComponentType, getUnhandledProps } from '../../lib'

Expand Down
2 changes: 1 addition & 1 deletion src/collections/Message/MessageHeader.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Message/MessageItem.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Message/MessageList.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/Table.js
@@ -1,7 +1,7 @@
import _ from 'lodash'
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/TableBody.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getComponentType, getUnhandledProps } from '../../lib'

Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/TableCell.js
@@ -1,7 +1,7 @@
import _ from 'lodash'
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/TableFooter.js
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getUnhandledProps } from '../../lib'
import TableHeader from './TableHeader'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/TableHeader.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/TableHeaderCell.js
@@ -1,6 +1,6 @@
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import { getUnhandledProps, useValueAndKey } from '../../lib'
import TableCell from './TableCell'
Expand Down
2 changes: 1 addition & 1 deletion src/collections/Table/TableRow.js
@@ -1,7 +1,7 @@
import _ from 'lodash'
import cx from 'clsx'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down
2 changes: 1 addition & 1 deletion src/elements/Button/Button.js
@@ -1,7 +1,7 @@
import cx from 'clsx'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import * as React from 'react'

import {
childrenUtils,
Expand Down