@lumx/react 4.11.0-next.9 → 4.12.0-alpha.0
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/{Dpulze-1.js → BvaFEHZn.js} +69 -2
- package/_internal/BvaFEHZn.js.map +1 -0
- package/index.d.ts +309 -28
- package/index.js +1096 -493
- package/index.js.map +1 -1
- package/package.json +5 -5
- package/utils/index.js +2 -69
- package/utils/index.js.map +1 -1
- package/_internal/Dpulze-1.js.map +0 -1
|
@@ -154,6 +154,73 @@ const ClickAwayProvider = ({
|
|
|
154
154
|
};
|
|
155
155
|
ClickAwayProvider.displayName = 'ClickAwayProvider';
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Sets up an IntersectionObserver on the given element.
|
|
159
|
+
* Calls `callback` when at least one observed entry is intersecting.
|
|
160
|
+
* Returns a cleanup function that unobserves the element.
|
|
161
|
+
*/
|
|
162
|
+
function setupInfiniteScrollObserver(element, callback, options) {
|
|
163
|
+
const observer = new IntersectionObserver((entries = []) => {
|
|
164
|
+
const hasIntersection = entries.some(entry => entry.isIntersecting);
|
|
165
|
+
if (!hasIntersection) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
callback();
|
|
169
|
+
}, options);
|
|
170
|
+
observer.observe(element);
|
|
171
|
+
return () => {
|
|
172
|
+
observer.unobserve(element);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const INFINITE_SCROLL_CLASSNAME = 'lumx-infinite-scroll-anchor';
|
|
177
|
+
/**
|
|
178
|
+
* Framework-agnostic InfiniteScroll sentinel component.
|
|
179
|
+
*
|
|
180
|
+
* Renders a tiny invisible div that triggers a callback when it enters the viewport
|
|
181
|
+
* (or intersects its root element) via IntersectionObserver.
|
|
182
|
+
*
|
|
183
|
+
* The div has a small height (4px) to avoid issues when a browser zoom is applied,
|
|
184
|
+
* where a zero-height element might not trigger IntersectionObserver reliably.
|
|
185
|
+
*/
|
|
186
|
+
const InfiniteScroll$1 = ({
|
|
187
|
+
ref
|
|
188
|
+
}) =>
|
|
189
|
+
/*#__PURE__*/
|
|
190
|
+
// In order to avoid issues when a zoom is added to the browser, we add a small height to the div so that
|
|
191
|
+
// the intersection has a higher chance of working correctly.
|
|
192
|
+
jsx("div", {
|
|
193
|
+
ref: ref,
|
|
194
|
+
"aria-hidden": "true",
|
|
195
|
+
className: INFINITE_SCROLL_CLASSNAME,
|
|
196
|
+
style: {
|
|
197
|
+
height: '4px'
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Handles basic callback pattern by using intersection observers.
|
|
203
|
+
*/
|
|
204
|
+
const InfiniteScroll = ({
|
|
205
|
+
callback,
|
|
206
|
+
options
|
|
207
|
+
}) => {
|
|
208
|
+
const elementRef = React__default.useRef(null);
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
const {
|
|
211
|
+
current: element
|
|
212
|
+
} = elementRef;
|
|
213
|
+
if (!element) {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
return setupInfiniteScrollObserver(element, callback, options);
|
|
217
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
218
|
+
}, [elementRef.current, callback]);
|
|
219
|
+
return InfiniteScroll$1({
|
|
220
|
+
ref: elementRef
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
|
|
157
224
|
const PortalContext = /*#__PURE__*/React__default.createContext(() => ({
|
|
158
225
|
container: document.body
|
|
159
226
|
}));
|
|
@@ -191,5 +258,5 @@ const Portal = ({
|
|
|
191
258
|
return /*#__PURE__*/createPortal(children, container);
|
|
192
259
|
};
|
|
193
260
|
|
|
194
|
-
export { ClickAwayProvider as C, DisabledStateProvider as D, Portal as P, PortalProvider as a, useDisabledStateContext as u };
|
|
195
|
-
//# sourceMappingURL=
|
|
261
|
+
export { ClickAwayProvider as C, DisabledStateProvider as D, InfiniteScroll as I, Portal as P, PortalProvider as a, useDisabledStateContext as u };
|
|
262
|
+
//# sourceMappingURL=BvaFEHZn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BvaFEHZn.js","sources":["../../src/utils/disabled/DisabledStateContext.tsx","../../../lumx-core/src/js/utils/ClickAway/index.ts","../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx","../../../lumx-core/src/js/utils/InfiniteScroll/setupInfiniteScrollObserver.ts","../../../lumx-core/src/js/utils/InfiniteScroll/index.tsx","../../src/utils/InfiniteScroll/InfiniteScroll.tsx","../../src/utils/Portal/PortalProvider.tsx","../../src/utils/Portal/Portal.tsx"],"sourcesContent":["import React, { useContext } from 'react';\n\nimport { DisabledStateContextValue } from '@lumx/core/js/utils/disabledState';\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","/**\n * Shared types and logic for ClickAway detection.\n *\n * ClickAway detects clicks outside a set of elements and triggers a callback.\n * The core logic (event listening + target checking) is framework-agnostic.\n * Framework-specific wrappers (React hook, Vue composable) and context providers\n * (React context, Vue provide/inject) are implemented in each framework package.\n */\n\nimport type { Falsy } from '@lumx/core/js/types';\n\n/** Event types that trigger click away detection. */\nexport const CLICK_AWAY_EVENT_TYPES = ['mousedown', 'touchstart'] as const;\n\n/** Callback triggered when a click away is detected. */\nexport type ClickAwayCallback = EventListener | Falsy;\n\n/**\n * Check if the click event targets are outside all the given elements.\n *\n * @param targets - The event target elements (from `event.target` and `event.composedPath()`).\n * @param elements - The elements considered \"inside\" the click away context.\n * @returns `true` if the click is outside all elements (i.e. a click away).\n */\nexport function isClickAway(targets: HTMLElement[], elements: HTMLElement[]): boolean {\n return !elements.some((element) => element instanceof Node && targets.some((target) => element.contains(target)));\n}\n\n/**\n * Imperative setup for click away detection.\n * Adds mousedown/touchstart listeners on `document` and calls the callback when a click\n * occurs outside the elements returned by `getElements`.\n *\n * Note: when `getElements` returns an empty array, any click is considered a click away.\n * Callers should guard against calling `setupClickAway` when no refs are registered.\n *\n * @param getElements - Getter returning the current list of elements considered \"inside\".\n * @param callback - Callback to invoke on click away.\n * @returns A teardown function that removes the event listeners.\n */\nexport function setupClickAway(\n getElements: () => HTMLElement[],\n callback: ClickAwayCallback,\n): (() => void) | undefined {\n if (!callback) {\n return undefined;\n }\n\n const listener: EventListener = (evt) => {\n const targets = [evt.composedPath?.()[0], evt.target].filter((t): t is HTMLElement => t instanceof Node);\n const elements = getElements();\n if (isClickAway(targets, elements)) {\n callback(evt);\n }\n };\n\n CLICK_AWAY_EVENT_TYPES.forEach((evtType) => document.addEventListener(evtType, listener));\n return () => {\n CLICK_AWAY_EVENT_TYPES.forEach((evtType) => document.removeEventListener(evtType, listener));\n };\n}\n","import { RefObject, useEffect } from 'react';\n\nimport { Falsy } from '@lumx/react/utils/type';\nimport { setupClickAway } from '@lumx/core/js/utils/ClickAway';\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 getElements = () => {\n const refs = childrenRefs.current;\n if (!refs) return [];\n return refs.map((ref) => ref?.current).filter(Boolean) as HTMLElement[];\n };\n return setupClickAway(getElements, callback);\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","type EventCallback = (evt?: Event) => void;\n\n/**\n * Sets up an IntersectionObserver on the given element.\n * Calls `callback` when at least one observed entry is intersecting.\n * Returns a cleanup function that unobserves the element.\n */\nexport function setupInfiniteScrollObserver(\n element: Element,\n callback: EventCallback,\n options?: IntersectionObserverInit,\n): () => void {\n const observer = new IntersectionObserver((entries = []) => {\n const hasIntersection = entries.some((entry) => entry.isIntersecting);\n\n if (!hasIntersection) {\n return;\n }\n\n callback();\n }, options);\n\n observer.observe(element);\n\n return () => {\n observer.unobserve(element);\n };\n}\n","import type { CommonRef } from '../../types';\n\nexport { setupInfiniteScrollObserver } from './setupInfiniteScrollObserver';\n\nexport const INFINITE_SCROLL_CLASSNAME = 'lumx-infinite-scroll-anchor';\n\nexport interface InfiniteScrollProps {\n /** Callback when infinite scroll component is in view */\n // eslint-disable-next-line react/no-unused-prop-types\n callback: (evt?: Event) => void;\n /** Customize intersection observer option */\n // eslint-disable-next-line react/no-unused-prop-types\n options?: IntersectionObserverInit;\n}\n\n/**\n * Framework-agnostic InfiniteScroll sentinel component.\n *\n * Renders a tiny invisible div that triggers a callback when it enters the viewport\n * (or intersects its root element) via IntersectionObserver.\n *\n * The div has a small height (4px) to avoid issues when a browser zoom is applied,\n * where a zero-height element might not trigger IntersectionObserver reliably.\n */\nexport const InfiniteScroll = ({ ref }: { ref?: CommonRef }) => (\n // In order to avoid issues when a zoom is added to the browser, we add a small height to the div so that\n // the intersection has a higher chance of working correctly.\n <div ref={ref} aria-hidden=\"true\" className={INFINITE_SCROLL_CLASSNAME} style={{ height: '4px' }} />\n);\n","import React, { useEffect } from 'react';\nimport {\n InfiniteScroll as UI,\n type InfiniteScrollProps,\n setupInfiniteScrollObserver,\n} from '@lumx/core/js/utils/InfiniteScroll';\n\nexport type { InfiniteScrollProps };\n\n/**\n * Handles basic callback pattern by using intersection observers.\n */\nexport const InfiniteScroll: React.FC<InfiniteScrollProps> = ({ callback, options }) => {\n const elementRef = React.useRef<HTMLDivElement | null>(null);\n\n useEffect(() => {\n const { current: element } = elementRef;\n if (!element) {\n return undefined;\n }\n\n return setupInfiniteScrollObserver(element, callback, options);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [elementRef.current, callback]);\n\n return UI({ ref: elementRef });\n};\n","import React from 'react';\nimport type { PortalInit } from '@lumx/core/js/utils/Portal';\n\nexport type { PortalInit, PortalProviderProps } from '@lumx/core/js/utils/Portal';\n\nexport const PortalContext = React.createContext<PortalInit>(() => ({ container: document.body }));\n\nexport interface ReactPortalProviderProps {\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<ReactPortalProviderProps> = PortalContext.Provider;\n","import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { PortalContext } from './PortalProvider';\n\nexport type { PortalProps } from '@lumx/core/js/utils/Portal';\n\nexport interface ReactPortalProps {\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<ReactPortalProps> = ({ 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 const { container } = context ?? {};\n if (!container || typeof container === 'string') {\n return <>{children}</>;\n }\n return createPortal(children, container);\n};\n"],"names":["DisabledStateContext","React","createContext","state","DisabledStateProvider","children","value","_jsx","Provider","useDisabledStateContext","useContext","CLICK_AWAY_EVENT_TYPES","isClickAway","targets","elements","some","element","Node","target","contains","setupClickAway","getElements","callback","undefined","listener","evt","composedPath","filter","t","forEach","evtType","document","addEventListener","removeEventListener","useClickAway","childrenRefs","useEffect","refs","current","map","ref","Boolean","ClickAwayAncestorContext","ClickAwayProvider","parentRef","parentContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","currentRefs","useRef","displayName","setupInfiniteScrollObserver","options","observer","IntersectionObserver","entries","hasIntersection","entry","isIntersecting","observe","unobserve","INFINITE_SCROLL_CLASSNAME","InfiniteScroll","className","style","height","elementRef","UI","PortalContext","container","body","PortalProvider","Portal","enabled","init","useLayoutEffect","teardown","_Fragment","createPortal"],"mappings":";;;;AAIO,MAAMA,oBAAoB,gBAAGC,cAAK,CAACC,aAAa,CAA4B;AAAEC,EAAAA,KAAK,EAAE;AAAK,CAAC,CAAC;AAMnG;AACA;AACA;AACA;AACO,SAASC,qBAAqBA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAkC,CAAC,EAAE;AACtF,EAAA,oBAAOC,GAAA,CAACP,oBAAoB,CAACQ,QAAQ,EAAA;AAACF,IAAAA,KAAK,EAAEA,KAAM;AAAAD,IAAAA,QAAA,EAAEA;AAAQ,GAAgC,CAAC;AAClG;;AAEA;AACA;AACA;AACO,SAASI,uBAAuBA,GAA8B;EACjE,OAAOC,UAAU,CAACV,oBAAoB,CAAC;AAC3C;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACO,MAAMW,sBAAsB,GAAG,CAAC,WAAW,EAAE,YAAY,CAAU;;AAE1E;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAACC,OAAsB,EAAEC,QAAuB,EAAW;EAClF,OAAO,CAACA,QAAQ,CAACC,IAAI,CAAEC,OAAO,IAAKA,OAAO,YAAYC,IAAI,IAAIJ,OAAO,CAACE,IAAI,CAAEG,MAAM,IAAKF,OAAO,CAACG,QAAQ,CAACD,MAAM,CAAC,CAAC,CAAC;AACrH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAC1BC,WAAgC,EAChCC,QAA2B,EACH;EACxB,IAAI,CAACA,QAAQ,EAAE;AACX,IAAA,OAAOC,SAAS;AACpB,EAAA;EAEA,MAAMC,QAAuB,GAAIC,GAAG,IAAK;IACrC,MAAMZ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C;AAC1B,EAAA;AACA,EAAA,oBAAO6E,YAAY,CAAC7E,QAAQ,EAAEoE,SAAS,CAAC;AAC5C;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as _lumx_core_js_types from '@lumx/core/js/types';
|
|
|
4
4
|
import { ValueOf as ValueOf$1, GenericProps as GenericProps$1, HasTheme as HasTheme$1, PropsToOverride, HasAriaDisabled as HasAriaDisabled$1, HasRequiredLinkHref as HasRequiredLinkHref$1, HasClassName as HasClassName$1, HasCloseMode as HasCloseMode$1, JSXElement as JSXElement$1, CommonRef as CommonRef$1, Falsy, HeadingElement as HeadingElement$1, HasAriaLabelOrLabelledBy as HasAriaLabelOrLabelledBy$1 } from '@lumx/core/js/types';
|
|
5
5
|
export * from '@lumx/core/js/types';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
|
-
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, SetStateAction, Key, CSSProperties, ElementType as ElementType$1, HTMLInputTypeAttribute, ComponentProps, ImgHTMLAttributes
|
|
7
|
+
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, SetStateAction, Key, CSSProperties, ElementType as ElementType$1, HTMLInputTypeAttribute, ComponentProps, ImgHTMLAttributes } from 'react';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
/** LumX Component Type. */
|
|
@@ -589,6 +589,7 @@ interface AutocompleteProps extends GenericProps$1, HasTheme$1 {
|
|
|
589
589
|
/**
|
|
590
590
|
* Autocomplete component.
|
|
591
591
|
*
|
|
592
|
+
* @deprecated use `SelectTextField` instead
|
|
592
593
|
* @param props Component props.
|
|
593
594
|
* @param ref Component ref.
|
|
594
595
|
* @return React element.
|
|
@@ -608,7 +609,8 @@ interface AutocompleteMultipleProps extends AutocompleteProps {
|
|
|
608
609
|
}
|
|
609
610
|
/**
|
|
610
611
|
* AutocompleteMultiple component.
|
|
611
|
-
|
|
612
|
+
|
|
613
|
+
* @deprecated use `SelectTextField` instead
|
|
612
614
|
* @param props Component props.
|
|
613
615
|
* @param ref Component ref.
|
|
614
616
|
* @return React element.
|
|
@@ -1335,6 +1337,14 @@ interface ComboboxStateProps$1 {
|
|
|
1335
1337
|
* When omitted, the empty state is not shown.
|
|
1336
1338
|
*/
|
|
1337
1339
|
emptyMessage?: string | ((inputValue: string) => string);
|
|
1340
|
+
/**
|
|
1341
|
+
* Message callback to display the number of available options.
|
|
1342
|
+
* Called with the current visible option count and should return a human-readable string
|
|
1343
|
+
* (e.g. `(n) => \`${n} result(s) available\``).
|
|
1344
|
+
* Displayed when the combobox is open, not empty, not loading, and not in error.
|
|
1345
|
+
* When omitted, no option count message is shown.
|
|
1346
|
+
*/
|
|
1347
|
+
nbOptionMessage?: (optionsLength: number) => string;
|
|
1338
1348
|
/**
|
|
1339
1349
|
* Error state title message.
|
|
1340
1350
|
* When provided, the error state is active (takes priority over the empty state).
|
|
@@ -1356,10 +1366,10 @@ interface ComboboxStateProps$1 {
|
|
|
1356
1366
|
*/
|
|
1357
1367
|
state?: {
|
|
1358
1368
|
/**
|
|
1359
|
-
*
|
|
1360
|
-
* Driven by the framework wrapper via the combobox handle's `
|
|
1369
|
+
* The number of currently visible options.
|
|
1370
|
+
* Driven by the framework wrapper via the combobox handle's `optionsChange` event.
|
|
1361
1371
|
*/
|
|
1362
|
-
|
|
1372
|
+
optionsLength?: number;
|
|
1363
1373
|
/**
|
|
1364
1374
|
* The current value of the combobox input.
|
|
1365
1375
|
* Passed to `emptyMessage` when it is a function.
|
|
@@ -1856,6 +1866,17 @@ interface TextFieldProps$1 extends HasClassName, HasTheme, HasAriaDisabled, HasD
|
|
|
1856
1866
|
}
|
|
1857
1867
|
type TextFieldPropsToOverride = 'input' | 'IconButton' | 'labelProps' | 'textFieldRef' | 'clearButtonProps' | 'helperId' | 'errorId' | 'labelId' | 'isAnyDisabled' | 'isFocus';
|
|
1858
1868
|
|
|
1869
|
+
interface InputLabelProps extends ReactToJSX<InputLabelProps$1>, GenericProps$1 {
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* InputLabel component.
|
|
1873
|
+
*
|
|
1874
|
+
* @param props Component props.
|
|
1875
|
+
* @param ref Component ref.
|
|
1876
|
+
* @return React element.
|
|
1877
|
+
*/
|
|
1878
|
+
declare const InputLabel: Comp<InputLabelProps, HTMLLabelElement>;
|
|
1879
|
+
|
|
1859
1880
|
/**
|
|
1860
1881
|
* Defines the props of the component.
|
|
1861
1882
|
*/
|
|
@@ -2011,6 +2032,8 @@ interface ComboboxButtonProps$1 extends HasClassName {
|
|
|
2011
2032
|
interface ComboboxProviderProps {
|
|
2012
2033
|
/** Combobox content. */
|
|
2013
2034
|
children?: ReactNode;
|
|
2035
|
+
/** Callback fired when the combobox open state changes. */
|
|
2036
|
+
onOpen?: (isOpen: boolean) => void;
|
|
2014
2037
|
}
|
|
2015
2038
|
/**
|
|
2016
2039
|
* Combobox.Provider component.
|
|
@@ -2033,11 +2056,11 @@ interface ComboboxEventMap {
|
|
|
2033
2056
|
/** Fired when the active descendant changes (visual focus). Payload: the option id or null. */
|
|
2034
2057
|
activeDescendantChange: string | null;
|
|
2035
2058
|
/**
|
|
2036
|
-
* Fired when the visible option count
|
|
2037
|
-
* Payload:
|
|
2059
|
+
* Fired when the visible option count changes.
|
|
2060
|
+
* Payload: the number of visible options plus the current input value.
|
|
2038
2061
|
*/
|
|
2039
|
-
|
|
2040
|
-
|
|
2062
|
+
optionsChange: {
|
|
2063
|
+
optionsLength: number;
|
|
2041
2064
|
inputValue?: string;
|
|
2042
2065
|
} | undefined;
|
|
2043
2066
|
/**
|
|
@@ -2331,7 +2354,6 @@ interface DialogProps extends GenericProps$1, HasCloseMode$1, BaseDialogProps {
|
|
|
2331
2354
|
/** Children */
|
|
2332
2355
|
children?: React__default.ReactNode;
|
|
2333
2356
|
}
|
|
2334
|
-
|
|
2335
2357
|
/**
|
|
2336
2358
|
* Dialog component.
|
|
2337
2359
|
*
|
|
@@ -3269,33 +3291,25 @@ interface InputHelperProps extends ReactToJSX<InputHelperProps$1>, GenericProps$
|
|
|
3269
3291
|
*/
|
|
3270
3292
|
declare const InputHelper: Comp<InputHelperProps, HTMLParagraphElement>;
|
|
3271
3293
|
|
|
3272
|
-
interface
|
|
3294
|
+
interface BaseLightboxProps extends HasClassName, HasTheme, Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'> {
|
|
3295
|
+
/** Whether the component is open or not. */
|
|
3296
|
+
isOpen?: boolean;
|
|
3297
|
+
/** Whether to keep the dialog open on clickaway or escape press. */
|
|
3298
|
+
preventAutoClose?: boolean;
|
|
3299
|
+
/** Z-axis position. */
|
|
3300
|
+
zIndex?: number;
|
|
3273
3301
|
}
|
|
3274
|
-
/**
|
|
3275
|
-
* InputLabel component.
|
|
3276
|
-
*
|
|
3277
|
-
* @param props Component props.
|
|
3278
|
-
* @param ref Component ref.
|
|
3279
|
-
* @return React element.
|
|
3280
|
-
*/
|
|
3281
|
-
declare const InputLabel: Comp<InputLabelProps, HTMLLabelElement>;
|
|
3282
3302
|
|
|
3283
3303
|
/**
|
|
3284
3304
|
* Defines the props of the component.
|
|
3285
3305
|
*/
|
|
3286
|
-
interface LightboxProps extends GenericProps$1,
|
|
3306
|
+
interface LightboxProps extends GenericProps$1, ReactToJSX<BaseLightboxProps> {
|
|
3287
3307
|
/** Props to pass to the close button (minus those already set by the Lightbox props). */
|
|
3288
3308
|
closeButtonProps?: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
|
|
3289
|
-
/** Whether the component is open or not. */
|
|
3290
|
-
isOpen?: boolean;
|
|
3291
3309
|
/** Reference to the element that triggered modal opening to set focus on. */
|
|
3292
3310
|
parentElement: RefObject<any>;
|
|
3293
3311
|
/** Reference to the element that should get the focus when the lightbox opens. By default, the close button or the lightbox itself will take focus. */
|
|
3294
3312
|
focusElement?: RefObject<HTMLElement>;
|
|
3295
|
-
/** Whether to keep the dialog open on clickaway or escape press. */
|
|
3296
|
-
preventAutoClose?: boolean;
|
|
3297
|
-
/** Z-axis position. */
|
|
3298
|
-
zIndex?: number;
|
|
3299
3313
|
/** On close callback. */
|
|
3300
3314
|
onClose?(): void;
|
|
3301
3315
|
/** Children */
|
|
@@ -3922,6 +3936,7 @@ interface SelectProps extends CoreSelectProps {
|
|
|
3922
3936
|
/**
|
|
3923
3937
|
* Select component.
|
|
3924
3938
|
*
|
|
3939
|
+
* @deprecated use `SelectTextField` instead
|
|
3925
3940
|
* @param props Component props.
|
|
3926
3941
|
* @param ref Component ref.
|
|
3927
3942
|
* @return React element.
|
|
@@ -3939,12 +3954,278 @@ declare const SelectMultipleField: React.FC<SelectMultipleProps>;
|
|
|
3939
3954
|
/**
|
|
3940
3955
|
* SelectMultiple component.
|
|
3941
3956
|
*
|
|
3957
|
+
* @deprecated use `SelectTextField` instead
|
|
3942
3958
|
* @param props Component props.
|
|
3943
3959
|
* @param ref Component ref.
|
|
3944
3960
|
* @return React element.
|
|
3945
3961
|
*/
|
|
3946
3962
|
declare const SelectMultiple: Comp<SelectMultipleProps, HTMLDivElement>;
|
|
3947
3963
|
|
|
3964
|
+
/**
|
|
3965
|
+
* Status of the SelectTextField dropdown list.
|
|
3966
|
+
*
|
|
3967
|
+
* - `'idle'` — Default state, no loading indicators.
|
|
3968
|
+
* - `'loading'` — Full loading: shows skeleton placeholders, hides real options.
|
|
3969
|
+
* - `'loadingMore'` — Paginated loading: appends a skeleton after existing options.
|
|
3970
|
+
* - `'error'` — Error state: shows an error message in the dropdown.
|
|
3971
|
+
*/
|
|
3972
|
+
type SelectTextFieldStatus = 'idle' | 'loading' | 'loadingMore' | 'error';
|
|
3973
|
+
/**
|
|
3974
|
+
* Context passed to the `renderOption` callback alongside the option object.
|
|
3975
|
+
* Contains core-computed values that the consumer should forward to `<Combobox.Option>`.
|
|
3976
|
+
*/
|
|
3977
|
+
interface RenderOptionContext {
|
|
3978
|
+
/** Index of the option in the current (possibly section-filtered) list. */
|
|
3979
|
+
index: number;
|
|
3980
|
+
/** Resolved option id (from `getOptionId`). Should be passed as `value` to `<Combobox.Option>`. */
|
|
3981
|
+
value: any;
|
|
3982
|
+
/** Whether this option is currently selected. Should be forwarded as `isSelected`. */
|
|
3983
|
+
isSelected: boolean;
|
|
3984
|
+
/** Resolved description string (from `getOptionDescription`), if any. Should be forwarded as `description`. */
|
|
3985
|
+
description?: string | null;
|
|
3986
|
+
}
|
|
3987
|
+
interface BaseSelectProps<O> {
|
|
3988
|
+
/** List of option objects. */
|
|
3989
|
+
options?: Array<O>;
|
|
3990
|
+
/** Option object id selector. */
|
|
3991
|
+
getOptionId: Selector<O>;
|
|
3992
|
+
/** Option object name selector (falls back to id if not defined). */
|
|
3993
|
+
getOptionName?: Selector<O, string | undefined | null>;
|
|
3994
|
+
/** Option object description selector. */
|
|
3995
|
+
getOptionDescription?: Selector<O, string | undefined | null>;
|
|
3996
|
+
/**
|
|
3997
|
+
* Custom option render function (core/Vue contract).
|
|
3998
|
+
* Receives the option object and a `RenderOptionContext` with core-computed props (`value`,
|
|
3999
|
+
* `isSelected`, `description`, `index`). The callee must render a `<Combobox.Option>` and
|
|
4000
|
+
* forward those context values, including a unique `key`.
|
|
4001
|
+
*
|
|
4002
|
+
* @example (Vue / core level)
|
|
4003
|
+
* renderOption={(fruit, { value, isSelected, description }) => (
|
|
4004
|
+
* <Combobox.Option key={value} value={value} isSelected={isSelected} description={description}>
|
|
4005
|
+
* <strong>{fruit.name}</strong>
|
|
4006
|
+
* </Combobox.Option>
|
|
4007
|
+
* )}
|
|
4008
|
+
*/
|
|
4009
|
+
renderOption?: (option: O, context: RenderOptionContext) => JSXElement;
|
|
4010
|
+
/**
|
|
4011
|
+
* Selector returning a section id string for each option. Options with the same
|
|
4012
|
+
* section id are grouped together. The id is also used as the default displayed
|
|
4013
|
+
* label unless `renderSectionTitle` is provided.
|
|
4014
|
+
*/
|
|
4015
|
+
getSectionId?: Selector<O, string>;
|
|
4016
|
+
/**
|
|
4017
|
+
* Custom section title render function. Receives the section id and the options
|
|
4018
|
+
* in that section. Returns custom JSX to display as the section header.
|
|
4019
|
+
* When not provided, the section id is used as a plain text label.
|
|
4020
|
+
*/
|
|
4021
|
+
renderSectionTitle?: (sectionId: string, options: O[]) => JSXElement;
|
|
4022
|
+
}
|
|
4023
|
+
/**
|
|
4024
|
+
* Shared translation labels for SelectTextField wrappers (React and Vue).
|
|
4025
|
+
*/
|
|
4026
|
+
interface SelectTextFieldTranslations {
|
|
4027
|
+
/** Accessible label for the clear button. */
|
|
4028
|
+
clearLabel?: string;
|
|
4029
|
+
/** Accessible label for the show-suggestions toggle button. When omitted, the toggle button is not rendered. */
|
|
4030
|
+
showSuggestionsLabel?: string;
|
|
4031
|
+
/** Accessible label for the chip group. */
|
|
4032
|
+
chipGroupLabel?: string;
|
|
4033
|
+
/** Accessible label for the remove action on chips (used in visually hidden text). */
|
|
4034
|
+
chipRemoveLabel?: string;
|
|
4035
|
+
/** Screen reader loading announcement (e.g. "Loading…"). */
|
|
4036
|
+
loadingMessage?: string;
|
|
4037
|
+
/**
|
|
4038
|
+
* Message to display when the list has no visible options.
|
|
4039
|
+
* Can be a plain string or a function receiving the current input value (for dynamic messages).
|
|
4040
|
+
* When omitted, the empty state is not shown.
|
|
4041
|
+
*/
|
|
4042
|
+
emptyMessage?: string | ((inputValue: string) => string);
|
|
4043
|
+
/**
|
|
4044
|
+
* Message callback to display the number of available options.
|
|
4045
|
+
* Called with the current visible option count and should return a human-readable string
|
|
4046
|
+
* (e.g. `(n) => \`${n} result(s) available\``).
|
|
4047
|
+
* Displayed when the combobox is open, not empty, not loading, and not in error.
|
|
4048
|
+
* When omitted, no option count message is shown.
|
|
4049
|
+
*/
|
|
4050
|
+
nbOptionMessage?: (optionsLength: number) => string;
|
|
4051
|
+
/** Error title displayed in the dropdown (e.g. "Failed to load"). */
|
|
4052
|
+
errorMessage?: string;
|
|
4053
|
+
/** Secondary error message (e.g. "Please try again"). */
|
|
4054
|
+
errorTryReloadMessage?: string;
|
|
4055
|
+
}
|
|
4056
|
+
/**
|
|
4057
|
+
* Wrapper-level props shared between React and Vue SelectTextField implementations.
|
|
4058
|
+
* These are framework-specific concerns (not part of the core template) that both
|
|
4059
|
+
* wrappers need — extracted here to avoid duplication.
|
|
4060
|
+
*/
|
|
4061
|
+
interface BaseSelectTextFieldWrapperProps<O> extends Pick<BaseSelectProps<O>, 'options' | 'getOptionId' | 'getOptionName' | 'getOptionDescription' | 'getSectionId'>, HasAriaDisabled, HasTheme {
|
|
4062
|
+
/** Selection type: 'single' or 'multiple'. */
|
|
4063
|
+
selectionType: 'single' | 'multiple';
|
|
4064
|
+
/**
|
|
4065
|
+
* Status of the dropdown list.
|
|
4066
|
+
* @default 'idle'
|
|
4067
|
+
*/
|
|
4068
|
+
listStatus?: SelectTextFieldStatus;
|
|
4069
|
+
/**
|
|
4070
|
+
* Controls how the combobox filters options as the user types.
|
|
4071
|
+
*
|
|
4072
|
+
* - `'auto'` — Options that do not match the input value are hidden client-side.
|
|
4073
|
+
* - `'manual'` — All options remain visible; filtering is the consumer's
|
|
4074
|
+
* responsibility (e.g. by updating the `options` prop in response to `onSearch`).
|
|
4075
|
+
* - `'off'` — Like `'manual'`, but the input is also set to `readOnly` and
|
|
4076
|
+
* `openOnFocus` defaults to `true` (useful for static dropdowns / pure pickers).
|
|
4077
|
+
*
|
|
4078
|
+
* This prop is independent of `onSearch`: you can use both together (e.g. client-side
|
|
4079
|
+
* filtering + tracking search text for a "create" action), or use `filter: 'manual'`
|
|
4080
|
+
* without `onSearch` for static dropdowns.
|
|
4081
|
+
*/
|
|
4082
|
+
filter: 'auto' | 'manual' | 'off';
|
|
4083
|
+
/**
|
|
4084
|
+
* Controlled search input value.
|
|
4085
|
+
* When provided, this value seeds (and resets) the visible search text in the input.
|
|
4086
|
+
* Setting it to `''` (empty string) resets the input.
|
|
4087
|
+
*/
|
|
4088
|
+
searchInputValue?: string;
|
|
4089
|
+
/**
|
|
4090
|
+
* Whether to show a clear button when a value is selected.
|
|
4091
|
+
* @default true
|
|
4092
|
+
*/
|
|
4093
|
+
hasClearButton?: boolean;
|
|
4094
|
+
/**
|
|
4095
|
+
* When true, the dropdown opens automatically when the input receives focus.
|
|
4096
|
+
* When false (default), the dropdown only opens on click, typing, or keyboard navigation.
|
|
4097
|
+
*
|
|
4098
|
+
* @default false
|
|
4099
|
+
*/
|
|
4100
|
+
openOnFocus?: boolean;
|
|
4101
|
+
/** Field label (required). Also used as aria-label for the listbox. */
|
|
4102
|
+
label: string;
|
|
4103
|
+
/** Input placeholder text. */
|
|
4104
|
+
placeholder?: string;
|
|
4105
|
+
/** Leading icon (SVG path). */
|
|
4106
|
+
icon?: string;
|
|
4107
|
+
/** Disabled state. */
|
|
4108
|
+
isDisabled?: boolean;
|
|
4109
|
+
/** Required field indicator. */
|
|
4110
|
+
isRequired?: boolean;
|
|
4111
|
+
/** Error state flag. */
|
|
4112
|
+
hasError?: boolean;
|
|
4113
|
+
/** Error message text. */
|
|
4114
|
+
error?: string;
|
|
4115
|
+
/** Helper text below the field. */
|
|
4116
|
+
helper?: string;
|
|
4117
|
+
/** Native input id attribute. */
|
|
4118
|
+
id?: string;
|
|
4119
|
+
/** Native input name attribute. */
|
|
4120
|
+
name?: string;
|
|
4121
|
+
/** Whether displayed with valid style. */
|
|
4122
|
+
isValid?: boolean;
|
|
4123
|
+
/** Maximum string length (shows character counter). */
|
|
4124
|
+
maxLength?: number;
|
|
4125
|
+
/** Accessible label for the input element (overrides the visual label for screen readers). */
|
|
4126
|
+
ariaLabel?: string;
|
|
4127
|
+
/** Additional props forwarded to the Combobox.Input (and ultimately to TextField). */
|
|
4128
|
+
inputProps?: Record<string, any>;
|
|
4129
|
+
/** Props forwarded to the Combobox.Popover. */
|
|
4130
|
+
popoverProps?: Record<string, any>;
|
|
4131
|
+
/** Labels for the clear button, toggle button, and chip group. */
|
|
4132
|
+
translations: SelectTextFieldTranslations;
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
interface BaseSelectTextFieldProps<O = any> extends BaseSelectTextFieldWrapperProps<O>, HasClassName$1 {
|
|
4136
|
+
/**
|
|
4137
|
+
* Custom option render function. Must return a `<Combobox.Option>` element with custom
|
|
4138
|
+
* children/props. Core-computed props (`value`, `isSelected`, `description`, `key`) are
|
|
4139
|
+
* merged in automatically — the consumer does not need to forward them.
|
|
4140
|
+
*/
|
|
4141
|
+
renderOption?: (option: O, index: number) => React__default.ReactNode;
|
|
4142
|
+
/**
|
|
4143
|
+
* Custom section title render function. Receives the section id and the options
|
|
4144
|
+
* in that section. Returns custom JSX to display as the section header.
|
|
4145
|
+
* When not provided, the section id is used as a plain text label.
|
|
4146
|
+
*/
|
|
4147
|
+
renderSectionTitle?: (sectionId: string, options: O[]) => React__default.ReactNode;
|
|
4148
|
+
/**
|
|
4149
|
+
* Callback fired when the search input text changes.
|
|
4150
|
+
* Independent of `filter`: both can be used together (e.g. client-side
|
|
4151
|
+
* filtering + tracking search text for a "create" action).
|
|
4152
|
+
*/
|
|
4153
|
+
onSearch?: (searchText: string) => void;
|
|
4154
|
+
/** Ref to the underlying input element. */
|
|
4155
|
+
inputRef?: React__default.Ref<HTMLInputElement>;
|
|
4156
|
+
/** Callback to load more items (infinite scroll). */
|
|
4157
|
+
onLoadMore?: () => void;
|
|
4158
|
+
/** Content to render before the options list. */
|
|
4159
|
+
beforeOptions?: React__default.ReactNode;
|
|
4160
|
+
/** Props forwarded to the Combobox.List popover. */
|
|
4161
|
+
popoverProps?: ComboboxPopoverProps;
|
|
4162
|
+
/** On blur callback. */
|
|
4163
|
+
onBlur?: (event: React__default.FocusEvent) => void;
|
|
4164
|
+
/** On focus callback. */
|
|
4165
|
+
onFocus?: (event: React__default.FocusEvent) => void;
|
|
4166
|
+
/** On key down callback. */
|
|
4167
|
+
onKeyDown?: (event: React__default.KeyboardEvent) => void;
|
|
4168
|
+
/** On clear callback (fired when the clear button is clicked). */
|
|
4169
|
+
onClear?: (event?: SyntheticEvent) => void;
|
|
4170
|
+
/** Callback fired when the dropdown open state changes. */
|
|
4171
|
+
onOpen?: (isOpen: boolean) => void;
|
|
4172
|
+
}
|
|
4173
|
+
/** Single selection props **/
|
|
4174
|
+
interface SingleSelectTextFieldProps<O = any> extends BaseSelectTextFieldProps<O> {
|
|
4175
|
+
/** Selection type. */
|
|
4176
|
+
selectionType: 'single';
|
|
4177
|
+
/** Selected option object. */
|
|
4178
|
+
value?: O;
|
|
4179
|
+
/** Callback on option selected (or cleared). */
|
|
4180
|
+
onChange?: (newValue?: O) => void;
|
|
4181
|
+
/** Not available in single selection. */
|
|
4182
|
+
renderChip?: never;
|
|
4183
|
+
}
|
|
4184
|
+
/** Multiple selection props **/
|
|
4185
|
+
interface MultipleSelectTextFieldProps<O = any> extends BaseSelectTextFieldProps<O> {
|
|
4186
|
+
/** Selection type. */
|
|
4187
|
+
selectionType: 'multiple';
|
|
4188
|
+
/** Selected option objects. */
|
|
4189
|
+
value?: O[];
|
|
4190
|
+
/** Callback on option array changed. */
|
|
4191
|
+
onChange?: (newValue?: O[]) => void;
|
|
4192
|
+
/** Custom chip render function. */
|
|
4193
|
+
renderChip?: (option: O) => React__default.ReactNode;
|
|
4194
|
+
/** Customize chip props per selected option. */
|
|
4195
|
+
getChipProps?: (option: O) => Partial<ChipProps$1>;
|
|
4196
|
+
}
|
|
4197
|
+
/**
|
|
4198
|
+
* SelectTextField props — supports both single and multiple selection.
|
|
4199
|
+
*/
|
|
4200
|
+
type SelectTextFieldProps<O = any> = SingleSelectTextFieldProps<O> | MultipleSelectTextFieldProps<O>;
|
|
4201
|
+
|
|
4202
|
+
/**
|
|
4203
|
+
* SelectTextField compound component.
|
|
4204
|
+
*/
|
|
4205
|
+
declare const SelectTextField: {
|
|
4206
|
+
<O>(props: SelectTextFieldProps<O>): react_jsx_runtime.JSX.Element;
|
|
4207
|
+
displayName: string;
|
|
4208
|
+
} & {
|
|
4209
|
+
/** Selectable option within the dropdown list. */
|
|
4210
|
+
Option: Comp<ComboboxOptionProps, HTMLLIElement>;
|
|
4211
|
+
/** Labelled group of options. */
|
|
4212
|
+
Section: Comp<ComboboxSectionProps, HTMLLIElement>;
|
|
4213
|
+
/** Info icon on an option that reveals a popover with additional details. */
|
|
4214
|
+
OptionMoreInfo: {
|
|
4215
|
+
(props: ComboboxOptionMoreInfoProps): react_jsx_runtime.JSX.Element;
|
|
4216
|
+
displayName: string;
|
|
4217
|
+
className: "lumx-combobox-option-more-info";
|
|
4218
|
+
};
|
|
4219
|
+
/** Skeleton loading placeholder for options being fetched. */
|
|
4220
|
+
OptionSkeleton: {
|
|
4221
|
+
(props: ComboboxOptionSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
4222
|
+
displayName: string;
|
|
4223
|
+
className: "lumx-combobox-option-skeleton";
|
|
4224
|
+
};
|
|
4225
|
+
/** Visual separator between option groups (alias for ListDivider). Purely decorative — invisible to screen readers. */
|
|
4226
|
+
Divider: Comp<ListDividerProps, HTMLLIElement>;
|
|
4227
|
+
};
|
|
4228
|
+
|
|
3948
4229
|
/**
|
|
3949
4230
|
* Defines the props of the component.
|
|
3950
4231
|
*/
|
|
@@ -4994,5 +5275,5 @@ declare const ThemeProvider: React__default.FC<{
|
|
|
4994
5275
|
/** Get the theme in the current context. */
|
|
4995
5276
|
declare function useTheme(): ThemeContextValue;
|
|
4996
5277
|
|
|
4997
|
-
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME, COMPONENT_NAME, Checkbox, Chip, ChipGroup, Combobox, CommentBlock, CommentBlockVariant, DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSection, ListSubheader, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, Select, SelectMultiple, SelectMultipleField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableCellVariant as TableCellVariantType, TableHeader, TableRow, Text, TextField, ThOrder, ThOrder as ThOrderType, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, useFocusPointStyle, useHeadingLevel, useTheme };
|
|
4998
|
-
export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, ComboboxButtonProps, ComboboxInputProps, ComboboxListProps, ComboboxOptionActionProps, ComboboxOptionMoreInfoProps, ComboboxOptionProps, ComboboxOptionSkeletonProps, ComboboxPopoverComponentProps, ComboboxPopoverProps, ComboboxProviderProps, ComboboxSectionProps, ComboboxStateProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GenericBlockSectionProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSectionProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectMultipleProps, SelectProps, SelectionChipGroupProps, SideNavigationItemProps, SideNavigationProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
|
|
5278
|
+
export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME, COMPONENT_NAME, Checkbox, Chip, ChipGroup, Combobox, CommentBlock, CommentBlockVariant, DEFAULT_PROPS, DatePicker, DatePickerControlled, DatePickerField, Dialog, Divider, DragHandle, Dropdown, ExpansionPanel, Flag, FlexBox, GenericBlock, GenericBlockGapSize, Grid, GridColumn, GridItem, Heading, HeadingLevelProvider, Icon, IconButton, ImageBlock, ImageBlockCaptionPosition, ImageLightbox, InlineList, InputHelper, InputLabel, Lightbox, Link, LinkPreview, List, ListDivider, ListItem, ListSection, ListSubheader, Message, Mosaic, Navigation, Notification, Placement, Popover, PopoverDialog, PostBlock, Progress, ProgressCircular, ProgressLinear, ProgressTracker, ProgressTrackerProvider, ProgressTrackerStep, ProgressTrackerStepPanel, ProgressVariant, RadioButton, RadioGroup, RawInputText, RawInputTextarea, Select, SelectMultiple, SelectMultipleField, SelectTextField, SelectVariant, SelectionChipGroup, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableCellVariant as TableCellVariantType, TableHeader, TableRow, Text, TextField, ThOrder, ThOrder as ThOrderType, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, useFocusPointStyle, useHeadingLevel, useTheme };
|
|
5279
|
+
export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, ComboboxButtonProps, ComboboxInputProps, ComboboxListProps, ComboboxOptionActionProps, ComboboxOptionMoreInfoProps, ComboboxOptionProps, ComboboxOptionSkeletonProps, ComboboxPopoverComponentProps, ComboboxPopoverProps, ComboboxProviderProps, ComboboxSectionProps, ComboboxStateProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GenericBlockSectionProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSectionProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, MultipleSelectTextFieldProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectMultipleProps, SelectProps, SelectTextFieldProps, SelectTextFieldStatus, SelectTextFieldTranslations, SelectionChipGroupProps, SideNavigationItemProps, SideNavigationProps, SingleSelectTextFieldProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesProps, SlideshowControlsProps, SlideshowItemProps, SlideshowProps, SwitchProps, TabListProps, TabPanelProps, TabProps, TabProviderProps, TableBodyProps, TableCellProps, TableHeaderProps, TableProps, TableRowProps, TextFieldProps, TextProps, ThumbnailProps, ThumbnailSize, ToolbarProps, TooltipPlacement, TooltipProps, UploaderProps, UploaderSize, UserBlockProps, UserBlockSize };
|