@dxos/react-ui 0.10.0 → 0.11.0
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/chunk-parse-stack.mjs +1566 -0
- package/dist/lib/chunk-parse-stack.mjs.map +1 -0
- package/dist/lib/index.mjs +5220 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/testing.mjs +144 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/translations.mjs +38 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -6
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarContext.d.ts +9 -0
- package/dist/types/src/components/Avatars/AvatarContext.d.ts.map +1 -0
- package/dist/types/src/components/Avatars/index.d.ts +1 -0
- package/dist/types/src/components/Avatars/index.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +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/Breadcrumb/Breadcrumb.theme.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +1 -6
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/ButtonGroupContext.d.ts +9 -0
- package/dist/types/src/components/Button/ButtonGroupContext.d.ts.map +1 -0
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.theme.d.ts +1 -0
- package/dist/types/src/components/Button/IconButton.theme.d.ts.map +1 -1
- package/dist/types/src/components/Button/SystemIconButton.d.ts +1 -1
- package/dist/types/src/components/Button/SystemIconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/index.d.ts +1 -0
- package/dist/types/src/components/Button/index.d.ts.map +1 -1
- package/dist/types/src/components/Calendar/Calendar.d.ts +0 -2
- package/dist/types/src/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/src/components/Calendar/index.d.ts +1 -0
- package/dist/types/src/components/Calendar/index.d.ts.map +1 -1
- package/dist/types/src/components/Calendar/parse-calendar-date.d.ts +3 -0
- package/dist/types/src/components/Calendar/parse-calendar-date.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.d.ts +42 -15
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.theme.d.ts +0 -1
- package/dist/types/src/components/Card/Card.theme.d.ts.map +1 -1
- package/dist/types/src/components/Carousel/Carousel.d.ts +2 -4
- package/dist/types/src/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/src/components/Carousel/CarouselContext.d.ts +8 -0
- package/dist/types/src/components/Carousel/CarouselContext.d.ts.map +1 -0
- package/dist/types/src/components/Carousel/index.d.ts +1 -0
- package/dist/types/src/components/Carousel/index.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/ClipboardContext.d.ts +7 -0
- package/dist/types/src/components/Clipboard/ClipboardContext.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts +0 -6
- package/dist/types/src/components/Clipboard/ClipboardProvider.d.ts.map +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts +1 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/Column/Column.d.ts +7 -12
- package/dist/types/src/components/Column/Column.d.ts.map +1 -1
- package/dist/types/src/components/Column/Column.stories.d.ts +2 -2
- package/dist/types/src/components/Column/Column.theme.d.ts +0 -1
- package/dist/types/src/components/Column/Column.theme.d.ts.map +1 -1
- package/dist/types/src/components/Column/ColumnContext.d.ts +9 -0
- package/dist/types/src/components/Column/ColumnContext.d.ts.map +1 -0
- package/dist/types/src/components/Column/index.d.ts +1 -0
- package/dist/types/src/components/Column/index.d.ts.map +1 -1
- package/dist/types/src/components/Column/withColumn.d.ts +40 -4
- package/dist/types/src/components/Column/withColumn.d.ts.map +1 -1
- package/dist/types/src/components/DatePicker/DatePicker.d.ts +0 -10
- package/dist/types/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/src/components/DatePicker/DatePickerContext.d.ts +13 -0
- package/dist/types/src/components/DatePicker/DatePickerContext.d.ts.map +1 -0
- package/dist/types/src/components/DatePicker/index.d.ts +1 -0
- package/dist/types/src/components/DatePicker/index.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +3 -3
- package/dist/types/src/components/Dialog/Dialog.d.ts +3 -3
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +5 -10
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/index.d.ts +1 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts.map +1 -1
- package/dist/types/src/components/ErrorFallback/parse-stack.d.ts +8 -0
- package/dist/types/src/components/ErrorFallback/parse-stack.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.d.ts +2 -10
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -1
- package/dist/types/src/components/Focus/FocusContext.d.ts +10 -0
- package/dist/types/src/components/Focus/FocusContext.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +1 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +9 -10
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +7 -2
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.theme.d.ts +13 -0
- package/dist/types/src/components/Input/Input.theme.d.ts.map +1 -1
- package/dist/types/src/components/Input/InputTriggerContext.d.ts +15 -0
- package/dist/types/src/components/Input/InputTriggerContext.d.ts.map +1 -0
- package/dist/types/src/components/Input/SegmentedInput.d.ts.map +1 -1
- package/dist/types/src/components/Input/index.d.ts +1 -0
- package/dist/types/src/components/Input/index.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +2 -35
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.theme.d.ts.map +1 -1
- package/dist/types/src/components/Main/MainContext.d.ts +38 -0
- package/dist/types/src/components/Main/MainContext.d.ts.map +1 -0
- package/dist/types/src/components/Main/index.d.ts +1 -0
- package/dist/types/src/components/Main/index.d.ts.map +1 -1
- package/dist/types/src/components/MediaPlayer/MediaPlayer.d.ts +1 -17
- package/dist/types/src/components/MediaPlayer/MediaPlayer.d.ts.map +1 -1
- package/dist/types/src/components/MediaPlayer/index.d.ts +1 -0
- package/dist/types/src/components/MediaPlayer/index.d.ts.map +1 -1
- package/dist/types/src/components/MediaPlayer/media-kind.d.ts +18 -0
- package/dist/types/src/components/MediaPlayer/media-kind.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +6 -22
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts +1 -11
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenuContext.d.ts +27 -0
- package/dist/types/src/components/Menu/DropdownMenuContext.d.ts.map +1 -0
- package/dist/types/src/components/Menu/index.d.ts +1 -0
- package/dist/types/src/components/Menu/index.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts +11 -6
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +4 -1
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.theme.d.ts.map +1 -1
- package/dist/types/src/components/Message/index.d.ts +1 -0
- package/dist/types/src/components/Message/index.d.ts.map +1 -1
- package/dist/types/src/components/Message/message-icons.d.ts +3 -0
- package/dist/types/src/components/Message/message-icons.d.ts.map +1 -0
- package/dist/types/src/components/Panel/Panel.d.ts +4 -4
- package/dist/types/src/components/Panel/Panel.stories.d.ts.map +1 -1
- package/dist/types/src/components/Panel/Panel.theme.d.ts +1 -1
- package/dist/types/src/components/Panel/Panel.theme.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +6 -10
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/PopoverContext.d.ts +29 -0
- package/dist/types/src/components/Popover/PopoverContext.d.ts.map +1 -0
- package/dist/types/src/components/Popover/index.d.ts +1 -0
- package/dist/types/src/components/Popover/index.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +2 -2
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +2 -2
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +3 -16
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainerContext.d.ts +16 -0
- package/dist/types/src/components/ScrollContainer/ScrollContainerContext.d.ts.map +1 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts +1 -0
- package/dist/types/src/components/ScrollContainer/index.d.ts.map +1 -1
- package/dist/types/src/components/Slider/Slider.d.ts +25 -0
- package/dist/types/src/components/Slider/Slider.d.ts.map +1 -0
- package/dist/types/src/components/Slider/Slider.stories.d.ts +29 -0
- package/dist/types/src/components/Slider/Slider.stories.d.ts.map +1 -0
- package/dist/types/src/components/Slider/Slider.test.d.ts +2 -0
- package/dist/types/src/components/Slider/Slider.test.d.ts.map +1 -0
- package/dist/types/src/components/Slider/Slider.theme.d.ts +7 -0
- package/dist/types/src/components/Slider/Slider.theme.d.ts.map +1 -0
- package/dist/types/src/components/Slider/index.d.ts +2 -0
- package/dist/types/src/components/Slider/index.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts +3 -3
- package/dist/types/src/components/Status/Status.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -2
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.theme.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/TextTooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +2 -23
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/TooltipContext.d.ts +35 -0
- package/dist/types/src/components/Tooltip/TooltipContext.d.ts.map +1 -0
- package/dist/types/src/components/Tooltip/index.d.ts +1 -0
- package/dist/types/src/components/Tooltip/index.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +1 -1
- package/dist/types/src/hooks/useIconHref.d.ts +8 -0
- package/dist/types/src/hooks/useIconHref.d.ts.map +1 -1
- package/dist/types/src/hooks/useThemeContext.d.ts +2 -1
- package/dist/types/src/hooks/useThemeContext.d.ts.map +1 -1
- package/dist/types/src/hooks/useThemeContext.test.d.ts +2 -0
- package/dist/types/src/hooks/useThemeContext.test.d.ts.map +1 -0
- package/dist/types/src/playground/Density.stories.d.ts +11 -0
- package/dist/types/src/playground/Density.stories.d.ts.map +1 -0
- package/dist/types/src/playground/Elevation.stories.d.ts +14 -0
- package/dist/types/src/playground/Elevation.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.d.ts +1 -1
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -1
- package/dist/types/src/primitives/DensityProvider/DensityContext.d.ts +6 -0
- package/dist/types/src/primitives/DensityProvider/DensityContext.d.ts.map +1 -0
- package/dist/types/src/primitives/DensityProvider/DensityProvider.d.ts +10 -4
- package/dist/types/src/primitives/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/primitives/DensityProvider/index.d.ts +1 -0
- package/dist/types/src/primitives/DensityProvider/index.d.ts.map +1 -1
- package/dist/types/src/primitives/Flex/Flex.d.ts +1 -1
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -1
- package/dist/types/src/primitives/Grid/Grid.d.ts +1 -1
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -1
- package/dist/types/src/primitives/ThemeProvider/IconRegistry.d.ts +15 -0
- package/dist/types/src/primitives/ThemeProvider/IconRegistry.d.ts.map +1 -0
- package/dist/types/src/primitives/ThemeProvider/ThemeProvider.d.ts +1 -2
- package/dist/types/src/primitives/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/primitives/ThemeProvider/ThemeProvider.stories.d.ts +1 -1
- package/dist/types/src/primitives/ThemeProvider/TranslationsContext.d.ts +112 -0
- package/dist/types/src/primitives/ThemeProvider/TranslationsContext.d.ts.map +1 -0
- package/dist/types/src/primitives/ThemeProvider/TranslationsProvider.d.ts +0 -109
- package/dist/types/src/primitives/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/primitives/ThemeProvider/icon-registry.d.ts +34 -0
- package/dist/types/src/primitives/ThemeProvider/icon-registry.d.ts.map +1 -0
- package/dist/types/src/primitives/ThemeProvider/index.d.ts +3 -1
- package/dist/types/src/primitives/ThemeProvider/index.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/theme/defaultTheme.d.ts.map +1 -1
- package/dist/types/src/theme/index.d.ts +1 -0
- package/dist/types/src/theme/index.d.ts.map +1 -1
- package/dist/types/src/util/slots.d.ts +6 -3
- package/dist/types/src/util/slots.d.ts.map +1 -1
- package/dist/types/src/util/slots.stories.d.ts +14 -0
- package/dist/types/src/util/slots.stories.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -27
- package/src/components/Avatars/Avatar.tsx +1 -11
- package/src/components/Avatars/AvatarContext.ts +16 -0
- package/src/components/Avatars/index.ts +2 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +27 -25
- package/src/components/Breadcrumb/Breadcrumb.theme.ts +7 -5
- package/src/components/Breadcrumb/Breadcrumb.tsx +2 -2
- package/src/components/Button/Button.tsx +2 -11
- package/src/components/Button/ButtonGroupContext.ts +17 -0
- package/src/components/Button/IconButton.stories.tsx +2 -3
- package/src/components/Button/IconButton.theme.ts +15 -2
- package/src/components/Button/IconButton.tsx +6 -1
- package/src/components/Button/SystemIconButton.tsx +23 -16
- package/src/components/Button/index.ts +2 -0
- package/src/components/Calendar/Calendar.theme.ts +5 -5
- package/src/components/Calendar/Calendar.tsx +1 -3
- package/src/components/Calendar/index.ts +2 -0
- package/src/components/Calendar/parse-calendar-date.ts +9 -0
- package/src/components/Card/Card.theme.ts +48 -38
- package/src/components/Card/Card.tsx +77 -16
- package/src/components/Carousel/Carousel.tsx +4 -11
- package/src/components/Carousel/CarouselContext.ts +17 -0
- package/src/components/Carousel/index.ts +2 -0
- package/src/components/Clipboard/ClipboardContext.ts +20 -0
- package/src/components/Clipboard/ClipboardProvider.tsx +2 -12
- package/src/components/Clipboard/CopyButton.tsx +1 -1
- package/src/components/Clipboard/index.ts +1 -1
- package/src/components/Column/Column.stories.tsx +2 -2
- package/src/components/Column/Column.theme.ts +2 -11
- package/src/components/Column/Column.tsx +35 -57
- package/src/components/Column/ColumnContext.ts +22 -0
- package/src/components/Column/index.ts +2 -0
- package/src/components/Column/withColumn.ts +41 -4
- package/src/components/DatePicker/DatePicker.theme.ts +2 -2
- package/src/components/DatePicker/DatePicker.tsx +1 -14
- package/src/components/DatePicker/DatePickerContext.ts +21 -0
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/ErrorFallback/ErrorStack.tsx +8 -28
- package/src/components/ErrorFallback/index.ts +1 -0
- package/src/components/ErrorFallback/parse-stack.ts +33 -0
- package/src/components/Focus/Focus.stories.tsx +6 -6
- package/src/components/Focus/Focus.tsx +2 -30
- package/src/components/Focus/FocusContext.ts +22 -0
- package/src/components/Focus/index.ts +2 -0
- package/src/components/Image/Image.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +63 -48
- package/src/components/Input/Input.theme.ts +33 -27
- package/src/components/Input/Input.tsx +46 -43
- package/src/components/Input/InputTriggerContext.ts +45 -0
- package/src/components/Input/SegmentedInput.tsx +2 -1
- package/src/components/Input/index.ts +2 -0
- package/src/components/Main/Main.stories.tsx +2 -1
- package/src/components/Main/Main.theme.ts +10 -1
- package/src/components/Main/Main.tsx +1 -115
- package/src/components/Main/MainContext.ts +126 -0
- package/src/components/Main/index.ts +2 -0
- package/src/components/MediaPlayer/MediaPlayer.tsx +16 -47
- package/src/components/MediaPlayer/index.ts +2 -0
- package/src/components/MediaPlayer/media-kind.ts +41 -0
- package/src/components/Menu/DropdownMenu.tsx +27 -44
- package/src/components/Menu/DropdownMenuContext.ts +35 -0
- package/src/components/Menu/Menu.theme.ts +3 -3
- package/src/components/Menu/index.ts +2 -0
- package/src/components/Message/Message.stories.tsx +32 -15
- package/src/components/Message/Message.theme.ts +8 -2
- package/src/components/Message/Message.tsx +47 -23
- package/src/components/Message/index.ts +2 -0
- package/src/components/Message/message-icons.ts +16 -0
- package/src/components/Panel/Panel.stories.tsx +15 -2
- package/src/components/Panel/Panel.theme.ts +15 -6
- package/src/components/Popover/Popover.theme.ts +1 -1
- package/src/components/Popover/Popover.tsx +22 -37
- package/src/components/Popover/PopoverContext.ts +32 -0
- package/src/components/Popover/index.ts +2 -0
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +1 -1
- package/src/components/ScrollContainer/ScrollContainer.tsx +1 -18
- package/src/components/ScrollContainer/ScrollContainerContext.ts +25 -0
- package/src/components/ScrollContainer/index.ts +2 -0
- package/src/components/Select/Select.theme.ts +2 -2
- package/src/components/Slider/Slider.stories.tsx +107 -0
- package/src/components/Slider/Slider.test.tsx +105 -0
- package/src/components/Slider/Slider.theme.ts +38 -0
- package/src/components/Slider/Slider.tsx +64 -0
- package/src/components/Slider/index.ts +5 -0
- package/src/components/Status/Status.theme.ts +1 -1
- package/src/components/Status/Status.tsx +0 -1
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/Toolbar/Toolbar.theme.ts +14 -5
- package/src/components/Toolbar/Toolbar.tsx +5 -1
- package/src/components/Tooltip/TextTooltip.tsx +2 -1
- package/src/components/Tooltip/Tooltip.tsx +12 -35
- package/src/components/Tooltip/TooltipContext.ts +41 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/hooks/useIconHref.ts +26 -5
- package/src/hooks/useThemeContext.test.tsx +33 -0
- package/src/hooks/useThemeContext.ts +28 -3
- package/src/playground/Density.stories.tsx +41 -0
- package/src/playground/Elevation.stories.tsx +348 -0
- package/src/primitives/DensityProvider/DensityContext.ts +15 -0
- package/src/primitives/DensityProvider/DensityProvider.tsx +12 -6
- package/src/primitives/DensityProvider/index.ts +1 -0
- package/src/primitives/Flex/Flex.stories.tsx +1 -1
- package/src/primitives/Grid/Grid.stories.tsx +1 -1
- package/src/primitives/ThemeProvider/IconRegistry.tsx +42 -0
- package/src/primitives/ThemeProvider/ThemeProvider.tsx +16 -15
- package/src/primitives/ThemeProvider/TranslationsContext.ts +24 -0
- package/src/primitives/ThemeProvider/TranslationsProvider.tsx +4 -16
- package/src/primitives/ThemeProvider/icon-registry.ts +272 -0
- package/src/primitives/ThemeProvider/index.ts +9 -1
- package/src/testing/decorators/withLayout.tsx +4 -4
- package/src/testing/decorators/withLayoutVariants.tsx +3 -3
- package/src/testing/decorators/withTheme.tsx +1 -2
- package/src/theme/defaultTheme.ts +2 -0
- package/src/theme/index.ts +1 -0
- package/src/util/slots.stories.tsx +80 -0
- package/src/util/slots.ts +14 -5
- package/dist/lib/browser/chunk-CMHHVHX3.mjs +0 -46
- package/dist/lib/browser/chunk-CMHHVHX3.mjs.map +0 -7
- package/dist/lib/browser/chunk-GTHV4WYK.mjs +0 -1499
- package/dist/lib/browser/chunk-GTHV4WYK.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -5632
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs +0 -133
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/browser/translations.mjs +0 -9
- package/dist/lib/browser/translations.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3VSKWNCQ.mjs +0 -1501
- package/dist/lib/node-esm/chunk-3VSKWNCQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P4KFQGJI.mjs +0 -48
- package/dist/lib/node-esm/chunk-P4KFQGJI.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -5633
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -134
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/translations.mjs +0 -10
- package/dist/lib/node-esm/translations.mjs.map +0 -7
- package/src/components/Column/AUDIT.md +0 -148
- package/src/components/Focus/AUDIT.md +0 -43
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import { mx } from '@dxos/ui-theme';
|
|
6
6
|
import { type ComponentFunction, type Density, type Theme } from '@dxos/ui-types';
|
|
7
7
|
|
|
8
|
+
import { withColumn } from '../Column/withColumn';
|
|
9
|
+
|
|
8
10
|
export type CardStyleProps = {
|
|
9
11
|
border?: boolean;
|
|
10
12
|
fullWidth?: boolean;
|
|
@@ -12,29 +14,27 @@ export type CardStyleProps = {
|
|
|
12
14
|
variant?: 'default' | 'subtitle' | 'description';
|
|
13
15
|
density?: Density;
|
|
14
16
|
truncate?: boolean;
|
|
15
|
-
padding?: boolean;
|
|
16
17
|
};
|
|
17
18
|
|
|
19
|
+
const subgrid = 'col-span-3 grid grid-cols-subgrid gap-1 items-center';
|
|
20
|
+
|
|
18
21
|
const root: ComponentFunction<CardStyleProps> = ({ border, fullWidth }, ...etc) =>
|
|
19
22
|
mx(
|
|
20
|
-
'dx-card dx-card-surface dx-card-min-width dx-card-max-width min-h-(--dx-rail-item)
|
|
21
|
-
|
|
23
|
+
'dx-card dx-card-surface dx-card-min-width dx-card-max-width min-h-(--dx-rail-item) p-1 gap-1',
|
|
24
|
+
'group/card relative shrink-0 overflow-hidden',
|
|
25
|
+
border && 'border-2 border-separator rounded-md dx-focus-ring-group-y-indicator',
|
|
22
26
|
fullWidth && 'max-w-none!',
|
|
23
27
|
...etc,
|
|
24
28
|
);
|
|
25
29
|
|
|
26
30
|
const header: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
27
|
-
mx(
|
|
28
|
-
'dx-card__header col-span-3 grid grid-cols-subgrid items-center',
|
|
29
|
-
'[&>*:not(.dx-gutter)]:col-start-2 [&>*:not(.dx-gutter)>*]:col-start-2',
|
|
30
|
-
...etc,
|
|
31
|
-
);
|
|
31
|
+
mx('dx-card__header', subgrid, withColumn.placeContent(), ...etc);
|
|
32
32
|
|
|
33
|
-
const title: ComponentFunction<CardStyleProps> = (
|
|
33
|
+
const title: ComponentFunction<CardStyleProps> = (_, ...etc) => mx('dx-card__title grow truncate', ...etc);
|
|
34
34
|
|
|
35
|
-
const body: ComponentFunction<CardStyleProps> = (
|
|
35
|
+
const body: ComponentFunction<CardStyleProps> = (_, ...etc) => mx('dx-card__body contents', ...etc);
|
|
36
36
|
|
|
37
|
-
const block: ComponentFunction<CardStyleProps> = (
|
|
37
|
+
const block: ComponentFunction<CardStyleProps> = (_, ...etc) => mx('dx-card__block', ...etc);
|
|
38
38
|
|
|
39
39
|
const text: ComponentFunction<CardStyleProps> = ({ variant = 'default', truncate: _truncate }, ...etc) =>
|
|
40
40
|
mx(
|
|
@@ -47,65 +47,75 @@ const text: ComponentFunction<CardStyleProps> = ({ variant = 'default', truncate
|
|
|
47
47
|
const textSpan: ComponentFunction<CardStyleProps> = ({ variant = 'default', truncate }, ...etc) =>
|
|
48
48
|
mx(variant === 'description' && 'text-sm text-description line-clamp-3', truncate && 'truncate', ...etc);
|
|
49
49
|
|
|
50
|
-
const poster: ComponentFunction<CardStyleProps> = (
|
|
50
|
+
const poster: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
51
51
|
mx('dx-card__poster col-span-3 max-h-[200px] select-none pointer-events-none', ...etc);
|
|
52
52
|
|
|
53
|
-
const posterIcon: ComponentFunction<CardStyleProps> = (
|
|
53
|
+
const posterIcon: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
54
54
|
mx('dx-card__poster-icon col-span-3 grid place-items-center bg-input-surface text-subdued max-h-[200px]', ...etc);
|
|
55
55
|
|
|
56
|
-
const action: ComponentFunction<CardStyleProps> = (
|
|
56
|
+
const action: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
57
57
|
mx(
|
|
58
|
-
'dx-card__action
|
|
58
|
+
mx('dx-card__action', subgrid, withColumn.placeContent(), 'p-0! gap-0! w-full text-start overflow-hidden'),
|
|
59
59
|
...etc,
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
-
const actionLabel: ComponentFunction<CardStyleProps> = (
|
|
62
|
+
const actionLabel: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
63
63
|
mx('dx-card__action-label min-w-0 flex-1 truncate', ...etc);
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
// Holds the label and its annotation in one grid cell: `action` puts every child in column 2, so
|
|
66
|
+
// siblings would otherwise stack onto separate rows.
|
|
67
|
+
const actionContent: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
68
|
+
mx('dx-card__action-content min-w-0 flex-1 flex items-baseline gap-2 overflow-hidden', ...etc);
|
|
69
|
+
|
|
70
|
+
// Never shrinks: the label truncates around it, so a long subject cannot squeeze the annotation out.
|
|
71
|
+
const actionAnnotation: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
72
|
+
mx('dx-card__action-annotation shrink-0 text-xs text-description tabular-nums', ...etc);
|
|
73
|
+
|
|
74
|
+
const link: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
75
|
+
mx(mx('dx-card__link', subgrid, withColumn.placeContent(), 'group p-0! dx-button dx-focus-ring min-h-1!'), ...etc);
|
|
70
76
|
|
|
71
|
-
const linkLabel: ComponentFunction<CardStyleProps> = (
|
|
77
|
+
const linkLabel: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
72
78
|
mx('dx-card__link-label min-w-0 flex-1 truncate text-sm!', ...etc);
|
|
73
79
|
|
|
74
80
|
const row: ComponentFunction<CardStyleProps> = ({ fullWidth }, ...etc) =>
|
|
75
81
|
mx(
|
|
76
|
-
|
|
82
|
+
// No `overflow-hidden`: focus rings are drawn outside the border box (`.dx-input` uses
|
|
83
|
+
// `ring-offset`), so clipping here severs the ring of any focusable control in the row —
|
|
84
|
+
// `Column.Row` carries the same note. Children that need to clip do it themselves (`truncate`).
|
|
85
|
+
'dx-card__row',
|
|
77
86
|
fullWidth
|
|
78
87
|
? 'col-span-full'
|
|
79
88
|
: // The `>*` selector reaches the real grid item when a content child is `display: contents`
|
|
80
89
|
// (e.g. `dx-avatar`), which the direct-child selector cannot target. It is inert for normal
|
|
81
90
|
// block children, whose inner nodes are not grid items of this row.
|
|
82
|
-
|
|
91
|
+
mx(subgrid, withColumn.placeContent()),
|
|
83
92
|
...etc,
|
|
84
93
|
);
|
|
85
94
|
|
|
86
95
|
// NOTE: Direct children that lack an explicit `col-*` utility default to the
|
|
87
96
|
// Column.Root center track (via `--dx-col`); see `ui-theme`'s `css/components/card.css`.
|
|
88
|
-
const section: ComponentFunction<CardStyleProps> = (
|
|
89
|
-
mx('dx-card__section col-span-full grid grid-cols-subgrid', ...etc);
|
|
97
|
+
const section: ComponentFunction<CardStyleProps> = (_, ...etc) => mx('dx-card__section', subgrid, ...etc);
|
|
90
98
|
|
|
91
|
-
const sectionTitle: ComponentFunction<CardStyleProps> = (
|
|
99
|
+
const sectionTitle: ComponentFunction<CardStyleProps> = (_, ...etc) =>
|
|
92
100
|
mx('dx-card__section-title col-start-2 col-span-full py-2 text-xs text-description font-medium uppercase', ...etc);
|
|
93
101
|
|
|
94
102
|
export const cardTheme: Theme<CardStyleProps> = {
|
|
95
|
-
root,
|
|
96
|
-
header,
|
|
97
|
-
title,
|
|
98
|
-
body,
|
|
99
|
-
block,
|
|
100
|
-
row,
|
|
101
|
-
section,
|
|
103
|
+
'root': root,
|
|
104
|
+
'header': header,
|
|
105
|
+
'title': title,
|
|
106
|
+
'body': body,
|
|
107
|
+
'block': block,
|
|
108
|
+
'row': row,
|
|
109
|
+
'section': section,
|
|
102
110
|
'section-title': sectionTitle,
|
|
103
|
-
text,
|
|
111
|
+
'text': text,
|
|
104
112
|
'text-span': textSpan,
|
|
105
|
-
poster,
|
|
113
|
+
'poster': poster,
|
|
106
114
|
'poster-icon': posterIcon,
|
|
107
|
-
action,
|
|
115
|
+
'action': action,
|
|
108
116
|
'action-label': actionLabel,
|
|
109
|
-
|
|
117
|
+
'action-content': actionContent,
|
|
118
|
+
'action-annotation': actionAnnotation,
|
|
119
|
+
'link': link,
|
|
110
120
|
'link-label': linkLabel,
|
|
111
121
|
};
|
|
@@ -5,7 +5,16 @@
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import DOMPurify from 'dompurify';
|
|
8
|
-
import React, {
|
|
8
|
+
import React, {
|
|
9
|
+
CSSProperties,
|
|
10
|
+
type KeyboardEventHandler,
|
|
11
|
+
MouseEventHandler,
|
|
12
|
+
type ReactNode,
|
|
13
|
+
forwardRef,
|
|
14
|
+
useCallback,
|
|
15
|
+
useId,
|
|
16
|
+
useMemo,
|
|
17
|
+
} from 'react';
|
|
9
18
|
import { useTranslation } from 'react-i18next';
|
|
10
19
|
|
|
11
20
|
import { iconSize } from '@dxos/ui-theme';
|
|
@@ -17,7 +26,7 @@ import { useThemeContext } from '../../hooks';
|
|
|
17
26
|
import { composable, composableProps, slottable } from '../../util';
|
|
18
27
|
import { type ThemedClassName } from '../../util';
|
|
19
28
|
import { Button, IconButton } from '../Button';
|
|
20
|
-
import { Column } from '../Column';
|
|
29
|
+
import { Column, type ColumnRootProps } from '../Column';
|
|
21
30
|
import { Icon } from '../Icon';
|
|
22
31
|
import { Image, type ImageProps } from '../Image';
|
|
23
32
|
import { DropdownMenu } from '../Menu';
|
|
@@ -33,10 +42,22 @@ type CardRootProps = {
|
|
|
33
42
|
'id'?: string;
|
|
34
43
|
'border'?: boolean;
|
|
35
44
|
'fullWidth'?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Adopt the parent grid's columns (via `subgrid`) instead of defining the card's own gutters —
|
|
47
|
+
* used to align a nested card's rows to an outer 3-track grid. See `Column.Root`.
|
|
48
|
+
*/
|
|
49
|
+
'subgrid'?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Width of the card's leading/trailing gutter tracks. Defaults to `lg` (chrome-sized inset for
|
|
52
|
+
* headers and rows); a card whose whole body is a form should use `sm` so the fields inset like
|
|
53
|
+
* a standalone form rather than by the card's chrome.
|
|
54
|
+
*/
|
|
55
|
+
'gutter'?: ColumnRootProps['gutter'];
|
|
36
56
|
'density'?: Density;
|
|
37
57
|
'style'?: CSSProperties;
|
|
38
58
|
'tabIndex'?: number;
|
|
39
59
|
'onClick'?: MouseEventHandler<HTMLDivElement>;
|
|
60
|
+
'onKeyDown'?: KeyboardEventHandler<HTMLDivElement>;
|
|
40
61
|
'data-selected'?: boolean;
|
|
41
62
|
'data-testid'?: string;
|
|
42
63
|
};
|
|
@@ -45,7 +66,7 @@ type CardRootProps = {
|
|
|
45
66
|
* `Card.Root` does not support `asChild`. The Column grid is the root element
|
|
46
67
|
* (one `<div>` carrying both the `dx-card` and `dx-column-root` classes
|
|
47
68
|
* instead of the previous outer-card + inner-column pair), so caller-provided
|
|
48
|
-
* HTML attributes — `onClick`, `tabIndex`, `style`, `data-*`, `grid-template-rows`
|
|
69
|
+
* HTML attributes — `onClick`, `onKeyDown`, `tabIndex`, `style`, `data-*`, `grid-template-rows`
|
|
49
70
|
* overrides via `classNames` — land directly on the grid container.
|
|
50
71
|
* Slot-parents (`Focus.Item asChild`, `Mosaic.Tile asChild`, etc.) continue to
|
|
51
72
|
* work because `composable()` preserves the COMPOSABLE marker that slottable parents
|
|
@@ -53,14 +74,15 @@ type CardRootProps = {
|
|
|
53
74
|
* `<div>` exactly the way `slottable`'s `Slot`/`Primitive.div` branch did.
|
|
54
75
|
*/
|
|
55
76
|
const CardRoot = composable<HTMLDivElement, CardRootProps>(
|
|
56
|
-
({ children, id, role, border = true, fullWidth, density, ...props }, forwardedRef) => {
|
|
77
|
+
({ children, id, role, border = true, fullWidth, subgrid, gutter = 'lg', density, ...props }, forwardedRef) => {
|
|
57
78
|
const { className, ...rest } = composableProps(props);
|
|
58
79
|
const { tx } = useThemeContext();
|
|
59
80
|
|
|
60
81
|
return (
|
|
61
82
|
<Column.Root
|
|
62
83
|
asChild
|
|
63
|
-
gutter=
|
|
84
|
+
gutter={gutter}
|
|
85
|
+
subgrid={subgrid}
|
|
64
86
|
classNames={tx('card.root', { border, fullWidth }, className)}
|
|
65
87
|
role={role ?? 'group'}
|
|
66
88
|
>
|
|
@@ -186,11 +208,17 @@ type CardMenuProps<T extends any | void = void> = ToolbarMenuProps<T>;
|
|
|
186
208
|
|
|
187
209
|
function CardMenu<T extends any | void = void>({ context, items }: CardMenuProps<T>) {
|
|
188
210
|
const { t } = useTranslation(translationKey);
|
|
211
|
+
// A `Card.Root` with an `onClick` is a click target, and this menu sits inside it. React portals
|
|
212
|
+
// propagate through the React tree rather than the DOM, so without this both the trigger and the
|
|
213
|
+
// item selection reach the card's handler and activate it on the way past. Radix's `asChild`
|
|
214
|
+
// composes the trigger handler, so the menu still opens.
|
|
215
|
+
const stopPropagation = useCallback<MouseEventHandler>((event) => event.stopPropagation(), []);
|
|
189
216
|
return (
|
|
190
217
|
<CardBlock end>
|
|
191
218
|
<DropdownMenu.Root>
|
|
192
219
|
<DropdownMenu.Trigger disabled={!items?.length} asChild>
|
|
193
220
|
<IconButton
|
|
221
|
+
onClick={stopPropagation}
|
|
194
222
|
iconOnly
|
|
195
223
|
variant='ghost'
|
|
196
224
|
icon='ph--dots-three-vertical--regular'
|
|
@@ -199,12 +227,13 @@ function CardMenu<T extends any | void = void>({ context, items }: CardMenuProps
|
|
|
199
227
|
</DropdownMenu.Trigger>
|
|
200
228
|
{(items?.length ?? 0) > 0 && (
|
|
201
229
|
<DropdownMenu.Portal>
|
|
202
|
-
<DropdownMenu.Content>
|
|
230
|
+
<DropdownMenu.Content onClick={stopPropagation}>
|
|
203
231
|
<DropdownMenu.Viewport>
|
|
204
|
-
{items?.map(({ label, onClick: onSelect }, index) => (
|
|
232
|
+
{items?.map(({ label, icon, onClick: onSelect }, index) => (
|
|
205
233
|
// `context` is the generic payload threaded to each handler; the cast is the
|
|
206
234
|
// generic boundary (T may be `void`, so `context` is typed `T | undefined`).
|
|
207
235
|
<DropdownMenu.Item key={index} onSelect={() => onSelect(context as T)}>
|
|
236
|
+
{icon && <Icon icon={icon} />}
|
|
208
237
|
{label}
|
|
209
238
|
</DropdownMenu.Item>
|
|
210
239
|
))}
|
|
@@ -226,7 +255,11 @@ CardMenu.displayName = CARD_MENU_NAME;
|
|
|
226
255
|
|
|
227
256
|
const CARD_BLOCK_NAME = 'Card.Block';
|
|
228
257
|
|
|
229
|
-
type CardBlockProps = SlottableProps<{
|
|
258
|
+
type CardBlockProps = SlottableProps<{
|
|
259
|
+
end?: boolean;
|
|
260
|
+
compact?: boolean;
|
|
261
|
+
square?: boolean;
|
|
262
|
+
}>;
|
|
230
263
|
|
|
231
264
|
/**
|
|
232
265
|
* Leading (default) or trailing (`end`) gutter slot of a Card row/header. Sized to the
|
|
@@ -252,6 +285,12 @@ CardBlock.displayName = CARD_BLOCK_NAME;
|
|
|
252
285
|
|
|
253
286
|
const CARD_TITLE_NAME = 'Card.Title';
|
|
254
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Card heading text. Carries no column placement of its own, so it must be a child of a subgrid
|
|
290
|
+
* part — `Card.Header` (the usual home), `Card.Row`, or `Card.Section` — which places it in the
|
|
291
|
+
* center content track. Placed directly under `Card.Root` (or a `display:contents` `Card.Body`) it
|
|
292
|
+
* auto-places into a gutter track and renders clamped/misaligned.
|
|
293
|
+
*/
|
|
255
294
|
const CardTitle = slottable<HTMLDivElement>(({ children, asChild, ...props }, forwardedRef) => {
|
|
256
295
|
const { tx } = useThemeContext();
|
|
257
296
|
const { className, ...rest } = composableProps(props, { role: 'heading' });
|
|
@@ -370,6 +409,12 @@ CardRow.displayName = CARD_ROW_NAME;
|
|
|
370
409
|
|
|
371
410
|
const CARD_TEXT_NAME = 'Card.Text';
|
|
372
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Body text within a Card. Carries no column placement of its own, so it must be a child of a subgrid
|
|
414
|
+
* part — `Card.Row` (the usual home), `Card.Header`, or `Card.Section` — which places it in the center
|
|
415
|
+
* content track. Placed directly under `Card.Root` (or a `display:contents` `Card.Body`) it auto-places
|
|
416
|
+
* into a gutter track and renders squeezed. Use `variant='description'` for muted secondary text.
|
|
417
|
+
*/
|
|
373
418
|
// `onClick` is opted in explicitly: `ComposableProps` deliberately excludes event handlers, but the
|
|
374
419
|
// part spreads rest props onto its element, so the handler is forwarded at runtime.
|
|
375
420
|
type CardTextProps = {
|
|
@@ -405,6 +450,12 @@ type CardHtmlProps = { html?: string; variant?: 'default' | 'description' };
|
|
|
405
450
|
/**
|
|
406
451
|
* Renders sanitized HTML content inside a card text slot.
|
|
407
452
|
* Uses DOMPurify to prevent XSS from untrusted markup (e.g. RSS feed content).
|
|
453
|
+
*
|
|
454
|
+
* Sanitization is all this does: the markup renders in the app's own DOM, so the content's CSS reaches
|
|
455
|
+
* the app, remote images (tracking pixels) load, and nothing adapts to the theme. Prefer
|
|
456
|
+
* `@dxos/react-ui-components`' `Html`, which isolates content in a shadow root and blocks remote images
|
|
457
|
+
* by default — it cannot be used from here (that package depends on this one), so a caller that needs
|
|
458
|
+
* those guarantees should compose `Html` into the card rather than reach for this.
|
|
408
459
|
*/
|
|
409
460
|
function CardHtml({ html = '', variant = 'default', ...props }: CardHtmlProps & ThemedClassName<object>) {
|
|
410
461
|
const { tx } = useThemeContext();
|
|
@@ -473,9 +524,16 @@ CardPoster.displayName = CARD_POSTER_NAME;
|
|
|
473
524
|
|
|
474
525
|
const CARD_ACTION_NAME = 'Card.Action';
|
|
475
526
|
|
|
476
|
-
type CardActionProps = {
|
|
527
|
+
type CardActionProps = {
|
|
528
|
+
icon?: string;
|
|
529
|
+
label: string;
|
|
530
|
+
/** Short trailing text (e.g. an age); kept at full width while the label truncates around it. */
|
|
531
|
+
annotation?: string;
|
|
532
|
+
actionIcon?: string;
|
|
533
|
+
onClick?: () => void;
|
|
534
|
+
};
|
|
477
535
|
|
|
478
|
-
function CardAction({ icon, actionIcon = 'ph--arrow-right--regular', label, onClick }: CardActionProps) {
|
|
536
|
+
function CardAction({ icon, actionIcon = 'ph--arrow-right--regular', label, annotation, onClick }: CardActionProps) {
|
|
479
537
|
const { tx } = useThemeContext();
|
|
480
538
|
return (
|
|
481
539
|
<Button variant='ghost' classNames={tx('card.action', {})} onClick={onClick}>
|
|
@@ -484,7 +542,10 @@ function CardAction({ icon, actionIcon = 'ph--arrow-right--regular', label, onCl
|
|
|
484
542
|
<Icon icon={icon} size={4} />
|
|
485
543
|
</CardBlock>
|
|
486
544
|
)}
|
|
487
|
-
<span className={tx('card.action-
|
|
545
|
+
<span className={tx('card.action-content', {})}>
|
|
546
|
+
<span className={tx('card.action-label', {})}>{label}</span>
|
|
547
|
+
{annotation && <span className={tx('card.action-annotation', {})}>{annotation}</span>}
|
|
548
|
+
</span>
|
|
488
549
|
{actionIcon && (
|
|
489
550
|
<CardBlock end>
|
|
490
551
|
<Icon icon={actionIcon} size={4} />
|
|
@@ -528,22 +589,22 @@ CardLink.displayName = CARD_LINK_NAME;
|
|
|
528
589
|
export const Card = {
|
|
529
590
|
Root: CardRoot,
|
|
530
591
|
|
|
531
|
-
//
|
|
592
|
+
// Containers
|
|
532
593
|
Header: CardHeader,
|
|
594
|
+
Body: CardBody,
|
|
533
595
|
|
|
534
|
-
// Header
|
|
596
|
+
// Header components
|
|
535
597
|
Block: CardBlock,
|
|
536
598
|
DragHandle: CardDragHandle,
|
|
537
599
|
ActionIconButton: CardActionIconButton,
|
|
538
600
|
Menu: CardMenu,
|
|
539
601
|
Title: CardTitle,
|
|
540
602
|
|
|
541
|
-
// Body
|
|
542
|
-
Body: CardBody,
|
|
603
|
+
// Body components
|
|
543
604
|
Section: CardSection,
|
|
544
605
|
Row: CardRow,
|
|
545
606
|
|
|
546
|
-
//
|
|
607
|
+
// Row components
|
|
547
608
|
Text: CardText,
|
|
548
609
|
Html: CardHtml,
|
|
549
610
|
Poster: CardPoster,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
6
|
-
import { createContext } from '@radix-ui/react-context';
|
|
7
6
|
import React, {
|
|
8
7
|
Children,
|
|
9
8
|
type KeyboardEvent,
|
|
@@ -25,6 +24,7 @@ import { translationKey } from '../../translations';
|
|
|
25
24
|
import { type ThemedClassName, composable, composableProps } from '../../util';
|
|
26
25
|
import { IconButton } from '../Button';
|
|
27
26
|
import { type MediaKind, MediaPlayer } from '../MediaPlayer';
|
|
27
|
+
import { CarouselProvider, useCarousel } from './CarouselContext';
|
|
28
28
|
|
|
29
29
|
// TODO(burdon): Controller.
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ import { type MediaKind, MediaPlayer } from '../MediaPlayer';
|
|
|
35
35
|
/** Slide change behaviour: `none` hard-swaps the active slide, `slide` animates a horizontal track. */
|
|
36
36
|
export type CarouselTransition = 'none' | 'slide';
|
|
37
37
|
|
|
38
|
-
type CarouselContextValue = {
|
|
38
|
+
export type CarouselContextValue = {
|
|
39
39
|
index: number;
|
|
40
40
|
count: number;
|
|
41
41
|
transition: CarouselTransition;
|
|
@@ -56,13 +56,6 @@ type CarouselContextValue = {
|
|
|
56
56
|
prev: () => void;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
const CAROUSEL_NAME = 'Carousel';
|
|
60
|
-
|
|
61
|
-
const [CarouselProvider, useCarouselContext] = createContext<CarouselContextValue>(CAROUSEL_NAME);
|
|
62
|
-
|
|
63
|
-
/** Returns the current carousel state. Must be used within {@link Carousel.Root}. */
|
|
64
|
-
export const useCarousel = (): CarouselContextValue => useCarouselContext('useCarousel');
|
|
65
|
-
|
|
66
59
|
//
|
|
67
60
|
// Root
|
|
68
61
|
//
|
|
@@ -347,8 +340,8 @@ const CarouselSlide = ({
|
|
|
347
340
|
<div
|
|
348
341
|
className={mx(
|
|
349
342
|
transition === 'slide'
|
|
350
|
-
? 'relative shrink-0 basis-full h-full
|
|
351
|
-
: 'absolute inset-0 w-full h-full
|
|
343
|
+
? 'relative shrink-0 basis-full h-full dx-base-surface'
|
|
344
|
+
: 'absolute inset-0 w-full h-full dx-base-surface',
|
|
352
345
|
classNames,
|
|
353
346
|
)}
|
|
354
347
|
>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createContext } from '@radix-ui/react-context';
|
|
6
|
+
|
|
7
|
+
import { type CarouselContextValue } from './Carousel';
|
|
8
|
+
|
|
9
|
+
// Kept out of `Carousel.tsx`: react-refresh only fast-refreshes a module whose exports are all
|
|
10
|
+
// components, so a context and its hook exported beside them force a full page reload on every edit.
|
|
11
|
+
|
|
12
|
+
export const CAROUSEL_NAME = 'Carousel';
|
|
13
|
+
|
|
14
|
+
export const [CarouselProvider, useCarouselContext] = createContext<CarouselContextValue>(CAROUSEL_NAME);
|
|
15
|
+
|
|
16
|
+
/** Returns the current carousel state. Must be used within {@link Carousel.Root}. */
|
|
17
|
+
export const useCarousel = (): CarouselContextValue => useCarouselContext('useCarousel');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createContext, useContext } from 'react';
|
|
6
|
+
|
|
7
|
+
// Kept out of `ClipboardProvider.tsx`: react-refresh only fast-refreshes a module whose exports are all
|
|
8
|
+
// components, so a context and its hook exported beside them force a full page reload on every edit.
|
|
9
|
+
|
|
10
|
+
export type ClipboardContextValue = {
|
|
11
|
+
textValue: string;
|
|
12
|
+
setTextValue: (nextValue: string) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const ClipboardContext = createContext<ClipboardContextValue>({
|
|
16
|
+
textValue: '',
|
|
17
|
+
setTextValue: async (_) => {},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const useClipboard = () => useContext(ClipboardContext);
|
|
@@ -2,19 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { type PropsWithChildren,
|
|
5
|
+
import React, { type PropsWithChildren, useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
textValue: string;
|
|
9
|
-
setTextValue: (nextValue: string) => Promise<void>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const ClipboardContext = createContext<ClipboardContextValue>({
|
|
13
|
-
textValue: '',
|
|
14
|
-
setTextValue: async (_) => {},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const useClipboard = () => useContext(ClipboardContext);
|
|
7
|
+
import { ClipboardContext } from './ClipboardContext';
|
|
18
8
|
|
|
19
9
|
export const ClipboardProvider = ({ children }: PropsWithChildren<{}>) => {
|
|
20
10
|
const [textValue, setInternalTextValue] = useState('');
|
|
@@ -10,7 +10,7 @@ import { useTranslation } from '../../primitives';
|
|
|
10
10
|
import { Button, type ButtonProps, IconButton } from '../Button';
|
|
11
11
|
import { Icon, type IconProps } from '../Icon';
|
|
12
12
|
import { type TooltipScopedProps, useTooltipContext } from '../Tooltip';
|
|
13
|
-
import { useClipboard } from './
|
|
13
|
+
import { useClipboard } from './ClipboardContext';
|
|
14
14
|
|
|
15
15
|
export type CopyButtonProps = ButtonProps &
|
|
16
16
|
Pick<IconProps, 'size'> & {
|
|
@@ -141,8 +141,8 @@ export const WithCenter: Story = {
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
* ScrollArea auto-bleeds inside Column.Root (via [.dx-
|
|
145
|
-
* No
|
|
144
|
+
* ScrollArea auto-bleeds inside Column.Root (via `[.dx-column-root_&]:col-span-full` in its theme).
|
|
145
|
+
* No bleed wrapper needed.
|
|
146
146
|
*/
|
|
147
147
|
export const WithScrollAreaAutoBleed: Story = {
|
|
148
148
|
decorators: [withLayout({ layout: 'column', classNames: 'w-[25rem]' })],
|
|
@@ -45,19 +45,11 @@ const block: ComponentFunction<ColumnBlockStyleProps> = ({ end, compact, square
|
|
|
45
45
|
mx(
|
|
46
46
|
'dx-gutter grid place-items-center [&>img]:max-w-[1.5rem]',
|
|
47
47
|
end ? 'col-start-3' : 'col-start-1',
|
|
48
|
-
square
|
|
49
|
-
compact
|
|
48
|
+
square && 'aspect-square',
|
|
49
|
+
!compact && 'h-[var(--dx-rail-item)]',
|
|
50
50
|
...etc,
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* Bleed placement: spans all 3 columns of the parent Column.Root grid (gutter-to-gutter).
|
|
55
|
-
* Use for `ScrollArea`, full-width dividers, tables, or any content that should ignore gutters.
|
|
56
|
-
*/
|
|
57
|
-
const bleed: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
58
|
-
return mx('col-span-full grid grid-cols-subgrid min-h-0', ...etc);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
53
|
/**
|
|
62
54
|
* Center placement: places the element in column 2 (the central track between gutters) of the
|
|
63
55
|
* parent Column.Root grid. Does NOT use subgrid — placement is explicit on this element only.
|
|
@@ -71,6 +63,5 @@ export const columnTheme = {
|
|
|
71
63
|
root,
|
|
72
64
|
row,
|
|
73
65
|
block,
|
|
74
|
-
bleed,
|
|
75
66
|
center,
|
|
76
67
|
};
|