@lumx/react 4.9.0-alpha.1 → 4.9.0-alpha.3
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/{C9YCH96e.js → Dpulze-1.js} +3 -3
- package/_internal/Dpulze-1.js.map +1 -0
- package/index.d.ts +164 -25
- package/index.js +485 -223
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/utils/index.js +1 -1
- package/_internal/C9YCH96e.js.map +0 -1
|
@@ -48,7 +48,7 @@ const CLICK_AWAY_EVENT_TYPES = ['mousedown', 'touchstart'];
|
|
|
48
48
|
* @returns `true` if the click is outside all elements (i.e. a click away).
|
|
49
49
|
*/
|
|
50
50
|
function isClickAway(targets, elements) {
|
|
51
|
-
return !elements.some(element => targets.some(target => element
|
|
51
|
+
return !elements.some(element => element instanceof Node && targets.some(target => element.contains(target)));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -68,7 +68,7 @@ function setupClickAway(getElements, callback) {
|
|
|
68
68
|
return undefined;
|
|
69
69
|
}
|
|
70
70
|
const listener = evt => {
|
|
71
|
-
const targets = [evt.composedPath?.()[0], evt.target];
|
|
71
|
+
const targets = [evt.composedPath?.()[0], evt.target].filter(t => t instanceof Node);
|
|
72
72
|
const elements = getElements();
|
|
73
73
|
if (isClickAway(targets, elements)) {
|
|
74
74
|
callback(evt);
|
|
@@ -192,4 +192,4 @@ const Portal = ({
|
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
export { ClickAwayProvider as C, DisabledStateProvider as D, Portal as P, PortalProvider as a, useDisabledStateContext as u };
|
|
195
|
-
//# sourceMappingURL=
|
|
195
|
+
//# sourceMappingURL=Dpulze-1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dpulze-1.js","sources":["../../src/utils/disabled/DisabledStateContext.tsx","../../../lumx-core/src/js/utils/ClickAway/index.ts","../../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\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","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","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;;ACv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,CAAC,MAAM;IACxB,OAAOd,OAAO,EAAEe,QAAQ;EAC5B,CAAC,EAAE,CAACf,OAAO,EAAEe,QAAQ,EAAEH,OAAO,CAAC,CAAC;EAEhC,MAAM;AAAEJ,IAAAA;AAAU,GAAC,GAAGR,OAAO,IAAI,EAAE;AACnC,EAAA,IAAI,CAACQ,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;IAC7C,oBAAOjD,GAAA,CAAAyD,QAAA,EAAA;AAAA3D,MAAAA,QAAA,EAAGA;AAAQ,KAAG,CAAC;AAC1B,EAAA;AACA,EAAA,oBAAO4D,YAAY,CAAC5D,QAAQ,EAAEmD,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 { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf as ValueOf$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,
|
|
7
|
+
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, RefObject, SetStateAction, Key, CSSProperties, ElementType as ElementType$1, HTMLInputTypeAttribute, ComponentProps, ImgHTMLAttributes, AriaAttributes as AriaAttributes$1 } from 'react';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
/** LumX Component Type. */
|
|
@@ -1268,8 +1268,8 @@ interface TextProps$1 extends HasClassName {
|
|
|
1268
1268
|
* Defines the props of the component.
|
|
1269
1269
|
*/
|
|
1270
1270
|
interface ListSectionProps$1 extends HasClassName {
|
|
1271
|
-
/** Section label displayed as the group title. */
|
|
1272
|
-
label?: string;
|
|
1271
|
+
/** Section label displayed as the group title. Accepts a plain string or custom JSX content. */
|
|
1272
|
+
label?: string | JSXElement;
|
|
1273
1273
|
/** Section icon */
|
|
1274
1274
|
icon?: string;
|
|
1275
1275
|
/** List items (should be ListItem, ListDivider, etc.). */
|
|
@@ -1362,6 +1362,12 @@ interface ComboboxStateProps$1 {
|
|
|
1362
1362
|
* Used to suppress false "empty" state while data is loading.
|
|
1363
1363
|
*/
|
|
1364
1364
|
isLoading?: boolean;
|
|
1365
|
+
/**
|
|
1366
|
+
* Whether the combobox popover is open.
|
|
1367
|
+
* Used to gate live region content so screen readers announce messages
|
|
1368
|
+
* when the popover opens (content insertion triggers `aria-live` announcement).
|
|
1369
|
+
*/
|
|
1370
|
+
isOpen?: boolean;
|
|
1365
1371
|
};
|
|
1366
1372
|
}
|
|
1367
1373
|
|
|
@@ -1377,8 +1383,8 @@ interface ComboboxStateProps extends ReactToJSX<ComboboxStateProps$1, 'state'> {
|
|
|
1377
1383
|
* Defines the props for the core ComboboxSection template.
|
|
1378
1384
|
*/
|
|
1379
1385
|
interface ComboboxSectionProps$1 extends HasClassName {
|
|
1380
|
-
/** Section label displayed as the group title. */
|
|
1381
|
-
label?: string;
|
|
1386
|
+
/** Section label displayed as the group title. Accepts a plain string or custom JSX content. */
|
|
1387
|
+
label?: string | JSXElement;
|
|
1382
1388
|
/** Section icon */
|
|
1383
1389
|
icon?: string;
|
|
1384
1390
|
/** Section content (should be ComboboxOption elements). */
|
|
@@ -1573,6 +1579,12 @@ interface ComboboxOptionSkeletonProps$1 extends HasClassName {
|
|
|
1573
1579
|
children?: JSXElement;
|
|
1574
1580
|
/** ref to the root <li> element. */
|
|
1575
1581
|
ref?: CommonRef;
|
|
1582
|
+
/**
|
|
1583
|
+
* Number of skeleton `<li>` elements to render.
|
|
1584
|
+
* Each is an independent element with `:nth-child` width cycling applied by SCSS.
|
|
1585
|
+
* @default 1
|
|
1586
|
+
*/
|
|
1587
|
+
count?: number;
|
|
1576
1588
|
}
|
|
1577
1589
|
/**
|
|
1578
1590
|
* Props that React/Vue wrappers need to re-declare with framework-specific types.
|
|
@@ -1590,12 +1602,6 @@ interface ComboboxOptionSkeletonProps extends GenericProps$1, ReactToJSX<Combobo
|
|
|
1590
1602
|
after?: ReactNode;
|
|
1591
1603
|
/** Override the default SkeletonTypography content entirely. */
|
|
1592
1604
|
children?: ReactNode;
|
|
1593
|
-
/**
|
|
1594
|
-
* Number of skeleton `<li>` elements to render.
|
|
1595
|
-
* Each is an independent element with `:nth-child` width cycling applied by SCSS.
|
|
1596
|
-
* @default 1
|
|
1597
|
-
*/
|
|
1598
|
-
count?: number;
|
|
1599
1605
|
}
|
|
1600
1606
|
|
|
1601
1607
|
/**
|
|
@@ -1614,6 +1620,8 @@ interface ComboboxOptionMoreInfoProps$1 extends HasClassName {
|
|
|
1614
1620
|
onMouseEnter?(): void;
|
|
1615
1621
|
/** Mouse leave callback. */
|
|
1616
1622
|
onMouseLeave?(): void;
|
|
1623
|
+
/** Props forwarded to the IconButton. */
|
|
1624
|
+
buttonProps?: Record<string, any>;
|
|
1617
1625
|
}
|
|
1618
1626
|
/**
|
|
1619
1627
|
* Props that React/Vue wrappers need to re-declare with framework-specific types.
|
|
@@ -1628,6 +1636,8 @@ interface ComboboxOptionMoreInfoProps extends ReactToJSX<ComboboxOptionMoreInfoP
|
|
|
1628
1636
|
children?: ReactNode;
|
|
1629
1637
|
/** Callback when the popover opens or closes. */
|
|
1630
1638
|
onToggle?(isOpen: boolean): void;
|
|
1639
|
+
/** Props forwarded to the IconButton. */
|
|
1640
|
+
buttonProps?: Partial<IconButtonProps>;
|
|
1631
1641
|
}
|
|
1632
1642
|
|
|
1633
1643
|
/**
|
|
@@ -1665,6 +1675,8 @@ interface ComboboxOptionProps$1 extends HasClassName {
|
|
|
1665
1675
|
hidden?: boolean;
|
|
1666
1676
|
/** On click callback. */
|
|
1667
1677
|
handleClick?(): void;
|
|
1678
|
+
/** Extra props forwarded to the inner action element (e.g. link props when as="a"). */
|
|
1679
|
+
actionProps?: Record<string, any>;
|
|
1668
1680
|
/** ref to the root <li> element. */
|
|
1669
1681
|
ref?: CommonRef;
|
|
1670
1682
|
/** The value for this option (used for selection). */
|
|
@@ -1674,7 +1686,7 @@ interface ComboboxOptionProps$1 extends HasClassName {
|
|
|
1674
1686
|
* Props that React/Vue wrappers need to re-declare with framework-specific types.
|
|
1675
1687
|
* Used by `ReactToJSX<ComboboxOptionProps, ComboboxOptionPropsToOverride>`.
|
|
1676
1688
|
*/
|
|
1677
|
-
type ComboboxOptionPropsToOverride = 'before' | 'after' | 'children' | 'tooltipProps';
|
|
1689
|
+
type ComboboxOptionPropsToOverride = 'before' | 'after' | 'children' | 'tooltipProps' | 'actionProps';
|
|
1678
1690
|
|
|
1679
1691
|
declare const ARIA_LINK_MODES: readonly ["aria-describedby", "aria-labelledby"];
|
|
1680
1692
|
|
|
@@ -1714,6 +1726,10 @@ interface TooltipProps extends GenericProps$1, TooltipProps$1 {
|
|
|
1714
1726
|
*/
|
|
1715
1727
|
declare const Tooltip: Comp<TooltipProps, HTMLDivElement>;
|
|
1716
1728
|
|
|
1729
|
+
/**
|
|
1730
|
+
* Props forwarded to the inner action element (button or link).
|
|
1731
|
+
*/
|
|
1732
|
+
type ComboboxOptionActionProps$1<E extends ElementType$1 = 'button'> = HasPolymorphicAs$1<E> & HasRequiredLinkHref$1<E>;
|
|
1717
1733
|
/**
|
|
1718
1734
|
* Props for Combobox.Option component.
|
|
1719
1735
|
*/
|
|
@@ -1732,6 +1748,8 @@ interface ComboboxOptionProps extends GenericProps$1, ReactToJSX<ComboboxOptionP
|
|
|
1732
1748
|
after?: ReactNode;
|
|
1733
1749
|
/** Props forwarded to a Tooltip wrapping the role="option" / role="gridcell" trigger element. */
|
|
1734
1750
|
tooltipProps?: Partial<TooltipProps>;
|
|
1751
|
+
/** Props forwarded to the inner action element (e.g. `{ as: 'a', href: '/foo' }`). */
|
|
1752
|
+
actionProps?: ComboboxOptionActionProps$1<any>;
|
|
1735
1753
|
}
|
|
1736
1754
|
|
|
1737
1755
|
/**
|
|
@@ -1985,6 +2003,38 @@ declare namespace ComboboxProvider {
|
|
|
1985
2003
|
var displayName: string;
|
|
1986
2004
|
}
|
|
1987
2005
|
|
|
2006
|
+
/** Map of combobox event names to their payload types. */
|
|
2007
|
+
interface ComboboxEventMap {
|
|
2008
|
+
/** Fired when the combobox open state changes. Payload: whether the combobox is open. */
|
|
2009
|
+
open: boolean;
|
|
2010
|
+
/** Fired when the active descendant changes (visual focus). Payload: the option id or null. */
|
|
2011
|
+
activeDescendantChange: string | null;
|
|
2012
|
+
/**
|
|
2013
|
+
* Fired when the visible option count transitions between empty and non-empty.
|
|
2014
|
+
* Payload: whether the list is empty plus the current input value.
|
|
2015
|
+
*/
|
|
2016
|
+
emptyChange: {
|
|
2017
|
+
isEmpty?: boolean;
|
|
2018
|
+
inputValue?: string;
|
|
2019
|
+
} | undefined;
|
|
2020
|
+
/**
|
|
2021
|
+
* Fired immediately when the aggregate loading state changes (skeleton count transitions
|
|
2022
|
+
* between 0 and >0). Used for empty suppression in ComboboxState and for aria-busy on the listbox.
|
|
2023
|
+
*/
|
|
2024
|
+
loadingChange: boolean;
|
|
2025
|
+
/**
|
|
2026
|
+
* Fired after a 500ms debounce when loading persists, or immediately when loading ends.
|
|
2027
|
+
* Used to control the loading message text in the live region (ComboboxState).
|
|
2028
|
+
*/
|
|
2029
|
+
loadingAnnouncement: boolean;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Hook to subscribe to a combobox event via the handle's subscriber system.
|
|
2034
|
+
* Re-subscribes when the handle changes (e.g. trigger mount/unmount).
|
|
2035
|
+
*/
|
|
2036
|
+
declare function useComboboxEvent<K extends keyof ComboboxEventMap>(event: K, initialValue: ComboboxEventMap[K]): ComboboxEventMap[K];
|
|
2037
|
+
|
|
1988
2038
|
/**
|
|
1989
2039
|
* Props for Combobox.Button component.
|
|
1990
2040
|
*
|
|
@@ -2017,7 +2067,9 @@ type ComboboxOptionActionProps<E extends ElementType$1 = 'button'> = HasPolymorp
|
|
|
2017
2067
|
* Combobox compound component namespace.
|
|
2018
2068
|
*/
|
|
2019
2069
|
declare const Combobox: {
|
|
2070
|
+
/** Provides shared combobox context (handle, listbox ID, anchor ref) to all sub-components. */
|
|
2020
2071
|
Provider: typeof ComboboxProvider;
|
|
2072
|
+
/** Button trigger for select-only combobox mode with keyboard navigation and typeahead. */
|
|
2021
2073
|
Button: (<E extends React$1.ElementType = Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>>(props: Omit<HasPolymorphicAs$1<E>, "children" | "aria-expanded" | "aria-haspopup" | "role" | "aria-controls" | "aria-activedescendant"> & _lumx_core_js_types.HasRequiredLinkHref<E> & ReactToJSX<ComboboxButtonProps$1> & {
|
|
2022
2074
|
onSelect?: (option: {
|
|
2023
2075
|
value: string;
|
|
@@ -2028,9 +2080,13 @@ declare const Combobox: {
|
|
|
2028
2080
|
displayName: string;
|
|
2029
2081
|
className: "lumx-combobox-button";
|
|
2030
2082
|
};
|
|
2083
|
+
/** Text input trigger for autocomplete combobox mode with optional toggle button and filtering. */
|
|
2031
2084
|
Input: Comp<ComboboxInputProps, HTMLDivElement>;
|
|
2085
|
+
/** Listbox container that registers with the combobox handle and tracks loading state. */
|
|
2032
2086
|
List: Comp<ComboboxListProps, HTMLUListElement>;
|
|
2087
|
+
/** Selectable option item with filtering and keyboard navigation support. */
|
|
2033
2088
|
Option: Comp<ComboboxOptionProps, HTMLLIElement>;
|
|
2089
|
+
/** Secondary action button within a grid-mode option row, rendered as an independent gridcell. */
|
|
2034
2090
|
OptionAction: (<E extends React$1.ElementType = "button">(props: React$1.PropsWithoutRef<React$1.ComponentProps<E>> & {
|
|
2035
2091
|
as?: E | undefined;
|
|
2036
2092
|
} & _lumx_core_js_types.HasClassName & _lumx_core_js_types.HasRequiredLinkHref<E> & {
|
|
@@ -2043,22 +2099,27 @@ declare const Combobox: {
|
|
|
2043
2099
|
displayName: string;
|
|
2044
2100
|
className: "lumx-combobox-option-action";
|
|
2045
2101
|
};
|
|
2102
|
+
/** Info button on an option that shows a popover on hover or keyboard highlight. */
|
|
2046
2103
|
OptionMoreInfo: {
|
|
2047
2104
|
(props: ComboboxOptionMoreInfoProps): react_jsx_runtime.JSX.Element;
|
|
2048
2105
|
displayName: string;
|
|
2049
2106
|
className: "lumx-combobox-option-more-info";
|
|
2050
2107
|
};
|
|
2108
|
+
/** Loading placeholder skeleton(s) that auto-register loading state with the combobox handle. */
|
|
2051
2109
|
OptionSkeleton: {
|
|
2052
|
-
(props: ComboboxOptionSkeletonProps): react_jsx_runtime.JSX.Element
|
|
2110
|
+
(props: ComboboxOptionSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
2053
2111
|
displayName: string;
|
|
2054
2112
|
className: "lumx-combobox-option-skeleton";
|
|
2055
2113
|
};
|
|
2114
|
+
/** Floating popover container that auto-binds to the combobox anchor and open/close state. */
|
|
2056
2115
|
Popover: {
|
|
2057
2116
|
(props: ComboboxPopoverComponentProps): react_jsx_runtime.JSX.Element;
|
|
2058
2117
|
displayName: string;
|
|
2059
2118
|
className: "lumx-combobox-popover";
|
|
2060
2119
|
};
|
|
2120
|
+
/** Labelled group of options that auto-hides when all its child options are filtered out. */
|
|
2061
2121
|
Section: Comp<ComboboxSectionProps, HTMLLIElement>;
|
|
2122
|
+
/** Displays empty, error, and loading state messages for the combobox list. */
|
|
2062
2123
|
State: {
|
|
2063
2124
|
(props: ComboboxStateProps): react_jsx_runtime.JSX.Element;
|
|
2064
2125
|
displayName: string;
|
|
@@ -2066,6 +2127,8 @@ declare const Combobox: {
|
|
|
2066
2127
|
};
|
|
2067
2128
|
/** Visual separator between option groups (alias for ListDivider). Purely decorative — invisible to screen readers. */
|
|
2068
2129
|
Divider: Comp<ListDividerProps, HTMLLIElement>;
|
|
2130
|
+
/** Hook to subscribe to combobox events. Must be used within a Combobox.Provider. */
|
|
2131
|
+
useComboboxEvent: typeof useComboboxEvent;
|
|
2069
2132
|
};
|
|
2070
2133
|
|
|
2071
2134
|
/**
|
|
@@ -2395,7 +2458,7 @@ declare const Dropdown: Comp<DropdownProps, HTMLDivElement>;
|
|
|
2395
2458
|
/**
|
|
2396
2459
|
* Defines the props of the component.
|
|
2397
2460
|
*/
|
|
2398
|
-
interface ExpansionPanelProps extends
|
|
2461
|
+
interface ExpansionPanelProps$1 extends HasClassName, HasCloseMode, HasTheme {
|
|
2399
2462
|
/** Whether the expansion panel has a background. */
|
|
2400
2463
|
hasBackground?: boolean;
|
|
2401
2464
|
/** Whether the header has a divider. */
|
|
@@ -2404,6 +2467,41 @@ interface ExpansionPanelProps extends GenericProps$1, HasCloseMode$1, HasTheme$1
|
|
|
2404
2467
|
isOpen?: boolean;
|
|
2405
2468
|
/** Label text (overwritten if a `<header>` is provided in the children). */
|
|
2406
2469
|
label?: string;
|
|
2470
|
+
/** On open callback. */
|
|
2471
|
+
handleOpen?: (event: any) => void;
|
|
2472
|
+
/** On close callback. */
|
|
2473
|
+
handleClose?: (event: any) => void;
|
|
2474
|
+
/** Props to pass to the toggle button (minus those already set by the ExpansionPanel props). */
|
|
2475
|
+
toggleButtonProps: any;
|
|
2476
|
+
/** On toggle open or close callback. */
|
|
2477
|
+
handleToggleOpen?(shouldOpen: boolean, event: any): void;
|
|
2478
|
+
/** Children */
|
|
2479
|
+
children?: JSXElement;
|
|
2480
|
+
/** Ref forwarded to the root `<section>` element. */
|
|
2481
|
+
ref?: CommonRef;
|
|
2482
|
+
/** Ref forwarded to the collapsible wrapper `<div>`. */
|
|
2483
|
+
wrapperRef?: CommonRef;
|
|
2484
|
+
/** Props spread onto the header content `<div>` (e.g. `aria-*`, `data-*`). */
|
|
2485
|
+
headerProps: GenericProps;
|
|
2486
|
+
/** Content rendered inside the header content area. */
|
|
2487
|
+
headerContent?: JSXElement;
|
|
2488
|
+
/** Optional drag handle element rendered at the start of the header. */
|
|
2489
|
+
dragHandle?: JSXElement;
|
|
2490
|
+
/** Content rendered inside the collapsible content area. */
|
|
2491
|
+
content?: JSXElement;
|
|
2492
|
+
/** Optional footer element rendered below the content. */
|
|
2493
|
+
footer?: JSXElement;
|
|
2494
|
+
/** IconButton component injected by the framework wrapper (React or Vue). */
|
|
2495
|
+
IconButton: any;
|
|
2496
|
+
/** Whether the children should remain mounted (visible in the DOM) while the panel is closed. */
|
|
2497
|
+
isChildrenVisible?: boolean;
|
|
2498
|
+
}
|
|
2499
|
+
type ExpansionPanelPropsToOverride = 'handleOpen' | 'handleClose' | 'toggleButtonProps' | 'handleToggleOpen' | 'wrapperRef' | 'headerProps' | 'headerContent' | 'dragHandle' | 'content' | 'IconButton' | 'isChildrenVisible' | 'footer';
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* Defines the props of the component.
|
|
2503
|
+
*/
|
|
2504
|
+
interface ExpansionPanelProps extends GenericProps$1, ReactToJSX<ExpansionPanelProps$1, ExpansionPanelPropsToOverride> {
|
|
2407
2505
|
/** On open callback. */
|
|
2408
2506
|
onOpen?: (event: React__default.MouseEvent) => void;
|
|
2409
2507
|
/** On close callback. */
|
|
@@ -2412,8 +2510,6 @@ interface ExpansionPanelProps extends GenericProps$1, HasCloseMode$1, HasTheme$1
|
|
|
2412
2510
|
toggleButtonProps: Pick<IconButtonProps, 'label'> & Omit<IconButtonProps, 'label' | 'onClick' | 'icon' | 'emphasis' | 'color'>;
|
|
2413
2511
|
/** On toggle open or close callback. */
|
|
2414
2512
|
onToggleOpen?(shouldOpen: boolean, event: React__default.MouseEvent): void;
|
|
2415
|
-
/** Children */
|
|
2416
|
-
children?: React__default.ReactNode;
|
|
2417
2513
|
}
|
|
2418
2514
|
/**
|
|
2419
2515
|
* ExpansionPanel component.
|
|
@@ -3293,7 +3389,20 @@ declare const Message: Comp<MessageProps, HTMLDivElement>;
|
|
|
3293
3389
|
/**
|
|
3294
3390
|
* Defines the props of the component.
|
|
3295
3391
|
*/
|
|
3296
|
-
interface MosaicProps extends
|
|
3392
|
+
interface MosaicProps$1 extends HasClassName, HasTheme {
|
|
3393
|
+
/** Thumbnails. */
|
|
3394
|
+
thumbnails: any[];
|
|
3395
|
+
/** On image click callback. */
|
|
3396
|
+
handleClick?(index: number): void;
|
|
3397
|
+
Thumbnail: any;
|
|
3398
|
+
ref?: CommonRef;
|
|
3399
|
+
}
|
|
3400
|
+
type MosaicPropsToOverride = 'Thumbnail' | 'thumbnails';
|
|
3401
|
+
|
|
3402
|
+
/**
|
|
3403
|
+
* Defines the props of the component.
|
|
3404
|
+
*/
|
|
3405
|
+
interface MosaicProps extends GenericProps$1, ReactToJSX<MosaicProps$1, MosaicPropsToOverride> {
|
|
3297
3406
|
/** Thumbnails. */
|
|
3298
3407
|
thumbnails: ThumbnailProps[];
|
|
3299
3408
|
/** On image click callback. */
|
|
@@ -4409,16 +4518,25 @@ declare enum TabListLayout {
|
|
|
4409
4518
|
/**
|
|
4410
4519
|
* Defines the props of the component.
|
|
4411
4520
|
*/
|
|
4412
|
-
interface TabListProps extends
|
|
4521
|
+
interface TabListProps$1 extends HasClassName, HasTheme {
|
|
4413
4522
|
/** ARIA label (purpose of the set of tabs). */
|
|
4414
4523
|
['aria-label']: string;
|
|
4415
4524
|
/** Tab list. */
|
|
4416
|
-
children:
|
|
4525
|
+
children: JSXElement;
|
|
4417
4526
|
/** Layout of the tabs in the list. */
|
|
4418
4527
|
layout?: TabListLayout;
|
|
4419
4528
|
/** Position of the tabs in the list (requires 'clustered' layout). */
|
|
4420
|
-
position?: Alignment
|
|
4529
|
+
position?: Alignment;
|
|
4530
|
+
/** ref to the wrapper element */
|
|
4531
|
+
ref?: CommonRef;
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
/**
|
|
4535
|
+
* Defines the props of the component.
|
|
4536
|
+
*/
|
|
4537
|
+
interface TabListProps extends GenericProps$1, ReactToJSX<TabListProps$1> {
|
|
4421
4538
|
}
|
|
4539
|
+
|
|
4422
4540
|
/**
|
|
4423
4541
|
* TabList component.
|
|
4424
4542
|
*
|
|
@@ -4460,6 +4578,10 @@ interface TabProps$1 extends HasClassName {
|
|
|
4460
4578
|
changeToTab?: () => void;
|
|
4461
4579
|
/** Tab index for roving tabindex management. */
|
|
4462
4580
|
tabIndex?: number;
|
|
4581
|
+
/** Name of the prop used to set tab index (framework-dependent). */
|
|
4582
|
+
tabIndexProp?: string;
|
|
4583
|
+
/** Name of the prop used to attach the keypress event (framework-dependent). */
|
|
4584
|
+
keyPressProp?: string;
|
|
4463
4585
|
/** ID applied to the tab button element (for aria-labelledby on the panel). */
|
|
4464
4586
|
tabId?: string;
|
|
4465
4587
|
/** ID of the associated tab panel (for aria-controls). */
|
|
@@ -4471,7 +4593,7 @@ interface TabProps$1 extends HasClassName {
|
|
|
4471
4593
|
/** Forward ref to the underlying button element. */
|
|
4472
4594
|
ref?: CommonRef;
|
|
4473
4595
|
}
|
|
4474
|
-
type TabPropsToOverride = 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabId' | 'tabPanelId' | 'Icon' | 'Text';
|
|
4596
|
+
type TabPropsToOverride = 'isAnyDisabled' | 'shouldActivateOnFocus' | 'changeToTab' | 'tabIndex' | 'tabIndexProp' | 'keyPressProp' | 'tabId' | 'tabPanelId' | 'Icon' | 'Text';
|
|
4475
4597
|
|
|
4476
4598
|
/**
|
|
4477
4599
|
* Defines the props of the component.
|
|
@@ -4506,13 +4628,30 @@ declare const Tab: Comp<TabProps, HTMLButtonElement>;
|
|
|
4506
4628
|
/**
|
|
4507
4629
|
* Defines the props of the component.
|
|
4508
4630
|
*/
|
|
4509
|
-
interface TabPanelProps extends
|
|
4510
|
-
/** Native id property */
|
|
4511
|
-
id?: string;
|
|
4631
|
+
interface TabPanelProps$1 extends HasClassName {
|
|
4512
4632
|
/** Whether the tab is active or not. */
|
|
4513
4633
|
isActive?: boolean;
|
|
4634
|
+
/** Whether the tab is lazy loaded or not */
|
|
4635
|
+
isLazy?: boolean;
|
|
4514
4636
|
/** Children */
|
|
4515
|
-
children?:
|
|
4637
|
+
children?: JSXElement;
|
|
4638
|
+
/** ID applied to the tab button element (for aria-labelledby on the panel). */
|
|
4639
|
+
tabId?: string;
|
|
4640
|
+
/** ID of the associated tab panel (for aria-controls). */
|
|
4641
|
+
id?: string;
|
|
4642
|
+
/** Name of the prop used to set tab index (framework-dependent). */
|
|
4643
|
+
tabIndexProp?: string;
|
|
4644
|
+
/** Forward ref to the underlying button element. */
|
|
4645
|
+
ref?: CommonRef;
|
|
4646
|
+
}
|
|
4647
|
+
type TabPanelPropsToOverride = 'tabId' | 'isLazy' | 'tabIndexProp';
|
|
4648
|
+
|
|
4649
|
+
/**
|
|
4650
|
+
* Defines the props of the component.
|
|
4651
|
+
*/
|
|
4652
|
+
interface TabPanelProps extends GenericProps$1, ReactToJSX<TabPanelProps$1, TabPanelPropsToOverride> {
|
|
4653
|
+
/** Native id property */
|
|
4654
|
+
id?: string;
|
|
4516
4655
|
}
|
|
4517
4656
|
/**
|
|
4518
4657
|
* TabPanel component.
|