@lumx/react 3.20.1-alpha.45 → 3.20.1-alpha.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_internal/{useClassnames.js → Cd8LPzmx.js} +32 -31
- package/_internal/Cd8LPzmx.js.map +1 -0
- package/index.js +20 -13
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/utils/index.d.ts +30 -29
- package/utils/index.js +1 -1
- package/_internal/useClassnames.js.map +0 -1
|
@@ -2,7 +2,7 @@ import React__default, { useEffect, useContext, createContext, useMemo, useRef }
|
|
|
2
2
|
import isEmpty from 'lodash/isEmpty';
|
|
3
3
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
|
-
import {
|
|
5
|
+
import { classNames } from '@lumx/core/js/utils';
|
|
6
6
|
|
|
7
7
|
const EVENT_TYPES = ['mousedown', 'touchstart'];
|
|
8
8
|
function isClickAway(targets, refs) {
|
|
@@ -157,48 +157,49 @@ function useDisabledStateContext() {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
|
-
* Hook that
|
|
161
|
-
*
|
|
162
|
-
* @
|
|
160
|
+
* Hook that provides BEM class name utilities for a component.
|
|
161
|
+
*
|
|
162
|
+
* @param className - Base component class name (kebab-case)
|
|
163
|
+
* @returns Object with `block` and `element` utility functions
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* const { block, element } = useClassnames('my-component');
|
|
163
167
|
*/
|
|
164
|
-
function useClassnames(
|
|
168
|
+
function useClassnames(className) {
|
|
165
169
|
return useMemo(() => {
|
|
166
170
|
return {
|
|
167
171
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* Executing `block()` returns`CLASSNAME`
|
|
171
|
-
*
|
|
172
|
-
* Executing `block('modifier')` returns `CLASSNAME CLASSNAME--modifier`
|
|
172
|
+
* Generates BEM block class names with optional modifiers.
|
|
173
173
|
*
|
|
174
|
-
*
|
|
174
|
+
* @param modifier - Modifier string, object, or additional class names
|
|
175
|
+
* @param additionalClasses - Additional CSS classes to append
|
|
176
|
+
* @returns Generated class name string
|
|
175
177
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
178
|
+
* @example
|
|
179
|
+
* block() // 'my-component'
|
|
180
|
+
* block('active') // 'my-component my-component--active'
|
|
181
|
+
* block({ active: true, disabled: false }) // 'my-component my-component--active'
|
|
182
|
+
* block(['custom-class']) // 'my-component custom-class'
|
|
181
183
|
*/
|
|
182
|
-
block:
|
|
184
|
+
block: classNames.bem.block(className),
|
|
183
185
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* Executing `element('element')` returns `CLASSNAME__element`
|
|
187
|
-
*
|
|
188
|
-
* Executing `element('element', 'modifier')` returns `CLASSNAME__element CLASSNAME__element--modifier`
|
|
189
|
-
*
|
|
190
|
-
* Executing `element('element', { modifier1: true, modifier2: false })` returns `CLASSNAME__element CLASSNAME__element--modifier1`
|
|
186
|
+
* Generates BEM element class names with optional modifiers.
|
|
191
187
|
*
|
|
192
|
-
*
|
|
188
|
+
* @param elementName - Element name
|
|
189
|
+
* @param modifier - Modifier string, object, or additional class names
|
|
190
|
+
* @param additionalClasses - Additional CSS classes to append
|
|
191
|
+
* @returns Generated class name string
|
|
193
192
|
*
|
|
194
|
-
* @
|
|
195
|
-
*
|
|
196
|
-
*
|
|
193
|
+
* @example
|
|
194
|
+
* element('header') // 'my-component__header'
|
|
195
|
+
* element('header', 'large') // 'my-component__header my-component__header--large'
|
|
196
|
+
* element('header', { large: true, small: false }) // 'my-component__header my-component__header--large'
|
|
197
|
+
* element('header', ['custom-class']) // 'my-component__header custom-class'
|
|
197
198
|
*/
|
|
198
|
-
element:
|
|
199
|
+
element: classNames.bem.element(className)
|
|
199
200
|
};
|
|
200
|
-
}, [
|
|
201
|
+
}, [className]);
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
export { ClickAwayProvider as C, DisabledStateProvider as D, Portal as P, PortalProvider as a, useClassnames as b, useDisabledStateContext as u };
|
|
204
|
-
//# sourceMappingURL=
|
|
205
|
+
//# sourceMappingURL=Cd8LPzmx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cd8LPzmx.js","sources":["../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx","../../src/utils/Portal/PortalProvider.tsx","../../src/utils/Portal/Portal.tsx","../../src/utils/disabled/DisabledStateContext.tsx","../../src/utils/className/useClassnames.ts"],"sourcesContent":["import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils/type';\n\nimport isEmpty from 'lodash/isEmpty';\n\nconst EVENT_TYPES = ['mousedown', 'touchstart'];\n\nfunction isClickAway(targets: HTMLElement[], refs: Array<RefObject<HTMLElement>>): boolean {\n // The targets elements are not contained in any of the listed element references.\n return !refs.some((ref) => targets.some((target) => ref?.current?.contains(target)));\n}\n\nexport interface ClickAwayParameters {\n /**\n * A callback function to call when the user clicks away from the elements.\n */\n callback: EventListener | Falsy;\n /**\n * Elements considered within the click away context (clicking outside them will trigger the click away callback).\n */\n childrenRefs: RefObject<Array<RefObject<HTMLElement>>>;\n}\n\n/**\n * Listen to clicks away from the given elements and callback the passed in function.\n *\n * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.\n */\nexport function useClickAway({ callback, childrenRefs }: ClickAwayParameters): void {\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!callback || !currentRefs || isEmpty(currentRefs)) {\n return undefined;\n }\n const listener: EventListener = (evt) => {\n const targets = [evt.composedPath?.()[0], evt.target] as HTMLElement[];\n if (isClickAway(targets, currentRefs)) {\n callback(evt);\n }\n };\n\n EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n }, [callback, childrenRefs]);\n}\n","import { createContext, RefObject, useContext, useEffect, useMemo, useRef } from 'react';\nimport { ClickAwayParameters, useClickAway } from '@lumx/react/hooks/useClickAway';\n\ninterface ContextValue {\n childrenRefs: Array<RefObject<HTMLElement>>;\n addRefs(...newChildrenRefs: Array<RefObject<HTMLElement>>): void;\n}\n\nconst ClickAwayAncestorContext = createContext<ContextValue | null>(null);\n\ninterface ClickAwayProviderProps extends ClickAwayParameters {\n /**\n * (Optional) Element that should be considered as part of the parent\n */\n parentRef?: RefObject<HTMLElement>;\n /**\n * Children\n */\n children?: React.ReactNode;\n}\n\n/**\n * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure\n * we take into account both the DOM tree and the React tree to detect click away.\n *\n * @return the react component.\n */\nexport const ClickAwayProvider: React.FC<ClickAwayProviderProps> = ({\n children,\n callback,\n childrenRefs,\n parentRef,\n}) => {\n const parentContext = useContext(ClickAwayAncestorContext);\n const currentContext = useMemo(() => {\n const context: ContextValue = {\n childrenRefs: [],\n /**\n * Add element refs to the current context and propagate to the parent context.\n */\n addRefs(...newChildrenRefs) {\n // Add element refs that should be considered as inside the click away context.\n context.childrenRefs.push(...newChildrenRefs);\n\n if (parentContext) {\n // Also add then to the parent context\n parentContext.addRefs(...newChildrenRefs);\n if (parentRef) {\n // The parent element is also considered as inside the parent click away context but not inside the current context\n parentContext.addRefs(parentRef);\n }\n }\n },\n };\n return context;\n }, [parentContext, parentRef]);\n\n useEffect(() => {\n const { current: currentRefs } = childrenRefs;\n if (!currentRefs) {\n return;\n }\n currentContext.addRefs(...currentRefs);\n }, [currentContext, childrenRefs]);\n\n useClickAway({ callback, childrenRefs: useRef(currentContext.childrenRefs) });\n return <ClickAwayAncestorContext.Provider value={currentContext}>{children}</ClickAwayAncestorContext.Provider>;\n};\nClickAwayProvider.displayName = 'ClickAwayProvider';\n","import React from 'react';\n\ntype Container = DocumentFragment | Element;\n\n/**\n * Portal initializing function.\n * If it does not provide a container, the Portal children will render in classic React tree and not in a portal.\n */\nexport type PortalInit = () => {\n container?: Container;\n teardown?: () => void;\n};\n\nexport const PortalContext = React.createContext<PortalInit>(() => ({ container: document.body }));\n\nexport interface PortalProviderProps {\n children?: React.ReactNode;\n value: PortalInit;\n}\n\n/**\n * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)\n */\nexport const PortalProvider: React.FC<PortalProviderProps> = PortalContext.Provider;\n","import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { PortalContext } from './PortalProvider';\n\nexport interface PortalProps {\n enabled?: boolean;\n children: React.ReactNode;\n}\n\n/**\n * Render children in a portal outside the current DOM position\n * (defaults to `document.body` but can be customized with the PortalContextProvider)\n */\nexport const Portal: React.FC<PortalProps> = ({ children, enabled = true }) => {\n const init = React.useContext(PortalContext);\n const context = React.useMemo(\n () => {\n return enabled ? init() : null;\n },\n // Only update on 'enabled'\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [enabled],\n );\n\n React.useLayoutEffect(() => {\n return context?.teardown;\n }, [context?.teardown, enabled]);\n\n if (!context?.container) {\n return <>{children}</>;\n }\n return createPortal(children, context.container);\n};\n","import React, { useContext } from 'react';\n\n/** Disable state */\ntype DisabledStateContextValue =\n | {\n state: 'disabled';\n }\n | { state: undefined | null };\n\nexport const DisabledStateContext = React.createContext<DisabledStateContextValue>({ state: null });\n\nexport type DisabledStateProviderProps = DisabledStateContextValue & {\n children: React.ReactNode;\n};\n\n/**\n * Disabled state provider.\n * All nested LumX Design System components inherit this disabled state.\n */\nexport function DisabledStateProvider({ children, ...value }: DisabledStateProviderProps) {\n return <DisabledStateContext.Provider value={value}>{children}</DisabledStateContext.Provider>;\n}\n\n/**\n * Get DisabledState context value\n */\nexport function useDisabledStateContext(): DisabledStateContextValue {\n return useContext(DisabledStateContext);\n}\n","import { useMemo } from 'react';\n\nimport type { KebabCase } from '@lumx/core/js/types';\nimport { classNames } from '@lumx/core/js/utils';\n\n/**\n * Hook that provides BEM class name utilities for a component.\n *\n * @param className - Base component class name (kebab-case)\n * @returns Object with `block` and `element` utility functions\n *\n * @example\n * const { block, element } = useClassnames('my-component');\n */\nexport function useClassnames<C extends string>(className: KebabCase<C>) {\n return useMemo(() => {\n return {\n /**\n * Generates BEM block class names with optional modifiers.\n *\n * @param modifier - Modifier string, object, or additional class names\n * @param additionalClasses - Additional CSS classes to append\n * @returns Generated class name string\n *\n * @example\n * block() // 'my-component'\n * block('active') // 'my-component my-component--active'\n * block({ active: true, disabled: false }) // 'my-component my-component--active'\n * block(['custom-class']) // 'my-component custom-class'\n */\n block: classNames.bem.block(className),\n /**\n * Generates BEM element class names with optional modifiers.\n *\n * @param elementName - Element name\n * @param modifier - Modifier string, object, or additional class names\n * @param additionalClasses - Additional CSS classes to append\n * @returns Generated class name string\n *\n * @example\n * element('header') // 'my-component__header'\n * element('header', 'large') // 'my-component__header my-component__header--large'\n * element('header', { large: true, small: false }) // 'my-component__header my-component__header--large'\n * element('header', ['custom-class']) // 'my-component__header custom-class'\n */\n element: classNames.bem.element(className),\n };\n }, [className]);\n}\n"],"names":["EVENT_TYPES","isClickAway","targets","refs","some","ref","target","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","composedPath","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","createContext","ClickAwayProvider","children","parentRef","parentContext","useContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","_jsx","Provider","value","displayName","PortalContext","React","container","body","PortalProvider","Portal","enabled","init","useLayoutEffect","teardown","_Fragment","createPortal","DisabledStateContext","state","DisabledStateProvider","useDisabledStateContext","useClassnames","className","block","classNames","bem","element"],"mappings":";;;;;;AAMA,MAAMA,WAAW,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC;AAE/C,SAASC,WAAWA,CAACC,OAAsB,EAAEC,IAAmC,EAAW;AACvF;EACA,OAAO,CAACA,IAAI,CAACC,IAAI,CAAEC,GAAG,IAAKH,OAAO,CAACE,IAAI,CAAEE,M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AACA;AACO,SAAS8B,uBAAuBA,GAA8B;EACjE,OAAO3B,UAAU,CAACwB,oBAAoB,CAAC;AAC3C;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,aAAaA,CAAmBC,SAAuB,EAAE;EACrE,OAAO3B,OAAO,CAAC,MAAM;IACjB,OAAO;AACH;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACY4B,KAAK,EAAEC,UAAU,CAACC,GAAG,CAACF,KAAK,CAACD,SAAS,CAAC;AACtC;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACYI,MAAAA,OAAO,EAAEF,UAAU,CAACC,GAAG,CAACC,OAAO,CAACJ,SAAS;KAC5C;AACL,EAAA,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;AACnB;;;;"}
|
package/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import { mdiAlertCircle } from '@lumx/icons/esm/alert-circle';
|
|
|
8
8
|
import { mdiCheckCircle } from '@lumx/icons/esm/check-circle';
|
|
9
9
|
import { mdiInformation } from '@lumx/icons/esm/information';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
import { u as useDisabledStateContext, b as useClassnames, P as Portal, C as ClickAwayProvider } from './_internal/
|
|
12
|
-
import {
|
|
11
|
+
import { u as useDisabledStateContext, b as useClassnames, P as Portal, C as ClickAwayProvider } from './_internal/Cd8LPzmx.js';
|
|
12
|
+
import { classNames, onEnterPressed, onEscapePressed, onButtonPressed, detectHorizontalSwipe } from '@lumx/core/js/utils';
|
|
13
13
|
import last from 'lodash/last';
|
|
14
14
|
import pull from 'lodash/pull';
|
|
15
15
|
import get from 'lodash/get';
|
|
@@ -782,7 +782,7 @@ const RawClickable = forwardRefPolymorphic((props, ref) => {
|
|
|
782
782
|
const COMPONENT_NAME$1f = 'ButtonRoot';
|
|
783
783
|
const BUTTON_WRAPPER_CLASSNAME = `lumx-button-wrapper`;
|
|
784
784
|
const BUTTON_CLASSNAME = `lumx-button`;
|
|
785
|
-
const wrapperBlock =
|
|
785
|
+
const wrapperBlock = classNames.bem.block(BUTTON_WRAPPER_CLASSNAME);
|
|
786
786
|
|
|
787
787
|
/**
|
|
788
788
|
* Render a button wrapper with the ButtonRoot inside.
|
|
@@ -1916,7 +1916,7 @@ const DatePickerControlled = forwardRef((props, ref) => {
|
|
|
1916
1916
|
label: /*#__PURE__*/jsxs(Fragment, {
|
|
1917
1917
|
children: [/*#__PURE__*/jsx("span", {
|
|
1918
1918
|
"aria-live": labelAriaLive,
|
|
1919
|
-
className: onMonthChange ?
|
|
1919
|
+
className: onMonthChange ? classNames.visuallyHidden() : undefined,
|
|
1920
1920
|
dir: "auto",
|
|
1921
1921
|
children: monthYear
|
|
1922
1922
|
}), onMonthChange && /*#__PURE__*/jsx(FlexBox, {
|
|
@@ -1987,7 +1987,7 @@ const DatePickerControlled = forwardRef((props, ref) => {
|
|
|
1987
1987
|
"aria-hidden": true,
|
|
1988
1988
|
children: formatDayNumber(locale, date)
|
|
1989
1989
|
}), /*#__PURE__*/jsx("span", {
|
|
1990
|
-
className:
|
|
1990
|
+
className: classNames.visuallyHidden(),
|
|
1991
1991
|
children: date.toLocaleDateString(locale, {
|
|
1992
1992
|
day: 'numeric',
|
|
1993
1993
|
month: 'long',
|
|
@@ -6256,7 +6256,7 @@ const useOverflowTooltipLabel = content => {
|
|
|
6256
6256
|
// Not inside a tooltip
|
|
6257
6257
|
!parentTooltip && labelElement &&
|
|
6258
6258
|
// Not inside a visually hidden
|
|
6259
|
-
!labelElement?.closest(`.${
|
|
6259
|
+
!labelElement?.closest(`.${classNames.visuallyHidden()}`) &&
|
|
6260
6260
|
// Text overflows
|
|
6261
6261
|
labelElement.offsetWidth < labelElement.scrollWidth) {
|
|
6262
6262
|
// Set tooltip label
|
|
@@ -6350,7 +6350,7 @@ const Text = forwardRef((props, ref) => {
|
|
|
6350
6350
|
'is-truncated': isTruncated && !isTruncatedMultiline,
|
|
6351
6351
|
'is-truncated-multiline': isTruncatedMultiline,
|
|
6352
6352
|
'no-wrap': noWrap
|
|
6353
|
-
}, [
|
|
6353
|
+
}, [classNames.typography(typography), classNames.font(color, colorVariant), className]),
|
|
6354
6354
|
title: tooltipLabel,
|
|
6355
6355
|
style: {
|
|
6356
6356
|
...truncateLinesStyle,
|
|
@@ -6622,6 +6622,13 @@ GridColumn.displayName = COMPONENT_NAME$S;
|
|
|
6622
6622
|
GridColumn.className = CLASSNAME$S;
|
|
6623
6623
|
GridColumn.defaultProps = DEFAULT_PROPS$K;
|
|
6624
6624
|
|
|
6625
|
+
/** Resolve color & color variant from a `ColorWithVariants` and optionally a `ColorVariant`. */
|
|
6626
|
+
function resolveColorWithVariants(colorWithVariants, colorVariant) {
|
|
6627
|
+
if (!colorWithVariants) return [undefined, colorVariant];
|
|
6628
|
+
const [color, baseColorVariant] = colorWithVariants.split('-');
|
|
6629
|
+
return [color, colorVariant || baseColorVariant];
|
|
6630
|
+
}
|
|
6631
|
+
|
|
6625
6632
|
/**
|
|
6626
6633
|
* Component display name.
|
|
6627
6634
|
*/
|
|
@@ -7691,7 +7698,7 @@ const InlineList = forwardRef((props, ref) => {
|
|
|
7691
7698
|
ref: ref,
|
|
7692
7699
|
className: block({
|
|
7693
7700
|
wrap: Boolean(wrap)
|
|
7694
|
-
}, [className,
|
|
7701
|
+
}, [className, classNames.font(color, colorVariant), classNames.typography(typography)])
|
|
7695
7702
|
// Lists with removed bullet style can lose their a11y list role on some browsers
|
|
7696
7703
|
,
|
|
7697
7704
|
role: "list",
|
|
@@ -7828,7 +7835,7 @@ const InputLabel = forwardRef((props, ref) => {
|
|
|
7828
7835
|
'is-required': isRequired,
|
|
7829
7836
|
[`theme-${theme}`]: Boolean(theme),
|
|
7830
7837
|
'has-custom-typography': Boolean(typography)
|
|
7831
|
-
}, [className,
|
|
7838
|
+
}, [className, classNames.typography(typography)]),
|
|
7832
7839
|
children: children
|
|
7833
7840
|
});
|
|
7834
7841
|
});
|
|
@@ -8023,7 +8030,7 @@ const Link = forwardRef((props, ref) => {
|
|
|
8023
8030
|
[`color-${color}`]: Boolean(color),
|
|
8024
8031
|
[`color-variant-${colorVariant}`]: Boolean(colorVariant),
|
|
8025
8032
|
'has-typography': Boolean(typography)
|
|
8026
|
-
}, [className,
|
|
8033
|
+
}, [className, classNames.typography(typography)]),
|
|
8027
8034
|
children: wrapChildrenIconWithSpaces(/*#__PURE__*/jsxs(Fragment, {
|
|
8028
8035
|
children: [leftIcon && /*#__PURE__*/jsx(Icon, {
|
|
8029
8036
|
icon: leftIcon,
|
|
@@ -10337,7 +10344,7 @@ const SideNavigation = forwardRef((props, ref) => {
|
|
|
10337
10344
|
return /*#__PURE__*/jsx("ul", {
|
|
10338
10345
|
ref: ref,
|
|
10339
10346
|
...forwardedProps,
|
|
10340
|
-
className: block([className, theme === Theme.dark &&
|
|
10347
|
+
className: block([className, theme === Theme.dark && classNames.font('light')]),
|
|
10341
10348
|
children: content
|
|
10342
10349
|
});
|
|
10343
10350
|
});
|
|
@@ -13471,7 +13478,7 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
13471
13478
|
className: block({
|
|
13472
13479
|
[`position-${position}`]: Boolean(position),
|
|
13473
13480
|
'is-initializing': !styles.popper?.transform
|
|
13474
|
-
}, [className, isHidden &&
|
|
13481
|
+
}, [className, isHidden && classNames.visuallyHidden()]),
|
|
13475
13482
|
style: {
|
|
13476
13483
|
...(isHidden ? undefined : styles.popper),
|
|
13477
13484
|
zIndex
|
|
@@ -13620,7 +13627,7 @@ const Uploader = forwardRef((props, ref) => {
|
|
|
13620
13627
|
}), fileInputProps && /*#__PURE__*/jsx("input", {
|
|
13621
13628
|
type: "file",
|
|
13622
13629
|
id: inputId,
|
|
13623
|
-
className: element('input', [
|
|
13630
|
+
className: element('input', [classNames.visuallyHidden()]),
|
|
13624
13631
|
...disabledStateProps,
|
|
13625
13632
|
...fileInputProps,
|
|
13626
13633
|
readOnly: isAnyDisabled,
|