@dxos/react-ui 0.8.4-main.21d9917 → 0.8.4-main.2244d791bb
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-6DTBPJE4.mjs} +4 -4
- package/dist/lib/browser/chunk-6DTBPJE4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +456 -309
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +5 -4
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-2NHEX4AD.mjs → chunk-JKHQSGNU.mjs} +4 -4
- package/dist/lib/node-esm/chunk-JKHQSGNU.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +456 -309
- 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 +5 -4
- 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/Avatars/Avatar.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.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +4 -2
- 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 +7 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +1 -5
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/List.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 +8 -9
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +0 -3
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.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 +2 -3
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +23 -26
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +43 -9
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +6 -1
- 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/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.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +1 -5
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts +1 -0
- package/dist/types/src/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +7 -6
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -0
- 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/exemplars/virtualizer.stories.d.ts +11 -0
- package/dist/types/src/exemplars/virtualizer.stories.d.ts.map +1 -0
- 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/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/withTheme.d.ts +3 -2
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -22
- package/src/components/AnchoredOverflow/AnchoredOverflow.tsx +10 -12
- package/src/components/Avatars/Avatar.stories.tsx +2 -2
- package/src/components/Avatars/Avatar.tsx +2 -9
- package/src/components/Avatars/AvatarGroup.stories.tsx +2 -2
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +2 -2
- package/src/components/Breadcrumb/Breadcrumb.tsx +5 -31
- package/src/components/Button/Button.stories.tsx +3 -3
- package/src/components/Button/Button.tsx +1 -7
- package/src/components/Button/IconButton.stories.tsx +2 -2
- package/src/components/Button/IconButton.tsx +1 -1
- package/src/components/Button/Toggle.stories.tsx +2 -2
- package/src/components/Button/ToggleGroup.stories.tsx +2 -2
- package/src/components/Dialog/AlertDialog.stories.tsx +6 -7
- package/src/components/Dialog/AlertDialog.tsx +78 -9
- package/src/components/Dialog/Dialog.stories.tsx +11 -11
- package/src/components/Dialog/Dialog.tsx +44 -19
- package/src/components/Icon/Icon.stories.tsx +2 -2
- package/src/components/Icon/Icon.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +11 -10
- package/src/components/Input/Input.tsx +10 -25
- package/src/components/Link/Link.stories.tsx +2 -2
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/List/List.stories.tsx +2 -2
- package/src/components/List/List.tsx +7 -13
- package/src/components/List/Tree.stories.tsx +2 -2
- package/src/components/List/Treegrid.stories.tsx +2 -2
- package/src/components/List/Treegrid.tsx +4 -9
- package/src/components/Main/Main.stories.tsx +41 -23
- package/src/components/Main/Main.tsx +128 -71
- package/src/components/Menu/ContextMenu.stories.tsx +2 -2
- package/src/components/Menu/ContextMenu.tsx +7 -31
- package/src/components/Menu/DropdownMenu.stories.tsx +2 -2
- package/src/components/Menu/DropdownMenu.tsx +8 -8
- package/src/components/Message/Message.stories.tsx +23 -8
- package/src/components/Message/Message.tsx +8 -21
- package/src/components/Popover/Popover.stories.tsx +2 -2
- package/src/components/Popover/Popover.tsx +3 -3
- package/src/components/ScrollArea/ScrollArea.stories.tsx +152 -76
- package/src/components/ScrollArea/ScrollArea.tsx +68 -116
- package/src/components/ScrollArea/index.ts +1 -1
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +24 -9
- package/src/components/ScrollContainer/ScrollContainer.tsx +14 -9
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.tsx +9 -25
- package/src/components/Separator/Separator.tsx +1 -1
- 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/Status/Status.tsx +2 -2
- package/src/components/Tag/Tag.stories.tsx +3 -7
- package/src/components/Tag/Tag.tsx +1 -6
- package/src/components/ThemeProvider/ThemeProvider.tsx +2 -1
- package/src/components/Toast/Toast.stories.tsx +2 -2
- package/src/components/Toast/Toast.tsx +6 -10
- package/src/components/Toolbar/Toolbar.stories.tsx +2 -2
- package/src/components/Toolbar/Toolbar.tsx +13 -9
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +2 -2
- package/src/components/index.ts +2 -0
- 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/exemplars/virtualizer.stories.tsx +133 -0
- package/src/index.ts +1 -0
- 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 +79 -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/withLayoutVariants.tsx +1 -1
- package/src/testing/decorators/withTheme.tsx +19 -17
- package/dist/lib/browser/chunk-CEKVHJ27.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2NHEX4AD.mjs.map +0 -7
|
@@ -86,7 +86,7 @@ const DialogOverlay: ForwardRefExoticComponent<DialogOverlayProps> = forwardRef<
|
|
|
86
86
|
return (
|
|
87
87
|
<DialogOverlayPrimitive
|
|
88
88
|
{...props}
|
|
89
|
-
className={tx('dialog.overlay',
|
|
89
|
+
className={tx('dialog.overlay', {}, classNames)}
|
|
90
90
|
ref={forwardedRef}
|
|
91
91
|
data-block-align={blockAlign}
|
|
92
92
|
>
|
|
@@ -120,12 +120,7 @@ const DialogContent: ForwardRefExoticComponent<DialogContentProps> = forwardRef<
|
|
|
120
120
|
// https://www.radix-ui.com/primitives/docs/components/dialog#description
|
|
121
121
|
aria-describedby={undefined}
|
|
122
122
|
{...props}
|
|
123
|
-
className={tx(
|
|
124
|
-
'dialog.content',
|
|
125
|
-
'dialog',
|
|
126
|
-
{ inOverlayLayout: propsInOverlayLayout || inOverlayLayout, size },
|
|
127
|
-
classNames,
|
|
128
|
-
)}
|
|
123
|
+
className={tx('dialog.content', { inOverlayLayout: propsInOverlayLayout || inOverlayLayout, size }, classNames)}
|
|
129
124
|
ref={forwardedRef}
|
|
130
125
|
>
|
|
131
126
|
{children}
|
|
@@ -144,18 +139,30 @@ type DialogHeaderProps = ThemedClassName<PropsWithChildren> & { srOnly?: boolean
|
|
|
144
139
|
|
|
145
140
|
const DialogHeader: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTMLHeadingElement, DialogTitleProps>(
|
|
146
141
|
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
142
|
+
const { tx } = useThemeContext();
|
|
143
|
+
return <div {...props} role='header' className={tx('dialog.header', { srOnly }, classNames)} ref={forwardedRef} />;
|
|
144
|
+
},
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
//
|
|
148
|
+
// Body
|
|
149
|
+
//
|
|
150
|
+
|
|
151
|
+
type DialogBodyProps = PropsWithChildren;
|
|
152
|
+
|
|
153
|
+
const DialogBody: ForwardRefExoticComponent<DialogBodyProps> = forwardRef<HTMLDivElement, DialogBodyProps>(
|
|
154
|
+
({ children, ...props }, forwardedRef) => {
|
|
147
155
|
const { tx } = useThemeContext();
|
|
148
156
|
return (
|
|
149
|
-
<div
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
className={tx('dialog.header', 'dialog__header', { srOnly }, classNames)}
|
|
153
|
-
ref={forwardedRef}
|
|
154
|
-
/>
|
|
157
|
+
<div {...props} className={tx('dialog.body')} ref={forwardedRef}>
|
|
158
|
+
{children}
|
|
159
|
+
</div>
|
|
155
160
|
);
|
|
156
161
|
},
|
|
157
162
|
);
|
|
158
163
|
|
|
164
|
+
// TODO(burdon): Add ActionBar.
|
|
165
|
+
|
|
159
166
|
//
|
|
160
167
|
// Title
|
|
161
168
|
//
|
|
@@ -166,11 +173,7 @@ const DialogTitle: ForwardRefExoticComponent<DialogTitleProps> = forwardRef<HTML
|
|
|
166
173
|
({ classNames, srOnly, ...props }, forwardedRef) => {
|
|
167
174
|
const { tx } = useThemeContext();
|
|
168
175
|
return (
|
|
169
|
-
<DialogTitlePrimitive
|
|
170
|
-
{...props}
|
|
171
|
-
className={tx('dialog.title', 'dialog__title', { srOnly }, classNames)}
|
|
172
|
-
ref={forwardedRef}
|
|
173
|
-
/>
|
|
176
|
+
<DialogTitlePrimitive {...props} className={tx('dialog.title', { srOnly }, classNames)} ref={forwardedRef} />
|
|
174
177
|
);
|
|
175
178
|
},
|
|
176
179
|
);
|
|
@@ -189,12 +192,30 @@ const DialogDescription: ForwardRefExoticComponent<DialogTitleProps> = forwardRe
|
|
|
189
192
|
return (
|
|
190
193
|
<DialogDescriptionPrimitive
|
|
191
194
|
{...props}
|
|
192
|
-
className={tx('dialog.description',
|
|
195
|
+
className={tx('dialog.description', { srOnly }, classNames)}
|
|
193
196
|
ref={forwardedRef}
|
|
194
197
|
/>
|
|
195
198
|
);
|
|
196
199
|
});
|
|
197
200
|
|
|
201
|
+
//
|
|
202
|
+
// ActionBar
|
|
203
|
+
//
|
|
204
|
+
|
|
205
|
+
type DialogActionBarProps = ThemedClassName<PropsWithChildren>;
|
|
206
|
+
|
|
207
|
+
const DialogActionBar: ForwardRefExoticComponent<DialogActionBarProps> = forwardRef<
|
|
208
|
+
HTMLDivElement,
|
|
209
|
+
DialogActionBarProps
|
|
210
|
+
>(({ children, classNames, ...props }, forwardedRef) => {
|
|
211
|
+
const { tx } = useThemeContext();
|
|
212
|
+
return (
|
|
213
|
+
<div {...props} className={tx('dialog.actionbar', {}, classNames)} ref={forwardedRef}>
|
|
214
|
+
{children}
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
});
|
|
218
|
+
|
|
198
219
|
//
|
|
199
220
|
// Close
|
|
200
221
|
//
|
|
@@ -239,8 +260,10 @@ export const Dialog = {
|
|
|
239
260
|
Overlay: DialogOverlay,
|
|
240
261
|
Content: DialogContent,
|
|
241
262
|
Header: DialogHeader,
|
|
263
|
+
Body: DialogBody,
|
|
242
264
|
Title: DialogTitle,
|
|
243
265
|
Description: DialogDescription,
|
|
266
|
+
ActionBar: DialogActionBar,
|
|
244
267
|
Close: DialogClose,
|
|
245
268
|
CloseIconButton: DialogCloseIconButton,
|
|
246
269
|
};
|
|
@@ -252,8 +275,10 @@ export type {
|
|
|
252
275
|
DialogOverlayProps,
|
|
253
276
|
DialogContentProps,
|
|
254
277
|
DialogHeaderProps,
|
|
278
|
+
DialogBodyProps,
|
|
255
279
|
DialogTitleProps,
|
|
256
280
|
DialogDescriptionProps,
|
|
281
|
+
DialogActionBarProps,
|
|
257
282
|
DialogCloseProps,
|
|
258
283
|
DialogCloseIconButtonProps,
|
|
259
284
|
};
|
|
@@ -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
|
},
|
|
@@ -20,7 +20,7 @@ export const Icon = memo(
|
|
|
20
20
|
const { tx } = useThemeContext();
|
|
21
21
|
const href = useIconHref(icon);
|
|
22
22
|
return (
|
|
23
|
-
<svg {...props} className={tx('icon.root',
|
|
23
|
+
<svg {...props} className={tx('icon.root', { size }, classNames)} ref={forwardedRef}>
|
|
24
24
|
<use href={href} />
|
|
25
25
|
</svg>
|
|
26
26
|
);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { mx, surfaceShadow } from '@dxos/ui-theme';
|
|
9
9
|
import { type MessageValence } from '@dxos/ui-types';
|
|
10
10
|
|
|
11
11
|
import { withTheme } from '../../testing';
|
|
@@ -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
|
|
|
@@ -43,7 +43,7 @@ type LabelProps = ThemedClassName<LabelPrimitiveProps> & { srOnly?: boolean };
|
|
|
43
43
|
const Label = forwardRef<HTMLLabelElement, LabelProps>(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
44
44
|
const { tx } = useThemeContext();
|
|
45
45
|
return (
|
|
46
|
-
<LabelPrimitive {...props} className={tx('input.label',
|
|
46
|
+
<LabelPrimitive {...props} className={tx('input.label', { srOnly }, classNames)} ref={forwardedRef}>
|
|
47
47
|
{children}
|
|
48
48
|
</LabelPrimitive>
|
|
49
49
|
);
|
|
@@ -55,11 +55,7 @@ const Description = forwardRef<HTMLSpanElement, DescriptionProps>(
|
|
|
55
55
|
({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
56
56
|
const { tx } = useThemeContext();
|
|
57
57
|
return (
|
|
58
|
-
<DescriptionPrimitive
|
|
59
|
-
{...props}
|
|
60
|
-
className={tx('input.description', 'input__description', { srOnly }, classNames)}
|
|
61
|
-
ref={forwardedRef}
|
|
62
|
-
>
|
|
58
|
+
<DescriptionPrimitive {...props} className={tx('input.description', { srOnly }, classNames)} ref={forwardedRef}>
|
|
63
59
|
{children}
|
|
64
60
|
</DescriptionPrimitive>
|
|
65
61
|
);
|
|
@@ -75,12 +71,7 @@ const Validation = forwardRef<HTMLSpanElement, InputScopedProps<ValidationProps>
|
|
|
75
71
|
return (
|
|
76
72
|
<ValidationPrimitive
|
|
77
73
|
{...props}
|
|
78
|
-
className={tx(
|
|
79
|
-
'input.validation',
|
|
80
|
-
`input__validation-message input__validation-message--${validationValence}`,
|
|
81
|
-
{ srOnly, validationValence },
|
|
82
|
-
classNames,
|
|
83
|
-
)}
|
|
74
|
+
className={tx('input.validation', { srOnly, validationValence }, classNames)}
|
|
84
75
|
ref={forwardedRef}
|
|
85
76
|
>
|
|
86
77
|
{children}
|
|
@@ -97,7 +88,7 @@ const DescriptionAndValidation = forwardRef<HTMLParagraphElement, DescriptionAnd
|
|
|
97
88
|
return (
|
|
98
89
|
<DescriptionAndValidationPrimitive
|
|
99
90
|
{...props}
|
|
100
|
-
className={tx('input.descriptionAndValidation',
|
|
91
|
+
className={tx('input.descriptionAndValidation', { srOnly }, classNames)}
|
|
101
92
|
ref={forwardedRef}
|
|
102
93
|
>
|
|
103
94
|
{children}
|
|
@@ -119,7 +110,6 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
119
110
|
elevation: propsElevation,
|
|
120
111
|
segmentClassName: propsSegmentClassName,
|
|
121
112
|
inputClassName,
|
|
122
|
-
variant,
|
|
123
113
|
...props
|
|
124
114
|
},
|
|
125
115
|
forwardedRef,
|
|
@@ -128,12 +118,10 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
128
118
|
const { tx } = useThemeContext();
|
|
129
119
|
const density = useDensityContext(propsDensity);
|
|
130
120
|
const elevation = useElevationContext(propsElevation);
|
|
131
|
-
|
|
132
121
|
const segmentClassName = useCallback(
|
|
133
122
|
({ focused, validationValence }: Parameters<Exclude<PinInputPrimitiveProps['segmentClassName'], undefined>>[0]) =>
|
|
134
123
|
tx(
|
|
135
124
|
'input.input',
|
|
136
|
-
'input--pin-segment',
|
|
137
125
|
{
|
|
138
126
|
variant: 'static',
|
|
139
127
|
focused,
|
|
@@ -143,9 +131,10 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
143
131
|
validationValence,
|
|
144
132
|
},
|
|
145
133
|
propsSegmentClassName,
|
|
146
|
-
),
|
|
134
|
+
) || '',
|
|
147
135
|
[tx, props.disabled, elevation, propsElevation, density],
|
|
148
136
|
);
|
|
137
|
+
|
|
149
138
|
return (
|
|
150
139
|
<PinInputPrimitive
|
|
151
140
|
{...{
|
|
@@ -153,7 +142,7 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
153
142
|
segmentClassName,
|
|
154
143
|
...(props.autoFocus && !hasIosKeyboard && { autoFocus: true }),
|
|
155
144
|
}}
|
|
156
|
-
inputClassName={tx('input.inputWithSegments',
|
|
145
|
+
inputClassName={tx('input.inputWithSegments', { disabled: props.disabled }, inputClassName) || ''}
|
|
157
146
|
ref={forwardedRef}
|
|
158
147
|
/>
|
|
159
148
|
);
|
|
@@ -174,13 +163,11 @@ const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>
|
|
|
174
163
|
forwardedRef,
|
|
175
164
|
) => {
|
|
176
165
|
const { hasIosKeyboard } = useThemeContext();
|
|
177
|
-
const
|
|
166
|
+
const { tx } = useThemeContext();
|
|
178
167
|
const density = useDensityContext(propsDensity);
|
|
179
168
|
const elevation = useElevationContext(propsElevation);
|
|
180
169
|
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
181
170
|
|
|
182
|
-
const { tx } = themeContextValue;
|
|
183
|
-
|
|
184
171
|
return (
|
|
185
172
|
<TextInputPrimitive
|
|
186
173
|
{...props}
|
|
@@ -188,7 +175,6 @@ const TextInput = forwardRef<HTMLInputElement, InputScopedProps<TextInputProps>>
|
|
|
188
175
|
{...{ 'data-1p-ignore': noAutoFill }}
|
|
189
176
|
className={tx(
|
|
190
177
|
'input.input',
|
|
191
|
-
'input',
|
|
192
178
|
{
|
|
193
179
|
variant,
|
|
194
180
|
disabled: props.disabled,
|
|
@@ -220,7 +206,6 @@ const TextArea = forwardRef<HTMLTextAreaElement, InputScopedProps<TextAreaProps>
|
|
|
220
206
|
{...props}
|
|
221
207
|
className={tx(
|
|
222
208
|
'input.input',
|
|
223
|
-
'input--text-area',
|
|
224
209
|
{
|
|
225
210
|
variant,
|
|
226
211
|
disabled: props.disabled,
|
|
@@ -278,13 +263,13 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
|
|
|
278
263
|
'aria-invalid': 'true' as const,
|
|
279
264
|
'aria-errormessage': errorMessageId,
|
|
280
265
|
}),
|
|
281
|
-
className: tx('input.checkbox',
|
|
266
|
+
className: tx('input.checkbox', { size }, 'shrink-0', classNames),
|
|
282
267
|
}}
|
|
283
268
|
ref={forwardedRef}
|
|
284
269
|
>
|
|
285
270
|
<Icon
|
|
286
271
|
icon={checked === 'indeterminate' ? 'ph--minus--regular' : 'ph--check--regular'}
|
|
287
|
-
classNames={tx('input.checkboxIndicator',
|
|
272
|
+
classNames={tx('input.checkboxIndicator', { size, checked })}
|
|
288
273
|
/>
|
|
289
274
|
</CheckboxPrimitive>
|
|
290
275
|
);
|
|
@@ -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;
|
|
@@ -19,6 +19,6 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
19
19
|
({ asChild, variant, classNames, ...props }, forwardedRef) => {
|
|
20
20
|
const { tx } = useThemeContext();
|
|
21
21
|
const Root = asChild ? Slot : Primitive.a;
|
|
22
|
-
return <Root {...props} className={tx('link.root',
|
|
22
|
+
return <Root {...props} className={tx('link.root', { variant }, classNames)} ref={forwardedRef} />;
|
|
23
23
|
},
|
|
24
24
|
);
|
|
@@ -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;
|
|
@@ -40,7 +40,7 @@ const List = forwardRef<HTMLOListElement, ListProps>(({ classNames, children, ..
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<DensityProvider density={density}>
|
|
43
|
-
<ListPrimitive {...props} className={tx('list.root',
|
|
43
|
+
<ListPrimitive {...props} className={tx('list.root', {}, classNames)} ref={forwardedRef}>
|
|
44
44
|
{children}
|
|
45
45
|
</ListPrimitive>
|
|
46
46
|
</DensityProvider>
|
|
@@ -58,7 +58,7 @@ const ListItemEndcap = forwardRef<HTMLDivElement, ListItemEndcapProps>(
|
|
|
58
58
|
<Root
|
|
59
59
|
{...(!asChild && { role: 'none' })}
|
|
60
60
|
{...props}
|
|
61
|
-
className={tx('list.item.endcap',
|
|
61
|
+
className={tx('list.item.endcap', { density }, classNames)}
|
|
62
62
|
ref={forwardedRef}
|
|
63
63
|
>
|
|
64
64
|
{children}
|
|
@@ -73,13 +73,7 @@ const MockListItemOpenTrigger = ({
|
|
|
73
73
|
}: ThemedClassName<Omit<ComponentPropsWithoutRef<'div'>, 'children'>>) => {
|
|
74
74
|
const density = useDensityContext();
|
|
75
75
|
const { tx } = useThemeContext();
|
|
76
|
-
return (
|
|
77
|
-
<div
|
|
78
|
-
role='none'
|
|
79
|
-
{...props}
|
|
80
|
-
className={tx('list.item.openTrigger', 'list__listItem__openTrigger--mock', { density }, classNames)}
|
|
81
|
-
/>
|
|
82
|
-
);
|
|
76
|
+
return <div role='none' {...props} className={tx('list.item.openTrigger', { density }, classNames)} />;
|
|
83
77
|
};
|
|
84
78
|
|
|
85
79
|
type ListItemHeadingProps = ThemedClassName<ListPrimitiveItemHeadingProps>;
|
|
@@ -91,7 +85,7 @@ const ListItemHeading = forwardRef<HTMLParagraphElement, ListItemHeadingProps>(
|
|
|
91
85
|
return (
|
|
92
86
|
<ListPrimitiveItemHeading
|
|
93
87
|
{...props}
|
|
94
|
-
className={tx('list.item.heading',
|
|
88
|
+
className={tx('list.item.heading', { density }, classNames)}
|
|
95
89
|
ref={forwardedRef}
|
|
96
90
|
>
|
|
97
91
|
{children}
|
|
@@ -110,14 +104,14 @@ const ListItemOpenTrigger = forwardRef<HTMLButtonElement, ListItemOpenTriggerPro
|
|
|
110
104
|
return (
|
|
111
105
|
<ListPrimitiveItemOpenTrigger
|
|
112
106
|
{...props}
|
|
113
|
-
className={tx('list.item.openTrigger',
|
|
107
|
+
className={tx('list.item.openTrigger', { density }, classNames)}
|
|
114
108
|
ref={forwardedRef}
|
|
115
109
|
>
|
|
116
110
|
{children || (
|
|
117
111
|
<Icon
|
|
118
112
|
size={3}
|
|
119
113
|
icon={open ? 'ph--caret-down--bold' : 'ph--caret-right--bold'}
|
|
120
|
-
classNames={tx('list.item.openTriggerIcon',
|
|
114
|
+
classNames={tx('list.item.openTriggerIcon', {})}
|
|
121
115
|
/>
|
|
122
116
|
)}
|
|
123
117
|
</ListPrimitiveItemOpenTrigger>
|
|
@@ -134,7 +128,7 @@ const ListItemRoot = forwardRef<HTMLLIElement, ListItemRootProps>(
|
|
|
134
128
|
return (
|
|
135
129
|
<ListPrimitiveItem
|
|
136
130
|
{...props}
|
|
137
|
-
className={tx('list.item.root',
|
|
131
|
+
className={tx('list.item.root', { density, collapsible: props.collapsible }, classNames)}
|
|
138
132
|
ref={forwardedRef}
|
|
139
133
|
>
|
|
140
134
|
{children}
|
|
@@ -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
|
-
className={tx('treegrid.root',
|
|
101
|
+
className={tx('treegrid.root', {}, classNames)}
|
|
103
102
|
style={{ ...style, gridTemplateColumns }}
|
|
103
|
+
onKeyDown={handleKeyDown}
|
|
104
104
|
ref={forwardedRef}
|
|
105
105
|
>
|
|
106
106
|
{children}
|
|
@@ -149,7 +149,7 @@ const TreegridRow = forwardRef<HTMLDivElement, TreegridRowScopedProps<TreegridRo
|
|
|
149
149
|
<Root
|
|
150
150
|
role='row'
|
|
151
151
|
aria-level={level}
|
|
152
|
-
className={tx('treegrid.row',
|
|
152
|
+
className={tx('treegrid.row', { level }, classNames)}
|
|
153
153
|
{...(parentOf && { 'aria-expanded': open, 'aria-owns': parentOf })}
|
|
154
154
|
{...props}
|
|
155
155
|
id={id}
|
|
@@ -168,12 +168,7 @@ const TreegridCell = forwardRef<HTMLDivElement, TreegridCellProps>(
|
|
|
168
168
|
({ classNames, children, indent, ...props }, forwardedRef) => {
|
|
169
169
|
const { tx } = useThemeContext();
|
|
170
170
|
return (
|
|
171
|
-
<div
|
|
172
|
-
role='gridcell'
|
|
173
|
-
className={tx('treegrid.cell', 'treegrid__cell', { indent }, classNames)}
|
|
174
|
-
{...props}
|
|
175
|
-
ref={forwardedRef}
|
|
176
|
-
>
|
|
171
|
+
<div role='gridcell' className={tx('treegrid.cell', { indent }, classNames)} {...props} ref={forwardedRef}>
|
|
177
172
|
{children}
|
|
178
173
|
</div>
|
|
179
174
|
);
|
|
@@ -5,56 +5,74 @@
|
|
|
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
|
-
chromatic: {
|
|
56
|
-
disableSnapshot: false,
|
|
57
|
-
},
|
|
58
76
|
},
|
|
59
77
|
} satisfies Meta<typeof DefaultStory>;
|
|
60
78
|
|