@cngx/common 0.1.0-rc.3 → 0.1.0-rc.5
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/audio/README.md +180 -0
- package/display/README.md +1 -0
- package/fesm2022/cngx-common-a11y.mjs +123 -3
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +1205 -0
- package/fesm2022/cngx-common-audio.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +8 -8
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +2 -2
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +996 -55
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +320 -8
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1633 -80
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +187 -3
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +63 -8
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +101 -0
- package/layout/README.md +39 -1
- package/package.json +5 -1
- package/theming/components/cngx-accordion.css +147 -0
- package/theming/components/cngx-badge.css +6 -0
- package/theming/components/cngx-bottom-sheet.css +8 -1
- package/theming/components/cngx-breadcrumb.css +108 -0
- package/theming/components/cngx-button-toggle.css +6 -0
- package/theming/components/cngx-data-grid.css +154 -0
- package/theming/components/cngx-dialog.css +4 -0
- package/theming/components/cngx-divider.css +4 -0
- package/theming/components/cngx-listbox.css +6 -0
- package/theming/components/cngx-menu.css +7 -0
- package/theming/components/cngx-slider.css +237 -0
- package/theming/components/cngx-tooltip.css +6 -0
- package/types/cngx-common-a11y.d.ts +67 -2
- package/types/cngx-common-audio.d.ts +736 -0
- package/types/cngx-common-data.d.ts +632 -22
- package/types/cngx-common-display.d.ts +189 -1
- package/types/cngx-common-interactive.d.ts +1028 -31
- package/types/cngx-common-layout.d.ts +88 -3
- package/types/cngx-common-popover.d.ts +25 -4
package/interactive/README.md
CHANGED
|
@@ -204,6 +204,107 @@ readonly [updateName, nameState] = optimistic(
|
|
|
204
204
|
- No `DestroyRef` cleanup - the subscription is unmanaged. If the component is
|
|
205
205
|
destroyed mid-flight, the subscription completes silently.
|
|
206
206
|
|
|
207
|
+
## CngxSlider / CngxRangeSlider
|
|
208
|
+
|
|
209
|
+
Finished slider components - the 90% API. Drop in `<cngx-slider>`, bind `[(value)]`, done:
|
|
210
|
+
the component renders the track, fill, and thumb and wires full APG keyboard (Arrow / Page /
|
|
211
|
+
Home / End) and pointer-drag. The value is a `model<number>()`, so it binds two-way and
|
|
212
|
+
works with Signal Forms via `[control]`; the `cngx-form-field` integration is `CngxSliderField`
|
|
213
|
+
in `@cngx/forms`. `showValue` floats the formatted value above the thumb.
|
|
214
|
+
|
|
215
|
+
```html
|
|
216
|
+
<label id="vol">Volume</label>
|
|
217
|
+
<cngx-slider aria-labelledby="vol" [(value)]="volume" [min]="0" [max]="100" [step]="5" showValue />
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`<cngx-range-slider>` is the two-thumb range over a `model<[number, number]>()` tuple. It
|
|
221
|
+
paints the orange fill band between the thumbs and clamps each to the other so they never
|
|
222
|
+
cross.
|
|
223
|
+
|
|
224
|
+
```html
|
|
225
|
+
<cngx-range-slider aria-label="Price" [(value)]="price" [min]="0" [max]="1000" [step]="10" showValue />
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Headless directives (bring your own skin)
|
|
229
|
+
|
|
230
|
+
When the default skin is not what you want, the headless `[cngxSliderTrack]` /
|
|
231
|
+
`[cngxRangeSliderTrack]` directives give you the same `role="slider"` brain on your own
|
|
232
|
+
element. They publish `--cngx-slider-fraction` (and, for range,
|
|
233
|
+
`--cngx-slider-start/end-fraction`) so your markup positions the thumb and fill; default
|
|
234
|
+
Track-B styling for the BEM skin ships in `@cngx/themes/cngx.css`.
|
|
235
|
+
|
|
236
|
+
```html
|
|
237
|
+
<div cngxSliderTrack class="cngx-slider" aria-label="Level" [(value)]="level" [min]="0" [max]="100">
|
|
238
|
+
<span class="cngx-slider__track"><span class="cngx-slider__fill"></span></span>
|
|
239
|
+
<span class="cngx-slider__thumb"></span>
|
|
240
|
+
</div>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
For a headless range, host two `[cngxSliderThumb]="'start' | 'end'"` children inside
|
|
244
|
+
`[cngxRangeSliderTrack]`. `createSliderCore()` is the shared pure factory under all of them -
|
|
245
|
+
hand it the value/min/max/step signals and it returns the clamped value, track fraction,
|
|
246
|
+
`aria-valuetext`, and the keyboard/pointer write helpers.
|
|
247
|
+
|
|
248
|
+
## CngxAccordion / CngxAccordionPanel
|
|
249
|
+
|
|
250
|
+
A coordinating accordion over the existing expansion and roving atoms. `CngxAccordion`
|
|
251
|
+
owns one open-set signal and arbitrates single- vs multi-open (`[multi]`); each
|
|
252
|
+
`CngxAccordionPanel` header is a button that toggles its `panelId` and derives
|
|
253
|
+
`aria-expanded` from that one signal - no panel-owned state, no sibling syncing. The
|
|
254
|
+
container pins `CngxRovingTabindex` to the vertical axis for arrow-key header navigation,
|
|
255
|
+
so the header buttons must be direct children of the `cngxAccordion` element. Default
|
|
256
|
+
chrome ships as Track-B CSS in `@cngx/themes/cngx.css`.
|
|
257
|
+
|
|
258
|
+
```html
|
|
259
|
+
<div cngxAccordion #acc="cngxAccordion" [multi]="false">
|
|
260
|
+
<button cngxAccordionPanel panelId="a" controls="region-a">Section A</button>
|
|
261
|
+
<div role="region" id="region-a" [hidden]="!acc.isOpen('a')">…</div>
|
|
262
|
+
<button cngxAccordionPanel panelId="b" controls="region-b">Section B</button>
|
|
263
|
+
<div role="region" id="region-b" [hidden]="!acc.isOpen('b')">…</div>
|
|
264
|
+
</div>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
`aria-multiselectable` reflects `[multi]`; `CNGX_ACCORDION` is the token panels inject to
|
|
268
|
+
reach the coordinator.
|
|
269
|
+
|
|
270
|
+
## CngxBreadcrumb / CngxBreadcrumbItem / CngxBreadcrumbSeparator
|
|
271
|
+
|
|
272
|
+
A linear breadcrumb over a `<nav>` landmark. `CngxBreadcrumb` names the landmark and, when
|
|
273
|
+
the trail exceeds `[maxVisible]`, derives which middle crumbs collapse (keeping the first
|
|
274
|
+
and the last `maxVisible - 1`) and exposes them via `collapsedItems()` / `hasCollapsed()`.
|
|
275
|
+
`CngxBreadcrumbItem` marks the terminal crumb `aria-current="page"` from its position - the
|
|
276
|
+
terminal crumb may be a `<span>` or an `<a [attr.href]="null">`, both derive it identically;
|
|
277
|
+
`CngxBreadcrumbSeparator` marks glyphs `aria-hidden`. Default chrome ships as Track-B CSS
|
|
278
|
+
in `@cngx/themes/cngx.css`.
|
|
279
|
+
|
|
280
|
+
```html
|
|
281
|
+
<nav cngxBreadcrumb [maxVisible]="4" #bc="cngxBreadcrumb">
|
|
282
|
+
<ol>
|
|
283
|
+
<li><a cngxBreadcrumbItem href="/">Home</a></li>
|
|
284
|
+
<li cngxBreadcrumbSeparator>/</li>
|
|
285
|
+
<li><span cngxBreadcrumbItem>Current page</span></li>
|
|
286
|
+
</ol>
|
|
287
|
+
</nav>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Render the collapsed crumbs in an ellipsis `CngxMenu` (drive it from `bc.hasCollapsed()`),
|
|
291
|
+
and truncate long labels with `CngxTruncate`.
|
|
292
|
+
|
|
293
|
+
The collapse rule is a swappable DI factory. `createBreadcrumbCollapse()` is the default
|
|
294
|
+
(keep the first crumb + the last `maxVisible - 1`); override
|
|
295
|
+
`CNGX_BREADCRUMB_COLLAPSE_STRATEGY` in `providers` (app-wide) or `viewProviders` (per `<nav>`)
|
|
296
|
+
to change which indices fold - width-aware, keep-first-N, mobile parent-only - without
|
|
297
|
+
forking. The strategy is a pure `(total, maxVisible) => ReadonlySet<number>`.
|
|
298
|
+
|
|
299
|
+
```ts
|
|
300
|
+
@Component({
|
|
301
|
+
viewProviders: [{
|
|
302
|
+
provide: CNGX_BREADCRUMB_COLLAPSE_STRATEGY,
|
|
303
|
+
useValue: (total, maxVisible) => keepFirstTwoAndLastTwo(total, maxVisible),
|
|
304
|
+
}],
|
|
305
|
+
})
|
|
306
|
+
```
|
|
307
|
+
|
|
207
308
|
## Other Exports
|
|
208
309
|
|
|
209
310
|
`CngxClickOutside`, `CngxDisclosure`, `CngxNavLink`, `CngxNavLabel`, `CngxNavBadge`,
|
package/layout/README.md
CHANGED
|
@@ -111,7 +111,45 @@ Manages text truncation with expand/collapse state detection. Applies `-webkit-l
|
|
|
111
111
|
- `isClamped` is only updated when collapsed - expanded state preserves the last known value.
|
|
112
112
|
- Consumer is responsible for the toggle button and `aria-expanded` attribute.
|
|
113
113
|
|
|
114
|
+
## injectQueryParamSync
|
|
115
|
+
|
|
116
|
+
Bidirectional sync between a caller-owned `WritableSignal<T>` and a named URL query param. The URL wins on initial load (deep-link / shareable-link intent); after that the signal is the source and reflects outward. Re-hydrates on browser back/forward, dev-warns once and no-ops when `@angular/router` is absent.
|
|
117
|
+
|
|
118
|
+
Call it in an injection context (a component field/constructor, a directive) on a signal you own:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { Component, signal } from '@angular/core';
|
|
122
|
+
import { injectQueryParamSync } from '@cngx/common/layout';
|
|
123
|
+
|
|
124
|
+
@Component({ /* ... */ })
|
|
125
|
+
export class PanelComponent {
|
|
126
|
+
readonly panelOpen = signal(false);
|
|
127
|
+
|
|
128
|
+
constructor() {
|
|
129
|
+
// Persist panelOpen to ?panel=open, restore it on load and back/forward.
|
|
130
|
+
injectQueryParamSync(this.panelOpen, { param: 'panel' });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The default codec is boolean (`true` -> `open`, absence -> `false`). Pass an explicit codec for other value shapes (a `null` return removes the param):
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
injectQueryParamSync(this.tab, {
|
|
139
|
+
param: 'tab',
|
|
140
|
+
serialize: (v) => v ?? null,
|
|
141
|
+
deserialize: (raw) => raw ?? 'overview',
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Notes
|
|
146
|
+
|
|
147
|
+
- Loop-safe: reflect writes run in `untracked()` and are skipped when the serialized value is unchanged, so there is no signal<->URL feedback loop.
|
|
148
|
+
- `param` accepts a `Signal<string>`; a bound rename migrates the key in a single navigate (old key removed, current value written under the new key).
|
|
149
|
+
- `onSyncError(err)` receives `router.navigate` rejections - no silent failures.
|
|
150
|
+
- Returns `void`; it wires effects on the caller's signal and tears them down with the injection context.
|
|
151
|
+
|
|
114
152
|
## Other Exports
|
|
115
153
|
|
|
116
154
|
`CngxIntersectionObserver`, `CngxResizeObserver`, `CngxScrollLock`, `CngxBackdrop`,
|
|
117
|
-
`CngxMediaQuery`, `CngxDrawer`, `CngxDrawerPanel`, `CngxDrawerContent`, `CngxInfiniteScroll`
|
|
155
|
+
`CngxMediaQuery`, `injectMediaQuery`, `CngxDrawer`, `CngxDrawerPanel`, `CngxDrawerContent`, `CngxInfiniteScroll`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cngx/common",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.5",
|
|
4
4
|
"description": "Atoms and molecules (a11y, interactive, layout, dialog, popover, display) for the CNGX Angular component library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cngx",
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
"types": "./types/cngx-common-a11y.d.ts",
|
|
56
56
|
"default": "./fesm2022/cngx-common-a11y.mjs"
|
|
57
57
|
},
|
|
58
|
+
"./audio": {
|
|
59
|
+
"types": "./types/cngx-common-audio.d.ts",
|
|
60
|
+
"default": "./fesm2022/cngx-common-audio.mjs"
|
|
61
|
+
},
|
|
58
62
|
"./card": {
|
|
59
63
|
"types": "./types/cngx-common-card.d.ts",
|
|
60
64
|
"default": "./fesm2022/cngx-common-card.mjs"
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Default skin for the `cngxAccordion` / `cngxAccordionPanel` directives. The
|
|
4
|
+
* directives are headless: the coordinator owns the open-set and arrow-key
|
|
5
|
+
* roving, each header mirrors `aria-expanded` and `aria-controls`. This
|
|
6
|
+
* stylesheet gives the header buttons their chrome, a twisty that rotates when
|
|
7
|
+
* the panel opens, and the region its padding. Without it the accordion renders
|
|
8
|
+
* as bare stacked buttons.
|
|
9
|
+
*
|
|
10
|
+
* Markup the default skin expects (header buttons are direct children of the
|
|
11
|
+
* `cngxAccordion` element so the roving host can find them):
|
|
12
|
+
*
|
|
13
|
+
* ```html
|
|
14
|
+
* <div cngxAccordion class="cngx-accordion" #acc="cngxAccordion">
|
|
15
|
+
* <button cngxAccordionPanel class="cngx-accordion__header" panelId="a" controls="r-a">
|
|
16
|
+
* Section A
|
|
17
|
+
* </button>
|
|
18
|
+
* <div role="region" id="r-a" class="cngx-accordion__region" [hidden]="!acc.isOpen('a')">…</div>
|
|
19
|
+
* </div>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* **Inheritance**
|
|
23
|
+
*
|
|
24
|
+
* - header text / surface -> `--cngx-color-text` / `--cngx-color-surface`
|
|
25
|
+
* - hover tint -> `--cngx-color-primary` (low alpha)
|
|
26
|
+
* - dividers -> `--cngx-color-border`
|
|
27
|
+
* - focus ring -> `--cngx-color-primary` (contrast >= 3:1)
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
@layer cngx.tokens {
|
|
31
|
+
/**
|
|
32
|
+
* Header button padding. The pixel `initial-value` is only the un-set
|
|
33
|
+
* fallback; `@cngx/ui/accordion` SETs this from `--cngx-space-*` at its group
|
|
34
|
+
* default (`accordion-group.component.css` `:not([data-skin])`) so a global
|
|
35
|
+
* `[data-density]` re-scales it. Never put `var()` in the `initial-value` (it
|
|
36
|
+
* is invalid, and a registered initial-value defeats any `var()` fallback -
|
|
37
|
+
* reference_property_color_initial_defeats_fallback); derive via a host SET.
|
|
38
|
+
* @group Header
|
|
39
|
+
*/
|
|
40
|
+
@property --cngx-accordion-header-padding {
|
|
41
|
+
syntax: '*';
|
|
42
|
+
/* Inherits so a value set on the group host (a skin's `[data-skin]` block or
|
|
43
|
+
the Material density bridge) reaches the item header - the header is a
|
|
44
|
+
descendant, and `inherits: false` would silently pin it to the initial
|
|
45
|
+
value. */
|
|
46
|
+
inherits: true;
|
|
47
|
+
initial-value: 0.75rem 1rem;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Region (content) padding.
|
|
52
|
+
* @group Region
|
|
53
|
+
*/
|
|
54
|
+
@property --cngx-accordion-region-padding {
|
|
55
|
+
syntax: '*';
|
|
56
|
+
/* Inherits so a group-host value (skin block or density bridge) reaches the
|
|
57
|
+
region - same host->descendant cascade as the header padding above. */
|
|
58
|
+
inherits: true;
|
|
59
|
+
initial-value: 0.75rem 1rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Divider colour between rows.
|
|
64
|
+
* @group Header
|
|
65
|
+
* @see [[--cngx-color-border]]
|
|
66
|
+
*/
|
|
67
|
+
@property --cngx-accordion-border-color {
|
|
68
|
+
syntax: '<color>';
|
|
69
|
+
inherits: true;
|
|
70
|
+
initial-value: oklch(0.88 0.005 250);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Display of the CSS twisty. `block` shows it, `none` hides it. A skin that
|
|
75
|
+
* ships its own chevron (e.g. the @cngx/ui accordion organism) sets this to
|
|
76
|
+
* `none` on the header instead of a blanket `::after` reset. `inherits: true`
|
|
77
|
+
* so a value set on the header button reaches the `::after` pseudo.
|
|
78
|
+
* @group Header
|
|
79
|
+
*/
|
|
80
|
+
@property --cngx-accordion-twisty-display {
|
|
81
|
+
syntax: '*';
|
|
82
|
+
inherits: true;
|
|
83
|
+
initial-value: block;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@layer cngx.components {
|
|
88
|
+
[cngxAccordion] {
|
|
89
|
+
display: block;
|
|
90
|
+
border: 1px solid var(--cngx-accordion-border-color, oklch(0.88 0.005 250));
|
|
91
|
+
border-radius: var(--cngx-radius-md, 0.375rem);
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
[cngxAccordionPanel] {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: space-between;
|
|
99
|
+
gap: 0.5rem;
|
|
100
|
+
inline-size: 100%;
|
|
101
|
+
padding: var(--cngx-accordion-header-padding, 0.75rem 1rem);
|
|
102
|
+
border: 0;
|
|
103
|
+
border-block-end: 1px solid var(--cngx-accordion-border-color, oklch(0.88 0.005 250));
|
|
104
|
+
background: var(--cngx-color-surface, oklch(1 0 0));
|
|
105
|
+
color: var(--cngx-color-text, oklch(0.2 0.01 250));
|
|
106
|
+
font: inherit;
|
|
107
|
+
text-align: start;
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
[cngxAccordionPanel]:hover {
|
|
112
|
+
background: color-mix(
|
|
113
|
+
in oklch,
|
|
114
|
+
var(--cngx-color-primary, oklch(0.66 0.19 50)) 6%,
|
|
115
|
+
var(--cngx-color-surface, oklch(1 0 0))
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
[cngxAccordionPanel]:focus-visible {
|
|
120
|
+
outline: 2px solid var(--cngx-color-primary, oklch(0.66 0.19 50));
|
|
121
|
+
outline-offset: -2px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Twisty: a CSS-drawn chevron after the label that rotates when the panel
|
|
125
|
+
* opens. A skin projecting its own icon hides it via
|
|
126
|
+
* `--cngx-accordion-twisty-display: none` on the header. */
|
|
127
|
+
[cngxAccordionPanel]::after {
|
|
128
|
+
content: '';
|
|
129
|
+
display: var(--cngx-accordion-twisty-display, block);
|
|
130
|
+
flex: 0 0 auto;
|
|
131
|
+
inline-size: 0.5rem;
|
|
132
|
+
block-size: 0.5rem;
|
|
133
|
+
border-inline-end: 2px solid currentcolor;
|
|
134
|
+
border-block-end: 2px solid currentcolor;
|
|
135
|
+
rotate: 45deg;
|
|
136
|
+
transition: rotate 0.15s ease;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[cngxAccordionPanel][aria-expanded='true']::after {
|
|
140
|
+
rotate: 225deg;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.cngx-accordion__region {
|
|
144
|
+
padding: var(--cngx-accordion-region-padding, 0.75rem 1rem);
|
|
145
|
+
border-block-end: 1px solid var(--cngx-accordion-border-color, oklch(0.88 0.005 250));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -260,6 +260,12 @@
|
|
|
260
260
|
* conventions allow the indicator span to be scoped on its own. */
|
|
261
261
|
@scope (.cngx-badge-indicator) {
|
|
262
262
|
:scope {
|
|
263
|
+
/* Derive spacing from the global scale (SET-from-scale rule; the
|
|
264
|
+
registered pixel initial defeats the use-site fallback). Both read on
|
|
265
|
+
the host (base + --inline modifier). padding-inline 3 -> xs (3 -> 4);
|
|
266
|
+
inline-gap 0.375rem -> xs. */
|
|
267
|
+
--cngx-badge-padding-inline: var(--cngx-space-xs);
|
|
268
|
+
--cngx-badge-inline-gap: var(--cngx-space-xs);
|
|
263
269
|
display: inline-flex;
|
|
264
270
|
align-items: center;
|
|
265
271
|
justify-content: center;
|
|
@@ -128,7 +128,8 @@
|
|
|
128
128
|
*/
|
|
129
129
|
@property --cngx-bottom-sheet-handle-margin {
|
|
130
130
|
syntax: '*';
|
|
131
|
-
inherits:
|
|
131
|
+
/* Read on the :scope::before pseudo; inherits so the :scope SET reaches it. */
|
|
132
|
+
inherits: true;
|
|
132
133
|
initial-value: 0 auto 16px;
|
|
133
134
|
}
|
|
134
135
|
|
|
@@ -152,6 +153,12 @@
|
|
|
152
153
|
@layer cngx.components {
|
|
153
154
|
@scope (dialog.cngx-bottom-sheet) {
|
|
154
155
|
:scope {
|
|
156
|
+
/* Derive spacing from the global scale (SET-from-scale rule; the
|
|
157
|
+
registered pixel initial defeats the use-site fallback). padding read on
|
|
158
|
+
the host (24 -> lg); handle-margin read on :scope::before and is
|
|
159
|
+
inherits:true so the SET cascades (0/auto kept literal, 16 -> md). */
|
|
160
|
+
--cngx-bottom-sheet-padding: var(--cngx-space-lg);
|
|
161
|
+
--cngx-bottom-sheet-handle-margin: 0 auto var(--cngx-space-md);
|
|
155
162
|
margin: 0;
|
|
156
163
|
inset: auto 0 0 0;
|
|
157
164
|
width: 100%;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Default skin for the `cngxBreadcrumb` family. The directives are headless:
|
|
4
|
+
* the coordinator names the landmark and computes which crumbs collapse, each
|
|
5
|
+
* item derives `aria-current`, separators are `aria-hidden`. This stylesheet
|
|
6
|
+
* lays the trail out as an inline list and styles the links, the terminal
|
|
7
|
+
* crumb, and the separators. Without it the trail renders as a plain stacked
|
|
8
|
+
* list.
|
|
9
|
+
*
|
|
10
|
+
* Markup the default skin expects:
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <nav cngxBreadcrumb class="cngx-breadcrumb">
|
|
14
|
+
* <ol>
|
|
15
|
+
* <li><a cngxBreadcrumbItem href="/">Home</a></li>
|
|
16
|
+
* <li cngxBreadcrumbSeparator>/</li>
|
|
17
|
+
* <li><span cngxBreadcrumbItem>Current</span></li>
|
|
18
|
+
* </ol>
|
|
19
|
+
* </nav>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* **Inheritance**
|
|
23
|
+
*
|
|
24
|
+
* - link colour -> `--cngx-color-primary`
|
|
25
|
+
* - terminal crumb -> `--cngx-color-text`
|
|
26
|
+
* - separator -> `--cngx-color-text-muted`
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
@layer cngx.tokens {
|
|
30
|
+
/**
|
|
31
|
+
* Gap between crumbs and separators.
|
|
32
|
+
* @group Trail
|
|
33
|
+
*/
|
|
34
|
+
@property --cngx-breadcrumb-gap {
|
|
35
|
+
syntax: '<length>';
|
|
36
|
+
inherits: true;
|
|
37
|
+
initial-value: 0.5rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Separator colour. Delegated at `:root` to the dark-aware foundation token
|
|
42
|
+
* `--cngx-color-text-muted` so the separator mutes in step with the link and
|
|
43
|
+
* terminal colours; the literal `initial-value` is only the last-resort
|
|
44
|
+
* fallback (CSS forbids a `var()` in `@property` `initial-value`).
|
|
45
|
+
* @group Separator
|
|
46
|
+
* @see [[--cngx-color-text-muted]]
|
|
47
|
+
*/
|
|
48
|
+
@property --cngx-breadcrumb-separator-color {
|
|
49
|
+
syntax: '<color>';
|
|
50
|
+
inherits: true;
|
|
51
|
+
initial-value: oklch(0.6 0.01 250);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Chain the separator to the foundation muted-text token so the dark-mode
|
|
55
|
+
cascade reaches it like the link and terminal colours below. */
|
|
56
|
+
:root {
|
|
57
|
+
--cngx-breadcrumb-separator-color: var(--cngx-color-text-muted, oklch(0.6 0.01 250));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@layer cngx.components {
|
|
62
|
+
[cngxBreadcrumb] > ol {
|
|
63
|
+
/* Derive the gap from the global scale (SET-from-scale rule). 0.5rem -> sm.
|
|
64
|
+
Read on this element (inherits:true, so a set on the container would also
|
|
65
|
+
reach it). */
|
|
66
|
+
--cngx-breadcrumb-gap: var(--cngx-space-sm);
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-wrap: wrap;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: var(--cngx-breadcrumb-gap, 0.5rem);
|
|
71
|
+
margin: 0;
|
|
72
|
+
padding: 0;
|
|
73
|
+
list-style: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Scope to the trail's own row items (direct `> ol > li`). A bare
|
|
77
|
+
`[cngxBreadcrumb] li` also matches the nested `<li>` rows inside a
|
|
78
|
+
composed dropdown (overflow menu, siblings list) whose popover panel is
|
|
79
|
+
DOM-nested in a trail `<li>`, forcing those rows inline-flex and laying a
|
|
80
|
+
vertical dropdown out horizontally. */
|
|
81
|
+
[cngxBreadcrumb] > ol > li {
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[cngxBreadcrumbItem] {
|
|
87
|
+
color: var(--cngx-color-primary, oklch(0.66 0.19 50));
|
|
88
|
+
text-decoration: none;
|
|
89
|
+
font-size: var(--cngx-font-size-sm, 0.8125rem);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
[cngxBreadcrumbItem]:hover {
|
|
93
|
+
text-decoration: underline;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Terminal crumb: not a link target, reads as the current location. */
|
|
97
|
+
[cngxBreadcrumbItem][aria-current='page'] {
|
|
98
|
+
color: var(--cngx-color-text, oklch(0.2 0.01 250));
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
text-decoration: none;
|
|
101
|
+
cursor: default;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
[cngxBreadcrumbSeparator] {
|
|
105
|
+
color: var(--cngx-breadcrumb-separator-color, oklch(0.6 0.01 250));
|
|
106
|
+
user-select: none;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -51,6 +51,12 @@
|
|
|
51
51
|
@layer cngx.components {
|
|
52
52
|
@scope (.cngx-button-toggle) {
|
|
53
53
|
:scope {
|
|
54
|
+
/* Derive padding from the global scale (SET-from-scale rule; the
|
|
55
|
+
registered pixel initial defeats the use-site fallback). Read on the
|
|
56
|
+
host. padding-block 0.4rem -> sm (6.4 -> 8); padding-inline 0.875rem ->
|
|
57
|
+
md (14 -> 16). */
|
|
58
|
+
--cngx-button-toggle-padding-block: var(--cngx-space-sm);
|
|
59
|
+
--cngx-button-toggle-padding-inline: var(--cngx-space-md);
|
|
54
60
|
display: inline-flex;
|
|
55
61
|
align-items: center;
|
|
56
62
|
justify-content: center;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Registered `@property` token surface for the `@cngx/ui/data-grid-accordion`
|
|
4
|
+
* organism. The organism carries its structural CSS through each component's
|
|
5
|
+
* `styleUrl` (Track A); this file only *registers* the shared `--cngx-dga-*`
|
|
6
|
+
* custom properties so a value set on the group host cascades down to every row,
|
|
7
|
+
* header, and footer.
|
|
8
|
+
*
|
|
9
|
+
* Registration matters because the column template, gaps, and paddings are set
|
|
10
|
+
* on the group host and read by descendant summaries. `@property` with
|
|
11
|
+
* `inherits: true` keeps that host -> descendant cascade alive; `inherits: false`
|
|
12
|
+
* would silently pin descendants to the initial value. Every token here inherits.
|
|
13
|
+
*
|
|
14
|
+
* Density: the pixel `initial-value` of each spacing token is only the un-set
|
|
15
|
+
* fallback. The organism's default rule and each skin SET `--cngx-dga-row-py` /
|
|
16
|
+
* `-row-px` / `-region-padding` / `-col-gap` FROM `--cngx-space-*`
|
|
17
|
+
* (`data-grid-accordion.component.css` `:not([data-skin])`, and the content skins
|
|
18
|
+
* in `data-grid-accordion-skins.css`), so a global `[data-density]` re-scales the
|
|
19
|
+
* grid. Do NOT put `var()` in an `initial-value` here - it is invalid and a
|
|
20
|
+
* registered initial-value defeats any `var()` fallback anyway
|
|
21
|
+
* (reference_property_color_initial_defeats_fallback); the derivation is always a
|
|
22
|
+
* SET at the host, never the registration.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
@layer cngx.tokens {
|
|
26
|
+
/**
|
|
27
|
+
* The shared `grid-template-columns` template. Set on the group host via
|
|
28
|
+
* `[style.--cngx-dga-columns]`; header, every row summary, and footer read it,
|
|
29
|
+
* so all three align on one contract.
|
|
30
|
+
* @group Grid
|
|
31
|
+
*/
|
|
32
|
+
@property --cngx-dga-columns {
|
|
33
|
+
syntax: '*';
|
|
34
|
+
inherits: true;
|
|
35
|
+
initial-value: 1fr;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gap between column tracks in the header, row summaries, and footer.
|
|
40
|
+
* @group Grid
|
|
41
|
+
*/
|
|
42
|
+
@property --cngx-dga-col-gap {
|
|
43
|
+
syntax: '*';
|
|
44
|
+
inherits: true;
|
|
45
|
+
initial-value: 0.5rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Block padding of a row summary (and the header / footer rows).
|
|
50
|
+
* @group Grid
|
|
51
|
+
*/
|
|
52
|
+
@property --cngx-dga-row-py {
|
|
53
|
+
syntax: '*';
|
|
54
|
+
inherits: true;
|
|
55
|
+
initial-value: 0.5rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Inline padding of a row summary (and the header / footer rows).
|
|
60
|
+
* @group Grid
|
|
61
|
+
*/
|
|
62
|
+
@property --cngx-dga-row-px {
|
|
63
|
+
syntax: '*';
|
|
64
|
+
inherits: true;
|
|
65
|
+
initial-value: 0.75rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Padding of a row's expanded detail region.
|
|
70
|
+
* @group Region
|
|
71
|
+
*/
|
|
72
|
+
@property --cngx-dga-region-padding {
|
|
73
|
+
syntax: '*';
|
|
74
|
+
inherits: true;
|
|
75
|
+
initial-value: 0.75rem 1rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Base font size for grid cells; the `density` skin drives compact / spacious
|
|
80
|
+
* off this hook.
|
|
81
|
+
* @group Grid
|
|
82
|
+
*/
|
|
83
|
+
@property --cngx-dga-fs {
|
|
84
|
+
syntax: '*';
|
|
85
|
+
inherits: true;
|
|
86
|
+
initial-value: inherit;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Scroll floor for the header / rows / footer. Set on the group host by a skin;
|
|
91
|
+
* when it exceeds the host width the whole grid scrolls sideways (host
|
|
92
|
+
* `overflow-x: auto`) with every column intact, instead of a container query
|
|
93
|
+
* dropping a column. The flat base leaves it 0 (no forced scroll).
|
|
94
|
+
* @group Grid
|
|
95
|
+
*/
|
|
96
|
+
@property --cngx-dga-min-width {
|
|
97
|
+
syntax: '<length>';
|
|
98
|
+
inherits: true;
|
|
99
|
+
initial-value: 0px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Divider colour between rows and around the header / footer.
|
|
104
|
+
* @group Grid
|
|
105
|
+
* @see [[--cngx-color-border]]
|
|
106
|
+
*/
|
|
107
|
+
@property --cngx-dga-border-color {
|
|
108
|
+
syntax: '<color>';
|
|
109
|
+
inherits: true;
|
|
110
|
+
initial-value: oklch(0.88 0.005 250);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Alternate row surface, the zebra tint the `ledger` skin fills.
|
|
115
|
+
* @group Surface
|
|
116
|
+
*/
|
|
117
|
+
@property --cngx-dga-surface-alt {
|
|
118
|
+
syntax: '<color>';
|
|
119
|
+
inherits: true;
|
|
120
|
+
initial-value: oklch(0.97 0.003 250);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Fixed track width for a `col="sm"` column. Named sizes mirror the `size`
|
|
125
|
+
* vocabulary of `CngxTag` / `CngxIcon` / `CngxAvatar`; the group maps `col="sm"`
|
|
126
|
+
* to `var(--cngx-dga-col-sm)` when deriving the shared template.
|
|
127
|
+
* @group Grid
|
|
128
|
+
*/
|
|
129
|
+
@property --cngx-dga-col-sm {
|
|
130
|
+
syntax: '<length>';
|
|
131
|
+
inherits: true;
|
|
132
|
+
initial-value: 5rem;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Fixed track width for a `col="md"` column.
|
|
137
|
+
* @group Grid
|
|
138
|
+
*/
|
|
139
|
+
@property --cngx-dga-col-md {
|
|
140
|
+
syntax: '<length>';
|
|
141
|
+
inherits: true;
|
|
142
|
+
initial-value: 7rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Fixed track width for a `col="lg"` column.
|
|
147
|
+
* @group Grid
|
|
148
|
+
*/
|
|
149
|
+
@property --cngx-dga-col-lg {
|
|
150
|
+
syntax: '<length>';
|
|
151
|
+
inherits: true;
|
|
152
|
+
initial-value: 10rem;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -277,6 +277,10 @@
|
|
|
277
277
|
@layer cngx.components {
|
|
278
278
|
@scope (dialog[cngxDialog]) {
|
|
279
279
|
:scope {
|
|
280
|
+
/* Derive the padding from the global scale (SET-from-scale rule; the
|
|
281
|
+
registered pixel initial defeats the use-site fallback). Read on the
|
|
282
|
+
host. 24 -> lg. */
|
|
283
|
+
--cngx-dialog-padding: var(--cngx-space-lg);
|
|
280
284
|
border: var(--cngx-dialog-border, none);
|
|
281
285
|
border-radius: var(--cngx-dialog-border-radius, 8px);
|
|
282
286
|
padding: var(--cngx-dialog-padding, 24px);
|
|
@@ -113,6 +113,10 @@
|
|
|
113
113
|
@scope (.cngx-divider) {
|
|
114
114
|
/* Horizontal default - full-width thin line, vertical breathing room. */
|
|
115
115
|
:scope {
|
|
116
|
+
/* Derive the inset amount from the global scale (SET-from-scale rule; the
|
|
117
|
+
registered pixel initial defeats the use-site fallback). Read on the
|
|
118
|
+
host under the --inset modifier. 16 -> md. */
|
|
119
|
+
--cngx-divider-inset-amount: var(--cngx-space-md);
|
|
116
120
|
display: block;
|
|
117
121
|
box-sizing: border-box;
|
|
118
122
|
width: 100%;
|
|
@@ -179,6 +179,9 @@
|
|
|
179
179
|
|
|
180
180
|
@layer cngx.components {
|
|
181
181
|
[cngxListbox] {
|
|
182
|
+
/* Derive container padding from the global scale (SET-from-scale rule; the
|
|
183
|
+
registered pixel initial defeats the use-site fallback). 4 -> xs. */
|
|
184
|
+
--cngx-listbox-padding: var(--cngx-space-xs);
|
|
182
185
|
list-style: none;
|
|
183
186
|
margin: 0;
|
|
184
187
|
padding: var(--cngx-listbox-padding, 4px);
|
|
@@ -192,6 +195,9 @@
|
|
|
192
195
|
}
|
|
193
196
|
|
|
194
197
|
[cngxOption] {
|
|
198
|
+
/* Derive option padding from the global scale (SET-from-scale rule).
|
|
199
|
+
6/10 -> xs/sm (10 -> 8). Read on this element. */
|
|
200
|
+
--cngx-option-padding: var(--cngx-space-xs) var(--cngx-space-sm);
|
|
195
201
|
display: flex;
|
|
196
202
|
align-items: center;
|
|
197
203
|
padding: var(--cngx-option-padding, 6px 10px);
|