@adia-ai/web-components 0.8.37 → 0.8.39

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 (48) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/MIGRATION.md +9 -7
  3. package/README.md +3 -3
  4. package/bin/doc.mjs +27 -5
  5. package/components/calendar-picker/calendar-picker.css +4 -1
  6. package/components/card/card.css +1 -1
  7. package/components/combobox/combobox.css +6 -0
  8. package/components/command/command.a2ui.json +3 -0
  9. package/components/command/command.class.js +28 -6
  10. package/components/command/command.css +14 -3
  11. package/components/command/command.yaml +5 -0
  12. package/components/date-range-picker/date-range-picker.css +6 -0
  13. package/components/datetime-picker/datetime-picker.css +4 -0
  14. package/components/drilldown/drilldown.a2ui.json +244 -0
  15. package/components/drilldown/drilldown.class.js +550 -0
  16. package/components/drilldown/drilldown.css +304 -0
  17. package/components/drilldown/drilldown.d.ts +68 -0
  18. package/components/drilldown/drilldown.examples.md +20 -0
  19. package/components/drilldown/drilldown.js +17 -0
  20. package/components/drilldown/drilldown.yaml +273 -0
  21. package/components/index.js +1 -0
  22. package/components/modal/modal.class.js +68 -4
  23. package/components/nav/nav.a2ui.json +5 -0
  24. package/components/nav/nav.class.js +35 -12
  25. package/components/nav/nav.d.ts +2 -0
  26. package/components/nav/nav.yaml +18 -0
  27. package/components/nav-item/nav-item.class.js +9 -6
  28. package/components/page/page.a2ui.json +13 -1
  29. package/components/page/page.css +113 -0
  30. package/components/page/page.yaml +30 -3
  31. package/components/select/select.class.js +30 -12
  32. package/components/select/select.css +11 -2
  33. package/components/swatch/swatch.css +6 -4
  34. package/components/toggle-group/toggle-group.class.js +21 -11
  35. package/components/toggle-group/toggle-group.css +16 -8
  36. package/components/toggle-group/toggle-group.d.ts +6 -0
  37. package/components/toggle-group/toggle-group.yaml +10 -0
  38. package/components/toggle-group/toggle-option.a2ui.json +5 -0
  39. package/components/toggle-group/toggle-option.yaml +18 -2
  40. package/custom-elements.json +277 -100
  41. package/dist/theme-provider.min.js +3 -3
  42. package/dist/web-components.min.css +1 -1
  43. package/dist/web-components.min.js +110 -88
  44. package/dist/web-components.sheet.js +1 -1
  45. package/package.json +1 -1
  46. package/patterns/bulk-action-toolbar/bulk-action-toolbar.examples.html +1 -1
  47. package/styles/components.css +1 -0
  48. package/traits/view-transition/view-transition.js +7 -0
@@ -30,10 +30,15 @@ import { UIElement } from '../../core/element.js';
30
30
  // ── Toggle Option ──
31
31
  //
32
32
  // Parent-managed. Selection state flows through `toggle-group-ui`'s `value`
33
- // (and `single` mode flag). Items don't expose `checked` parent applies
34
- // `data-selected` on the DOM element when the item's `value` is part of the
35
- // group's comma-separated `value` list. Consistent with native `<option>`
36
- // inside `<select>`.
33
+ // (and `single` mode flag) the group's `value` stays the single source of
34
+ // truth. ADR-0056 (gh#1303): the child's current-state surface is the
35
+ // declared, reflected `selected` prop below, converging onto <segment-ui>'s
36
+ // mechanism (yaml → catalog → generative grammar) instead of a private
37
+ // stamp. `toggle-group-ui` also stamps the legacy `data-selected` attribute
38
+ // on the same element in parallel — DEPRECATED, kept only because external
39
+ // CSS may already target it as an undocumented hook; its removal rides the
40
+ // 0.9.0 breaking wave. Don't set `selected` directly on an option; drive
41
+ // the group's `value` instead.
37
42
 
38
43
  export class UIToggleOption extends UIElement {
39
44
  static properties = {
@@ -41,6 +46,7 @@ export class UIToggleOption extends UIElement {
41
46
  text: { type: String, default: '', reflect: true },
42
47
  icon: { type: String, default: '', reflect: true },
43
48
  disabled: { type: Boolean, default: false, reflect: true },
49
+ selected: { type: Boolean, default: false, reflect: true },
44
50
  };
45
51
 
46
52
  static template = () => null;
@@ -59,6 +65,7 @@ export class UIToggleOption extends UIElement {
59
65
  }
60
66
  if (this.disabled) this.setAttribute('aria-disabled', 'true');
61
67
  else this.removeAttribute('aria-disabled');
68
+ this.setAttribute('aria-pressed', this.selected ? 'true' : 'false');
62
69
  }
63
70
 
64
71
  #stamp() {
@@ -100,13 +107,16 @@ export class UIToggleGroup extends UIElement {
100
107
  const selected = this.#valueSet;
101
108
  for (const opt of this.querySelectorAll('toggle-option-ui')) {
102
109
  const optVal = opt.value || opt.getAttribute('value') || '';
103
- if (selected.has(optVal)) {
104
- opt.setAttribute('data-selected', '');
105
- opt.setAttribute('aria-pressed', 'true');
106
- } else {
107
- opt.removeAttribute('data-selected');
108
- opt.setAttribute('aria-pressed', 'false');
109
- }
110
+ const isSelected = selected.has(optVal);
111
+ // ADR-0056 (gh#1303): `selected` is the declared, reflected mechanism —
112
+ // converges onto <segment-ui>'s convention (opt's own render() stamps
113
+ // aria-pressed from it). `data-selected` is stamped alongside it only
114
+ // as a DEPRECATED parallel hook for pre-existing external CSS; it no
115
+ // longer drives styling (toggle-group.css) and its removal rides the
116
+ // 0.9.0 breaking wave.
117
+ opt.selected = isSelected;
118
+ if (isSelected) opt.setAttribute('data-selected', '');
119
+ else opt.removeAttribute('data-selected');
110
120
  }
111
121
  }
112
122
 
@@ -1,12 +1,23 @@
1
- /* Safari 17.x bug: `:scope:not(...):hover` inside `@scope` doesn't match
2
- the scope root. Plain selector outside works. The @scope is
3
- `(toggle-option-ui)` NOT `(toggle-group-ui)` — so the moved-out
4
- selector targets `toggle-option-ui:hover`. See docs/BROWSER-COMPAT.md §3a. */
1
+ /* Safari 17.x bug: `:scope:not(...):hover` (Flavor A) and `:scope[selected]`
2
+ (Flavor B attribute-removal restyle) both fail inside `@scope`.
3
+ Selectors moved out. The @scope is `(toggle-option-ui)` — NOT
4
+ `(toggle-group-ui)` so the moved-out selectors target
5
+ `toggle-option-ui:hover` / `toggle-option-ui[selected]`. See
6
+ docs/BROWSER-COMPAT.md §3a; mirrors segment.css. */
5
7
  toggle-option-ui:not([disabled]):hover {
6
8
  --toggle-option-bg: var(--toggle-option-bg-hover);
7
9
  --toggle-option-fg: var(--toggle-option-fg-hover);
8
10
  }
9
11
 
12
+ /* ADR-0056 (gh#1303): converged onto <segment-ui>'s declared, reflected
13
+ [selected] prop, set by <toggle-group-ui> (toggle-group.class.js). The
14
+ parent also stamps the legacy `data-selected` attribute in parallel —
15
+ DEPRECATED, no longer styled here; removal rides the 0.9.0 breaking wave. */
16
+ toggle-option-ui[selected] {
17
+ --toggle-option-bg: var(--toggle-option-selected-bg);
18
+ --toggle-option-fg: var(--toggle-option-selected-fg);
19
+ }
20
+
10
21
  @scope (toggle-group-ui) {
11
22
  :where(:scope) {
12
23
  /* ── Tokens ── */
@@ -94,10 +105,7 @@ toggle-option-ui:not([disabled]):hover {
94
105
  z-index: 1;
95
106
  }
96
107
 
97
- :scope[data-selected] {
98
- --toggle-option-bg: var(--toggle-option-selected-bg);
99
- --toggle-option-fg: var(--toggle-option-selected-fg);
100
- }
108
+ /* [selected] state rule moved outside @scope — see Safari 17.x bug note at top. */
101
109
 
102
110
  :scope[disabled] {
103
111
  --toggle-option-fg: var(--toggle-option-fg-disabled);
@@ -38,6 +38,12 @@ export class UIToggleOption extends UIElement {
38
38
  disabled: boolean;
39
39
  /** Optional Phosphor icon name; renders as a leading icon. */
40
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 (was previously a private
45
+ `data-selected` stamp with no declared API surface). */
46
+ selected: boolean;
41
47
  /** Visible label text. */
42
48
  text: string;
43
49
  /** Stable identifier matched against the parent group's `value`. */
@@ -1,5 +1,13 @@
1
1
  # Generated by scripts/migrate-yamls-to-v1.mjs — migrated to v1 contract.
2
2
  # Edit this file; run `npm run build:components` to regenerate a2ui.json.
3
+ #
4
+ # ADR-0056 (gh#1303): <toggle-option-ui>'s current-state surface converges
5
+ # onto <segment-ui>'s declared, reflected `[selected]` prop (see
6
+ # toggle-option.yaml). This container sets that prop, keeping `value` as the
7
+ # single source of truth. It also stamps the legacy `data-selected`
8
+ # attribute on each option in parallel — DEPRECATED (undocumented external
9
+ # CSS may target it); its removal rides the 0.9.0 breaking wave, not this
10
+ # change.
3
11
  $schema: ../../../../scripts/schemas/component.yaml.schema.json
4
12
  name: UIToggleGroup
5
13
  tag: toggle-group-ui
@@ -80,6 +88,8 @@ a2ui:
80
88
  reason: 'Selection model distinction.'
81
89
  - rule: 'Use for filter chips, multi-flag toggles, day-of-week pickers; for binary on/off use <switch-ui>.'
82
90
  reason: 'Capacity guidance.'
91
+ - rule: 'Sets the child <toggle-option-ui>''s declared [selected] prop to reflect the group value (ADR-0056) — do not author [selected] directly in generated markup; author the group''s value instead.'
92
+ reason: 'Parent-managed declared state — group value stays the single source of truth.'
83
93
  anti_patterns: []
84
94
  examples:
85
95
  - name: basic-toggle-group
@@ -26,6 +26,11 @@
26
26
  "type": "string",
27
27
  "default": ""
28
28
  },
29
+ "selected": {
30
+ "description": "Whether this option is currently selected. Managed by the parent\n<toggle-group-ui> container (ADR-0056) — don't set directly; the group's\n`value` is the single source of truth. Converges onto <segment-ui>'s\ndeclared reflected-prop mechanism (was previously a private\n`data-selected` stamp with no declared API surface).",
31
+ "type": "boolean",
32
+ "default": false
33
+ },
29
34
  "text": {
30
35
  "description": "Visible label text.",
31
36
  "type": "string",
@@ -3,6 +3,12 @@
3
3
  # §228 (v0.5.9): authored to close the §229 baseline class-export-undeclared
4
4
  # drift for UIToggleOption. Ships as a sibling class in toggle-group/toggle-group.class.js
5
5
  # + is registered alongside UIToggleGroup.
6
+ #
7
+ # ADR-0056 (gh#1303): `selected` converges onto <segment-ui>'s declared,
8
+ # parent-managed, reflected-prop convention. `<toggle-group-ui>` also stamps
9
+ # the legacy `data-selected` attribute in parallel — DEPRECATED, kept only
10
+ # because it was an undocumented hook external CSS may already target;
11
+ # removal rides the 0.9.0 breaking wave (see toggle-group.yaml + CHANGELOG).
6
12
 
7
13
  # Child component of <toggle-group-ui>. Surface only inside that parent.
8
14
  $schema: ../../../../scripts/schemas/component.yaml.schema.json
@@ -32,6 +38,16 @@ props:
32
38
  description: Disabled state — blocks pointer + keyboard activation.
33
39
  type: boolean
34
40
  default: false
41
+ selected:
42
+ description: |-
43
+ Whether this option is currently selected. Managed by the parent
44
+ <toggle-group-ui> container (ADR-0056) — don't set directly; the group's
45
+ `value` is the single source of truth. Converges onto <segment-ui>'s
46
+ declared reflected-prop mechanism (was previously a private
47
+ `data-selected` stamp with no declared API surface).
48
+ type: boolean
49
+ default: false
50
+ reflect: true
35
51
 
36
52
  keywords:
37
53
  - toggle-option
@@ -53,5 +69,5 @@ a2ui:
53
69
  reason: 'Multi-select cluster contract.'
54
70
  - rule: 'Different from <segment-ui> (which is single-select inside <segmented-ui>).'
55
71
  reason: 'Selection model boundary.'
56
- - rule: 'Active state controlled via the toggle-option''s own active attribute (independent of siblings).'
57
- reason: 'Parent does not own state in multi-select.'
72
+ - rule: 'Selected state exposed via its own declared [selected] reflected prop, set by the parent <toggle-group-ui> (ADR-0056) — mirrors <segment-ui>''s convention. Do not set [selected] directly; drive the group''s value instead.'
73
+ reason: 'Parent-managed declared state group value stays the single source of truth.'