@dxos/ui-theme 0.8.4-staging.ac66bdf99f → 0.9.0
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 +89 -867
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +89 -867
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/plugin/node-cjs/main.css +252 -119
- package/dist/plugin/node-cjs/main.css.map +3 -3
- package/dist/plugin/node-cjs/meta.json +1 -1
- package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs +82 -10
- package/dist/plugin/node-cjs/plugins/ThemePlugin.cjs.map +3 -3
- package/dist/plugin/node-esm/main.css +252 -119
- package/dist/plugin/node-esm/main.css.map +3 -3
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/plugin/node-esm/plugins/ThemePlugin.mjs +84 -12
- 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 +2 -2
- 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/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugins/ThemePlugin.d.ts +3 -2
- package/dist/types/src/plugins/ThemePlugin.d.ts.map +1 -1
- package/dist/types/src/util/hash-styles.d.ts +12 -2
- package/dist/types/src/util/hash-styles.d.ts.map +1 -1
- package/dist/types/src/util/mx.d.ts +0 -36
- package/dist/types/src/util/mx.d.ts.map +1 -1
- package/dist/types/src/util/size.d.ts.map +1 -1
- package/dist/types/src/util/valence.d.ts +8 -2
- package/dist/types/src/util/valence.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -21
- package/src/Theme.stories.tsx +94 -27
- package/src/css/DESIGN_SYSTEM.md +187 -0
- package/src/css/base/base.css +2 -2
- package/src/css/components/button.css +63 -13
- package/src/css/components/card.css +14 -0
- package/src/css/components/checkbox.css +3 -3
- package/src/css/components/focus.css +12 -12
- package/src/css/components/link.css +4 -1
- package/src/css/components/panel.css +45 -45
- package/src/css/components/state.css +99 -0
- package/src/css/components/state.md +101 -0
- package/src/css/components/surface.css +33 -11
- package/src/css/components/tag.css +25 -24
- package/src/css/integrations/codemirror.css +4 -3
- package/src/css/integrations/tldraw.css +1 -1
- package/src/css/layout/main.css +6 -0
- package/src/css/layout/size.css +16 -3
- package/src/css/theme/animation.css +31 -0
- package/src/css/theme/palette.css +34 -0
- package/src/css/theme/semantic.css +101 -60
- package/src/css/theme/spacing.css +29 -12
- package/src/css/theme/styles.css +172 -119
- package/src/css/utilities.css +42 -0
- package/src/defs.ts +3 -1
- package/src/fragments/AUDIT.md +0 -2
- package/src/fragments/density.ts +34 -7
- package/src/fragments/hover.ts +0 -2
- package/src/index.ts +1 -1
- package/src/main.css +68 -9
- package/src/plugins/ThemePlugin.ts +102 -14
- package/src/plugins/main.css +10 -7
- package/src/util/hash-styles.ts +54 -42
- package/src/util/mx.ts +1 -126
- package/src/util/valence.ts +15 -5
- package/dist/types/src/theme/components/avatar.d.ts +0 -21
- package/dist/types/src/theme/components/avatar.d.ts.map +0 -1
- package/dist/types/src/theme/components/breadcrumb.d.ts +0 -9
- package/dist/types/src/theme/components/breadcrumb.d.ts.map +0 -1
- package/dist/types/src/theme/components/button.d.ts +0 -15
- package/dist/types/src/theme/components/button.d.ts.map +0 -1
- package/dist/types/src/theme/components/card.d.ts +0 -12
- package/dist/types/src/theme/components/card.d.ts.map +0 -1
- package/dist/types/src/theme/components/dialog.d.ts +0 -17
- package/dist/types/src/theme/components/dialog.d.ts.map +0 -1
- package/dist/types/src/theme/components/focus.d.ts +0 -6
- package/dist/types/src/theme/components/focus.d.ts.map +0 -1
- package/dist/types/src/theme/components/icon-button.d.ts +0 -8
- package/dist/types/src/theme/components/icon-button.d.ts.map +0 -1
- package/dist/types/src/theme/components/icon.d.ts +0 -10
- package/dist/types/src/theme/components/icon.d.ts.map +0 -1
- package/dist/types/src/theme/components/index.d.ts +0 -27
- package/dist/types/src/theme/components/index.d.ts.map +0 -1
- package/dist/types/src/theme/components/input.d.ts +0 -115
- package/dist/types/src/theme/components/input.d.ts.map +0 -1
- package/dist/types/src/theme/components/link.d.ts +0 -7
- package/dist/types/src/theme/components/link.d.ts.map +0 -1
- package/dist/types/src/theme/components/list.d.ts +0 -14
- package/dist/types/src/theme/components/list.d.ts.map +0 -1
- package/dist/types/src/theme/components/main.d.ts +0 -28
- package/dist/types/src/theme/components/main.d.ts.map +0 -1
- package/dist/types/src/theme/components/menu.d.ts +0 -13
- package/dist/types/src/theme/components/menu.d.ts.map +0 -1
- package/dist/types/src/theme/components/message.d.ts +0 -12
- package/dist/types/src/theme/components/message.d.ts.map +0 -1
- package/dist/types/src/theme/components/popover.d.ts +0 -11
- package/dist/types/src/theme/components/popover.d.ts.map +0 -1
- package/dist/types/src/theme/components/scroll-area.d.ts +0 -32
- package/dist/types/src/theme/components/scroll-area.d.ts.map +0 -1
- package/dist/types/src/theme/components/select.d.ts +0 -13
- package/dist/types/src/theme/components/select.d.ts.map +0 -1
- package/dist/types/src/theme/components/separator.d.ts +0 -8
- package/dist/types/src/theme/components/separator.d.ts.map +0 -1
- package/dist/types/src/theme/components/skeleton.d.ts +0 -7
- package/dist/types/src/theme/components/skeleton.d.ts.map +0 -1
- package/dist/types/src/theme/components/splitter.d.ts +0 -4
- package/dist/types/src/theme/components/splitter.d.ts.map +0 -1
- package/dist/types/src/theme/components/status.d.ts +0 -9
- package/dist/types/src/theme/components/status.d.ts.map +0 -1
- package/dist/types/src/theme/components/tag.d.ts +0 -7
- package/dist/types/src/theme/components/tag.d.ts.map +0 -1
- package/dist/types/src/theme/components/toast.d.ts +0 -12
- package/dist/types/src/theme/components/toast.d.ts.map +0 -1
- package/dist/types/src/theme/components/toolbar.d.ts +0 -11
- package/dist/types/src/theme/components/toolbar.d.ts.map +0 -1
- package/dist/types/src/theme/components/tooltip.d.ts +0 -8
- package/dist/types/src/theme/components/tooltip.d.ts.map +0 -1
- package/dist/types/src/theme/components/treegrid.d.ts +0 -10
- package/dist/types/src/theme/components/treegrid.d.ts.map +0 -1
- package/dist/types/src/theme/index.d.ts +0 -4
- package/dist/types/src/theme/index.d.ts.map +0 -1
- package/dist/types/src/theme/primitives/column.d.ts +0 -29
- package/dist/types/src/theme/primitives/column.d.ts.map +0 -1
- package/dist/types/src/theme/primitives/index.d.ts +0 -3
- package/dist/types/src/theme/primitives/index.d.ts.map +0 -1
- package/dist/types/src/theme/primitives/panel.d.ts +0 -13
- package/dist/types/src/theme/primitives/panel.d.ts.map +0 -1
- package/dist/types/src/theme/theme.d.ts +0 -5
- package/dist/types/src/theme/theme.d.ts.map +0 -1
- package/src/css/components/selected.css +0 -30
- package/src/theme/components/avatar.ts +0 -95
- package/src/theme/components/breadcrumb.ts +0 -29
- package/src/theme/components/button.ts +0 -48
- package/src/theme/components/card.ts +0 -102
- package/src/theme/components/dialog.ts +0 -61
- package/src/theme/components/focus.ts +0 -33
- package/src/theme/components/icon-button.ts +0 -18
- package/src/theme/components/icon.ts +0 -28
- package/src/theme/components/index.ts +0 -30
- package/src/theme/components/input.ts +0 -171
- package/src/theme/components/link.ts +0 -25
- package/src/theme/components/list.ts +0 -46
- package/src/theme/components/main.ts +0 -34
- package/src/theme/components/menu.ts +0 -50
- package/src/theme/components/message.ts +0 -40
- package/src/theme/components/popover.ts +0 -41
- package/src/theme/components/scroll-area.ts +0 -115
- package/src/theme/components/select.ts +0 -52
- package/src/theme/components/separator.ts +0 -24
- package/src/theme/components/skeleton.ts +0 -23
- package/src/theme/components/splitter.ts +0 -20
- package/src/theme/components/status.ts +0 -32
- package/src/theme/components/tag.ts +0 -23
- package/src/theme/components/toast.ts +0 -53
- package/src/theme/components/toolbar.ts +0 -35
- package/src/theme/components/tooltip.ts +0 -27
- package/src/theme/components/treegrid.ts +0 -37
- package/src/theme/index.ts +0 -7
- package/src/theme/primitives/column.ts +0 -71
- package/src/theme/primitives/index.ts +0 -6
- package/src/theme/primitives/panel.ts +0 -43
- package/src/theme/theme.ts +0 -87
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
&:focus-visible {
|
|
15
|
-
@apply ring-focus-line ring-offset-focus-offset z-[1] ring-[var(--color-
|
|
15
|
+
@apply ring-focus-line ring-offset-focus-offset z-[1] ring-[var(--color-focus-ring-subtle)];
|
|
16
16
|
|
|
17
17
|
&[data-variant='primary'] {
|
|
18
|
-
@apply ring-[var(--color-
|
|
18
|
+
@apply ring-[var(--color-focus-ring)];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
&:hover {
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
&:focus {
|
|
48
|
-
@apply ring-focus-line ring-offset-focus-offset z-[1] ring-[var(--color-
|
|
48
|
+
@apply ring-focus-line ring-offset-focus-offset z-[1] ring-[var(--color-focus-ring-subtle)];
|
|
49
49
|
|
|
50
50
|
&[data-variant='primary'] {
|
|
51
|
-
@apply ring-[var(--color-
|
|
51
|
+
@apply ring-[var(--color-focus-ring)];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
&:hover {
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
.dx-focus-ring-group:focus-visible .dx-focus-ring-group-indicator,
|
|
80
80
|
.dx-focus-ring-group-x:focus-visible .dx-focus-ring-group-x-indicator,
|
|
81
81
|
.dx-focus-ring-group-y:focus-visible .dx-focus-ring-group-y-indicator {
|
|
82
|
-
@apply ring-focus-line ring-offset-focus-offset ring-[var(--color-
|
|
82
|
+
@apply ring-focus-line ring-offset-focus-offset ring-[var(--color-focus-ring-subtle)];
|
|
83
83
|
|
|
84
84
|
&[data-variant='primary'] {
|
|
85
|
-
@apply ring-[var(--color-
|
|
85
|
+
@apply ring-[var(--color-focus-ring)];
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
&:hover {
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
.dx-focus-ring-group-always:focus .dx-focus-ring-group-indicator,
|
|
98
98
|
.dx-focus-ring-group-x-always:focus .dx-focus-ring-group-x-indicator,
|
|
99
99
|
.dx-focus-ring-group-y-always:focus .dx-focus-ring-group-y-indicator {
|
|
100
|
-
@apply ring-focus-line ring-offset-focus-offset ring-[var(--color-
|
|
100
|
+
@apply ring-focus-line ring-offset-focus-offset ring-[var(--color-focus-ring-subtle)];
|
|
101
101
|
|
|
102
102
|
&[data-variant='primary'] {
|
|
103
|
-
@apply ring-[var(--color-
|
|
103
|
+
@apply ring-[var(--color-focus-ring)];
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
&:hover {
|
|
@@ -145,11 +145,11 @@
|
|
|
145
145
|
|
|
146
146
|
&:focus-visible {
|
|
147
147
|
&::after {
|
|
148
|
-
@apply ring-focus-line ring-offset-focus-offset ring-inset z-[1] ring-[var(--color-
|
|
148
|
+
@apply ring-focus-line ring-offset-focus-offset ring-inset z-[1] ring-[var(--color-focus-ring-subtle)];
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
&[data-variant='primary']::after {
|
|
152
|
-
@apply ring-[var(--color-
|
|
152
|
+
@apply ring-[var(--color-focus-ring)];
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
&:hover {
|
|
@@ -178,11 +178,11 @@
|
|
|
178
178
|
|
|
179
179
|
&:focus {
|
|
180
180
|
&::after {
|
|
181
|
-
@apply ring-focus-line ring-offset-focus-offset ring-inset z-[1] ring-[var(--color-
|
|
181
|
+
@apply ring-focus-line ring-offset-focus-offset ring-inset z-[1] ring-[var(--color-focus-ring-subtle)];
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
&[data-variant='primary']::after {
|
|
185
|
-
@apply ring-[var(--color-
|
|
185
|
+
@apply ring-[var(--color-focus-ring)];
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
&:hover {
|
|
@@ -1,117 +1,117 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Panel — applies bg-{hue}-surface / text-{hue}-
|
|
2
|
+
* Panel — applies bg-{hue}-surface / text-{hue}-fg / border-{hue}-border tokens via data-hue attribute or BEM modifier.
|
|
3
3
|
* Example: <div className='dx-panel' data-hue='blue'>...</div>
|
|
4
4
|
* Example: <div className='dx-panel dx-panel--blue'>...</div>
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
@layer dx-components {
|
|
8
|
-
|
|
8
|
+
[data-hue='neutral'] .dx-panel,
|
|
9
9
|
.dx-panel--neutral {
|
|
10
|
-
@apply bg-neutral-surface text-neutral-
|
|
10
|
+
@apply bg-neutral-surface text-neutral-fg border-neutral-border;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
[data-hue='red'] .dx-panel,
|
|
14
14
|
.dx-panel--red {
|
|
15
|
-
@apply bg-red-surface text-red-
|
|
15
|
+
@apply bg-red-surface text-red-fg border-red-border;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
[data-hue='orange'] .dx-panel,
|
|
19
19
|
.dx-panel--orange {
|
|
20
|
-
@apply bg-orange-surface text-orange-
|
|
20
|
+
@apply bg-orange-surface text-orange-fg border-orange-border;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
[data-hue='amber'] .dx-panel,
|
|
24
24
|
.dx-panel--amber {
|
|
25
|
-
@apply bg-amber-surface text-amber-
|
|
25
|
+
@apply bg-amber-surface text-amber-fg border-amber-border;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
[data-hue='yellow'] .dx-panel,
|
|
29
29
|
.dx-panel--yellow {
|
|
30
|
-
@apply bg-yellow-surface text-yellow-
|
|
30
|
+
@apply bg-yellow-surface text-yellow-fg border-yellow-border;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
[data-hue='lime'] .dx-panel,
|
|
34
34
|
.dx-panel--lime {
|
|
35
|
-
@apply bg-lime-surface text-lime-
|
|
35
|
+
@apply bg-lime-surface text-lime-fg border-lime-border;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
[data-hue='green'] .dx-panel,
|
|
39
39
|
.dx-panel--green {
|
|
40
|
-
@apply bg-green-surface text-green-
|
|
40
|
+
@apply bg-green-surface text-green-fg border-green-border;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
[data-hue='emerald'] .dx-panel,
|
|
44
44
|
.dx-panel--emerald {
|
|
45
|
-
@apply bg-emerald-surface text-emerald-
|
|
45
|
+
@apply bg-emerald-surface text-emerald-fg border-emerald-border;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
[data-hue='teal'] .dx-panel,
|
|
49
49
|
.dx-panel--teal {
|
|
50
|
-
@apply bg-teal-surface text-teal-
|
|
50
|
+
@apply bg-teal-surface text-teal-fg border-teal-border;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
[data-hue='cyan'] .dx-panel,
|
|
54
54
|
.dx-panel--cyan {
|
|
55
|
-
@apply bg-cyan-surface text-cyan-
|
|
55
|
+
@apply bg-cyan-surface text-cyan-fg border-cyan-border;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
[data-hue='sky'] .dx-panel,
|
|
59
59
|
.dx-panel--sky {
|
|
60
|
-
@apply bg-sky-surface text-sky-
|
|
60
|
+
@apply bg-sky-surface text-sky-fg border-sky-border;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
[data-hue='blue'] .dx-panel,
|
|
64
64
|
.dx-panel--blue {
|
|
65
|
-
@apply bg-blue-surface text-blue-
|
|
65
|
+
@apply bg-blue-surface text-blue-fg border-blue-border;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
[data-hue='indigo'] .dx-panel,
|
|
69
69
|
.dx-panel--indigo {
|
|
70
|
-
@apply bg-indigo-surface text-indigo-
|
|
70
|
+
@apply bg-indigo-surface text-indigo-fg border-indigo-border;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
[data-hue='violet'] .dx-panel,
|
|
74
74
|
.dx-panel--violet {
|
|
75
|
-
@apply bg-violet-surface text-violet-
|
|
75
|
+
@apply bg-violet-surface text-violet-fg border-violet-border;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
[data-hue='purple'] .dx-panel,
|
|
79
79
|
.dx-panel--purple {
|
|
80
|
-
@apply bg-purple-surface text-purple-
|
|
80
|
+
@apply bg-purple-surface text-purple-fg border-purple-border;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
[data-hue='fuchsia'] .dx-panel,
|
|
84
84
|
.dx-panel--fuchsia {
|
|
85
|
-
@apply bg-fuchsia-surface text-fuchsia-
|
|
85
|
+
@apply bg-fuchsia-surface text-fuchsia-fg border-fuchsia-border;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
[data-hue='pink'] .dx-panel,
|
|
89
89
|
.dx-panel--pink {
|
|
90
|
-
@apply bg-pink-surface text-pink-
|
|
90
|
+
@apply bg-pink-surface text-pink-fg border-pink-border;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
[data-hue='rose'] .dx-panel,
|
|
94
94
|
.dx-panel--rose {
|
|
95
|
-
@apply bg-rose-surface text-rose-
|
|
95
|
+
@apply bg-rose-surface text-rose-fg border-rose-border;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
[data-hue='info'] .dx-panel,
|
|
99
99
|
.dx-panel--info {
|
|
100
|
-
@apply bg-info-surface text-info-
|
|
100
|
+
@apply bg-info-surface text-info-fg border-info-border;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
[data-hue='success'] .dx-panel,
|
|
104
104
|
.dx-panel--success {
|
|
105
|
-
@apply bg-success-surface text-success-
|
|
105
|
+
@apply bg-success-surface text-success-fg border-success-border;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
[data-hue='warning'] .dx-panel,
|
|
109
109
|
.dx-panel--warning {
|
|
110
|
-
@apply bg-warning-surface text-warning-
|
|
110
|
+
@apply bg-warning-surface text-warning-fg border-warning-border;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
[data-hue='error'] .dx-panel,
|
|
114
114
|
.dx-panel--error {
|
|
115
|
-
@apply bg-error-surface text-error-
|
|
115
|
+
@apply bg-error-surface text-error-fg border-error-border;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selected / Current / Highlighted state utilities.
|
|
3
|
+
*
|
|
4
|
+
* See `./selected.md` for the ARIA pairing grammar — every class below
|
|
5
|
+
* fires off a specific attribute and silently does nothing without it.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@layer dx-components {
|
|
9
|
+
/*
|
|
10
|
+
* Pure visual affordance, no ARIA pair. Combine with dx-selected or dx-current.
|
|
11
|
+
*
|
|
12
|
+
* Picks the hover variant matching the element's underlying state:
|
|
13
|
+
* - neither aria-selected nor aria-current → hover-surface
|
|
14
|
+
* - aria-selected="true" → selected-surface-hover
|
|
15
|
+
* - aria-current="true" → current-surface-hover (wins if both)
|
|
16
|
+
*
|
|
17
|
+
* Higher-specificity rules (attribute selectors) override the plain :hover rule,
|
|
18
|
+
* and `aria-current` is listed last so it beats `aria-selected` at equal specificity.
|
|
19
|
+
*/
|
|
20
|
+
.dx-hover {
|
|
21
|
+
@apply cursor-pointer
|
|
22
|
+
hover:bg-hover-surface! hover:text-hover-fg!
|
|
23
|
+
hover:aria-selected:bg-selected-surface-hover hover:aria-selected:text-selected-fg
|
|
24
|
+
hover:aria-[current=true]:bg-current-surface-hover hover:aria-[current=true]:text-current-fg;
|
|
25
|
+
}
|
|
26
|
+
.dx-hover-row {
|
|
27
|
+
@apply group-hover/row:bg-hover-surface! group-hover/row:text-hover-fg!
|
|
28
|
+
group-hover/row:group-aria-selected/row:bg-selected-surface-hover!
|
|
29
|
+
group-hover/row:group-aria-selected/row:text-selected-fg!
|
|
30
|
+
group-hover/row:group-aria-[current=true]/row:bg-current-surface-hover!
|
|
31
|
+
group-hover/row:group-aria-[current=true]/row:text-current-fg!;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/*
|
|
35
|
+
* Pairs with `aria-selected`. Use for listbox/option selection (master/detail).
|
|
36
|
+
* `!` is required: these utilities live in the `dx-components` layer, but
|
|
37
|
+
* background utilities like `bg-card-surface` live in Tailwind's
|
|
38
|
+
* `utilities` layer (declared later in the cascade), so without
|
|
39
|
+
* `!important` the card background would override the state colour.
|
|
40
|
+
*
|
|
41
|
+
* NOTE: Declared before `.dx-current` so that when an element has both
|
|
42
|
+
* `aria-selected="true"` and `aria-current="true"`, `dx-current` wins at
|
|
43
|
+
* equal specificity (consistent with how `dx-hover` resolves the same
|
|
44
|
+
* conflict).
|
|
45
|
+
*/
|
|
46
|
+
.dx-selected {
|
|
47
|
+
@apply aria-selected:bg-selected-surface! aria-selected:text-selected-fg!
|
|
48
|
+
aria-selected:font-semibold aria-selected:tracking-normal
|
|
49
|
+
transition-[color,font-variation-settings,letter-spacing];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/*
|
|
53
|
+
* Pairs with `aria-current="true|page|…"`. Use for "you are here" navigation.
|
|
54
|
+
*
|
|
55
|
+
* The ring uses the subdued focus indicator (neutral) rather than the
|
|
56
|
+
* accent blue — `dx-current` marks position, not focus, so a saturated
|
|
57
|
+
* ring would compete with the actual keyboard focus ring.
|
|
58
|
+
*/
|
|
59
|
+
.dx-current {
|
|
60
|
+
@apply dx-ring-pseudo
|
|
61
|
+
aria-[current=true]:bg-current-surface! aria-[current=true]:text-current-fg!
|
|
62
|
+
aria-[current=true]:after:ring-focus-ring-subtle!;
|
|
63
|
+
}
|
|
64
|
+
.dx-current-row {
|
|
65
|
+
@apply group-aria-[current=true]/row:bg-current-surface! group-aria-[current=true]/row:text-current-fg!;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*
|
|
69
|
+
* Pairs with Radix-managed `data-highlighted`. Don't set the attribute manually.
|
|
70
|
+
*/
|
|
71
|
+
.dx-highlighted {
|
|
72
|
+
@apply data-[highlighted]:bg-current-surface
|
|
73
|
+
data-[highlighted]:text-current-fg
|
|
74
|
+
hover:data-[highlighted]:bg-current-surface-hover;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@layer dx-tokens {
|
|
79
|
+
/*
|
|
80
|
+
* Sidebars sit on a different surface than the main content, so nudge the state highlights to
|
|
81
|
+
* keep contrast: offset each token off its `*-base` (see semantic.css) — darker in light mode,
|
|
82
|
+
* lighter in dark. Tune the magnitude via --dx-sidebar-l-shift.
|
|
83
|
+
*/
|
|
84
|
+
.dx-main-sidebar {
|
|
85
|
+
--dx-sidebar-l-shift: 0.04;
|
|
86
|
+
--color-hover-surface: light-dark(
|
|
87
|
+
oklch(from var(--dx-hover-surface-base) calc(l - var(--dx-sidebar-l-shift)) c h),
|
|
88
|
+
oklch(from var(--dx-hover-surface-base) calc(l + var(--dx-sidebar-l-shift)) c h)
|
|
89
|
+
);
|
|
90
|
+
--color-current-surface: light-dark(
|
|
91
|
+
oklch(from var(--dx-current-surface-base) calc(l - var(--dx-sidebar-l-shift)) c h),
|
|
92
|
+
oklch(from var(--dx-current-surface-base) calc(l + var(--dx-sidebar-l-shift)) c h)
|
|
93
|
+
);
|
|
94
|
+
--color-current-surface-hover: light-dark(
|
|
95
|
+
oklch(from var(--dx-current-surface-hover-base) calc(l - var(--dx-sidebar-l-shift)) c h),
|
|
96
|
+
oklch(from var(--dx-current-surface-hover-base) calc(l + var(--dx-sidebar-l-shift)) c h)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# `dx-*` selection / navigation grammar
|
|
2
|
+
|
|
3
|
+
Companion to `selected.css`. The four selection-state utilities below are
|
|
4
|
+
each bound to a specific ARIA attribute (or `data-*`) selector. **The
|
|
5
|
+
class only fires when the matching ARIA attribute is set on the same
|
|
6
|
+
element.** Mismatches (e.g. `dx-current` paired with `aria-selected`)
|
|
7
|
+
silently render as a plain row.
|
|
8
|
+
|
|
9
|
+
| Class | Bound selector | Pair with | Use when |
|
|
10
|
+
| ---------------- | ---------------------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `dx-hover` | `hover:` | (no ARIA — pure visual affordance) | Always, on any clickable row. Adds the cursor + hover bg/text. |
|
|
12
|
+
| `dx-selected` | `aria-selected:` | `aria-selected={boolean}` | A row is "the chosen one" driving a master/detail panel. Listbox / option pattern. Multi-select OK. |
|
|
13
|
+
| `dx-current` | `aria-[current=true]:` | `aria-current='true'` | A row is "where you are" in a navigation set (current page, current step). At most one current per group. The CSS variant fires only on `aria-current='true'`, so use that literal even on `<a>`/nav links. |
|
|
14
|
+
| `dx-highlighted` | `data-[highlighted]:` | Radix `data-highlighted` (managed) | A Radix-managed transient highlight (menu / combobox active option). Don't set the attribute manually. |
|
|
15
|
+
|
|
16
|
+
## Rules
|
|
17
|
+
|
|
18
|
+
1. **Never combine `dx-selected` and `dx-current` on the same element**
|
|
19
|
+
unless you also set both `aria-selected` and `aria-current`. They
|
|
20
|
+
express different things (chosen vs you-are-here) and the visual
|
|
21
|
+
weight is similar enough that combining them defeats both.
|
|
22
|
+
2. **`aria-pressed`, `aria-checked`, `aria-expanded`, `aria-disabled`
|
|
23
|
+
are not selection-row attributes.** None of the `dx-*` selection
|
|
24
|
+
utilities pair with them. Toggle buttons (mute/unmute) want
|
|
25
|
+
`aria-pressed`; a selection row wants `aria-selected`.
|
|
26
|
+
3. **`aria-selected` is only valid on roles that admit it** — `option`,
|
|
27
|
+
`tab`, `gridcell`, `row`, `treeitem`, `columnheader`, `rowheader`.
|
|
28
|
+
On a plain `<button>` inside a `<ul role='listbox'>`, give the button
|
|
29
|
+
`role='option'` so assistive tech sees the attribute.
|
|
30
|
+
4. **`dx-active` does not exist.** If you see it in code it's a no-op
|
|
31
|
+
string. Use `dx-selected` (selection) or `dx-current` (navigation)
|
|
32
|
+
instead.
|
|
33
|
+
5. **Set ARIA before adding the class.** The class is inert without
|
|
34
|
+
the attribute; it's not a fallback styler. Reviewers should reject
|
|
35
|
+
PRs that add `dx-selected` without `aria-selected`.
|
|
36
|
+
|
|
37
|
+
## Canonical patterns
|
|
38
|
+
|
|
39
|
+
### Selectable row in a list (master/detail)
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<ul role='listbox' aria-label='…'>
|
|
43
|
+
{items.map((item) => (
|
|
44
|
+
<li key={item.id} role='presentation'>
|
|
45
|
+
<button
|
|
46
|
+
type='button'
|
|
47
|
+
role='option'
|
|
48
|
+
aria-selected={item.id === selectedId}
|
|
49
|
+
className='dx-hover dx-selected'
|
|
50
|
+
onClick={() => onSelect(item.id)}
|
|
51
|
+
>
|
|
52
|
+
{item.label}
|
|
53
|
+
</button>
|
|
54
|
+
</li>
|
|
55
|
+
))}
|
|
56
|
+
</ul>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### "You are here" in a navigation list
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<nav>
|
|
63
|
+
<ul>
|
|
64
|
+
{pages.map((page) => (
|
|
65
|
+
<li key={page.href}>
|
|
66
|
+
<a
|
|
67
|
+
href={page.href}
|
|
68
|
+
aria-current={page.href === currentHref ? 'true' : undefined}
|
|
69
|
+
className='dx-hover dx-current'
|
|
70
|
+
>
|
|
71
|
+
{page.label}
|
|
72
|
+
</a>
|
|
73
|
+
</li>
|
|
74
|
+
))}
|
|
75
|
+
</ul>
|
|
76
|
+
</nav>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Toggle button (NOT a row)
|
|
80
|
+
|
|
81
|
+
Don't reach for `dx-selected` here. Toggle buttons want their own
|
|
82
|
+
visual treatment via `aria-pressed:` variants — out of scope for this
|
|
83
|
+
file.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<button type='button' aria-pressed={muted} onClick={toggleMute}>
|
|
87
|
+
{muted ? 'Unmute' : 'Mute'}
|
|
88
|
+
</button>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Enforcing the grammar
|
|
92
|
+
|
|
93
|
+
A future ESLint rule could flag:
|
|
94
|
+
|
|
95
|
+
- `dx-selected` without `aria-selected` on the same element.
|
|
96
|
+
- `dx-current` without `aria-current` on the same element.
|
|
97
|
+
- `dx-active` literal anywhere.
|
|
98
|
+
|
|
99
|
+
Until that exists, reviewers and the `react-ui-list` `RowList` /
|
|
100
|
+
`CardList` containers (which set both attribute and class together)
|
|
101
|
+
are the enforcement.
|
|
@@ -4,31 +4,53 @@
|
|
|
4
4
|
|
|
5
5
|
@layer dx-components {
|
|
6
6
|
.dx-base-surface {
|
|
7
|
-
@apply bg-base-surface text-base-
|
|
7
|
+
@apply bg-base-surface text-base-fg;
|
|
8
8
|
--surface-bg: var(--color-base-surface);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.dx-sidebar-surface {
|
|
12
|
-
@apply bg-sidebar-surface text-base-
|
|
12
|
+
@apply bg-sidebar-surface text-base-fg;
|
|
13
13
|
--surface-bg: var(--color-sidebar-surface);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.dx-modal-surface {
|
|
17
|
-
@apply bg-modal-surface text-base-
|
|
17
|
+
@apply bg-modal-surface text-base-fg backdrop-blur-md;
|
|
18
18
|
--surface-bg: var(--color-modal-surface);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.dx-attention-surface {
|
|
22
|
-
@apply bg-attention-surface text-base-
|
|
22
|
+
@apply bg-attention-surface text-base-fg;
|
|
23
23
|
--surface-bg: var(--color-attention-surface);
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
.dx-popover-surface {
|
|
27
|
+
@apply bg-popover-surface text-base-fg backdrop-blur-md;
|
|
28
|
+
--surface-bg: var(--color-popover-surface);
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
/*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
@layer dx-tokens {
|
|
33
|
+
/*
|
|
34
|
+
* Elevated surfaces (modal, popover) sit higher than the hover/current base tokens, so the
|
|
35
|
+
* un-offset state colours collide with the surface itself (e.g. in dark mode the popover surface
|
|
36
|
+
* and hover surface are both neutral-750 → the highlight is invisible). Re-derive the state
|
|
37
|
+
* colours off the actual surface (--surface-bg) via relative oklch — darker in light mode,
|
|
38
|
+
* lighter in dark — so highlights stay visible regardless of how the surface tokens are tuned.
|
|
39
|
+
* Mirrors the .dx-main-sidebar offset in state.css.
|
|
40
|
+
*/
|
|
41
|
+
.dx-modal-surface,
|
|
42
|
+
.dx-popover-surface {
|
|
43
|
+
--color-hover-surface: light-dark(
|
|
44
|
+
oklch(from var(--surface-bg) calc(l - 0.08) c h),
|
|
45
|
+
oklch(from var(--surface-bg) calc(l + 0.08) c h)
|
|
46
|
+
);
|
|
47
|
+
--color-current-surface: light-dark(
|
|
48
|
+
oklch(from var(--surface-bg) calc(l - 0.1) c h),
|
|
49
|
+
oklch(from var(--surface-bg) calc(l + 0.1) c h)
|
|
50
|
+
);
|
|
51
|
+
--color-current-surface-hover: light-dark(
|
|
52
|
+
oklch(from var(--surface-bg) calc(l - 0.12) c h),
|
|
53
|
+
oklch(from var(--surface-bg) calc(l + 0.12) c h)
|
|
54
|
+
);
|
|
33
55
|
}
|
|
34
|
-
}
|
|
56
|
+
}
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
.dx-tag--anchor {
|
|
13
13
|
/* NOTE: Margin offsets padding so that border is flush with text. This should only apply to anchor tags inside of Codemirror. */
|
|
14
|
-
@apply inline cursor-pointer -
|
|
15
|
-
|
|
14
|
+
@apply inline cursor-pointer px-[4px] py-0.5;
|
|
15
|
+
/** TODO(burdon): Configure secondary color. */
|
|
16
|
+
@apply bg-input-surface ring ring-neutral-border rounded-sm;
|
|
16
17
|
&:hover {
|
|
17
18
|
@apply bg-hover-surface;
|
|
18
19
|
}
|
|
@@ -20,111 +21,111 @@
|
|
|
20
21
|
|
|
21
22
|
.dx-tag[data-hue='neutral'],
|
|
22
23
|
.dx-tag--neutral {
|
|
23
|
-
@apply bg-neutral-surface text-neutral-
|
|
24
|
+
@apply bg-neutral-surface text-neutral-fg;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.dx-tag[data-hue='red'],
|
|
27
28
|
.dx-tag--red {
|
|
28
|
-
@apply bg-red-surface text-red-
|
|
29
|
+
@apply bg-red-surface text-red-fg;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.dx-tag[data-hue='orange'],
|
|
32
33
|
.dx-tag--orange {
|
|
33
|
-
@apply bg-orange-surface text-orange-
|
|
34
|
+
@apply bg-orange-surface text-orange-fg;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
.dx-tag[data-hue='amber'],
|
|
37
38
|
.dx-tag--amber {
|
|
38
|
-
@apply bg-amber-surface text-amber-
|
|
39
|
+
@apply bg-amber-surface text-amber-fg;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.dx-tag[data-hue='yellow'],
|
|
42
43
|
.dx-tag--yellow {
|
|
43
|
-
@apply bg-yellow-surface text-yellow-
|
|
44
|
+
@apply bg-yellow-surface text-yellow-fg;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
.dx-tag[data-hue='lime'],
|
|
47
48
|
.dx-tag--lime {
|
|
48
|
-
@apply bg-lime-surface text-lime-
|
|
49
|
+
@apply bg-lime-surface text-lime-fg;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.dx-tag[data-hue='green'],
|
|
52
53
|
.dx-tag--green {
|
|
53
|
-
@apply bg-green-surface text-green-
|
|
54
|
+
@apply bg-green-surface text-green-fg;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
.dx-tag[data-hue='emerald'],
|
|
57
58
|
.dx-tag--emerald {
|
|
58
|
-
@apply bg-emerald-surface text-emerald-
|
|
59
|
+
@apply bg-emerald-surface text-emerald-fg;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
.dx-tag[data-hue='teal'],
|
|
62
63
|
.dx-tag--teal {
|
|
63
|
-
@apply bg-teal-surface text-teal-
|
|
64
|
+
@apply bg-teal-surface text-teal-fg;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
.dx-tag[data-hue='cyan'],
|
|
67
68
|
.dx-tag--cyan {
|
|
68
|
-
@apply bg-cyan-surface text-cyan-
|
|
69
|
+
@apply bg-cyan-surface text-cyan-fg;
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
.dx-tag[data-hue='sky'],
|
|
72
73
|
.dx-tag--sky {
|
|
73
|
-
@apply bg-sky-surface text-sky-
|
|
74
|
+
@apply bg-sky-surface text-sky-fg;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
.dx-tag[data-hue='blue'],
|
|
77
78
|
.dx-tag--blue {
|
|
78
|
-
@apply bg-blue-surface text-blue-
|
|
79
|
+
@apply bg-blue-surface text-blue-fg;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
.dx-tag[data-hue='indigo'],
|
|
82
83
|
.dx-tag--indigo {
|
|
83
|
-
@apply bg-indigo-surface text-indigo-
|
|
84
|
+
@apply bg-indigo-surface text-indigo-fg;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
.dx-tag[data-hue='violet'],
|
|
87
88
|
.dx-tag--violet {
|
|
88
|
-
@apply bg-violet-surface text-violet-
|
|
89
|
+
@apply bg-violet-surface text-violet-fg;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
.dx-tag[data-hue='purple'],
|
|
92
93
|
.dx-tag--purple {
|
|
93
|
-
@apply bg-purple-surface text-purple-
|
|
94
|
+
@apply bg-purple-surface text-purple-fg;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
.dx-tag[data-hue='fuchsia'],
|
|
97
98
|
.dx-tag--fuchsia {
|
|
98
|
-
@apply bg-fuchsia-surface text-fuchsia-
|
|
99
|
+
@apply bg-fuchsia-surface text-fuchsia-fg;
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
.dx-tag[data-hue='pink'],
|
|
102
103
|
.dx-tag--pink {
|
|
103
|
-
@apply bg-pink-surface text-pink-
|
|
104
|
+
@apply bg-pink-surface text-pink-fg;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
.dx-tag[data-hue='rose'],
|
|
107
108
|
.dx-tag--rose {
|
|
108
|
-
@apply bg-rose-surface text-rose-
|
|
109
|
+
@apply bg-rose-surface text-rose-fg;
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
.dx-tag[data-hue='info'],
|
|
112
113
|
.dx-tag--info {
|
|
113
|
-
@apply bg-cyan-surface text-cyan-
|
|
114
|
+
@apply bg-cyan-surface text-cyan-fg;
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
.dx-tag[data-hue='success'],
|
|
117
118
|
.dx-tag--success {
|
|
118
|
-
@apply bg-emerald-surface text-emerald-
|
|
119
|
+
@apply bg-emerald-surface text-emerald-fg;
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
.dx-tag[data-hue='warning'],
|
|
122
123
|
.dx-tag--warning {
|
|
123
|
-
@apply bg-amber-surface text-amber-
|
|
124
|
+
@apply bg-amber-surface text-amber-fg;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
.dx-tag[data-hue='error'],
|
|
127
128
|
.dx-tag--error {
|
|
128
|
-
@apply bg-rose-surface text-rose-
|
|
129
|
+
@apply bg-rose-surface text-rose-fg;
|
|
129
130
|
}
|
|
130
131
|
}
|