@dxos/ui-theme 0.8.4-main.8360d9e660 → 0.8.4-main.8baae0fced
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/index.mjs +414 -479
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +414 -479
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/plugin/node-cjs/{theme.css → main.css} +189 -122
- package/dist/plugin/node-cjs/main.css.map +7 -0
- package/dist/plugin/node-cjs/meta.json +1 -1
- package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs +8 -15
- package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs.map +3 -3
- package/dist/plugin/node-esm/{theme.css → main.css} +189 -122
- package/dist/plugin/node-esm/main.css.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/plugin/node-esm/plugins/ThemePlugin.mjs +8 -15
- package/dist/plugin/node-esm/plugins/ThemePlugin.mjs.map +3 -3
- package/dist/types/src/Theme.stories.d.ts.map +1 -1
- package/dist/types/src/defs.d.ts +1 -1
- package/dist/types/src/defs.d.ts.map +1 -1
- package/dist/types/src/fragments/density.d.ts +1 -4
- package/dist/types/src/fragments/density.d.ts.map +1 -1
- package/dist/types/src/fragments/hover.d.ts +0 -1
- package/dist/types/src/fragments/hover.d.ts.map +1 -1
- package/dist/types/src/fragments/index.d.ts +0 -4
- package/dist/types/src/fragments/index.d.ts.map +1 -1
- package/dist/types/src/fragments/text.d.ts +0 -1
- package/dist/types/src/fragments/text.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/plugins/ThemePlugin.d.ts +1 -1
- package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -1
- package/dist/types/src/theme/components/avatar.d.ts.map +1 -1
- package/dist/types/src/theme/components/button.d.ts +2 -2
- package/dist/types/src/theme/components/button.d.ts.map +1 -1
- package/dist/types/src/theme/components/card.d.ts +1 -0
- package/dist/types/src/theme/components/card.d.ts.map +1 -1
- package/dist/types/src/theme/components/dialog.d.ts.map +1 -1
- package/dist/types/src/theme/components/focus.d.ts +6 -0
- package/dist/types/src/theme/components/focus.d.ts.map +1 -0
- package/dist/types/src/theme/components/icon-button.d.ts +1 -0
- package/dist/types/src/theme/components/icon-button.d.ts.map +1 -1
- package/dist/types/src/theme/components/icon.d.ts.map +1 -1
- package/dist/types/src/theme/components/index.d.ts +1 -0
- package/dist/types/src/theme/components/index.d.ts.map +1 -1
- package/dist/types/src/theme/components/input.d.ts +8 -8
- package/dist/types/src/theme/components/input.d.ts.map +1 -1
- package/dist/types/src/theme/components/link.d.ts.map +1 -1
- package/dist/types/src/theme/components/list.d.ts.map +1 -1
- package/dist/types/src/theme/components/main.d.ts.map +1 -1
- package/dist/types/src/theme/components/message.d.ts.map +1 -1
- package/dist/types/src/theme/components/popover.d.ts.map +1 -1
- package/dist/types/src/theme/components/scroll-area.d.ts +12 -2
- package/dist/types/src/theme/components/scroll-area.d.ts.map +1 -1
- package/dist/types/src/theme/components/select.d.ts.map +1 -1
- package/dist/types/src/theme/components/status.d.ts +1 -1
- package/dist/types/src/theme/components/status.d.ts.map +1 -1
- package/dist/types/src/theme/components/toast.d.ts.map +1 -1
- package/dist/types/src/theme/components/tooltip.d.ts.map +1 -1
- package/dist/types/src/theme/components/treegrid.d.ts.map +1 -1
- package/dist/types/src/theme/index.d.ts +1 -0
- package/dist/types/src/theme/index.d.ts.map +1 -1
- package/dist/types/src/theme/primitives/column.d.ts +25 -3
- package/dist/types/src/theme/primitives/column.d.ts.map +1 -1
- package/dist/types/src/theme/primitives/panel.d.ts +9 -5
- package/dist/types/src/theme/primitives/panel.d.ts.map +1 -1
- package/dist/types/src/theme/theme.d.ts.map +1 -1
- package/dist/types/src/util/elevation.d.ts.map +1 -0
- package/dist/types/src/util/hash-styles.d.ts +1 -1
- package/dist/types/src/util/hash-styles.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +3 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/mx.d.ts +49 -284
- package/dist/types/src/util/mx.d.ts.map +1 -1
- package/dist/types/src/util/size.d.ts +27 -0
- package/dist/types/src/util/size.d.ts.map +1 -0
- package/dist/types/src/util/valence.d.ts +4 -0
- package/dist/types/src/util/valence.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -18
- package/src/Theme.stories.tsx +5 -5
- package/src/css/DESIGN_SYSTEM.md +159 -0
- package/src/css/base/base.css +2 -2
- package/src/css/components/button.css +4 -3
- package/src/css/components/checkbox.css +1 -1
- package/src/css/components/{focus-ring.css → focus.css} +27 -13
- package/src/css/components/icon.css +9 -0
- package/src/css/components/link.css +3 -0
- package/src/css/components/panel.css +45 -45
- package/src/css/components/selected.css +63 -10
- package/src/css/components/selected.md +101 -0
- package/src/css/components/surface.css +4 -4
- package/src/css/components/tag.css +25 -23
- package/src/css/integrations/codemirror.css +5 -3
- package/src/css/integrations/tldraw.css +1 -0
- package/src/css/layout/main.css +0 -7
- package/src/css/layout/size.css +16 -26
- package/src/css/theme/animation.css +31 -0
- package/src/css/theme/palette.css +6 -0
- package/src/css/theme/semantic.css +47 -46
- package/src/css/theme/spacing.css +31 -17
- package/src/css/theme/styles.css +22 -22
- package/src/css/utilities.css +114 -3
- package/src/defs.ts +1 -1
- package/src/fragments/AUDIT.md +55 -0
- package/src/fragments/density.ts +8 -5
- package/src/fragments/hover.ts +0 -2
- package/src/fragments/index.ts +1 -5
- package/src/fragments/text.ts +1 -1
- package/src/index.ts +1 -1
- package/src/{theme.css → main.css} +47 -10
- package/src/plugins/ThemePlugin.ts +12 -24
- package/src/plugins/main.css +45 -0
- package/src/theme/components/avatar.ts +3 -4
- package/src/theme/components/button.ts +2 -2
- package/src/theme/components/card.ts +15 -6
- package/src/theme/components/dialog.ts +4 -3
- package/src/theme/components/focus.ts +33 -0
- package/src/theme/components/icon-button.ts +6 -5
- package/src/theme/components/icon.ts +7 -5
- package/src/theme/components/index.ts +1 -0
- package/src/theme/components/input.ts +18 -33
- package/src/theme/components/link.ts +1 -2
- package/src/theme/components/list.ts +4 -4
- package/src/theme/components/menu.ts +4 -4
- package/src/theme/components/message.ts +6 -7
- package/src/theme/components/popover.ts +4 -5
- package/src/theme/components/scroll-area.ts +58 -46
- package/src/theme/components/select.ts +2 -3
- package/src/theme/components/status.ts +5 -5
- package/src/theme/components/toast.ts +2 -3
- package/src/theme/components/tooltip.ts +2 -3
- package/src/theme/components/treegrid.ts +1 -1
- package/src/theme/index.ts +1 -0
- package/src/theme/primitives/column.ts +49 -8
- package/src/theme/primitives/panel.ts +18 -25
- package/src/theme/theme.ts +2 -0
- package/src/typings.d.ts +3 -0
- package/src/util/hash-styles.ts +19 -19
- package/src/util/index.ts +3 -0
- package/src/util/mx.ts +112 -7
- package/src/util/size.ts +103 -0
- package/dist/plugin/node-cjs/theme.css.map +0 -7
- package/dist/plugin/node-esm/theme.css.map +0 -7
- package/dist/types/src/fragments/elevation.d.ts.map +0 -1
- package/dist/types/src/fragments/focus.d.ts +0 -4
- package/dist/types/src/fragments/focus.d.ts.map +0 -1
- package/dist/types/src/fragments/size.d.ts +0 -9
- package/dist/types/src/fragments/size.d.ts.map +0 -1
- package/dist/types/src/fragments/valence.d.ts +0 -4
- package/dist/types/src/fragments/valence.d.ts.map +0 -1
- package/src/fragments/focus.ts +0 -11
- package/src/fragments/size.ts +0 -123
- /package/dist/types/src/{fragments → util}/elevation.d.ts +0 -0
- /package/src/{fragments → util}/elevation.ts +0 -0
- /package/src/{fragments → util}/valence.ts +0 -0
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentFunction, type Elevation, type MessageValence, type Theme } from '@dxos/ui-types';
|
|
6
6
|
|
|
7
|
-
import { messageValence } from '../../
|
|
8
|
-
import { mx } from '../../util';
|
|
7
|
+
import { mx, messageValence } from '../../util';
|
|
9
8
|
|
|
10
9
|
export type MessageStyleProps = {
|
|
11
10
|
valence?: MessageValence;
|
|
@@ -13,23 +12,23 @@ export type MessageStyleProps = {
|
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export const messageRoot: ComponentFunction<MessageStyleProps> = ({ valence }, etc) => {
|
|
16
|
-
return mx('grid grid-cols-[
|
|
15
|
+
return mx('grid grid-cols-[2rem_1fr_2rem] p-1 rounded-sm', messageValence(valence), etc);
|
|
17
16
|
};
|
|
18
17
|
|
|
19
18
|
export const messageHeader: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
20
|
-
return mx('col-span-
|
|
19
|
+
return mx('col-span-full grid grid-cols-subgrid items-center', etc);
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
export const messageTitle: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
24
|
-
return mx('col-start-2
|
|
23
|
+
return mx('col-start-2 truncate', etc);
|
|
25
24
|
};
|
|
26
25
|
|
|
27
26
|
export const messageIcon: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
28
|
-
return mx('col-start-1', etc);
|
|
27
|
+
return mx('col-start-1 grid place-items-center', etc);
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
export const messageContent: ComponentFunction<MessageStyleProps> = (_, etc) => {
|
|
32
|
-
return mx('grid grid-cols-subgrid
|
|
31
|
+
return mx('col-start-2 grid grid-cols-subgrid inline first:font-medium', etc);
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
export const messageTheme: Theme<MessageStyleProps> = {
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { mx } from '../../util';
|
|
7
|
+
import { mx, surfaceShadow, surfaceZIndex } from '../../util';
|
|
9
8
|
|
|
10
9
|
export type PopoverStyleProps = Partial<{
|
|
11
10
|
constrainBlock: boolean;
|
|
@@ -18,15 +17,15 @@ export const popoverContent: ComponentFunction<PopoverStyleProps> = ({ elevation
|
|
|
18
17
|
'dx-modal-surface border border-separator rounded-sm',
|
|
19
18
|
surfaceShadow({ elevation: 'positioned' }),
|
|
20
19
|
surfaceZIndex({ elevation, level: 'menu' }),
|
|
21
|
-
|
|
20
|
+
'dx-focus-ring',
|
|
22
21
|
...etc,
|
|
23
22
|
);
|
|
24
23
|
|
|
25
24
|
export const popoverViewport: ComponentFunction<PopoverStyleProps> = ({ constrainBlock, constrainInline }, ...etc) =>
|
|
26
25
|
mx(
|
|
27
|
-
'
|
|
26
|
+
'grid grid-rows-[1fr] min-h-0 min-w-popover-min-width',
|
|
28
27
|
(constrainBlock || constrainInline) && 'overflow-hidden',
|
|
29
|
-
|
|
28
|
+
constrainBlock && 'max-h-(--radix-popover-content-available-height)',
|
|
30
29
|
constrainBlock &&
|
|
31
30
|
'max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-var(--spacing-screen-border)*2))]',
|
|
32
31
|
constrainInline && 'max-w-(--radix-popover-content-available-width)',
|
|
@@ -5,12 +5,24 @@
|
|
|
5
5
|
import { type AllowedAxis, type ComponentFunction, type Theme } from '@dxos/ui-types';
|
|
6
6
|
|
|
7
7
|
import { mx } from '../../util';
|
|
8
|
+
import { withColumn } from '../primitives/column';
|
|
9
|
+
|
|
10
|
+
export const scrollbar = {
|
|
11
|
+
thin: {
|
|
12
|
+
size: 4,
|
|
13
|
+
padding: 4,
|
|
14
|
+
},
|
|
15
|
+
coarse: {
|
|
16
|
+
size: 8,
|
|
17
|
+
padding: 8,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
8
20
|
|
|
9
21
|
export type ScrollAreaStyleProps = {
|
|
10
22
|
orientation?: AllowedAxis;
|
|
11
23
|
autoHide?: boolean;
|
|
12
|
-
/** Balance left/right, top/bottom
|
|
13
|
-
|
|
24
|
+
/** Balance left/right, top/bottom offset with scrollbar. */
|
|
25
|
+
centered?: boolean;
|
|
14
26
|
/** Add default padding. */
|
|
15
27
|
/** TODO(burdon): Integrate with Column.Root padding. */
|
|
16
28
|
padding?: boolean;
|
|
@@ -21,29 +33,17 @@ export type ScrollAreaStyleProps = {
|
|
|
21
33
|
snap?: boolean;
|
|
22
34
|
};
|
|
23
35
|
|
|
24
|
-
export const scrollAreaRoot: ComponentFunction<ScrollAreaStyleProps> = ({ orientation
|
|
36
|
+
export const scrollAreaRoot: ComponentFunction<ScrollAreaStyleProps> = ({ orientation }, ...etc) =>
|
|
25
37
|
mx(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
orientation === '
|
|
30
|
-
orientation === '
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// Apply col-span-full only when inside a Column.Root grid (detected via dx-column marker).
|
|
34
|
-
'[.dx-
|
|
35
|
-
|
|
36
|
-
// NOTE: Uses --gutter CSS variable
|
|
37
|
-
// If contained within Column.Root grid, the gutter is set by that component.
|
|
38
|
-
margin && [
|
|
39
|
-
orientation === 'vertical' &&
|
|
40
|
-
(thin
|
|
41
|
-
? 'pl-[var(--gutter,4px)] pr-[calc(var(--gutter,4px)-4px)]'
|
|
42
|
-
: 'pl-[var(--gutter,8px)] pr-[calc(var(--gutter,8px)-8px)]'),
|
|
43
|
-
orientation === 'horizontal' && (thin ? 'py-[var(--gutter,4px)]' : 'py-[var(--gutter,8px)]'),
|
|
44
|
-
orientation === 'all' &&
|
|
45
|
-
(thin ? 'pl-[var(--gutter,4px)] py-[var(--gutter,8px)]' : 'pl-[var(--gutter,8px)] py-[var(--gutter,8px)]'),
|
|
46
|
-
],
|
|
38
|
+
// Expand
|
|
39
|
+
'dx-container',
|
|
40
|
+
|
|
41
|
+
orientation === 'vertical' && 'group/scroll-v flex flex-col',
|
|
42
|
+
orientation === 'horizontal' && 'group/scroll-h flex',
|
|
43
|
+
orientation === 'all' && 'group/scroll-all',
|
|
44
|
+
|
|
45
|
+
// Apply col-span-full only when inside a Column.Root grid (detected via dx-column-root marker).
|
|
46
|
+
'[.dx-column-root_&]:col-span-full',
|
|
47
47
|
|
|
48
48
|
...etc,
|
|
49
49
|
);
|
|
@@ -52,24 +52,47 @@ export const scrollAreaRoot: ComponentFunction<ScrollAreaStyleProps> = ({ orient
|
|
|
52
52
|
* NOTE: The browser reserves space for scrollbars.
|
|
53
53
|
*/
|
|
54
54
|
export const scrollAreaViewport: ComponentFunction<ScrollAreaStyleProps> = (
|
|
55
|
-
{ orientation,
|
|
55
|
+
{ orientation, centered, padding, snap, autoHide },
|
|
56
56
|
...etc
|
|
57
|
-
) =>
|
|
58
|
-
mx(
|
|
59
|
-
'h-
|
|
57
|
+
) => {
|
|
58
|
+
return mx(
|
|
59
|
+
'flex-1 min-h-0 w-full',
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
// Reset --dx-col so nested components don't try to grid-position themselves.
|
|
62
|
+
// ScrollArea has already consumed --gutter for padding.
|
|
63
|
+
withColumn.consumed(),
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
orientation === 'vertical' && 'overflow-y-scroll',
|
|
66
|
+
orientation === 'horizontal' && 'flex overflow-x-scroll overscroll-x-contain',
|
|
67
|
+
orientation === 'all' && 'overflow-scroll',
|
|
68
68
|
|
|
69
69
|
'[&::-webkit-scrollbar-corner]:bg-transparent',
|
|
70
70
|
'[&::-webkit-scrollbar-track]:bg-transparent',
|
|
71
71
|
'[&::-webkit-scrollbar-thumb]:rounded-none',
|
|
72
72
|
|
|
73
|
+
'[&::-webkit-scrollbar]:w-[var(--scroll-width)] [&::-webkit-scrollbar]:h-[var(--scroll-width)]',
|
|
74
|
+
|
|
75
|
+
// If contained within Column.Root grid the gutter is set by that component (--gutter CSS variable).
|
|
76
|
+
// If centered, left padding compensates for scrollbar width so content is visually centered.
|
|
77
|
+
(orientation === 'vertical' || orientation === 'all') &&
|
|
78
|
+
(padding
|
|
79
|
+
? [
|
|
80
|
+
centered ? 'pl-[var(--gutter,calc(var(--scroll-width)+var(--scroll-padding)))]' : 'pl-[var(--gutter,0)]',
|
|
81
|
+
'pr-[calc(var(--gutter,calc(var(--scroll-width)+var(--scroll-padding)))-var(--scroll-width))]',
|
|
82
|
+
]
|
|
83
|
+
: centered && 'pl-[var(--scroll-width)]'),
|
|
84
|
+
|
|
85
|
+
(orientation === 'horizontal' || orientation === 'all') &&
|
|
86
|
+
(padding
|
|
87
|
+
? [centered && 'pt-[calc(var(--scroll-width)+var(--scroll-padding))]', 'pb-[var(--scroll-padding)]']
|
|
88
|
+
: centered && 'pt-[var(--scroll-width)]'),
|
|
89
|
+
|
|
90
|
+
snap && [
|
|
91
|
+
orientation === 'vertical' && 'snap-y snap-mandatory',
|
|
92
|
+
orientation === 'horizontal' && 'snap-x snap-mandatory',
|
|
93
|
+
orientation === 'all' && 'snap-both snap-mandatory',
|
|
94
|
+
],
|
|
95
|
+
|
|
73
96
|
autoHide
|
|
74
97
|
? [
|
|
75
98
|
orientation === 'vertical' && 'group-hover/scroll-v:[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
@@ -82,20 +105,9 @@ export const scrollAreaViewport: ComponentFunction<ScrollAreaStyleProps> = (
|
|
|
82
105
|
orientation === 'all' && '[&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb',
|
|
83
106
|
],
|
|
84
107
|
|
|
85
|
-
padding && [
|
|
86
|
-
orientation === 'vertical' && 'px-[4px]',
|
|
87
|
-
orientation === 'horizontal' && 'pb-[4px]',
|
|
88
|
-
orientation === 'all' && 'pl-[4px] pb-[4px]',
|
|
89
|
-
],
|
|
90
|
-
|
|
91
|
-
snap && [
|
|
92
|
-
orientation === 'vertical' && 'snap-y snap-mandatory',
|
|
93
|
-
orientation === 'horizontal' && 'snap-x snap-mandatory',
|
|
94
|
-
orientation === 'all' && 'snap-both snap-mandatory',
|
|
95
|
-
],
|
|
96
|
-
|
|
97
108
|
...etc,
|
|
98
109
|
);
|
|
110
|
+
};
|
|
99
111
|
|
|
100
112
|
export const scrollAreaTheme: Theme<ScrollAreaStyleProps> = {
|
|
101
113
|
root: scrollAreaRoot,
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
|
|
6
6
|
|
|
7
|
-
import { surfaceShadow, surfaceZIndex } from '../../
|
|
8
|
-
import { mx } from '../../util';
|
|
7
|
+
import { mx, surfaceShadow, surfaceZIndex } from '../../util';
|
|
9
8
|
|
|
10
9
|
export type SelectStyleProps = Partial<{
|
|
11
10
|
elevation: Elevation;
|
|
@@ -26,7 +25,7 @@ export const selectViewport: ComponentFunction<SelectStyleProps> = (_props, ...e
|
|
|
26
25
|
export const selectItem: ComponentFunction<SelectStyleProps> = (_props, ...etc) =>
|
|
27
26
|
mx(
|
|
28
27
|
'flex items-center min-h-[2rem] px-3 py-1 gap-2',
|
|
29
|
-
'text-base-
|
|
28
|
+
'text-base-foreground leading-none select-none outline-hidden',
|
|
30
29
|
'[&>svg]:invisible [&[data-state=checked]>svg]:visible',
|
|
31
30
|
'dx-highlighted',
|
|
32
31
|
...etc,
|
|
@@ -7,21 +7,21 @@ import type { ComponentFunction, Theme } from '@dxos/ui-types';
|
|
|
7
7
|
import { mx } from '../../util';
|
|
8
8
|
|
|
9
9
|
export type StatusStyleProps = {
|
|
10
|
-
indeterminate?: boolean;
|
|
11
10
|
variant?: 'default' | 'main-bottom';
|
|
11
|
+
indeterminate?: boolean;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export const statusRoot: ComponentFunction<StatusStyleProps> = ({ variant = 'default' }, ...etc) =>
|
|
15
15
|
mx(
|
|
16
|
-
'h-1 relative
|
|
17
|
-
variant === 'main-bottom' ? 'w-full block' : 'inline-20 inline-block',
|
|
16
|
+
'h-1 relative rounded-full overflow-hidden',
|
|
17
|
+
variant === 'main-bottom' ? 'w-full block' : 'inline-20 inline-block bg-base-surface',
|
|
18
18
|
...etc,
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
export const statusBar: ComponentFunction<StatusStyleProps> = ({
|
|
21
|
+
export const statusBar: ComponentFunction<StatusStyleProps> = ({ variant = 'default', indeterminate }, ...etc) =>
|
|
22
22
|
mx(
|
|
23
23
|
'absolute inset-y-0 block rounded-full',
|
|
24
|
-
variant === 'main-bottom' ? 'bg-
|
|
24
|
+
variant === 'main-bottom' ? 'bg-composer-300' : 'bg-un-accent',
|
|
25
25
|
indeterminate ? 'animate-progress-indeterminate' : 'start-0',
|
|
26
26
|
...etc,
|
|
27
27
|
);
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentFunction, type Theme } from '@dxos/ui-types';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { mx } from '../../util';
|
|
7
|
+
import { mx, surfaceShadow } from '../../util';
|
|
9
8
|
|
|
10
9
|
export type ToastStyleProps = Partial<{
|
|
11
10
|
srOnly: boolean;
|
|
@@ -28,7 +27,7 @@ export const toastRoot: ComponentFunction<ToastStyleProps> = (_props, ...etc) =>
|
|
|
28
27
|
'radix-swipe-end:animate-toast-swipe-out',
|
|
29
28
|
'translate-x-radix-toast-swipe-move-x',
|
|
30
29
|
'radix-swipe-cancel:translate-x-0 radix-swipe-cancel:duration-200 radix-swipe-cancel:ease-[ease]',
|
|
31
|
-
|
|
30
|
+
'dx-focus-ring',
|
|
32
31
|
...etc,
|
|
33
32
|
);
|
|
34
33
|
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentFunction, type Elevation, type Theme } from '@dxos/ui-types';
|
|
6
6
|
|
|
7
|
-
import { surfaceShadow, surfaceZIndex } from '../../
|
|
8
|
-
import { mx } from '../../util';
|
|
7
|
+
import { mx, surfaceShadow, surfaceZIndex } from '../../util';
|
|
9
8
|
|
|
10
9
|
export type TooltipStyleProps = Partial<{
|
|
11
10
|
elevation: Elevation;
|
|
@@ -13,7 +12,7 @@ export type TooltipStyleProps = Partial<{
|
|
|
13
12
|
|
|
14
13
|
export const tooltipContent: ComponentFunction<TooltipStyleProps> = ({ elevation }, ...etc) =>
|
|
15
14
|
mx(
|
|
16
|
-
'inline-flex items-center p-1 max-w-64 text-sm bg-inverse-surface text-inverse-
|
|
15
|
+
'inline-flex items-center p-1 max-w-64 text-sm bg-inverse-surface text-inverse-foreground rounded-sm',
|
|
17
16
|
surfaceShadow({ elevation: 'positioned' }),
|
|
18
17
|
surfaceZIndex({ elevation, level: 'tooltip' }),
|
|
19
18
|
...etc,
|
|
@@ -25,7 +25,7 @@ const levelStyles = new Map<number, string>([
|
|
|
25
25
|
export const treegridRoot: ComponentFunction<TreegridStyleProps> = (_, ...etc) => mx('grid', ...etc);
|
|
26
26
|
|
|
27
27
|
export const treegridRow: ComponentFunction<TreegridStyleProps> = ({ level = 1 }, ...etc) =>
|
|
28
|
-
mx(
|
|
28
|
+
mx(levelStyles.get(Math.min(Math.max(Math.round(level), 1), 8)), ...etc);
|
|
29
29
|
|
|
30
30
|
export const treegridCell: ComponentFunction<TreegridStyleProps> = ({ indent }, ...etc) =>
|
|
31
31
|
mx(indent && 'indent', ...etc);
|
package/src/theme/index.ts
CHANGED
|
@@ -6,25 +6,66 @@ import { type ComponentFunction } from '@dxos/ui-types';
|
|
|
6
6
|
|
|
7
7
|
import { mx } from '../../util';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Column-aware theme utilities.
|
|
11
|
+
* Components apply these in their theme functions to participate in the Column grid
|
|
12
|
+
* without importing Column React components.
|
|
13
|
+
*
|
|
14
|
+
* CSS custom property cascade:
|
|
15
|
+
* - Column.Root sets `--dx-col: 2 / span 1` (center column placement).
|
|
16
|
+
* - ScrollArea.Viewport resets `--dx-col: auto` after consuming `--gutter`.
|
|
17
|
+
* - Components apply `grid-column: var(--dx-col, auto)` to auto-center in Column
|
|
18
|
+
* or do nothing outside Column / inside ScrollArea.
|
|
19
|
+
*/
|
|
20
|
+
export const withColumn = {
|
|
21
|
+
/** Centers element in the Column grid via --dx-col. No-op outside Column or inside ScrollArea. */
|
|
22
|
+
center: () => '[grid-column:var(--dx-col,auto)]',
|
|
23
|
+
|
|
24
|
+
/** Propagates the Column grid to children via subgrid. No-op outside Column.
|
|
25
|
+
* Direct children default to center column unless they are a dx-container (ScrollArea). */
|
|
26
|
+
propagate: () =>
|
|
27
|
+
'[.dx-column-root_&]:col-span-full [.dx-column-root_&]:grid [.dx-column-root_&]:grid-cols-subgrid [.dx-column-root_&]:[&>*:not(.dx-container)]:[grid-column:var(--dx-col,auto)]',
|
|
28
|
+
|
|
29
|
+
/** Resets --dx-col after consuming --gutter. Applied by ScrollArea.Viewport. */
|
|
30
|
+
consumed: () => '[--dx-col:auto]',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type ColumnStyleProps = {};
|
|
34
|
+
|
|
35
|
+
const columnRoot: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
36
|
+
return mx('dx-column-root grid', ...etc);
|
|
37
|
+
};
|
|
10
38
|
|
|
11
39
|
/**
|
|
12
40
|
* Three-column icon-slot row: spans all 3 columns of the parent Column.Root grid.
|
|
13
41
|
* Uses CSS subgrid to inherit column sizing from the parent Column.
|
|
14
42
|
* Children map to: [col-1: icon/slot] [col-2: content] [col-3: icon/action].
|
|
43
|
+
* NOTE: Must not use overflow-hidden here since it will clip input focus rings.
|
|
15
44
|
*/
|
|
16
|
-
const columnRow: ComponentFunction<
|
|
17
|
-
mx('col-span-3 grid grid-cols-subgrid', ...etc);
|
|
45
|
+
const columnRow: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
46
|
+
return mx('col-span-3 grid grid-cols-subgrid', ...etc);
|
|
47
|
+
};
|
|
18
48
|
|
|
19
49
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
50
|
+
* Bleed placement: spans all 3 columns of the parent Column.Root grid (gutter-to-gutter).
|
|
51
|
+
* Use for `ScrollArea`, full-width dividers, tables, or any content that should ignore gutters.
|
|
52
|
+
*/
|
|
53
|
+
const columnBleed: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
54
|
+
return mx('col-span-full grid grid-cols-subgrid min-h-0', ...etc);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Center placement: places the element in column 2 (the central track between gutters) of the
|
|
59
|
+
* parent Column.Root grid. Does NOT use subgrid — placement is explicit on this element only.
|
|
60
|
+
* Safe to nest arbitrary compound components (including those that render `display: contents`).
|
|
22
61
|
*/
|
|
23
|
-
const
|
|
24
|
-
mx('
|
|
62
|
+
const columnCenter: ComponentFunction<ColumnStyleProps> = (_, ...etc) => {
|
|
63
|
+
return mx(withColumn.center(), 'min-h-0', ...etc);
|
|
64
|
+
};
|
|
25
65
|
|
|
26
66
|
export const columnTheme = {
|
|
27
67
|
root: columnRoot,
|
|
28
68
|
row: columnRow,
|
|
29
|
-
|
|
69
|
+
bleed: columnBleed,
|
|
70
|
+
center: columnCenter,
|
|
30
71
|
};
|
|
@@ -6,41 +6,34 @@ import { type ComponentFunction } from '@dxos/ui-types';
|
|
|
6
6
|
|
|
7
7
|
import { mx } from '../../util';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type Size = 'lg' | 'md' | 'sm';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
export type PanelStyleProps = {
|
|
12
|
+
size?: Size;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const sizes: Record<Size, string> = {
|
|
16
|
+
lg: 'h-(--dx-topbar-size)',
|
|
17
|
+
md: 'h-(--dx-toolbar-size)',
|
|
18
|
+
sm: 'h-(--dx-statusbar-size)',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const panelRoot: ComponentFunction<PanelStyleProps> = (_, ...etc) =>
|
|
12
22
|
mx(
|
|
13
23
|
// prettier-ignore
|
|
14
|
-
'
|
|
24
|
+
'dx-container grid grid-cols-[100%] overflow-hidden',
|
|
15
25
|
// Add uncategorized children to content slot.
|
|
16
26
|
'[&>*:not([data-slot])]:[grid-area:content]',
|
|
17
27
|
...etc,
|
|
18
28
|
);
|
|
19
29
|
|
|
20
|
-
const panelToolbar: ComponentFunction<
|
|
21
|
-
mx(
|
|
22
|
-
// prettier-ignore
|
|
23
|
-
'[grid-area:toolbar]',
|
|
24
|
-
'h-(--dx-toolbar-size)', // TODO(burdon): Option.
|
|
25
|
-
'[.dx-main-mobile-layout_&]:px-3',
|
|
26
|
-
// 'border-b border-subdued-separator relative',
|
|
27
|
-
...etc,
|
|
28
|
-
);
|
|
30
|
+
const panelToolbar: ComponentFunction<PanelStyleProps> = ({ size = 'md' }, ...etc) =>
|
|
31
|
+
mx('[grid-area:toolbar]', 'shrink-0', sizes[size], ...etc);
|
|
29
32
|
|
|
30
|
-
const panelContent: ComponentFunction<
|
|
31
|
-
mx(
|
|
32
|
-
// prettier-ignore
|
|
33
|
-
'[grid-area:content] overflow-hidden min-h-0',
|
|
34
|
-
...etc,
|
|
35
|
-
);
|
|
33
|
+
const panelContent: ComponentFunction<PanelStyleProps> = (_, ...etc) => mx('[grid-area:content] min-h-0', ...etc);
|
|
36
34
|
|
|
37
|
-
const panelStatusbar: ComponentFunction<
|
|
38
|
-
mx(
|
|
39
|
-
// prettier-ignore
|
|
40
|
-
'[grid-area:statusbar]',
|
|
41
|
-
'h-(--dx-statusbar-size)', // TODO(burdon): Option.
|
|
42
|
-
...etc,
|
|
43
|
-
);
|
|
35
|
+
const panelStatusbar: ComponentFunction<PanelStyleProps> = ({ size = 'md' }, ...etc) =>
|
|
36
|
+
mx('[grid-area:statusbar]', 'shrink-0', sizes[size], ...etc);
|
|
44
37
|
|
|
45
38
|
export const panelTheme = {
|
|
46
39
|
root: panelRoot,
|
package/src/theme/theme.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
buttonTheme,
|
|
12
12
|
cardTheme,
|
|
13
13
|
dialogTheme,
|
|
14
|
+
focusTheme,
|
|
14
15
|
iconButtonTheme,
|
|
15
16
|
iconTheme,
|
|
16
17
|
inputTheme,
|
|
@@ -53,6 +54,7 @@ export const defaultTheme: Theme<Record<string, any>> = {
|
|
|
53
54
|
button: buttonTheme,
|
|
54
55
|
card: cardTheme,
|
|
55
56
|
dialog: dialogTheme,
|
|
57
|
+
focus: focusTheme,
|
|
56
58
|
icon: iconTheme,
|
|
57
59
|
iconButton: iconButtonTheme,
|
|
58
60
|
input: inputTheme,
|
package/src/typings.d.ts
CHANGED
package/src/util/hash-styles.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type ColorStyles = {
|
|
|
11
11
|
hue: Hue;
|
|
12
12
|
fill: string; // -fill
|
|
13
13
|
surface: string; // -surface
|
|
14
|
-
|
|
14
|
+
foreground: string; // -foreground
|
|
15
15
|
text: string; // -text
|
|
16
16
|
border: string; // -border
|
|
17
17
|
};
|
|
@@ -20,7 +20,7 @@ const neutral: ColorStyles = {
|
|
|
20
20
|
hue: 'neutral',
|
|
21
21
|
fill: 'bg-neutral-fill',
|
|
22
22
|
surface: 'bg-neutral-surface',
|
|
23
|
-
|
|
23
|
+
foreground: 'text-neutral-foreground',
|
|
24
24
|
text: 'text-neutral-text',
|
|
25
25
|
border: 'border-neutral-border',
|
|
26
26
|
};
|
|
@@ -32,7 +32,7 @@ const styles: ColorStyles[] = [
|
|
|
32
32
|
hue: 'red',
|
|
33
33
|
fill: 'bg-red-fill',
|
|
34
34
|
surface: 'bg-red-surface',
|
|
35
|
-
|
|
35
|
+
foreground: 'text-red-foreground',
|
|
36
36
|
text: 'text-red-text',
|
|
37
37
|
border: 'border-red-border',
|
|
38
38
|
},
|
|
@@ -40,7 +40,7 @@ const styles: ColorStyles[] = [
|
|
|
40
40
|
hue: 'orange',
|
|
41
41
|
fill: 'bg-orange-fill',
|
|
42
42
|
surface: 'bg-orange-surface',
|
|
43
|
-
|
|
43
|
+
foreground: 'text-orange-foreground',
|
|
44
44
|
text: 'text-orange-text',
|
|
45
45
|
border: 'border-orange-border',
|
|
46
46
|
},
|
|
@@ -48,7 +48,7 @@ const styles: ColorStyles[] = [
|
|
|
48
48
|
hue: 'amber',
|
|
49
49
|
fill: 'bg-amber-fill',
|
|
50
50
|
surface: 'bg-amber-surface',
|
|
51
|
-
|
|
51
|
+
foreground: 'text-amber-foreground',
|
|
52
52
|
text: 'text-amber-text',
|
|
53
53
|
border: 'border-amber-border',
|
|
54
54
|
},
|
|
@@ -56,7 +56,7 @@ const styles: ColorStyles[] = [
|
|
|
56
56
|
hue: 'yellow',
|
|
57
57
|
fill: 'bg-yellow-fill',
|
|
58
58
|
surface: 'bg-yellow-surface',
|
|
59
|
-
|
|
59
|
+
foreground: 'text-yellow-foreground',
|
|
60
60
|
text: 'text-yellow-text',
|
|
61
61
|
border: 'border-yellow-border',
|
|
62
62
|
},
|
|
@@ -64,7 +64,7 @@ const styles: ColorStyles[] = [
|
|
|
64
64
|
hue: 'lime',
|
|
65
65
|
fill: 'bg-lime-fill',
|
|
66
66
|
surface: 'bg-lime-surface',
|
|
67
|
-
|
|
67
|
+
foreground: 'text-lime-foreground',
|
|
68
68
|
text: 'text-lime-text',
|
|
69
69
|
border: 'border-lime-border',
|
|
70
70
|
},
|
|
@@ -72,7 +72,7 @@ const styles: ColorStyles[] = [
|
|
|
72
72
|
hue: 'green',
|
|
73
73
|
fill: 'bg-green-fill',
|
|
74
74
|
surface: 'bg-green-surface',
|
|
75
|
-
|
|
75
|
+
foreground: 'text-green-foreground',
|
|
76
76
|
text: 'text-green-text',
|
|
77
77
|
border: 'border-green-border',
|
|
78
78
|
},
|
|
@@ -80,7 +80,7 @@ const styles: ColorStyles[] = [
|
|
|
80
80
|
hue: 'emerald',
|
|
81
81
|
fill: 'bg-emerald-fill',
|
|
82
82
|
surface: 'bg-emerald-surface',
|
|
83
|
-
|
|
83
|
+
foreground: 'text-emerald-foreground',
|
|
84
84
|
text: 'text-emerald-text',
|
|
85
85
|
border: 'border-emerald-border',
|
|
86
86
|
},
|
|
@@ -88,7 +88,7 @@ const styles: ColorStyles[] = [
|
|
|
88
88
|
hue: 'teal',
|
|
89
89
|
fill: 'bg-teal-fill',
|
|
90
90
|
surface: 'bg-teal-surface',
|
|
91
|
-
|
|
91
|
+
foreground: 'text-teal-foreground',
|
|
92
92
|
text: 'text-teal-text',
|
|
93
93
|
border: 'border-teal-border',
|
|
94
94
|
},
|
|
@@ -96,7 +96,7 @@ const styles: ColorStyles[] = [
|
|
|
96
96
|
hue: 'cyan',
|
|
97
97
|
fill: 'bg-cyan-fill',
|
|
98
98
|
surface: 'bg-cyan-surface',
|
|
99
|
-
|
|
99
|
+
foreground: 'text-cyan-foreground',
|
|
100
100
|
text: 'text-cyan-text',
|
|
101
101
|
border: 'border-cyan-border',
|
|
102
102
|
},
|
|
@@ -104,7 +104,7 @@ const styles: ColorStyles[] = [
|
|
|
104
104
|
hue: 'sky',
|
|
105
105
|
fill: 'bg-sky-fill',
|
|
106
106
|
surface: 'bg-sky-surface',
|
|
107
|
-
|
|
107
|
+
foreground: 'text-sky-foreground',
|
|
108
108
|
text: 'text-sky-text',
|
|
109
109
|
border: 'border-sky-border',
|
|
110
110
|
},
|
|
@@ -112,7 +112,7 @@ const styles: ColorStyles[] = [
|
|
|
112
112
|
hue: 'blue',
|
|
113
113
|
fill: 'bg-blue-fill',
|
|
114
114
|
surface: 'bg-blue-surface',
|
|
115
|
-
|
|
115
|
+
foreground: 'text-blue-foreground',
|
|
116
116
|
text: 'text-blue-text',
|
|
117
117
|
border: 'border-blue-border',
|
|
118
118
|
},
|
|
@@ -120,7 +120,7 @@ const styles: ColorStyles[] = [
|
|
|
120
120
|
hue: 'indigo',
|
|
121
121
|
fill: 'bg-indigo-fill',
|
|
122
122
|
surface: 'bg-indigo-surface',
|
|
123
|
-
|
|
123
|
+
foreground: 'text-indigo-foreground',
|
|
124
124
|
text: 'text-indigo-text',
|
|
125
125
|
border: 'border-indigo-border',
|
|
126
126
|
},
|
|
@@ -128,7 +128,7 @@ const styles: ColorStyles[] = [
|
|
|
128
128
|
hue: 'violet',
|
|
129
129
|
fill: 'bg-violet-fill',
|
|
130
130
|
surface: 'bg-violet-surface',
|
|
131
|
-
|
|
131
|
+
foreground: 'text-violet-foreground',
|
|
132
132
|
text: 'text-violet-text',
|
|
133
133
|
border: 'border-violet-border',
|
|
134
134
|
},
|
|
@@ -136,7 +136,7 @@ const styles: ColorStyles[] = [
|
|
|
136
136
|
hue: 'purple',
|
|
137
137
|
fill: 'bg-purple-fill',
|
|
138
138
|
surface: 'bg-purple-surface',
|
|
139
|
-
|
|
139
|
+
foreground: 'text-purple-foreground',
|
|
140
140
|
text: 'text-purple-text',
|
|
141
141
|
border: 'border-purple-border',
|
|
142
142
|
},
|
|
@@ -144,7 +144,7 @@ const styles: ColorStyles[] = [
|
|
|
144
144
|
hue: 'fuchsia',
|
|
145
145
|
fill: 'bg-fuchsia-fill',
|
|
146
146
|
surface: 'bg-fuchsia-surface',
|
|
147
|
-
|
|
147
|
+
foreground: 'text-fuchsia-foreground',
|
|
148
148
|
text: 'text-fuchsia-text',
|
|
149
149
|
border: 'border-fuchsia-border',
|
|
150
150
|
},
|
|
@@ -152,7 +152,7 @@ const styles: ColorStyles[] = [
|
|
|
152
152
|
hue: 'pink',
|
|
153
153
|
fill: 'bg-pink-fill',
|
|
154
154
|
surface: 'bg-pink-surface',
|
|
155
|
-
|
|
155
|
+
foreground: 'text-pink-foreground',
|
|
156
156
|
text: 'text-pink-text',
|
|
157
157
|
border: 'border-pink-border',
|
|
158
158
|
},
|
|
@@ -160,7 +160,7 @@ const styles: ColorStyles[] = [
|
|
|
160
160
|
hue: 'rose',
|
|
161
161
|
fill: 'bg-rose-fill',
|
|
162
162
|
surface: 'bg-rose-surface',
|
|
163
|
-
|
|
163
|
+
foreground: 'text-rose-foreground',
|
|
164
164
|
text: 'text-rose-text',
|
|
165
165
|
border: 'border-rose-border',
|
|
166
166
|
},
|