@lumx/react 4.1.1-alpha.0 → 4.1.1-alpha.2

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.
@@ -1,4 +1,4 @@
1
- import React__default, { useContext, useEffect, createContext, useMemo, useRef } from 'react';
1
+ import React__default, { useContext, useEffect, useMemo, useRef, createContext } from 'react';
2
2
  import { jsx, Fragment } from 'react/jsx-runtime';
3
3
  import isEmpty from 'lodash/isEmpty';
4
4
  import { createPortal } from 'react-dom';
@@ -156,4 +156,4 @@ const Portal = ({
156
156
  };
157
157
 
158
158
  export { ClickAwayProvider as C, DisabledStateProvider as D, Portal as P, PortalProvider as a, useDisabledStateContext as u };
159
- //# sourceMappingURL=ClSM3-wl.js.map
159
+ //# sourceMappingURL=DpdvhbTO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClSM3-wl.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 { 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","children","value","_jsx","Provider","useDisabledStateContext","useContext","EVENT_TYPES","isClickAway","targets","refs","some","ref","target","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","composedPath","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","ClickAwayProvider","parentRef","parentContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","displayName","PortalContext","container","body","PortalProvider","Portal","enabled","init","useLayoutEffect","teardown","_Fragment","createPortal"],"mappings":";;;;;AASO,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;;ACtBA,MAAMW,WAAW,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC;AAE/C,SAASC,WAAWA,CAACC,OAAsB,EAAEC,IAAmC,EAAW;AACvF;EACA,OAAO,CAACA,IAAI,CAACC,IAAI,CAAEC,GAAG,IAAKH,OAAO,CAACE,IAAI,CAAEE,MAAM,IAAKD,GAAG,EAAEE,OAAO,EAAEC,QAAQ,CAACF,MAAM,CAAC,CA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AK,CAAC,CAAC,CAAC;AAOlG;AACA;AACA;AACO,MAAMC,cAA6C,GAAGH,aAAa,CAACvC;;ACd3E;AACA;AACA;AACA;AACO,MAAM2C,MAA6B,GAAGA,CAAC;EAAE9C,QAAQ;AAAE+C,EAAAA,OAAO,GAAG;AAAK,CAAC,KAAK;AAC3E,EAAA,MAAMC,IAAI,GAAGpD,cAAK,CAACS,UAAU,CAACqC,aAAa,CAAC;AAC5C,EAAA,MAAMN,OAAO,GAAGxC,cAAK,CAACuC,OAAO,CACzB,MAAM;AACF,IAAA,OAAOY,OAAO,GAAGC,IAAI,EAAE,GAAG,IAAI;EAClC,CAAC;AACD;AACA;EACA,CAACD,OAAO,CACZ,CAAC;EAEDnD,cAAK,CAACqD,eAAe,CAAC,MAAM;IACxB,OAAOb,OAAO,EAAEc,QAAQ;EAC5B,CAAC,EAAE,CAACd,OAAO,EAAEc,QAAQ,EAAEH,OAAO,CAAC,CAAC;AAEhC,EAAA,IAAI,CAACX,OAAO,EAAEO,SAAS,EAAE;IACrB,oBAAOzC,GAAA,CAAAiD,QAAA,EAAA;AAAAnD,MAAAA,QAAA,EAAGA;AAAQ,KAAG,CAAC;AAC1B,EAAA;AACA,EAAA,oBAAOoD,YAAY,CAACpD,QAAQ,EAAEoC,OAAO,CAACO,SAAS,CAAC;AACpD;;;;"}
1
+ {"version":3,"file":"DpdvhbTO.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 { 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","children","value","_jsx","Provider","useDisabledStateContext","useContext","EVENT_TYPES","isClickAway","targets","refs","some","ref","target","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","undefined","listener","evt","composedPath","forEach","evtType","document","addEventListener","removeEventListener","ClickAwayAncestorContext","ClickAwayProvider","parentRef","parentContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","displayName","PortalContext","container","body","PortalProvider","Portal","enabled","init","useLayoutEffect","teardown","_Fragment","createPortal"],"mappings":";;;;;AASO,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,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is, Alignment, VerticalAlignment, Orientation, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1, WhiteSpace, AspectRatio, GlobalSize, TypographyInterface as TypographyInterface$1, Theme as Theme$1 } from '@lumx/core/js/constants';
1
+ import { Kind as Kind$1, HorizontalAlignment, Size as Size$1, ColorPalette as ColorPalette$1, VerticalAlignment, Alignment, Orientation, ColorWithVariants as ColorWithVariants$1, ColorVariant as ColorVariant$1, Typography as Typography$1, WhiteSpace, AspectRatio, Emphasis as Emphasis$1, GlobalSize, TypographyInterface as TypographyInterface$1, Theme as Theme$1 } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  import * as _lumx_core_js_types from '@lumx/core/js/types';
4
- import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf, HasCloseMode, TextElement, HeadingElement, Falsy, HasClassName as HasClassName$1, HasRequiredLinkHref, HasAriaLabelOrLabelledBy } from '@lumx/core/js/types';
4
+ import { GenericProps as GenericProps$1, HasTheme as HasTheme$1, ValueOf, HasAriaDisabled as HasAriaDisabled$1, HasCloseMode, TextElement, HeadingElement, Falsy, HasClassName as HasClassName$1, HasRequiredLinkHref, HasAriaLabelOrLabelledBy } 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, AriaAttributes, DetailedHTMLProps, ButtonHTMLAttributes, InputHTMLAttributes, RefObject, ImgHTMLAttributes, CSSProperties, SetStateAction, Key, ElementType, ComponentProps } from 'react';
7
+ import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, AriaAttributes, InputHTMLAttributes, RefObject, ImgHTMLAttributes, CSSProperties, SetStateAction, Key, ElementType, ComponentProps } from 'react';
8
8
 
9
9
  /** LumX Component Type. */
10
10
  type Comp<P, T = HTMLElement> = {
@@ -318,19 +318,183 @@ interface BadgeWrapperProps extends GenericProps$1 {
318
318
  }
319
319
  declare const BadgeWrapper: Comp<BadgeWrapperProps, HTMLDivElement>;
320
320
 
321
+ declare const Theme: {
322
+ readonly light: "light";
323
+ readonly dark: "dark";
324
+ };
325
+ type Theme = ValueOf<typeof Theme>;
326
+ declare const Size: {
327
+ readonly xxs: "xxs";
328
+ readonly xs: "xs";
329
+ readonly s: "s";
330
+ readonly m: "m";
331
+ readonly l: "l";
332
+ readonly xl: "xl";
333
+ readonly xxl: "xxl";
334
+ readonly tiny: "tiny";
335
+ readonly regular: "regular";
336
+ readonly medium: "medium";
337
+ readonly big: "big";
338
+ readonly huge: "huge";
339
+ };
340
+ type Size = ValueOf<typeof Size>;
341
+ declare const Emphasis: {
342
+ readonly low: "low";
343
+ readonly medium: "medium";
344
+ readonly high: "high";
345
+ };
346
+ type Emphasis = ValueOf<typeof Emphasis>;
347
+ /**
348
+ * List of typographies that can't be customized.
349
+ */
350
+ declare const TypographyInterface: {
351
+ readonly overline: "overline";
352
+ readonly caption: "caption";
353
+ readonly body1: "body1";
354
+ readonly body2: "body2";
355
+ readonly subtitle1: "subtitle1";
356
+ readonly subtitle2: "subtitle2";
357
+ readonly title: "title";
358
+ readonly headline: "headline";
359
+ readonly display1: "display1";
360
+ };
361
+ type TypographyInterface = ValueOf<typeof TypographyInterface>;
362
+ /**
363
+ * List of typographies that can be customized (via CSS variables).
364
+ */
365
+ declare const TypographyCustom: {
366
+ readonly intro: "custom-intro";
367
+ readonly 'body-large': "custom-body-large";
368
+ readonly body: "custom-body";
369
+ readonly quote: "custom-quote";
370
+ readonly 'publish-info': "custom-publish-info";
371
+ readonly button: "custom-button";
372
+ readonly title1: "custom-title1";
373
+ readonly title2: "custom-title2";
374
+ readonly title3: "custom-title3";
375
+ readonly title4: "custom-title4";
376
+ readonly title5: "custom-title5";
377
+ readonly title6: "custom-title6";
378
+ };
379
+ type TypographyCustom = ValueOf<typeof TypographyCustom>;
380
+ /**
381
+ * List of all typographies.
382
+ */
383
+ declare const Typography: {
384
+ readonly custom: {
385
+ readonly intro: "custom-intro";
386
+ readonly 'body-large': "custom-body-large";
387
+ readonly body: "custom-body";
388
+ readonly quote: "custom-quote";
389
+ readonly 'publish-info': "custom-publish-info";
390
+ readonly button: "custom-button";
391
+ readonly title1: "custom-title1";
392
+ readonly title2: "custom-title2";
393
+ readonly title3: "custom-title3";
394
+ readonly title4: "custom-title4";
395
+ readonly title5: "custom-title5";
396
+ readonly title6: "custom-title6";
397
+ };
398
+ readonly overline: "overline";
399
+ readonly caption: "caption";
400
+ readonly body1: "body1";
401
+ readonly body2: "body2";
402
+ readonly subtitle1: "subtitle1";
403
+ readonly subtitle2: "subtitle2";
404
+ readonly title: "title";
405
+ readonly headline: "headline";
406
+ readonly display1: "display1";
407
+ };
408
+ type Typography = TypographyInterface | TypographyCustom;
409
+ /**
410
+ * Semantic info about the purpose of the component
411
+ */
412
+ declare const Kind: {
413
+ readonly info: "info";
414
+ readonly success: "success";
415
+ readonly warning: "warning";
416
+ readonly error: "error";
417
+ };
418
+ type Kind = ValueOf<typeof Kind>;
419
+ /**
420
+ * See SCSS variable $lumx-color-palette
421
+ */
422
+ declare const ColorPalette: {
423
+ readonly primary: "primary";
424
+ readonly secondary: "secondary";
425
+ readonly blue: "blue";
426
+ readonly dark: "dark";
427
+ readonly green: "green";
428
+ readonly yellow: "yellow";
429
+ readonly red: "red";
430
+ readonly light: "light";
431
+ readonly grey: "grey";
432
+ };
433
+ type ColorPalette = ValueOf<typeof ColorPalette>;
434
+ /**
435
+ * See SCSS variable $lumx-color-variants
436
+ */
437
+ declare const ColorVariant: {
438
+ readonly D1: "D1";
439
+ readonly D2: "D2";
440
+ readonly L1: "L1";
441
+ readonly L2: "L2";
442
+ readonly L3: "L3";
443
+ readonly L4: "L4";
444
+ readonly L5: "L5";
445
+ readonly L6: "L6";
446
+ readonly N: "N";
447
+ };
448
+ type ColorVariant = ValueOf<typeof ColorVariant>;
449
+ /** ColorPalette with all possible color variant combination */
450
+ type ColorWithVariants = ColorPalette | Exclude<`${ColorPalette}-${ColorVariant}`, `light-D${number}` | `dark-D${number}`>;
451
+
452
+ interface HasClassName {
453
+ /**
454
+ * Class name forwarded to the root element of the component.
455
+ */
456
+ className?: string;
457
+ }
458
+
459
+ interface HasTheme {
460
+ /**
461
+ * Theme adapting the component to light or dark background.
462
+ */
463
+ theme?: Theme;
464
+ }
465
+
466
+ /**
467
+ * Define a generic props types.
468
+ */
469
+ interface GenericProps extends HasClassName {
470
+ /**
471
+ * Any prop (particularly any supported prop for a HTML element).
472
+ */
473
+ [propName: string]: any;
474
+ }
475
+
476
+ type JSXElement = boolean | number | string | React__default.JSX.Element | Iterable<JSXElement> | undefined | null;
477
+
478
+ /** Transform a string literal into kebab case */
479
+ type KebabCase<S> = S extends `${infer C}${infer T}` ? T extends Uncapitalize<T> ? `${Uncapitalize<C>}${KebabCase<T>}` : `${Uncapitalize<C>}-${KebabCase<T>}` : S;
480
+
481
+ /** Transform the component name into the lumx class name. */
482
+ type LumxClassName<TComponentName extends string> = `lumx-${KebabCase<TComponentName>}`;
483
+
484
+ type Booleanish = boolean | 'true' | 'false';
485
+
321
486
  interface HasAriaDisabled {
322
487
  /** Similar to `disabled` but does not block pointer events or focus */
323
- 'aria-disabled'?: AriaAttributes['aria-disabled'];
488
+ 'aria-disabled'?: Booleanish;
324
489
  }
325
490
 
326
- type HTMLButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
327
491
  /**
328
492
  * Button size definition.
329
493
  */
330
- type ButtonSize = Extract<Size$1, 's' | 'm'>;
331
- interface BaseButtonProps extends GenericProps$1, Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>, HasTheme$1, HasAriaDisabled {
494
+ type ButtonSize = Extract<Size, 's' | 'm'>;
495
+ interface BaseButtonProps extends GenericProps, Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>, HasTheme, HasAriaDisabled {
332
496
  /** Color variant. */
333
- color?: ColorPalette$1;
497
+ color?: ColorPalette;
334
498
  /** Emphasis variant. */
335
499
  emphasis?: Emphasis;
336
500
  /** Whether or not the button has a background color in low emphasis. */
@@ -348,7 +512,7 @@ interface BaseButtonProps extends GenericProps$1, Pick<AriaAttributes, 'aria-exp
348
512
  /** Native anchor target property. */
349
513
  target?: '_self' | '_blank' | '_parent' | '_top';
350
514
  /** Native button type. */
351
- type?: HTMLButtonProps['type'];
515
+ type?: 'submit' | 'reset' | 'button' | undefined;
352
516
  /** Custom react component for the link (can be used to inject react router Link). */
353
517
  linkAs?: 'a' | any;
354
518
  }
@@ -358,9 +522,6 @@ interface BaseButtonProps extends GenericProps$1, Pick<AriaAttributes, 'aria-exp
358
522
  * @deprecated Use Emphasis instead.
359
523
  */
360
524
  declare const ButtonEmphasis: {
361
- /**
362
- * Component default props.
363
- */
364
525
  readonly low: "low";
365
526
  readonly medium: "medium";
366
527
  readonly high: "high";
@@ -376,8 +537,21 @@ interface ButtonProps extends BaseButtonProps {
376
537
  /** When `true`, the button gets as large as possible. */
377
538
  fullWidth?: boolean;
378
539
  /** Children */
379
- children?: React.ReactNode;
540
+ children?: JSXElement;
380
541
  }
542
+ /**
543
+ * Component display name.
544
+ */
545
+ declare const COMPONENT_NAME = "Button";
546
+ /**
547
+ * Component default class name and class prefix.
548
+ */
549
+ declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
550
+ /**
551
+ * Component default props.
552
+ */
553
+ declare const DEFAULT_PROPS: Partial<ButtonProps>;
554
+
381
555
  /**
382
556
  * Button component.
383
557
  *
@@ -385,9 +559,9 @@ interface ButtonProps extends BaseButtonProps {
385
559
  * @param ref Component ref.
386
560
  * @return React element.
387
561
  */
388
- declare const Button: Comp<ButtonProps, HTMLAnchorElement | HTMLButtonElement>;
562
+ declare const Button: Comp<ButtonProps, HTMLButtonElement | HTMLAnchorElement>;
389
563
 
390
- interface IconButtonProps extends BaseButtonProps {
564
+ interface IconButtonProps$1 extends BaseButtonProps {
391
565
  /**
392
566
  * Icon (SVG path).
393
567
  * If `image` is also set, `image` will be used instead.
@@ -403,6 +577,9 @@ interface IconButtonProps extends BaseButtonProps {
403
577
  * If you really don't want an aria-label, you can set an empty label (this is not recommended).
404
578
  */
405
579
  label: string;
580
+ }
581
+
582
+ interface IconButtonProps extends IconButtonProps$1 {
406
583
  /**
407
584
  * Props to pass to the tooltip.
408
585
  * If undefined or if tooltipProps.label is undefined, the label prop will be used as tooltip label.
@@ -423,12 +600,13 @@ declare const IconButton: Comp<IconButtonProps, HTMLButtonElement>;
423
600
  /**
424
601
  * Defines the props of the component
425
602
  */
426
- interface ButtonGroupProps extends GenericProps$1 {
603
+ interface ButtonGroupProps extends GenericProps {
427
604
  /**
428
605
  * Children
429
606
  */
430
607
  children?: React.ReactNode;
431
608
  }
609
+
432
610
  /**
433
611
  * ButtonGroup component.
434
612
  *
@@ -441,7 +619,7 @@ declare const ButtonGroup: Comp<ButtonGroupProps, HTMLDivElement>;
441
619
  /**
442
620
  * Defines the props of the component.
443
621
  */
444
- interface CheckboxProps extends GenericProps$1, HasTheme$1, HasAriaDisabled {
622
+ interface CheckboxProps extends GenericProps$1, HasTheme$1, HasAriaDisabled$1 {
445
623
  /** Helper text. */
446
624
  helper?: string;
447
625
  /** Native input id property. */
@@ -479,7 +657,7 @@ type ChipSize = Extract<Size$1, 's' | 'm'>;
479
657
  /**
480
658
  * Defines the props of the component.
481
659
  */
482
- interface ChipProps extends GenericProps$1, HasTheme$1, HasAriaDisabled {
660
+ interface ChipProps extends GenericProps$1, HasTheme$1, HasAriaDisabled$1 {
483
661
  /** A component to be rendered after the content. */
484
662
  after?: ReactNode;
485
663
  /** A component to be rendered before the content. */
@@ -1057,7 +1235,7 @@ declare const GenericBlockGapSize: Pick<{
1057
1235
  readonly medium: "medium";
1058
1236
  readonly big: "big";
1059
1237
  readonly huge: "huge";
1060
- }, "tiny" | "regular" | "medium" | "big" | "huge">;
1238
+ }, "medium" | "tiny" | "regular" | "big" | "huge">;
1061
1239
  type GenericBlockGapSize = ValueOf<typeof GenericBlockGapSize>;
1062
1240
 
1063
1241
  interface GenericBlockProps extends FlexBoxProps {
@@ -1308,157 +1486,6 @@ interface GridColumnProps extends GenericProps$1 {
1308
1486
  */
1309
1487
  declare const GridColumn: Comp<GridColumnProps, HTMLElement>;
1310
1488
 
1311
- declare const Theme: {
1312
- readonly light: "light";
1313
- readonly dark: "dark";
1314
- };
1315
- type Theme = ValueOf<typeof Theme>;
1316
- declare const Size: {
1317
- readonly xxs: "xxs";
1318
- readonly xs: "xs";
1319
- readonly s: "s";
1320
- readonly m: "m";
1321
- readonly l: "l";
1322
- readonly xl: "xl";
1323
- readonly xxl: "xxl";
1324
- readonly tiny: "tiny";
1325
- readonly regular: "regular";
1326
- readonly medium: "medium";
1327
- readonly big: "big";
1328
- readonly huge: "huge";
1329
- };
1330
- type Size = ValueOf<typeof Size>;
1331
- /**
1332
- * List of typographies that can't be customized.
1333
- */
1334
- declare const TypographyInterface: {
1335
- readonly overline: "overline";
1336
- readonly caption: "caption";
1337
- readonly body1: "body1";
1338
- readonly body2: "body2";
1339
- readonly subtitle1: "subtitle1";
1340
- readonly subtitle2: "subtitle2";
1341
- readonly title: "title";
1342
- readonly headline: "headline";
1343
- readonly display1: "display1";
1344
- };
1345
- type TypographyInterface = ValueOf<typeof TypographyInterface>;
1346
- /**
1347
- * List of typographies that can be customized (via CSS variables).
1348
- */
1349
- declare const TypographyCustom: {
1350
- readonly intro: "custom-intro";
1351
- readonly 'body-large': "custom-body-large";
1352
- readonly body: "custom-body";
1353
- readonly quote: "custom-quote";
1354
- readonly 'publish-info': "custom-publish-info";
1355
- readonly button: "custom-button";
1356
- readonly title1: "custom-title1";
1357
- readonly title2: "custom-title2";
1358
- readonly title3: "custom-title3";
1359
- readonly title4: "custom-title4";
1360
- readonly title5: "custom-title5";
1361
- readonly title6: "custom-title6";
1362
- };
1363
- type TypographyCustom = ValueOf<typeof TypographyCustom>;
1364
- /**
1365
- * List of all typographies.
1366
- */
1367
- declare const Typography: {
1368
- readonly custom: {
1369
- readonly intro: "custom-intro";
1370
- readonly 'body-large': "custom-body-large";
1371
- readonly body: "custom-body";
1372
- readonly quote: "custom-quote";
1373
- readonly 'publish-info': "custom-publish-info";
1374
- readonly button: "custom-button";
1375
- readonly title1: "custom-title1";
1376
- readonly title2: "custom-title2";
1377
- readonly title3: "custom-title3";
1378
- readonly title4: "custom-title4";
1379
- readonly title5: "custom-title5";
1380
- readonly title6: "custom-title6";
1381
- };
1382
- readonly overline: "overline";
1383
- readonly caption: "caption";
1384
- readonly body1: "body1";
1385
- readonly body2: "body2";
1386
- readonly subtitle1: "subtitle1";
1387
- readonly subtitle2: "subtitle2";
1388
- readonly title: "title";
1389
- readonly headline: "headline";
1390
- readonly display1: "display1";
1391
- };
1392
- type Typography = TypographyInterface | TypographyCustom;
1393
- /**
1394
- * Semantic info about the purpose of the component
1395
- */
1396
- declare const Kind: {
1397
- readonly info: "info";
1398
- readonly success: "success";
1399
- readonly warning: "warning";
1400
- readonly error: "error";
1401
- };
1402
- type Kind = ValueOf<typeof Kind>;
1403
- /**
1404
- * See SCSS variable $lumx-color-palette
1405
- */
1406
- declare const ColorPalette: {
1407
- readonly primary: "primary";
1408
- readonly secondary: "secondary";
1409
- readonly blue: "blue";
1410
- readonly dark: "dark";
1411
- readonly green: "green";
1412
- readonly yellow: "yellow";
1413
- readonly red: "red";
1414
- readonly light: "light";
1415
- readonly grey: "grey";
1416
- };
1417
- type ColorPalette = ValueOf<typeof ColorPalette>;
1418
- /**
1419
- * See SCSS variable $lumx-color-variants
1420
- */
1421
- declare const ColorVariant: {
1422
- readonly D1: "D1";
1423
- readonly D2: "D2";
1424
- readonly L1: "L1";
1425
- readonly L2: "L2";
1426
- readonly L3: "L3";
1427
- readonly L4: "L4";
1428
- readonly L5: "L5";
1429
- readonly L6: "L6";
1430
- readonly N: "N";
1431
- };
1432
- type ColorVariant = ValueOf<typeof ColorVariant>;
1433
- /** ColorPalette with all possible color variant combination */
1434
- type ColorWithVariants = ColorPalette | Exclude<`${ColorPalette}-${ColorVariant}`, `light-D${number}` | `dark-D${number}`>;
1435
-
1436
- interface HasClassName {
1437
- /**
1438
- * Class name forwarded to the root element of the component.
1439
- */
1440
- className?: string;
1441
- }
1442
-
1443
- interface HasTheme {
1444
- /**
1445
- * Theme adapting the component to light or dark background.
1446
- */
1447
- theme?: Theme;
1448
- }
1449
-
1450
- /**
1451
- * Define a generic props types.
1452
- */
1453
- interface GenericProps extends HasClassName {
1454
- /**
1455
- * Any prop (particularly any supported prop for a HTML element).
1456
- */
1457
- [propName: string]: any;
1458
- }
1459
-
1460
- type JSXElement = boolean | number | string | React__default.JSX.Element | Iterable<JSXElement> | undefined | null;
1461
-
1462
1489
  type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
1463
1490
  /**
1464
1491
  * Defines the props of the component.
@@ -1819,7 +1846,7 @@ type HTMLAnchorProps = React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAn
1819
1846
  /**
1820
1847
  * Defines the props of the component.
1821
1848
  */
1822
- interface LinkProps extends GenericProps$1, HasAriaDisabled {
1849
+ interface LinkProps extends GenericProps$1, HasAriaDisabled$1 {
1823
1850
  /** Color variant. */
1824
1851
  color?: ColorWithVariants$1;
1825
1852
  /** Lightened or darkened variant of the selected icon color. */
@@ -1854,7 +1881,7 @@ interface LinkProps extends GenericProps$1, HasAriaDisabled {
1854
1881
  * @param ref Component ref.
1855
1882
  * @return React element.
1856
1883
  */
1857
- declare const Link: Comp<LinkProps, HTMLAnchorElement | HTMLButtonElement>;
1884
+ declare const Link: Comp<LinkProps, HTMLButtonElement | HTMLAnchorElement>;
1858
1885
 
1859
1886
  /**
1860
1887
  * Defines the props of the component.
@@ -1931,7 +1958,7 @@ type ListItemSize = Extract<Size$1, 'tiny' | 'regular' | 'big' | 'huge'>;
1931
1958
  /**
1932
1959
  * Defines the props of the component.
1933
1960
  */
1934
- interface ListItemProps extends GenericProps$1, HasAriaDisabled {
1961
+ interface ListItemProps extends GenericProps$1, HasAriaDisabled$1 {
1935
1962
  /** A component to be rendered after the content. */
1936
1963
  after?: ReactNode;
1937
1964
  /** A component to be rendered before the content. */
@@ -2073,7 +2100,7 @@ declare const NavigationItem: (<E extends ElementType = "a">(props: React$1.Prop
2073
2100
  as?: E | undefined;
2074
2101
  } & HasTheme$1 & HasClassName$1 & BaseNavigationItemProps & HasRequiredLinkHref<E> & React$1.ComponentProps<E> & {
2075
2102
  ref?: ComponentRef<E> | undefined;
2076
- }) => React$1.JSX.Element) & {
2103
+ }) => React.JSX.Element) & {
2077
2104
  displayName: string;
2078
2105
  className: "lumx-navigation-item";
2079
2106
  };
@@ -2334,7 +2361,7 @@ declare const ProgressTrackerStepPanel: Comp<ProgressTrackerStepPanelProps, HTML
2334
2361
  /**
2335
2362
  * Defines the props of the component.
2336
2363
  */
2337
- interface RadioButtonProps extends GenericProps$1, HasTheme$1, HasAriaDisabled {
2364
+ interface RadioButtonProps extends GenericProps$1, HasTheme$1, HasAriaDisabled$1 {
2338
2365
  /** Helper text. */
2339
2366
  helper?: string;
2340
2367
  /** Native input id property. */
@@ -2489,7 +2516,7 @@ interface SideNavigationItemProps extends GenericProps$1, HasCloseMode {
2489
2516
  /** SideNavigationItem elements. */
2490
2517
  children?: ReactNode;
2491
2518
  /** Emphasis variant. */
2492
- emphasis?: Emphasis;
2519
+ emphasis?: Emphasis$1;
2493
2520
  /** Label content. */
2494
2521
  label: string | ReactNode;
2495
2522
  /** Icon (SVG path). */
@@ -2641,6 +2668,8 @@ declare const clamp: (value: number, min: number, max: number) => number;
2641
2668
  * Defines the props of the component.
2642
2669
  */
2643
2670
  interface SlideshowProps extends GenericProps$1, Pick<SlidesProps, 'autoPlay' | 'slidesId' | 'id' | 'theme' | 'fillHeight' | 'groupBy' | 'slideGroupLabel'> {
2671
+ /** Whether to use CSS transform or native scroll snap. */
2672
+ mode?: 'transform' | 'scroll-snap';
2644
2673
  /** current slide active */
2645
2674
  activeIndex?: SlidesProps['activeIndex'];
2646
2675
  /** Interval between each slide when automatic rotation is enabled. */
@@ -2787,7 +2816,7 @@ declare const SlideshowControls: Comp<SlideshowControlsProps, HTMLDivElement> &
2787
2816
  };
2788
2817
  };
2789
2818
 
2790
- interface SlidesProps extends GenericProps$1, HasTheme$1 {
2819
+ interface SlidesCommonProps extends GenericProps$1, HasTheme$1 {
2791
2820
  /** current slide active */
2792
2821
  activeIndex: number;
2793
2822
  /** slides id to be added to the wrapper */
@@ -2816,6 +2845,14 @@ interface SlidesProps extends GenericProps$1, HasTheme$1 {
2816
2845
  /** Children */
2817
2846
  children?: React__default.ReactNode;
2818
2847
  }
2848
+ interface SlidesTransformProps extends SlidesCommonProps {
2849
+ mode?: 'transform';
2850
+ }
2851
+ interface SlidesScrollSnapProps extends SlidesCommonProps {
2852
+ mode: 'scroll-snap';
2853
+ onChange: (index: number) => void;
2854
+ }
2855
+ type SlidesProps = SlidesTransformProps | SlidesScrollSnapProps;
2819
2856
  /**
2820
2857
  * Slides component.
2821
2858
  *
@@ -2828,7 +2865,7 @@ declare const Slides: Comp<SlidesProps, HTMLDivElement>;
2828
2865
  /**
2829
2866
  * Defines the props of the component.
2830
2867
  */
2831
- interface SwitchProps extends GenericProps$1, HasTheme$1, HasAriaDisabled {
2868
+ interface SwitchProps extends GenericProps$1, HasTheme$1, HasAriaDisabled$1 {
2832
2869
  /** Helper text. */
2833
2870
  helper?: string;
2834
2871
  /** Whether it is checked or not. */
@@ -3079,7 +3116,7 @@ declare const TabPanel: Comp<TabPanelProps, HTMLDivElement>;
3079
3116
  /**
3080
3117
  * Defines the props of the component.
3081
3118
  */
3082
- interface TextFieldProps extends GenericProps$1, HasTheme$1, HasAriaDisabled {
3119
+ interface TextFieldProps extends GenericProps$1, HasTheme$1, HasAriaDisabled$1 {
3083
3120
  /** Chip Group to be rendered before the main text input. */
3084
3121
  chips?: ReactNode;
3085
3122
  /** Props to pass to the clear button (minus those already set by the TextField props). If not specified, the button won't be displayed. */
@@ -3247,7 +3284,7 @@ interface FileInputProps extends Omit<React__default.ComponentProps<'input'>, 'o
3247
3284
  /**
3248
3285
  * Defines the props of the component.
3249
3286
  */
3250
- interface UploaderProps extends GenericProps$1, HasTheme$1, HasAriaDisabled {
3287
+ interface UploaderProps extends GenericProps$1, HasTheme$1, HasAriaDisabled$1 {
3251
3288
  /** Image aspect ratio. */
3252
3289
  aspectRatio?: AspectRatio;
3253
3290
  /** Icon (SVG path). */
@@ -3331,5 +3368,5 @@ declare const ThemeProvider: React__default.FC<{
3331
3368
  /** Get the theme in the current context. */
3332
3369
  declare function useTheme(): ThemeContextValue;
3333
3370
 
3334
- export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, Checkbox, Chip, ChipGroup, CommentBlock, CommentBlockVariant, 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, 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, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, isClickable, useFocusPointStyle, useHeadingLevel, useTheme };
3335
- export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectMultipleProps, SelectProps, 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 };
3371
+ export { AlertDialog, Autocomplete, AutocompleteMultiple, Avatar, Badge, BadgeWrapper, Button, ButtonEmphasis, ButtonGroup, CLASSNAME, COMPONENT_NAME, Checkbox, Chip, ChipGroup, 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, 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, SideNavigation, SideNavigationItem, SkeletonCircle, SkeletonRectangle, SkeletonRectangleVariant, SkeletonTypography, Slider, Slides, Slideshow, SlideshowControls, SlideshowItem, Switch, Tab, TabList, TabListLayout, TabPanel, TabProvider, Table, TableBody, TableCell, TableCellVariant, TableHeader, TableRow, Text, TextField, ThOrder, ThemeProvider, Thumbnail, ThumbnailAspectRatio, ThumbnailObjectFit, ThumbnailVariant, Toolbar, Tooltip, Uploader, UploaderVariant, UserBlock, clamp, isClickable, useFocusPointStyle, useHeadingLevel, useTheme };
3372
+ export type { AlertDialogProps, AutocompleteMultipleProps, AutocompleteProps, AvatarProps, AvatarSize, BadgeProps, BadgeWrapperProps, BaseButtonProps, ButtonGroupProps, ButtonProps, ButtonSize, CheckboxProps, ChipGroupProps, ChipProps, CommentBlockProps, DatePickerControlledProps, DatePickerFieldProps, DatePickerProps, DialogProps, DialogSizes, DividerProps, DragHandleProps, DropdownProps, Elevation, ExpansionPanelProps, FlagProps, FlexBoxProps, FlexHorizontalAlignment, FlexVerticalAlignment, FocusPoint, GapSize, GenericBlockProps, GridColumnGapSize, GridColumnProps, GridItemProps, GridProps, HeadingLevelProviderProps, HeadingProps, IconButtonProps, IconProps, IconSizes, ImageBlockProps, ImageBlockSize, ImageLightboxProps, InlineListProps, InputHelperProps, InputLabelProps, LightboxProps, LinkPreviewProps, LinkProps, ListDividerProps, ListItemProps, ListItemSize, ListProps, ListSubheaderProps, MarginAutoAlignment, MessageProps, MosaicProps, NavigationProps, NotificationProps, Offset, PopoverDialogProps, PopoverProps, PostBlockProps, ProgressCircularProps, ProgressCircularSize, ProgressLinearProps, ProgressProps, ProgressTrackerProps, ProgressTrackerProviderProps, ProgressTrackerStepPanelProps, ProgressTrackerStepProps, RadioButtonProps, RadioGroupProps, RawInputTextProps, RawInputTextareaProps, SelectMultipleProps, SelectProps, SideNavigationItemProps, SideNavigationProps, SkeletonCircleProps, SkeletonRectangleProps, SkeletonTypographyProps, SliderProps, SlidesCommonProps, 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 };