@adia-ai/web-components 0.8.42 → 0.8.44

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.
Files changed (186) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/MIGRATION.md +130 -80
  3. package/USAGE.md +1 -1
  4. package/color/index.js +1 -1
  5. package/components/action-list/action-item.a2ui.json +3 -8
  6. package/components/action-list/action-item.yaml +10 -16
  7. package/components/action-list/action-list.class.js +5 -61
  8. package/components/action-list/action-list.d.ts +1 -3
  9. package/components/avatar/avatar.class.js +12 -1
  10. package/components/button/button.d.ts +4 -0
  11. package/components/button/button.yaml +1 -1
  12. package/components/calendar-picker/calendar-picker.a2ui.json +1 -1
  13. package/components/calendar-picker/calendar-picker.class.js +2 -3
  14. package/components/calendar-picker/calendar-picker.css +16 -18
  15. package/components/calendar-picker/calendar-picker.yaml +2 -2
  16. package/components/card/card.css +3 -3
  17. package/components/chart/chart.a2ui.json +29 -18
  18. package/components/chart/chart.class.js +1308 -266
  19. package/components/chart/chart.css +151 -1
  20. package/components/chart/chart.d.ts +9 -9
  21. package/components/chart/chart.yaml +63 -31
  22. package/components/chart-legend/chart-legend.a2ui.json +20 -14
  23. package/components/chart-legend/chart-legend.class.js +79 -58
  24. package/components/chart-legend/chart-legend.css +65 -1
  25. package/components/chart-legend/chart-legend.d.ts +5 -5
  26. package/components/chart-legend/chart-legend.examples.md +4 -4
  27. package/components/chart-legend/chart-legend.yaml +50 -20
  28. package/components/check/check.css +9 -0
  29. package/components/color-area/color-area.a2ui.json +1 -1
  30. package/components/color-area/color-area.class.js +2 -2
  31. package/components/color-area/color-area.css +4 -7
  32. package/components/color-area/color-area.d.ts +1 -1
  33. package/components/color-area/color-area.yaml +3 -3
  34. package/components/color-input/color-input.a2ui.json +1 -1
  35. package/components/color-input/color-input.class.js +1 -1
  36. package/components/color-input/color-input.yaml +2 -2
  37. package/components/combobox/combobox.a2ui.json +3 -0
  38. package/components/combobox/combobox.class.js +9 -8
  39. package/components/combobox/combobox.css +25 -4
  40. package/components/combobox/combobox.yaml +6 -0
  41. package/components/command/command.css +17 -1
  42. package/components/context-menu/context-menu.d.ts +2 -0
  43. package/components/drilldown/drilldown.a2ui.json +3 -0
  44. package/components/drilldown/drilldown.css +8 -1
  45. package/components/drilldown/drilldown.yaml +2 -0
  46. package/components/field/field.class.js +5 -5
  47. package/components/heatmap/heatmap.a2ui.json +5 -0
  48. package/components/heatmap/heatmap.d.ts +2 -0
  49. package/components/heatmap/heatmap.yaml +8 -0
  50. package/components/index.js +0 -4
  51. package/components/input/input.a2ui.json +4 -4
  52. package/components/input/input.class.js +20 -7
  53. package/components/input/input.css +6 -0
  54. package/components/input/input.yaml +15 -11
  55. package/components/integration-card/integration-card.d.ts +2 -0
  56. package/components/menu/menu-item.a2ui.json +3 -8
  57. package/components/menu/menu-item.yaml +13 -21
  58. package/components/menu/menu.class.js +5 -27
  59. package/components/menu/menu.d.ts +1 -3
  60. package/components/noodles/noodles.a2ui.json +0 -15
  61. package/components/noodles/noodles.yaml +0 -12
  62. package/components/number-format/number-format.class.js +10 -0
  63. package/components/pagination/pagination.class.js +88 -4
  64. package/components/pane/pane.a2ui.json +2 -12
  65. package/components/pane/pane.class.js +5 -30
  66. package/components/pane/pane.d.ts +3 -5
  67. package/components/pane/pane.yaml +7 -19
  68. package/components/popover/popover.d.ts +2 -0
  69. package/components/progress/progress.a2ui.json +1 -1
  70. package/components/progress/progress.class.js +13 -8
  71. package/components/progress/progress.d.ts +1 -1
  72. package/components/progress/progress.yaml +2 -2
  73. package/components/radio/radio.css +7 -0
  74. package/components/range/range.class.js +9 -1
  75. package/components/search/search.css +10 -1
  76. package/components/segment/segment.a2ui.json +1 -2
  77. package/components/segment/segment.css +10 -0
  78. package/components/segment/segment.yaml +1 -2
  79. package/components/segmented/segmented.a2ui.json +1 -3
  80. package/components/segmented/segmented.class.js +2 -2
  81. package/components/segmented/segmented.yaml +2 -4
  82. package/components/select/select.a2ui.json +5 -1
  83. package/components/select/select.class.js +14 -14
  84. package/components/select/select.css +20 -1
  85. package/components/select/select.yaml +7 -1
  86. package/components/step-progress/step-progress.yaml +1 -1
  87. package/components/stream/stream.d.ts +2 -0
  88. package/components/switch/switch.css +8 -0
  89. package/components/table/table.a2ui.json +6 -1
  90. package/components/table/table.class.js +18 -1
  91. package/components/table/table.css +31 -6
  92. package/components/table/table.d.ts +3 -1
  93. package/components/table/table.examples.md +2 -2
  94. package/components/table/table.yaml +9 -1
  95. package/components/table-toolbar/table-toolbar.a2ui.json +67 -2
  96. package/components/table-toolbar/table-toolbar.class.js +492 -17
  97. package/components/table-toolbar/table-toolbar.css +311 -0
  98. package/components/table-toolbar/table-toolbar.d.ts +17 -1
  99. package/components/table-toolbar/table-toolbar.yaml +220 -15
  100. package/components/tag/tag.class.js +13 -1
  101. package/components/text/text.a2ui.json +3 -3
  102. package/components/text/text.d.ts +5 -3
  103. package/components/text/text.yaml +3 -3
  104. package/components/textarea/textarea.class.js +9 -1
  105. package/components/textarea/textarea.css +4 -0
  106. package/components/time-picker/time-picker.yaml +3 -2
  107. package/components/tour/tour.d.ts +10 -0
  108. package/components/tree/tree.yaml +1 -1
  109. package/components/upload/upload.class.js +16 -0
  110. package/components/upload/upload.d.ts +7 -0
  111. package/components/upload/upload.yaml +7 -3
  112. package/core/a11y.d.ts +22 -0
  113. package/core/a11y.js +64 -0
  114. package/core/anchor.js +9 -5
  115. package/core/element.js +1 -1
  116. package/core/icons.js +2 -5
  117. package/custom-elements.json +142 -594
  118. package/dist/host.min.css +1 -1
  119. package/dist/host.sheet.js +1 -1
  120. package/dist/theme-provider.min.js +1 -1
  121. package/dist/web-components.min.css +1 -1
  122. package/dist/web-components.min.js +122 -119
  123. package/dist/web-components.sheet.js +1 -1
  124. package/index.d.ts +0 -15
  125. package/package.json +1 -1
  126. package/patterns/access-requests/access-requests.examples.html +1 -1
  127. package/patterns/admin-keys-and-export/admin-keys-and-export.examples.html +7 -7
  128. package/patterns/agent-cost/agent-cost.examples.html +6 -6
  129. package/patterns/agent-memory/agent-memory.examples.html +3 -3
  130. package/patterns/agent-prompt-library/agent-prompt-library.examples.html +8 -8
  131. package/patterns/agent-tool-call/agent-tool-call.examples.html +1 -1
  132. package/patterns/approvals/approvals.examples.html +6 -6
  133. package/patterns/audit-log/audit-log.examples.html +1 -1
  134. package/patterns/bulk-action-toolbar/bulk-action-toolbar.examples.html +4 -4
  135. package/patterns/chart-in-card/chart-in-card.examples.html +124 -10
  136. package/patterns/chart-in-card/chart-in-card.examples.js +37 -0
  137. package/patterns/comments-and-collaboration/comments-and-collaboration.examples.html +5 -5
  138. package/patterns/conversion-funnel/conversion-funnel.html +2 -2
  139. package/patterns/data-tables-inline-edit-and-tree/data-tables-inline-edit-and-tree.examples.html +2 -2
  140. package/patterns/diff-review/diff-review.examples.html +6 -6
  141. package/patterns/editor-shell/editor-shell.examples.html +3 -3
  142. package/patterns/export-flow/export-flow.examples.html +2 -2
  143. package/patterns/filter-bar/filter-bar.examples.html +2 -2
  144. package/patterns/forms-conditional-and-autocomplete/forms-conditional-and-autocomplete.examples.html +2 -2
  145. package/patterns/inline-dialog/inline-dialog.examples.html +2 -2
  146. package/patterns/marketing-engagement/marketing-engagement.examples.html +4 -4
  147. package/patterns/notifications-bell-and-digest/notifications-bell-and-digest.examples.html +1 -1
  148. package/patterns/permissions-matrix/permissions-matrix.examples.html +1 -1
  149. package/patterns/permissions-sharing/permissions-sharing.examples.html +2 -2
  150. package/patterns/profile-public-and-verification/profile-public-and-verification.examples.html +4 -4
  151. package/patterns/search-discovery/search-discovery.examples.html +2 -2
  152. package/styles/colors/semantics/features.css +8 -1
  153. package/styles/components.css +0 -4
  154. package/styles/type/roles.css +29 -9
  155. package/traits/arrow-grid-nav/arrow-grid-nav.js +1 -1
  156. package/traits/resize-observer/resize-observer.js +1 -1
  157. package/components/color-picker/color-picker.a2ui.json +0 -148
  158. package/components/color-picker/color-picker.class.js +0 -46
  159. package/components/color-picker/color-picker.css +0 -14
  160. package/components/color-picker/color-picker.d.ts +0 -99
  161. package/components/color-picker/color-picker.examples.md +0 -19
  162. package/components/color-picker/color-picker.js +0 -17
  163. package/components/color-picker/color-picker.yaml +0 -175
  164. package/components/datetime-picker/datetime-picker.a2ui.json +0 -256
  165. package/components/datetime-picker/datetime-picker.class.js +0 -58
  166. package/components/datetime-picker/datetime-picker.css +0 -11
  167. package/components/datetime-picker/datetime-picker.d.ts +0 -87
  168. package/components/datetime-picker/datetime-picker.examples.md +0 -25
  169. package/components/datetime-picker/datetime-picker.js +0 -17
  170. package/components/datetime-picker/datetime-picker.yaml +0 -254
  171. package/components/progress-row/progress-row.a2ui.json +0 -107
  172. package/components/progress-row/progress-row.class.js +0 -118
  173. package/components/progress-row/progress-row.css +0 -60
  174. package/components/progress-row/progress-row.d.ts +0 -24
  175. package/components/progress-row/progress-row.examples.md +0 -7
  176. package/components/progress-row/progress-row.js +0 -17
  177. package/components/progress-row/progress-row.yaml +0 -85
  178. package/components/toggle-group/toggle-group.a2ui.json +0 -148
  179. package/components/toggle-group/toggle-group.class.js +0 -195
  180. package/components/toggle-group/toggle-group.css +0 -127
  181. package/components/toggle-group/toggle-group.d.ts +0 -50
  182. package/components/toggle-group/toggle-group.examples.md +0 -33
  183. package/components/toggle-group/toggle-group.js +0 -18
  184. package/components/toggle-group/toggle-group.yaml +0 -135
  185. package/components/toggle-group/toggle-option.a2ui.json +0 -86
  186. package/components/toggle-group/toggle-option.yaml +0 -75
@@ -1,24 +0,0 @@
1
- /**
2
- * `<progress-row-ui>` — DEPRECATED (gh#1363 C4) — absorbed into <progress-ui>: set `label` (and optional `meta`) directly on <progress-ui> instead, which activates the identical row layout in place. progress-row-ui keeps working (still composes <progress-ui> internally, unchanged behavior) for existing back-compat markup, but is no longer taught or generated for new work. Was: inline labeled progress row with label, progress bar, and meta text — storage quotas, capacity breakdowns, usage indicators.
3
- *
4
- * @see https://ui-kit.exe.xyz/site/components/progress-row
5
- *
6
- * Type declarations generated by scripts/build/dts-codegen.mjs from
7
- * the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
8
- * run `npm run build:components`, then `npm run codegen:dts` to
9
- * regenerate; or hand-author this file fully if rich event types are
10
- * needed beyond what the yaml `events:` block can express.
11
- */
12
-
13
- import { UIElement } from '../../core/element.js';
14
-
15
- export class UIProgressRow extends UIElement {
16
- /** Left-hand label text */
17
- label: string;
18
- /** Right-hand meta text (e.g. '32 GB', '4.2k / 10k') */
19
- meta: string;
20
- /** Progress value 0-100 (null = indeterminate; legacy -1 accepted for back-compat) */
21
- value: number | null;
22
- /** Color variant for the progress fill */
23
- variant: 'default' | 'success' | 'warning' | 'danger';
24
- }
@@ -1,7 +0,0 @@
1
- # progress-row — Examples
2
-
3
- ## Basic (back-compat)
4
-
5
- ```html
6
- <progress-row-ui label="Storage" value="42" meta="42 GB / 100 GB"></progress-row-ui>
7
- ```
@@ -1,17 +0,0 @@
1
- /**
2
- * `<progress-row-ui>` — auto-registers the tag on import.
3
- *
4
- * For non-side-effect class import (test isolation, tag override), use
5
- * the `class` subpath:
6
- *
7
- * import { UIProgressRow } from '@adia-ai/web-components/components/progress-row/class';
8
- *
9
- * @see ../../USAGE.md#registration--auto-vs-explicit
10
- */
11
-
12
- import { defineIfFree } from '../../core/register.js';
13
- import { UIProgressRow } from './progress-row.class.js';
14
-
15
- defineIfFree('progress-row-ui', UIProgressRow);
16
-
17
- export { UIProgressRow };
@@ -1,85 +0,0 @@
1
- # Generated by scripts/migrate-yamls-to-v1.mjs — migrated to v1 contract.
2
- # Edit this file; run `npm run build:components` to regenerate a2ui.json.
3
- $schema: ../../../../scripts/schemas/component.yaml.schema.json
4
- name: UIProgressRow
5
- tag: progress-row-ui
6
- status: deprecated
7
- component: ProgressRow
8
- category: feedback
9
- version: 1
10
- description: >-
11
- DEPRECATED (gh#1363 C4) — absorbed into <progress-ui>: set
12
- `label` (and optional `meta`) directly on <progress-ui> instead, which
13
- activates the identical row layout in place. progress-row-ui keeps
14
- working (still composes <progress-ui> internally, unchanged behavior)
15
- for existing back-compat markup, but is no longer taught or generated
16
- for new work. Was: inline labeled progress row with label, progress
17
- bar, and meta text — storage quotas, capacity breakdowns, usage
18
- indicators.
19
- # Per ADR-0027 — primitives that programmatically create other primitives
20
- # do NOT auto-import them. Consumer (or demo shell) must explicitly import.
21
- composes:
22
- - progress-ui
23
- props:
24
- label:
25
- description: Left-hand label text
26
- type: string
27
- default: ""
28
- meta:
29
- description: Right-hand meta text (e.g. '32 GB', '4.2k / 10k')
30
- type: string
31
- default: ""
32
- value:
33
- description: Progress value 0-100 (null = indeterminate; legacy -1 accepted for back-compat)
34
- type: number
35
- default: null
36
- variant:
37
- description: Color variant for the progress fill
38
- type: string
39
- default: default
40
- enum:
41
- - default
42
- - success
43
- - warning
44
- - danger
45
- events: {}
46
- slots:
47
- label:
48
- description: "Label region — control label."
49
- meta:
50
- description: "Child content region for the `meta` slot."
51
- states:
52
- - name: idle
53
- description: Default, ready for interaction.
54
- traits: []
55
- tokens: {}
56
- a2ui:
57
- rules:
58
- - rule: 'DEPRECATED — do not generate ProgressRow. Set `label` (and optional `meta`) directly on <progress-ui> instead; label present activates the identical row layout.'
59
- reason: 'Absorbed progress-row-ui''s row layout into progress-ui (gh#1363 C4); this component is now a back-compat alias only.'
60
- - rule: 'For standalone progress bars without a row context use <progress-ui> directly (no `label`).'
61
- reason: 'Composition boundary — unchanged by the absorption.'
62
- anti_patterns:
63
- - wrong: |
64
- {"component": "ProgressRow", "label": "CPU", "value": 92}
65
- why: |
66
- ProgressRow is deprecated — its row layout was absorbed
67
- into Progress directly.
68
- fix: |
69
- {"component": "Progress", "label": "CPU", "value": 92}
70
- # Deliberately empty (gh#1363 C4) — deprecated components carry no
71
- # A2UI examples: the catalog/corpus must never teach `"component":
72
- # "ProgressRow"` as a generation target. See progress.yaml's own examples
73
- # for the equivalent (and current) label+row shape.
74
- examples: []
75
- keywords:
76
- - progressrow
77
- - progress-row
78
- - progress
79
- - row
80
- synonyms:
81
- progress-row: [task-row, progress-line, labeled-progress]
82
- related:
83
- - Progress
84
- - StepProgress
85
- - List
@@ -1,148 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://adiaui.dev/a2ui/v0_9/components/ToggleGroup.json",
4
- "title": "ToggleGroup",
5
- "description": "DEPRECATED (gh#1369) — use <segmented-ui multiple> + <segment-ui> instead. Multi-select button group (unlike <segmented-ui> which is single-select by default). Hosts <toggle-option-ui> children, each independently toggleable; emits change events with the active value set.",
6
- "type": "object",
7
- "allOf": [
8
- {
9
- "$ref": "common_types.json#/$defs/ComponentCommon"
10
- },
11
- {
12
- "$ref": "common_types.json#/$defs/CatalogComponentCommon"
13
- }
14
- ],
15
- "properties": {
16
- "component": {
17
- "const": "ToggleGroup"
18
- },
19
- "single": {
20
- "description": "When true, restrict to one active option (single-select) — clicking the already-selected option again CLEARS it (empty value), unlike a native radiogroup. Migration (gh#1369): [single]=true maps to plain <segmented-ui> (no [multiple]) — note segmented-ui's single-select never clears on re-click, it's standard radiogroup semantics; the default (false, multi-select) maps to <segmented-ui multiple>.",
21
- "type": "boolean",
22
- "default": false
23
- },
24
- "value": {
25
- "description": "Comma-separated selected values",
26
- "type": "string",
27
- "default": ""
28
- }
29
- },
30
- "required": [
31
- "component"
32
- ],
33
- "unevaluatedProperties": false,
34
- "x-adiaui": {
35
- "allowedChildren": [
36
- "ToggleOption"
37
- ],
38
- "anti_patterns": [],
39
- "category": "navigation",
40
- "composes": [],
41
- "events": {
42
- "change": {
43
- "description": "Fired when selection changes. detail: { value }",
44
- "detail": {
45
- "value": {
46
- "description": "New toggle-group value.",
47
- "type": "string"
48
- }
49
- }
50
- }
51
- },
52
- "examples": [
53
- {
54
- "description": "Basic ToggleGroup usage",
55
- "a2ui": "[\n {\n \"id\": \"root\",\n \"component\": \"Card\",\n \"children\": [\n \"sec\"\n ]\n },\n {\n \"id\": \"sec\",\n \"component\": \"Section\",\n \"children\": [\n \"comp\"\n ]\n },\n {\n \"id\": \"comp\",\n \"component\": \"ToggleGroup\",\n \"value\": \"\"\n }\n]",
56
- "name": "basic-toggle-group"
57
- }
58
- ],
59
- "keywords": [
60
- "togglegroup",
61
- "toggle-group",
62
- "toggle",
63
- "group"
64
- ],
65
- "name": "UIToggleGroup",
66
- "parts": {},
67
- "related": [
68
- "ToggleOption",
69
- "Segmented",
70
- "Radio"
71
- ],
72
- "slots": {
73
- "default": {
74
- "description": "Default slot — primary child content."
75
- }
76
- },
77
- "states": [
78
- {
79
- "description": "Default, ready for interaction.",
80
- "name": "idle"
81
- }
82
- ],
83
- "status": "deprecated",
84
- "synonyms": {
85
- "toggle-group": [
86
- "segmented-control",
87
- "option-group",
88
- "toggle-set"
89
- ]
90
- },
91
- "tag": "toggle-group-ui",
92
- "tokens": {
93
- "--toggle-group-border": {
94
- "description": "Border color of the group container"
95
- },
96
- "--toggle-group-height": {
97
- "description": "Height of the group container"
98
- },
99
- "--toggle-group-radius": {
100
- "description": "Border radius of the group container"
101
- },
102
- "--toggle-option-bg-hover": {
103
- "description": "Background color on hover"
104
- },
105
- "--toggle-option-border": {
106
- "description": "Border color between adjacent options"
107
- },
108
- "--toggle-option-duration": {
109
- "description": "Transition duration"
110
- },
111
- "--toggle-option-easing": {
112
- "description": "Transition easing function"
113
- },
114
- "--toggle-option-fg": {
115
- "description": "Default text color"
116
- },
117
- "--toggle-option-fg-disabled": {
118
- "description": "Text color when disabled"
119
- },
120
- "--toggle-option-fg-hover": {
121
- "description": "Text color on hover"
122
- },
123
- "--toggle-option-focus-ring": {
124
- "description": "Focus ring box-shadow"
125
- },
126
- "--toggle-option-font-size": {
127
- "description": "Font size for option text and icons"
128
- },
129
- "--toggle-option-gap": {
130
- "description": "Gap between icon and text within an option"
131
- },
132
- "--toggle-option-height": {
133
- "description": "Min-height of each option"
134
- },
135
- "--toggle-option-px": {
136
- "description": "Horizontal padding of each option"
137
- },
138
- "--toggle-option-selected-bg": {
139
- "description": "Background color when selected"
140
- },
141
- "--toggle-option-selected-fg": {
142
- "description": "Text color when selected"
143
- }
144
- },
145
- "traits": [],
146
- "version": 1
147
- }
148
- }
@@ -1,195 +0,0 @@
1
- /**
2
- * Non-side-effect class export for `<toggle-option-ui>` (+ co-located primitives).
3
- *
4
- * Importing this file gives you the class(es) without auto-registering the tag.
5
- * Useful for test isolation, subclassing with tag-name override, or selective
6
- * composition.
7
- *
8
- * The auto-register path stays at `@adia-ai/web-components/components/toggle-group`
9
- * (which imports this file + calls `defineIfFree()`).
10
- *
11
- * @see ../../USAGE.md#registration--auto-vs-explicit
12
- */
13
-
14
- /**
15
- * DEPRECATED (gh#1369, #1363 C1, ADR-0057) — use <segmented-ui multiple> +
16
- * <segment-ui> instead (same comma-separated value encoding). Kept working
17
- * as-is for existing consumers; no behavior change.
18
- *
19
- * <toggle-group-ui value="bold,italic">
20
- * <toggle-option-ui value="bold" icon="text-b"></toggle-option-ui>
21
- * <toggle-option-ui value="italic" icon="text-italic"></toggle-option-ui>
22
- * <toggle-option-ui value="underline" icon="text-underline"></toggle-option-ui>
23
- * </toggle-group-ui>
24
- *
25
- * Multi-select button group (unlike segmented which is single-select by default).
26
- *
27
- * Properties:
28
- * value — comma-separated selected values
29
- * single — restrict to one active option at a time (default false: multi-select)
30
- */
31
-
32
- import { UIElement } from '../../core/element.js';
33
-
34
- // ── Toggle Option ──
35
- //
36
- // Parent-managed. Selection state flows through `toggle-group-ui`'s `value`
37
- // (and `single` mode flag) — the group's `value` stays the single source of
38
- // truth. ADR-0056 (gh#1303): the child's current-state surface is the
39
- // declared, reflected `selected` prop below, converging onto <segment-ui>'s
40
- // mechanism (yaml → catalog → generative grammar) instead of a private
41
- // stamp. Don't set `selected` directly on an option; drive the group's
42
- // `value` instead.
43
-
44
- export class UIToggleOption extends UIElement {
45
- static properties = {
46
- value: { type: String, default: '', reflect: true },
47
- text: { type: String, default: '', reflect: true },
48
- icon: { type: String, default: '', reflect: true },
49
- disabled: { type: Boolean, default: false, reflect: true },
50
- selected: { type: Boolean, default: false, reflect: true },
51
- };
52
-
53
- static template = () => null;
54
-
55
- #stamped = false;
56
-
57
- // gh#1369 (#1363 C1): DEPRECATED — use <segment-ui> inside
58
- // <segmented-ui multiple> instead. One-time warn, same pattern as
59
- // UIFormElement's #labelWarned (form.js) — informational only, behavior
60
- // is unchanged.
61
- static #deprecationWarned = false;
62
-
63
- connected() {
64
- if (!UIToggleOption.#deprecationWarned) {
65
- UIToggleOption.#deprecationWarned = true;
66
- // eslint-disable-next-line no-console
67
- console.warn(
68
- '[AdiaUI] <toggle-option-ui> is deprecated — use <segment-ui> ' +
69
- 'inside <segmented-ui multiple> instead (gh#1369, #1363 C1). ' +
70
- 'Kept working as-is; no behavior change.',
71
- );
72
- }
73
- this.setAttribute('role', 'button');
74
- this.setAttribute('tabindex', '0');
75
- }
76
-
77
- render() {
78
- if (!this.#stamped) {
79
- this.#stamped = true;
80
- this.#stamp();
81
- }
82
- if (this.disabled) this.setAttribute('aria-disabled', 'true');
83
- else this.removeAttribute('aria-disabled');
84
- this.setAttribute('aria-pressed', this.selected ? 'true' : 'false');
85
- }
86
-
87
- #stamp() {
88
- let inner = '';
89
- if (this.icon) inner += `<icon-ui name="${this.icon}"></icon-ui>`;
90
- if (this.text) inner += `<span data-text>${this.text}</span>`;
91
- this.innerHTML = inner;
92
- }
93
-
94
- disconnected() {
95
- this.#stamped = false;
96
- }
97
- }
98
-
99
- export class UIToggleGroup extends UIElement {
100
- static properties = {
101
- value: { type: String, default: '', reflect: true },
102
- single: { type: Boolean, default: false, reflect: true },
103
- };
104
-
105
- static template = () => null;
106
-
107
- #bound = false;
108
-
109
- // gh#1369 (#1363 C1): DEPRECATED — use <segmented-ui multiple> instead.
110
- static #deprecationWarned = false;
111
-
112
- get #valueSet() {
113
- return new Set(this.value ? this.value.split(',').map(v => v.trim()).filter(Boolean) : []);
114
- }
115
-
116
- connected() {
117
- if (!UIToggleGroup.#deprecationWarned) {
118
- UIToggleGroup.#deprecationWarned = true;
119
- // #deprecationWarned is a one-shot PER CLASS (not per instance,
120
- // matching UIFormElement's #labelWarned pattern) — the message can't
121
- // branch on THIS instance's [single] alone without misleading a page
122
- // that mixes single and non-single toggle-groups, so it states both
123
- // mappings instead (gh#1369 review).
124
- // eslint-disable-next-line no-console
125
- console.warn(
126
- '[AdiaUI] <toggle-group-ui> is deprecated (gh#1369, #1363 C1) — ' +
127
- 'migrate to <segmented-ui multiple> + <segment-ui> (multi-select, ' +
128
- 'the default) or plain <segmented-ui> with no [multiple] (when ' +
129
- '[single] is set — note single-select never clears on re-click, ' +
130
- 'unlike [single]\'s clear-on-reclick). Same comma-separated value ' +
131
- 'encoding either way. Kept working as-is; no behavior change.',
132
- );
133
- }
134
- if (!this.#bound) {
135
- this.#bound = true;
136
- this.addEventListener('click', this.#onClick);
137
- this.addEventListener('keydown', this.#onKey);
138
- }
139
- this.setAttribute('role', 'group');
140
- }
141
-
142
- render() {
143
- const selected = this.#valueSet;
144
- for (const opt of this.querySelectorAll('toggle-option-ui')) {
145
- const optVal = opt.value || opt.getAttribute('value') || '';
146
- const isSelected = selected.has(optVal);
147
- // ADR-0056 (gh#1303): `selected` is the declared, reflected mechanism —
148
- // converges onto <segment-ui>'s convention (opt's own render() stamps
149
- // aria-pressed from it).
150
- opt.selected = isSelected;
151
- }
152
- }
153
-
154
- #toggle(opt) {
155
- if (opt.disabled) return;
156
- const optVal = opt.value || opt.getAttribute('value') || '';
157
- if (!optVal) return;
158
-
159
- const selected = this.#valueSet;
160
-
161
- if (this.single) {
162
- if (selected.has(optVal)) {
163
- selected.clear();
164
- } else {
165
- selected.clear();
166
- selected.add(optVal);
167
- }
168
- } else {
169
- if (selected.has(optVal)) selected.delete(optVal);
170
- else selected.add(optVal);
171
- }
172
-
173
- this.value = [...selected].join(',');
174
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: this.value } }));
175
- }
176
-
177
- #onClick = (e) => {
178
- const opt = e.target.closest('toggle-option-ui');
179
- if (opt && this.contains(opt)) this.#toggle(opt);
180
- };
181
-
182
- #onKey = (e) => {
183
- if (e.key === 'Enter' || e.key === ' ') {
184
- e.preventDefault();
185
- const opt = e.target.closest('toggle-option-ui');
186
- if (opt && this.contains(opt)) this.#toggle(opt);
187
- }
188
- };
189
-
190
- disconnected() {
191
- this.removeEventListener('click', this.#onClick);
192
- this.removeEventListener('keydown', this.#onKey);
193
- this.#bound = false;
194
- }
195
- }
@@ -1,127 +0,0 @@
1
- /* DEPRECATED (gh#1369, #1363 C1, ADR-0057): <toggle-group-ui>/
2
- <toggle-option-ui> are superseded by <segmented-ui multiple> +
3
- <segment-ui> (segment.css owns the equivalent [multiple]-mode styling).
4
- This file is kept as-is for existing consumers — no behavior change.
5
-
6
- Safari 17.x bug: `:scope:not(...):hover` (Flavor A) and `:scope[selected]`
7
- (Flavor B — attribute-removal restyle) both fail inside `@scope`.
8
- Selectors moved out. The @scope is `(toggle-option-ui)` — NOT
9
- `(toggle-group-ui)` — so the moved-out selectors target
10
- `toggle-option-ui:hover` / `toggle-option-ui[selected]`. See
11
- docs/BROWSER-COMPAT.md §3a; mirrors segment.css. */
12
- toggle-option-ui:not([disabled]):hover {
13
- --toggle-option-bg: var(--toggle-option-bg-hover);
14
- --toggle-option-fg: var(--toggle-option-fg-hover);
15
- }
16
-
17
- /* ADR-0056 (gh#1303): converged onto <segment-ui>'s declared, reflected
18
- [selected] prop, set by <toggle-group-ui> (toggle-group.class.js). */
19
- toggle-option-ui[selected] {
20
- --toggle-option-bg: var(--toggle-option-selected-bg);
21
- --toggle-option-fg: var(--toggle-option-selected-fg);
22
- }
23
-
24
- @scope (toggle-group-ui) {
25
- :where(:scope) {
26
- /* ── Tokens ── */
27
- --toggle-group-border-width: 1px;
28
- --toggle-group-border-color: var(--a-ui-border);
29
- --toggle-group-radius: var(--a-radius);
30
- --toggle-group-height: var(--a-size);
31
- text-align: start; /* §text-align-reset — blocks inheritance from centered ancestors */
32
- }
33
-
34
- :scope {
35
- box-sizing: border-box;
36
- display: flex;
37
- border: var(--toggle-group-border-width) solid var(--toggle-group-border-color);
38
- border-radius: var(--toggle-group-radius);
39
- overflow: hidden;
40
- }
41
-
42
- /* Display convention (ADR-0037): block-level by default; [inline] opts back to inline-level. */
43
- :scope[inline] { display: inline-flex; }
44
- }
45
-
46
- @scope (toggle-option-ui) {
47
- :where(:scope) {
48
- /* ── Layout ── */
49
- --toggle-option-gap: var(--a-space-1);
50
- --toggle-option-height: var(--a-size);
51
- --toggle-option-px: var(--a-ui-px);
52
- --toggle-option-border-width: 1px;
53
- --toggle-option-border-color: var(--a-ui-border);
54
-
55
- /* ── Colors ── */
56
- --toggle-option-bg: transparent;
57
- --toggle-option-fg: var(--a-fg-muted);
58
- --toggle-option-fg-hover: var(--md-sys-color-neutral-on-surface);
59
- --toggle-option-bg-hover: var(--a-bg-muted);
60
- --toggle-option-selected-bg: var(--md-sys-color-primary-container);
61
- --toggle-option-selected-fg: var(--a-primary-bg);
62
- --toggle-option-fg-disabled: var(--a-ui-text-disabled);
63
-
64
- /* ── Typography ── */
65
- --toggle-option-font-size: var(--a-ui-size);
66
-
67
- /* ── Transition ── */
68
- --toggle-option-duration: var(--a-duration-fast);
69
- --toggle-option-easing: var(--a-easing);
70
-
71
- /* ── State ── */
72
- --toggle-option-focus-ring: var(--a-focus-ring);
73
- }
74
-
75
- :scope {
76
- box-sizing: border-box;
77
- display: inline-flex;
78
- align-items: center;
79
- justify-content: center;
80
- gap: var(--toggle-option-gap);
81
- min-height: var(--toggle-option-height);
82
- padding: 0 var(--toggle-option-px);
83
- border: none;
84
- background: var(--toggle-option-bg);
85
- color: var(--toggle-option-fg);
86
- font: inherit;
87
- /* font-family floor — see segment.css rationale (inline default; this
88
- scope's tokens don't use the -default suffix). */
89
- font-family: var(--toggle-option-font-family, var(--a-font-family-ui));
90
- font-size: var(--toggle-option-font-size);
91
- cursor: pointer;
92
- transition:
93
- background var(--toggle-option-duration) var(--toggle-option-easing),
94
- color var(--toggle-option-duration) var(--toggle-option-easing);
95
- }
96
-
97
- /* Adjacent options share borders */
98
- :scope + :scope {
99
- border-inline-start: var(--toggle-option-border-width) solid var(--toggle-option-border-color);
100
- }
101
-
102
- /* hover rule moved outside @scope — see Safari 17.x bug note at top. */
103
-
104
- :scope:focus-visible {
105
- outline: none;
106
- box-shadow: var(--toggle-option-focus-ring);
107
- border-color: transparent;
108
- z-index: 1;
109
- }
110
-
111
- /* [selected] state rule moved outside @scope — see Safari 17.x bug note at top. */
112
-
113
- :scope[disabled] {
114
- --toggle-option-fg: var(--toggle-option-fg-disabled);
115
- cursor: not-allowed;
116
- pointer-events: none;
117
- }
118
-
119
- /* Icon sizing */
120
- icon-ui {
121
- --a-icon-size: var(--toggle-option-font-size);
122
- }
123
-
124
- [data-text] {
125
- white-space: nowrap;
126
- }
127
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * `<toggle-group-ui>` — DEPRECATED (gh#1369) — use <segmented-ui multiple> + <segment-ui> instead. Multi-select button group (unlike <segmented-ui> which is single-select by default). Hosts <toggle-option-ui> children, each independently toggleable; emits change events with the active value set.
3
- *
4
- * @see https://ui-kit.exe.xyz/site/components/toggle-group
5
- *
6
- * Type declarations generated by scripts/build/dts-codegen.mjs from
7
- * the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
8
- * run `npm run build:components`, then `npm run codegen:dts` to
9
- * regenerate; or hand-author this file fully if rich event types are
10
- * needed beyond what the yaml `events:` block can express.
11
- */
12
-
13
- import { UIElement } from '../../core/element.js';
14
-
15
- export interface ToggleGroupChangeEventDetail {
16
- /** New toggle-group value. */
17
- value: string;
18
- }
19
-
20
- export type ToggleGroupChangeEvent = CustomEvent<ToggleGroupChangeEventDetail>;
21
-
22
- export class UIToggleGroup extends UIElement {
23
- /** When true, restrict to one active option (single-select) — clicking the already-selected option again CLEARS it (empty value), unlike a native radiogroup. Migration (gh#1369): [single]=true maps to plain <segmented-ui> (no [multiple]) — note segmented-ui's single-select never clears on re-click, it's standard radiogroup semantics; the default (false, multi-select) maps to <segmented-ui multiple>. */
24
- single: boolean;
25
- /** Comma-separated selected values */
26
- value: string;
27
-
28
- addEventListener(type: 'change', listener: (ev: ToggleGroupChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
29
- addEventListener<K extends keyof HTMLElementEventMap>(
30
- type: K,
31
- listener: (this: UIToggleGroup, ev: HTMLElementEventMap[K]) => unknown,
32
- options?: boolean | AddEventListenerOptions,
33
- ): void;
34
- }
35
-
36
- export class UIToggleOption extends UIElement {
37
- /** Disabled state — blocks pointer + keyboard activation. */
38
- disabled: boolean;
39
- /** Optional Phosphor icon name; renders as a leading icon. */
40
- icon: string;
41
- /** Whether this option is currently selected. Managed by the parent
42
- <toggle-group-ui> container (ADR-0056) — don't set directly; the group's
43
- `value` is the single source of truth. Converges onto <segment-ui>'s
44
- declared reflected-prop mechanism. */
45
- selected: boolean;
46
- /** Visible label text. */
47
- text: string;
48
- /** Stable identifier matched against the parent group's `value`. */
49
- value: string;
50
- }