@dxos/react-ui 0.9.1-main.c7dcc2e112 → 0.9.1-staging.ee54ba693a
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-HFJYTGHU.mjs → chunk-CMHHVHX3.mjs} +4 -1
- package/dist/lib/browser/chunk-CMHHVHX3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F3PLXTDA.mjs → chunk-GTHV4WYK.mjs} +123 -232
- package/dist/lib/browser/chunk-GTHV4WYK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1069 -976
- 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 -5
- package/dist/lib/browser/testing/index.mjs.map +2 -2
- package/dist/lib/browser/translations.mjs +1 -1
- package/dist/lib/node-esm/{chunk-LLVUYLAM.mjs → chunk-3VSKWNCQ.mjs} +123 -232
- package/dist/lib/node-esm/chunk-3VSKWNCQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OJYUPUCY.mjs → chunk-P4KFQGJI.mjs} +4 -1
- package/dist/lib/node-esm/chunk-P4KFQGJI.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1069 -976
- 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 -5
- package/dist/lib/node-esm/testing/index.mjs.map +2 -2
- package/dist/lib/node-esm/translations.mjs +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.d.ts +3 -3
- 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.stories.d.ts +3 -0
- package/dist/types/src/components/Button/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Button/MicButton.d.ts +24 -0
- package/dist/types/src/components/Button/MicButton.d.ts.map +1 -0
- package/dist/types/src/components/Button/MicButton.stories.d.ts +57 -0
- package/dist/types/src/components/Button/MicButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/SystemIconButton.d.ts +15 -2
- package/dist/types/src/components/Button/SystemIconButton.d.ts.map +1 -1
- package/dist/types/src/components/Button/SystemIconButton.stories.d.ts +51 -0
- package/dist/types/src/components/Button/SystemIconButton.stories.d.ts.map +1 -0
- package/dist/types/src/components/Button/ToggleGroup.d.ts +2 -2
- package/dist/types/src/components/Button/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Button/index.d.ts +1 -0
- package/dist/types/src/components/Button/index.d.ts.map +1 -1
- package/dist/types/src/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/src/components/Calendar/Calendar.theme.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.d.ts +8 -8
- package/dist/types/src/components/Card/Card.d.ts.map +1 -1
- package/dist/types/src/components/Card/Card.stories.d.ts +2 -2
- package/dist/types/src/components/Card/Card.stories.d.ts.map +1 -1
- package/dist/types/src/components/Carousel/Carousel.d.ts +29 -6
- package/dist/types/src/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/types/src/components/Carousel/Carousel.stories.d.ts +48 -2
- package/dist/types/src/components/Carousel/Carousel.stories.d.ts.map +1 -1
- package/dist/types/src/components/Column/Column.d.ts +2 -2
- package/dist/types/src/components/Column/Column.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/AlertDialog.d.ts +2 -2
- package/dist/types/src/components/Dialog/AlertDialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts +1 -1
- package/dist/types/src/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts +2 -2
- package/dist/types/src/components/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.stories.d.ts +5 -0
- package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +4 -1
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +3 -3
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.theme.d.ts +10 -10
- package/dist/types/src/components/Input/Input.theme.d.ts.map +1 -1
- package/dist/types/src/components/Input/SegmentedInput.d.ts +8 -8
- package/dist/types/src/components/Input/SegmentedInput.d.ts.map +1 -1
- package/dist/types/src/components/Input/index.d.ts +0 -1
- package/dist/types/src/components/Input/index.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +3 -3
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts +1 -1
- package/dist/types/src/components/Menu/ContextMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menu/DropdownMenu.d.ts +2 -2
- package/dist/types/src/components/Menu/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.d.ts +1 -1
- package/dist/types/src/components/Message/Message.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +2 -2
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Panel/Panel.d.ts +1 -1
- package/dist/types/src/components/Panel/Panel.d.ts.map +1 -1
- package/dist/types/src/components/Panel/Panel.theme.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +2 -2
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts +2 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +1 -0
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.d.ts.map +1 -1
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts +2 -2
- package/dist/types/src/components/ScrollContainer/ScrollContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.d.ts +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.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.d.ts +30 -16
- package/dist/types/src/components/Splitter/Splitter.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts +6 -1
- package/dist/types/src/components/Splitter/Splitter.stories.d.ts.map +1 -1
- package/dist/types/src/components/Splitter/Splitter.theme.d.ts +3 -1
- package/dist/types/src/components/Splitter/Splitter.theme.d.ts.map +1 -1
- 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/Tag/Tag.theme.d.ts +1 -1
- package/dist/types/src/components/Tag/Tag.theme.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts +1 -1
- package/dist/types/src/components/Toast/Toast.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.theme.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +3 -3
- 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 +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/primitives/ThemeProvider/TranslationsProvider.d.ts +1 -8
- package/dist/types/src/primitives/ThemeProvider/TranslationsProvider.d.ts.map +1 -1
- package/dist/types/src/theme/defaultTheme.d.ts.map +1 -1
- package/dist/types/src/theme/index.d.ts +0 -2
- package/dist/types/src/theme/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util/slots.d.ts +1 -1
- package/dist/types/src/util/slots.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -21
- package/src/components/Avatars/Avatar.stories.tsx +2 -2
- package/src/components/Avatars/Avatar.theme.ts +1 -1
- package/src/components/Avatars/Avatar.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +6 -6
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/Button/MicButton.stories.tsx +60 -0
- package/src/components/Button/MicButton.tsx +117 -0
- package/src/components/Button/SystemIconButton.stories.tsx +91 -0
- package/src/components/Button/SystemIconButton.tsx +113 -2
- package/src/components/Button/ToggleGroup.tsx +2 -2
- package/src/components/Button/index.ts +1 -0
- package/src/components/Calendar/Calendar.theme.ts +2 -0
- package/src/components/Calendar/Calendar.tsx +3 -3
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Card/Card.tsx +11 -11
- package/src/components/Carousel/Carousel.stories.tsx +42 -18
- package/src/components/Carousel/Carousel.tsx +169 -33
- package/src/components/Column/Column.tsx +4 -7
- package/src/components/Dialog/AlertDialog.stories.tsx +2 -2
- package/src/components/Dialog/AlertDialog.tsx +13 -13
- package/src/components/Dialog/Dialog.stories.tsx +3 -4
- package/src/components/Dialog/Dialog.theme.ts +1 -1
- package/src/components/Dialog/Dialog.tsx +12 -12
- package/src/components/Icon/Icon.stories.tsx +23 -0
- package/src/components/Icon/Icon.theme.ts +1 -1
- package/src/components/Input/Input.stories.tsx +13 -5
- package/src/components/Input/Input.theme.ts +17 -39
- package/src/components/Input/Input.tsx +30 -13
- package/src/components/Input/SegmentedInput.tsx +50 -41
- package/src/components/Input/index.ts +0 -1
- package/src/components/Main/Main.tsx +3 -3
- package/src/components/MediaPlayer/MediaPlayer.tsx +4 -4
- package/src/components/Menu/ContextMenu.tsx +8 -8
- package/src/components/Menu/DropdownMenu.tsx +12 -13
- package/src/components/Message/Message.stories.tsx +2 -2
- package/src/components/Message/Message.theme.ts +1 -1
- package/src/components/Message/Message.tsx +2 -2
- package/src/components/Panel/Panel.theme.ts +2 -1
- package/src/components/Panel/Panel.tsx +1 -1
- package/src/components/Popover/Popover.tsx +9 -9
- package/src/components/ScrollArea/ScrollArea.tsx +7 -4
- package/src/components/ScrollContainer/ScrollContainer.stories.tsx +2 -2
- package/src/components/ScrollContainer/ScrollContainer.tsx +2 -2
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.theme.ts +1 -1
- package/src/components/Select/Select.tsx +14 -14
- package/src/components/Separator/Separator.tsx +1 -0
- package/src/components/Splitter/Splitter.stories.tsx +84 -20
- package/src/components/Splitter/Splitter.theme.ts +20 -3
- package/src/components/Splitter/Splitter.tsx +320 -47
- package/src/components/Tag/Tag.stories.tsx +1 -1
- package/src/components/Tag/Tag.theme.ts +1 -1
- package/src/components/Tag/Tag.tsx +3 -5
- package/src/components/Toast/Toast.theme.ts +3 -2
- package/src/components/Toast/Toast.tsx +5 -5
- package/src/components/Toolbar/Toolbar.tsx +10 -10
- package/src/components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/index.ts +0 -1
- package/src/exemplars/tabster.stories.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/primitives/ThemeProvider/TranslationsProvider.tsx +10 -30
- package/src/testing/decorators/withLayout.tsx +4 -4
- package/src/theme/defaultTheme.ts +0 -4
- package/src/theme/index.ts +0 -2
- package/src/translations.ts +8 -0
- package/src/util/slots.ts +5 -5
- package/dist/lib/browser/chunk-F3PLXTDA.mjs.map +0 -7
- package/dist/lib/browser/chunk-HFJYTGHU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LLVUYLAM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OJYUPUCY.mjs.map +0 -7
- package/dist/types/src/components/Input/constants.d.ts +0 -5
- package/dist/types/src/components/Input/constants.d.ts.map +0 -1
- package/dist/types/src/components/List/List.d.ts +0 -29
- package/dist/types/src/components/List/List.d.ts.map +0 -1
- package/dist/types/src/components/List/List.stories.d.ts +0 -16
- package/dist/types/src/components/List/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/List.theme.d.ts +0 -7
- package/dist/types/src/components/List/List.theme.d.ts.map +0 -1
- package/dist/types/src/components/List/ListDropIndicator.d.ts +0 -13
- package/dist/types/src/components/List/ListDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/List/Tree.d.ts +0 -23
- package/dist/types/src/components/List/Tree.d.ts.map +0 -1
- package/dist/types/src/components/List/Tree.stories.d.ts +0 -15
- package/dist/types/src/components/List/Tree.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/TreeDropIndicator.d.ts +0 -8
- package/dist/types/src/components/List/TreeDropIndicator.d.ts.map +0 -1
- package/dist/types/src/components/List/Treegrid.d.ts +0 -33
- package/dist/types/src/components/List/Treegrid.d.ts.map +0 -1
- package/dist/types/src/components/List/Treegrid.stories.d.ts +0 -12
- package/dist/types/src/components/List/Treegrid.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/Treegrid.theme.d.ts +0 -7
- package/dist/types/src/components/List/Treegrid.theme.d.ts.map +0 -1
- package/dist/types/src/components/List/index.d.ts +0 -4
- package/dist/types/src/components/List/index.d.ts.map +0 -1
- package/src/components/Input/constants.ts +0 -8
- package/src/components/List/List.stories.tsx +0 -234
- package/src/components/List/List.theme.ts +0 -47
- package/src/components/List/List.tsx +0 -171
- package/src/components/List/ListDropIndicator.tsx +0 -69
- package/src/components/List/Tree.stories.tsx +0 -87
- package/src/components/List/Tree.tsx +0 -74
- package/src/components/List/TreeDropIndicator.tsx +0 -70
- package/src/components/List/Treegrid.stories.tsx +0 -156
- package/src/components/List/Treegrid.theme.ts +0 -35
- package/src/components/List/Treegrid.tsx +0 -187
- package/src/components/List/index.ts +0 -7
|
@@ -33,7 +33,7 @@ type VariantMap = {
|
|
|
33
33
|
|
|
34
34
|
type Variant = { [K in keyof VariantMap]: { type: K } & VariantMap[K] }[keyof VariantMap];
|
|
35
35
|
|
|
36
|
-
type
|
|
36
|
+
type StoryArgs = Partial<{
|
|
37
37
|
kind: keyof VariantMap;
|
|
38
38
|
label: string;
|
|
39
39
|
labelVisuallyHidden: boolean;
|
|
@@ -52,7 +52,7 @@ const DefaultStory = ({
|
|
|
52
52
|
validationValence,
|
|
53
53
|
validationMessage,
|
|
54
54
|
...props
|
|
55
|
-
}:
|
|
55
|
+
}: StoryArgs) => {
|
|
56
56
|
return (
|
|
57
57
|
<Input.Root {...{ validationValence }}>
|
|
58
58
|
<Input.Label srOnly={labelVisuallyHidden}>{label}</Input.Label>
|
|
@@ -63,8 +63,16 @@ const DefaultStory = ({
|
|
|
63
63
|
{kind === 'time' && <Input.Time {...props} />}
|
|
64
64
|
{kind === 'date' && <Input.Date {...props} />}
|
|
65
65
|
{kind === 'datetime' && <Input.DateTime {...props} />}
|
|
66
|
-
{kind === 'checkbox' &&
|
|
67
|
-
|
|
66
|
+
{kind === 'checkbox' && (
|
|
67
|
+
<Input.Block>
|
|
68
|
+
<Input.Checkbox {...props} />
|
|
69
|
+
</Input.Block>
|
|
70
|
+
)}
|
|
71
|
+
{kind === 'switch' && (
|
|
72
|
+
<Input.Block>
|
|
73
|
+
<Input.Switch {...props} />
|
|
74
|
+
</Input.Block>
|
|
75
|
+
)}
|
|
68
76
|
|
|
69
77
|
<Input.DescriptionAndValidation srOnly={descriptionVisuallyHidden}>
|
|
70
78
|
{validationMessage && <Input.Validation classNames='block'>{validationMessage}</Input.Validation>}
|
|
@@ -83,7 +91,7 @@ const meta = {
|
|
|
83
91
|
|
|
84
92
|
export default meta;
|
|
85
93
|
|
|
86
|
-
type Story = StoryObj<
|
|
94
|
+
type Story = StoryObj<StoryArgs & Variant>;
|
|
87
95
|
|
|
88
96
|
export const Density: Story = {
|
|
89
97
|
render: () => (
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { densityDimensions, staticDisabled } from '@dxos/ui-theme';
|
|
6
|
-
import { getSize,
|
|
6
|
+
import { getSize, mx, sizeValue, snapSize, textValence } from '@dxos/ui-theme';
|
|
7
7
|
import {
|
|
8
8
|
type ComponentFragment,
|
|
9
9
|
type ComponentFunction,
|
|
@@ -13,8 +13,6 @@ import {
|
|
|
13
13
|
type Size,
|
|
14
14
|
} from '@dxos/ui-types';
|
|
15
15
|
|
|
16
|
-
import { inputTextLabel } from './constants';
|
|
17
|
-
|
|
18
16
|
export type InputStyleProps = Partial<{
|
|
19
17
|
variant: 'default' | 'subdued' | 'static';
|
|
20
18
|
density: Density;
|
|
@@ -32,16 +30,10 @@ export type InputMetaStyleProps = Partial<{
|
|
|
32
30
|
}>;
|
|
33
31
|
|
|
34
32
|
const textInputSurfaceFocus =
|
|
35
|
-
'transition-colors bg-input-surface focus:bg-focus-surface border border-separator focus:border-separator';
|
|
33
|
+
'transition-colors bg-input-surface focus:bg-focus-surface border border-input-separator focus:border-separator';
|
|
36
34
|
|
|
37
35
|
const textInputSurfaceHover = 'hover:bg-focus-surface';
|
|
38
36
|
|
|
39
|
-
const booleanInputSurface =
|
|
40
|
-
'shadow-inner transition-colors bg-un-accent aria-checked:bg-accent-bg aria-[checked=mixed]:bg-accent-bg';
|
|
41
|
-
|
|
42
|
-
const booleanInputSurfaceHover =
|
|
43
|
-
'hover:bg-un-accent-hover hover:aria-checked:bg-accent-bg-hover hover:aria-[checked=mixed]:bg-accent-bg-hover';
|
|
44
|
-
|
|
45
37
|
// TODO(burdon): Replace with semantic tokens.
|
|
46
38
|
const valence = (valence?: MessageValence) => {
|
|
47
39
|
switch (valence) {
|
|
@@ -97,32 +89,15 @@ const input: ComponentFunction<InputStyleProps> = (props, ...etc) =>
|
|
|
97
89
|
|
|
98
90
|
const textArea: ComponentFunction<InputStyleProps> = (props, ...etc) => input(props, ...etc);
|
|
99
91
|
|
|
100
|
-
const checkbox: ComponentFunction<InputStyleProps> = ({ size =
|
|
92
|
+
const checkbox: ComponentFunction<InputStyleProps> = ({ size = 4 }, ...etc) =>
|
|
101
93
|
mx('dx-checkbox dx-focus-ring', getSize(size), ...etc);
|
|
102
94
|
|
|
103
|
-
const checkboxIndicator: ComponentFunction<InputStyleProps> = ({ size =
|
|
95
|
+
const checkboxIndicator: ComponentFunction<InputStyleProps> = ({ size = 4, checked }, ...etc) =>
|
|
104
96
|
mx(getSize(snapSize(sizeValue(size) * 0.65, 4)), !checked && 'invisible', ...etc);
|
|
105
97
|
|
|
106
|
-
const
|
|
107
|
-
mx(
|
|
108
|
-
getHeight(size),
|
|
109
|
-
getWidth(snapSize(sizeValue(size) * 1.75, 9)),
|
|
110
|
-
booleanInputSurface,
|
|
111
|
-
!disabled && booleanInputSurfaceHover,
|
|
112
|
-
// TODO(burdon): Added m-1 margin to make 40px width to align with 40px icon button.
|
|
113
|
-
'cursor-pointer shrink-0 rounded-full px-1 mx-1 relative',
|
|
114
|
-
'dx-focus-ring',
|
|
115
|
-
...etc,
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
const switchThumb: ComponentFunction<InputStyleProps> = ({ size = 5 }, ...etc) =>
|
|
119
|
-
mx(
|
|
120
|
-
getSize(size === 'px' ? 'px' : ((size - 2) as Size)),
|
|
121
|
-
'block bg-white rounded-full transition-transform duration-100 will-change-transform data-[state=checked]:translate-x-[100%]',
|
|
122
|
-
...etc,
|
|
123
|
-
);
|
|
98
|
+
const switch_: ComponentFunction<InputStyleProps> = (_props, ...etc) => mx('dx-checkbox--switch dx-focus-ring', ...etc);
|
|
124
99
|
|
|
125
|
-
const
|
|
100
|
+
const pin: ComponentFunction<InputStyleProps> = (props, ...etc) =>
|
|
126
101
|
mx(
|
|
127
102
|
'font-mono selection:bg-transparent mx-auto',
|
|
128
103
|
props.density === 'lg'
|
|
@@ -138,7 +113,7 @@ const withSegmentsInput: ComponentFunction<InputStyleProps> = (props, ...etc) =>
|
|
|
138
113
|
|
|
139
114
|
const segment: ComponentFunction<InputStyleProps> = (props, ...etc) =>
|
|
140
115
|
mx(
|
|
141
|
-
'flex items-center justify-center
|
|
116
|
+
'flex items-center justify-center tabular-nums',
|
|
142
117
|
props.density === 'lg'
|
|
143
118
|
? 'size-12 rounded-xs'
|
|
144
119
|
: props.density === 'sm'
|
|
@@ -155,7 +130,7 @@ const segment: ComponentFunction<InputStyleProps> = (props, ...etc) =>
|
|
|
155
130
|
);
|
|
156
131
|
|
|
157
132
|
const label: ComponentFunction<InputMetaStyleProps> = (props, ...etc) =>
|
|
158
|
-
mx('block',
|
|
133
|
+
mx('block text-sm text-description', props.srOnly && 'sr-only', ...etc);
|
|
159
134
|
|
|
160
135
|
const description: ComponentFunction<InputMetaStyleProps> = (props, ...etc) =>
|
|
161
136
|
mx('text-description', props.srOnly && 'sr-only', ...etc);
|
|
@@ -164,7 +139,7 @@ const descriptionAndValidation: ComponentFunction<InputMetaStyleProps> = (props,
|
|
|
164
139
|
mx('leading-none my-1.5', props.srOnly && 'sr-only', ...etc);
|
|
165
140
|
|
|
166
141
|
const validation: ComponentFunction<InputMetaStyleProps> = (props, ...etc) =>
|
|
167
|
-
mx(
|
|
142
|
+
mx('text-sm text-description', props.srOnly ? 'sr-only' : textValence(props.validationValence), ...etc);
|
|
168
143
|
|
|
169
144
|
const triggerIcon: ComponentFunction<{}> = (_p, ...etc) =>
|
|
170
145
|
mx(
|
|
@@ -174,17 +149,20 @@ const triggerIcon: ComponentFunction<{}> = (_p, ...etc) =>
|
|
|
174
149
|
...etc,
|
|
175
150
|
);
|
|
176
151
|
|
|
152
|
+
const block: ComponentFunction<InputStyleProps> = (props, ...etc) =>
|
|
153
|
+
mx('grid place-items-center w-[var(--dx-rail-item)] h-[var(--dx-rail-item)]', ...etc);
|
|
154
|
+
|
|
177
155
|
export const inputTheme = {
|
|
178
156
|
input,
|
|
179
157
|
textArea,
|
|
180
|
-
|
|
158
|
+
pin,
|
|
181
159
|
segment,
|
|
182
|
-
checkbox,
|
|
183
|
-
checkboxIndicator,
|
|
184
160
|
label,
|
|
185
161
|
description,
|
|
186
|
-
|
|
187
|
-
|
|
162
|
+
checkbox,
|
|
163
|
+
checkboxIndicator,
|
|
164
|
+
switch: switch_,
|
|
165
|
+
block,
|
|
188
166
|
validation,
|
|
189
167
|
descriptionAndValidation,
|
|
190
168
|
triggerIcon,
|
|
@@ -8,6 +8,7 @@ import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
|
8
8
|
import React, {
|
|
9
9
|
type ComponentPropsWithRef,
|
|
10
10
|
type ForwardRefExoticComponent,
|
|
11
|
+
PropsWithChildren,
|
|
11
12
|
forwardRef,
|
|
12
13
|
useCallback,
|
|
13
14
|
useEffect,
|
|
@@ -37,7 +38,6 @@ import {
|
|
|
37
38
|
type ValidationProps as ValidationPrimitiveProps,
|
|
38
39
|
useInputContext,
|
|
39
40
|
} from '@dxos/react-input';
|
|
40
|
-
import { mx } from '@dxos/ui-theme';
|
|
41
41
|
import { type Density, type Elevation, type Size } from '@dxos/ui-types';
|
|
42
42
|
|
|
43
43
|
import { translationKey } from '#translations';
|
|
@@ -262,7 +262,7 @@ const PinInput = forwardRef<HTMLInputElement, PinInputProps>(
|
|
|
262
262
|
...props,
|
|
263
263
|
...(props.autoFocus && !hasIosKeyboard && { autoFocus: true }),
|
|
264
264
|
}}
|
|
265
|
-
className={tx('input.
|
|
265
|
+
className={tx('input.pin', { disabled: props.disabled }, classNames) || ''}
|
|
266
266
|
segmentClassName={tx('input.segment', { disabled: props.disabled, density, elevation }) || ''}
|
|
267
267
|
ref={forwardedRef}
|
|
268
268
|
/>
|
|
@@ -400,7 +400,7 @@ const Checkbox: ForwardRefExoticComponent<CheckboxProps> = forwardRef<
|
|
|
400
400
|
'aria-invalid': 'true' as const,
|
|
401
401
|
'aria-errormessage': errorMessageId,
|
|
402
402
|
}),
|
|
403
|
-
className: tx('input.checkbox', { size }, 'shrink-0', classNames),
|
|
403
|
+
'className': tx('input.checkbox', { size }, 'shrink-0', classNames),
|
|
404
404
|
}}
|
|
405
405
|
ref={forwardedRef}
|
|
406
406
|
>
|
|
@@ -435,6 +435,7 @@ const Switch = forwardRef<HTMLInputElement, InputScopedProps<SwitchProps>>(
|
|
|
435
435
|
},
|
|
436
436
|
forwardedRef,
|
|
437
437
|
) => {
|
|
438
|
+
const { tx } = useThemeContext();
|
|
438
439
|
const [checked, onCheckedChange] = useControllableState({
|
|
439
440
|
prop: propsChecked,
|
|
440
441
|
defaultProp: propsDefaultChecked ?? false,
|
|
@@ -446,7 +447,7 @@ const Switch = forwardRef<HTMLInputElement, InputScopedProps<SwitchProps>>(
|
|
|
446
447
|
return (
|
|
447
448
|
<input
|
|
448
449
|
type='checkbox'
|
|
449
|
-
className={
|
|
450
|
+
className={tx('input.switch', { disabled: props.disabled }, classNames)}
|
|
450
451
|
checked={checked}
|
|
451
452
|
onChange={(event) => {
|
|
452
453
|
onCheckedChange(event.target.checked);
|
|
@@ -466,6 +467,21 @@ const Switch = forwardRef<HTMLInputElement, InputScopedProps<SwitchProps>>(
|
|
|
466
467
|
|
|
467
468
|
Switch.displayName = 'Input.Switch';
|
|
468
469
|
|
|
470
|
+
//
|
|
471
|
+
// Wrapper for Switch/Checkbox to center them within the input row height.
|
|
472
|
+
//
|
|
473
|
+
|
|
474
|
+
const Block = forwardRef<HTMLDivElement, PropsWithChildren>(({ children, ...props }, forwardedRef) => {
|
|
475
|
+
const { tx } = useThemeContext();
|
|
476
|
+
return (
|
|
477
|
+
<div {...props} className={tx('input.block')} ref={forwardedRef}>
|
|
478
|
+
{children}
|
|
479
|
+
</div>
|
|
480
|
+
);
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
Block.displayName = 'Input.Block';
|
|
484
|
+
|
|
469
485
|
//
|
|
470
486
|
// Date / Time / DateTime — segmented react-aria-components fields with locale-aware ordering,
|
|
471
487
|
// spinbutton semantics, and immutable separators. ISO string API:
|
|
@@ -499,6 +515,7 @@ export const Input = {
|
|
|
499
515
|
DateTime,
|
|
500
516
|
Checkbox,
|
|
501
517
|
Switch,
|
|
518
|
+
Block,
|
|
502
519
|
Label,
|
|
503
520
|
Description,
|
|
504
521
|
Validation,
|
|
@@ -508,19 +525,19 @@ export const Input = {
|
|
|
508
525
|
export { useInputTrigger };
|
|
509
526
|
|
|
510
527
|
export type {
|
|
511
|
-
|
|
528
|
+
CheckboxProps,
|
|
529
|
+
DateInputProps,
|
|
530
|
+
DateTimeInputProps,
|
|
531
|
+
DescriptionAndValidationProps,
|
|
532
|
+
DescriptionProps,
|
|
512
533
|
InputRootProps,
|
|
513
534
|
InputSharedProps,
|
|
535
|
+
InputVariant,
|
|
536
|
+
LabelProps,
|
|
514
537
|
PinInputProps,
|
|
515
|
-
|
|
538
|
+
SwitchProps,
|
|
516
539
|
TextAreaProps,
|
|
540
|
+
TextInputProps,
|
|
517
541
|
TimeProps,
|
|
518
|
-
DateInputProps,
|
|
519
|
-
DateTimeInputProps,
|
|
520
|
-
CheckboxProps,
|
|
521
|
-
SwitchProps,
|
|
522
|
-
LabelProps,
|
|
523
|
-
DescriptionProps,
|
|
524
542
|
ValidationProps,
|
|
525
|
-
DescriptionAndValidationProps,
|
|
526
543
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { CalendarDate, CalendarDateTime, Time, parseDate, parseDateTime, parseTime } from '@internationalized/date';
|
|
6
6
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
7
|
-
import React, { forwardRef, useCallback, useState } from 'react';
|
|
7
|
+
import React, { type ComponentProps, ReactNode, forwardRef, useCallback, useState } from 'react';
|
|
8
8
|
import {
|
|
9
9
|
DateField,
|
|
10
10
|
type DateFieldProps,
|
|
@@ -53,7 +53,9 @@ const toCalendarDate = (date: Date) => new CalendarDate(date.getFullYear(), date
|
|
|
53
53
|
// Theming.
|
|
54
54
|
//
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
// TODO(burdon): Move to theme.
|
|
57
|
+
const fieldClassNames =
|
|
58
|
+
'inline-flex flex-nowrap items-center gap-px whitespace-nowrap tabular-nums focus-within:bg-attention-surface';
|
|
57
59
|
|
|
58
60
|
// React Aria sets `caret-color: transparent` inline on each segment because spinbuttons replace
|
|
59
61
|
// the whole value rather than inserting at a caret position. We override with `!important` so a
|
|
@@ -63,16 +65,18 @@ const fieldClass = 'inline-flex items-center gap-px font-mono tabular-nums focus
|
|
|
63
65
|
// width regardless of value (so e.g. month `1` and `12` occupy the same space). `text-align: end`
|
|
64
66
|
// right-aligns the digits within that fixed width.
|
|
65
67
|
// TODO(burdon): Move to Input.theme.ts
|
|
66
|
-
const
|
|
67
|
-
'rounded-xs outline-none text-end [caret-color:currentColor]! ' +
|
|
68
|
+
const segmentClassNames =
|
|
69
|
+
'shrink-0 rounded-xs outline-none text-end [caret-color:currentColor]! ' +
|
|
68
70
|
'data-[type=year]:min-w-[4ch] ' +
|
|
69
|
-
'data-[type=month]:min-w-[
|
|
70
|
-
'data-[type=hour]:min-w-[
|
|
71
|
+
'data-[type=month]:min-w-[1ch] data-[type=day]:min-w-[1ch] ' +
|
|
72
|
+
'data-[type=hour]:min-w-[1ch] data-[type=minute]:min-w-[1ch] ' +
|
|
71
73
|
'data-[placeholder]:text-subdued data-[type=literal]:text-subdued ' +
|
|
72
74
|
'data-[focused]:bg-accent-bg data-[focused]:text-accent-fg ' +
|
|
73
75
|
'data-[invalid]:text-rose-500 ' +
|
|
74
76
|
'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50';
|
|
75
77
|
|
|
78
|
+
const timeSegmentClassNames = `${segmentClassNames} data-[type=dayPeriod]:text-xs data-[type=dayPeriod]:text-description`;
|
|
79
|
+
|
|
76
80
|
// Match bidi format characters (LRI/RLI/PDI/LRE/RLE/PDF/LRO/RLO) that React Aria inserts to
|
|
77
81
|
// isolate locale-formatted portions. These are invisible glyphs but the browser still gives
|
|
78
82
|
// them ~4px of width, which pushes the first visible character of time-only fields out of
|
|
@@ -80,18 +84,22 @@ const segmentClass =
|
|
|
80
84
|
// collapse them to zero width.
|
|
81
85
|
const BIDI_FORMAT_RE = /^[--]+$/;
|
|
82
86
|
|
|
87
|
+
// The segment object react-aria passes to the `DateInput` render function and expects back on
|
|
88
|
+
// `DateSegment` — derived from the component so no extra dependency on `react-stately` is needed.
|
|
89
|
+
type DateSegmentData = ComponentProps<typeof DateSegment>['segment'];
|
|
90
|
+
|
|
83
91
|
/**
|
|
84
92
|
* Render a single DateSegment. Locale-specific literals between date and time portions
|
|
85
93
|
* (e.g. en-US's `", "`) become a plain space; bidi format markers are kept but rendered
|
|
86
94
|
* zero-width so the visible content lines up at the field's left edge.
|
|
87
95
|
*/
|
|
88
|
-
const renderSegment = (segment:
|
|
96
|
+
const renderSegment = (segment: DateSegmentData, classNames = segmentClassNames) => {
|
|
89
97
|
if (segment.type === 'literal') {
|
|
90
98
|
if (BIDI_FORMAT_RE.test(segment.text)) {
|
|
91
99
|
// Render as a fixed-width spacer (between date and time portions of a datetime field),
|
|
92
100
|
// but hide when at the field's edges — opening LRI is the first child of a time-only
|
|
93
101
|
// field and would push everything right; closing PDI is the last child everywhere.
|
|
94
|
-
return <span aria-hidden className='select-none w-[
|
|
102
|
+
return <span aria-hidden className='select-none w-[1ch] first:hidden last:hidden' />;
|
|
95
103
|
}
|
|
96
104
|
if (segment.text.includes(',')) {
|
|
97
105
|
return (
|
|
@@ -101,7 +109,8 @@ const renderSegment = (segment: { type: string; text: string }) => {
|
|
|
101
109
|
);
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
|
-
|
|
112
|
+
|
|
113
|
+
return <DateSegment segment={segment} className={classNames} />;
|
|
105
114
|
};
|
|
106
115
|
|
|
107
116
|
//
|
|
@@ -110,12 +119,12 @@ const renderSegment = (segment: { type: string; text: string }) => {
|
|
|
110
119
|
|
|
111
120
|
type SegmentedInputBaseProps = InputSharedProps &
|
|
112
121
|
ThemedClassName<{
|
|
113
|
-
id?: string;
|
|
114
|
-
value?: string;
|
|
115
|
-
defaultValue?: string;
|
|
116
|
-
onValueChange?: (value: string) => void;
|
|
117
|
-
disabled?: boolean;
|
|
118
|
-
autoFocus?: boolean;
|
|
122
|
+
'id'?: string;
|
|
123
|
+
'value'?: string;
|
|
124
|
+
'defaultValue'?: string;
|
|
125
|
+
'onValueChange'?: (value: string) => void;
|
|
126
|
+
'disabled'?: boolean;
|
|
127
|
+
'autoFocus'?: boolean;
|
|
119
128
|
'aria-label'?: string;
|
|
120
129
|
}>;
|
|
121
130
|
|
|
@@ -150,19 +159,19 @@ const useFieldChrome = ({
|
|
|
150
159
|
* `Input.Root`) calls the registered handler on press; the popover anchors to this field.
|
|
151
160
|
*/
|
|
152
161
|
const PickerWrapper = ({
|
|
162
|
+
children,
|
|
153
163
|
pickerValue,
|
|
154
|
-
onPickerChange,
|
|
155
164
|
withTime,
|
|
156
165
|
disabled = false,
|
|
157
|
-
children,
|
|
158
166
|
calendar,
|
|
167
|
+
onPickerChange,
|
|
159
168
|
}: {
|
|
169
|
+
children: ReactNode;
|
|
160
170
|
pickerValue: Date | undefined;
|
|
161
|
-
onPickerChange: (next: Date | undefined) => void;
|
|
162
171
|
withTime: boolean;
|
|
163
172
|
disabled?: boolean;
|
|
164
|
-
|
|
165
|
-
|
|
173
|
+
calendar: ReactNode;
|
|
174
|
+
onPickerChange: (next: Date | undefined) => void;
|
|
166
175
|
}) => {
|
|
167
176
|
const [open, setOpen] = useState(false);
|
|
168
177
|
const openPicker = useCallback(() => {
|
|
@@ -225,13 +234,13 @@ const SegmentedDate = forwardRef<HTMLDivElement, InputScopedProps<SegmentedDateP
|
|
|
225
234
|
const parsed = tryParse(parseDate, stringValue);
|
|
226
235
|
|
|
227
236
|
const fieldProps: DateFieldProps<CalendarDate> = {
|
|
228
|
-
value: parsed,
|
|
229
|
-
onChange: (next) => setStringValue(next ? formatCalendarDate(next) : ''),
|
|
230
|
-
isDisabled: disabled,
|
|
237
|
+
'value': parsed,
|
|
238
|
+
'onChange': (next) => setStringValue(next ? formatCalendarDate(next) : ''),
|
|
239
|
+
'isDisabled': disabled,
|
|
231
240
|
autoFocus,
|
|
232
241
|
'aria-label': ariaLabel ?? 'date',
|
|
233
|
-
granularity: 'day',
|
|
234
|
-
shouldForceLeadingZeros: true,
|
|
242
|
+
'granularity': 'day',
|
|
243
|
+
'shouldForceLeadingZeros': true,
|
|
235
244
|
};
|
|
236
245
|
|
|
237
246
|
const field = (
|
|
@@ -247,7 +256,7 @@ const SegmentedDate = forwardRef<HTMLDivElement, InputScopedProps<SegmentedDateP
|
|
|
247
256
|
className={tx(
|
|
248
257
|
'input.input',
|
|
249
258
|
{ variant, disabled, density, elevation, validationValence },
|
|
250
|
-
|
|
259
|
+
fieldClassNames,
|
|
251
260
|
classNames,
|
|
252
261
|
)}
|
|
253
262
|
>
|
|
@@ -311,14 +320,14 @@ const SegmentedTime = forwardRef<HTMLDivElement, InputScopedProps<SegmentedTimeP
|
|
|
311
320
|
const parsed = tryParse(parseTime, stringValue);
|
|
312
321
|
|
|
313
322
|
const fieldProps: TimeFieldProps<Time> = {
|
|
314
|
-
value: parsed,
|
|
315
|
-
onChange: (next) => setStringValue(next ? formatTime(next) : ''),
|
|
316
|
-
isDisabled: disabled,
|
|
323
|
+
'value': parsed,
|
|
324
|
+
'onChange': (next) => setStringValue(next ? formatTime(next) : ''),
|
|
325
|
+
'isDisabled': disabled,
|
|
317
326
|
autoFocus,
|
|
318
327
|
'aria-label': ariaLabel ?? 'time',
|
|
319
|
-
granularity: 'minute',
|
|
328
|
+
'granularity': 'minute',
|
|
320
329
|
hourCycle,
|
|
321
|
-
shouldForceLeadingZeros: true,
|
|
330
|
+
'shouldForceLeadingZeros': true,
|
|
322
331
|
};
|
|
323
332
|
|
|
324
333
|
return (
|
|
@@ -334,11 +343,11 @@ const SegmentedTime = forwardRef<HTMLDivElement, InputScopedProps<SegmentedTimeP
|
|
|
334
343
|
className={tx(
|
|
335
344
|
'input.input',
|
|
336
345
|
{ variant, disabled, density, elevation, validationValence },
|
|
337
|
-
|
|
346
|
+
fieldClassNames,
|
|
338
347
|
classNames,
|
|
339
348
|
)}
|
|
340
349
|
>
|
|
341
|
-
{renderSegment}
|
|
350
|
+
{(segment) => renderSegment(segment, timeSegmentClassNames)}
|
|
342
351
|
</DateInput>
|
|
343
352
|
</TimeField>
|
|
344
353
|
);
|
|
@@ -386,14 +395,14 @@ const SegmentedDateTime = forwardRef<HTMLDivElement, InputScopedProps<SegmentedD
|
|
|
386
395
|
const parsed = tryParse(parseDateTime, stringValue);
|
|
387
396
|
|
|
388
397
|
const fieldProps: DateFieldProps<CalendarDateTime> = {
|
|
389
|
-
value: parsed,
|
|
390
|
-
onChange: (next) => setStringValue(next ? formatCalendarDateTime(next) : ''),
|
|
391
|
-
isDisabled: disabled,
|
|
398
|
+
'value': parsed,
|
|
399
|
+
'onChange': (next) => setStringValue(next ? formatCalendarDateTime(next) : ''),
|
|
400
|
+
'isDisabled': disabled,
|
|
392
401
|
autoFocus,
|
|
393
402
|
'aria-label': ariaLabel ?? 'date-time',
|
|
394
|
-
granularity: 'minute',
|
|
403
|
+
'granularity': 'minute',
|
|
395
404
|
hourCycle,
|
|
396
|
-
shouldForceLeadingZeros: true,
|
|
405
|
+
'shouldForceLeadingZeros': true,
|
|
397
406
|
};
|
|
398
407
|
|
|
399
408
|
const field = (
|
|
@@ -409,7 +418,7 @@ const SegmentedDateTime = forwardRef<HTMLDivElement, InputScopedProps<SegmentedD
|
|
|
409
418
|
className={tx(
|
|
410
419
|
'input.input',
|
|
411
420
|
{ variant, disabled, density, elevation, validationValence },
|
|
412
|
-
|
|
421
|
+
fieldClassNames,
|
|
413
422
|
classNames,
|
|
414
423
|
)}
|
|
415
424
|
>
|
|
@@ -449,6 +458,6 @@ const SegmentedDateTime = forwardRef<HTMLDivElement, InputScopedProps<SegmentedD
|
|
|
449
458
|
);
|
|
450
459
|
SegmentedDateTime.displayName = 'Input.SegmentedDateTime';
|
|
451
460
|
|
|
452
|
-
export { SegmentedDate,
|
|
461
|
+
export { SegmentedDate, SegmentedDateTime, SegmentedTime };
|
|
453
462
|
|
|
454
|
-
export type { SegmentedDateProps,
|
|
463
|
+
export type { SegmentedDateProps, SegmentedDateTimeProps, SegmentedTimeProps };
|
|
@@ -9,8 +9,8 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
11
11
|
import React, {
|
|
12
|
-
type ComponentPropsWithRef,
|
|
13
12
|
type ComponentPropsWithoutRef,
|
|
13
|
+
type ComponentPropsWithRef,
|
|
14
14
|
type Dispatch,
|
|
15
15
|
type KeyboardEvent,
|
|
16
16
|
type PropsWithChildren,
|
|
@@ -428,6 +428,6 @@ export const Main = {
|
|
|
428
428
|
ComplementarySidebar: MainComplementarySidebar,
|
|
429
429
|
};
|
|
430
430
|
|
|
431
|
-
export { useMainContext, useSidebars
|
|
431
|
+
export { useLandmarkMover, useMainContext, useSidebars };
|
|
432
432
|
|
|
433
|
-
export type {
|
|
433
|
+
export type { MainContentProps, MainNavigationSidebarProps, MainOverlayProps, MainRootProps, SidebarState };
|
|
@@ -14,10 +14,10 @@ export type MediaFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
|
14
14
|
|
|
15
15
|
/** Static map to keep Tailwind's class scanner happy (no dynamic `object-${fit}`). */
|
|
16
16
|
const FIT_CLASS: Record<MediaFit, string> = {
|
|
17
|
-
cover: 'object-cover',
|
|
18
|
-
contain: 'object-contain',
|
|
19
|
-
fill: 'object-fill',
|
|
20
|
-
none: 'object-none',
|
|
17
|
+
'cover': 'object-cover',
|
|
18
|
+
'contain': 'object-contain',
|
|
19
|
+
'fill': 'object-fill',
|
|
20
|
+
'none': 'object-none',
|
|
21
21
|
'scale-down': 'object-scale-down',
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -134,16 +134,16 @@ export const ContextMenu = {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
export type {
|
|
137
|
-
ContextMenuRootProps,
|
|
138
|
-
ContextMenuTriggerProps,
|
|
139
|
-
ContextMenuPortalProps,
|
|
140
|
-
ContextMenuContentProps,
|
|
141
|
-
ContextMenuViewportProps,
|
|
142
137
|
ContextMenuArrowProps,
|
|
143
|
-
ContextMenuGroupProps,
|
|
144
|
-
ContextMenuItemProps,
|
|
145
138
|
ContextMenuCheckboxItemProps,
|
|
139
|
+
ContextMenuContentProps,
|
|
140
|
+
ContextMenuGroupLabelProps,
|
|
141
|
+
ContextMenuGroupProps,
|
|
146
142
|
ContextMenuItemIndicatorProps,
|
|
143
|
+
ContextMenuItemProps,
|
|
144
|
+
ContextMenuPortalProps,
|
|
145
|
+
ContextMenuRootProps,
|
|
147
146
|
ContextMenuSeparatorProps,
|
|
148
|
-
|
|
147
|
+
ContextMenuTriggerProps,
|
|
148
|
+
ContextMenuViewportProps,
|
|
149
149
|
};
|
|
@@ -15,8 +15,8 @@ import { Primitive } from '@radix-ui/react-primitive';
|
|
|
15
15
|
import { Slot } from '@radix-ui/react-slot';
|
|
16
16
|
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
17
17
|
import React, {
|
|
18
|
-
type ComponentPropsWithRef,
|
|
19
18
|
type ComponentPropsWithoutRef,
|
|
19
|
+
type ComponentPropsWithRef,
|
|
20
20
|
type ComponentRef,
|
|
21
21
|
type FC,
|
|
22
22
|
PropsWithChildren,
|
|
@@ -29,8 +29,7 @@ import React, {
|
|
|
29
29
|
useRef,
|
|
30
30
|
} from 'react';
|
|
31
31
|
|
|
32
|
-
import { useElevationContext, useThemeContext } from '../../hooks';
|
|
33
|
-
import { useSafeCollisionPadding } from '../../hooks/useSafeCollisionPadding';
|
|
32
|
+
import { useElevationContext, useSafeCollisionPadding, useThemeContext } from '../../hooks';
|
|
34
33
|
import { type ThemedClassName } from '../../util';
|
|
35
34
|
|
|
36
35
|
type Direction = 'ltr' | 'rtl';
|
|
@@ -653,22 +652,22 @@ const useDropdownMenuMenuScope: (scope?: DropdownMenuScope) => any = useMenuScop
|
|
|
653
652
|
export { createDropdownMenuScope, useDropdownMenuContext, useDropdownMenuMenuScope };
|
|
654
653
|
|
|
655
654
|
export type {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
DropdownMenuVirtualTriggerProps,
|
|
659
|
-
DropdownMenuPortalProps,
|
|
655
|
+
DropdownMenuArrowProps,
|
|
656
|
+
DropdownMenuCheckboxItemProps,
|
|
660
657
|
DropdownMenuContentProps,
|
|
661
|
-
DropdownMenuViewportProps,
|
|
662
658
|
DropdownMenuGroupProps,
|
|
663
|
-
|
|
659
|
+
DropdownMenuItemIndicatorProps,
|
|
664
660
|
DropdownMenuItemProps,
|
|
665
|
-
|
|
661
|
+
DropdownMenuLabelProps,
|
|
662
|
+
DropdownMenuPortalProps,
|
|
666
663
|
DropdownMenuRadioGroupProps,
|
|
667
664
|
DropdownMenuRadioItemProps,
|
|
668
|
-
|
|
665
|
+
DropdownMenuRootProps,
|
|
669
666
|
DropdownMenuSeparatorProps,
|
|
670
|
-
|
|
667
|
+
DropdownMenuSubContentProps,
|
|
671
668
|
DropdownMenuSubProps,
|
|
672
669
|
DropdownMenuSubTriggerProps,
|
|
673
|
-
|
|
670
|
+
DropdownMenuTriggerProps,
|
|
671
|
+
DropdownMenuViewportProps,
|
|
672
|
+
DropdownMenuVirtualTriggerProps,
|
|
674
673
|
};
|
|
@@ -14,14 +14,14 @@ import { Message } from './Message';
|
|
|
14
14
|
|
|
15
15
|
random.seed(123);
|
|
16
16
|
|
|
17
|
-
type
|
|
17
|
+
type StoryArgs = {
|
|
18
18
|
valence: MessageValence;
|
|
19
19
|
title: string;
|
|
20
20
|
body: string;
|
|
21
21
|
button?: boolean;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const DefaultStory = ({ valence, title, body, button }:
|
|
24
|
+
const DefaultStory = ({ valence, title, body, button }: StoryArgs) => (
|
|
25
25
|
<div className='w-[30rem]'>
|
|
26
26
|
<Message.Root valence={valence}>
|
|
27
27
|
{title && <Message.Title onClose={() => console.log('close')}>{title}</Message.Title>}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { messageValence, mx } from '@dxos/ui-theme';
|
|
6
6
|
import { type ComponentFunction, type Elevation, type MessageValence, type Theme } from '@dxos/ui-types';
|
|
7
7
|
|
|
8
8
|
export type MessageStyleProps = {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { createContext } from '@radix-ui/react-context';
|
|
6
6
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
7
7
|
import { Slot } from '@radix-ui/react-slot';
|
|
8
|
-
import React, { type
|
|
8
|
+
import React, { type ComponentPropsWithRef, type CSSProperties, forwardRef } from 'react';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
|
|
11
11
|
import { useId } from '@dxos/react-hooks';
|
|
@@ -204,6 +204,6 @@ export const Message = {
|
|
|
204
204
|
|
|
205
205
|
export const Callout = Message;
|
|
206
206
|
|
|
207
|
-
export type { MessageRootProps, MessageTitleProps
|
|
207
|
+
export type { MessageContentProps, MessageRootProps, MessageTitleProps };
|
|
208
208
|
|
|
209
209
|
export { messageIcons };
|