@dxos/react-ui 0.8.4-main.dedc0f3 → 0.8.4-main.e250131250
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/dist/lib/browser/chunk-LUPEFGHJ.mjs +776 -0
- package/dist/lib/browser/chunk-LUPEFGHJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4100 -62
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +99 -60
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/chunk-EQOBFLZC.mjs +778 -0
- package/dist/lib/node-esm/chunk-EQOBFLZC.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +4100 -62
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +99 -60
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +0 -6
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +0 -6
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -6
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Buttons → Button}/Button.d.ts +4 -4
- package/dist/types/src/components/Button/Button.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/Button.stories.d.ts +1 -7
- package/dist/types/src/components/Button/Button.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/IconButton.d.ts +2 -2
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/IconButton.stories.d.ts +0 -6
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Buttons → Button}/Toggle.d.ts +2 -2
- package/dist/types/src/components/Button/Toggle.d.ts.map +1 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts +16 -0
- package/dist/types/src/components/Button/Toggle.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/ToggleGroup.d.ts +27 -0
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -0
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +27 -0
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/index.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.d.ts +145 -0
- package/dist/types/src/components/Card/Card.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.stories.d.ts +21 -0
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -0
- package/dist/types/src/components/Card/index.d.ts +2 -0
- package/dist/types/src/components/Card/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/CopyButton.d.ts +1 -1
- package/dist/types/src/components/Clipboard/CopyButton.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +10 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +53 -0
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -0
- package/dist/types/src/components/{Dialogs → Dialog}/AlertDialog.stories.d.ts +0 -6
- package/dist/types/src/components/Dialog/AlertDialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts +66 -0
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +25 -0
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -0
- package/dist/types/src/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts +11 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts +7 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +8 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts +9 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts +5 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.d.ts +44 -0
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts +9 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +2 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -0
- package/dist/types/src/components/Icon/Icon.d.ts +5 -2
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +25 -0
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.d.ts +14 -0
- package/dist/types/src/components/Image/Image.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.stories.d.ts +33 -0
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -0
- package/dist/types/src/components/Image/index.d.ts +2 -0
- package/dist/types/src/components/Image/index.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +7 -9
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +8 -14
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts +0 -6
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Lists → List}/List.d.ts +10 -4
- package/dist/types/src/components/List/List.d.ts.map +1 -0
- package/dist/types/src/components/{Lists → List}/List.stories.d.ts +8 -8
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +1 -0
- package/dist/types/src/components/List/Tree.d.ts.map +1 -0
- package/dist/types/src/components/{Lists → List}/Tree.stories.d.ts +0 -6
- package/dist/types/src/components/List/Tree.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +1 -0
- package/dist/types/src/components/{Lists → List}/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +1 -0
- package/dist/types/src/components/List/index.d.ts.map +1 -0
- package/dist/types/src/components/Main/Main.d.ts +17 -27
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +0 -4
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/{Menus → Menu}/ContextMenu.d.ts +6 -6
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
- package/dist/types/src/components/{Menus → Menu}/ContextMenu.stories.d.ts +0 -6
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +113 -0
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +28 -0
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/Menu/index.d.ts.map +1 -0
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +5 -7
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +34 -25
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +0 -6
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +32 -24
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +63 -12
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +55 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +23 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts +2 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/Select/Select.d.ts +10 -10
- package/dist/types/src/components/Select/Select.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +2 -8
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Separator/Separator.d.ts +4 -4
- package/dist/types/src/components/Separator/Separator.d.ts.map +1 -1
- package/dist/types/src/components/Skeleton/Skeleton.d.ts +12 -0
- package/dist/types/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts +17 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/index.d.ts +2 -0
- package/dist/types/src/components/Skeleton/index.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts +37 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts +7 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/index.d.ts +2 -0
- package/dist/types/src/components/Splitter/index.d.ts.map +1 -0
- package/dist/types/src/components/Status/Status.d.ts +3 -4
- package/dist/types/src/components/Status/Status.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +4 -8
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +5 -10
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +3 -3
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts +12 -0
- package/dist/types/src/components/ThemeProvider/ThemeProvider.stories.d.ts.map +1 -0
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +19 -19
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +0 -6
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +46 -20
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +0 -6
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +10 -12
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +2 -8
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +14 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +23 -0
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts +15 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts +8 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts +11 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +2 -2
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts +2 -2
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +0 -6
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +1 -2
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts +0 -6
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Column/Column.d.ts +51 -0
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts +25 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/index.d.ts +2 -0
- package/dist/types/src/primitives/Column/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.d.ts +11 -0
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts +6 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/index.d.ts +2 -0
- package/dist/types/src/primitives/Container/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts +15 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts +8 -0
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/index.d.ts +2 -0
- package/dist/types/src/primitives/Flex/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts +14 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts +8 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/index.d.ts +2 -0
- package/dist/types/src/primitives/Grid/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts +46 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts +6 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/index.d.ts +2 -0
- package/dist/types/src/primitives/Panel/index.d.ts.map +1 -0
- package/dist/types/src/primitives/index.d.ts +6 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -0
- package/dist/types/src/testing/Loading.d.ts +9 -0
- package/dist/types/src/testing/Loading.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/index.d.ts +2 -1
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts +15 -0
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +12 -0
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts +5 -1
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +11 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/usePx.d.ts +8 -0
- package/dist/types/src/util/usePx.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -31
- package/src/components/Avatars/Avatar.stories.tsx +7 -10
- package/src/components/Avatars/Avatar.tsx +6 -13
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -5
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +4 -7
- package/src/components/Breadcrumb/Breadcrumb.tsx +11 -37
- package/src/components/{Buttons → Button}/Button.stories.tsx +5 -7
- package/src/components/{Buttons → Button}/Button.tsx +12 -26
- package/src/components/{Buttons → Button}/IconButton.stories.tsx +4 -7
- package/src/components/{Buttons → Button}/IconButton.tsx +19 -14
- package/src/components/{Buttons → Button}/Toggle.stories.tsx +7 -9
- package/src/components/{Buttons → Button}/Toggle.tsx +4 -4
- package/src/components/{Buttons → Button}/ToggleGroup.stories.tsx +2 -5
- package/src/components/{Buttons → Button}/ToggleGroup.tsx +12 -16
- package/src/components/Card/Card.stories.tsx +151 -0
- package/src/components/Card/Card.tsx +394 -0
- package/src/components/Card/index.ts +5 -0
- package/src/components/Clipboard/CopyButton.tsx +7 -7
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialog/AlertDialog.stories.tsx +69 -0
- package/src/components/{Dialogs → Dialog}/AlertDialog.tsx +121 -82
- package/src/components/Dialog/Dialog.stories.tsx +178 -0
- package/src/components/Dialog/Dialog.tsx +280 -0
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +50 -0
- package/src/components/ErrorFallback/ErrorFallback.tsx +70 -0
- package/src/components/ErrorFallback/ErrorStack.tsx +80 -0
- package/src/components/ErrorFallback/ThrowError.tsx +37 -0
- package/src/components/ErrorFallback/index.ts +9 -0
- package/src/components/Focus/AUDIT.md +43 -0
- package/src/components/Focus/Focus.stories.tsx +230 -0
- package/src/components/Focus/Focus.tsx +201 -0
- package/src/components/Focus/index.ts +5 -0
- package/src/components/Icon/Icon.stories.tsx +144 -0
- package/src/components/Icon/Icon.tsx +6 -2
- package/src/components/Image/Image.stories.tsx +86 -0
- package/src/components/Image/Image.tsx +223 -0
- package/src/components/Image/index.ts +5 -0
- package/src/components/Input/Input.stories.tsx +21 -43
- package/src/components/Input/Input.tsx +38 -74
- package/src/components/Link/Link.stories.tsx +2 -5
- package/src/components/Link/Link.tsx +2 -2
- package/src/components/{Lists → List}/List.stories.tsx +30 -37
- package/src/components/{Lists → List}/List.tsx +16 -19
- package/src/components/{Lists → List}/ListDropIndicator.tsx +7 -7
- package/src/components/{Lists → List}/Tree.stories.tsx +5 -8
- package/src/components/{Lists → List}/TreeDropIndicator.tsx +6 -6
- package/src/components/{Lists → List}/Treegrid.stories.tsx +3 -3
- package/src/components/{Lists → List}/Treegrid.tsx +66 -30
- package/src/components/Main/Main.stories.tsx +41 -23
- package/src/components/Main/Main.tsx +163 -97
- package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +2 -5
- package/src/components/{Menus → Menu}/ContextMenu.tsx +9 -33
- package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +3 -6
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +139 -112
- package/src/components/Message/Message.stories.tsx +28 -15
- package/src/components/Message/Message.tsx +43 -34
- package/src/components/Popover/Popover.stories.tsx +5 -8
- package/src/components/Popover/Popover.tsx +118 -96
- package/src/components/ScrollArea/ScrollArea.stories.tsx +222 -35
- package/src/components/ScrollArea/ScrollArea.tsx +97 -79
- package/src/components/ScrollArea/index.ts +1 -1
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +90 -0
- package/src/components/ScrollContainer/ScrollContainer.tsx +320 -0
- package/src/components/ScrollContainer/index.ts +5 -0
- package/src/components/Select/Select.stories.tsx +6 -8
- package/src/components/Select/Select.tsx +11 -27
- package/src/components/Separator/Separator.tsx +5 -8
- package/src/components/Skeleton/Skeleton.stories.tsx +52 -0
- package/src/components/Skeleton/Skeleton.tsx +26 -0
- package/src/components/Skeleton/index.ts +5 -0
- package/src/components/Splitter/Splitter.stories.tsx +83 -0
- package/src/components/Splitter/Splitter.tsx +140 -0
- package/src/components/Splitter/index.ts +5 -0
- package/src/components/Status/Status.stories.tsx +21 -20
- package/src/components/Status/Status.tsx +10 -7
- package/src/components/Tag/Tag.stories.tsx +8 -12
- package/src/components/Tag/Tag.tsx +3 -8
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +32 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +10 -9
- package/src/components/ThemeProvider/TranslationsProvider.tsx +1 -16
- package/src/components/ThemeProvider/index.ts +3 -3
- package/src/components/Toast/Toast.stories.tsx +3 -6
- package/src/components/Toast/Toast.tsx +22 -41
- package/src/components/Toolbar/Toolbar.stories.tsx +4 -9
- package/src/components/Toolbar/Toolbar.tsx +183 -11
- package/src/components/Tooltip/Tooltip.stories.tsx +17 -18
- package/src/components/Tooltip/Tooltip.tsx +42 -39
- package/src/components/index.ts +15 -9
- package/src/exemplars/generics.stories.tsx +41 -0
- package/src/exemplars/slot.stories.tsx +117 -0
- package/src/exemplars/tabster.stories.tsx +127 -0
- package/src/exemplars/virtualizer.stories.tsx +137 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDensityContext.ts +3 -3
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/hooks/useSafeArea.ts +3 -2
- package/src/hooks/useVisualViewport.ts +4 -4
- package/src/index.ts +2 -1
- package/src/playground/Controls.stories.tsx +3 -12
- package/src/playground/Custom.stories.tsx +13 -34
- package/src/playground/Typography.stories.tsx +3 -6
- package/src/primitives/Column/AUDIT.md +354 -0
- package/src/primitives/Column/Column.stories.tsx +183 -0
- package/src/primitives/Column/Column.tsx +169 -0
- package/src/primitives/Column/index.ts +5 -0
- package/src/primitives/Container/Container.stories.tsx +30 -0
- package/src/primitives/Container/Container.tsx +19 -0
- package/src/primitives/Container/index.ts +5 -0
- package/src/primitives/Flex/Flex.stories.tsx +58 -0
- package/src/primitives/Flex/Flex.tsx +24 -0
- package/src/primitives/Flex/index.ts +5 -0
- package/src/primitives/Grid/Grid.stories.tsx +57 -0
- package/src/primitives/Grid/Grid.tsx +30 -0
- package/src/primitives/Grid/index.ts +5 -0
- package/src/primitives/Panel/Panel.stories.tsx +67 -0
- package/src/primitives/Panel/Panel.tsx +114 -0
- package/src/primitives/Panel/index.ts +5 -0
- package/src/primitives/index.ts +9 -0
- package/src/testing/Loading.tsx +26 -0
- package/src/testing/decorators/index.ts +2 -1
- package/src/testing/decorators/withLayout.tsx +77 -0
- package/src/testing/decorators/withLayoutVariants.tsx +48 -0
- package/src/testing/decorators/withTheme.tsx +37 -0
- package/src/testing/index.ts +2 -0
- package/src/translations.ts +19 -0
- package/src/util/index.ts +3 -1
- package/src/util/usePx.ts +62 -0
- package/dist/lib/browser/chunk-Y4PW3CX2.mjs +0 -4402
- package/dist/lib/browser/chunk-Y4PW3CX2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-L6LIOSFT.mjs +0 -4404
- package/dist/lib/node-esm/chunk-L6LIOSFT.mjs.map +0 -7
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +0 -15
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +0 -1
- package/dist/types/src/components/AnchoredOverflow/index.d.ts +0 -2
- package/dist/types/src/components/AnchoredOverflow/index.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Button.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -19
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +0 -31
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +0 -37
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +0 -1
- package/dist/types/src/components/Buttons/index.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts +0 -31
- package/dist/types/src/components/Dialogs/AlertDialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts +0 -31
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +0 -26
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +0 -1
- package/dist/types/src/components/Dialogs/index.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.d.ts.map +0 -1
- package/dist/types/src/components/Lists/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/ListDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/TreeDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/Lists/Treegrid.stories.d.ts.map +0 -1
- package/dist/types/src/components/Lists/index.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +0 -113
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +0 -21
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/index.d.ts.map +0 -1
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts +0 -12
- package/dist/types/src/testing/decorators/withSurfaceVariantsLayout.d.ts.map +0 -1
- package/dist/types/src/util/ThemedClassName.d.ts +0 -5
- package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +0 -59
- package/src/components/AnchoredOverflow/index.ts +0 -5
- package/src/components/Dialogs/AlertDialog.stories.tsx +0 -72
- package/src/components/Dialogs/Dialog.stories.tsx +0 -65
- package/src/components/Dialogs/Dialog.tsx +0 -159
- package/src/testing/decorators/withSurfaceVariantsLayout.tsx +0 -51
- package/src/testing/decorators/withTheme.ts +0 -25
- package/src/util/ThemedClassName.ts +0 -7
- /package/dist/types/src/components/{Buttons → Button}/index.d.ts +0 -0
- /package/dist/types/src/components/{Dialogs → Dialog}/index.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/ListDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Tree.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/TreeDropIndicator.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/Treegrid.stories.d.ts +0 -0
- /package/dist/types/src/components/{Lists → List}/index.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
- /package/src/components/{Buttons → Button}/index.ts +0 -0
- /package/src/components/{Dialogs → Dialog}/index.ts +0 -0
- /package/src/components/{Lists → List}/Tree.tsx +0 -0
- /package/src/components/{Lists → List}/index.ts +0 -0
- /package/src/components/{Menus → Menu}/index.ts +0 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type SyntheticEvent, useCallback, useRef, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
8
|
+
import { mx } from '@dxos/ui-theme';
|
|
9
|
+
|
|
10
|
+
const cache = new Map<string, string>();
|
|
11
|
+
|
|
12
|
+
export type ImageProps = ThemedClassName<
|
|
13
|
+
{
|
|
14
|
+
src: string;
|
|
15
|
+
alt?: string;
|
|
16
|
+
crossOrigin?: 'anonymous' | 'use-credentials' | '';
|
|
17
|
+
} & ColorOptions
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
// TODO(burdon): Option for neutral background color.
|
|
21
|
+
export const Image = ({
|
|
22
|
+
classNames,
|
|
23
|
+
src,
|
|
24
|
+
alt = '',
|
|
25
|
+
crossOrigin = 'anonymous',
|
|
26
|
+
sampleSize = 64,
|
|
27
|
+
contrast = 0.9,
|
|
28
|
+
}: ImageProps) => {
|
|
29
|
+
const [crossOriginState, setCrossOriginState] = useState<ImageProps['crossOrigin']>(crossOrigin);
|
|
30
|
+
const [dominantColor, setDominantColor] = useState<string | undefined>(undefined);
|
|
31
|
+
const [imageLoaded, setImageLoaded] = useState<boolean>(false);
|
|
32
|
+
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
33
|
+
|
|
34
|
+
// CORS not supported by server.
|
|
35
|
+
const handleImageError = (): void => {
|
|
36
|
+
setCrossOriginState(undefined);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const handleImageLoad = useCallback(
|
|
40
|
+
({ target }: SyntheticEvent<HTMLImageElement>): void => {
|
|
41
|
+
const rgb = cache.get(src);
|
|
42
|
+
if (rgb) {
|
|
43
|
+
setDominantColor(rgb);
|
|
44
|
+
setImageLoaded(true);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const img = target as HTMLImageElement;
|
|
49
|
+
if (!canvasRef.current) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const color = extractDominantColor(canvasRef.current, img, { sampleSize, contrast });
|
|
55
|
+
if (color) {
|
|
56
|
+
const rgb = `rgb(${color[0]}, ${color[1]}, ${color[2]})`;
|
|
57
|
+
cache.set(src, rgb);
|
|
58
|
+
setDominantColor(rgb);
|
|
59
|
+
}
|
|
60
|
+
} catch {
|
|
61
|
+
setCrossOriginState(undefined);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
setImageLoaded(true);
|
|
65
|
+
},
|
|
66
|
+
[sampleSize, contrast, src],
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
className={mx(`relative flex w-full justify-center overflow-hidden transition-all duration-700`, classNames)}
|
|
72
|
+
style={{
|
|
73
|
+
backgroundColor: dominantColor,
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{/* Hidden canvas for color extraction. */}
|
|
77
|
+
<canvas ref={canvasRef} style={{ display: 'none' }} aria-hidden='true' />
|
|
78
|
+
|
|
79
|
+
{/* Background gradient overlay for smooth transition. */}
|
|
80
|
+
<div
|
|
81
|
+
className='absolute inset-0 pointer-events-none'
|
|
82
|
+
style={{
|
|
83
|
+
background: dominantColor
|
|
84
|
+
? `radial-gradient(circle at center, transparent 30%, ${dominantColor} 100%)`
|
|
85
|
+
: undefined,
|
|
86
|
+
transition: 'opacity 0.7s ease-in-out',
|
|
87
|
+
opacity: 0.5,
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<img
|
|
92
|
+
src={src}
|
|
93
|
+
alt={alt}
|
|
94
|
+
crossOrigin={crossOriginState}
|
|
95
|
+
onError={handleImageError}
|
|
96
|
+
onLoad={handleImageLoad}
|
|
97
|
+
className='z-10 object-contain transition-opacity duration-500'
|
|
98
|
+
style={{
|
|
99
|
+
opacity: imageLoaded ? 1 : 0,
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
type ColorOptions = {
|
|
107
|
+
sampleSize?: number;
|
|
108
|
+
contrast?: number;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get dominant color from image (esp. from corners).
|
|
113
|
+
*/
|
|
114
|
+
const extractDominantColor = (
|
|
115
|
+
canvas: HTMLCanvasElement,
|
|
116
|
+
img: HTMLImageElement,
|
|
117
|
+
{ sampleSize = 64, contrast = 0.95 }: ColorOptions,
|
|
118
|
+
): [number, number, number] | null => {
|
|
119
|
+
const ctx = canvas.getContext('2d');
|
|
120
|
+
if (!ctx) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Draw the image scaled down.
|
|
125
|
+
canvas.width = sampleSize;
|
|
126
|
+
canvas.height = sampleSize;
|
|
127
|
+
ctx.drawImage(img, 0, 0, sampleSize, sampleSize);
|
|
128
|
+
|
|
129
|
+
// Get image data.
|
|
130
|
+
const imageData = ctx.getImageData(0, 0, sampleSize, sampleSize);
|
|
131
|
+
const pixels = imageData.data;
|
|
132
|
+
|
|
133
|
+
// Check for transparent background.
|
|
134
|
+
if (isTransparent(pixels, sampleSize)) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
let r = 0;
|
|
139
|
+
let g = 0;
|
|
140
|
+
let b = 0;
|
|
141
|
+
let totalWeight = 0;
|
|
142
|
+
|
|
143
|
+
// Define corner sampling areas (e.g., 25% of each dimension from each corner).
|
|
144
|
+
const cornerSize = Math.floor(sampleSize * 0.125);
|
|
145
|
+
|
|
146
|
+
// Sample only pixels in corner areas.
|
|
147
|
+
for (let y = 0; y < sampleSize; y++) {
|
|
148
|
+
for (let x = 0; x < sampleSize; x++) {
|
|
149
|
+
// Check if pixel is in any corner area.
|
|
150
|
+
const isInTopLeft = x < cornerSize && y < cornerSize;
|
|
151
|
+
const isInTopRight = x >= sampleSize - cornerSize && y < cornerSize;
|
|
152
|
+
const isInBottomLeft = x < cornerSize && y >= sampleSize - cornerSize;
|
|
153
|
+
const isInBottomRight = x >= sampleSize - cornerSize && y >= sampleSize - cornerSize;
|
|
154
|
+
if (!isInTopLeft && !isInTopRight && !isInBottomLeft && !isInBottomRight) {
|
|
155
|
+
continue; // Skip pixels not in corner areas.
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const i = (y * sampleSize + x) * 4;
|
|
159
|
+
const red = pixels[i];
|
|
160
|
+
const green = pixels[i + 1];
|
|
161
|
+
const blue = pixels[i + 2];
|
|
162
|
+
const alpha = pixels[i + 3];
|
|
163
|
+
|
|
164
|
+
// Skip transparent pixels.
|
|
165
|
+
if (alpha === 0) continue;
|
|
166
|
+
|
|
167
|
+
// Calculate saturation to weight vibrant colors more.
|
|
168
|
+
const max = Math.max(red, green, blue);
|
|
169
|
+
const min = Math.min(red, green, blue);
|
|
170
|
+
const saturation = max === 0 ? 0 : (max - min) / max;
|
|
171
|
+
const weight = 1 + saturation * 2;
|
|
172
|
+
|
|
173
|
+
r += red * weight;
|
|
174
|
+
g += green * weight;
|
|
175
|
+
b += blue * weight;
|
|
176
|
+
totalWeight += weight;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (totalWeight > 0) {
|
|
181
|
+
// Slightly darken the color for better contrast.
|
|
182
|
+
r = Math.round(Math.round(r / totalWeight) * contrast);
|
|
183
|
+
g = Math.round(Math.round(g / totalWeight) * contrast);
|
|
184
|
+
b = Math.round(Math.round(b / totalWeight) * contrast);
|
|
185
|
+
return [r, g, b];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return null;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Detects if an image has a transparent background by examining edge pixels.
|
|
193
|
+
* @param pixels - Image pixel data from canvas
|
|
194
|
+
* @param sampleSize - Size of the sampled image
|
|
195
|
+
* @param threshold - Percentage threshold for considering background transparent (default: 0.5)
|
|
196
|
+
* @returns True if the image has a transparent background
|
|
197
|
+
*/
|
|
198
|
+
const isTransparent = (pixels: Uint8ClampedArray, sampleSize: number, threshold: number = 0.5): boolean => {
|
|
199
|
+
let edgeTransparentPixels = 0;
|
|
200
|
+
const edgePixels = sampleSize * 4 - 4; // Perimeter minus corners counted twice.
|
|
201
|
+
|
|
202
|
+
for (let x = 0; x < sampleSize; x++) {
|
|
203
|
+
// Top edge.
|
|
204
|
+
const topIndex = x * 4;
|
|
205
|
+
if (pixels[topIndex + 3] === 0) edgeTransparentPixels++;
|
|
206
|
+
|
|
207
|
+
// Bottom edge.
|
|
208
|
+
const bottomIndex = ((sampleSize - 1) * sampleSize + x) * 4;
|
|
209
|
+
if (pixels[bottomIndex + 3] === 0) edgeTransparentPixels++;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
for (let y = 1; y < sampleSize - 1; y++) {
|
|
213
|
+
// Left edge.
|
|
214
|
+
const leftIndex = y * sampleSize * 4;
|
|
215
|
+
if (pixels[leftIndex + 3] === 0) edgeTransparentPixels++;
|
|
216
|
+
|
|
217
|
+
// Right edge.
|
|
218
|
+
const rightIndex = (y * sampleSize + sampleSize - 1) * 4;
|
|
219
|
+
if (pixels[rightIndex + 3] === 0) edgeTransparentPixels++;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return edgeTransparentPixels / edgePixels > threshold;
|
|
223
|
+
};
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
|
-
import {
|
|
11
|
-
import { type MessageValence } from '@dxos/react-ui-types';
|
|
8
|
+
import { type MessageValence } from '@dxos/ui-types';
|
|
12
9
|
|
|
13
|
-
import { withTheme } from '../../testing';
|
|
10
|
+
import { withLayoutVariants, withTheme } from '../../testing';
|
|
14
11
|
|
|
15
12
|
import {
|
|
16
13
|
type CheckboxProps,
|
|
@@ -31,7 +28,7 @@ type VariantMap = {
|
|
|
31
28
|
|
|
32
29
|
type Variant = { [K in keyof VariantMap]: { type: K } & VariantMap[K] }[keyof VariantMap];
|
|
33
30
|
|
|
34
|
-
type
|
|
31
|
+
type DefaultStoryProps = Partial<{
|
|
35
32
|
kind: keyof VariantMap;
|
|
36
33
|
label: string;
|
|
37
34
|
labelVisuallyHidden: boolean;
|
|
@@ -41,7 +38,7 @@ type BaseProps = Partial<{
|
|
|
41
38
|
validationMessage: string;
|
|
42
39
|
}>;
|
|
43
40
|
|
|
44
|
-
const
|
|
41
|
+
const DefaultStory = ({
|
|
45
42
|
kind,
|
|
46
43
|
label,
|
|
47
44
|
description,
|
|
@@ -50,7 +47,7 @@ const Wrapper = ({
|
|
|
50
47
|
validationValence,
|
|
51
48
|
validationMessage,
|
|
52
49
|
...props
|
|
53
|
-
}:
|
|
50
|
+
}: DefaultStoryProps) => {
|
|
54
51
|
return (
|
|
55
52
|
<Input.Root {...{ validationValence }}>
|
|
56
53
|
<Input.Label srOnly={labelVisuallyHidden}>{label}</Input.Label>
|
|
@@ -62,49 +59,28 @@ const Wrapper = ({
|
|
|
62
59
|
{kind === 'switch' && <Input.Switch {...props} />}
|
|
63
60
|
|
|
64
61
|
<Input.DescriptionAndValidation srOnly={descriptionVisuallyHidden}>
|
|
65
|
-
{validationMessage &&
|
|
66
|
-
<>
|
|
67
|
-
<Input.Validation>{validationMessage}</Input.Validation>{' '}
|
|
68
|
-
</>
|
|
69
|
-
)}
|
|
62
|
+
{validationMessage && <Input.Validation classNames='block'>{validationMessage}</Input.Validation>}
|
|
70
63
|
<Input.Description>{description}</Input.Description>
|
|
71
64
|
</Input.DescriptionAndValidation>
|
|
72
65
|
</Input.Root>
|
|
73
66
|
);
|
|
74
67
|
};
|
|
75
68
|
|
|
76
|
-
const DefaultStory = (props: BaseProps) => {
|
|
77
|
-
return (
|
|
78
|
-
<div className='space-b-4'>
|
|
79
|
-
<div className={mx(baseSurface, 'p-4 rounded-md')}>
|
|
80
|
-
<Wrapper {...props} />
|
|
81
|
-
</div>
|
|
82
|
-
<div className={mx('bg-cardSurface', 'p-4 rounded-md', surfaceShadow({ elevation: 'positioned' }))}>
|
|
83
|
-
<Wrapper {...props} />
|
|
84
|
-
</div>
|
|
85
|
-
<div className={mx(modalSurface, 'p-4 rounded-md', surfaceShadow({ elevation: 'dialog' }))}>
|
|
86
|
-
<Wrapper {...props} />
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
69
|
const meta = {
|
|
93
|
-
title: 'ui/react-ui-core/Input',
|
|
70
|
+
title: 'ui/react-ui-core/components/Input',
|
|
94
71
|
component: Input.Root as any,
|
|
95
72
|
render: DefaultStory,
|
|
96
|
-
decorators: [withTheme],
|
|
97
|
-
parameters: { chromatic: { disableSnapshot: false } },
|
|
73
|
+
decorators: [withTheme(), withLayoutVariants()],
|
|
98
74
|
} satisfies Meta<typeof DefaultStory>;
|
|
99
75
|
|
|
100
76
|
export default meta;
|
|
101
77
|
|
|
102
|
-
type Story = StoryObj<
|
|
78
|
+
type Story = StoryObj<DefaultStoryProps & Variant>;
|
|
103
79
|
|
|
104
|
-
export const
|
|
80
|
+
export const DensityCoarse: Story = {
|
|
105
81
|
args: {
|
|
106
82
|
kind: 'text',
|
|
107
|
-
label: '
|
|
83
|
+
label: 'Input value',
|
|
108
84
|
placeholder: 'This is an input',
|
|
109
85
|
disabled: false,
|
|
110
86
|
description: undefined,
|
|
@@ -112,13 +88,14 @@ export const Default: Story = {
|
|
|
112
88
|
descriptionVisuallyHidden: false,
|
|
113
89
|
validationMessage: '',
|
|
114
90
|
validationValence: undefined,
|
|
91
|
+
density: 'coarse',
|
|
115
92
|
},
|
|
116
93
|
};
|
|
117
94
|
|
|
118
95
|
export const DensityFine: Story = {
|
|
119
96
|
args: {
|
|
120
97
|
kind: 'text',
|
|
121
|
-
label: '
|
|
98
|
+
label: 'Input value',
|
|
122
99
|
placeholder: 'This is a density:fine input',
|
|
123
100
|
disabled: false,
|
|
124
101
|
description: undefined,
|
|
@@ -133,7 +110,7 @@ export const DensityFine: Story = {
|
|
|
133
110
|
export const Subdued: Story = {
|
|
134
111
|
args: {
|
|
135
112
|
kind: 'text',
|
|
136
|
-
label: '
|
|
113
|
+
label: 'Input value',
|
|
137
114
|
placeholder: 'This is a subdued input',
|
|
138
115
|
disabled: false,
|
|
139
116
|
description: undefined,
|
|
@@ -163,7 +140,7 @@ export const LabelVisuallyHidden: Story = {
|
|
|
163
140
|
},
|
|
164
141
|
};
|
|
165
142
|
|
|
166
|
-
export const
|
|
143
|
+
export const WithDescription: Story = {
|
|
167
144
|
args: {
|
|
168
145
|
kind: 'text',
|
|
169
146
|
label: 'Described input',
|
|
@@ -172,7 +149,7 @@ export const InputWithDescription: Story = {
|
|
|
172
149
|
},
|
|
173
150
|
};
|
|
174
151
|
|
|
175
|
-
export const
|
|
152
|
+
export const WithErrorAndDescription: Story = {
|
|
176
153
|
args: {
|
|
177
154
|
kind: 'text',
|
|
178
155
|
label: 'Described invalid input',
|
|
@@ -183,7 +160,7 @@ export const InputWithErrorAndDescription: Story = {
|
|
|
183
160
|
},
|
|
184
161
|
};
|
|
185
162
|
|
|
186
|
-
export const
|
|
163
|
+
export const WithValidationAndDescription: Story = {
|
|
187
164
|
args: {
|
|
188
165
|
kind: 'text',
|
|
189
166
|
label: 'Described input with validation message',
|
|
@@ -209,7 +186,8 @@ export const PinInput: Story = {
|
|
|
209
186
|
label: 'This input is a PIN-style input',
|
|
210
187
|
length: 6,
|
|
211
188
|
description: 'Type in secret you received',
|
|
212
|
-
|
|
189
|
+
pattern: '\\d*',
|
|
190
|
+
density: 'coarse',
|
|
213
191
|
},
|
|
214
192
|
};
|
|
215
193
|
|
|
@@ -217,7 +195,7 @@ export const Checkbox: Story = {
|
|
|
217
195
|
args: {
|
|
218
196
|
kind: 'checkbox',
|
|
219
197
|
label: 'This is a checkbox',
|
|
220
|
-
description: '
|
|
198
|
+
description: 'Checked, indeterminate, or unchecked',
|
|
221
199
|
size: 5,
|
|
222
200
|
},
|
|
223
201
|
};
|
|
@@ -226,6 +204,6 @@ export const Switch: Story = {
|
|
|
226
204
|
args: {
|
|
227
205
|
kind: 'switch',
|
|
228
206
|
label: 'This is a switch',
|
|
229
|
-
description:
|
|
207
|
+
description: 'On or off',
|
|
230
208
|
},
|
|
231
209
|
};
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { Root as CheckboxPrimitive, type CheckboxProps as CheckboxPrimitiveProps } from '@radix-ui/react-checkbox';
|
|
5
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
7
6
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
8
|
-
import React, { type ComponentPropsWithRef, type ForwardRefExoticComponent, forwardRef
|
|
7
|
+
import React, { type ComponentPropsWithRef, type ForwardRefExoticComponent, forwardRef } from 'react';
|
|
9
8
|
|
|
10
9
|
import {
|
|
11
10
|
DescriptionAndValidation as DescriptionAndValidationPrimitive,
|
|
@@ -28,8 +27,8 @@ import {
|
|
|
28
27
|
type ValidationProps as ValidationPrimitiveProps,
|
|
29
28
|
useInputContext,
|
|
30
29
|
} from '@dxos/react-input';
|
|
31
|
-
import { mx } from '@dxos/
|
|
32
|
-
import { type
|
|
30
|
+
import { mx } from '@dxos/ui-theme';
|
|
31
|
+
import { type Density, type Elevation, type Size } from '@dxos/ui-types';
|
|
33
32
|
|
|
34
33
|
import { useDensityContext, useElevationContext, useThemeContext } from '../../hooks';
|
|
35
34
|
import { type ThemedClassName } from '../../util';
|
|
@@ -41,10 +40,10 @@ type InputSharedProps = Partial<{ density: Density; elevation: Elevation; varian
|
|
|
41
40
|
|
|
42
41
|
type LabelProps = ThemedClassName<LabelPrimitiveProps> & { srOnly?: boolean };
|
|
43
42
|
|
|
44
|
-
const Label = forwardRef<HTMLLabelElement, LabelProps>(({
|
|
43
|
+
const Label = forwardRef<HTMLLabelElement, LabelProps>(({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
45
44
|
const { tx } = useThemeContext();
|
|
46
45
|
return (
|
|
47
|
-
<LabelPrimitive {...props} className={tx('input.label',
|
|
46
|
+
<LabelPrimitive {...props} className={tx('input.label', { srOnly }, classNames)} ref={forwardedRef}>
|
|
48
47
|
{children}
|
|
49
48
|
</LabelPrimitive>
|
|
50
49
|
);
|
|
@@ -53,14 +52,10 @@ const Label = forwardRef<HTMLLabelElement, LabelProps>(({ srOnly, classNames, ch
|
|
|
53
52
|
type DescriptionProps = ThemedClassName<DescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
54
53
|
|
|
55
54
|
const Description = forwardRef<HTMLSpanElement, DescriptionProps>(
|
|
56
|
-
({
|
|
55
|
+
({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
57
56
|
const { tx } = useThemeContext();
|
|
58
57
|
return (
|
|
59
|
-
<DescriptionPrimitive
|
|
60
|
-
{...props}
|
|
61
|
-
className={tx('input.description', 'input__description', { srOnly }, classNames)}
|
|
62
|
-
ref={forwardedRef}
|
|
63
|
-
>
|
|
58
|
+
<DescriptionPrimitive {...props} className={tx('input.description', { srOnly }, classNames)} ref={forwardedRef}>
|
|
64
59
|
{children}
|
|
65
60
|
</DescriptionPrimitive>
|
|
66
61
|
);
|
|
@@ -70,18 +65,13 @@ const Description = forwardRef<HTMLSpanElement, DescriptionProps>(
|
|
|
70
65
|
type ValidationProps = ThemedClassName<ValidationPrimitiveProps> & { srOnly?: boolean };
|
|
71
66
|
|
|
72
67
|
const Validation = forwardRef<HTMLSpanElement, InputScopedProps<ValidationProps>>(
|
|
73
|
-
({ __inputScope,
|
|
68
|
+
({ __inputScope, classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
74
69
|
const { tx } = useThemeContext();
|
|
75
70
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
76
71
|
return (
|
|
77
72
|
<ValidationPrimitive
|
|
78
73
|
{...props}
|
|
79
|
-
className={tx(
|
|
80
|
-
'input.validation',
|
|
81
|
-
`input__validation-message input__validation-message--${validationValence}`,
|
|
82
|
-
{ srOnly, validationValence },
|
|
83
|
-
classNames,
|
|
84
|
-
)}
|
|
74
|
+
className={tx('input.validation', { srOnly, validationValence }, classNames)}
|
|
85
75
|
ref={forwardedRef}
|
|
86
76
|
>
|
|
87
77
|
{children}
|
|
@@ -93,12 +83,12 @@ const Validation = forwardRef<HTMLSpanElement, InputScopedProps<ValidationProps>
|
|
|
93
83
|
type DescriptionAndValidationProps = ThemedClassName<DescriptionAndValidationPrimitiveProps> & { srOnly?: boolean };
|
|
94
84
|
|
|
95
85
|
const DescriptionAndValidation = forwardRef<HTMLParagraphElement, DescriptionAndValidationProps>(
|
|
96
|
-
({
|
|
86
|
+
({ classNames, children, srOnly, ...props }, forwardedRef) => {
|
|
97
87
|
const { tx } = useThemeContext();
|
|
98
88
|
return (
|
|
99
89
|
<DescriptionAndValidationPrimitive
|
|
100
90
|
{...props}
|
|
101
|
-
className={tx('input.descriptionAndValidation',
|
|
91
|
+
className={tx('input.descriptionAndValidation', { srOnly }, classNames)}
|
|
102
92
|
ref={forwardedRef}
|
|
103
93
|
>
|
|
104
94
|
{children}
|
|
@@ -107,54 +97,23 @@ const DescriptionAndValidation = forwardRef<HTMLParagraphElement, DescriptionAnd
|
|
|
107
97
|
},
|
|
108
98
|
);
|
|
109
99
|
|
|
110
|
-
type PinInputProps = InputSharedProps &
|
|
111
|
-
Omit<PinInputPrimitiveProps, 'segmentClassName' | 'inputClassName'> & {
|
|
112
|
-
segmentClassName?: ClassNameValue;
|
|
113
|
-
inputClassName?: ClassNameValue;
|
|
114
|
-
};
|
|
100
|
+
type PinInputProps = ThemedClassName<InputSharedProps & Omit<PinInputPrimitiveProps, 'className' | 'segmentClassName'>>;
|
|
115
101
|
|
|
116
102
|
const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
117
|
-
(
|
|
118
|
-
{
|
|
119
|
-
density: propsDensity,
|
|
120
|
-
elevation: propsElevation,
|
|
121
|
-
segmentClassName: propsSegmentClassName,
|
|
122
|
-
inputClassName,
|
|
123
|
-
variant,
|
|
124
|
-
...props
|
|
125
|
-
},
|
|
126
|
-
forwardedRef,
|
|
127
|
-
) => {
|
|
103
|
+
({ classNames, density: propsDensity, elevation: propsElevation, ...props }, forwardedRef) => {
|
|
128
104
|
const { hasIosKeyboard } = useThemeContext();
|
|
129
105
|
const { tx } = useThemeContext();
|
|
130
106
|
const density = useDensityContext(propsDensity);
|
|
131
107
|
const elevation = useElevationContext(propsElevation);
|
|
132
108
|
|
|
133
|
-
const segmentClassName = useCallback(
|
|
134
|
-
({ focused, validationValence }: Parameters<Exclude<PinInputPrimitiveProps['segmentClassName'], undefined>>[0]) =>
|
|
135
|
-
tx(
|
|
136
|
-
'input.input',
|
|
137
|
-
'input--pin-segment',
|
|
138
|
-
{
|
|
139
|
-
variant: 'static',
|
|
140
|
-
focused,
|
|
141
|
-
disabled: props.disabled,
|
|
142
|
-
density,
|
|
143
|
-
elevation,
|
|
144
|
-
validationValence,
|
|
145
|
-
},
|
|
146
|
-
propsSegmentClassName,
|
|
147
|
-
),
|
|
148
|
-
[tx, props.disabled, elevation, propsElevation, density],
|
|
149
|
-
);
|
|
150
109
|
return (
|
|
151
110
|
<PinInputPrimitive
|
|
152
111
|
{...{
|
|
153
112
|
...props,
|
|
154
|
-
segmentClassName,
|
|
155
113
|
...(props.autoFocus && !hasIosKeyboard && { autoFocus: true }),
|
|
156
114
|
}}
|
|
157
|
-
|
|
115
|
+
className={tx('input.inputWithSegments', { disabled: props.disabled }, classNames) || ''}
|
|
116
|
+
segmentClassName={tx('input.segment', { disabled: props.disabled, density, elevation }) || ''}
|
|
158
117
|
ref={forwardedRef}
|
|
159
118
|
/>
|
|
160
119
|
);
|
|
@@ -163,24 +122,30 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
163
122
|
|
|
164
123
|
// TODO(burdon): Implement inline icon within button: e.g., https://www.radix-ui.com/themes/playground#text-field
|
|
165
124
|
|
|
166
|
-
type
|
|
125
|
+
type AutoFillProps = {
|
|
126
|
+
noAutoFill?: boolean;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
type TextInputProps = InputSharedProps & ThemedClassName<TextInputPrimitiveProps> & AutoFillProps;
|
|
167
130
|
|
|
168
131
|
const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>(
|
|
169
|
-
(
|
|
132
|
+
(
|
|
133
|
+
{ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, noAutoFill, ...props },
|
|
134
|
+
forwardedRef,
|
|
135
|
+
) => {
|
|
170
136
|
const { hasIosKeyboard } = useThemeContext();
|
|
171
|
-
const
|
|
137
|
+
const { tx } = useThemeContext();
|
|
172
138
|
const density = useDensityContext(propsDensity);
|
|
173
139
|
const elevation = useElevationContext(propsElevation);
|
|
174
140
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
175
141
|
|
|
176
|
-
const { tx } = themeContextValue;
|
|
177
|
-
|
|
178
142
|
return (
|
|
179
143
|
<TextInputPrimitive
|
|
180
144
|
{...props}
|
|
145
|
+
// TODO(wittjosiah): Factor out autofill properies.
|
|
146
|
+
{...{ 'data-1p-ignore': noAutoFill }}
|
|
181
147
|
className={tx(
|
|
182
148
|
'input.input',
|
|
183
|
-
'input',
|
|
184
149
|
{
|
|
185
150
|
variant,
|
|
186
151
|
disabled: props.disabled,
|
|
@@ -211,8 +176,7 @@ const TextArea = forwardRef<HTMLTextAreaElement, InputScopedProps<TextAreaProps>
|
|
|
211
176
|
<TextAreaPrimitive
|
|
212
177
|
{...props}
|
|
213
178
|
className={tx(
|
|
214
|
-
'input.
|
|
215
|
-
'input--text-area',
|
|
179
|
+
'input.textArea',
|
|
216
180
|
{
|
|
217
181
|
variant,
|
|
218
182
|
disabled: props.disabled,
|
|
@@ -220,7 +184,6 @@ const TextArea = forwardRef<HTMLTextAreaElement, InputScopedProps<TextAreaProps>
|
|
|
220
184
|
elevation,
|
|
221
185
|
validationValence,
|
|
222
186
|
},
|
|
223
|
-
'-mbe-labelSpacingBlock',
|
|
224
187
|
classNames,
|
|
225
188
|
)}
|
|
226
189
|
{...(props.autoFocus && !hasIosKeyboard && { autoFocus: true })}
|
|
@@ -230,7 +193,9 @@ const TextArea = forwardRef<HTMLTextAreaElement, InputScopedProps<TextAreaProps>
|
|
|
230
193
|
},
|
|
231
194
|
);
|
|
232
195
|
|
|
233
|
-
type CheckboxProps = ThemedClassName<Omit<
|
|
196
|
+
type CheckboxProps = ThemedClassName<Omit<CheckboxPrimitive.CheckboxProps, 'children'>> & {
|
|
197
|
+
size?: Size;
|
|
198
|
+
};
|
|
234
199
|
|
|
235
200
|
const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
|
|
236
201
|
HTMLButtonElement,
|
|
@@ -239,12 +204,11 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
|
|
|
239
204
|
(
|
|
240
205
|
{
|
|
241
206
|
__inputScope,
|
|
207
|
+
classNames,
|
|
242
208
|
checked: propsChecked,
|
|
243
209
|
defaultChecked: propsDefaultChecked,
|
|
244
210
|
onCheckedChange: propsOnCheckedChange,
|
|
245
211
|
size,
|
|
246
|
-
weight = 'bold',
|
|
247
|
-
classNames,
|
|
248
212
|
...props
|
|
249
213
|
},
|
|
250
214
|
forwardedRef,
|
|
@@ -258,7 +222,7 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
|
|
|
258
222
|
const { tx } = useThemeContext();
|
|
259
223
|
|
|
260
224
|
return (
|
|
261
|
-
<CheckboxPrimitive
|
|
225
|
+
<CheckboxPrimitive.Root
|
|
262
226
|
{...{
|
|
263
227
|
...props,
|
|
264
228
|
checked,
|
|
@@ -269,15 +233,15 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
|
|
|
269
233
|
'aria-invalid': 'true' as const,
|
|
270
234
|
'aria-errormessage': errorMessageId,
|
|
271
235
|
}),
|
|
272
|
-
className: tx('input.checkbox',
|
|
236
|
+
className: tx('input.checkbox', { size }, 'shrink-0', classNames),
|
|
273
237
|
}}
|
|
274
238
|
ref={forwardedRef}
|
|
275
239
|
>
|
|
276
240
|
<Icon
|
|
277
241
|
icon={checked === 'indeterminate' ? 'ph--minus--regular' : 'ph--check--regular'}
|
|
278
|
-
classNames={tx('input.checkboxIndicator',
|
|
242
|
+
classNames={tx('input.checkboxIndicator', { size, checked })}
|
|
279
243
|
/>
|
|
280
|
-
</CheckboxPrimitive>
|
|
244
|
+
</CheckboxPrimitive.Root>
|
|
281
245
|
);
|
|
282
246
|
},
|
|
283
247
|
);
|
|
@@ -290,10 +254,10 @@ const Switch = forwardRef<HTMLInputElement, InputScopedProps<SwitchProps>>(
|
|
|
290
254
|
(
|
|
291
255
|
{
|
|
292
256
|
__inputScope,
|
|
257
|
+
classNames,
|
|
293
258
|
checked: propsChecked,
|
|
294
259
|
defaultChecked: propsDefaultChecked,
|
|
295
260
|
onCheckedChange: propsOnCheckedChange,
|
|
296
|
-
classNames,
|
|
297
261
|
...props
|
|
298
262
|
},
|
|
299
263
|
forwardedRef,
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
|
|
9
7
|
import { withTheme } from '../../testing';
|
|
@@ -11,10 +9,9 @@ import { withTheme } from '../../testing';
|
|
|
11
9
|
import { Link } from './Link';
|
|
12
10
|
|
|
13
11
|
const meta = {
|
|
14
|
-
title: 'ui/react-ui-core/Link',
|
|
12
|
+
title: 'ui/react-ui-core/components/Link',
|
|
15
13
|
component: Link,
|
|
16
|
-
decorators: [withTheme],
|
|
17
|
-
parameters: { chromatic: { disableSnapshot: false } },
|
|
14
|
+
decorators: [withTheme()],
|
|
18
15
|
} satisfies Meta<typeof Link>;
|
|
19
16
|
|
|
20
17
|
export default meta;
|