@dxos/react-ui 0.8.4-main.bc674ce → 0.8.4-main.bd9b33e6c8
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-CEKVHJ27.mjs → chunk-LUPEFGHJ.mjs} +119 -117
- package/dist/lib/browser/chunk-LUPEFGHJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3021 -2087
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +59 -36
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-2NHEX4AD.mjs → chunk-EQOBFLZC.mjs} +119 -117
- package/dist/lib/node-esm/chunk-EQOBFLZC.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3021 -2087
- 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 +59 -36
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.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/IconButton.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/ToggleGroup.d.ts +6 -6
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +145 -0
- package/dist/types/src/components/Card/Card.d.ts.map +1 -0
- package/dist/types/src/components/Card/Card.stories.d.ts +21 -0
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -0
- package/dist/types/src/components/Card/index.d.ts +2 -0
- package/dist/types/src/components/Card/index.d.ts.map +1 -0
- package/dist/types/src/components/Clipboard/index.d.ts +10 -1
- package/dist/types/src/components/Clipboard/index.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +41 -19
- 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 -22
- 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/ErrorFallback/ErrorFallback.d.ts +11 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts +7 -0
- package/dist/types/src/components/ErrorFallback/ErrorFallback.stories.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts +8 -0
- package/dist/types/src/components/ErrorFallback/ErrorStack.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts +9 -0
- package/dist/types/src/components/ErrorFallback/ThrowError.d.ts.map +1 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts +5 -0
- package/dist/types/src/components/ErrorFallback/index.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.d.ts +44 -0
- package/dist/types/src/components/Focus/Focus.d.ts.map +1 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts +9 -0
- package/dist/types/src/components/Focus/Focus.stories.d.ts.map +1 -0
- package/dist/types/src/components/Focus/index.d.ts +2 -0
- package/dist/types/src/components/Focus/index.d.ts.map +1 -0
- package/dist/types/src/components/Icon/Icon.d.ts +3 -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 +14 -0
- package/dist/types/src/components/Image/Image.d.ts.map +1 -0
- package/dist/types/src/components/Image/Image.stories.d.ts +33 -0
- package/dist/types/src/components/Image/Image.stories.d.ts.map +1 -0
- package/dist/types/src/components/Image/index.d.ts +2 -0
- package/dist/types/src/components/Image/index.d.ts.map +1 -0
- package/dist/types/src/components/Input/Input.d.ts +4 -7
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +7 -7
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +9 -3
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +8 -2
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +6 -32
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +1 -5
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +51 -50
- 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.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 +32 -23
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +31 -25
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +62 -9
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +23 -7
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +6 -2
- 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.d.ts +12 -0
- package/dist/types/src/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts +17 -0
- package/dist/types/src/components/Skeleton/Skeleton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Skeleton/index.d.ts +2 -0
- package/dist/types/src/components/Skeleton/index.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts +37 -0
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts +7 -0
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -0
- package/dist/types/src/components/Splitter/index.d.ts +2 -0
- package/dist/types/src/components/Splitter/index.d.ts.map +1 -0
- package/dist/types/src/components/Status/Status.d.ts +3 -4
- package/dist/types/src/components/Status/Status.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +4 -2
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.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 +2 -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/Toast/Toast.d.ts +15 -15
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +37 -11
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +9 -9
- 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 +9 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +23 -0
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts +15 -0
- package/dist/types/src/exemplars/slot.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts +8 -0
- package/dist/types/src/exemplars/tabster.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts +11 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts +1 -1
- package/dist/types/src/hooks/useDensityContext.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.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.map +1 -1
- package/dist/types/src/primitives/Column/Column.d.ts +51 -0
- package/dist/types/src/primitives/Column/Column.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts +25 -0
- package/dist/types/src/primitives/Column/Column.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Column/index.d.ts +2 -0
- package/dist/types/src/primitives/Column/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.d.ts +11 -0
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts +6 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/index.d.ts +2 -0
- package/dist/types/src/primitives/Container/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts +15 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts +8 -0
- package/dist/types/src/primitives/Flex/Flex.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/index.d.ts +2 -0
- package/dist/types/src/primitives/Flex/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts +14 -0
- package/dist/types/src/primitives/Grid/Grid.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts +8 -0
- package/dist/types/src/primitives/Grid/Grid.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Grid/index.d.ts +2 -0
- package/dist/types/src/primitives/Grid/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts +46 -0
- package/dist/types/src/primitives/Panel/Panel.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts +6 -0
- package/dist/types/src/primitives/Panel/Panel.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Panel/index.d.ts +2 -0
- package/dist/types/src/primitives/Panel/index.d.ts.map +1 -0
- package/dist/types/src/primitives/index.d.ts +6 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -0
- package/dist/types/src/testing/Loading.d.ts +9 -0
- package/dist/types/src/testing/Loading.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/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 +3 -2
- 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 +25 -21
- package/src/components/Avatars/Avatar.stories.tsx +7 -8
- package/src/components/Avatars/Avatar.tsx +5 -12
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -2
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +11 -37
- package/src/components/Button/Button.stories.tsx +3 -3
- package/src/components/Button/Button.tsx +11 -25
- package/src/components/Button/IconButton.stories.tsx +4 -4
- package/src/components/Button/IconButton.tsx +2 -3
- package/src/components/Button/Toggle.stories.tsx +2 -2
- package/src/components/Button/Toggle.tsx +4 -4
- package/src/components/Button/ToggleGroup.stories.tsx +2 -2
- package/src/components/Button/ToggleGroup.tsx +12 -16
- package/src/components/Card/Card.stories.tsx +151 -0
- package/src/components/Card/Card.tsx +394 -0
- package/src/components/Card/index.ts +5 -0
- package/src/components/Clipboard/CopyButton.tsx +3 -3
- package/src/components/Dialog/AlertDialog.stories.tsx +16 -16
- package/src/components/Dialog/AlertDialog.tsx +121 -82
- package/src/components/Dialog/Dialog.stories.tsx +98 -17
- package/src/components/Dialog/Dialog.tsx +108 -87
- package/src/components/ErrorFallback/ErrorFallback.stories.tsx +50 -0
- package/src/components/ErrorFallback/ErrorFallback.tsx +70 -0
- package/src/components/ErrorFallback/ErrorStack.tsx +80 -0
- package/src/components/ErrorFallback/ThrowError.tsx +37 -0
- package/src/components/ErrorFallback/index.ts +9 -0
- package/src/components/Focus/AUDIT.md +43 -0
- package/src/components/Focus/Focus.stories.tsx +230 -0
- package/src/components/Focus/Focus.tsx +201 -0
- package/src/components/Focus/index.ts +5 -0
- package/src/components/Icon/Icon.stories.tsx +45 -14
- package/src/components/Icon/Icon.tsx +6 -2
- package/src/components/Image/Image.stories.tsx +86 -0
- package/src/components/Image/Image.tsx +223 -0
- package/src/components/Image/index.ts +5 -0
- package/src/components/Input/Input.stories.tsx +20 -39
- package/src/components/Input/Input.tsx +24 -69
- package/src/components/Link/Link.stories.tsx +2 -2
- package/src/components/Link/Link.tsx +2 -2
- package/src/components/List/List.stories.tsx +15 -22
- package/src/components/List/List.tsx +15 -18
- package/src/components/List/ListDropIndicator.tsx +7 -7
- package/src/components/List/Tree.stories.tsx +5 -5
- package/src/components/List/TreeDropIndicator.tsx +6 -6
- package/src/components/List/Treegrid.stories.tsx +3 -3
- package/src/components/List/Treegrid.tsx +10 -15
- package/src/components/Main/Main.stories.tsx +6 -95
- package/src/components/Main/Main.tsx +61 -211
- package/src/components/Menu/ContextMenu.stories.tsx +2 -2
- package/src/components/Menu/ContextMenu.tsx +9 -33
- package/src/components/Menu/DropdownMenu.stories.tsx +2 -2
- package/src/components/Menu/DropdownMenu.tsx +58 -52
- package/src/components/Message/Message.stories.tsx +27 -12
- package/src/components/Message/Message.tsx +14 -30
- package/src/components/Popover/Popover.stories.tsx +4 -4
- package/src/components/Popover/Popover.tsx +62 -59
- package/src/components/ScrollArea/ScrollArea.stories.tsx +213 -73
- package/src/components/ScrollArea/ScrollArea.tsx +85 -113
- package/src/components/ScrollArea/index.ts +1 -1
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +43 -23
- package/src/components/ScrollContainer/ScrollContainer.tsx +174 -87
- package/src/components/Select/Select.stories.tsx +4 -4
- package/src/components/Select/Select.tsx +11 -27
- package/src/components/Separator/Separator.tsx +5 -8
- package/src/components/Skeleton/Skeleton.stories.tsx +52 -0
- package/src/components/Skeleton/Skeleton.tsx +26 -0
- package/src/components/Skeleton/index.ts +5 -0
- package/src/components/Splitter/Splitter.stories.tsx +83 -0
- package/src/components/Splitter/Splitter.tsx +140 -0
- package/src/components/Splitter/index.ts +5 -0
- package/src/components/Status/Status.stories.tsx +21 -17
- package/src/components/Status/Status.tsx +10 -7
- package/src/components/Tag/Tag.stories.tsx +4 -9
- package/src/components/Tag/Tag.tsx +2 -7
- package/src/components/ThemeProvider/ThemeProvider.stories.tsx +32 -0
- package/src/components/ThemeProvider/ThemeProvider.tsx +9 -6
- package/src/components/Toast/Toast.stories.tsx +2 -2
- package/src/components/Toast/Toast.tsx +22 -41
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -2
- package/src/components/Toolbar/Toolbar.tsx +171 -25
- package/src/components/Tooltip/Tooltip.stories.tsx +16 -14
- package/src/components/Tooltip/Tooltip.tsx +18 -18
- package/src/components/index.ts +10 -5
- package/src/exemplars/generics.stories.tsx +41 -0
- package/src/exemplars/slot.stories.tsx +117 -0
- package/src/exemplars/tabster.stories.tsx +127 -0
- package/src/exemplars/virtualizer.stories.tsx +137 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDensityContext.ts +2 -2
- package/src/index.ts +1 -0
- package/src/playground/Controls.stories.tsx +3 -10
- package/src/playground/Custom.stories.tsx +11 -21
- package/src/playground/Typography.stories.tsx +3 -3
- package/src/primitives/Column/AUDIT.md +354 -0
- package/src/primitives/Column/Column.stories.tsx +183 -0
- package/src/primitives/Column/Column.tsx +169 -0
- package/src/primitives/Column/index.ts +5 -0
- package/src/primitives/Container/Container.stories.tsx +30 -0
- package/src/primitives/Container/Container.tsx +19 -0
- package/src/primitives/Container/index.ts +5 -0
- package/src/primitives/Flex/Flex.stories.tsx +58 -0
- package/src/primitives/Flex/Flex.tsx +24 -0
- package/src/primitives/Flex/index.ts +5 -0
- package/src/primitives/Grid/Grid.stories.tsx +57 -0
- package/src/primitives/Grid/Grid.tsx +30 -0
- package/src/primitives/Grid/index.ts +5 -0
- package/src/primitives/Panel/Panel.stories.tsx +67 -0
- package/src/primitives/Panel/Panel.tsx +114 -0
- package/src/primitives/Panel/index.ts +5 -0
- package/src/primitives/index.ts +9 -0
- package/src/testing/Loading.tsx +26 -0
- package/src/testing/decorators/withLayout.tsx +21 -7
- package/src/testing/decorators/withLayoutVariants.tsx +18 -21
- package/src/testing/decorators/withTheme.tsx +24 -19
- 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-CEKVHJ27.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2NHEX4AD.mjs.map +0 -7
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +0 -15
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +0 -1
- package/dist/types/src/components/AnchoredOverflow/index.d.ts +0 -2
- package/dist/types/src/components/AnchoredOverflow/index.d.ts.map +0 -1
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +0 -59
- package/src/components/AnchoredOverflow/index.ts +0 -5
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { type ComponentPropsWithoutRef, forwardRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { Panel } from '../../primitives';
|
|
9
|
+
import { withLayout, withTheme } from '../../testing';
|
|
10
|
+
import { ScrollArea } from '../ScrollArea';
|
|
11
|
+
import { Toolbar } from '../Toolbar';
|
|
12
|
+
|
|
13
|
+
import { Splitter, type SplitterRootProps } from './Splitter';
|
|
14
|
+
|
|
15
|
+
const PanelContent = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<'div'> & { label: string }>(
|
|
16
|
+
({ label, ...props }, ref) => (
|
|
17
|
+
<div ref={ref} {...props}>
|
|
18
|
+
<Panel.Root>
|
|
19
|
+
<Panel.Toolbar asChild>
|
|
20
|
+
<Toolbar.Root>{label}</Toolbar.Root>
|
|
21
|
+
</Panel.Toolbar>
|
|
22
|
+
<Panel.Content asChild>
|
|
23
|
+
<ScrollArea.Root orientation='vertical'>
|
|
24
|
+
<ScrollArea.Viewport>
|
|
25
|
+
{Array.from({ length: 100 }).map((_, i) => (
|
|
26
|
+
<div key={i} className='p-1'>
|
|
27
|
+
{label}-{i}
|
|
28
|
+
</div>
|
|
29
|
+
))}
|
|
30
|
+
</ScrollArea.Viewport>
|
|
31
|
+
</ScrollArea.Root>
|
|
32
|
+
</Panel.Content>
|
|
33
|
+
</Panel.Root>
|
|
34
|
+
</div>
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const DefaultStory = (props: SplitterRootProps) => {
|
|
39
|
+
const [mode, setMode] = useState(props.mode ?? 'both');
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Panel.Root>
|
|
43
|
+
<Panel.Toolbar asChild>
|
|
44
|
+
<Toolbar.Root>
|
|
45
|
+
<Toolbar.Button onClick={() => setMode('upper')}>A</Toolbar.Button>
|
|
46
|
+
<Toolbar.Button onClick={() => setMode('both')}>A + B</Toolbar.Button>
|
|
47
|
+
<Toolbar.Button onClick={() => setMode('lower')}>B</Toolbar.Button>
|
|
48
|
+
</Toolbar.Root>
|
|
49
|
+
</Panel.Toolbar>
|
|
50
|
+
<Panel.Content asChild>
|
|
51
|
+
<Splitter.Root mode={mode} ratio={props.ratio}>
|
|
52
|
+
<Splitter.Panel asChild position='upper'>
|
|
53
|
+
<PanelContent label='A' />
|
|
54
|
+
</Splitter.Panel>
|
|
55
|
+
<Splitter.Panel asChild position='lower'>
|
|
56
|
+
<PanelContent label='B' />
|
|
57
|
+
</Splitter.Panel>
|
|
58
|
+
</Splitter.Root>
|
|
59
|
+
</Panel.Content>
|
|
60
|
+
</Panel.Root>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const meta: Meta<SplitterRootProps> = {
|
|
65
|
+
title: 'ui/react-ui-core/components/Splitter',
|
|
66
|
+
component: Splitter.Root,
|
|
67
|
+
render: DefaultStory,
|
|
68
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
69
|
+
parameters: {
|
|
70
|
+
layout: 'fullscreen',
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default meta;
|
|
75
|
+
|
|
76
|
+
type Story = StoryObj<SplitterRootProps>;
|
|
77
|
+
|
|
78
|
+
export const Default: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
mode: 'both',
|
|
81
|
+
ratio: 0.5,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createContextScope } from '@radix-ui/react-context';
|
|
6
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
7
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
|
|
10
|
+
import { composableProps, slottable } from '@dxos/ui-theme';
|
|
11
|
+
|
|
12
|
+
import { useThemeContext } from '../../hooks';
|
|
13
|
+
|
|
14
|
+
type ScopedProps<P> = P & { __scopeSplitter?: any };
|
|
15
|
+
|
|
16
|
+
// TODO(burdon): Enable resize.
|
|
17
|
+
// TODO(burdon): Generalize horizontal/vertical and change to start/end.
|
|
18
|
+
type Mode = 'upper' | 'lower' | 'both';
|
|
19
|
+
|
|
20
|
+
type SplitterContextValue = {
|
|
21
|
+
mode: Mode;
|
|
22
|
+
ratio: number;
|
|
23
|
+
transition: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const SPLITTER_NAME = 'Splitter';
|
|
27
|
+
|
|
28
|
+
const [createSplitterContext, createSplitterScope] = createContextScope(SPLITTER_NAME);
|
|
29
|
+
|
|
30
|
+
const [SplitterProvider, useSplitterContext] = createSplitterContext<SplitterContextValue>(SPLITTER_NAME);
|
|
31
|
+
|
|
32
|
+
//
|
|
33
|
+
// Root
|
|
34
|
+
//
|
|
35
|
+
|
|
36
|
+
const ROOT_NAME = 'Splitter.Root';
|
|
37
|
+
|
|
38
|
+
type RootOwnProps = Partial<SplitterContextValue>;
|
|
39
|
+
|
|
40
|
+
type RootProps = RootOwnProps;
|
|
41
|
+
|
|
42
|
+
const Root = slottable<HTMLDivElement, RootOwnProps>(
|
|
43
|
+
(
|
|
44
|
+
{
|
|
45
|
+
asChild,
|
|
46
|
+
mode = 'upper',
|
|
47
|
+
ratio = 0.5,
|
|
48
|
+
transition = 250,
|
|
49
|
+
children,
|
|
50
|
+
// Extract scoped prop from the spread.
|
|
51
|
+
...props
|
|
52
|
+
},
|
|
53
|
+
forwardedRef,
|
|
54
|
+
) => {
|
|
55
|
+
const { tx } = useThemeContext();
|
|
56
|
+
const { __scopeSplitter, ...rest } = props as ScopedProps<typeof props>;
|
|
57
|
+
const { className, ...restProps } = composableProps(rest);
|
|
58
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<SplitterProvider scope={__scopeSplitter} mode={mode} ratio={ratio} transition={transition}>
|
|
62
|
+
<Comp role='none' {...restProps} ref={forwardedRef} className={tx('splitter.root', {}, className)}>
|
|
63
|
+
{children}
|
|
64
|
+
</Comp>
|
|
65
|
+
</SplitterProvider>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
Root.displayName = ROOT_NAME;
|
|
71
|
+
|
|
72
|
+
//
|
|
73
|
+
// Panel
|
|
74
|
+
//
|
|
75
|
+
|
|
76
|
+
const PANEL_NAME = 'Splitter.Panel';
|
|
77
|
+
|
|
78
|
+
type PanelOwnProps = {
|
|
79
|
+
position: 'upper' | 'lower';
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type PanelProps = PanelOwnProps;
|
|
83
|
+
|
|
84
|
+
const Panel = slottable<HTMLDivElement, PanelOwnProps>(
|
|
85
|
+
({ asChild, children, position, style, ...props }, forwardedRef) => {
|
|
86
|
+
const { tx } = useThemeContext();
|
|
87
|
+
const { __scopeSplitter, ...rest } = props as ScopedProps<typeof props>;
|
|
88
|
+
const { className, ...restProps } = composableProps(rest);
|
|
89
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
90
|
+
const { mode, ratio, transition } = useSplitterContext(PANEL_NAME, __scopeSplitter);
|
|
91
|
+
|
|
92
|
+
// Calculate position and height based on mode and ratio.
|
|
93
|
+
const isUpper = position === 'upper';
|
|
94
|
+
const top = isUpper ? '0%' : mode === 'upper' ? '100%' : mode === 'lower' ? '0%' : `${ratio * 100}%`;
|
|
95
|
+
|
|
96
|
+
const height = isUpper
|
|
97
|
+
? mode === 'upper'
|
|
98
|
+
? '100%'
|
|
99
|
+
: mode === 'lower'
|
|
100
|
+
? '0%'
|
|
101
|
+
: `${ratio * 100}%`
|
|
102
|
+
: mode === 'lower'
|
|
103
|
+
? '100%'
|
|
104
|
+
: mode === 'upper'
|
|
105
|
+
? '0%'
|
|
106
|
+
: `${(1 - ratio) * 100}%`;
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Comp
|
|
110
|
+
role='none'
|
|
111
|
+
{...restProps}
|
|
112
|
+
ref={forwardedRef}
|
|
113
|
+
className={tx('splitter.panel', {}, className)}
|
|
114
|
+
style={{
|
|
115
|
+
top,
|
|
116
|
+
height,
|
|
117
|
+
transition: `top ${transition}ms, height ${transition}ms ease-out`,
|
|
118
|
+
...style,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
{children}
|
|
122
|
+
</Comp>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
Panel.displayName = PANEL_NAME;
|
|
128
|
+
|
|
129
|
+
//
|
|
130
|
+
// Splitter
|
|
131
|
+
//
|
|
132
|
+
|
|
133
|
+
const Splitter = {
|
|
134
|
+
Root,
|
|
135
|
+
Panel,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { Splitter, createSplitterScope };
|
|
139
|
+
|
|
140
|
+
export type { Mode as SplitterMode, RootProps as SplitterRootProps, PanelProps as SplitterPanelProps };
|
|
@@ -10,30 +10,34 @@ import { withTheme } from '../../testing';
|
|
|
10
10
|
import { Status } from './Status';
|
|
11
11
|
|
|
12
12
|
const meta = {
|
|
13
|
-
title: 'ui/react-ui-core/Status',
|
|
13
|
+
title: 'ui/react-ui-core/components/Status',
|
|
14
14
|
component: Status,
|
|
15
|
-
decorators: [withTheme],
|
|
15
|
+
decorators: [withTheme()],
|
|
16
16
|
} satisfies Meta<typeof Status>;
|
|
17
17
|
|
|
18
18
|
export default meta;
|
|
19
19
|
|
|
20
20
|
type Story = StoryObj<typeof meta>;
|
|
21
21
|
|
|
22
|
-
export const Normal
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
export const Normal: Story = {
|
|
23
|
+
render: (props) => {
|
|
24
|
+
return (
|
|
25
|
+
<div className='m-5 space-b-5'>
|
|
26
|
+
<Status classNames='block' progress={0} {...props} />
|
|
27
|
+
<Status classNames='block' progress={0.3} {...props} />
|
|
28
|
+
<Status classNames='block' progress={0.7} {...props} />
|
|
29
|
+
<Status classNames='block' progress={1} {...props} />
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
},
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
export const Indeterminate
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
export const Indeterminate: Story = {
|
|
36
|
+
render: (props) => {
|
|
37
|
+
return (
|
|
38
|
+
<div className='m-5'>
|
|
39
|
+
<Status classNames='block' indeterminate {...props} />
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
39
43
|
};
|
|
@@ -4,14 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type ComponentPropsWithRef, forwardRef } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type StatusStyleProps } from '@dxos/ui-theme';
|
|
8
|
+
|
|
7
9
|
import { useThemeContext } from '../../hooks';
|
|
8
10
|
import { type ThemedClassName } from '../../util';
|
|
9
11
|
|
|
10
|
-
type StatusProps = ThemedClassName<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
12
|
+
type StatusProps = ThemedClassName<
|
|
13
|
+
ComponentPropsWithRef<'span'> &
|
|
14
|
+
StatusStyleProps & {
|
|
15
|
+
progress?: number;
|
|
16
|
+
}
|
|
17
|
+
>;
|
|
15
18
|
|
|
16
19
|
const Status = forwardRef<HTMLSpanElement, StatusProps>(
|
|
17
20
|
({ classNames, children, progress = 0, indeterminate, variant, ...props }, forwardedRef) => {
|
|
@@ -20,12 +23,12 @@ const Status = forwardRef<HTMLSpanElement, StatusProps>(
|
|
|
20
23
|
<span
|
|
21
24
|
role='status'
|
|
22
25
|
{...props}
|
|
23
|
-
className={tx('status.root',
|
|
26
|
+
className={tx('status.root', { indeterminate, variant }, classNames)}
|
|
24
27
|
ref={forwardedRef}
|
|
25
28
|
>
|
|
26
29
|
<span
|
|
27
30
|
role='none'
|
|
28
|
-
className={tx('status.bar',
|
|
31
|
+
className={tx('status.bar', { indeterminate, variant }, classNames)}
|
|
29
32
|
{...(!indeterminate && { style: { width: `${Math.round(progress * 100)}%` } })}
|
|
30
33
|
/>
|
|
31
34
|
{children}
|
|
@@ -8,17 +8,17 @@ import React from 'react';
|
|
|
8
8
|
import { hues } from '@dxos/ui-theme';
|
|
9
9
|
import { type ChromaticPalette, type MessageValence } from '@dxos/ui-types';
|
|
10
10
|
|
|
11
|
-
import { withTheme } from '../../testing';
|
|
11
|
+
import { withLayout, withTheme } from '../../testing';
|
|
12
12
|
|
|
13
13
|
import { Tag } from './Tag';
|
|
14
14
|
|
|
15
15
|
const palettes = ['neutral', 'success', 'info', 'warning', 'error', ...hues] as (ChromaticPalette | MessageValence)[];
|
|
16
16
|
|
|
17
17
|
const meta = {
|
|
18
|
-
title: 'ui/react-ui-core/Tag',
|
|
18
|
+
title: 'ui/react-ui-core/components/Tag',
|
|
19
19
|
component: Tag,
|
|
20
20
|
render: () => (
|
|
21
|
-
<div
|
|
21
|
+
<div>
|
|
22
22
|
{palettes.map((palette) => (
|
|
23
23
|
<Tag key={palette} palette={palette}>
|
|
24
24
|
{palette}
|
|
@@ -26,12 +26,7 @@ const meta = {
|
|
|
26
26
|
))}
|
|
27
27
|
</div>
|
|
28
28
|
),
|
|
29
|
-
decorators: [withTheme],
|
|
30
|
-
parameters: {
|
|
31
|
-
chromatic: {
|
|
32
|
-
disableSnapshot: false,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
29
|
+
decorators: [withTheme(), withLayout({ layout: 'default' })],
|
|
35
30
|
} satisfies Meta<typeof Tag>;
|
|
36
31
|
|
|
37
32
|
export default meta;
|
|
@@ -19,14 +19,9 @@ export type TagProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.sp
|
|
|
19
19
|
export const Tag = forwardRef<HTMLSpanElement, TagProps>(
|
|
20
20
|
({ asChild, palette = 'neutral', classNames, ...props }, forwardedRef) => {
|
|
21
21
|
const { tx } = useThemeContext();
|
|
22
|
-
const
|
|
22
|
+
const Comp = asChild ? Slot : Primitive.span;
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
{...props}
|
|
26
|
-
className={tx('tag.root', 'dx-tag', { palette }, classNames)}
|
|
27
|
-
data-hue={palette}
|
|
28
|
-
ref={forwardedRef}
|
|
29
|
-
/>
|
|
24
|
+
<Comp {...props} className={tx('tag.root', { palette }, classNames)} data-hue={palette} ref={forwardedRef} />
|
|
30
25
|
);
|
|
31
26
|
},
|
|
32
27
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { useThemeContext } from '../../hooks';
|
|
9
|
+
import { withLayout, withTheme } from '../../testing';
|
|
10
|
+
|
|
11
|
+
import { ThemeProvider } from './ThemeProvider';
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'ui/react-ui-core/components/ThemeProvider',
|
|
15
|
+
component: ThemeProvider,
|
|
16
|
+
render: () => {
|
|
17
|
+
const { themeMode, platform } = useThemeContext();
|
|
18
|
+
return (
|
|
19
|
+
<div className='p-4 flex flex-col gap-4'>
|
|
20
|
+
<h1>ThemeProvider</h1>
|
|
21
|
+
<pre className='text-sm text-description'>{JSON.stringify({ themeMode, platform }, null, 2)}</pre>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
decorators: [withTheme(), withLayout()],
|
|
26
|
+
} satisfies Meta<typeof ThemeProvider>;
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {};
|
|
@@ -20,6 +20,7 @@ export type ThemeContextValue = {
|
|
|
20
20
|
hasIosKeyboard: boolean;
|
|
21
21
|
safeAreaPadding?: SafeAreaPadding;
|
|
22
22
|
noCache?: boolean;
|
|
23
|
+
platform?: 'mobile' | 'desktop';
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -39,10 +40,11 @@ export const ThemeProvider = ({
|
|
|
39
40
|
fallback = null,
|
|
40
41
|
resourceExtensions,
|
|
41
42
|
appNs,
|
|
42
|
-
tx = (_path,
|
|
43
|
+
tx = (_path, _styleProps, ..._options) => undefined,
|
|
43
44
|
themeMode = 'dark',
|
|
44
45
|
rootDensity = 'fine',
|
|
45
|
-
|
|
46
|
+
noCache,
|
|
47
|
+
platform,
|
|
46
48
|
}: ThemeProviderProps) => {
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
if (document.defaultView) {
|
|
@@ -53,9 +55,10 @@ export const ThemeProvider = ({
|
|
|
53
55
|
}, []);
|
|
54
56
|
|
|
55
57
|
const safeAreaPadding = useSafeArea();
|
|
58
|
+
// Destructure all props explicitly so useMemo deps are stable primitives, not a new `rest` object every render.
|
|
56
59
|
const contextValue = useMemo(
|
|
57
|
-
() => ({ tx, themeMode, hasIosKeyboard: hasIosKeyboard(), safeAreaPadding,
|
|
58
|
-
[tx, themeMode, safeAreaPadding,
|
|
60
|
+
() => ({ tx, themeMode, hasIosKeyboard: hasIosKeyboard(), safeAreaPadding, noCache, platform }),
|
|
61
|
+
[tx, themeMode, safeAreaPadding, noCache, platform],
|
|
59
62
|
);
|
|
60
63
|
|
|
61
64
|
return (
|
|
@@ -77,8 +80,8 @@ export const ThemeProvider = ({
|
|
|
77
80
|
|
|
78
81
|
const handleInputModalityChange = (isUsingKeyboard: boolean) => {
|
|
79
82
|
if (isUsingKeyboard) {
|
|
80
|
-
document.body.setAttribute('data-
|
|
83
|
+
document.body.setAttribute('data-w-keyboard', 'true');
|
|
81
84
|
} else {
|
|
82
|
-
document.body.removeAttribute('data-
|
|
85
|
+
document.body.removeAttribute('data-w-keyboard');
|
|
83
86
|
}
|
|
84
87
|
};
|
|
@@ -45,10 +45,10 @@ const DefaultStory = ({ title, description, actionTriggers, openTrigger, closeTr
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
const meta = {
|
|
48
|
-
title: 'ui/react-ui-core/Toast',
|
|
48
|
+
title: 'ui/react-ui-core/components/Toast',
|
|
49
49
|
component: Toast as any,
|
|
50
50
|
render: DefaultStory,
|
|
51
|
-
decorators: [withTheme],
|
|
51
|
+
decorators: [withTheme()],
|
|
52
52
|
} satisfies Meta<typeof DefaultStory>;
|
|
53
53
|
|
|
54
54
|
export default meta;
|
|
@@ -4,49 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import
|
|
8
|
-
ToastAction as ToastActionPrimitive,
|
|
9
|
-
type ToastActionProps as ToastActionPrimitiveProps,
|
|
10
|
-
ToastClose as ToastClosePrimitive,
|
|
11
|
-
type ToastCloseProps as ToastClosePrimitiveProps,
|
|
12
|
-
ToastDescription as ToastDescriptionPrimitive,
|
|
13
|
-
type ToastDescriptionProps as ToastDescriptionPrimitiveProps,
|
|
14
|
-
ToastProvider as ToastProviderPrimitive,
|
|
15
|
-
type ToastProviderProps as ToastProviderPrimitiveProps,
|
|
16
|
-
Root as ToastRootPrimitive,
|
|
17
|
-
type ToastProps as ToastRootPrimitiveProps,
|
|
18
|
-
ToastTitle as ToastTitlePrimitive,
|
|
19
|
-
type ToastTitleProps as ToastTitlePrimitiveProps,
|
|
20
|
-
ToastViewport as ToastViewportPrimitive,
|
|
21
|
-
type ToastViewportProps as ToastViewportPrimitiveProps,
|
|
22
|
-
} from '@radix-ui/react-toast';
|
|
7
|
+
import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
23
8
|
import React, { type ComponentPropsWithRef, type FunctionComponent, forwardRef } from 'react';
|
|
24
9
|
|
|
25
10
|
import { useThemeContext } from '../../hooks';
|
|
26
11
|
import { type ThemedClassName } from '../../util';
|
|
27
12
|
import { ElevationProvider } from '../ElevationProvider';
|
|
28
13
|
|
|
29
|
-
type ToastProviderProps =
|
|
14
|
+
type ToastProviderProps = ToastPrimitive.ToastProviderProps;
|
|
30
15
|
|
|
31
|
-
const ToastProvider: FunctionComponent<ToastProviderProps> =
|
|
16
|
+
const ToastProvider: FunctionComponent<ToastProviderProps> = ToastPrimitive.Provider;
|
|
32
17
|
|
|
33
|
-
type ToastViewportProps = ThemedClassName<
|
|
18
|
+
type ToastViewportProps = ThemedClassName<ToastPrimitive.ToastViewportProps>;
|
|
34
19
|
|
|
35
20
|
const ToastViewport = forwardRef<HTMLOListElement, ToastViewportProps>(({ classNames, ...props }, forwardedRef) => {
|
|
36
21
|
const { tx } = useThemeContext();
|
|
37
|
-
return (
|
|
38
|
-
<ToastViewportPrimitive className={tx('toast.viewport', 'toast-viewport', {}, classNames)} ref={forwardedRef} />
|
|
39
|
-
);
|
|
22
|
+
return <ToastPrimitive.Viewport {...props} className={tx('toast.viewport', {}, classNames)} ref={forwardedRef} />;
|
|
40
23
|
});
|
|
41
24
|
|
|
42
|
-
type ToastRootProps = ThemedClassName<
|
|
25
|
+
type ToastRootProps = ThemedClassName<ToastPrimitive.ToastProps>;
|
|
43
26
|
|
|
44
27
|
const ToastRoot = forwardRef<HTMLLIElement, ToastRootProps>(({ classNames, children, ...props }, forwardedRef) => {
|
|
45
28
|
const { tx } = useThemeContext();
|
|
46
29
|
return (
|
|
47
|
-
<
|
|
30
|
+
<ToastPrimitive.Root {...props} className={tx('toast.root', {}, classNames)} ref={forwardedRef}>
|
|
48
31
|
<ElevationProvider elevation='toast'>{children}</ElevationProvider>
|
|
49
|
-
</
|
|
32
|
+
</ToastPrimitive.Root>
|
|
50
33
|
);
|
|
51
34
|
});
|
|
52
35
|
|
|
@@ -54,29 +37,27 @@ type ToastBodyProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.div
|
|
|
54
37
|
|
|
55
38
|
const ToastBody = forwardRef<HTMLDivElement, ToastBodyProps>(({ asChild, classNames, ...props }, forwardedRef) => {
|
|
56
39
|
const { tx } = useThemeContext();
|
|
57
|
-
const
|
|
58
|
-
return <
|
|
40
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
41
|
+
return <Comp {...props} className={tx('toast.body', {}, classNames)} ref={forwardedRef} />;
|
|
59
42
|
});
|
|
60
43
|
|
|
61
|
-
type ToastTitleProps = ThemedClassName<
|
|
44
|
+
type ToastTitleProps = ThemedClassName<ToastPrimitive.ToastTitleProps>;
|
|
62
45
|
|
|
63
46
|
const ToastTitle = forwardRef<HTMLHeadingElement, ToastTitleProps>(
|
|
64
47
|
({ asChild, classNames, ...props }, forwardedRef) => {
|
|
65
48
|
const { tx } = useThemeContext();
|
|
66
|
-
const
|
|
67
|
-
return <
|
|
49
|
+
const Comp = asChild ? Slot : ToastPrimitive.Title;
|
|
50
|
+
return <Comp {...props} className={tx('toast.title', {}, classNames)} ref={forwardedRef} />;
|
|
68
51
|
},
|
|
69
52
|
);
|
|
70
53
|
|
|
71
|
-
type ToastDescriptionProps = ThemedClassName<
|
|
54
|
+
type ToastDescriptionProps = ThemedClassName<ToastPrimitive.ToastDescriptionProps>;
|
|
72
55
|
|
|
73
56
|
const ToastDescription = forwardRef<HTMLParagraphElement, ToastDescriptionProps>(
|
|
74
57
|
({ asChild, classNames, ...props }, forwardedRef) => {
|
|
75
58
|
const { tx } = useThemeContext();
|
|
76
|
-
const
|
|
77
|
-
return (
|
|
78
|
-
<Root {...props} className={tx('toast.description', 'toast__description', {}, classNames)} ref={forwardedRef} />
|
|
79
|
-
);
|
|
59
|
+
const Comp = asChild ? Slot : ToastPrimitive.Description;
|
|
60
|
+
return <Comp {...props} className={tx('toast.description', {}, classNames)} ref={forwardedRef} />;
|
|
80
61
|
},
|
|
81
62
|
);
|
|
82
63
|
|
|
@@ -85,18 +66,18 @@ type ToastActionsProps = ThemedClassName<ComponentPropsWithRef<typeof Primitive.
|
|
|
85
66
|
const ToastActions = forwardRef<HTMLDivElement, ToastActionsProps>(
|
|
86
67
|
({ asChild, classNames, ...props }, forwardedRef) => {
|
|
87
68
|
const { tx } = useThemeContext();
|
|
88
|
-
const
|
|
89
|
-
return <
|
|
69
|
+
const Comp = asChild ? Slot : Primitive.div;
|
|
70
|
+
return <Comp {...props} className={tx('toast.actions', {}, classNames)} ref={forwardedRef} />;
|
|
90
71
|
},
|
|
91
72
|
);
|
|
92
73
|
|
|
93
|
-
type ToastActionProps =
|
|
74
|
+
type ToastActionProps = ToastPrimitive.ToastActionProps;
|
|
94
75
|
|
|
95
|
-
const ToastAction: FunctionComponent<ToastActionProps> =
|
|
76
|
+
const ToastAction: FunctionComponent<ToastActionProps> = ToastPrimitive.Action;
|
|
96
77
|
|
|
97
|
-
type ToastCloseProps =
|
|
78
|
+
type ToastCloseProps = ToastPrimitive.ToastCloseProps;
|
|
98
79
|
|
|
99
|
-
const ToastClose: FunctionComponent<ToastCloseProps> =
|
|
80
|
+
const ToastClose: FunctionComponent<ToastCloseProps> = ToastPrimitive.Close;
|
|
100
81
|
|
|
101
82
|
export const Toast = {
|
|
102
83
|
Provider: ToastProvider,
|
|
@@ -69,10 +69,10 @@ const DefaultStory = (props: StorybookToolbarProps) => {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
const meta = {
|
|
72
|
-
title: 'ui/react-ui-core/Toolbar',
|
|
72
|
+
title: 'ui/react-ui-core/components/Toolbar',
|
|
73
73
|
component: Toolbar as any,
|
|
74
74
|
render: DefaultStory,
|
|
75
|
-
decorators: [withTheme],
|
|
75
|
+
decorators: [withTheme()],
|
|
76
76
|
} satisfies Meta<typeof DefaultStory>;
|
|
77
77
|
|
|
78
78
|
export default meta;
|