@lumx/react 3.18.1 → 3.18.2-alpha.1

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.
Files changed (47) hide show
  1. package/_internal/index.js +236 -0
  2. package/_internal/index.js.map +1 -0
  3. package/index.d.ts +13 -8
  4. package/index.js +219 -226
  5. package/index.js.map +1 -1
  6. package/package.json +3 -3
  7. package/src/components/autocomplete/Autocomplete.tsx +5 -4
  8. package/src/components/autocomplete/AutocompleteMultiple.tsx +5 -3
  9. package/src/components/button/Button.stories.tsx +1 -0
  10. package/src/components/button/Button.test.tsx +41 -2
  11. package/src/components/button/ButtonRoot.tsx +10 -11
  12. package/src/components/checkbox/Checkbox.stories.tsx +13 -2
  13. package/src/components/checkbox/Checkbox.test.tsx +29 -0
  14. package/src/components/checkbox/Checkbox.tsx +8 -7
  15. package/src/components/chip/Chip.stories.tsx +17 -0
  16. package/src/components/chip/Chip.test.tsx +44 -0
  17. package/src/components/chip/Chip.tsx +10 -9
  18. package/src/components/date-picker/DatePickerField.stories.tsx +18 -0
  19. package/src/components/date-picker/DatePickerField.tsx +4 -4
  20. package/src/components/link/Link.stories.tsx +4 -1
  21. package/src/components/link/Link.test.tsx +45 -6
  22. package/src/components/link/Link.tsx +7 -6
  23. package/src/components/list/ListItem.stories.tsx +14 -48
  24. package/src/components/list/ListItem.test.tsx +78 -7
  25. package/src/components/list/ListItem.tsx +11 -9
  26. package/src/components/progress-tracker/ProgressTrackerStep.tsx +7 -7
  27. package/src/components/radio-button/RadioButton.stories.tsx +32 -0
  28. package/src/components/radio-button/RadioButton.test.tsx +30 -0
  29. package/src/components/radio-button/RadioButton.tsx +8 -7
  30. package/src/components/slider/Slider.tsx +6 -7
  31. package/src/components/switch/Switch.stories.tsx +11 -1
  32. package/src/components/switch/Switch.test.tsx +30 -0
  33. package/src/components/switch/Switch.tsx +8 -7
  34. package/src/components/table/TableRow.tsx +8 -6
  35. package/src/components/tabs/Tab.tsx +12 -9
  36. package/src/components/text-field/TextField.stories.tsx +22 -0
  37. package/src/components/text-field/TextField.test.tsx +56 -0
  38. package/src/components/text-field/TextField.tsx +12 -10
  39. package/src/utils/disabled/DisabledStateContext.tsx +29 -0
  40. package/src/utils/disabled/DisabledStateProvider.stories.tsx +88 -0
  41. package/src/utils/disabled/index.ts +2 -0
  42. package/src/utils/disabled/useDisableStateProps.tsx +37 -0
  43. package/src/utils/index.ts +1 -0
  44. package/src/utils/type/HasAriaDisabled.ts +6 -0
  45. package/utils/index.d.ts +20 -1
  46. package/utils/index.js +1 -134
  47. package/utils/index.js.map +1 -1
@@ -0,0 +1,236 @@
1
+ import React__default, { useContext, useEffect, useMemo, useRef, createContext } from 'react';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import { createPortal } from 'react-dom';
4
+
5
+ function _defineProperty(e, r, t) {
6
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
7
+ value: t,
8
+ enumerable: !0,
9
+ configurable: !0,
10
+ writable: !0
11
+ }) : e[r] = t, e;
12
+ }
13
+ function _extends() {
14
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
15
+ for (var e = 1; e < arguments.length; e++) {
16
+ var t = arguments[e];
17
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
18
+ }
19
+ return n;
20
+ }, _extends.apply(null, arguments);
21
+ }
22
+ function ownKeys(e, r) {
23
+ var t = Object.keys(e);
24
+ if (Object.getOwnPropertySymbols) {
25
+ var o = Object.getOwnPropertySymbols(e);
26
+ r && (o = o.filter(function (r) {
27
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
28
+ })), t.push.apply(t, o);
29
+ }
30
+ return t;
31
+ }
32
+ function _objectSpread2(e) {
33
+ for (var r = 1; r < arguments.length; r++) {
34
+ var t = null != arguments[r] ? arguments[r] : {};
35
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
36
+ _defineProperty(e, r, t[r]);
37
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
38
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
39
+ });
40
+ }
41
+ return e;
42
+ }
43
+ function _objectWithoutProperties(e, t) {
44
+ if (null == e) return {};
45
+ var o,
46
+ r,
47
+ i = _objectWithoutPropertiesLoose(e, t);
48
+ if (Object.getOwnPropertySymbols) {
49
+ var n = Object.getOwnPropertySymbols(e);
50
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
51
+ }
52
+ return i;
53
+ }
54
+ function _objectWithoutPropertiesLoose(r, e) {
55
+ if (null == r) return {};
56
+ var t = {};
57
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
58
+ if (-1 !== e.indexOf(n)) continue;
59
+ t[n] = r[n];
60
+ }
61
+ return t;
62
+ }
63
+ function _toPrimitive(t, r) {
64
+ if ("object" != typeof t || !t) return t;
65
+ var e = t[Symbol.toPrimitive];
66
+ if (void 0 !== e) {
67
+ var i = e.call(t, r || "default");
68
+ if ("object" != typeof i) return i;
69
+ throw new TypeError("@@toPrimitive must return a primitive value.");
70
+ }
71
+ return ("string" === r ? String : Number)(t);
72
+ }
73
+ function _toPropertyKey(t) {
74
+ var i = _toPrimitive(t, "string");
75
+ return "symbol" == typeof i ? i : i + "";
76
+ }
77
+
78
+ const _excluded = ["children"];
79
+
80
+ /** Disable state */
81
+
82
+ const DisabledStateContext = /*#__PURE__*/React__default.createContext({
83
+ state: null
84
+ });
85
+ /**
86
+ * Disabled state provider.
87
+ * All nested LumX Design System components inherit this disabled state.
88
+ */
89
+ function DisabledStateProvider(_ref) {
90
+ let {
91
+ children
92
+ } = _ref,
93
+ value = _objectWithoutProperties(_ref, _excluded);
94
+ return /*#__PURE__*/React__default.createElement(DisabledStateContext.Provider, {
95
+ value: value
96
+ }, children);
97
+ }
98
+
99
+ /**
100
+ * Get DisabledState context value
101
+ */
102
+ function useDisabledStateContext() {
103
+ return useContext(DisabledStateContext);
104
+ }
105
+
106
+ const EVENT_TYPES = ['mousedown', 'touchstart'];
107
+ function isClickAway(targets, refs) {
108
+ // The targets elements are not contained in any of the listed element references.
109
+ return !refs.some(ref => targets.some(target => {
110
+ var _ref$current;
111
+ return ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(target);
112
+ }));
113
+ }
114
+ /**
115
+ * Listen to clicks away from the given elements and callback the passed in function.
116
+ *
117
+ * Warning: If you need to detect click away on nested React portals, please use the `ClickAwayProvider` component.
118
+ */
119
+ function useClickAway({
120
+ callback,
121
+ childrenRefs
122
+ }) {
123
+ useEffect(() => {
124
+ const {
125
+ current: currentRefs
126
+ } = childrenRefs;
127
+ if (!callback || !currentRefs || isEmpty(currentRefs)) {
128
+ return undefined;
129
+ }
130
+ const listener = evt => {
131
+ var _evt$composedPath;
132
+ const targets = [(_evt$composedPath = evt.composedPath) === null || _evt$composedPath === void 0 ? void 0 : _evt$composedPath.call(evt)[0], evt.target];
133
+ if (isClickAway(targets, currentRefs)) {
134
+ callback(evt);
135
+ }
136
+ };
137
+ EVENT_TYPES.forEach(evtType => document.addEventListener(evtType, listener));
138
+ return () => {
139
+ EVENT_TYPES.forEach(evtType => document.removeEventListener(evtType, listener));
140
+ };
141
+ }, [callback, childrenRefs]);
142
+ }
143
+
144
+ const ClickAwayAncestorContext = /*#__PURE__*/createContext(null);
145
+ /**
146
+ * Component combining the `useClickAway` hook with a React context to hook into the React component tree and make sure
147
+ * we take into account both the DOM tree and the React tree to detect click away.
148
+ *
149
+ * @return the react component.
150
+ */
151
+ const ClickAwayProvider = ({
152
+ children,
153
+ callback,
154
+ childrenRefs,
155
+ parentRef
156
+ }) => {
157
+ const parentContext = useContext(ClickAwayAncestorContext);
158
+ const currentContext = useMemo(() => {
159
+ const context = {
160
+ childrenRefs: [],
161
+ /**
162
+ * Add element refs to the current context and propagate to the parent context.
163
+ */
164
+ addRefs(...newChildrenRefs) {
165
+ // Add element refs that should be considered as inside the click away context.
166
+ context.childrenRefs.push(...newChildrenRefs);
167
+ if (parentContext) {
168
+ // Also add then to the parent context
169
+ parentContext.addRefs(...newChildrenRefs);
170
+ if (parentRef) {
171
+ // The parent element is also considered as inside the parent click away context but not inside the current context
172
+ parentContext.addRefs(parentRef);
173
+ }
174
+ }
175
+ }
176
+ };
177
+ return context;
178
+ }, [parentContext, parentRef]);
179
+ useEffect(() => {
180
+ const {
181
+ current: currentRefs
182
+ } = childrenRefs;
183
+ if (!currentRefs) {
184
+ return;
185
+ }
186
+ currentContext.addRefs(...currentRefs);
187
+ }, [currentContext, childrenRefs]);
188
+ useClickAway({
189
+ callback,
190
+ childrenRefs: useRef(currentContext.childrenRefs)
191
+ });
192
+ return /*#__PURE__*/React__default.createElement(ClickAwayAncestorContext.Provider, {
193
+ value: currentContext
194
+ }, children);
195
+ };
196
+ ClickAwayProvider.displayName = 'ClickAwayProvider';
197
+
198
+ /**
199
+ * Portal initializing function.
200
+ * If it does not provide a container, the Portal children will render in classic React tree and not in a portal.
201
+ */
202
+
203
+ const PortalContext = /*#__PURE__*/React__default.createContext(() => ({
204
+ container: document.body
205
+ }));
206
+ /**
207
+ * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)
208
+ */
209
+ const PortalProvider = PortalContext.Provider;
210
+
211
+ /**
212
+ * Render children in a portal outside the current DOM position
213
+ * (defaults to `document.body` but can be customized with the PortalContextProvider)
214
+ */
215
+ const Portal = ({
216
+ children,
217
+ enabled = true
218
+ }) => {
219
+ const init = React__default.useContext(PortalContext);
220
+ const context = React__default.useMemo(() => {
221
+ return enabled ? init() : null;
222
+ },
223
+ // Only update on 'enabled'
224
+ // eslint-disable-next-line react-hooks/exhaustive-deps
225
+ [enabled]);
226
+ React__default.useLayoutEffect(() => {
227
+ return context === null || context === void 0 ? void 0 : context.teardown;
228
+ }, [context === null || context === void 0 ? void 0 : context.teardown, enabled]);
229
+ if (!(context !== null && context !== void 0 && context.container)) {
230
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
231
+ }
232
+ return /*#__PURE__*/createPortal(children, context.container);
233
+ };
234
+
235
+ export { ClickAwayProvider as C, DisabledStateProvider as D, Portal as P, _objectSpread2 as _, _objectWithoutProperties as a, _extends as b, PortalProvider as c, useDisabledStateContext as u };
236
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/disabled/DisabledStateContext.tsx","../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx","../../src/utils/Portal/PortalProvider.tsx","../../src/utils/Portal/Portal.tsx"],"sourcesContent":["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 { 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 React, { 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"],"names":["DisabledStateContext","React","createContext","state","DisabledStateProvider","_ref","children","value","_objectWithoutProperties","_excluded","createElement","Provider","useDisabledStateContext","useContext","EVENT_TYPES","isClickAway","targets","refs","some","ref","target","_ref$current","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","_evt$composedPath","composedPath","call","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","ClickAwayProvider","parentRef","parentContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","displayName","PortalContext","container","body","PortalProvider","Portal","enabled","init","useLayoutEffect","teardown","Fragment","createPortal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAOO,MAAMA,oBAAoB,gBAAGC,cAAK,CAACC,aAAa,CAA4B;AAAEC,EAAAA,KAAK,EAAE,IAAA;AAAK,CAAC,CAAC,CAAA;AAMnG;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CAAAC,IAAA,EAAqD;EAAA,IAApD;AAAEC,MAAAA,QAAAA;AAA+C,KAAC,GAAAD,IAAA;AAAnCE,IAAAA,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA,CAAA,CAAA;AACtD,EAAA,oBAAOR,cAAA,CAAAS,aAAA,CAACV,oBAAoB,CAACW,QAAQ,EAAA;AAACJ,IAAAA,KAAK,EAAEA,KAAAA;AAAM,GAAA,EAAED,QAAwC,CAAC,CAAA;AAClG,CAAA;;AAEA;AACA;AACA;AACO,SAASM,uBAAuBA,GAA8B;EACjE,OAAOC,UAAU,CAACb,oBAAoB,CAAC,CAAA;AAC3C;;ACtBA,MAAMc,WAAW,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;AAE/C,SAASC,WAAWA,CAACC,OAAsB,EAAEC,IAAmC,EAAW;AACvF;EACA,OAAO,CAACA,IAAI,CAACC,IAAI,CAAEC,GAAG,IAAKH,OAAO,CAACE,IAAI,CAAEE,MAAM,IAAA;AAAA,IAAA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AA,CAAAA,GAAAA,OAAO,CAAEc,QAAQ,CAAA;AAC5B,GAAC,EAAE,CAACd,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAPA,OAAO,CAAEc,QAAQ,EAAEH,OAAO,CAAC,CAAC,CAAA;EAEhC,IAAI,EAACX,OAAO,KAAPA,IAAAA,IAAAA,OAAO,eAAPA,OAAO,CAAEO,SAAS,CAAE,EAAA;IACrB,oBAAOrD,cAAA,CAAAS,aAAA,CAAAT,cAAA,CAAA6D,QAAA,EAAGxD,IAAAA,EAAAA,QAAW,CAAC,CAAA;AAC1B,GAAA;AACA,EAAA,oBAAOyD,YAAY,CAACzD,QAAQ,EAAEyC,OAAO,CAACO,SAAS,CAAC,CAAA;AACpD;;;;"}
package/index.d.ts CHANGED
@@ -578,12 +578,17 @@ interface BadgeWrapperProps extends GenericProps {
578
578
  }
579
579
  declare const BadgeWrapper: Comp<BadgeWrapperProps, HTMLDivElement>;
580
580
 
581
+ interface HasAriaDisabled {
582
+ /** Similar to `disabled` but does not block pointer events or focus */
583
+ 'aria-disabled'?: AriaAttributes['aria-disabled'];
584
+ }
585
+
581
586
  type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
582
587
  /**
583
588
  * Button size definition.
584
589
  */
585
590
  type ButtonSize = Extract<Size, 's' | 'm'>;
586
- interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label' | 'aria-disabled'>, HasTheme {
591
+ interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>, HasTheme, HasAriaDisabled {
587
592
  /** Color variant. */
588
593
  color?: ColorPalette;
589
594
  /** Emphasis variant. */
@@ -693,7 +698,7 @@ declare const ButtonGroup: Comp<ButtonGroupProps, HTMLDivElement>;
693
698
  /**
694
699
  * Defines the props of the component.
695
700
  */
696
- interface CheckboxProps extends GenericProps, HasTheme {
701
+ interface CheckboxProps extends GenericProps, HasTheme, HasAriaDisabled {
697
702
  /** Helper text. */
698
703
  helper?: string;
699
704
  /** Native input id property. */
@@ -731,7 +736,7 @@ type ChipSize = Extract<Size, 's' | 'm'>;
731
736
  /**
732
737
  * Defines the props of the component.
733
738
  */
734
- interface ChipProps extends GenericProps, HasTheme {
739
+ interface ChipProps extends GenericProps, HasTheme, HasAriaDisabled {
735
740
  /** A component to be rendered after the content. */
736
741
  after?: ReactNode;
737
742
  /** A component to be rendered before the content. */
@@ -1920,7 +1925,7 @@ type HTMLAnchorProps = React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAn
1920
1925
  /**
1921
1926
  * Defines the props of the component.
1922
1927
  */
1923
- interface LinkProps extends GenericProps {
1928
+ interface LinkProps extends GenericProps, HasAriaDisabled {
1924
1929
  /** Color variant. */
1925
1930
  color?: ColorWithVariants;
1926
1931
  /** Lightened or darkened variant of the selected icon color. */
@@ -2032,7 +2037,7 @@ type ListItemSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;
2032
2037
  /**
2033
2038
  * Defines the props of the component.
2034
2039
  */
2035
- interface ListItemProps extends GenericProps {
2040
+ interface ListItemProps extends GenericProps, HasAriaDisabled {
2036
2041
  /** A component to be rendered after the content. */
2037
2042
  after?: ReactNode;
2038
2043
  /** A component to be rendered before the content. */
@@ -2439,7 +2444,7 @@ declare const ProgressTrackerStepPanel: Comp<ProgressTrackerStepPanelProps, HTML
2439
2444
  /**
2440
2445
  * Defines the props of the component.
2441
2446
  */
2442
- interface RadioButtonProps extends GenericProps, HasTheme {
2447
+ interface RadioButtonProps extends GenericProps, HasTheme, HasAriaDisabled {
2443
2448
  /** Helper text. */
2444
2449
  helper?: string;
2445
2450
  /** Native input id property. */
@@ -2933,7 +2938,7 @@ declare const Slides: Comp<SlidesProps, HTMLDivElement>;
2933
2938
  /**
2934
2939
  * Defines the props of the component.
2935
2940
  */
2936
- interface SwitchProps extends GenericProps, HasTheme {
2941
+ interface SwitchProps extends GenericProps, HasTheme, HasAriaDisabled {
2937
2942
  /** Helper text. */
2938
2943
  helper?: string;
2939
2944
  /** Whether it is checked or not. */
@@ -3184,7 +3189,7 @@ declare const TabPanel: Comp<TabPanelProps, HTMLDivElement>;
3184
3189
  /**
3185
3190
  * Defines the props of the component.
3186
3191
  */
3187
- interface TextFieldProps extends GenericProps, HasTheme {
3192
+ interface TextFieldProps extends GenericProps, HasTheme, HasAriaDisabled {
3188
3193
  /** Chip Group to be rendered before the main text input. */
3189
3194
  chips?: ReactNode;
3190
3195
  /** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */