@cngx/common 0.0.1-rc.0 → 0.1.0-rc.1
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/a11y/README.md +13 -16
- package/card/README.md +2 -21
- package/chart/README.md +5 -8
- package/data/README.md +45 -47
- package/dialog/README.md +12 -15
- package/display/README.md +5 -9
- package/fesm2022/cngx-common-a11y.mjs +164 -51
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +157 -69
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +389 -92
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +311 -151
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +167 -29
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +445 -110
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2059 -435
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +188 -31
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +711 -90
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +1479 -73
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1144 -85
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +5 -5
- package/layout/README.md +2 -2
- package/package.json +7 -6
- package/popover/README.md +8 -34
- package/stepper/README.md +69 -8
- package/tabs/README.md +6 -6
- package/theming/components/cngx-async.css +74 -0
- package/theming/components/cngx-backdrop.css +73 -0
- package/theming/components/cngx-badge.css +340 -0
- package/theming/components/cngx-bottom-sheet.css +201 -0
- package/theming/components/cngx-button-toggle.css +99 -0
- package/theming/components/cngx-dialog.css +358 -0
- package/theming/components/cngx-divider.css +145 -0
- package/theming/components/cngx-listbox.css +220 -0
- package/theming/components/cngx-menu.css +371 -0
- package/theming/components/cngx-ripple.css +116 -0
- package/theming/components/cngx-tooltip.css +265 -0
- package/theming/system-tokens.css +24 -0
- package/types/cngx-common-a11y.d.ts +159 -38
- package/types/cngx-common-card.d.ts +137 -22
- package/types/cngx-common-chart.d.ts +337 -40
- package/types/cngx-common-data.d.ts +277 -45
- package/types/cngx-common-dialog.d.ts +162 -22
- package/types/cngx-common-display.d.ts +422 -78
- package/types/cngx-common-interactive.d.ts +1880 -305
- package/types/cngx-common-layout.d.ts +191 -28
- package/types/cngx-common-popover.d.ts +632 -87
- package/types/cngx-common-stepper.d.ts +1360 -45
- package/types/cngx-common-tabs.d.ts +1139 -56
- package/types/cngx-common.d.ts +1 -1
- package/README.md +0 -18
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Theming bridge for the `CngxListbox` family. Ships enough
|
|
4
|
+
* structural chrome that a bare `<ul cngxListbox>…</ul>` renders
|
|
5
|
+
* as a usable option list: bullets stripped, options laid out with
|
|
6
|
+
* breathing room, keyboard-cursor and selected-state signals
|
|
7
|
+
* painted in. Container surface (background, border, radius) is
|
|
8
|
+
* owned by the surrounding panel - `select-base.css` paints panel
|
|
9
|
+
* chrome at higher specificity for the select family.
|
|
10
|
+
*
|
|
11
|
+
* **Selectors**
|
|
12
|
+
*
|
|
13
|
+
* - `[cngxListbox]` - container
|
|
14
|
+
* - `[cngxOption]` - option host
|
|
15
|
+
* - `.cngx-option--selected`, `--highlighted`, `--disabled`,
|
|
16
|
+
* `--hidden` - state hooks
|
|
17
|
+
*
|
|
18
|
+
* **State modifiers**
|
|
19
|
+
*
|
|
20
|
+
* - `--highlighted` - low-alpha primary tint (keyboard cursor via
|
|
21
|
+
* `aria-activedescendant`)
|
|
22
|
+
* - `--selected` - higher-alpha primary tint so committed state
|
|
23
|
+
* reads stronger than the transient cursor
|
|
24
|
+
* - `--disabled` - opacity 0.5, `cursor: not-allowed`
|
|
25
|
+
* - `--hidden` - `display: none`
|
|
26
|
+
*
|
|
27
|
+
* Container `:focus-visible` paints a 2px ring (the container
|
|
28
|
+
* carries focus while `aria-activedescendant` points at the row).
|
|
29
|
+
*
|
|
30
|
+
* **Inheritance**
|
|
31
|
+
*
|
|
32
|
+
* - `--cngx-listbox-focus-outline-color` -> `--cngx-color-primary`
|
|
33
|
+
* - `--cngx-option-highlight-bg`, `--cngx-option-selected-bg` -
|
|
34
|
+
* low-alpha primary tints, no foundation delegation by design
|
|
35
|
+
*
|
|
36
|
+
* **Dark mode**
|
|
37
|
+
*
|
|
38
|
+
* Three hooks (`prefers-color-scheme: dark`, `[data-color-scheme="dark"]`,
|
|
39
|
+
* `.dark`) lift the highlight and selected alphas (0.1 -> 0.18,
|
|
40
|
+
* 0.18 -> 0.28) so the accent stays perceptible on dark surfaces
|
|
41
|
+
* without blowing out into a solid block.
|
|
42
|
+
*
|
|
43
|
+
* **Pair with**
|
|
44
|
+
*
|
|
45
|
+
* - `@cngx/themes/material/interactive-controls-theme` - Material 3 surface
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
@layer cngx.tokens {
|
|
49
|
+
/**
|
|
50
|
+
* Outline of the listbox container when it takes keyboard focus.
|
|
51
|
+
* The container uses `aria-activedescendant`, so it carries focus
|
|
52
|
+
* while the highlighted option is signalled separately by the
|
|
53
|
+
* highlight bg.
|
|
54
|
+
* @group State / Focus
|
|
55
|
+
* @see [[--cngx-color-primary]]
|
|
56
|
+
*/
|
|
57
|
+
@property --cngx-listbox-focus-outline-color {
|
|
58
|
+
syntax: '<color>';
|
|
59
|
+
inherits: true;
|
|
60
|
+
initial-value: oklch(0.66 0.19 50);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Stroke width of the container focus ring.
|
|
65
|
+
* @group State / Focus
|
|
66
|
+
*/
|
|
67
|
+
@property --cngx-listbox-focus-outline-width {
|
|
68
|
+
syntax: '<length>';
|
|
69
|
+
inherits: false;
|
|
70
|
+
initial-value: 2px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Distance from the container edge to the focus ring.
|
|
75
|
+
* @group State / Focus
|
|
76
|
+
*/
|
|
77
|
+
@property --cngx-listbox-focus-outline-offset {
|
|
78
|
+
syntax: '<length>';
|
|
79
|
+
inherits: false;
|
|
80
|
+
initial-value: 2px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Background tint of the keyboard-highlighted option. Low-alpha
|
|
85
|
+
* primary so the highlight reads as an accent without competing
|
|
86
|
+
* with selected-state visuals.
|
|
87
|
+
* @group State / Highlighted
|
|
88
|
+
* @see [[--cngx-color-primary]]
|
|
89
|
+
*/
|
|
90
|
+
@property --cngx-option-highlight-bg {
|
|
91
|
+
syntax: '<color>';
|
|
92
|
+
inherits: true;
|
|
93
|
+
initial-value: oklch(0.66 0.19 50 / 0.1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Background of a selected option. Slightly higher alpha than the
|
|
98
|
+
* highlight tint so selection reads as committed state rather than
|
|
99
|
+
* transient cursor position.
|
|
100
|
+
* @group State / Selected
|
|
101
|
+
* @see [[--cngx-color-primary]]
|
|
102
|
+
*/
|
|
103
|
+
@property --cngx-option-selected-bg {
|
|
104
|
+
syntax: '<color>';
|
|
105
|
+
inherits: true;
|
|
106
|
+
initial-value: oklch(0.66 0.19 50 / 0.18);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Opacity multiplier applied to disabled options.
|
|
111
|
+
* @group State / Disabled
|
|
112
|
+
*/
|
|
113
|
+
@property --cngx-option-disabled-opacity {
|
|
114
|
+
syntax: '<number>';
|
|
115
|
+
inherits: false;
|
|
116
|
+
initial-value: 0.5;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Padding shorthand inside the listbox container.
|
|
121
|
+
* @group Layout
|
|
122
|
+
*/
|
|
123
|
+
@property --cngx-listbox-padding {
|
|
124
|
+
syntax: '<length>';
|
|
125
|
+
inherits: false;
|
|
126
|
+
initial-value: 4px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Padding shorthand on each option.
|
|
131
|
+
* @group Layout
|
|
132
|
+
*/
|
|
133
|
+
@property --cngx-option-padding {
|
|
134
|
+
syntax: '*';
|
|
135
|
+
inherits: false;
|
|
136
|
+
initial-value: 6px 10px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Corner radius of each option.
|
|
141
|
+
* @group Layout
|
|
142
|
+
*/
|
|
143
|
+
@property --cngx-option-radius {
|
|
144
|
+
syntax: '<length>';
|
|
145
|
+
inherits: false;
|
|
146
|
+
initial-value: 4px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/*
|
|
150
|
+
* Default-theme palette. Highlight + selected tints flip to higher
|
|
151
|
+
* alphas on dark surfaces so the accent stays perceptible against
|
|
152
|
+
* the darker background without blowing out into a solid block.
|
|
153
|
+
*/
|
|
154
|
+
:root {
|
|
155
|
+
--cngx-listbox-focus-outline-color: var(--cngx-color-primary, oklch(0.66 0.19 50));
|
|
156
|
+
--cngx-option-highlight-bg: oklch(0.66 0.19 50 / 0.1);
|
|
157
|
+
--cngx-option-selected-bg: oklch(0.66 0.19 50 / 0.18);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@media (prefers-color-scheme: dark) {
|
|
161
|
+
:root:not([data-color-scheme='light']):not(.light) {
|
|
162
|
+
--cngx-option-highlight-bg: oklch(0.72 0.18 50 / 0.18);
|
|
163
|
+
--cngx-option-selected-bg: oklch(0.72 0.18 50 / 0.28);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:root[data-color-scheme='dark'],
|
|
168
|
+
:root.dark {
|
|
169
|
+
--cngx-option-highlight-bg: oklch(0.72 0.18 50 / 0.18);
|
|
170
|
+
--cngx-option-selected-bg: oklch(0.72 0.18 50 / 0.28);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:root[data-color-scheme='light'],
|
|
174
|
+
:root.light {
|
|
175
|
+
--cngx-option-highlight-bg: oklch(0.66 0.19 50 / 0.1);
|
|
176
|
+
--cngx-option-selected-bg: oklch(0.66 0.19 50 / 0.18);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@layer cngx.components {
|
|
181
|
+
[cngxListbox] {
|
|
182
|
+
list-style: none;
|
|
183
|
+
margin: 0;
|
|
184
|
+
padding: var(--cngx-listbox-padding, 4px);
|
|
185
|
+
outline: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
[cngxListbox]:focus-visible {
|
|
189
|
+
outline: var(--cngx-listbox-focus-outline-width, 2px) solid
|
|
190
|
+
var(--cngx-listbox-focus-outline-color, oklch(0.66 0.19 50));
|
|
191
|
+
outline-offset: var(--cngx-listbox-focus-outline-offset, 2px);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
[cngxOption] {
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
padding: var(--cngx-option-padding, 6px 10px);
|
|
198
|
+
border-radius: var(--cngx-option-radius, 4px);
|
|
199
|
+
cursor: pointer;
|
|
200
|
+
user-select: none;
|
|
201
|
+
color: inherit;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.cngx-option--highlighted {
|
|
205
|
+
background: var(--cngx-option-highlight-bg, oklch(0.66 0.19 50 / 0.1));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.cngx-option--selected {
|
|
209
|
+
background: var(--cngx-option-selected-bg, oklch(0.66 0.19 50 / 0.18));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.cngx-option--disabled {
|
|
213
|
+
opacity: var(--cngx-option-disabled-opacity, 0.5);
|
|
214
|
+
cursor: not-allowed;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.cngx-option--hidden {
|
|
218
|
+
display: none;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Theming bridge for the `CngxMenu` family. Ships enough structural
|
|
4
|
+
* chrome that a bare `<ul cngxMenu>…</ul>` renders as a usable
|
|
5
|
+
* popover menu: bullets stripped, items laid out in a flex row with
|
|
6
|
+
* icon / label / suffix / kbd slots, keyboard-cursor and checked-state
|
|
7
|
+
* signals painted in. Container surface (background, border, radius)
|
|
8
|
+
* is owned by the popover panel that hosts the menu -
|
|
9
|
+
* `cngx-popover-panel.css` paints the chrome.
|
|
10
|
+
*
|
|
11
|
+
* **Selectors**
|
|
12
|
+
*
|
|
13
|
+
* - `[cngxMenu]` - container
|
|
14
|
+
* - `[cngxMenuItem]`, `[cngxMenuItemCheckbox]`, `[cngxMenuItemRadio]`,
|
|
15
|
+
* `[cngxMenuItemSubmenu]` - item hosts
|
|
16
|
+
* - `.cngx-menu-item__icon`, `__label`, `__suffix`, `__kbd` - slots
|
|
17
|
+
* - `.cngx-menu-item--highlighted`, `--disabled`, `--checked` - state
|
|
18
|
+
* - `[cngxMenuSeparator]` - hairline divider
|
|
19
|
+
*
|
|
20
|
+
* **State modifiers**
|
|
21
|
+
*
|
|
22
|
+
* - `--highlighted` - tinted background (keyboard cursor via
|
|
23
|
+
* `aria-activedescendant`)
|
|
24
|
+
* - `--disabled` - opacity 0.5, `cursor: not-allowed`
|
|
25
|
+
* - `--checked` - bolder font-weight plus a leading glyph drawn by
|
|
26
|
+
* `::before` so the cue lands even without a projected icon:
|
|
27
|
+
* `[cngxMenuItemCheckbox]` -> `✓`, `[cngxMenuItemRadio]` ->
|
|
28
|
+
* filled dot. `:has(.cngx-menu-item__icon)` suppresses the pseudo
|
|
29
|
+
* when a projected icon already occupies the slot.
|
|
30
|
+
*
|
|
31
|
+
* **Inheritance**
|
|
32
|
+
*
|
|
33
|
+
* Surface tokens fall back to the foundation so brand swaps cascade:
|
|
34
|
+
*
|
|
35
|
+
* - `--cngx-menu-focus-outline-color` -> `--cngx-color-primary`
|
|
36
|
+
* - `--cngx-menu-item-highlight-bg` -> `color-mix(primary, transparent)`
|
|
37
|
+
* - `--cngx-menu-item-checked-color` -> `--cngx-color-primary`
|
|
38
|
+
* - `--cngx-menu-separator-color` -> `--cngx-color-border`
|
|
39
|
+
*
|
|
40
|
+
* The highlight tint is a `color-mix()` so Material's `--mat-sys-primary`
|
|
41
|
+
* (or any other primary override) flows through without forking.
|
|
42
|
+
*
|
|
43
|
+
* **Dark mode**
|
|
44
|
+
*
|
|
45
|
+
* Three hooks (`prefers-color-scheme: dark`, `[data-color-scheme="dark"]`,
|
|
46
|
+
* `.dark`) lift the highlight alpha (10% -> 18%) and flip the kbd
|
|
47
|
+
* muted-color from `oklch(0.45 …)` to `oklch(0.7 …)` so the shortcut
|
|
48
|
+
* hint stays readable on dark popover surfaces.
|
|
49
|
+
*
|
|
50
|
+
* **Pair with**
|
|
51
|
+
*
|
|
52
|
+
* - `@cngx/themes/material/interactive-controls-theme` - Material 3 surface
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
@layer cngx.tokens {
|
|
56
|
+
/**
|
|
57
|
+
* Outline of the menu container when it takes keyboard focus -
|
|
58
|
+
* standard 2px ring at the foundation-primary hue. The container
|
|
59
|
+
* uses `aria-activedescendant`, so it carries focus while the
|
|
60
|
+
* highlighted item is signalled separately by the highlight bg.
|
|
61
|
+
* @group State / Focus
|
|
62
|
+
* @see [[--cngx-color-primary]]
|
|
63
|
+
*/
|
|
64
|
+
@property --cngx-menu-focus-outline-color {
|
|
65
|
+
syntax: '<color>';
|
|
66
|
+
inherits: true;
|
|
67
|
+
initial-value: oklch(0.66 0.19 50);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Stroke width of the container focus ring.
|
|
72
|
+
* @group State / Focus
|
|
73
|
+
*/
|
|
74
|
+
@property --cngx-menu-focus-outline-width {
|
|
75
|
+
syntax: '<length>';
|
|
76
|
+
inherits: false;
|
|
77
|
+
initial-value: 2px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Distance from the container edge to the focus ring.
|
|
82
|
+
* @group State / Focus
|
|
83
|
+
*/
|
|
84
|
+
@property --cngx-menu-focus-outline-offset {
|
|
85
|
+
syntax: '<length>';
|
|
86
|
+
inherits: false;
|
|
87
|
+
initial-value: 2px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Background tint of the keyboard-highlighted item. Resolved at
|
|
92
|
+
* `:root` as `color-mix(in oklch, var(--cngx-color-primary) 10%,
|
|
93
|
+
* transparent)` so the tint tracks whichever primary the theme
|
|
94
|
+
* (cngx default, Material bridge, brand override) feeds. The
|
|
95
|
+
* `@property` initial-value below is the literal fallback used
|
|
96
|
+
* when neither the foundation token nor the `:root` declaration
|
|
97
|
+
* resolves.
|
|
98
|
+
* @group State / Highlighted
|
|
99
|
+
* @see [[--cngx-color-primary]]
|
|
100
|
+
*/
|
|
101
|
+
@property --cngx-menu-item-highlight-bg {
|
|
102
|
+
syntax: '<color>';
|
|
103
|
+
inherits: true;
|
|
104
|
+
initial-value: oklch(0.66 0.19 50 / 0.1);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Opacity multiplier applied to disabled menu items.
|
|
109
|
+
* @group State / Disabled
|
|
110
|
+
*/
|
|
111
|
+
@property --cngx-menu-item-disabled-opacity {
|
|
112
|
+
syntax: '<number>';
|
|
113
|
+
inherits: false;
|
|
114
|
+
initial-value: 0.5;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Padding shorthand inside the menu container.
|
|
119
|
+
* @group Layout
|
|
120
|
+
*/
|
|
121
|
+
@property --cngx-menu-padding {
|
|
122
|
+
syntax: '<length>';
|
|
123
|
+
inherits: false;
|
|
124
|
+
initial-value: 4px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Padding shorthand on each menu item.
|
|
129
|
+
* @group Layout
|
|
130
|
+
*/
|
|
131
|
+
@property --cngx-menu-item-padding {
|
|
132
|
+
syntax: '*';
|
|
133
|
+
inherits: false;
|
|
134
|
+
initial-value: 6px 10px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Inline gap between an item's slots (icon / label / suffix /
|
|
139
|
+
* kbd).
|
|
140
|
+
* @group Layout
|
|
141
|
+
*/
|
|
142
|
+
@property --cngx-menu-item-gap {
|
|
143
|
+
syntax: '<length>';
|
|
144
|
+
inherits: false;
|
|
145
|
+
initial-value: 8px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Corner radius of each menu item.
|
|
150
|
+
* @group Layout
|
|
151
|
+
*/
|
|
152
|
+
@property --cngx-menu-item-radius {
|
|
153
|
+
syntax: '<length>';
|
|
154
|
+
inherits: false;
|
|
155
|
+
initial-value: 4px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Font-weight applied to a checked menu item - emphasises
|
|
160
|
+
* committed state vs the transient highlight cursor.
|
|
161
|
+
* @group State / Checked
|
|
162
|
+
*/
|
|
163
|
+
@property --cngx-menu-item-checked-font-weight {
|
|
164
|
+
syntax: '<number>';
|
|
165
|
+
inherits: false;
|
|
166
|
+
initial-value: 600;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Color of the leading checkmark glyph painted on a checked item.
|
|
171
|
+
* Tracks the foundation primary so the cue matches the highlight
|
|
172
|
+
* accent.
|
|
173
|
+
* @group State / Checked
|
|
174
|
+
* @see [[--cngx-color-primary]]
|
|
175
|
+
*/
|
|
176
|
+
@property --cngx-menu-item-checked-color {
|
|
177
|
+
syntax: '<color>';
|
|
178
|
+
inherits: true;
|
|
179
|
+
initial-value: oklch(0.66 0.19 50);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Min-width reserved on the leading icon slot - keeps labels
|
|
184
|
+
* vertically aligned across rows when some items have icons and
|
|
185
|
+
* others don't.
|
|
186
|
+
* @group Layout
|
|
187
|
+
*/
|
|
188
|
+
@property --cngx-menu-item-icon-min-width {
|
|
189
|
+
syntax: '*';
|
|
190
|
+
inherits: false;
|
|
191
|
+
initial-value: 1.25rem;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Color of the trailing keyboard-shortcut hint. Defaults to a
|
|
196
|
+
* muted neutral that reads as secondary info next to the label.
|
|
197
|
+
* @group Surface
|
|
198
|
+
*/
|
|
199
|
+
@property --cngx-menu-item-kbd-color {
|
|
200
|
+
syntax: '<color>';
|
|
201
|
+
inherits: true;
|
|
202
|
+
initial-value: oklch(0.45 0 0);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Color of the menu separator hairline. Tracks
|
|
207
|
+
* `--cngx-color-border`.
|
|
208
|
+
* @group Surface
|
|
209
|
+
* @see [[--cngx-color-border]]
|
|
210
|
+
*/
|
|
211
|
+
@property --cngx-menu-separator-color {
|
|
212
|
+
syntax: '<color>';
|
|
213
|
+
inherits: true;
|
|
214
|
+
initial-value: oklch(0.89 0 0);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
* Default-theme palette. Highlight tint is a `color-mix()` of the
|
|
219
|
+
* foundation primary so the accent follows the bridge - Material's
|
|
220
|
+
* `--mat-sys-primary` (or any other theme that overrides
|
|
221
|
+
* `--cngx-color-primary`) flows through unchanged. Alpha lifts on
|
|
222
|
+
* dark surfaces so the tint stays perceptible without blowing out
|
|
223
|
+
* into a solid block. The kbd muted-color flips on the same axis
|
|
224
|
+
* so the shortcut hint stays readable on dark popover surfaces.
|
|
225
|
+
*/
|
|
226
|
+
:root {
|
|
227
|
+
--cngx-menu-focus-outline-color: var(--cngx-color-primary, oklch(0.66 0.19 50));
|
|
228
|
+
--cngx-menu-item-checked-color: var(--cngx-color-primary, oklch(0.66 0.19 50));
|
|
229
|
+
--cngx-menu-separator-color: var(--cngx-color-border, oklch(0.89 0 0));
|
|
230
|
+
--cngx-menu-item-highlight-bg: color-mix(
|
|
231
|
+
in oklch,
|
|
232
|
+
var(--cngx-color-primary, oklch(0.66 0.19 50)) 10%,
|
|
233
|
+
transparent
|
|
234
|
+
);
|
|
235
|
+
--cngx-menu-item-kbd-color: oklch(0.45 0 0);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@media (prefers-color-scheme: dark) {
|
|
239
|
+
:root:not([data-color-scheme='light']):not(.light) {
|
|
240
|
+
--cngx-menu-item-highlight-bg: color-mix(
|
|
241
|
+
in oklch,
|
|
242
|
+
var(--cngx-color-primary, oklch(0.72 0.18 50)) 18%,
|
|
243
|
+
transparent
|
|
244
|
+
);
|
|
245
|
+
--cngx-menu-item-kbd-color: oklch(0.7 0 0);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
:root[data-color-scheme='dark'],
|
|
250
|
+
:root.dark {
|
|
251
|
+
--cngx-menu-item-highlight-bg: color-mix(
|
|
252
|
+
in oklch,
|
|
253
|
+
var(--cngx-color-primary, oklch(0.72 0.18 50)) 18%,
|
|
254
|
+
transparent
|
|
255
|
+
);
|
|
256
|
+
--cngx-menu-item-kbd-color: oklch(0.7 0 0);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
:root[data-color-scheme='light'],
|
|
260
|
+
:root.light {
|
|
261
|
+
--cngx-menu-item-highlight-bg: color-mix(
|
|
262
|
+
in oklch,
|
|
263
|
+
var(--cngx-color-primary, oklch(0.66 0.19 50)) 10%,
|
|
264
|
+
transparent
|
|
265
|
+
);
|
|
266
|
+
--cngx-menu-item-kbd-color: oklch(0.45 0 0);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@layer cngx.components {
|
|
271
|
+
[cngxMenu] {
|
|
272
|
+
list-style: none;
|
|
273
|
+
margin: 0;
|
|
274
|
+
padding: var(--cngx-menu-padding, 4px);
|
|
275
|
+
outline: none;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
[cngxMenu]:focus-visible {
|
|
279
|
+
outline: var(--cngx-menu-focus-outline-width, 2px) solid
|
|
280
|
+
var(--cngx-menu-focus-outline-color, oklch(0.66 0.19 50));
|
|
281
|
+
outline-offset: var(--cngx-menu-focus-outline-offset, 2px);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
[cngxMenuItem],
|
|
285
|
+
[cngxMenuItemCheckbox],
|
|
286
|
+
[cngxMenuItemRadio],
|
|
287
|
+
[cngxMenuItemSubmenu] {
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
gap: var(--cngx-menu-item-gap, 8px);
|
|
291
|
+
padding: var(--cngx-menu-item-padding, 6px 10px);
|
|
292
|
+
border-radius: var(--cngx-menu-item-radius, 4px);
|
|
293
|
+
cursor: pointer;
|
|
294
|
+
user-select: none;
|
|
295
|
+
color: inherit;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.cngx-menu-item--highlighted {
|
|
299
|
+
background: var(--cngx-menu-item-highlight-bg, oklch(0.66 0.19 50 / 0.1));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.cngx-menu-item--disabled {
|
|
303
|
+
opacity: var(--cngx-menu-item-disabled-opacity, 0.5);
|
|
304
|
+
cursor: not-allowed;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/*
|
|
308
|
+
* Checked menu item gets a bolder label PLUS a leading indicator
|
|
309
|
+
* glyph drawn via `::before` so the committed-state signal lands
|
|
310
|
+
* even when the consumer hasn't projected an explicit icon.
|
|
311
|
+
* Checkbox-flavoured items get a tick (`✓`), radio-flavoured items
|
|
312
|
+
* get a filled dot (`●`) to mirror the standard form-control
|
|
313
|
+
* vocabulary. The pseudo lives outside the slot grid so it doesn't
|
|
314
|
+
* conflict with `[cngxMenuItemIcon]` content - `:has()` suppresses
|
|
315
|
+
* the pseudo when a projected icon is present.
|
|
316
|
+
*/
|
|
317
|
+
.cngx-menu-item--checked {
|
|
318
|
+
font-weight: var(--cngx-menu-item-checked-font-weight, 600);
|
|
319
|
+
}
|
|
320
|
+
[cngxMenuItemCheckbox].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
|
|
321
|
+
content: '✓';
|
|
322
|
+
display: inline-flex;
|
|
323
|
+
align-items: center;
|
|
324
|
+
justify-content: center;
|
|
325
|
+
min-width: var(--cngx-menu-item-icon-min-width, 1.25rem);
|
|
326
|
+
color: var(--cngx-menu-item-checked-color, oklch(0.66 0.19 50));
|
|
327
|
+
font-weight: 700;
|
|
328
|
+
}
|
|
329
|
+
[cngxMenuItemRadio].cngx-menu-item--checked:not(:has(.cngx-menu-item__icon))::before {
|
|
330
|
+
content: '●';
|
|
331
|
+
display: inline-flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
justify-content: center;
|
|
334
|
+
min-width: var(--cngx-menu-item-icon-min-width, 1.25rem);
|
|
335
|
+
color: var(--cngx-menu-item-checked-color, oklch(0.66 0.19 50));
|
|
336
|
+
font-size: 0.875em;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.cngx-menu-item__icon {
|
|
340
|
+
display: inline-flex;
|
|
341
|
+
align-items: center;
|
|
342
|
+
justify-content: center;
|
|
343
|
+
min-width: var(--cngx-menu-item-icon-min-width, 1.25rem);
|
|
344
|
+
flex-shrink: 0;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.cngx-menu-item__label {
|
|
348
|
+
flex: 1;
|
|
349
|
+
min-width: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.cngx-menu-item__suffix {
|
|
353
|
+
flex-shrink: 0;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.cngx-menu-item__kbd {
|
|
357
|
+
margin-inline-start: auto;
|
|
358
|
+
color: var(--cngx-menu-item-kbd-color, oklch(0.45 0 0));
|
|
359
|
+
font-size: 0.75rem;
|
|
360
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
361
|
+
flex-shrink: 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
[cngxMenuSeparator] {
|
|
365
|
+
display: block;
|
|
366
|
+
height: 1px;
|
|
367
|
+
margin: 4px 6px;
|
|
368
|
+
background: var(--cngx-menu-separator-color, oklch(0.89 0 0));
|
|
369
|
+
list-style: none;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Theming bridge for the `CngxRipple` directive. The directive
|
|
4
|
+
* injects `<span class="cngx-ripple__wave">` into the host on
|
|
5
|
+
* pointerdown and removes it after the animation completes; all
|
|
6
|
+
* visual treatment lives here, the directive only handles geometry
|
|
7
|
+
* and DOM injection.
|
|
8
|
+
*
|
|
9
|
+
* **Animation**
|
|
10
|
+
*
|
|
11
|
+
* The `cngx-ripple-expand` keyframe scales the wave from 0 -> 1 over
|
|
12
|
+
* `--cngx-ripple-duration` and fades opacity from
|
|
13
|
+
* `--cngx-ripple-opacity` to 0.
|
|
14
|
+
*
|
|
15
|
+
* Under `prefers-reduced-motion: reduce` the keyframe is suppressed
|
|
16
|
+
* and the wave appears as a static tint that fades on opacity
|
|
17
|
+
* transition only.
|
|
18
|
+
*
|
|
19
|
+
* **Per-instance geometry**
|
|
20
|
+
*
|
|
21
|
+
* `--cngx-ripple-x`, `--cngx-ripple-y`, `--cngx-ripple-size` are set
|
|
22
|
+
* inline by the directive per pointer event (not theme surface), so
|
|
23
|
+
* they are intentionally not `@property`-registered.
|
|
24
|
+
*
|
|
25
|
+
* **Inheritance**
|
|
26
|
+
*
|
|
27
|
+
* - `--cngx-ripple-color` defaults to `currentColor` so the wave
|
|
28
|
+
* tracks the host's text color without a per-component override
|
|
29
|
+
*
|
|
30
|
+
* **Pair with**
|
|
31
|
+
*
|
|
32
|
+
* - `@cngx/themes/material/ripple-theme` - Material state-layer surface
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
@layer cngx.tokens {
|
|
36
|
+
/**
|
|
37
|
+
* Wave color. Defaults to `currentColor` so the ripple inherits
|
|
38
|
+
* the host's text color.
|
|
39
|
+
* @group Surface
|
|
40
|
+
*/
|
|
41
|
+
@property --cngx-ripple-color {
|
|
42
|
+
syntax: '*';
|
|
43
|
+
inherits: true;
|
|
44
|
+
initial-value: currentColor;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Peak opacity of the wave at the start of the animation. Drops
|
|
49
|
+
* to zero by the end.
|
|
50
|
+
* @group Surface
|
|
51
|
+
*/
|
|
52
|
+
@property --cngx-ripple-opacity {
|
|
53
|
+
syntax: '<number>';
|
|
54
|
+
inherits: false;
|
|
55
|
+
initial-value: 0.12;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Animation duration of the wave expansion.
|
|
60
|
+
* @group Motion
|
|
61
|
+
*/
|
|
62
|
+
@property --cngx-ripple-duration {
|
|
63
|
+
syntax: '<time>';
|
|
64
|
+
inherits: false;
|
|
65
|
+
initial-value: 0.5s;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@layer cngx.components {
|
|
70
|
+
@scope (.cngx-ripple__wave) {
|
|
71
|
+
:scope {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
left: 0;
|
|
75
|
+
width: var(--cngx-ripple-size, 100px);
|
|
76
|
+
height: var(--cngx-ripple-size, 100px);
|
|
77
|
+
border-radius: 50%;
|
|
78
|
+
background: var(--cngx-ripple-color, currentColor);
|
|
79
|
+
opacity: 0;
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
transform: translate(
|
|
82
|
+
calc(var(--cngx-ripple-x, 50%) - var(--cngx-ripple-size, 100px) / 2),
|
|
83
|
+
calc(var(--cngx-ripple-y, 50%) - var(--cngx-ripple-size, 100px) / 2)
|
|
84
|
+
);
|
|
85
|
+
animation: cngx-ripple-expand var(--cngx-ripple-duration, 0.5s) ease-out forwards;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@media (prefers-reduced-motion: reduce) {
|
|
89
|
+
:scope {
|
|
90
|
+
animation: none;
|
|
91
|
+
opacity: var(--cngx-ripple-opacity, 0.12);
|
|
92
|
+
transition: opacity 0.15s ease;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@keyframes cngx-ripple-expand {
|
|
98
|
+
0% {
|
|
99
|
+
transform: translate(
|
|
100
|
+
calc(var(--cngx-ripple-x) - var(--cngx-ripple-size) / 2),
|
|
101
|
+
calc(var(--cngx-ripple-y) - var(--cngx-ripple-size) / 2)
|
|
102
|
+
)
|
|
103
|
+
scale(0);
|
|
104
|
+
opacity: var(--cngx-ripple-opacity, 0.12);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
100% {
|
|
108
|
+
transform: translate(
|
|
109
|
+
calc(var(--cngx-ripple-x) - var(--cngx-ripple-size) / 2),
|
|
110
|
+
calc(var(--cngx-ripple-y) - var(--cngx-ripple-size) / 2)
|
|
111
|
+
)
|
|
112
|
+
scale(1);
|
|
113
|
+
opacity: 0;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|