use-wc 1.0.0-pre.62 → 1.0.0-pre.64
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/custom-elements.json +243 -143
- package/dist/design-system.css +75 -17
- package/dist/docs/use-grid.md +12 -0
- package/dist/docs/use-gridrow.md +6 -0
- package/dist/tokens.css +4 -3
- package/package.json +1 -1
- package/vscode.html-custom-data.json +1 -0
package/custom-elements.json
CHANGED
|
@@ -89,149 +89,6 @@
|
|
|
89
89
|
}
|
|
90
90
|
]
|
|
91
91
|
},
|
|
92
|
-
{
|
|
93
|
-
"kind": "javascript-module",
|
|
94
|
-
"path": "src/elements/use-badge/use-badge.ts",
|
|
95
|
-
"declarations": [
|
|
96
|
-
{
|
|
97
|
-
"kind": "class",
|
|
98
|
-
"description": "`use-badge` renders a small indicator anchored to another element's corner, using\n[CSS anchor positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning)\ninstead of the classic `position: absolute` + negative-offset trick. This lets the badge live\nanywhere in the DOM rather than being a child of the element it decorates. A badge's shape,\ncolor, and positioning ship built in — reading from the design system's tokens when\n`tokens.css` is loaded, and falling back to sensible defaults otherwise — so no theme is\nrequired to get a working, visible badge.\n\nPoint a badge at its target with the `anchortarget` attribute, set to the target's `id`\n(named to avoid colliding with the `anchor` content attribute HTML is gaining natively):\n\n```html\n<button type=\"button\" id=\"inbox\">Inbox</button>\n<use-badge anchortarget=\"inbox\">99+</use-badge>\n```\n\nThe badge and its anchor must live in the same DOM tree — a badge cannot reach an anchor\ninside another component's shadow root, and an anchor's `anchor-name` set inside a shadow\ntree's stylesheet is not visible here. No positioned ancestor or shared containing block is\nrequired: anchor positioning resolves the badge's location straight from the anchor's own\ngeometry, so the badge can sit anywhere else in the DOM tree.\n\nWithout a resolved anchor — `anchortarget` unset, pointing at a missing id, or `anchorElement`\nnever assigned — the badge has no `:state(anchored)` and renders as a plain inline chip in\nnormal document flow, still using the same color/shape styling.\n\nSome components render their host as `display: contents`, which has no box of its own for CSS\nanchor positioning to resolve against. If the anchor computes a non-empty `--usewc-anchor-name`\ncustom property, the badge uses that dashed-ident as its `position-anchor` directly instead of\ngenerating and writing its own onto the anchor — letting a component publish the name of a\nreal, box-generating part of itself (already established for its own purposes) for badges to\ntarget instead of its host, even though that part lives inside the component's own shadow root.\nThis mechanism is shared with `use-menu`/`use-anchored` via `AnchorController`; components\nwithout a `display: contents` host don't need to publish anything.\n\n**Known Firefox limitation:** anchoring across a shadow root boundary this way — the case\n`--usewc-anchor-name` exists for — is mispositioned in Firefox as of this writing. Verified\ndirectly: `anchor()`'s logical `start`/`end` keywords resolve backwards on both axes\nspecifically for a cross-shadow-root anchor reference, in Firefox only — the same anchor()\ncalls resolve correctly for a same-tree anchor in Firefox, and cross-shadow anchoring resolves\ncorrectly in Chromium and Safari. A badge anchored to a plain element (button, input, anything\nthat isn't itself relying on this escape hatch) is unaffected in every engine, including\nFirefox.\n\n## Side effects\n\nThe badge is a sibling of its anchor rather than a child, so **as a side effect, a badge\nmutates its anchor element**: it appends its own id to the anchor's `aria-describedby`\n(preserving any ids already there, the same way `anchor-name` is appended rather than\nreplaced) to keep its content connected to the anchor for assistive technology. This means a\nbadge's content, or its `aria-label` when set, is announced as part of interacting with the\nanchor, e.g. \"Inbox button, 3\". A `dot` badge has no content of its own, so set `aria-label`\ndirectly on `<use-badge>` for a meaningful description (e.g. `aria-label=\"3 unread messages\"`);\nwithout one, the description contributes nothing and the anchor announces as before.\n\nAvoid adding `aria-hidden` to `<use-badge>` if you rely on this: while the description\ncomputation is specified to still read a hidden node when it's the direct target of\n`aria-describedby`, support for that specific case is inconsistent across browsers and screen\nreaders.\n\nSet `options=\"noaria\"` to opt a badge out of this and leave the anchor's `aria-describedby`\nuntouched, e.g. when the anchor already documents the badge's meaning some other way.",
|
|
99
|
-
"name": "UseBadge",
|
|
100
|
-
"slots": [
|
|
101
|
-
{
|
|
102
|
-
"description": "Badge content, e.g. a count or short label. Ignored when `dot` is set.",
|
|
103
|
-
"name": ""
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
"members": [
|
|
107
|
-
{
|
|
108
|
-
"kind": "field",
|
|
109
|
-
"name": "anchortarget",
|
|
110
|
-
"type": {
|
|
111
|
-
"text": "string | undefined"
|
|
112
|
-
},
|
|
113
|
-
"attribute": "anchortarget",
|
|
114
|
-
"reflects": true
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"kind": "field",
|
|
118
|
-
"name": "dot",
|
|
119
|
-
"type": {
|
|
120
|
-
"text": "boolean"
|
|
121
|
-
},
|
|
122
|
-
"default": "false",
|
|
123
|
-
"attribute": "dot",
|
|
124
|
-
"reflects": true
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"kind": "field",
|
|
128
|
-
"name": "blockalign",
|
|
129
|
-
"type": {
|
|
130
|
-
"text": "\"start\" | \"end\""
|
|
131
|
-
},
|
|
132
|
-
"default": "\"start\"",
|
|
133
|
-
"attribute": "blockalign",
|
|
134
|
-
"reflects": true
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"kind": "field",
|
|
138
|
-
"name": "inlinealign",
|
|
139
|
-
"type": {
|
|
140
|
-
"text": "\"start\" | \"end\""
|
|
141
|
-
},
|
|
142
|
-
"default": "\"end\"",
|
|
143
|
-
"attribute": "inlinealign",
|
|
144
|
-
"reflects": true
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"kind": "field",
|
|
148
|
-
"name": "options",
|
|
149
|
-
"type": {
|
|
150
|
-
"text": "string"
|
|
151
|
-
},
|
|
152
|
-
"default": "\"\"",
|
|
153
|
-
"attribute": "options",
|
|
154
|
-
"reflects": true
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"kind": "field",
|
|
158
|
-
"name": "anchorElement",
|
|
159
|
-
"description": "The element this badge is anchored to. Reading returns whatever element was last resolved,\neither from the `anchortarget` id or set here directly. Setting it anchors to that element\ninstead of resolving `anchortarget`, for cases where the target has no id to reference."
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
"attributes": [
|
|
163
|
-
{
|
|
164
|
-
"description": "Id of the element to anchor to, resolved in the badge's own tree.",
|
|
165
|
-
"name": "anchortarget",
|
|
166
|
-
"type": {
|
|
167
|
-
"text": "string | undefined"
|
|
168
|
-
},
|
|
169
|
-
"fieldName": "anchortarget"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"description": "Renders as a fixed-size dot instead of the slotted content.",
|
|
173
|
-
"name": "dot",
|
|
174
|
-
"type": {
|
|
175
|
-
"text": "boolean"
|
|
176
|
-
},
|
|
177
|
-
"default": "false",
|
|
178
|
-
"fieldName": "dot"
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
"description": "`\"start\" | \"end\"`: Aligns the badge along the block axis relative to its anchor.",
|
|
182
|
-
"name": "blockalign",
|
|
183
|
-
"type": {
|
|
184
|
-
"text": "\"start\" | \"end\""
|
|
185
|
-
},
|
|
186
|
-
"default": "\"start\"",
|
|
187
|
-
"fieldName": "blockalign"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"description": "`\"start\" | \"end\"`: Aligns the badge along the inline axis relative to its anchor.",
|
|
191
|
-
"name": "inlinealign",
|
|
192
|
-
"type": {
|
|
193
|
-
"text": "\"start\" | \"end\""
|
|
194
|
-
},
|
|
195
|
-
"default": "\"end\"",
|
|
196
|
-
"fieldName": "inlinealign"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"description": "Space-separated feature flags. `noaria` opts out of the automatic `aria-describedby` wiring described above.",
|
|
200
|
-
"name": "options",
|
|
201
|
-
"type": {
|
|
202
|
-
"text": "string"
|
|
203
|
-
},
|
|
204
|
-
"default": "\"\"",
|
|
205
|
-
"fieldName": "options"
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
"superclass": {
|
|
209
|
-
"name": "LitElement",
|
|
210
|
-
"package": "lit"
|
|
211
|
-
},
|
|
212
|
-
"tagName": "use-badge",
|
|
213
|
-
"customElement": true
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"exports": [
|
|
217
|
-
{
|
|
218
|
-
"kind": "js",
|
|
219
|
-
"name": "UseBadge",
|
|
220
|
-
"declaration": {
|
|
221
|
-
"name": "UseBadge",
|
|
222
|
-
"module": "src/elements/use-badge/use-badge.ts"
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
"kind": "custom-element-definition",
|
|
227
|
-
"name": "use-badge",
|
|
228
|
-
"declaration": {
|
|
229
|
-
"name": "UseBadge",
|
|
230
|
-
"module": "src/elements/use-badge/use-badge.ts"
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
]
|
|
234
|
-
},
|
|
235
92
|
{
|
|
236
93
|
"kind": "javascript-module",
|
|
237
94
|
"path": "src/elements/use-calendar-base/use-calendar-base.ts",
|
|
@@ -637,6 +494,149 @@
|
|
|
637
494
|
}
|
|
638
495
|
]
|
|
639
496
|
},
|
|
497
|
+
{
|
|
498
|
+
"kind": "javascript-module",
|
|
499
|
+
"path": "src/elements/use-badge/use-badge.ts",
|
|
500
|
+
"declarations": [
|
|
501
|
+
{
|
|
502
|
+
"kind": "class",
|
|
503
|
+
"description": "`use-badge` renders a small indicator anchored to another element's corner, using\n[CSS anchor positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning)\ninstead of the classic `position: absolute` + negative-offset trick. This lets the badge live\nanywhere in the DOM rather than being a child of the element it decorates. A badge's shape,\ncolor, and positioning ship built in — reading from the design system's tokens when\n`tokens.css` is loaded, and falling back to sensible defaults otherwise — so no theme is\nrequired to get a working, visible badge.\n\nPoint a badge at its target with the `anchortarget` attribute, set to the target's `id`\n(named to avoid colliding with the `anchor` content attribute HTML is gaining natively):\n\n```html\n<button type=\"button\" id=\"inbox\">Inbox</button>\n<use-badge anchortarget=\"inbox\">99+</use-badge>\n```\n\nThe badge and its anchor must live in the same DOM tree — a badge cannot reach an anchor\ninside another component's shadow root, and an anchor's `anchor-name` set inside a shadow\ntree's stylesheet is not visible here. No positioned ancestor or shared containing block is\nrequired: anchor positioning resolves the badge's location straight from the anchor's own\ngeometry, so the badge can sit anywhere else in the DOM tree.\n\nWithout a resolved anchor — `anchortarget` unset, pointing at a missing id, or `anchorElement`\nnever assigned — the badge has no `:state(anchored)` and renders as a plain inline chip in\nnormal document flow, still using the same color/shape styling.\n\nSome components render their host as `display: contents`, which has no box of its own for CSS\nanchor positioning to resolve against. If the anchor computes a non-empty `--usewc-anchor-name`\ncustom property, the badge uses that dashed-ident as its `position-anchor` directly instead of\ngenerating and writing its own onto the anchor — letting a component publish the name of a\nreal, box-generating part of itself (already established for its own purposes) for badges to\ntarget instead of its host, even though that part lives inside the component's own shadow root.\nThis mechanism is shared with `use-menu`/`use-anchored` via `AnchorController`; components\nwithout a `display: contents` host don't need to publish anything.\n\n**Known Firefox limitation:** anchoring across a shadow root boundary this way — the case\n`--usewc-anchor-name` exists for — is mispositioned in Firefox as of this writing. Verified\ndirectly: `anchor()`'s logical `start`/`end` keywords resolve backwards on both axes\nspecifically for a cross-shadow-root anchor reference, in Firefox only — the same anchor()\ncalls resolve correctly for a same-tree anchor in Firefox, and cross-shadow anchoring resolves\ncorrectly in Chromium and Safari. A badge anchored to a plain element (button, input, anything\nthat isn't itself relying on this escape hatch) is unaffected in every engine, including\nFirefox.\n\n## Side effects\n\nThe badge is a sibling of its anchor rather than a child, so **as a side effect, a badge\nmutates its anchor element**: it appends its own id to the anchor's `aria-describedby`\n(preserving any ids already there, the same way `anchor-name` is appended rather than\nreplaced) to keep its content connected to the anchor for assistive technology. This means a\nbadge's content, or its `aria-label` when set, is announced as part of interacting with the\nanchor, e.g. \"Inbox button, 3\". A `dot` badge has no content of its own, so set `aria-label`\ndirectly on `<use-badge>` for a meaningful description (e.g. `aria-label=\"3 unread messages\"`);\nwithout one, the description contributes nothing and the anchor announces as before.\n\nAvoid adding `aria-hidden` to `<use-badge>` if you rely on this: while the description\ncomputation is specified to still read a hidden node when it's the direct target of\n`aria-describedby`, support for that specific case is inconsistent across browsers and screen\nreaders.\n\nSet `options=\"noaria\"` to opt a badge out of this and leave the anchor's `aria-describedby`\nuntouched, e.g. when the anchor already documents the badge's meaning some other way.",
|
|
504
|
+
"name": "UseBadge",
|
|
505
|
+
"slots": [
|
|
506
|
+
{
|
|
507
|
+
"description": "Badge content, e.g. a count or short label. Ignored when `dot` is set.",
|
|
508
|
+
"name": ""
|
|
509
|
+
}
|
|
510
|
+
],
|
|
511
|
+
"members": [
|
|
512
|
+
{
|
|
513
|
+
"kind": "field",
|
|
514
|
+
"name": "anchortarget",
|
|
515
|
+
"type": {
|
|
516
|
+
"text": "string | undefined"
|
|
517
|
+
},
|
|
518
|
+
"attribute": "anchortarget",
|
|
519
|
+
"reflects": true
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"kind": "field",
|
|
523
|
+
"name": "dot",
|
|
524
|
+
"type": {
|
|
525
|
+
"text": "boolean"
|
|
526
|
+
},
|
|
527
|
+
"default": "false",
|
|
528
|
+
"attribute": "dot",
|
|
529
|
+
"reflects": true
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"kind": "field",
|
|
533
|
+
"name": "blockalign",
|
|
534
|
+
"type": {
|
|
535
|
+
"text": "\"start\" | \"end\""
|
|
536
|
+
},
|
|
537
|
+
"default": "\"start\"",
|
|
538
|
+
"attribute": "blockalign",
|
|
539
|
+
"reflects": true
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
"kind": "field",
|
|
543
|
+
"name": "inlinealign",
|
|
544
|
+
"type": {
|
|
545
|
+
"text": "\"start\" | \"end\""
|
|
546
|
+
},
|
|
547
|
+
"default": "\"end\"",
|
|
548
|
+
"attribute": "inlinealign",
|
|
549
|
+
"reflects": true
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"kind": "field",
|
|
553
|
+
"name": "options",
|
|
554
|
+
"type": {
|
|
555
|
+
"text": "string"
|
|
556
|
+
},
|
|
557
|
+
"default": "\"\"",
|
|
558
|
+
"attribute": "options",
|
|
559
|
+
"reflects": true
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"kind": "field",
|
|
563
|
+
"name": "anchorElement",
|
|
564
|
+
"description": "The element this badge is anchored to. Reading returns whatever element was last resolved,\neither from the `anchortarget` id or set here directly. Setting it anchors to that element\ninstead of resolving `anchortarget`, for cases where the target has no id to reference."
|
|
565
|
+
}
|
|
566
|
+
],
|
|
567
|
+
"attributes": [
|
|
568
|
+
{
|
|
569
|
+
"description": "Id of the element to anchor to, resolved in the badge's own tree.",
|
|
570
|
+
"name": "anchortarget",
|
|
571
|
+
"type": {
|
|
572
|
+
"text": "string | undefined"
|
|
573
|
+
},
|
|
574
|
+
"fieldName": "anchortarget"
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"description": "Renders as a fixed-size dot instead of the slotted content.",
|
|
578
|
+
"name": "dot",
|
|
579
|
+
"type": {
|
|
580
|
+
"text": "boolean"
|
|
581
|
+
},
|
|
582
|
+
"default": "false",
|
|
583
|
+
"fieldName": "dot"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"description": "`\"start\" | \"end\"`: Aligns the badge along the block axis relative to its anchor.",
|
|
587
|
+
"name": "blockalign",
|
|
588
|
+
"type": {
|
|
589
|
+
"text": "\"start\" | \"end\""
|
|
590
|
+
},
|
|
591
|
+
"default": "\"start\"",
|
|
592
|
+
"fieldName": "blockalign"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"description": "`\"start\" | \"end\"`: Aligns the badge along the inline axis relative to its anchor.",
|
|
596
|
+
"name": "inlinealign",
|
|
597
|
+
"type": {
|
|
598
|
+
"text": "\"start\" | \"end\""
|
|
599
|
+
},
|
|
600
|
+
"default": "\"end\"",
|
|
601
|
+
"fieldName": "inlinealign"
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"description": "Space-separated feature flags. `noaria` opts out of the automatic `aria-describedby` wiring described above.",
|
|
605
|
+
"name": "options",
|
|
606
|
+
"type": {
|
|
607
|
+
"text": "string"
|
|
608
|
+
},
|
|
609
|
+
"default": "\"\"",
|
|
610
|
+
"fieldName": "options"
|
|
611
|
+
}
|
|
612
|
+
],
|
|
613
|
+
"superclass": {
|
|
614
|
+
"name": "LitElement",
|
|
615
|
+
"package": "lit"
|
|
616
|
+
},
|
|
617
|
+
"tagName": "use-badge",
|
|
618
|
+
"customElement": true
|
|
619
|
+
}
|
|
620
|
+
],
|
|
621
|
+
"exports": [
|
|
622
|
+
{
|
|
623
|
+
"kind": "js",
|
|
624
|
+
"name": "UseBadge",
|
|
625
|
+
"declaration": {
|
|
626
|
+
"name": "UseBadge",
|
|
627
|
+
"module": "src/elements/use-badge/use-badge.ts"
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"kind": "custom-element-definition",
|
|
632
|
+
"name": "use-badge",
|
|
633
|
+
"declaration": {
|
|
634
|
+
"name": "UseBadge",
|
|
635
|
+
"module": "src/elements/use-badge/use-badge.ts"
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
]
|
|
639
|
+
},
|
|
640
640
|
{
|
|
641
641
|
"kind": "javascript-module",
|
|
642
642
|
"path": "src/elements/use-calendarday/use-calendarday.ts",
|
|
@@ -2167,6 +2167,46 @@
|
|
|
2167
2167
|
}
|
|
2168
2168
|
]
|
|
2169
2169
|
},
|
|
2170
|
+
{
|
|
2171
|
+
"kind": "javascript-module",
|
|
2172
|
+
"path": "src/elements/use-grid/constants.ts",
|
|
2173
|
+
"declarations": [
|
|
2174
|
+
{
|
|
2175
|
+
"kind": "variable",
|
|
2176
|
+
"name": "SELECTION_CELL_ATTRIBUTE",
|
|
2177
|
+
"type": {
|
|
2178
|
+
"text": "string"
|
|
2179
|
+
},
|
|
2180
|
+
"default": "\"data-usewc-selection-cell\""
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
"kind": "variable",
|
|
2184
|
+
"name": "SELECTION_COLUMN_ATTRIBUTE",
|
|
2185
|
+
"type": {
|
|
2186
|
+
"text": "string"
|
|
2187
|
+
},
|
|
2188
|
+
"default": "\"data-usewc-selection-column\""
|
|
2189
|
+
}
|
|
2190
|
+
],
|
|
2191
|
+
"exports": [
|
|
2192
|
+
{
|
|
2193
|
+
"kind": "js",
|
|
2194
|
+
"name": "SELECTION_CELL_ATTRIBUTE",
|
|
2195
|
+
"declaration": {
|
|
2196
|
+
"name": "SELECTION_CELL_ATTRIBUTE",
|
|
2197
|
+
"module": "src/elements/use-grid/constants.ts"
|
|
2198
|
+
}
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
"kind": "js",
|
|
2202
|
+
"name": "SELECTION_COLUMN_ATTRIBUTE",
|
|
2203
|
+
"declaration": {
|
|
2204
|
+
"name": "SELECTION_COLUMN_ATTRIBUTE",
|
|
2205
|
+
"module": "src/elements/use-grid/constants.ts"
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
]
|
|
2209
|
+
},
|
|
2170
2210
|
{
|
|
2171
2211
|
"kind": "javascript-module",
|
|
2172
2212
|
"path": "src/elements/use-grid/index.ts",
|
|
@@ -2244,6 +2284,16 @@
|
|
|
2244
2284
|
"attribute": "selectmode",
|
|
2245
2285
|
"reflects": true
|
|
2246
2286
|
},
|
|
2287
|
+
{
|
|
2288
|
+
"kind": "field",
|
|
2289
|
+
"name": "selectwith",
|
|
2290
|
+
"type": {
|
|
2291
|
+
"text": "SelectWith"
|
|
2292
|
+
},
|
|
2293
|
+
"default": "\"row\"",
|
|
2294
|
+
"attribute": "selectwith",
|
|
2295
|
+
"reflects": true
|
|
2296
|
+
},
|
|
2247
2297
|
{
|
|
2248
2298
|
"kind": "field",
|
|
2249
2299
|
"name": "name",
|
|
@@ -2284,6 +2334,36 @@
|
|
|
2284
2334
|
"attribute": "readonly",
|
|
2285
2335
|
"reflects": true
|
|
2286
2336
|
},
|
|
2337
|
+
{
|
|
2338
|
+
"kind": "field",
|
|
2339
|
+
"name": "isMultiSelect",
|
|
2340
|
+
"description": "`true` when `selectmode=\"multiple\"`. Read by `use-gridcell` selection cells.",
|
|
2341
|
+
"readonly": true
|
|
2342
|
+
},
|
|
2343
|
+
{
|
|
2344
|
+
"kind": "field",
|
|
2345
|
+
"name": "injectsSelectionColumn",
|
|
2346
|
+
"description": "`true` when a checkbox/radio selection column should exist (`selectmode` on and `selectwith`\nincludes `control`). Read by `use-gridrow.reconcileSelectorCell`.",
|
|
2347
|
+
"readonly": true
|
|
2348
|
+
},
|
|
2349
|
+
{
|
|
2350
|
+
"kind": "field",
|
|
2351
|
+
"name": "selectionGroupName",
|
|
2352
|
+
"description": "The shared `name` for injected radio controls — the grid's `name` when set, otherwise a stable\ngenerated id. Lazily created so single-select grids without a `name` still group correctly.",
|
|
2353
|
+
"readonly": true
|
|
2354
|
+
},
|
|
2355
|
+
{
|
|
2356
|
+
"kind": "method",
|
|
2357
|
+
"name": "isRowDisabled",
|
|
2358
|
+
"parameters": [
|
|
2359
|
+
{
|
|
2360
|
+
"name": "row",
|
|
2361
|
+
"type": {
|
|
2362
|
+
"text": "Element | null | undefined"
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
]
|
|
2366
|
+
},
|
|
2287
2367
|
{
|
|
2288
2368
|
"kind": "field",
|
|
2289
2369
|
"name": "value",
|
|
@@ -2301,6 +2381,14 @@
|
|
|
2301
2381
|
"default": "\"none\"",
|
|
2302
2382
|
"fieldName": "selectmode"
|
|
2303
2383
|
},
|
|
2384
|
+
{
|
|
2385
|
+
"name": "selectwith",
|
|
2386
|
+
"type": {
|
|
2387
|
+
"text": "SelectWith"
|
|
2388
|
+
},
|
|
2389
|
+
"default": "\"row\"",
|
|
2390
|
+
"fieldName": "selectwith"
|
|
2391
|
+
},
|
|
2304
2392
|
{
|
|
2305
2393
|
"name": "name",
|
|
2306
2394
|
"type": {
|
|
@@ -2343,6 +2431,14 @@
|
|
|
2343
2431
|
}
|
|
2344
2432
|
],
|
|
2345
2433
|
"exports": [
|
|
2434
|
+
{
|
|
2435
|
+
"kind": "js",
|
|
2436
|
+
"name": "SELECTION_CELL_ATTRIBUTE",
|
|
2437
|
+
"declaration": {
|
|
2438
|
+
"name": "SELECTION_CELL_ATTRIBUTE",
|
|
2439
|
+
"module": "src/elements/use-grid/use-grid.ts"
|
|
2440
|
+
}
|
|
2441
|
+
},
|
|
2346
2442
|
{
|
|
2347
2443
|
"kind": "js",
|
|
2348
2444
|
"name": "UseGrid",
|
|
@@ -2586,6 +2682,10 @@
|
|
|
2586
2682
|
"default": "\"\"",
|
|
2587
2683
|
"attribute": "value",
|
|
2588
2684
|
"reflects": true
|
|
2685
|
+
},
|
|
2686
|
+
{
|
|
2687
|
+
"kind": "method",
|
|
2688
|
+
"name": "reconcileSelectorCell"
|
|
2589
2689
|
}
|
|
2590
2690
|
],
|
|
2591
2691
|
"attributes": [
|
package/dist/design-system.css
CHANGED
|
@@ -977,6 +977,7 @@
|
|
|
977
977
|
padding: var(--usewc-layout-popover-menu-padding);
|
|
978
978
|
background: var(--usewc-color-popover-menu-background);
|
|
979
979
|
border-radius: var(--usewc-effect-popover-menu-border-radius);
|
|
980
|
+
box-shadow: var(--usewc-effect-popover-menu-shadow);
|
|
980
981
|
|
|
981
982
|
@supports (min-block-size: calc-size(fit-content, min(size, 1px))) {
|
|
982
983
|
min-block-size: calc-size(fit-content, min(size, var(--min-size)));
|
|
@@ -1059,9 +1060,19 @@
|
|
|
1059
1060
|
|
|
1060
1061
|
/* use-option's own checkmark now renders in-flow (a slot, not a background-image), so it
|
|
1061
1062
|
already reserves its own leading space via the shared gap/padding above — no extra reservation
|
|
1062
|
-
needed here. This block only concerns the native [role="menuitemcheckbox"/"menuitemradio"]
|
|
1063
|
-
items, whose checkmark is
|
|
1064
|
-
use-menu :is([role="menuitemcheckbox"], [role="menuitemradio"])
|
|
1063
|
+
needed here. This block only concerns the native [role="menuitemcheckbox"/"menuitemradio"] and
|
|
1064
|
+
[aria-selected] items, whose checkmark is theme.css's own ::before on the host. */
|
|
1065
|
+
use-menu :is([role="menuitemcheckbox"], [role="menuitemradio"], [aria-selected]) {
|
|
1066
|
+
&:has(+ :where([role="menuitemcheckbox"], [role="menuitemradio"], [aria-selected])),
|
|
1067
|
+
& + :where([role="menuitemcheckbox"], [role="menuitemradio"], [aria-selected]) {
|
|
1068
|
+
padding-inline-start: calc(var(--usewc-layout-input-padding-inline) * 2 + var(--usewc-layout-selector-width));
|
|
1069
|
+
|
|
1070
|
+
use-theme-escape & {
|
|
1071
|
+
all: revert-layer;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1065
1076
|
use-listbox-input {
|
|
1066
1077
|
&:has(+ :where([role="menuitemcheckbox"], [role="menuitemradio"])),
|
|
1067
1078
|
& + :where([role="menuitemcheckbox"], [role="menuitemradio"]) {
|
|
@@ -1130,19 +1141,46 @@
|
|
|
1130
1141
|
}
|
|
1131
1142
|
|
|
1132
1143
|
/* use-option's own checkmark is themed separately, in icon.css, as a mask on its
|
|
1133
|
-
selected-indicator part rather than a
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1144
|
+
selected-indicator part rather than a ::before on the host — this rule only concerns the
|
|
1145
|
+
native [aria-checked] / [aria-selected] menu items, which have no shadow part to target. The
|
|
1146
|
+
mark is the shared checkmark SVG masked and painted with its own color token (currentColor by
|
|
1147
|
+
default, so it adapts to light/dark on its own), sitting in the leading gutter the
|
|
1148
|
+
padding-reservation block above already carves out. */
|
|
1149
|
+
use-menu :is([aria-checked="true"], [aria-selected="true"]) {
|
|
1150
|
+
position: relative;
|
|
1151
|
+
/* Reserve the gutter unconditionally so the mark never lands on the label, even for a lone
|
|
1152
|
+
marked item with no marked sibling to trigger the adjacency reservation above. */
|
|
1153
|
+
padding-inline-start: calc(var(--usewc-layout-input-padding-inline) * 2 + var(--usewc-layout-selector-width));
|
|
1141
1154
|
|
|
1142
|
-
|
|
1155
|
+
&::before {
|
|
1156
|
+
content: "";
|
|
1157
|
+
position: absolute;
|
|
1158
|
+
inset-block: 0;
|
|
1159
|
+
inset-inline-start: var(--usewc-layout-input-padding-inline);
|
|
1160
|
+
margin-block: auto;
|
|
1161
|
+
inline-size: var(--usewc-layout-menu-item-checkmark-size);
|
|
1162
|
+
block-size: var(--usewc-layout-menu-item-checkmark-size);
|
|
1163
|
+
background-color: var(--usewc-effect-menu-item-checkmark-color, currentColor);
|
|
1164
|
+
mask-image: var(--usewc-effect-menu-item-checkmark-mask-image, var(--usewc-icon-checkmark));
|
|
1165
|
+
mask-size: contain;
|
|
1166
|
+
mask-repeat: no-repeat;
|
|
1167
|
+
mask-position: center;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
use-theme-escape &,
|
|
1171
|
+
use-theme-escape &::before {
|
|
1143
1172
|
all: revert-layer;
|
|
1144
1173
|
}
|
|
1145
1174
|
}
|
|
1175
|
+
|
|
1176
|
+
/* Before it upgrades, a popover-bound use-menu has no [popover] attribute yet — the element
|
|
1177
|
+
injects it in connectedCallback — and isn't :defined, so its slotted items would flash as
|
|
1178
|
+
block content on load. Hide it until then. Once upgraded it's :defined (this rule stops
|
|
1179
|
+
matching) and the injected [popover] keeps it hidden while closed. A standalone always-visible
|
|
1180
|
+
use-menu is hidden only for the few milliseconds until it upgrades. */
|
|
1181
|
+
use-menu:not([popover]):not(:defined) {
|
|
1182
|
+
display: none;
|
|
1183
|
+
}
|
|
1146
1184
|
}
|
|
1147
1185
|
|
|
1148
1186
|
/* Badge — use-badge.ts ships fixed, literal default styles with no knowledge of the token
|
|
@@ -1401,9 +1439,10 @@
|
|
|
1401
1439
|
}
|
|
1402
1440
|
|
|
1403
1441
|
/* ...but not right after a selection header cell — a select column reads as separate from the
|
|
1404
|
-
data columns without a rule between it and the first one. `use-
|
|
1405
|
-
cell with `data-usewc-selection-cell` (a real select-all checkbox, or an inert hidden
|
|
1406
|
-
spacer in single-select mode); a dev driving selection by hand uses a bare
|
|
1442
|
+
data columns without a rule between it and the first one. `use-gridrow` provisions the
|
|
1443
|
+
leading cell with `data-usewc-selection-cell` (a real select-all checkbox, or an inert hidden
|
|
1444
|
+
radio spacer in single-select mode); a dev driving selection by hand uses a bare
|
|
1445
|
+
checkbox/radio. */
|
|
1407
1446
|
use-gridhead
|
|
1408
1447
|
use-gridcell:is([data-usewc-selection-cell], :has(> input:is([type="checkbox"], [type="radio"])))
|
|
1409
1448
|
+ use-gridcell[role="columnheader"]::before {
|
|
@@ -1451,8 +1490,8 @@
|
|
|
1451
1490
|
showing centres the masked glyph inside it (no inline-block `vertical-align` guesswork).
|
|
1452
1491
|
The `[selected]` / `:not([selected])` split keeps the hidden slot on the shadow's
|
|
1453
1492
|
`display: none`; the `:not([selectmode="none"])` guard keeps a selection-less grid blank, and
|
|
1454
|
-
`use-gridrow:not([data-usewc-selection-column])` (an attribute
|
|
1455
|
-
|
|
1493
|
+
`use-gridrow:not([data-usewc-selection-column])` (an attribute the row sets on itself while
|
|
1494
|
+
it holds a checkbox/radio cell) keeps it blank when that control is the indicator —
|
|
1456
1495
|
otherwise the empty 1lh slot renders as a ghost column left of the control.
|
|
1457
1496
|
|
|
1458
1497
|
The leading gutter matches the injected checkbox/radio cell's inline padding, so the ✔ glyph
|
|
@@ -1557,6 +1596,25 @@
|
|
|
1557
1596
|
--usewc-color-grid-row-background: var(--usewc-color-grid-row-background-selected-hover);
|
|
1558
1597
|
}
|
|
1559
1598
|
|
|
1599
|
+
/* In the `row control` combo mode a whole-row hover both lights the row band (above) and
|
|
1600
|
+
previews the selection control, so the injected checkbox/radio picks up its own hover
|
|
1601
|
+
treatment even though the pointer is over the row rather than the control itself. Mirrors the
|
|
1602
|
+
`:not(...)` guards in selector.css — a disabled/readonly/checked control keeps its resting
|
|
1603
|
+
state — and wins over that rule because `use-theme.grid` imports after `use-theme.selector`. */
|
|
1604
|
+
use-grid:not(.chips, .list)[selectwith~="row"][selectwith~="control"]
|
|
1605
|
+
use-gridbody
|
|
1606
|
+
use-gridrow:not([disabled], [aria-disabled="true"]):hover
|
|
1607
|
+
use-gridcell[data-usewc-selection-cell]
|
|
1608
|
+
input:is([type="checkbox"], [type="radio"]):not(
|
|
1609
|
+
:disabled,
|
|
1610
|
+
[aria-disabled="true"],
|
|
1611
|
+
[aria-readonly="true"],
|
|
1612
|
+
:checked
|
|
1613
|
+
) {
|
|
1614
|
+
--usewc-color-selector-border: var(--usewc-color-selector-border-hover);
|
|
1615
|
+
--usewc-color-selector-background: var(--usewc-color-selector-background-hover);
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1560
1618
|
/* Cursor for a selectable, non-disabled row body. */
|
|
1561
1619
|
use-grid:not(.chips, .list):not([selectmode="none"]):is(:not([selectwith]), [selectwith~="row"])
|
|
1562
1620
|
use-gridbody
|
package/dist/docs/use-grid.md
CHANGED
|
@@ -17,6 +17,7 @@ Provide `aria-label` or `aria-labelledby` on the `use-grid` element so screen re
|
|
|
17
17
|
| Name | Type | Default | Description |
|
|
18
18
|
| --- | --- | --- | --- |
|
|
19
19
|
| selectmode | `"multiple" \| "single" \| "none"` | `"none"` | - |
|
|
20
|
+
| selectwith | `SelectWith` | `"row"` | - |
|
|
20
21
|
| name | `string` | `""` | - |
|
|
21
22
|
| role | `string` | `"grid"` | - |
|
|
22
23
|
| disabled | `boolean` | `false` | - |
|
|
@@ -27,8 +28,19 @@ Provide `aria-label` or `aria-labelledby` on the `use-grid` element so screen re
|
|
|
27
28
|
| Name | Type | Default | Description |
|
|
28
29
|
| --- | --- | --- | --- |
|
|
29
30
|
| internals | - | - | - |
|
|
31
|
+
| isMultiSelect | - | - | `true` when `selectmode="multiple"`. Read by `use-gridcell` selection cells. |
|
|
32
|
+
| injectsSelectionColumn | - | - | `true` when a checkbox/radio selection column should exist (`selectmode` on and `selectwith`
|
|
33
|
+
includes `control`). Read by `use-gridrow.reconcileSelectorCell`. |
|
|
34
|
+
| selectionGroupName | - | - | The shared `name` for injected radio controls — the grid's `name` when set, otherwise a stable
|
|
35
|
+
generated id. Lazily created so single-select grids without a `name` still group correctly. |
|
|
30
36
|
| value | `string[] \| string \| null` | - | - |
|
|
31
37
|
|
|
38
|
+
## Methods
|
|
39
|
+
|
|
40
|
+
| Name | Signature | Description |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| isRowDisabled | `(row: Element \| null \| undefined)` | - |
|
|
43
|
+
|
|
32
44
|
## Slots
|
|
33
45
|
|
|
34
46
|
| Name | Description |
|
package/dist/docs/use-gridrow.md
CHANGED
package/dist/tokens.css
CHANGED
|
@@ -238,8 +238,9 @@
|
|
|
238
238
|
--usewc-layout-dropdown-trigger-icon-size: 1em;
|
|
239
239
|
--usewc-effect-select-trigger-background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 16L5.0718 8.5L18.9282 8.5L12 16Z' fill='rgb(55,65,81)' /%3E%3C/svg%3E");
|
|
240
240
|
--usewc-effect-select-trigger-background-size: 1em;
|
|
241
|
-
--usewc-effect-menu-item-checkmark-
|
|
242
|
-
--usewc-effect-menu-item-checkmark-
|
|
241
|
+
--usewc-effect-menu-item-checkmark-mask-image: var(--usewc-icon-checkmark);
|
|
242
|
+
--usewc-effect-menu-item-checkmark-color: currentColor;
|
|
243
|
+
--usewc-layout-menu-item-checkmark-size: var(--usewc-layout-selected-indicator-size);
|
|
243
244
|
--usewc-effect-tree-item-expanded-indicator-mask-image: var(--usewc-icon-caret-block-end);
|
|
244
245
|
--usewc-effect-tree-item-expanded-indicator-color: currentColor;
|
|
245
246
|
--usewc-effect-tree-item-collapsed-indicator-mask-image: var(--usewc-icon-caret-inline-end);
|
|
@@ -618,6 +619,7 @@
|
|
|
618
619
|
--usewc-color-popover-menu-background: var(--usewc-color-canvas-background);
|
|
619
620
|
--usewc-color-popover-menu-border: var(--usewc-color-button-base-border-static);
|
|
620
621
|
--usewc-effect-popover-menu-border-radius: var(--usewc-effect-border-radius-8);
|
|
622
|
+
--usewc-effect-popover-menu-shadow: var(--usewc-effect-surface-shadow);
|
|
621
623
|
--usewc-font-popover-menu-header-size: var(--usewc-font-size-14);
|
|
622
624
|
--usewc-font-popover-menu-header-weight: var(--usewc-font-weight-medium);
|
|
623
625
|
--usewc-color-popover-menu-header-text: var(--usewc-color-gray-400);
|
|
@@ -738,7 +740,6 @@
|
|
|
738
740
|
--usewc-color-range-track-border-hover: var(--usewc-color-gray-600);
|
|
739
741
|
--usewc-color-selector-background-hover: oklch(from var(--usewc-color-gray-700) l c h / 0.5);
|
|
740
742
|
--usewc-effect-select-trigger-background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 16L5.0718 8.5L18.9282 8.5L12 16Z' fill='rgb(229,231,235)' /%3E%3C/svg%3E");
|
|
741
|
-
--usewc-effect-menu-item-checkmark-background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 13L10 18L19 7' stroke='rgb(229,231,235)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C%2Fsvg%3E");
|
|
742
743
|
--usewc-color-surface-backdrop: oklch(0% 0 0 / 0.6);
|
|
743
744
|
/* "Super light" can't float up on a near-black page — hold the primary's hue and chroma
|
|
744
745
|
but drop the lightness so the tint reads as a dark primary wash instead. */
|
package/package.json
CHANGED