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