@adia-ai/web-components 0.8.41 → 0.8.42
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/CHANGELOG.md +21 -0
- package/MIGRATION.md +187 -0
- package/USAGE.md +4 -4
- package/components/action-list/action-item.a2ui.json +8 -3
- package/components/action-list/action-item.yaml +25 -7
- package/components/action-list/action-list.class.js +68 -6
- package/components/action-list/action-list.d.ts +3 -1
- package/components/chart/chart.a2ui.json +18 -3
- package/components/chart/chart.class.js +58 -16
- package/components/chart/chart.d.ts +9 -3
- package/components/chart/chart.yaml +35 -3
- package/components/chart-legend/chart-legend.a2ui.json +6 -1
- package/components/chart-legend/chart-legend.class.js +59 -6
- package/components/chart-legend/chart-legend.css +5 -2
- package/components/chart-legend/chart-legend.d.ts +3 -1
- package/components/chart-legend/chart-legend.yaml +15 -1
- package/components/color-area/color-area.a2ui.json +148 -0
- package/components/color-area/color-area.class.js +657 -0
- package/components/color-area/color-area.css +188 -0
- package/components/color-area/color-area.d.ts +66 -0
- package/components/color-area/color-area.examples.md +19 -0
- package/components/color-area/color-area.js +17 -0
- package/components/color-area/color-area.yaml +183 -0
- package/components/color-input/color-input.a2ui.json +5 -5
- package/components/color-input/color-input.class.js +9 -6
- package/components/color-input/color-input.css +1 -1
- package/components/color-input/color-input.js +2 -2
- package/components/color-input/color-input.yaml +14 -12
- package/components/color-picker/color-picker.a2ui.json +15 -12
- package/components/color-picker/color-picker.class.js +24 -633
- package/components/color-picker/color-picker.css +14 -182
- package/components/color-picker/color-picker.yaml +41 -41
- package/components/description-list/description-list.a2ui.json +1 -1
- package/components/description-list/description-list.css +1 -1
- package/components/description-list/description-list.d.ts +1 -1
- package/components/description-list/description-list.yaml +1 -1
- package/components/field/field.a2ui.json +1 -1
- package/components/field/field.class.js +4 -1
- package/components/field/field.yaml +1 -1
- package/components/index.js +1 -0
- package/components/integration-card/integration-card.examples.md +2 -1
- package/components/menu/menu-item.a2ui.json +8 -3
- package/components/menu/menu-item.yaml +24 -3
- package/components/menu/menu.class.js +34 -6
- package/components/menu/menu.d.ts +3 -1
- package/components/pane/pane.a2ui.json +11 -1
- package/components/pane/pane.class.js +32 -3
- package/components/pane/pane.css +15 -10
- package/components/pane/pane.d.ts +10 -7
- package/components/pane/pane.yaml +15 -1
- package/components/swatch/swatch.yaml +1 -1
- package/components/table-toolbar/table-toolbar.class.js +15 -3
- package/core/icons.js +5 -0
- package/custom-elements.json +191 -16
- package/dist/theme-provider.min.js +1 -1
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +89 -89
- package/dist/web-components.sheet.js +1 -1
- package/index.d.ts +12 -1
- package/package.json +1 -1
- package/patterns/admin-shell/admin-shell.examples.html +2 -2
- package/patterns/form-system/form-system.examples.html +1 -1
- package/styles/components.css +1 -0
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
* type — chart type (default: 'bar')
|
|
22
22
|
* x — key for X-axis data
|
|
23
23
|
* y — key(s) for Y-axis, comma-separated for multi-series
|
|
24
|
-
*
|
|
24
|
+
* no-average — suppress the overlaid average line on bar/line (default: false — line shown).
|
|
25
|
+
* `hide-average` is a deprecated dual-read alias (ADR-0063, gh#1563).
|
|
25
26
|
* color — accent/success/warning/danger/info
|
|
26
|
-
*
|
|
27
|
-
*
|
|
27
|
+
* no-grid — hide gridlines. `hide-grid` is a deprecated dual-read alias (ADR-0063, gh#1563).
|
|
28
|
+
* no-values — hide value labels. `hide-values` is a deprecated dual-read alias (ADR-0063, gh#1563).
|
|
28
29
|
* corner-radius — bar corner radius in px (default: null, falls back to --a-radius)
|
|
29
30
|
* dots — line/multi-line marker visibility: all|none|hover|last (default: all)
|
|
30
31
|
* series-emphasis — multi-line: series key that keeps full area+line treatment; others render line-only, dimmed
|
|
@@ -215,10 +216,19 @@ export class UIChart extends UIElement {
|
|
|
215
216
|
type: { type: String, default: 'bar', reflect: true },
|
|
216
217
|
x: { type: String, default: '', reflect: true },
|
|
217
218
|
y: { type: String, default: '', reflect: true },
|
|
219
|
+
// ADR-0063 (gh#1563) — `no-*` is the ratified negation prefix; `hide-*`
|
|
220
|
+
// retires. `hideAverage`/`hideGrid`/`hideValues` stay declared (dual-
|
|
221
|
+
// read compat, 0.8.42) so old markup keeps reflecting; `#resolveNoAttr()`
|
|
222
|
+
// (called from connected()) mirrors an old-only value onto the new prop
|
|
223
|
+
// + warns once per attribute. Every internal render usage reads the
|
|
224
|
+
// canonical `noAverage`/`noGrid`/`noValues` below.
|
|
218
225
|
hideAverage: { type: Boolean, default: false, reflect: true, attribute: 'hide-average' },
|
|
226
|
+
noAverage: { type: Boolean, default: false, reflect: true, attribute: 'no-average' },
|
|
219
227
|
color: { type: String, default: '', reflect: true },
|
|
220
228
|
hideGrid: { type: Boolean, default: false, reflect: true, attribute: 'hide-grid' },
|
|
229
|
+
noGrid: { type: Boolean, default: false, reflect: true, attribute: 'no-grid' },
|
|
221
230
|
hideValues: { type: Boolean, default: false, reflect: true, attribute: 'hide-values' },
|
|
231
|
+
noValues: { type: Boolean, default: false, reflect: true, attribute: 'no-values' },
|
|
222
232
|
cornerRadius: { type: Number, default: null, reflect: true, attribute: 'corner-radius' },
|
|
223
233
|
smooth: { type: Number, default: 0.4, reflect: true },
|
|
224
234
|
size: { type: String, default: '', reflect: true },
|
|
@@ -241,6 +251,32 @@ export class UIChart extends UIElement {
|
|
|
241
251
|
|
|
242
252
|
static template = () => null;
|
|
243
253
|
|
|
254
|
+
// ADR-0063 (gh#1563) compat-shim warn-once flags — one per renamed
|
|
255
|
+
// attribute (not collapsed into one flag; each fires independently the
|
|
256
|
+
// first time its own old attribute resolves). Per-class, matching
|
|
257
|
+
// toggle-group.class.js's #deprecationWarned idiom.
|
|
258
|
+
static #warned = { hideAverage: false, hideGrid: false, hideValues: false };
|
|
259
|
+
|
|
260
|
+
/** Dual-read resolution for one `hide-*` → `no-*` rename (ADR-0063).
|
|
261
|
+
* New-name precedence: if `newAttr` is present, the old attribute is
|
|
262
|
+
* ignored outright (no mirror, no warn) — the new prop already reflects
|
|
263
|
+
* its own attribute normally. Otherwise, when only the old attribute is
|
|
264
|
+
* present, mirror its (always-true, boolean-presence) value onto the
|
|
265
|
+
* new prop and warn once per class. */
|
|
266
|
+
#resolveNoAttr(oldAttr, newAttr, newProp, warnKey) {
|
|
267
|
+
if (this.hasAttribute(newAttr)) return;
|
|
268
|
+
if (!this.hasAttribute(oldAttr)) return;
|
|
269
|
+
this[newProp] = true;
|
|
270
|
+
if (!UIChart.#warned[warnKey]) {
|
|
271
|
+
UIChart.#warned[warnKey] = true;
|
|
272
|
+
// eslint-disable-next-line no-console
|
|
273
|
+
console.warn(
|
|
274
|
+
`[AdiaUI] <chart-ui [${oldAttr}]> is deprecated — use [${newAttr}] ` +
|
|
275
|
+
`instead (ADR-0063, gh#1563). Kept working as-is; no behavior change.`,
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
244
280
|
#data = [];
|
|
245
281
|
#shapeWarned = false; // FEEDBACK-24: one-shot wrong-.data-shape warning
|
|
246
282
|
#resizeObs = null;
|
|
@@ -317,6 +353,12 @@ export class UIChart extends UIElement {
|
|
|
317
353
|
}
|
|
318
354
|
|
|
319
355
|
connected() {
|
|
356
|
+
// ADR-0063 (gh#1563) compat shims — resolve BEFORE the first render so
|
|
357
|
+
// there's no wrong-then-right flash; see #resolveNoAttr() above.
|
|
358
|
+
this.#resolveNoAttr('hide-average', 'no-average', 'noAverage', 'hideAverage');
|
|
359
|
+
this.#resolveNoAttr('hide-grid', 'no-grid', 'noGrid', 'hideGrid');
|
|
360
|
+
this.#resolveNoAttr('hide-values', 'no-values', 'noValues', 'hideValues');
|
|
361
|
+
|
|
320
362
|
if (!this.hasAttribute('role')) this.setAttribute('role', 'img');
|
|
321
363
|
if (!this.hasAttribute('aria-label')) this.setAttribute('aria-label', `${this.type} chart`);
|
|
322
364
|
|
|
@@ -439,13 +481,13 @@ export class UIChart extends UIElement {
|
|
|
439
481
|
// When the grid is hidden (in-card sparkline-like use) we can zero
|
|
440
482
|
// out the Y-axis label gutter entirely — otherwise the plot area
|
|
441
483
|
// collapses at small sizes.
|
|
442
|
-
const
|
|
443
|
-
const yLabelW =
|
|
484
|
+
const noGrid = this.noGrid;
|
|
485
|
+
const yLabelW = noGrid ? 0 : fontSize * 3.2;
|
|
444
486
|
const hasXLabels = !!this.x;
|
|
445
487
|
const pad = {
|
|
446
|
-
top:
|
|
447
|
-
right:
|
|
448
|
-
bottom: !hasXLabels ||
|
|
488
|
+
top: noGrid ? 2 : fontSize * 1.6,
|
|
489
|
+
right: noGrid ? 2 : fontSize * 1.2,
|
|
490
|
+
bottom: !hasXLabels || noGrid ? 2 : fontSize * 2.2,
|
|
449
491
|
left: yLabelW,
|
|
450
492
|
};
|
|
451
493
|
|
|
@@ -1035,11 +1077,11 @@ export class UIChart extends UIElement {
|
|
|
1035
1077
|
displayTicks = ticks.filter((_, i) => i % 2 === 0 || i === ticks.length - 1);
|
|
1036
1078
|
}
|
|
1037
1079
|
|
|
1038
|
-
//
|
|
1039
|
-
// want labels without gridlines can omit
|
|
1080
|
+
// noGrid suppresses both gridlines AND axis labels — callers who
|
|
1081
|
+
// want labels without gridlines can omit no-grid and rely on token
|
|
1040
1082
|
// overrides to make gridlines transparent. This keeps compact in-card
|
|
1041
1083
|
// charts visually clean.
|
|
1042
|
-
if (!this.
|
|
1084
|
+
if (!this.noGrid) {
|
|
1043
1085
|
const tickRange = ticks[ticks.length - 1] - ticks[0];
|
|
1044
1086
|
const safeRange = tickRange || 1; // Prevent division by zero
|
|
1045
1087
|
for (const t of displayTicks) {
|
|
@@ -1094,8 +1136,8 @@ export class UIChart extends UIElement {
|
|
|
1094
1136
|
let svg = this.#gridAndAxes(width, height, ticks, labels, pad, dims);
|
|
1095
1137
|
|
|
1096
1138
|
// At sm auto-hide value labels (they overlap at narrow widths).
|
|
1097
|
-
const showValues = !this.
|
|
1098
|
-
const showAverage = !this.
|
|
1139
|
+
const showValues = !this.noValues && dims.sizeClass !== 'sm';
|
|
1140
|
+
const showAverage = !this.noAverage && vals.length > 1 && dims.sizeClass !== 'sm' && !this.noGrid;
|
|
1099
1141
|
|
|
1100
1142
|
for (let i = 0; i < data.length; i++) {
|
|
1101
1143
|
const v = vals[i];
|
|
@@ -1155,8 +1197,8 @@ export class UIChart extends UIElement {
|
|
|
1155
1197
|
const isSm = dims.sizeClass === 'sm';
|
|
1156
1198
|
const dotR = isSm ? 1.5 : 3;
|
|
1157
1199
|
const hitR = Math.max(dotR, 10); // invisible hit-target for tooltip
|
|
1158
|
-
const showValues = !this.
|
|
1159
|
-
const showAverage = !this.
|
|
1200
|
+
const showValues = !this.noValues && !isSm;
|
|
1201
|
+
const showAverage = !this.noAverage && vals.length > 1 && !isSm && !this.noGrid;
|
|
1160
1202
|
|
|
1161
1203
|
points.forEach((p, i) => {
|
|
1162
1204
|
if (this.#shouldRenderDot(i, points.length)) {
|
|
@@ -2108,7 +2150,7 @@ export class UIChart extends UIElement {
|
|
|
2108
2150
|
const by = pad.top + plotH - barH;
|
|
2109
2151
|
svg += `<path${this.#seriesFill(k % 10, keys[k])}${tip({ label: labels[i], value: v, series: keys[k] })} d="${topRoundedBarPath(bx, by, subBarW, barH, this.#resolveRadius())}"/>`;
|
|
2110
2152
|
|
|
2111
|
-
if (!this.
|
|
2153
|
+
if (!this.noValues) {
|
|
2112
2154
|
svg += `<text data-value x="${bx + subBarW / 2}" y="${by - 4}" text-anchor="middle" font-size="${dims.valueSize}">${this.#fmtValue(v)}</text>`;
|
|
2113
2155
|
}
|
|
2114
2156
|
}
|
|
@@ -30,14 +30,20 @@ export class UIChart extends UIElement {
|
|
|
30
30
|
dots: 'all' | 'none' | 'hover' | 'last';
|
|
31
31
|
/** Number-format mode applied to axis labels + value overlays + donut total + gauge value + treemap value + funnel value + internal tooltip. `abbr` is the legacy 1.2K / 3M format; `decimal` fixes 2 decimals; `currency` prefixes via `--chart-currency-prefix` token (default "$"); `percent` multiplies × 100 and adds a % suffix. */
|
|
32
32
|
format: 'abbr' | 'decimal' | 'currency' | 'percent';
|
|
33
|
-
/**
|
|
33
|
+
/** DEPRECATED (ADR-0063, gh#1563) — use `noAverage` instead. Same meaning, same default; kept working as a dual-read compat shim (one- time console.warn when it's the name that resolves). Removed in 0.9.0. */
|
|
34
34
|
hideAverage: boolean;
|
|
35
|
-
/**
|
|
35
|
+
/** DEPRECATED (ADR-0063, gh#1563) — use `noGrid` instead. Same meaning, same default; kept working as a dual-read compat shim (one-time console.warn when it's the name that resolves). Removed in 0.9.0. */
|
|
36
36
|
hideGrid: boolean;
|
|
37
|
-
/**
|
|
37
|
+
/** DEPRECATED (ADR-0063, gh#1563) — use `noValues` instead. Same meaning, same default; kept working as a dual-read compat shim (one- time console.warn when it's the name that resolves). Removed in 0.9.0. */
|
|
38
38
|
hideValues: boolean;
|
|
39
39
|
/** Show a skeleton placeholder instead of the chart body. Set to true while data is being fetched; clear once data arrives. Preserves the element's aspect-ratio dimensions so the skeleton occupies the same space the chart will fill. Parity with stat-ui[loading] and table-ui[loading] (§FB-12, v0.6.27). */
|
|
40
40
|
loading: boolean;
|
|
41
|
+
/** When true, suppress the overlaid average line. Canonical spelling (ADR-0063, gh#1563) replacing `hideAverage`. */
|
|
42
|
+
noAverage: boolean;
|
|
43
|
+
/** Hide gridlines. Canonical spelling (ADR-0063, gh#1563) replacing `hideGrid`. */
|
|
44
|
+
noGrid: boolean;
|
|
45
|
+
/** Hide value labels. Canonical spelling (ADR-0063, gh#1563) replacing `hideValues`. */
|
|
46
|
+
noValues: boolean;
|
|
41
47
|
/** Multi-line only. Names one series key (matching a `y` key) to render at full strength — area fill + full-opacity line. Every other series drops its area fill and renders line-only at --chart-deemphasized-opacity. Empty (default) applies full treatment to every series, unchanged from pre-gh#561 behavior. */
|
|
42
48
|
seriesEmphasis: string;
|
|
43
49
|
/** Chart size */
|
|
@@ -62,20 +62,52 @@ props:
|
|
|
62
62
|
- danger
|
|
63
63
|
- info
|
|
64
64
|
hideAverage:
|
|
65
|
-
description:
|
|
65
|
+
description: >-
|
|
66
|
+
DEPRECATED (ADR-0063, gh#1563) — use `noAverage` instead. Same
|
|
67
|
+
meaning, same default; kept working as a dual-read compat shim (one-
|
|
68
|
+
time console.warn when it's the name that resolves). Removed in
|
|
69
|
+
0.9.0.
|
|
66
70
|
type: boolean
|
|
67
71
|
default: false
|
|
68
72
|
attribute: hide-average
|
|
73
|
+
noAverage:
|
|
74
|
+
description: >-
|
|
75
|
+
When true, suppress the overlaid average line. Canonical spelling
|
|
76
|
+
(ADR-0063, gh#1563) replacing `hideAverage`.
|
|
77
|
+
type: boolean
|
|
78
|
+
default: false
|
|
79
|
+
attribute: no-average
|
|
69
80
|
hideGrid:
|
|
70
|
-
description:
|
|
81
|
+
description: >-
|
|
82
|
+
DEPRECATED (ADR-0063, gh#1563) — use `noGrid` instead. Same meaning,
|
|
83
|
+
same default; kept working as a dual-read compat shim (one-time
|
|
84
|
+
console.warn when it's the name that resolves). Removed in 0.9.0.
|
|
71
85
|
type: boolean
|
|
72
86
|
default: false
|
|
73
87
|
attribute: hide-grid
|
|
88
|
+
noGrid:
|
|
89
|
+
description: >-
|
|
90
|
+
Hide gridlines. Canonical spelling (ADR-0063, gh#1563) replacing
|
|
91
|
+
`hideGrid`.
|
|
92
|
+
type: boolean
|
|
93
|
+
default: false
|
|
94
|
+
attribute: no-grid
|
|
74
95
|
hideValues:
|
|
75
|
-
description:
|
|
96
|
+
description: >-
|
|
97
|
+
DEPRECATED (ADR-0063, gh#1563) — use `noValues` instead. Same
|
|
98
|
+
meaning, same default; kept working as a dual-read compat shim (one-
|
|
99
|
+
time console.warn when it's the name that resolves). Removed in
|
|
100
|
+
0.9.0.
|
|
76
101
|
type: boolean
|
|
77
102
|
default: false
|
|
78
103
|
attribute: hide-values
|
|
104
|
+
noValues:
|
|
105
|
+
description: >-
|
|
106
|
+
Hide value labels. Canonical spelling (ADR-0063, gh#1563) replacing
|
|
107
|
+
`hideValues`.
|
|
108
|
+
type: boolean
|
|
109
|
+
default: false
|
|
110
|
+
attribute: no-values
|
|
79
111
|
cornerRadius:
|
|
80
112
|
description: Bar corner radius in px (null = let CSS tokens decide)
|
|
81
113
|
type: number
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"type": "string",
|
|
27
27
|
"default": ""
|
|
28
28
|
},
|
|
29
|
+
"interactive": {
|
|
30
|
+
"description": "Canonical opt-in spelling (ADR-0063, gh#1563) replacing `static`'s opt-out polarity. Rows are interactive <button>-role badges by default — this default stays `true` in 0.8.42 (deliberately NOT flipped yet; the 0.9.0 cut inverts it to `false` after a full consumer scan of every `<chart-legend-ui>` tag per the ADR).",
|
|
31
|
+
"type": "boolean",
|
|
32
|
+
"default": true
|
|
33
|
+
},
|
|
29
34
|
"onToggle": {
|
|
30
35
|
"description": "Series-toggle mode emitted via the `toggle` event. `hide` removes the series from the render; `opacity` fades it. Wired via [for] on chart-ui.",
|
|
31
36
|
"type": "string",
|
|
@@ -58,7 +63,7 @@
|
|
|
58
63
|
"default": "dot"
|
|
59
64
|
},
|
|
60
65
|
"static": {
|
|
61
|
-
"description": "When set, rows are non-interactive <span>s (no click, no toggle).",
|
|
66
|
+
"description": "DEPRECATED (ADR-0063, gh#1563) — use `interactive` instead. When set (and `interactive` is absent), rows are non-interactive <span>s (no click, no toggle). Kept working as a dual-read compat shim (one-time console.warn when it's the name that resolves). Removed in 0.9.0.",
|
|
62
67
|
"type": "boolean",
|
|
63
68
|
"default": false
|
|
64
69
|
}
|
|
@@ -35,9 +35,12 @@
|
|
|
35
35
|
* position — top | bottom | left | right. Layout hint; actual placement
|
|
36
36
|
* is where the element is placed in the DOM. Drives
|
|
37
37
|
* flex-direction.
|
|
38
|
-
*
|
|
39
|
-
* role
|
|
40
|
-
*
|
|
38
|
+
* interactive — canonical opt-in spelling (ADR-0063, gh#1563). Rows
|
|
39
|
+
* default interactive (`role="button"` badges that toggle
|
|
40
|
+
* on click + Enter/Space) until the 0.9.0 default-inversion
|
|
41
|
+
* cut. `static` is a deprecated opt-out alias — when set
|
|
42
|
+
* (and [interactive] is absent), rows render as
|
|
43
|
+
* non-interactive badges (no role/tabindex/handlers).
|
|
41
44
|
* on-toggle — hide | opacity. Default hide. Escape hatch per OD-CHART-09.
|
|
42
45
|
* Reported via the `toggle` event detail; chart-ui reads it
|
|
43
46
|
* when wired via [for].
|
|
@@ -58,17 +61,67 @@ export class UIChartLegend extends UIElement {
|
|
|
58
61
|
items: { type: String, default: '', reflect: false },
|
|
59
62
|
shape: { type: String, default: 'dot', reflect: true },
|
|
60
63
|
position: { type: String, default: 'bottom', reflect: true },
|
|
64
|
+
// ADR-0063 (gh#1563) — `static` (opt-out) is DEPRECATED; `interactive`
|
|
65
|
+
// (opt-in) is the canonical positively-named boolean. `static` stays
|
|
66
|
+
// declared (dual-read compat, 0.8.42). Deliberately does NOT flip the
|
|
67
|
+
// default here: `interactive` defaults `true` so a consumer naming
|
|
68
|
+
// NEITHER attribute keeps today's behavior (rows interactive)
|
|
69
|
+
// unchanged — the real default-inversion (interactive defaulting to
|
|
70
|
+
// `false`) is scheduled for 0.9.0 per the ADR's own consumer-scan
|
|
71
|
+
// requirement (every `<chart-legend-ui>` tag needs review first).
|
|
61
72
|
static: { type: Boolean, default: false, reflect: true },
|
|
73
|
+
interactive: { type: Boolean, default: true, reflect: true },
|
|
62
74
|
onToggle: { type: String, default: 'hide', reflect: true, attribute: 'on-toggle' },
|
|
63
75
|
};
|
|
64
76
|
|
|
65
77
|
static template = () => null;
|
|
66
78
|
|
|
79
|
+
// ADR-0063 (gh#1563) one-shot-per-class deprecation warn for [static].
|
|
80
|
+
static #warnedStatic = false;
|
|
81
|
+
|
|
67
82
|
#target = null;
|
|
68
83
|
#targetListener = null;
|
|
69
84
|
#hiddenKeys = new Set();
|
|
70
85
|
|
|
86
|
+
// ADR-0063 (gh#1563) — captured by overriding `connectedCallback()` to run
|
|
87
|
+
// BEFORE calling `super.connectedCallback()`. `interactive` defaults
|
|
88
|
+
// `true` (a reflected Boolean), and UIElement's own connectedCallback
|
|
89
|
+
// pre-sync loop stamps the attribute for any reflected Boolean prop whose
|
|
90
|
+
// value is already `true` and whose attribute is absent (gh#961) — that
|
|
91
|
+
// stamp happens INSIDE `super.connectedCallback()`, so a check made from
|
|
92
|
+
// `connected()` (which UIElement invokes AFTER its pre-sync loop) would
|
|
93
|
+
// see `[interactive]` present even when the author never wrote it.
|
|
94
|
+
// Capturing here, before the super call, reads only the AUTHORED markup —
|
|
95
|
+
// the constructor is too early (elements are constructed attribute-less
|
|
96
|
+
// then have each attribute set individually as the parser processes them;
|
|
97
|
+
// by connectedCallback time every authored attribute has already landed).
|
|
98
|
+
#authoredInteractive = false;
|
|
99
|
+
#authoredStatic = false;
|
|
100
|
+
|
|
101
|
+
connectedCallback() {
|
|
102
|
+
this.#authoredInteractive = this.hasAttribute('interactive');
|
|
103
|
+
this.#authoredStatic = this.hasAttribute('static');
|
|
104
|
+
super.connectedCallback();
|
|
105
|
+
}
|
|
106
|
+
|
|
71
107
|
connected() {
|
|
108
|
+
// ADR-0063 (gh#1563) compat shim — resolve BEFORE the first render/paint
|
|
109
|
+
// so there's no wrong-then-right flash. New-name precedence: [interactive]
|
|
110
|
+
// wins outright when present, regardless of [static]; only fall back to
|
|
111
|
+
// (and mirror) [static] when [interactive] is absent from markup.
|
|
112
|
+
if (!this.#authoredInteractive && this.#authoredStatic) {
|
|
113
|
+
this.interactive = false;
|
|
114
|
+
if (!UIChartLegend.#warnedStatic) {
|
|
115
|
+
UIChartLegend.#warnedStatic = true;
|
|
116
|
+
// eslint-disable-next-line no-console
|
|
117
|
+
console.warn(
|
|
118
|
+
'[AdiaUI] <chart-legend-ui [static]> is deprecated — use ' +
|
|
119
|
+
'[interactive] instead (ADR-0063, gh#1563). Note: [interactive] ' +
|
|
120
|
+
'still defaults to true until the 0.9.0 default-inversion cut. ' +
|
|
121
|
+
'Kept working as-is; no behavior change.',
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
72
125
|
this.setAttribute('role', 'list');
|
|
73
126
|
this.#resolveTarget();
|
|
74
127
|
this.#paint();
|
|
@@ -152,11 +205,11 @@ export class UIChartLegend extends UIElement {
|
|
|
152
205
|
keyboard-operable without a wrapping <button>. */
|
|
153
206
|
const row = document.createElement('badge-ui');
|
|
154
207
|
row.setAttribute('data-row', '');
|
|
155
|
-
row.setAttribute('role', this.
|
|
208
|
+
row.setAttribute('role', this.interactive ? 'button' : 'listitem');
|
|
156
209
|
row.setAttribute('text', label);
|
|
157
210
|
if (key) row.setAttribute('data-key', key);
|
|
158
211
|
if (active) row.setAttribute('data-active', '');
|
|
159
|
-
if (
|
|
212
|
+
if (this.interactive) {
|
|
160
213
|
row.setAttribute('tabindex', '0');
|
|
161
214
|
row.setAttribute('aria-pressed', active ? 'true' : 'false');
|
|
162
215
|
}
|
|
@@ -181,7 +234,7 @@ export class UIChartLegend extends UIElement {
|
|
|
181
234
|
swatch.style.setProperty('--swatch-color', swatchColor);
|
|
182
235
|
row.appendChild(swatch);
|
|
183
236
|
|
|
184
|
-
if (
|
|
237
|
+
if (this.interactive) {
|
|
185
238
|
row.addEventListener('click', (e) => this.#onRowToggle(e, key));
|
|
186
239
|
row.addEventListener('keydown', (e) => {
|
|
187
240
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -66,8 +66,11 @@
|
|
|
66
66
|
color var(--a-duration-fast) var(--a-easing);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/*
|
|
70
|
-
|
|
69
|
+
/* Non-interactive rows. ADR-0063 (gh#1563): `:not([interactive])` covers
|
|
70
|
+
both today's opt-out spelling (`[static]` mirrors onto `[interactive]`
|
|
71
|
+
being removed, in chart-legend.class.js's connected()) and the eventual
|
|
72
|
+
0.9.0 default-inversion, in one selector. */
|
|
73
|
+
:scope:not([interactive]) badge-ui[data-row] {
|
|
71
74
|
cursor: default;
|
|
72
75
|
}
|
|
73
76
|
|
|
@@ -28,13 +28,15 @@ export class UIChartLegend extends UIElement {
|
|
|
28
28
|
items: string;
|
|
29
29
|
/** id-ref of a chart-ui / heatmap-ui to mirror series from. */
|
|
30
30
|
for: string;
|
|
31
|
+
/** Canonical opt-in spelling (ADR-0063, gh#1563) replacing `static`'s opt-out polarity. Rows are interactive <button>-role badges by default — this default stays `true` in 0.8.42 (deliberately NOT flipped yet; the 0.9.0 cut inverts it to `false` after a full consumer scan of every `<chart-legend-ui>` tag per the ADR). */
|
|
32
|
+
interactive: boolean;
|
|
31
33
|
/** Series-toggle mode emitted via the `toggle` event. `hide` removes the series from the render; `opacity` fades it. Wired via [for] on chart-ui. */
|
|
32
34
|
onToggle: 'hide' | 'opacity';
|
|
33
35
|
/** Layout hint — drives flex-direction. Actual placement follows DOM order. */
|
|
34
36
|
position: 'top' | 'bottom' | 'left' | 'right';
|
|
35
37
|
/** Swatch shape. Maps to badge-ui's icon for dot/square variants. */
|
|
36
38
|
shape: 'dot' | 'square' | 'line' | 'dashed';
|
|
37
|
-
/** When set, rows are non-interactive <span>s (no click, no toggle). */
|
|
39
|
+
/** DEPRECATED (ADR-0063, gh#1563) — use `interactive` instead. When set (and `interactive` is absent), rows are non-interactive <span>s (no click, no toggle). Kept working as a dual-read compat shim (one-time console.warn when it's the name that resolves). Removed in 0.9.0. */
|
|
38
40
|
static: boolean;
|
|
39
41
|
|
|
40
42
|
addEventListener(type: 'toggle', listener: (ev: ChartLegendToggleEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -48,10 +48,24 @@ props:
|
|
|
48
48
|
- right
|
|
49
49
|
reflect: true
|
|
50
50
|
static:
|
|
51
|
-
description:
|
|
51
|
+
description: >-
|
|
52
|
+
DEPRECATED (ADR-0063, gh#1563) — use `interactive` instead. When set
|
|
53
|
+
(and `interactive` is absent), rows are non-interactive <span>s (no
|
|
54
|
+
click, no toggle). Kept working as a dual-read compat shim (one-time
|
|
55
|
+
console.warn when it's the name that resolves). Removed in 0.9.0.
|
|
52
56
|
type: boolean
|
|
53
57
|
default: false
|
|
54
58
|
reflect: true
|
|
59
|
+
interactive:
|
|
60
|
+
description: >-
|
|
61
|
+
Canonical opt-in spelling (ADR-0063, gh#1563) replacing `static`'s
|
|
62
|
+
opt-out polarity. Rows are interactive <button>-role badges by
|
|
63
|
+
default — this default stays `true` in 0.8.42 (deliberately NOT
|
|
64
|
+
flipped yet; the 0.9.0 cut inverts it to `false` after a full
|
|
65
|
+
consumer scan of every `<chart-legend-ui>` tag per the ADR).
|
|
66
|
+
type: boolean
|
|
67
|
+
default: true
|
|
68
|
+
reflect: true
|
|
55
69
|
onToggle:
|
|
56
70
|
description: >-
|
|
57
71
|
Series-toggle mode emitted via the `toggle` event. `hide` removes the
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://adiaui.dev/a2ui/v0_9/components/ColorArea.json",
|
|
4
|
+
"title": "ColorArea",
|
|
5
|
+
"description": "OKLCH-native color picker with 2D area and H/C/L sliders. Form-associated input emitting OKLCH color strings; canonical color authoring surface in the AdiaUI token system. Use for color input in design tools or theming UIs; for simple color swatches use <swatch-ui> or <color-input-ui> instead. Renamed from `<color-picker-ui>` (ADR-0063, gh#1563 — `-picker` is reserved for the outer trigger + popover composite shape; this is the inline substrate, mirroring <calendar-grid-ui>'s naming precedent). `<color-picker-ui>` is now a thin deprecated alias subclassing this component.",
|
|
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
|
+
"baseHue": {
|
|
17
|
+
"description": "Reference hue (degrees) for the [hue-drift-max] constraint. Default\nNaN — falls back to the picker's hue at first commit so the consumer\ncan pre-seed the picker and constrain drift from that initial value.\n",
|
|
18
|
+
"type": "number",
|
|
19
|
+
"default": "NaN"
|
|
20
|
+
},
|
|
21
|
+
"component": {
|
|
22
|
+
"const": "ColorArea"
|
|
23
|
+
},
|
|
24
|
+
"disabled": {
|
|
25
|
+
"description": "Disables all interaction",
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false
|
|
28
|
+
},
|
|
29
|
+
"format": {
|
|
30
|
+
"description": "Output format for the value property",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": [
|
|
33
|
+
"hex",
|
|
34
|
+
"oklch"
|
|
35
|
+
],
|
|
36
|
+
"default": "hex"
|
|
37
|
+
},
|
|
38
|
+
"hueDriftMax": {
|
|
39
|
+
"description": "Generation constraint — maximum allowed signed-shortest-path hue\ndeviation (degrees) from [base-hue] (or the first-committed hue\nif [base-hue] is unset). Default NaN (no constraint). Wrap-aware\nso a drift of 350 degrees resolves as -10.\n",
|
|
40
|
+
"type": "number",
|
|
41
|
+
"default": "NaN"
|
|
42
|
+
},
|
|
43
|
+
"maxChroma": {
|
|
44
|
+
"description": "Generation constraint (v0.4.9 §99h, FEEDBACK-02 #7) — clamp the\nOKLCH chroma channel to at most this value before commit. Out-of-\nbound mutations round-trip to the nearest in-bound equivalent +\nfire `constraint-clamp`. Default Infinity (no constraint).\n",
|
|
45
|
+
"type": "number",
|
|
46
|
+
"default": "Infinity"
|
|
47
|
+
},
|
|
48
|
+
"maxL": {
|
|
49
|
+
"description": "Generation constraint — clamp OKLCH lightness to at most this value (0..1). Default 1 (no constraint).",
|
|
50
|
+
"type": "number",
|
|
51
|
+
"default": 1
|
|
52
|
+
},
|
|
53
|
+
"minL": {
|
|
54
|
+
"description": "Generation constraint — clamp OKLCH lightness to at least this value (0..1). Default 0 (no constraint).",
|
|
55
|
+
"type": "number",
|
|
56
|
+
"default": 0
|
|
57
|
+
},
|
|
58
|
+
"name": {
|
|
59
|
+
"description": "Form field name",
|
|
60
|
+
"type": "string",
|
|
61
|
+
"default": ""
|
|
62
|
+
},
|
|
63
|
+
"value": {
|
|
64
|
+
"description": "Current color as hex string",
|
|
65
|
+
"type": "string",
|
|
66
|
+
"default": "#3b82f6"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"required": [
|
|
70
|
+
"component"
|
|
71
|
+
],
|
|
72
|
+
"unevaluatedProperties": false,
|
|
73
|
+
"x-adiaui": {
|
|
74
|
+
"anti_patterns": [],
|
|
75
|
+
"category": "input",
|
|
76
|
+
"composes": [
|
|
77
|
+
"slider-ui"
|
|
78
|
+
],
|
|
79
|
+
"events": {
|
|
80
|
+
"change": {
|
|
81
|
+
"description": "Fired on every color change"
|
|
82
|
+
},
|
|
83
|
+
"constraint-clamp": {
|
|
84
|
+
"description": "Fired immediately before `change` / `input` when one or more\nconsumer-declared constraints (max-chroma / max-l / min-l /\nhue-drift-max) clamped a channel away from the user-requested\nvalue. detail.clamps is an array of axis-specific clamp records.\n",
|
|
85
|
+
"detail": {
|
|
86
|
+
"clamps": {
|
|
87
|
+
"description": "Array of `{ axis, requested, clamped, reason }` objects. axis is\none of \"l\" / \"c\" / \"h\". reason names the triggering constraint\nprop. Empty arrays are never emitted.\n",
|
|
88
|
+
"type": "array"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"input": {
|
|
93
|
+
"description": "Fired during continuous interaction (drag)"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"examples": [
|
|
97
|
+
{
|
|
98
|
+
"description": "Color picker card with a color picker component for selecting colors with swatches.",
|
|
99
|
+
"a2ui": "[\n {\n \"id\": \"root\",\n \"component\": \"Card\",\n \"children\": [\n \"sec\"\n ]\n },\n {\n \"id\": \"sec\",\n \"component\": \"Section\",\n \"children\": [\n \"cp\"\n ]\n },\n {\n \"id\": \"cp\",\n \"component\": \"ColorArea\",\n \"value\": \"#6366f1\"\n }\n]",
|
|
100
|
+
"name": "color-area-demo"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"description": "Color picker with swatch selection in a card.",
|
|
104
|
+
"a2ui": "[\n {\n \"id\": \"root\",\n \"component\": \"Card\",\n \"children\": [\n \"sec\"\n ]\n },\n {\n \"id\": \"sec\",\n \"component\": \"Section\",\n \"children\": [\n \"cp\"\n ]\n },\n {\n \"id\": \"cp\",\n \"component\": \"ColorArea\",\n \"value\": \"#3b82f6\"\n }\n]",
|
|
105
|
+
"name": "color-area-panel"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"keywords": [
|
|
109
|
+
"colorarea",
|
|
110
|
+
"color-area",
|
|
111
|
+
"colorpicker",
|
|
112
|
+
"color-picker",
|
|
113
|
+
"color",
|
|
114
|
+
"picker"
|
|
115
|
+
],
|
|
116
|
+
"name": "UIColorArea",
|
|
117
|
+
"parts": {},
|
|
118
|
+
"related": [
|
|
119
|
+
"grid",
|
|
120
|
+
"button"
|
|
121
|
+
],
|
|
122
|
+
"slots": {},
|
|
123
|
+
"states": [
|
|
124
|
+
{
|
|
125
|
+
"description": "Default, ready for interaction.",
|
|
126
|
+
"name": "idle"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"description": "Non-interactive; dimmed.",
|
|
130
|
+
"attribute": "disabled",
|
|
131
|
+
"name": "disabled"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"status": "stable",
|
|
135
|
+
"synonyms": {
|
|
136
|
+
"color-area": [
|
|
137
|
+
"color-canvas",
|
|
138
|
+
"color-surface",
|
|
139
|
+
"swatch-picker",
|
|
140
|
+
"color-picker"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"tag": "color-area-ui",
|
|
144
|
+
"tokens": {},
|
|
145
|
+
"traits": [],
|
|
146
|
+
"version": 1
|
|
147
|
+
}
|
|
148
|
+
}
|