@dxos/react-ui 0.8.4-main.e8ec1fe → 0.8.4-main.ef1bc66f44
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-EJYV4HAH.mjs +774 -0
- package/dist/lib/browser/chunk-EJYV4HAH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3197 -66
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +34 -45
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-YTLZCZ2M.mjs +776 -0
- package/dist/lib/node-esm/chunk-YTLZCZ2M.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +3197 -66
- 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 +34 -45
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts +7 -0
- package/dist/types/src/components/AnchoredOverflow/AnchoredOverflow.d.ts.map +1 -1
- package/dist/types/src/components/Button/Button.d.ts +1 -1
- package/dist/types/src/components/Button/Button.d.ts.map +1 -1
- package/dist/types/src/components/Button/IconButton.d.ts +2 -1
- package/dist/types/src/components/Button/IconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/ToggleGroup.d.ts +4 -4
- package/dist/types/src/components/Button/ToggleGroup.stories.d.ts +4 -4
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts +1 -1
- package/dist/types/src/components/DensityProvider/DensityProvider.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +24 -9
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +7 -5
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts +1 -1
- package/dist/types/src/components/ElevationProvider/ElevationProvider.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +5 -2
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +2 -2
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.d.ts +1 -1
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +8 -9
- 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/{Menus → Menu}/ContextMenu.d.ts +6 -6
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/ContextMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/{Menus → Menu}/DropdownMenu.d.ts +3 -4
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/Menu/DropdownMenu.stories.d.ts.map +1 -0
- package/dist/types/src/components/Menu/index.d.ts.map +1 -0
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +25 -26
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +46 -8
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +4 -2
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +2 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts +9 -9
- package/dist/types/src/components/Separator/Separator.d.ts +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 +26 -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/Tag/Tag.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +2 -2
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts +1 -8
- package/dist/types/src/components/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts +2 -1
- package/dist/types/src/components/ThemeProvider/index.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +4 -4
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +13 -12
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +3 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/exemplars/generics.stories.d.ts +17 -0
- package/dist/types/src/exemplars/generics.stories.d.ts.map +1 -0
- package/dist/types/src/exemplars/slot.stories.d.ts +14 -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/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 +1 -1
- package/dist/types/src/hooks/useElevationContext.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/primitives/Container/Container.d.ts +23 -0
- package/dist/types/src/primitives/Container/Container.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts +11 -0
- package/dist/types/src/primitives/Container/Container.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Layout.d.ts +18 -0
- package/dist/types/src/primitives/Container/Layout.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/Layout.stories.d.ts +10 -0
- package/dist/types/src/primitives/Container/Layout.stories.d.ts.map +1 -0
- package/dist/types/src/primitives/Container/index.d.ts +3 -0
- package/dist/types/src/primitives/Container/index.d.ts.map +1 -0
- package/dist/types/src/primitives/Flex/Flex.d.ts +8 -0
- package/dist/types/src/primitives/Flex/Flex.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/index.d.ts +3 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withLayout.d.ts +3 -3
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayoutVariants.d.ts +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/util/index.d.ts +1 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -32
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +8 -0
- package/src/components/Avatars/Avatar.stories.tsx +4 -4
- package/src/components/Avatars/Avatar.tsx +1 -1
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -2
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -2
- package/src/components/Button/Button.stories.tsx +2 -2
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Button/IconButton.stories.tsx +2 -2
- package/src/components/Button/IconButton.tsx +8 -3
- package/src/components/Button/Toggle.stories.tsx +2 -2
- package/src/components/Button/ToggleGroup.stories.tsx +2 -2
- package/src/components/Clipboard/CopyButton.tsx +3 -3
- package/src/components/DensityProvider/DensityProvider.tsx +1 -1
- package/src/components/Dialog/AlertDialog.stories.tsx +2 -2
- package/src/components/Dialog/Dialog.stories.tsx +57 -23
- package/src/components/Dialog/Dialog.tsx +181 -40
- package/src/components/ElevationProvider/ElevationProvider.tsx +1 -1
- package/src/components/Icon/Icon.stories.tsx +3 -3
- package/src/components/Icon/Icon.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +12 -11
- package/src/components/Input/Input.tsx +13 -5
- package/src/components/Link/Link.stories.tsx +2 -2
- package/src/components/List/List.stories.tsx +18 -14
- package/src/components/List/List.tsx +1 -1
- package/src/components/List/Tree.stories.tsx +2 -2
- package/src/components/List/Treegrid.stories.tsx +2 -2
- package/src/components/List/Treegrid.tsx +1 -1
- package/src/components/Main/Main.stories.tsx +41 -20
- package/src/components/Main/Main.tsx +92 -45
- package/src/components/{Menus → Menu}/ContextMenu.stories.tsx +2 -2
- package/src/components/{Menus → Menu}/DropdownMenu.stories.tsx +2 -2
- package/src/components/{Menus → Menu}/DropdownMenu.tsx +61 -57
- package/src/components/Message/Message.stories.tsx +3 -3
- package/src/components/Message/Message.tsx +30 -5
- package/src/components/Popover/Popover.stories.tsx +2 -2
- package/src/components/Popover/Popover.tsx +35 -33
- package/src/components/ScrollArea/ScrollArea.stories.tsx +166 -40
- package/src/components/ScrollArea/ScrollArea.tsx +86 -80
- package/src/components/ScrollArea/index.ts +1 -1
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +3 -2
- package/src/components/ScrollContainer/ScrollContainer.tsx +99 -92
- package/src/components/Select/Select.stories.tsx +2 -2
- 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 +73 -0
- package/src/components/Splitter/Splitter.tsx +123 -0
- package/src/components/Splitter/index.ts +5 -0
- package/src/components/Status/Status.stories.tsx +2 -2
- package/src/components/Tag/Tag.stories.tsx +4 -4
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/ThemeProvider/ThemeProvider.tsx +2 -3
- package/src/components/ThemeProvider/TranslationsProvider.tsx +1 -16
- package/src/components/ThemeProvider/index.ts +3 -3
- package/src/components/Toast/Toast.stories.tsx +2 -2
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -2
- package/src/components/Toolbar/Toolbar.tsx +31 -12
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +22 -20
- package/src/components/index.ts +3 -1
- package/src/exemplars/generics.stories.tsx +44 -0
- package/src/exemplars/slot.stories.tsx +108 -0
- package/src/exemplars/tabster.stories.tsx +127 -0
- package/src/hooks/useDensityContext.ts +1 -1
- package/src/hooks/useElevationContext.ts +1 -1
- package/src/index.ts +2 -1
- package/src/playground/Controls.stories.tsx +3 -4
- package/src/playground/Custom.stories.tsx +2 -2
- package/src/playground/Typography.stories.tsx +2 -2
- package/src/primitives/Container/Container.stories.tsx +67 -0
- package/src/primitives/Container/Container.tsx +82 -0
- package/src/primitives/Container/Layout.stories.tsx +57 -0
- package/src/primitives/Container/Layout.tsx +61 -0
- package/src/primitives/Container/index.ts +6 -0
- package/src/primitives/Flex/Flex.tsx +26 -0
- package/src/primitives/Flex/index.ts +5 -0
- package/src/primitives/index.ts +6 -0
- package/src/testing/decorators/withLayout.tsx +22 -15
- package/src/testing/decorators/withLayoutVariants.tsx +3 -3
- package/src/testing/decorators/withTheme.tsx +21 -18
- package/src/util/index.ts +2 -2
- package/dist/lib/browser/chunk-53MI2QCM.mjs +0 -4707
- package/dist/lib/browser/chunk-53MI2QCM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ID67AFFF.mjs +0 -4709
- package/dist/lib/node-esm/chunk-ID67AFFF.mjs.map +0 -7
- package/dist/types/src/components/Menus/ContextMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +0 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +0 -1
- package/dist/types/src/components/Menus/index.d.ts.map +0 -1
- package/dist/types/src/util/ThemedClassName.d.ts +0 -5
- package/dist/types/src/util/ThemedClassName.d.ts.map +0 -1
- package/dist/types/src/util/domino.d.ts +0 -18
- package/dist/types/src/util/domino.d.ts.map +0 -1
- package/src/util/ThemedClassName.ts +0 -7
- package/src/util/domino.ts +0 -53
- /package/dist/types/src/components/{Menus → Menu}/ContextMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/DropdownMenu.stories.d.ts +0 -0
- /package/dist/types/src/components/{Menus → Menu}/index.d.ts +0 -0
- /package/src/components/{Menus → Menu}/ContextMenu.tsx +0 -0
- /package/src/components/{Menus → Menu}/index.ts +0 -0
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
DialogClose as DialogClosePrimitive,
|
|
8
8
|
type DialogCloseProps as DialogClosePrimitiveProps,
|
|
9
9
|
DialogContent as DialogContentPrimitive,
|
|
10
|
-
type DialogContentProps as DialogContentPrimitiveProps,
|
|
11
10
|
DialogDescription as DialogDescriptionPrimitive,
|
|
12
11
|
type DialogDescriptionProps as DialogDescriptionPrimitiveProps,
|
|
13
12
|
DialogOverlay as DialogOverlayPrimitive,
|
|
@@ -21,12 +20,26 @@ import {
|
|
|
21
20
|
DialogTrigger as DialogTriggerPrimitive,
|
|
22
21
|
type DialogTriggerProps as DialogTriggerPrimitiveProps,
|
|
23
22
|
} from '@radix-ui/react-dialog';
|
|
24
|
-
import React, {
|
|
23
|
+
import React, {
|
|
24
|
+
type ComponentPropsWithRef,
|
|
25
|
+
type ForwardRefExoticComponent,
|
|
26
|
+
type FunctionComponent,
|
|
27
|
+
type PropsWithChildren,
|
|
28
|
+
forwardRef,
|
|
29
|
+
} from 'react';
|
|
30
|
+
import { useTranslation } from 'react-i18next';
|
|
31
|
+
|
|
32
|
+
import { type DialogSize, osTranslations } from '@dxos/ui-theme';
|
|
25
33
|
|
|
26
34
|
import { useThemeContext } from '../../hooks';
|
|
27
35
|
import { type ThemedClassName } from '../../util';
|
|
36
|
+
import { IconButton, type IconButtonProps } from '../Button';
|
|
28
37
|
import { ElevationProvider } from '../ElevationProvider';
|
|
29
38
|
|
|
39
|
+
//
|
|
40
|
+
// Root
|
|
41
|
+
//
|
|
42
|
+
|
|
30
43
|
type DialogRootProps = DialogRootPrimitiveProps;
|
|
31
44
|
|
|
32
45
|
const DialogRoot: FunctionComponent<DialogRootProps> = (props) => (
|
|
@@ -35,52 +48,30 @@ const DialogRoot: FunctionComponent<DialogRootProps> = (props) => (
|
|
|
35
48
|
</ElevationProvider>
|
|
36
49
|
);
|
|
37
50
|
|
|
51
|
+
//
|
|
52
|
+
// Trigger
|
|
53
|
+
//
|
|
54
|
+
|
|
38
55
|
type DialogTriggerProps = DialogTriggerPrimitiveProps;
|
|
39
56
|
|
|
40
57
|
const DialogTrigger: FunctionComponent<DialogTriggerProps> = DialogTriggerPrimitive;
|
|
41
58
|
|
|
59
|
+
//
|
|
60
|
+
// Portal
|
|
61
|
+
//
|
|
62
|
+
|
|
42
63
|
type DialogPortalProps = DialogPortalPrimitiveProps;
|
|
43
64
|
|
|
44
65
|
const DialogPortal: FunctionComponent<DialogPortalProps> = DialogPortalPrimitive;
|
|
45
66
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
50
|
-
const { tx } = useThemeContext();
|
|
51
|
-
return (
|
|
52
|
-
<DialogTitlePrimitive
|
|
53
|
-
{...props}
|
|
54
|
-
className={tx('dialog.title', 'dialog__title', { srOnly }, classNames)}
|
|
55
|
-
ref={forwardedRef}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
},
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
type DialogDescriptionProps = ThemedClassName<DialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
62
|
-
|
|
63
|
-
const DialogDescription: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<
|
|
64
|
-
HTMLParagraphElement,
|
|
65
|
-
DialogDescriptionProps
|
|
66
|
-
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
67
|
-
const { tx } = useThemeContext();
|
|
68
|
-
return (
|
|
69
|
-
<DialogDescriptionPrimitive
|
|
70
|
-
{...props}
|
|
71
|
-
className={tx('dialog.description', 'dialog__description', { srOnly }, classNames)}
|
|
72
|
-
ref={forwardedRef}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
type DialogCloseProps = DialogClosePrimitiveProps;
|
|
67
|
+
//
|
|
68
|
+
// Overlay
|
|
69
|
+
//
|
|
78
70
|
|
|
79
|
-
const
|
|
71
|
+
const DIALOG_OVERLAY_NAME = 'DialogOverlay';
|
|
80
72
|
|
|
81
73
|
type OverlayLayoutContextValue = { inOverlayLayout?: boolean };
|
|
82
|
-
|
|
83
|
-
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
74
|
+
|
|
84
75
|
const [OverlayLayoutProvider, useOverlayLayoutContext] = createContext<OverlayLayoutContextValue>(
|
|
85
76
|
DIALOG_OVERLAY_NAME,
|
|
86
77
|
{},
|
|
@@ -107,10 +98,19 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
|
|
|
107
98
|
|
|
108
99
|
DialogOverlay.displayName = DIALOG_OVERLAY_NAME;
|
|
109
100
|
|
|
110
|
-
|
|
101
|
+
//
|
|
102
|
+
// Content
|
|
103
|
+
//
|
|
104
|
+
|
|
105
|
+
const DIALOG_CONTENT_NAME = 'DialogContent';
|
|
106
|
+
|
|
107
|
+
type DialogContentProps = ThemedClassName<ComponentPropsWithRef<typeof DialogContentPrimitive>> & {
|
|
108
|
+
size?: DialogSize;
|
|
109
|
+
inOverlayLayout?: boolean;
|
|
110
|
+
};
|
|
111
111
|
|
|
112
112
|
const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
113
|
-
({ classNames, children, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
113
|
+
({ classNames, children, size, inOverlayLayout: propsInOverlayLayout, ...props }, forwardedRef) => {
|
|
114
114
|
const { tx } = useThemeContext();
|
|
115
115
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
116
116
|
|
|
@@ -123,7 +123,7 @@ const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<
|
|
|
123
123
|
className={tx(
|
|
124
124
|
'dialog.content',
|
|
125
125
|
'dialog',
|
|
126
|
-
{ inOverlayLayout: propsInOverlayLayout || inOverlayLayout },
|
|
126
|
+
{ inOverlayLayout: propsInOverlayLayout || inOverlayLayout, size },
|
|
127
127
|
classNames,
|
|
128
128
|
)}
|
|
129
129
|
ref={forwardedRef}
|
|
@@ -136,15 +136,152 @@ const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<
|
|
|
136
136
|
|
|
137
137
|
DialogContent.displayName = DIALOG_CONTENT_NAME;
|
|
138
138
|
|
|
139
|
+
//
|
|
140
|
+
// Header
|
|
141
|
+
//
|
|
142
|
+
|
|
143
|
+
type DialogHeaderProps = ThemedClassName<PropsWithChildren> & { srOnly?: boolean };
|
|
144
|
+
|
|
145
|
+
const DialogHeader: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
146
|
+
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
147
|
+
const { tx } = useThemeContext();
|
|
148
|
+
return (
|
|
149
|
+
<div
|
|
150
|
+
{...props}
|
|
151
|
+
role='header'
|
|
152
|
+
className={tx('dialog.header', 'dialog__header', { srOnly }, classNames)}
|
|
153
|
+
ref={forwardedRef}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
//
|
|
160
|
+
// Body
|
|
161
|
+
//
|
|
162
|
+
|
|
163
|
+
type DialogBodyProps = PropsWithChildren;
|
|
164
|
+
|
|
165
|
+
const DialogBody: ForwardRefExoticComponent<DialogBodyProps> = forwardRef<HTMLDivElement, DialogBodyProps>(
|
|
166
|
+
({ children, ...props }, forwardedRef) => {
|
|
167
|
+
const { tx } = useThemeContext();
|
|
168
|
+
return (
|
|
169
|
+
<div {...props} className={tx('dialog.body', 'dialog__body')} ref={forwardedRef}>
|
|
170
|
+
{children}
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
},
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// TODO(burdon): Add ActionBar.
|
|
177
|
+
|
|
178
|
+
//
|
|
179
|
+
// Title
|
|
180
|
+
//
|
|
181
|
+
|
|
182
|
+
type DialogTitleProps = ThemedClassName<DialogTitlePrimitiveProps> & { srOnly?: boolean };
|
|
183
|
+
|
|
184
|
+
const DialogTitle: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
185
|
+
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
186
|
+
const { tx } = useThemeContext();
|
|
187
|
+
return (
|
|
188
|
+
<DialogTitlePrimitive
|
|
189
|
+
{...props}
|
|
190
|
+
className={tx('dialog.title', 'dialog__title', { srOnly }, classNames)}
|
|
191
|
+
ref={forwardedRef}
|
|
192
|
+
/>
|
|
193
|
+
);
|
|
194
|
+
},
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
//
|
|
198
|
+
// Description
|
|
199
|
+
//
|
|
200
|
+
|
|
201
|
+
type DialogDescriptionProps = ThemedClassName<DialogDescriptionPrimitiveProps> & { srOnly?: boolean };
|
|
202
|
+
|
|
203
|
+
const DialogDescription: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<
|
|
204
|
+
HTMLParagraphElement,
|
|
205
|
+
DialogDescriptionProps
|
|
206
|
+
>(({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
207
|
+
const { tx } = useThemeContext();
|
|
208
|
+
return (
|
|
209
|
+
<DialogDescriptionPrimitive
|
|
210
|
+
{...props}
|
|
211
|
+
className={tx('dialog.description', 'dialog__description', { srOnly }, classNames)}
|
|
212
|
+
ref={forwardedRef}
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
//
|
|
218
|
+
// ActionBar
|
|
219
|
+
//
|
|
220
|
+
|
|
221
|
+
type DialogActionBarProps = ThemedClassName<PropsWithChildren>;
|
|
222
|
+
|
|
223
|
+
const DialogActionBar: ForwardRefExoticComponent<DialogActionBarProps> = forwardRef<
|
|
224
|
+
HTMLDivElement,
|
|
225
|
+
DialogActionBarProps
|
|
226
|
+
>(({ children, classNames, ...props }, forwardedRef) => {
|
|
227
|
+
const { tx } = useThemeContext();
|
|
228
|
+
return (
|
|
229
|
+
<div {...props} className={tx('dialog.actionbar', 'dialog__actionbar', {}, classNames)} ref={forwardedRef}>
|
|
230
|
+
{children}
|
|
231
|
+
</div>
|
|
232
|
+
);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
//
|
|
236
|
+
// Close
|
|
237
|
+
//
|
|
238
|
+
|
|
239
|
+
type DialogCloseProps = DialogClosePrimitiveProps;
|
|
240
|
+
|
|
241
|
+
const DialogClose: FunctionComponent<DialogCloseProps> = DialogClosePrimitive;
|
|
242
|
+
|
|
243
|
+
//
|
|
244
|
+
// Close Button
|
|
245
|
+
//
|
|
246
|
+
|
|
247
|
+
type DialogCloseIconButtonProps = ThemedClassName<Partial<IconButtonProps>>;
|
|
248
|
+
|
|
249
|
+
const DialogCloseIconButton: ForwardRefExoticComponent<DialogCloseIconButtonProps> = forwardRef<
|
|
250
|
+
HTMLButtonElement,
|
|
251
|
+
DialogCloseIconButtonProps
|
|
252
|
+
>((props, forwardedRef) => {
|
|
253
|
+
const { t } = useTranslation(osTranslations);
|
|
254
|
+
return (
|
|
255
|
+
<IconButton
|
|
256
|
+
{...props}
|
|
257
|
+
label={props.label ?? t('close dialog label')}
|
|
258
|
+
icon='ph--x--regular'
|
|
259
|
+
iconOnly
|
|
260
|
+
size={4}
|
|
261
|
+
density='fine'
|
|
262
|
+
variant='ghost'
|
|
263
|
+
ref={forwardedRef}
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
//
|
|
269
|
+
// Dialog
|
|
270
|
+
//
|
|
271
|
+
|
|
139
272
|
export const Dialog = {
|
|
140
273
|
Root: DialogRoot,
|
|
141
274
|
Trigger: DialogTrigger,
|
|
142
275
|
Portal: DialogPortal,
|
|
143
276
|
Overlay: DialogOverlay,
|
|
144
277
|
Content: DialogContent,
|
|
278
|
+
Header: DialogHeader,
|
|
279
|
+
Body: DialogBody,
|
|
145
280
|
Title: DialogTitle,
|
|
146
281
|
Description: DialogDescription,
|
|
282
|
+
ActionBar: DialogActionBar,
|
|
147
283
|
Close: DialogClose,
|
|
284
|
+
CloseIconButton: DialogCloseIconButton,
|
|
148
285
|
};
|
|
149
286
|
|
|
150
287
|
export type {
|
|
@@ -153,7 +290,11 @@ export type {
|
|
|
153
290
|
DialogPortalProps,
|
|
154
291
|
DialogOverlayProps,
|
|
155
292
|
DialogContentProps,
|
|
293
|
+
DialogHeaderProps,
|
|
294
|
+
DialogBodyProps,
|
|
156
295
|
DialogTitleProps,
|
|
157
296
|
DialogDescriptionProps,
|
|
297
|
+
DialogActionBarProps,
|
|
158
298
|
DialogCloseProps,
|
|
299
|
+
DialogCloseIconButtonProps,
|
|
159
300
|
};
|
|
@@ -6,7 +6,7 @@ import { IconBase, type IconProps, type IconWeight } from '@phosphor-icons/react
|
|
|
6
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
7
|
import React, { type FC, type ReactElement, type SVGProps, forwardRef } from 'react';
|
|
8
8
|
|
|
9
|
-
import { getSize, mx } from '@dxos/
|
|
9
|
+
import { getSize, mx } from '@dxos/ui-theme';
|
|
10
10
|
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
@@ -60,9 +60,9 @@ const DefaultStory = ({ CustomIcon }: { CustomIcon: FC<IconProps> }) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
const meta = {
|
|
63
|
-
title: 'ui/react-ui-core/Icon',
|
|
63
|
+
title: 'ui/react-ui-core/components/Icon',
|
|
64
64
|
render: DefaultStory,
|
|
65
|
-
decorators: [withTheme],
|
|
65
|
+
decorators: [withTheme()],
|
|
66
66
|
parameters: {
|
|
67
67
|
layout: 'centered',
|
|
68
68
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Primitive } from '@radix-ui/react-primitive';
|
|
6
6
|
import React, { type ComponentPropsWithRef, forwardRef, memo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type Size } from '@dxos/
|
|
8
|
+
import { type Size } from '@dxos/ui-types';
|
|
9
9
|
|
|
10
10
|
import { useIconHref, useThemeContext } from '../../hooks';
|
|
11
11
|
import { type ThemedClassName } from '../../util';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { type MessageValence } from '@dxos/
|
|
8
|
+
import { mx, surfaceShadow } from '@dxos/ui-theme';
|
|
9
|
+
import { type MessageValence } from '@dxos/ui-types';
|
|
10
10
|
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
12
12
|
|
|
@@ -39,7 +39,7 @@ type BaseProps = Partial<{
|
|
|
39
39
|
validationMessage: string;
|
|
40
40
|
}>;
|
|
41
41
|
|
|
42
|
-
const
|
|
42
|
+
const InputWrapper = ({
|
|
43
43
|
kind,
|
|
44
44
|
label,
|
|
45
45
|
description,
|
|
@@ -74,31 +74,31 @@ const Wrapper = ({
|
|
|
74
74
|
const DefaultStory = (props: BaseProps) => {
|
|
75
75
|
return (
|
|
76
76
|
<div className='space-b-4'>
|
|
77
|
-
<div className={mx(baseSurface, 'p-4 rounded-md')}>
|
|
78
|
-
<
|
|
77
|
+
<div className={mx('bg-baseSurface', 'p-4 rounded-md')}>
|
|
78
|
+
<InputWrapper {...props} />
|
|
79
79
|
</div>
|
|
80
80
|
<div className={mx('bg-cardSurface', 'p-4 rounded-md', surfaceShadow({ elevation: 'positioned' }))}>
|
|
81
|
-
<
|
|
81
|
+
<InputWrapper {...props} />
|
|
82
82
|
</div>
|
|
83
|
-
<div className={mx(modalSurface, 'p-4 rounded-md', surfaceShadow({ elevation: 'dialog' }))}>
|
|
84
|
-
<
|
|
83
|
+
<div className={mx('bg-modalSurface', 'p-4 rounded-md', surfaceShadow({ elevation: 'dialog' }))}>
|
|
84
|
+
<InputWrapper {...props} />
|
|
85
85
|
</div>
|
|
86
86
|
</div>
|
|
87
87
|
);
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
const meta = {
|
|
91
|
-
title: 'ui/react-ui-core/Input',
|
|
91
|
+
title: 'ui/react-ui-core/components/Input',
|
|
92
92
|
component: Input.Root as any,
|
|
93
93
|
render: DefaultStory,
|
|
94
|
-
decorators: [withTheme],
|
|
94
|
+
decorators: [withTheme()],
|
|
95
95
|
} satisfies Meta<typeof DefaultStory>;
|
|
96
96
|
|
|
97
97
|
export default meta;
|
|
98
98
|
|
|
99
99
|
type Story = StoryObj<BaseProps & Variant>;
|
|
100
100
|
|
|
101
|
-
export const
|
|
101
|
+
export const DensityCoarse: Story = {
|
|
102
102
|
args: {
|
|
103
103
|
kind: 'text',
|
|
104
104
|
label: 'Hello',
|
|
@@ -109,6 +109,7 @@ export const Default: Story = {
|
|
|
109
109
|
descriptionVisuallyHidden: false,
|
|
110
110
|
validationMessage: '',
|
|
111
111
|
validationValence: undefined,
|
|
112
|
+
density: 'coarse',
|
|
112
113
|
},
|
|
113
114
|
};
|
|
114
115
|
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
type ValidationProps as ValidationPrimitiveProps,
|
|
28
28
|
useInputContext,
|
|
29
29
|
} from '@dxos/react-input';
|
|
30
|
-
import { mx } from '@dxos/
|
|
31
|
-
import { type ClassNameValue, type Density, type Elevation, type Size } from '@dxos/
|
|
30
|
+
import { mx } from '@dxos/ui-theme';
|
|
31
|
+
import { type ClassNameValue, 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';
|
|
@@ -119,7 +119,6 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
119
119
|
elevation: propsElevation,
|
|
120
120
|
segmentClassName: propsSegmentClassName,
|
|
121
121
|
inputClassName,
|
|
122
|
-
variant,
|
|
123
122
|
...props
|
|
124
123
|
},
|
|
125
124
|
forwardedRef,
|
|
@@ -162,10 +161,17 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
162
161
|
|
|
163
162
|
// TODO(burdon): Implement inline icon within button: e.g., https://www.radix-ui.com/themes/playground#text-field
|
|
164
163
|
|
|
165
|
-
type
|
|
164
|
+
type AutoFillProps = {
|
|
165
|
+
noAutoFill?: boolean;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
type TextInputProps = InputSharedProps & ThemedClassName<TextInputPrimitiveProps> & AutoFillProps;
|
|
166
169
|
|
|
167
170
|
const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>(
|
|
168
|
-
(
|
|
171
|
+
(
|
|
172
|
+
{ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, noAutoFill, ...props },
|
|
173
|
+
forwardedRef,
|
|
174
|
+
) => {
|
|
169
175
|
const { hasIosKeyboard } = useThemeContext();
|
|
170
176
|
const themeContextValue = useThemeContext();
|
|
171
177
|
const density = useDensityContext(propsDensity);
|
|
@@ -177,6 +183,8 @@ const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>
|
|
|
177
183
|
return (
|
|
178
184
|
<TextInputPrimitive
|
|
179
185
|
{...props}
|
|
186
|
+
// TODO(wittjosiah): Factor out autofill properies.
|
|
187
|
+
{...{ 'data-1p-ignore': noAutoFill }}
|
|
180
188
|
className={tx(
|
|
181
189
|
'input.input',
|
|
182
190
|
'input',
|
|
@@ -9,9 +9,9 @@ import { withTheme } from '../../testing';
|
|
|
9
9
|
import { Link } from './Link';
|
|
10
10
|
|
|
11
11
|
const meta = {
|
|
12
|
-
title: 'ui/react-ui-core/Link',
|
|
12
|
+
title: 'ui/react-ui-core/components/Link',
|
|
13
13
|
component: Link,
|
|
14
|
-
decorators: [withTheme],
|
|
14
|
+
decorators: [withTheme()],
|
|
15
15
|
} satisfies Meta<typeof Link>;
|
|
16
16
|
|
|
17
17
|
export default meta;
|
|
@@ -7,7 +7,7 @@ import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy }
|
|
|
7
7
|
import { CSS } from '@dnd-kit/utilities';
|
|
8
8
|
import { useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
9
9
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
10
|
-
import React, { type ReactNode, useState } from 'react';
|
|
10
|
+
import React, { type ReactNode, useCallback, useState } from 'react';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
getSize,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
ghostSelectedTrackingInterFromNormal,
|
|
17
17
|
mx,
|
|
18
18
|
surfaceShadow,
|
|
19
|
-
} from '@dxos/
|
|
19
|
+
} from '@dxos/ui-theme';
|
|
20
20
|
|
|
21
21
|
import { withTheme } from '../../testing';
|
|
22
22
|
import { Icon } from '../Icon';
|
|
@@ -24,9 +24,9 @@ import { Icon } from '../Icon';
|
|
|
24
24
|
import { List, ListItem, type ListScopedProps } from './List';
|
|
25
25
|
|
|
26
26
|
const meta = {
|
|
27
|
-
title: 'ui/react-ui-core/List',
|
|
27
|
+
title: 'ui/react-ui-core/components/List',
|
|
28
28
|
component: List,
|
|
29
|
-
decorators: [withTheme],
|
|
29
|
+
decorators: [withTheme()],
|
|
30
30
|
} satisfies Meta<typeof List>;
|
|
31
31
|
|
|
32
32
|
export default meta;
|
|
@@ -63,16 +63,20 @@ export const UniformSizeDraggable: Story = {
|
|
|
63
63
|
})),
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
const handleDragEnd = (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
const handleDragEnd = useCallback(
|
|
67
|
+
(event: DragEndEvent) => {
|
|
68
|
+
const { active, over } = event;
|
|
69
|
+
if (active.id !== over?.id) {
|
|
70
|
+
setItems((items) => {
|
|
71
|
+
const oldIndex = items.findIndex((item) => item.id === active.id);
|
|
72
|
+
const newIndex = items.findIndex((item) => item.id === over?.id);
|
|
73
|
+
return arrayMove(items, oldIndex, newIndex);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
[items],
|
|
78
|
+
);
|
|
79
|
+
|
|
76
80
|
return (
|
|
77
81
|
<DndContext onDragEnd={handleDragEnd}>
|
|
78
82
|
<SortableContext items={items.map(({ id }) => id)} strategy={verticalListSortingStrategy}>
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
useListContext,
|
|
24
24
|
useListItemContext,
|
|
25
25
|
} from '@dxos/react-list';
|
|
26
|
-
import { type Density } from '@dxos/
|
|
26
|
+
import { type Density } from '@dxos/ui-types';
|
|
27
27
|
|
|
28
28
|
import { useDensityContext, useThemeContext } from '../../hooks';
|
|
29
29
|
import { type ThemedClassName } from '../../util';
|
|
@@ -56,10 +56,10 @@ const DefaultStory = ({ data }: StorybookTreeProps) => {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
const meta = {
|
|
59
|
-
title: 'ui/react-ui-core/Tree',
|
|
59
|
+
title: 'ui/react-ui-core/components/Tree',
|
|
60
60
|
component: Tree as any,
|
|
61
61
|
render: DefaultStory,
|
|
62
|
-
decorators: [withTheme],
|
|
62
|
+
decorators: [withTheme()],
|
|
63
63
|
} satisfies Meta<typeof DefaultStory>;
|
|
64
64
|
|
|
65
65
|
export default meta;
|
|
@@ -144,10 +144,10 @@ const DefaultStory = () => {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
const meta = {
|
|
147
|
-
title: 'ui/react-ui-core/Treegrid',
|
|
147
|
+
title: 'ui/react-ui-core/components/Treegrid',
|
|
148
148
|
component: Treegrid.Root as any,
|
|
149
149
|
render: DefaultStory,
|
|
150
|
-
decorators: [withTheme],
|
|
150
|
+
decorators: [withTheme()],
|
|
151
151
|
} satisfies Meta<typeof DefaultStory>;
|
|
152
152
|
|
|
153
153
|
export default meta;
|
|
@@ -97,10 +97,10 @@ const TreegridRoot = forwardRef<HTMLDivElement, TreegridRootProps>(
|
|
|
97
97
|
return (
|
|
98
98
|
<Root
|
|
99
99
|
role='treegrid'
|
|
100
|
-
onKeyDown={handleKeyDown}
|
|
101
100
|
{...props}
|
|
102
101
|
className={tx('treegrid.root', 'treegrid', {}, classNames)}
|
|
103
102
|
style={{ ...style, gridTemplateColumns }}
|
|
103
|
+
onKeyDown={handleKeyDown}
|
|
104
104
|
ref={forwardedRef}
|
|
105
105
|
>
|
|
106
106
|
{children}
|
|
@@ -5,51 +5,72 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '../../testing';
|
|
9
|
-
import {
|
|
8
|
+
import { withLayout, withTheme } from '../../testing';
|
|
9
|
+
import { IconButton } from '../Button';
|
|
10
|
+
import { Toolbar } from '../Toolbar';
|
|
10
11
|
|
|
11
12
|
import { Main, useSidebars } from './Main';
|
|
12
13
|
|
|
13
14
|
type StoryMainArgs = {};
|
|
14
15
|
|
|
15
|
-
const NavigationSidebarToggle = () => {
|
|
16
|
+
const NavigationSidebarToggle = ({ close }: { close?: boolean }) => {
|
|
16
17
|
const { toggleNavigationSidebar } = useSidebars('StoryMain__SidebarToggle');
|
|
17
|
-
return
|
|
18
|
+
return (
|
|
19
|
+
<IconButton
|
|
20
|
+
icon={close ? 'ph--caret-left--regular' : 'ph--caret-right--regular'}
|
|
21
|
+
iconOnly
|
|
22
|
+
label='Toggle navigation sidebar'
|
|
23
|
+
onClick={toggleNavigationSidebar}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
18
26
|
};
|
|
19
27
|
|
|
20
|
-
const ComplementarySidebarToggle = () => {
|
|
28
|
+
const ComplementarySidebarToggle = ({ close }: { close?: boolean }) => {
|
|
21
29
|
const { toggleComplementarySidebar } = useSidebars('StoryMain__SidebarToggle');
|
|
22
|
-
return
|
|
30
|
+
return (
|
|
31
|
+
<IconButton
|
|
32
|
+
icon={close ? 'ph--caret-right--regular' : 'ph--caret-left--regular'}
|
|
33
|
+
iconOnly
|
|
34
|
+
label='Toggle complementary sidebar'
|
|
35
|
+
onClick={toggleComplementarySidebar}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
23
38
|
};
|
|
24
39
|
|
|
25
40
|
const DefaultStory = (_args: StoryMainArgs) => {
|
|
26
41
|
return (
|
|
27
|
-
<Main.Root>
|
|
42
|
+
<Main.Root defaultComplementarySidebarState='closed' defaultNavigationSidebarState='closed'>
|
|
28
43
|
<Main.Overlay />
|
|
29
|
-
<Main.NavigationSidebar label='Navigation'
|
|
30
|
-
<
|
|
31
|
-
|
|
44
|
+
<Main.NavigationSidebar label='Navigation'>
|
|
45
|
+
<Toolbar.Root>
|
|
46
|
+
<h1>Navigation</h1>
|
|
47
|
+
<Toolbar.Separator variant='gap' classNames='grow' />
|
|
48
|
+
<NavigationSidebarToggle close />
|
|
49
|
+
</Toolbar.Root>
|
|
32
50
|
</Main.NavigationSidebar>
|
|
33
|
-
<Main.Content>
|
|
34
|
-
<
|
|
35
|
-
<ComplementarySidebarToggle />
|
|
36
|
-
<p>Main content, hello!</p>
|
|
51
|
+
<Main.Content classNames='is-full'>
|
|
52
|
+
<Toolbar.Root>
|
|
37
53
|
<NavigationSidebarToggle />
|
|
38
|
-
|
|
54
|
+
<div className='flex items-center grow justify-center'>Main</div>
|
|
55
|
+
<ComplementarySidebarToggle />
|
|
56
|
+
</Toolbar.Root>
|
|
39
57
|
</Main.Content>
|
|
40
|
-
<Main.ComplementarySidebar label='Complementary
|
|
41
|
-
<
|
|
42
|
-
|
|
58
|
+
<Main.ComplementarySidebar label='Complementary'>
|
|
59
|
+
<Toolbar.Root>
|
|
60
|
+
<ComplementarySidebarToggle close />
|
|
61
|
+
<Toolbar.Separator variant='gap' classNames='grow' />
|
|
62
|
+
<h1>Complementary</h1>
|
|
63
|
+
</Toolbar.Root>
|
|
43
64
|
</Main.ComplementarySidebar>
|
|
44
65
|
</Main.Root>
|
|
45
66
|
);
|
|
46
67
|
};
|
|
47
68
|
|
|
48
69
|
const meta = {
|
|
49
|
-
title: 'ui/react-ui-core/Main',
|
|
70
|
+
title: 'ui/react-ui-core/components/Main',
|
|
50
71
|
component: Main.Root,
|
|
51
72
|
render: DefaultStory,
|
|
52
|
-
decorators: [withTheme],
|
|
73
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
53
74
|
parameters: {
|
|
54
75
|
layout: 'fullscreen',
|
|
55
76
|
chromatic: {
|