@lumx/react 4.0.1-alpha.3 → 4.0.1-alpha.5
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/{ClSM3-wl.js → BYSwKsj4.js} +85 -3
- package/_internal/BYSwKsj4.js.map +1 -0
- package/index.d.ts +22 -3
- package/index.js +432 -440
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/utils/index.d.ts +25 -1
- package/utils/index.js +1 -1
- package/_internal/ClSM3-wl.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React__default, { useContext, useEffect, createContext, useMemo, useRef } from 'react';
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import isEmpty from 'lodash/isEmpty';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
4
|
+
import ReactDOM, { createPortal } from 'react-dom';
|
|
5
|
+
import '@lumx/core/js/constants';
|
|
5
6
|
|
|
6
7
|
const DisabledStateContext = /*#__PURE__*/React__default.createContext({
|
|
7
8
|
state: null
|
|
@@ -27,6 +28,21 @@ function useDisabledStateContext() {
|
|
|
27
28
|
return useContext(DisabledStateContext);
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Optional global `window` instance (not defined when running SSR).
|
|
33
|
+
*/
|
|
34
|
+
const WINDOW = typeof window !== 'undefined' ? window : undefined;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Optional global `document` instance (not defined when running SSR).
|
|
38
|
+
*/
|
|
39
|
+
const DOCUMENT = typeof document !== 'undefined' ? document : undefined;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Check if we are running in a true browser
|
|
43
|
+
*/
|
|
44
|
+
const IS_BROWSER = typeof navigator !== 'undefined' && !navigator.userAgent.includes('jsdom');
|
|
45
|
+
|
|
30
46
|
const EVENT_TYPES = ['mousedown', 'touchstart'];
|
|
31
47
|
function isClickAway(targets, refs) {
|
|
32
48
|
// The targets elements are not contained in any of the listed element references.
|
|
@@ -116,6 +132,11 @@ const ClickAwayProvider = ({
|
|
|
116
132
|
};
|
|
117
133
|
ClickAwayProvider.displayName = 'ClickAwayProvider';
|
|
118
134
|
|
|
135
|
+
/** Check if user prefers reduced motion */
|
|
136
|
+
function isReducedMotion() {
|
|
137
|
+
return WINDOW?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
|
|
138
|
+
}
|
|
139
|
+
|
|
119
140
|
/**
|
|
120
141
|
* Portal initializing function.
|
|
121
142
|
* If it does not provide a container, the Portal children will render in classic React tree and not in a portal.
|
|
@@ -155,5 +176,66 @@ const Portal = ({
|
|
|
155
176
|
return /*#__PURE__*/createPortal(children, context.container);
|
|
156
177
|
};
|
|
157
178
|
|
|
158
|
-
|
|
159
|
-
|
|
179
|
+
/** Unref a react ref or element */
|
|
180
|
+
function unref(maybeElement) {
|
|
181
|
+
if (maybeElement instanceof Element) return maybeElement;
|
|
182
|
+
return maybeElement?.current;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function setupViewTransitionName(groups, type) {
|
|
186
|
+
const resets = [];
|
|
187
|
+
for (const group of groups) {
|
|
188
|
+
const element = unref(group[type]);
|
|
189
|
+
if (element instanceof HTMLElement) {
|
|
190
|
+
const originalName = element.style.viewTransitionName;
|
|
191
|
+
resets.push(() => {
|
|
192
|
+
element.style.viewTransitionName = originalName;
|
|
193
|
+
});
|
|
194
|
+
element.style.viewTransitionName = group.name;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return () => {
|
|
198
|
+
for (const reset of resets) {
|
|
199
|
+
reset();
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Wrapper around the `document.startViewTransition` handling browser incompatibilities, react DOM flush and
|
|
206
|
+
* user preference.
|
|
207
|
+
*
|
|
208
|
+
* @param updateCallback callback containing the changes to apply within the view transition.
|
|
209
|
+
* @param groups setup groups of old and new element pair to transition between.
|
|
210
|
+
*/
|
|
211
|
+
async function startViewTransition(updateCallback, {
|
|
212
|
+
groups = []
|
|
213
|
+
} = {}) {
|
|
214
|
+
const start = document?.startViewTransition?.bind(document);
|
|
215
|
+
const prefersReducedMotion = isReducedMotion();
|
|
216
|
+
const {
|
|
217
|
+
flushSync
|
|
218
|
+
} = ReactDOM;
|
|
219
|
+
if (prefersReducedMotion || !start || !flushSync) {
|
|
220
|
+
// Skip, apply changes without a transition
|
|
221
|
+
updateCallback();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Setup view transition name on old elements
|
|
226
|
+
const resetOldElement = setupViewTransitionName(groups, 'old');
|
|
227
|
+
let resetNewElements;
|
|
228
|
+
|
|
229
|
+
// Start view transition, apply changes & flush to DOM
|
|
230
|
+
await start(() => {
|
|
231
|
+
resetOldElement();
|
|
232
|
+
flushSync(updateCallback);
|
|
233
|
+
|
|
234
|
+
// Setup view transition name on new elements
|
|
235
|
+
resetNewElements = setupViewTransitionName(groups, 'new');
|
|
236
|
+
}).updateCallbackDone;
|
|
237
|
+
resetNewElements?.();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export { ClickAwayProvider as C, DisabledStateProvider as D, IS_BROWSER as I, Portal as P, WINDOW as W, PortalProvider as a, DOCUMENT as b, isReducedMotion as i, startViewTransition as s, useDisabledStateContext as u };
|
|
241
|
+
//# sourceMappingURL=BYSwKsj4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BYSwKsj4.js","sources":["../../src/utils/disabled/DisabledStateContext.tsx","../../src/constants.ts","../../src/hooks/useClickAway.tsx","../../src/utils/ClickAwayProvider/ClickAwayProvider.tsx","../../src/utils/browser/isReducedMotion.ts","../../src/utils/Portal/PortalProvider.tsx","../../src/utils/Portal/Portal.tsx","../../src/utils/react/unref.ts","../../src/utils/browser/DOM/startViewTransition.ts"],"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","export {\n DIALOG_TRANSITION_DURATION,\n NOTIFICATION_TRANSITION_DURATION,\n TOOLTIP_HOVER_DELAY,\n TOOLTIP_LONG_PRESS_DELAY,\n VISUALLY_HIDDEN,\n} from '@lumx/core/js/constants';\n\n/**\n * Optional global `window` instance (not defined when running SSR).\n */\nexport const WINDOW = typeof window !== 'undefined' ? window : undefined;\n\n/**\n * Optional global `document` instance (not defined when running SSR).\n */\nexport const DOCUMENT = typeof document !== 'undefined' ? document : undefined;\n\n/**\n * Check if we are running in a true browser\n */\nexport const IS_BROWSER = typeof navigator !== 'undefined' && !navigator.userAgent.includes('jsdom');\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 { WINDOW } from '@lumx/react/constants';\n\n/** Check if user prefers reduced motion */\nexport function isReducedMotion() {\n return WINDOW?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n}\n","import React from 'react';\n\ntype Container = DocumentFragment | Element;\n\n/**\n * Portal initializing function.\n * If it does not provide a container, the Portal children will render in classic React tree and not in a portal.\n */\nexport type PortalInit = () => {\n container?: Container;\n teardown?: () => void;\n};\n\nexport const PortalContext = React.createContext<PortalInit>(() => ({ container: document.body }));\n\nexport interface PortalProviderProps {\n children?: React.ReactNode;\n value: PortalInit;\n}\n\n/**\n * Customize where <Portal> wrapped elements render (tooltip, popover, dialog, etc.)\n */\nexport const PortalProvider: React.FC<PortalProviderProps> = PortalContext.Provider;\n","import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { PortalContext } from './PortalProvider';\n\nexport interface PortalProps {\n enabled?: boolean;\n children: React.ReactNode;\n}\n\n/**\n * Render children in a portal outside the current DOM position\n * (defaults to `document.body` but can be customized with the PortalContextProvider)\n */\nexport const Portal: React.FC<PortalProps> = ({ children, enabled = true }) => {\n const init = React.useContext(PortalContext);\n const context = React.useMemo(\n () => {\n return enabled ? init() : null;\n },\n // Only update on 'enabled'\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [enabled],\n );\n\n React.useLayoutEffect(() => {\n return context?.teardown;\n }, [context?.teardown, enabled]);\n\n if (!context?.container) {\n return <>{children}</>;\n }\n return createPortal(children, context.container);\n};\n","import { MaybeElementOrRef } from '@lumx/react/utils/type';\n\n/** Unref a react ref or element */\nexport function unref(maybeElement: MaybeElementOrRef<Element>) {\n if (maybeElement instanceof Element) return maybeElement;\n return maybeElement?.current;\n}\n","import ReactDOM from 'react-dom';\n\nimport { MaybeElementOrRef } from '@lumx/react/utils/type';\n\nimport { unref } from '../../react/unref';\nimport { isReducedMotion } from '../isReducedMotion';\n\ninterface TransitionGroup {\n /** Element that should be transitioned from */\n old: MaybeElementOrRef<Element>;\n /** Element that should be transitioned to */\n new: MaybeElementOrRef<Element>;\n /** viewTransitionName */\n name: string;\n}\n\nfunction setupViewTransitionName(groups: TransitionGroup[], type: 'old' | 'new') {\n const resets: Array<() => void> = [];\n for (const group of groups) {\n const element = unref(group[type]);\n if (element instanceof HTMLElement) {\n const originalName = element.style.viewTransitionName;\n resets.push(() => {\n element.style.viewTransitionName = originalName;\n });\n element.style.viewTransitionName = group.name;\n }\n }\n return () => {\n for (const reset of resets) {\n reset();\n }\n };\n}\n\n/**\n * Wrapper around the `document.startViewTransition` handling browser incompatibilities, react DOM flush and\n * user preference.\n *\n * @param updateCallback callback containing the changes to apply within the view transition.\n * @param groups setup groups of old and new element pair to transition between.\n */\nexport async function startViewTransition(\n updateCallback: () => void,\n {\n groups = [],\n }: {\n groups?: TransitionGroup[];\n } = {},\n) {\n const start = (document as any)?.startViewTransition?.bind(document);\n const prefersReducedMotion = isReducedMotion();\n const { flushSync } = ReactDOM as any;\n if (prefersReducedMotion || !start || !flushSync) {\n // Skip, apply changes without a transition\n updateCallback();\n return;\n }\n\n // Setup view transition name on old elements\n const resetOldElement = setupViewTransitionName(groups, 'old');\n\n let resetNewElements: (() => void) | undefined;\n\n // Start view transition, apply changes & flush to DOM\n await start(() => {\n resetOldElement();\n\n flushSync(updateCallback);\n\n // Setup view transition name on new elements\n resetNewElements = setupViewTransitionName(groups, 'new');\n }).updateCallbackDone;\n\n resetNewElements?.();\n}\n"],"names":["DisabledStateContext","React","createContext","state","DisabledStateProvider","children","value","_jsx","Provider","useDisabledStateContext","useContext","WINDOW","window","undefined","DOCUMENT","document","IS_BROWSER","navigator","userAgent","includes","EVENT_TYPES","isClickAway","targets","refs","some","ref","target","current","contains","useClickAway","callback","childrenRefs","useEffect","currentRefs","isEmpty","listener","evt","composedPath","forEach","evtType","addEventListener","removeEventListener","ClickAwayAncestorContext","ClickAwayProvider","parentRef","parentContext","currentContext","useMemo","context","addRefs","newChildrenRefs","push","useRef","displayName","isReducedMotion","matchMedia","matches","PortalContext","container","body","PortalProvider","Portal","enabled","init","useLayoutEffect","teardown","_Fragment","createPortal","unref","maybeElement","Element","setupViewTransitionName","groups","type","resets","group","element","HTMLElement","originalName","style","viewTransitionName","name","reset","startViewTransition","updateCallback","start","bind","prefersReducedMotion","flushSync","ReactDOM","resetOldElement","resetNewElements","updateCallbackDone"],"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;;ACpBA;AACA;AACA;AACO,MAAMW,MAAM,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGA,MAAM,GAAGC;;AAE/D;AACA;AACA;AACO,MAAMC,QAAQ,GAAG,OAAOC,QAAQ,KAAK,WAAW,GAAGA,QAAQ,GAAGF;;AAErE;AACA;AACA;MACaG,UAAU,GAAG,OAAOC,SAAS,KAAK,WAAW,IAAI,CAACA,SAAS,CAACC,SAAS,CAACC,QAAQ,CAAC,OAAO;;ACfnG,MAAMC,WA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MAAMM,eAAe,GAAGnB,uBAAuB,CAACC,MAAM,EAAE,KAAK,CAAC;AAE9D,EAAA,IAAImB,gBAA0C;;AAE9C;EACA,MAAMN,KAAK,CAAC,MAAM;AACdK,IAAAA,eAAe,EAAE;IAEjBF,SAAS,CAACJ,cAAc,CAAC;;AAEzB;AACAO,IAAAA,gBAAgB,GAAGpB,uBAAuB,CAACC,MAAM,EAAE,KAAK,CAAC;EAC7D,CAAC,CAAC,CAACoB,kBAAkB;AAErBD,EAAAA,gBAAgB,IAAI;AACxB;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { GenericProps, HasTheme, ValueOf, HasCloseMode, TextElement, HeadingElem
|
|
|
5
5
|
export * from '@lumx/core/js/types';
|
|
6
6
|
import * as React$1 from 'react';
|
|
7
7
|
import React__default, { Ref, ReactElement, ReactNode, SyntheticEvent, MouseEventHandler, KeyboardEventHandler, AriaAttributes, DetailedHTMLProps, ButtonHTMLAttributes, InputHTMLAttributes, RefObject, ImgHTMLAttributes, CSSProperties, SetStateAction, Key, ElementType, ComponentProps } from 'react';
|
|
8
|
-
import { IconProps } from '@lumx/core/js/components/Icon';
|
|
9
|
-
export { IconProps, IconSizes } from '@lumx/core/js/components/Icon';
|
|
10
8
|
|
|
11
9
|
/** LumX Component Type. */
|
|
12
10
|
type Comp<P, T = HTMLElement> = {
|
|
@@ -1314,6 +1312,27 @@ interface GridColumnProps extends GenericProps {
|
|
|
1314
1312
|
*/
|
|
1315
1313
|
declare const GridColumn: Comp<GridColumnProps, HTMLElement>;
|
|
1316
1314
|
|
|
1315
|
+
type IconSizes = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
|
|
1316
|
+
/**
|
|
1317
|
+
* Defines the props of the component.
|
|
1318
|
+
*/
|
|
1319
|
+
interface IconProps extends GenericProps, HasTheme {
|
|
1320
|
+
/** Color variant. */
|
|
1321
|
+
color?: ColorWithVariants;
|
|
1322
|
+
/** Lightened or darkened variant of the selected icon color. */
|
|
1323
|
+
colorVariant?: ColorVariant;
|
|
1324
|
+
/** Whether the icon has a shape. */
|
|
1325
|
+
hasShape?: boolean;
|
|
1326
|
+
/**
|
|
1327
|
+
* Icon (SVG path) draw code (`d` property of the `<path>` SVG element).
|
|
1328
|
+
* See https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths
|
|
1329
|
+
*/
|
|
1330
|
+
icon: string;
|
|
1331
|
+
/** Size variant. */
|
|
1332
|
+
size?: IconSizes;
|
|
1333
|
+
/** Sets an alternative text on the svg. Will set an `img` role to the svg. */
|
|
1334
|
+
alt?: string;
|
|
1335
|
+
}
|
|
1317
1336
|
/**
|
|
1318
1337
|
* Icon component.
|
|
1319
1338
|
*
|
|
@@ -3166,4 +3185,4 @@ declare const ThemeProvider: React__default.FC<{
|
|
|
3166
3185
|
declare function useTheme(): ThemeContextValue;
|
|
3167
3186
|
|
|
3168
3187
|
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 };
|
|
3169
|
-
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, 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 };
|
|
3188
|
+
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 };
|