@adia-ai/web-components 0.8.19 → 0.8.21
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 +26 -0
- package/components/card/card.a2ui.json +6 -3
- package/components/card/card.css +15 -1
- package/components/card/card.yaml +5 -3
- package/components/nav-group/nav-group.a2ui.json +5 -0
- package/components/nav-group/nav-group.class.js +14 -6
- package/components/nav-group/nav-group.css +5 -2
- package/components/nav-group/nav-group.d.ts +2 -0
- package/components/nav-group/nav-group.yaml +4 -0
- package/components/select/select.a2ui.json +3 -2
- package/components/select/select.class.js +14 -1
- package/components/select/select.css +13 -1
- package/components/select/select.yaml +5 -4
- package/components/table/table.class.js +7 -3
- package/components/table/table.css +7 -5
- package/dist/theme-provider.min.js +1 -1
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +19 -19
- package/dist/web-components.sheet.js +1 -1
- package/package.json +2 -1
- package/components/adia-mark/adia-mark.test.js +0 -69
- package/components/adia-wordmark/adia-wordmark.test.js +0 -69
- package/components/agent-artifact/agent-artifact.test.js +0 -61
- package/components/alert/alert.test.js +0 -364
- package/components/color-picker/color-picker.test.js +0 -96
- package/components/combobox/combobox.test.js +0 -256
- package/components/command/command.test.js +0 -99
- package/components/date-range-picker/date-range-picker.test.js +0 -387
- package/components/datetime-picker/datetime-picker.test.js +0 -454
- package/components/demo-toggle/demo-toggle.test.js +0 -102
- package/components/description-list/description-list.test.js +0 -72
- package/components/display-field/display-field.test.js +0 -115
- package/components/empty-state/empty-state.test.js +0 -77
- package/components/field/field.test.js +0 -260
- package/components/fields/fields.test.js +0 -88
- package/components/inline-message/inline-message.test.js +0 -203
- package/components/input/input.test.js +0 -335
- package/components/integration-card/integration-card.test.js +0 -318
- package/components/link/link.test.js +0 -143
- package/components/list/list.test.js +0 -106
- package/components/list-window/list-window.test.js +0 -303
- package/components/loading-overlay/loading-overlay.test.js +0 -257
- package/components/menu/menu.test.js +0 -176
- package/components/nav/nav.test.js +0 -428
- package/components/nav-group/nav-group.test.js +0 -67
- package/components/option-card/option-card.test.js +0 -32
- package/components/pagination/pagination.test.js +0 -195
- package/components/select/select.test.js +0 -481
- package/components/slider/slider.test.js +0 -202
- package/components/spinner/spinner.test.js +0 -272
- package/components/stat/stat.test.js +0 -108
- package/components/step-progress/step-progress.test.js +0 -129
- package/components/swatch/swatch.test.js +0 -563
- package/components/table/table.test.js +0 -479
- package/components/table-toolbar/table-toolbar.test.js +0 -152
- package/components/tag/tag.test.js +0 -137
- package/components/tags-input/tags-input.test.js +0 -477
- package/components/text/text.test.js +0 -202
- package/components/theme-provider/theme-provider.test.js +0 -94
- package/components/time-picker/time-picker.test.js +0 -287
- package/components/timeline/timeline.test.js +0 -31
- package/components/toggle-scheme/toggle-scheme.test.js +0 -110
- package/components/tree/tree.test.js +0 -312
- package/core/element.test.js +0 -389
- package/core/icons.test.js +0 -187
- package/core/logical-children.test.js +0 -54
- package/core/markdown.test.js +0 -47
- package/core/responsive.test.js +0 -121
- package/core/template.test.js +0 -611
- package/traits/active-state/active-state.test.js +0 -28
- package/traits/anchor-positioning/anchor-positioning.test.js +0 -122
- package/traits/announcer/announcer.test.js +0 -268
- package/traits/arrow-grid-nav/arrow-grid-nav.test.js +0 -375
- package/traits/attention-pulse/attention-pulse.test.js +0 -26
- package/traits/confetti/confetti.test.js +0 -46
- package/traits/confetti-burst/confetti-burst.test.js +0 -46
- package/traits/count-up/count-up.test.js +0 -54
- package/traits/declarative.test.js +0 -138
- package/traits/dirty-state/dirty-state.test.js +0 -45
- package/traits/drag-ghost/drag-ghost.test.js +0 -19
- package/traits/draggable/draggable.test.js +0 -60
- package/traits/draggable-list-item/draggable-list-item.test.js +0 -51
- package/traits/drop-target/drop-target.test.js +0 -241
- package/traits/droppable/droppable.test.js +0 -54
- package/traits/droppable-collection/droppable-collection.test.js +0 -99
- package/traits/error-shake/error-shake.test.js +0 -114
- package/traits/fade-presence/fade-presence.test.js +0 -20
- package/traits/focus-restore/focus-restore.test.js +0 -202
- package/traits/focus-trap/focus-trap.test.js +0 -42
- package/traits/focusable/focusable.test.js +0 -53
- package/traits/glow-focus/glow-focus.test.js +0 -31
- package/traits/gradient-shift/gradient-shift.test.js +0 -22
- package/traits/haptic-feedback/haptic-feedback.test.js +0 -52
- package/traits/hotkey/hotkey.test.js +0 -61
- package/traits/hoverable/hoverable.test.js +0 -24
- package/traits/inertia-drag/inertia-drag.test.js +0 -33
- package/traits/input-mask/input-mask.test.js +0 -151
- package/traits/intersection-observer/intersection-observer.test.js +0 -38
- package/traits/keyboard-nav/keyboard-nav.test.js +0 -41
- package/traits/keyboard-reorderable/keyboard-reorderable.test.js +0 -45
- package/traits/layout-animation/layout-animation.test.js +0 -114
- package/traits/long-press/long-press.test.js +0 -244
- package/traits/magnetic-hover/magnetic-hover.test.js +0 -30
- package/traits/noise-texture/noise-texture.test.js +0 -20
- package/traits/parallax/parallax.test.js +0 -26
- package/traits/portal/portal.test.js +0 -30
- package/traits/pressable/pressable.test.js +0 -73
- package/traits/resettable/resettable.test.js +0 -100
- package/traits/resizable/resizable.test.js +0 -39
- package/traits/resize-observer/resize-observer.test.js +0 -38
- package/traits/ripple/ripple.test.js +0 -32
- package/traits/roving-tabindex/roving-tabindex.test.js +0 -28
- package/traits/scale-press/scale-press.test.js +0 -39
- package/traits/scroll-lock/scroll-lock.test.js +0 -45
- package/traits/scroll-progress/scroll-progress.test.js +0 -182
- package/traits/shimmer-loading/shimmer-loading.test.js +0 -43
- package/traits/smoke.test.js +0 -111
- package/traits/snap-to-grid/snap-to-grid.test.js +0 -40
- package/traits/sound-feedback/sound-feedback.test.js +0 -26
- package/traits/spring-animate/spring-animate.test.js +0 -28
- package/traits/success-checkmark/success-checkmark.test.js +0 -120
- package/traits/tilt-hover/tilt-hover.test.js +0 -32
- package/traits/tossable/tossable.test.js +0 -31
- package/traits/traits-host.test.js +0 -73
- package/traits/typeahead/typeahead.test.js +0 -38
- package/traits/typewriter/typewriter.test.js +0 -47
- package/traits/validation/validation.test.js +0 -93
- package/traits/view-transition/view-transition.test.js +0 -268
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
-
import '../../core/element.js';
|
|
3
|
-
import './option-card.js';
|
|
4
|
-
|
|
5
|
-
const tick = () => new Promise((r) => queueMicrotask(r));
|
|
6
|
-
function mount(html) {
|
|
7
|
-
const w = document.createElement('div');
|
|
8
|
-
w.innerHTML = html;
|
|
9
|
-
document.body.appendChild(w);
|
|
10
|
-
return w.firstElementChild;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe('option-card-ui — heading/description stamp-if-absent (wrapper trap)', () => {
|
|
14
|
-
beforeEach(() => { document.body.innerHTML = ''; });
|
|
15
|
-
|
|
16
|
-
it('stamps heading + description from attrs when no slots are provided', async () => {
|
|
17
|
-
const el = mount('<option-card-ui heading="Pro" description="Best value"></option-card-ui>');
|
|
18
|
-
await tick();
|
|
19
|
-
expect(el.querySelectorAll('[slot="heading"]').length).toBe(1);
|
|
20
|
-
expect(el.querySelectorAll('[slot="description"]').length).toBe(1);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Regression (audit-wrapper-trap arm 2): a WRAPPED consumer [slot="heading"]
|
|
24
|
-
// override must suppress the attr-stamp, not collide with it.
|
|
25
|
-
it('does NOT stamp a duplicate heading when a WRAPPED consumer heading is present', async () => {
|
|
26
|
-
const el = mount(`<option-card-ui heading="Pro"><span style="display:contents" role="presentation"><h3 slot="heading" data-test="h">Custom</h3></span></option-card-ui>`);
|
|
27
|
-
await tick();
|
|
28
|
-
const headings = el.querySelectorAll('[slot="heading"]');
|
|
29
|
-
expect(headings.length).toBe(1);
|
|
30
|
-
expect(headings[0].dataset.test).toBe('h');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pagination-ui — regression guards for the v0.6.36 native-primitive
|
|
3
|
-
* leak fix and the universal [size] system threading.
|
|
4
|
-
*
|
|
5
|
-
* Before the fix, every page / prev / next item was a raw <button>,
|
|
6
|
-
* and pagination hardcoded `--a-size-sm` for its button cells (no
|
|
7
|
-
* [size] prop, no threading to the substrate's 24/30/36 px size
|
|
8
|
-
* system). After the fix, every item is a <button-ui> whose `size`
|
|
9
|
-
* attribute mirrors the host's, and active items render as
|
|
10
|
-
* `variant="primary"` so the filled-accent state comes from
|
|
11
|
-
* button-ui's primary surface matrix.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
15
|
-
import { readFileSync } from 'node:fs';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
import { dirname, resolve } from 'node:path';
|
|
18
|
-
import '../../core/element.js';
|
|
19
|
-
import './pagination.js';
|
|
20
|
-
import '../button/button.js';
|
|
21
|
-
|
|
22
|
-
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
23
|
-
const CLASS_JS = readFileSync(resolve(HERE, 'pagination.class.js'), 'utf8');
|
|
24
|
-
|
|
25
|
-
const tick = () => new Promise((r) => queueMicrotask(r));
|
|
26
|
-
|
|
27
|
-
function mount(html) {
|
|
28
|
-
const wrap = document.createElement('div');
|
|
29
|
-
wrap.innerHTML = html;
|
|
30
|
-
document.body.appendChild(wrap);
|
|
31
|
-
return wrap.firstElementChild;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
beforeEach(() => { document.body.innerHTML = ''; });
|
|
35
|
-
|
|
36
|
-
// ── Source-grep contract guards ─────────────────────────────────────
|
|
37
|
-
|
|
38
|
-
describe('pagination-ui — no native <button> leak', () => {
|
|
39
|
-
it('class.js creates <button-ui> elements (not raw <button>)', () => {
|
|
40
|
-
expect(CLASS_JS).toMatch(/createElement\(['"]button-ui['"]\)/);
|
|
41
|
-
// Negative — guard against accidental revert to raw <button>.
|
|
42
|
-
expect(CLASS_JS).not.toMatch(/createElement\(['"]button['"]\)/);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('declares caret-left + caret-right in static requiredIcons', () => {
|
|
46
|
-
expect(CLASS_JS).toMatch(/static\s+requiredIcons\s*=\s*\[[^\]]*['"]caret-left['"]/);
|
|
47
|
-
expect(CLASS_JS).toMatch(/static\s+requiredIcons\s*=\s*\[[^\]]*['"]caret-right['"]/);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('declares size prop in static properties (universal [size] thread-through)', () => {
|
|
51
|
-
expect(CLASS_JS).toMatch(/static\s+properties\s*=[\s\S]*?size:\s*\{\s*type:\s*String/);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// ── DOM contract guards ─────────────────────────────────────────────
|
|
56
|
-
|
|
57
|
-
describe('pagination-ui — DOM composition', () => {
|
|
58
|
-
it('stamps <button-ui> for every page / prev / next cell', async () => {
|
|
59
|
-
const el = mount('<pagination-ui page="3" total="10"></pagination-ui>');
|
|
60
|
-
await tick();
|
|
61
|
-
const buttons = el.querySelectorAll('button-ui');
|
|
62
|
-
expect(buttons.length).toBeGreaterThan(0);
|
|
63
|
-
// No raw <button> children — confirms the native-leak is closed at runtime.
|
|
64
|
-
expect(el.querySelectorAll(':scope button:not(button-ui)').length).toBe(0);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('threads size attribute through to every nested button-ui', async () => {
|
|
68
|
-
const el = mount('<pagination-ui page="2" total="5" size="lg"></pagination-ui>');
|
|
69
|
-
await tick();
|
|
70
|
-
const buttons = el.querySelectorAll('button-ui');
|
|
71
|
-
expect(buttons.length).toBeGreaterThan(0);
|
|
72
|
-
for (const btn of buttons) {
|
|
73
|
-
expect(btn.getAttribute('size')).toBe('lg');
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('defaults to size="md" (aligned with button-ui default)', async () => {
|
|
78
|
-
const el = mount('<pagination-ui page="2" total="5"></pagination-ui>');
|
|
79
|
-
await tick();
|
|
80
|
-
const buttons = el.querySelectorAll('button-ui');
|
|
81
|
-
expect(buttons.length).toBeGreaterThan(0);
|
|
82
|
-
for (const btn of buttons) {
|
|
83
|
-
expect(btn.getAttribute('size')).toBe('md');
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('renders the active page as variant="primary" (button-ui token chain)', async () => {
|
|
88
|
-
const el = mount('<pagination-ui page="3" total="10"></pagination-ui>');
|
|
89
|
-
await tick();
|
|
90
|
-
const active = el.querySelector('button-ui[data-active]');
|
|
91
|
-
expect(active).toBeTruthy();
|
|
92
|
-
expect(active.getAttribute('variant')).toBe('primary');
|
|
93
|
-
expect(active.getAttribute('aria-current')).toBe('page');
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('renders prev / next as ghost (default variant) or outline (button variant)', async () => {
|
|
97
|
-
const elDefault = mount('<pagination-ui page="3" total="10"></pagination-ui>');
|
|
98
|
-
await tick();
|
|
99
|
-
expect(elDefault.querySelector('button-ui[data-prev]').getAttribute('variant')).toBe('ghost');
|
|
100
|
-
expect(elDefault.querySelector('button-ui[data-next]').getAttribute('variant')).toBe('ghost');
|
|
101
|
-
|
|
102
|
-
const elButton = mount('<pagination-ui page="3" total="10" variant="button"></pagination-ui>');
|
|
103
|
-
await tick();
|
|
104
|
-
expect(elButton.querySelector('button-ui[data-prev]').getAttribute('variant')).toBe('outline');
|
|
105
|
-
expect(elButton.querySelector('button-ui[data-next]').getAttribute('variant')).toBe('outline');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('uses icon="caret-left" / "caret-right" on prev / next (not glyph text)', async () => {
|
|
109
|
-
const el = mount('<pagination-ui page="3" total="10"></pagination-ui>');
|
|
110
|
-
await tick();
|
|
111
|
-
expect(el.querySelector('button-ui[data-prev]').getAttribute('icon')).toBe('caret-left');
|
|
112
|
-
expect(el.querySelector('button-ui[data-next]').getAttribute('icon')).toBe('caret-right');
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// ── Width invariance: compact-mode cell count is constant across pages ──
|
|
117
|
-
//
|
|
118
|
-
// Compact width W = 2*siblings + 5 (= 7 at siblings=1). When the current
|
|
119
|
-
// page advances by one, the row's visible cell count must NOT change —
|
|
120
|
-
// otherwise the layout wobbles. For total ≤ W, we show every page and
|
|
121
|
-
// skip compact mode entirely (no point compressing if it doesn't save
|
|
122
|
-
// slots — also wobble-free since every page just highlights a different
|
|
123
|
-
// constant-width row).
|
|
124
|
-
|
|
125
|
-
describe('pagination-ui — compact-mode width invariance', () => {
|
|
126
|
-
function pageValues(el) {
|
|
127
|
-
return [...el.querySelectorAll('button-ui[data-page]')].map((b) => Number(b.dataset.value));
|
|
128
|
-
}
|
|
129
|
-
function cellCount(el) {
|
|
130
|
-
return el.querySelectorAll('button-ui[data-page], [data-ellipsis]').length;
|
|
131
|
-
}
|
|
132
|
-
function hasEllipsis(el) {
|
|
133
|
-
return el.querySelectorAll('[data-ellipsis]').length > 0;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
it('total=5 siblings=1 → never compacts (shows 1-5 every page)', async () => {
|
|
137
|
-
for (const page of [1, 2, 3, 4, 5]) {
|
|
138
|
-
const el = mount(`<pagination-ui page="${page}" total="5" siblings="1"></pagination-ui>`);
|
|
139
|
-
await tick();
|
|
140
|
-
expect(pageValues(el)).toEqual([1, 2, 3, 4, 5]);
|
|
141
|
-
expect(hasEllipsis(el)).toBe(false);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('total=10 siblings=1 → exactly 7 cells on every page (no wobble)', async () => {
|
|
146
|
-
for (const page of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) {
|
|
147
|
-
const el = mount(`<pagination-ui page="${page}" total="10" siblings="1"></pagination-ui>`);
|
|
148
|
-
await tick();
|
|
149
|
-
expect(cellCount(el)).toBe(7);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('total=10 page=3 siblings=1 → near-start: [1,2,3,4,5,…,10]', async () => {
|
|
154
|
-
const el = mount('<pagination-ui page="3" total="10" siblings="1"></pagination-ui>');
|
|
155
|
-
await tick();
|
|
156
|
-
expect(pageValues(el)).toEqual([1, 2, 3, 4, 5, 10]);
|
|
157
|
-
expect(el.querySelectorAll('[data-ellipsis]').length).toBe(1);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('total=10 page=4 siblings=1 → still near-start: [1,2,3,4,5,…,10] (same as page=3)', async () => {
|
|
161
|
-
const el = mount('<pagination-ui page="4" total="10" siblings="1"></pagination-ui>');
|
|
162
|
-
await tick();
|
|
163
|
-
expect(pageValues(el)).toEqual([1, 2, 3, 4, 5, 10]);
|
|
164
|
-
expect(el.querySelectorAll('[data-ellipsis]').length).toBe(1);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('total=10 page=5 siblings=1 → middle: [1,…,4,5,6,…,10]', async () => {
|
|
168
|
-
const el = mount('<pagination-ui page="5" total="10" siblings="1"></pagination-ui>');
|
|
169
|
-
await tick();
|
|
170
|
-
expect(pageValues(el)).toEqual([1, 4, 5, 6, 10]);
|
|
171
|
-
expect(el.querySelectorAll('[data-ellipsis]').length).toBe(2);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('total=10 page=7 siblings=1 → near-end: [1,…,6,7,8,9,10]', async () => {
|
|
175
|
-
const el = mount('<pagination-ui page="7" total="10" siblings="1"></pagination-ui>');
|
|
176
|
-
await tick();
|
|
177
|
-
expect(pageValues(el)).toEqual([1, 6, 7, 8, 9, 10]);
|
|
178
|
-
expect(el.querySelectorAll('[data-ellipsis]').length).toBe(1);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('total=20 page=10 siblings=1 → middle: [1,…,9,10,11,…,20]', async () => {
|
|
182
|
-
const el = mount('<pagination-ui page="10" total="20" siblings="1"></pagination-ui>');
|
|
183
|
-
await tick();
|
|
184
|
-
expect(pageValues(el)).toEqual([1, 9, 10, 11, 20]);
|
|
185
|
-
expect(el.querySelectorAll('[data-ellipsis]').length).toBe(2);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
it('total=20 siblings=2 → exactly 9 cells on every page', async () => {
|
|
189
|
-
for (const page of [1, 5, 10, 15, 20]) {
|
|
190
|
-
const el = mount(`<pagination-ui page="${page}" total="20" siblings="2"></pagination-ui>`);
|
|
191
|
-
await tick();
|
|
192
|
-
expect(cellCount(el)).toBe(9);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
});
|