@webquark/browser 1.1.0-dev.12 → 1.1.0-dev.13
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/dist/cjs/{action.props-DmLaQuU2.js → action.props-B6vl_1p5.js} +1 -1
- package/dist/cjs/{field-CEZ9NsWK.js → field-B5nxD8Kc.js} +1 -1
- package/dist/cjs/{index-CMAcJ6t1.js → index-BD6Jjssb.js} +4 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/q-accordion.cjs.entry.js +2 -2
- package/dist/cjs/q-alert.cjs.entry.js +1 -1
- package/dist/cjs/q-avatar.cjs.entry.js +1 -1
- package/dist/cjs/q-banner.cjs.entry.js +1 -1
- package/dist/cjs/q-button_2.cjs.entry.js +3 -3
- package/dist/cjs/q-card.cjs.entry.js +1 -1
- package/dist/cjs/q-carousel.cjs.entry.js +119 -17
- package/dist/cjs/q-chip.cjs.entry.js +2 -2
- package/dist/cjs/q-control-group.cjs.entry.js +64 -0
- package/dist/cjs/q-conversation-bubble.cjs.entry.js +1 -1
- package/dist/cjs/q-data-table.cjs.entry.js +4 -4
- package/dist/cjs/q-dialog.cjs.entry.js +1 -1
- package/dist/cjs/q-divider.cjs.entry.js +1 -1
- package/dist/cjs/q-dropdown.cjs.entry.js +218 -21
- package/dist/cjs/q-form.cjs.entry.js +14 -4
- package/dist/cjs/q-grid.cjs.entry.js +1 -1
- package/dist/cjs/q-icon.cjs.entry.js +1 -1
- package/dist/cjs/q-image-comparison.cjs.entry.js +1 -1
- package/dist/cjs/q-inline.cjs.entry.js +1 -1
- package/dist/cjs/q-input_2.cjs.entry.js +6 -6
- package/dist/cjs/q-link.cjs.entry.js +2 -2
- package/dist/cjs/q-map.cjs.entry.js +2 -2
- package/dist/cjs/q-media.cjs.entry.js +1 -1
- package/dist/cjs/q-navbar.cjs.entry.js +1 -1
- package/dist/cjs/q-pagination.cjs.entry.js +2 -2
- package/dist/cjs/q-panel.cjs.entry.js +1 -1
- package/dist/cjs/q-quantity-selector.cjs.entry.js +6 -6
- package/dist/cjs/q-radio-group.cjs.entry.js +4 -4
- package/dist/cjs/q-reel.cjs.entry.js +1 -1
- package/dist/cjs/q-scrollable.cjs.entry.js +1 -1
- package/dist/cjs/q-section.cjs.entry.js +1 -1
- package/dist/cjs/q-sidepanel.cjs.entry.js +1 -1
- package/dist/cjs/q-slider.cjs.entry.js +2 -2
- package/dist/cjs/q-stack.cjs.entry.js +1 -1
- package/dist/cjs/q-step-diagram-item.cjs.entry.js +2 -2
- package/dist/cjs/q-step-diagram.cjs.entry.js +3 -3
- package/dist/cjs/q-syntax-box.cjs.entry.js +1 -1
- package/dist/cjs/q-tabs.cjs.entry.js +1 -1
- package/dist/cjs/q-textarea.cjs.entry.js +4 -4
- package/dist/cjs/q-thumbnail.cjs.entry.js +1 -1
- package/dist/cjs/q-toast.cjs.entry.js +1 -1
- package/dist/cjs/q-toggle.cjs.entry.js +6 -6
- package/dist/cjs/q-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/webquark.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/actions/button/button.css +22 -0
- package/dist/collection/components/content/carousel/carousel.css +7 -0
- package/dist/collection/components/content/carousel/carousel.js +256 -10
- package/dist/collection/components/content/carousel/internals/autoplay.js +31 -6
- package/dist/collection/components/content/carousel/test/transitions.cmp.test.js +122 -0
- package/dist/collection/components/data-display/accordion/accordion.js +1 -1
- package/dist/collection/components/data-display/data-table/data-table.js +3 -3
- package/dist/collection/components/data-display/map/map.js +1 -1
- package/dist/collection/components/data-display/map/test/map.cmp.test.js +1 -1
- package/dist/collection/components/data-display/pagination/pagination.js +1 -1
- package/dist/collection/components/indicators/step-diagram/step-diagram.js +2 -2
- package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +1 -1
- package/dist/collection/components/inputs/dropdown/dropdown.css +115 -0
- package/dist/collection/components/inputs/dropdown/dropdown.js +274 -23
- package/dist/collection/components/inputs/dropdown/test/fit-options.cmp.test.js +120 -0
- package/dist/collection/components/inputs/dropdown/test/multiple.cmp.test.js +124 -0
- package/dist/collection/components/inputs/form/form.js +2 -2
- package/dist/collection/components/inputs/form/internals/field-state.js +6 -1
- package/dist/collection/components/inputs/form/internals/values.js +5 -0
- package/dist/collection/components/inputs/input/input.css +22 -0
- package/dist/collection/components/inputs/input/input.js +3 -3
- package/dist/collection/components/inputs/quantity-selector/quantity-selector.css +22 -0
- package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +4 -4
- package/dist/collection/components/inputs/radio-group/radio-group.js +2 -2
- package/dist/collection/components/inputs/slider/slider.js +1 -1
- package/dist/collection/components/inputs/textarea/textarea.js +2 -2
- package/dist/collection/components/inputs/toggle/toggle.css +22 -0
- package/dist/collection/components/inputs/toggle/toggle.js +3 -3
- package/dist/collection/components/layout/control-group/control-group.css +108 -0
- package/dist/collection/components/layout/control-group/control-group.js +142 -0
- package/dist/collection/components/layout/control-group/test/control-group.cmp.test.js +163 -0
- package/dist/components/index.js +1 -1
- package/dist/components/{p-4mHh96ug.js → p-BGHNFaaC.js} +1 -1
- package/dist/components/{p-BbY1XC6_.js → p-BZXIeEKC.js} +1 -1
- package/dist/components/{p-DbI_F3z0.js → p-Bc2_QcLn.js} +1 -1
- package/dist/components/{p-BKly3Y6e.js → p-Bp6Xr92S.js} +1 -1
- package/dist/components/{p-CSucjZb7.js → p-BwPMm43W.js} +1 -1
- package/dist/components/p-CpkX9YAW.js +1 -0
- package/dist/components/{p-CLErjC1f.js → p-D2nxHd1b.js} +1 -1
- package/dist/components/{p-DQhiqYeq.js → p-DkanItP3.js} +1 -1
- package/dist/components/p-IwIJb0Mc.js +1 -0
- package/dist/components/{p-0feRVg70.js → p-kfrqZyfJ.js} +1 -1
- package/dist/components/{p-CYG3Oakz.js → p-x3C-wjU9.js} +1 -1
- package/dist/components/q-accordion.js +1 -1
- package/dist/components/q-alert.js +1 -1
- package/dist/components/q-avatar.js +1 -1
- package/dist/components/q-banner.js +1 -1
- package/dist/components/q-button.js +1 -1
- package/dist/components/q-card.js +1 -1
- package/dist/components/q-carousel.js +1 -1
- package/dist/components/q-chip.js +1 -1
- package/dist/components/q-control-group.d.ts +11 -0
- package/dist/components/q-control-group.js +1 -0
- package/dist/components/q-conversation-bubble.js +1 -1
- package/dist/components/q-data-table.js +1 -1
- package/dist/components/q-dialog.js +1 -1
- package/dist/components/q-divider.js +1 -1
- package/dist/components/q-dropdown.js +1 -1
- package/dist/components/q-form.js +1 -1
- package/dist/components/q-grid.js +1 -1
- package/dist/components/q-icon.js +1 -1
- package/dist/components/q-image-comparison.js +1 -1
- package/dist/components/q-inline.js +1 -1
- package/dist/components/q-input.js +1 -1
- package/dist/components/q-link.js +1 -1
- package/dist/components/q-map.js +1 -1
- package/dist/components/q-media.js +1 -1
- package/dist/components/q-navbar.js +1 -1
- package/dist/components/q-pagination.js +1 -1
- package/dist/components/q-panel.js +1 -1
- package/dist/components/q-progress.js +1 -1
- package/dist/components/q-quantity-selector.js +1 -1
- package/dist/components/q-radio-group.js +1 -1
- package/dist/components/q-reel.js +1 -1
- package/dist/components/q-scrollable.js +1 -1
- package/dist/components/q-section.js +1 -1
- package/dist/components/q-sidepanel.js +1 -1
- package/dist/components/q-slider.js +1 -1
- package/dist/components/q-stack.js +1 -1
- package/dist/components/q-step-diagram-item.js +1 -1
- package/dist/components/q-step-diagram.js +1 -1
- package/dist/components/q-syntax-box.js +2 -2
- package/dist/components/q-tabs.js +1 -1
- package/dist/components/q-textarea.js +1 -1
- package/dist/components/q-thumbnail.js +1 -1
- package/dist/components/q-toast.js +1 -1
- package/dist/components/q-toggle.js +1 -1
- package/dist/components/q-toolbar.js +1 -1
- package/dist/components/q-tooltip.js +1 -1
- package/dist/esm/{action.props-DhnvhbLl.js → action.props-Di_LpF5H.js} +1 -1
- package/dist/esm/{field-u-k7C7Rf.js → field-C4Iilew6.js} +1 -1
- package/dist/esm/{index-DaJmsCb7.js → index-DoGM9gsC.js} +4 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/q-accordion.entry.js +2 -2
- package/dist/esm/q-alert.entry.js +1 -1
- package/dist/esm/q-avatar.entry.js +1 -1
- package/dist/esm/q-banner.entry.js +1 -1
- package/dist/esm/q-button_2.entry.js +3 -3
- package/dist/esm/q-card.entry.js +1 -1
- package/dist/esm/q-carousel.entry.js +119 -17
- package/dist/esm/q-chip.entry.js +2 -2
- package/dist/esm/q-control-group.entry.js +62 -0
- package/dist/esm/q-conversation-bubble.entry.js +1 -1
- package/dist/esm/q-data-table.entry.js +4 -4
- package/dist/esm/q-dialog.entry.js +1 -1
- package/dist/esm/q-divider.entry.js +1 -1
- package/dist/esm/q-dropdown.entry.js +218 -21
- package/dist/esm/q-form.entry.js +14 -4
- package/dist/esm/q-grid.entry.js +1 -1
- package/dist/esm/q-icon.entry.js +1 -1
- package/dist/esm/q-image-comparison.entry.js +1 -1
- package/dist/esm/q-inline.entry.js +1 -1
- package/dist/esm/q-input_2.entry.js +6 -6
- package/dist/esm/q-link.entry.js +2 -2
- package/dist/esm/q-map.entry.js +2 -2
- package/dist/esm/q-media.entry.js +1 -1
- package/dist/esm/q-navbar.entry.js +1 -1
- package/dist/esm/q-pagination.entry.js +2 -2
- package/dist/esm/q-panel.entry.js +1 -1
- package/dist/esm/q-quantity-selector.entry.js +6 -6
- package/dist/esm/q-radio-group.entry.js +4 -4
- package/dist/esm/q-reel.entry.js +1 -1
- package/dist/esm/q-scrollable.entry.js +1 -1
- package/dist/esm/q-section.entry.js +1 -1
- package/dist/esm/q-sidepanel.entry.js +1 -1
- package/dist/esm/q-slider.entry.js +2 -2
- package/dist/esm/q-stack.entry.js +1 -1
- package/dist/esm/q-step-diagram-item.entry.js +2 -2
- package/dist/esm/q-step-diagram.entry.js +3 -3
- package/dist/esm/q-syntax-box.entry.js +1 -1
- package/dist/esm/q-tabs.entry.js +1 -1
- package/dist/esm/q-textarea.entry.js +4 -4
- package/dist/esm/q-thumbnail.entry.js +1 -1
- package/dist/esm/q-toast.entry.js +1 -1
- package/dist/esm/q-toggle.entry.js +6 -6
- package/dist/esm/q-toolbar.entry.js +1 -1
- package/dist/esm/webquark.js +3 -3
- package/dist/types/components/content/carousel/carousel.d.ts +23 -2
- package/dist/types/components/content/carousel/carousel.types.d.ts +6 -0
- package/dist/types/components/content/carousel/internals/autoplay.d.ts +5 -0
- package/dist/types/components/inputs/dropdown/dropdown.d.ts +29 -2
- package/dist/types/components/inputs/dropdown/test/fit-options.cmp.test.d.ts +3 -0
- package/dist/types/components/inputs/dropdown/test/multiple.cmp.test.d.ts +1 -0
- package/dist/types/components/inputs/form/internals/field-state.d.ts +1 -1
- package/dist/types/components/layout/control-group/control-group.d.ts +20 -0
- package/dist/types/components/layout/control-group/test/control-group.cmp.test.d.ts +7 -0
- package/dist/types/components.d.ts +148 -9
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/form-field-adapter.d.ts +3 -3
- package/dist/webquark/{p-b8f4994a.entry.js → p-0182e114.entry.js} +1 -1
- package/dist/webquark/{p-2c195546.entry.js → p-048103e0.entry.js} +1 -1
- package/dist/webquark/{p-3430b43c.entry.js → p-0a2c52de.entry.js} +1 -1
- package/dist/webquark/{p-b577b258.entry.js → p-0baf478a.entry.js} +1 -1
- package/dist/webquark/{p-5d6fb0d1.entry.js → p-15bad9ef.entry.js} +1 -1
- package/dist/webquark/{p-253add6d.entry.js → p-17b9713f.entry.js} +1 -1
- package/dist/webquark/{p-253fb28b.entry.js → p-222405b8.entry.js} +1 -1
- package/dist/webquark/{p-7a47e0c3.entry.js → p-2eaa3a9f.entry.js} +1 -1
- package/dist/webquark/{p-e7384b6e.entry.js → p-3daafc56.entry.js} +1 -1
- package/dist/webquark/{p-45e0d213.entry.js → p-44bbe12f.entry.js} +1 -1
- package/dist/webquark/{p-dee50f0a.entry.js → p-4609c362.entry.js} +1 -1
- package/dist/webquark/{p-aca37b06.entry.js → p-5b584d3c.entry.js} +1 -1
- package/dist/webquark/p-65fe9cac.entry.js +1 -0
- package/dist/webquark/{p-e930a769.entry.js → p-846dc838.entry.js} +1 -1
- package/dist/webquark/{p-d2c4696f.entry.js → p-84b350a3.entry.js} +1 -1
- package/dist/webquark/p-85131314.entry.js +1 -0
- package/dist/webquark/{p-58aaa98b.entry.js → p-852e88ae.entry.js} +1 -1
- package/dist/webquark/{p-596737cc.entry.js → p-86c05afd.entry.js} +1 -1
- package/dist/webquark/p-8c5b2706.entry.js +1 -0
- package/dist/webquark/p-923527f0.entry.js +1 -0
- package/dist/webquark/{p-33234157.entry.js → p-9a76cd71.entry.js} +1 -1
- package/dist/webquark/{p-BuctNczf.js → p-DDUED8LT.js} +1 -1
- package/dist/webquark/{p-Bk4FnOfb.js → p-Dnz3WmdX.js} +1 -1
- package/dist/webquark/{p-DaJmsCb7.js → p-DoGM9gsC.js} +1 -1
- package/dist/webquark/p-a0d97367.entry.js +1 -0
- package/dist/webquark/{p-3af50215.entry.js → p-a16bd8d5.entry.js} +2 -2
- package/dist/webquark/{p-fa15a69b.entry.js → p-a2334abe.entry.js} +1 -1
- package/dist/webquark/{p-5cccb6bc.entry.js → p-a2ff1b64.entry.js} +1 -1
- package/dist/webquark/{p-a199de7d.entry.js → p-a314bc21.entry.js} +1 -1
- package/dist/webquark/{p-848e040a.entry.js → p-a3e1096d.entry.js} +1 -1
- package/dist/webquark/{p-3726655f.entry.js → p-a66550da.entry.js} +1 -1
- package/dist/webquark/{p-b75ec829.entry.js → p-aa342e81.entry.js} +1 -1
- package/dist/webquark/{p-b702f60a.entry.js → p-b1c771fb.entry.js} +1 -1
- package/dist/webquark/p-b21ad707.entry.js +1 -0
- package/dist/webquark/{p-99ed0b0d.entry.js → p-b45ca926.entry.js} +1 -1
- package/dist/webquark/{p-29897ae6.entry.js → p-b8fdef4f.entry.js} +1 -1
- package/dist/webquark/{p-78c56cd3.entry.js → p-d4788321.entry.js} +1 -1
- package/dist/webquark/{p-01a59ac3.entry.js → p-d86bd51d.entry.js} +1 -1
- package/dist/webquark/{p-b82aaf4c.entry.js → p-dbcf7592.entry.js} +1 -1
- package/dist/webquark/p-e0943d41.entry.js +1 -0
- package/dist/webquark/{p-dcea3702.entry.js → p-e2721e77.entry.js} +1 -1
- package/dist/webquark/{p-ddeb2d4c.entry.js → p-e723a7ae.entry.js} +1 -1
- package/dist/webquark/{p-c2edfa2c.entry.js → p-eb800d1e.entry.js} +1 -1
- package/dist/webquark/{p-fbd1cbbe.entry.js → p-f4d23ffe.entry.js} +1 -1
- package/dist/webquark/{p-156d2fcf.entry.js → p-f51e1098.entry.js} +1 -1
- package/dist/webquark/{p-44eda084.entry.js → p-fe14f038.entry.js} +1 -1
- package/dist/webquark/webquark.esm.js +1 -1
- package/package.json +2 -2
- package/dist/components/p-cSh-5xis.js +0 -1
- package/dist/webquark/p-2e26f158.entry.js +0 -1
- package/dist/webquark/p-473a1810.entry.js +0 -1
- package/dist/webquark/p-881ecd5b.entry.js +0 -1
- package/dist/webquark/p-8a0733a1.entry.js +0 -1
- package/dist/webquark/p-f20ed85a.entry.js +0 -1
- package/dist/webquark/p-f95aeb8d.entry.js +0 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { afterEach, expect, it } from "vitest";
|
|
2
|
+
import "../../../../../../packages/browser/components/dist/components/q-dropdown.js";
|
|
3
|
+
import "../../../../../../packages/browser/components/dist/components/q-control-group.js";
|
|
4
|
+
import "../../../../../../packages/browser/components/dist/components/q-input.js";
|
|
5
|
+
import tokens from "../../../../theme/tokens.css?raw";
|
|
6
|
+
const frame = async () => { await new Promise(requestAnimationFrame); await new Promise(requestAnimationFrame); };
|
|
7
|
+
const width = (element) => element.getBoundingClientRect().width;
|
|
8
|
+
async function fixture(attributes = '') {
|
|
9
|
+
document.body.innerHTML = `<style>${tokens}</style><div id="parent" style="width:600px"><q-dropdown id="dropdown" width="fit-options" label="Unit" label-hidden ${attributes}></q-dropdown></div>`;
|
|
10
|
+
const dropdown = document.getElementById('dropdown');
|
|
11
|
+
dropdown.options = ['Hours', 'Minutes', 'Seconds'];
|
|
12
|
+
dropdown.value = 'Hours';
|
|
13
|
+
await customElements.whenDefined('q-dropdown');
|
|
14
|
+
await frame();
|
|
15
|
+
return dropdown;
|
|
16
|
+
}
|
|
17
|
+
afterEach(() => document.body.replaceChildren());
|
|
18
|
+
it('keeps a content-sized interval group inside its layout space as text grows', async () => {
|
|
19
|
+
const dropdown = await fixture();
|
|
20
|
+
const parent = document.getElementById('parent');
|
|
21
|
+
parent.style.cssText = 'display:flex;flex-wrap:wrap;gap:16px;width:600px';
|
|
22
|
+
const group = document.createElement('q-control-group');
|
|
23
|
+
group.style.cssText = 'width:max-content;max-width:100%';
|
|
24
|
+
const number = document.createElement('q-input');
|
|
25
|
+
number.width = 'xs';
|
|
26
|
+
number.type = 'number';
|
|
27
|
+
number.labelHidden = true;
|
|
28
|
+
number.value = '10';
|
|
29
|
+
group.append(number, dropdown);
|
|
30
|
+
const sibling = document.createElement('span');
|
|
31
|
+
sibling.textContent = 'Enabled';
|
|
32
|
+
parent.append(group, sibling);
|
|
33
|
+
for (const fontSize of ['14px', '24px', '32px']) {
|
|
34
|
+
parent.style.setProperty('--q-control-font-md', fontSize);
|
|
35
|
+
parent.style.setProperty('--q-control-line-md', `${parseFloat(fontSize) + 6}px`);
|
|
36
|
+
parent.style.setProperty('--q-control-height-md', `${parseFloat(fontSize) + 16}px`);
|
|
37
|
+
await frame();
|
|
38
|
+
const groupBox = group.getBoundingClientRect();
|
|
39
|
+
const trigger = dropdown.shadowRoot.querySelector('button').getBoundingClientRect();
|
|
40
|
+
expect(trigger.right).toBeLessThanOrEqual(groupBox.right + 1);
|
|
41
|
+
expect(trigger.bottom).toBeLessThanOrEqual(groupBox.bottom + 1);
|
|
42
|
+
expect(sibling.getBoundingClientRect().left).toBeGreaterThanOrEqual(trigger.right);
|
|
43
|
+
}
|
|
44
|
+
parent.style.width = '140px';
|
|
45
|
+
await frame();
|
|
46
|
+
expect(dropdown.getBoundingClientRect().right).toBeLessThanOrEqual(group.getBoundingClientRect().right + 1);
|
|
47
|
+
expect(dropdown.shadowRoot.querySelector('button').getBoundingClientRect().right)
|
|
48
|
+
.toBeLessThanOrEqual(group.getBoundingClientRect().right + 1);
|
|
49
|
+
expect(width(number)).toBe(80);
|
|
50
|
+
});
|
|
51
|
+
it('fits the longest label with arrow spacing and keeps that width across selection', async () => {
|
|
52
|
+
const dropdown = await fixture();
|
|
53
|
+
const initial = width(dropdown);
|
|
54
|
+
expect(initial).toBeLessThan(200);
|
|
55
|
+
dropdown.value = 'Minutes';
|
|
56
|
+
await frame();
|
|
57
|
+
expect(width(dropdown)).toBe(initial);
|
|
58
|
+
const text = dropdown.shadowRoot.querySelector('.trigger-text');
|
|
59
|
+
const arrow = dropdown.shadowRoot.querySelector('button .chevron-icon');
|
|
60
|
+
expect(text.scrollWidth).toBeLessThanOrEqual(text.clientWidth);
|
|
61
|
+
expect(arrow.getBoundingClientRect().left - text.getBoundingClientRect().right).toBeGreaterThanOrEqual(9.5);
|
|
62
|
+
dropdown.options = ['Hours', 'A much longer interval option'];
|
|
63
|
+
await expect.poll(() => width(dropdown)).toBeGreaterThan(initial);
|
|
64
|
+
dropdown.removeAttribute('width');
|
|
65
|
+
await frame();
|
|
66
|
+
expect(width(dropdown)).toBe(600);
|
|
67
|
+
expect(dropdown.style.getPropertyValue('--_q-dropdown-options-width')).toBe('');
|
|
68
|
+
});
|
|
69
|
+
it('reflows after font, gap and size changes, and respects parent and explicit host widths', async () => {
|
|
70
|
+
const dropdown = await fixture();
|
|
71
|
+
const initial = width(dropdown);
|
|
72
|
+
dropdown.style.setProperty('--q-dropdown-font-size', '24px');
|
|
73
|
+
await expect.poll(() => width(dropdown)).toBeGreaterThan(initial);
|
|
74
|
+
const larger = width(dropdown);
|
|
75
|
+
dropdown.style.setProperty('--q-dropdown-icon-gap', '24px');
|
|
76
|
+
await expect.poll(() => width(dropdown)).toBeGreaterThan(larger + 13);
|
|
77
|
+
const withGap = width(dropdown);
|
|
78
|
+
dropdown.style.setProperty('--q-dropdown-padding', '0 40px');
|
|
79
|
+
await expect.poll(() => width(dropdown)).toBeGreaterThan(withGap + 40);
|
|
80
|
+
dropdown.style.removeProperty('--q-dropdown-padding');
|
|
81
|
+
dropdown.style.removeProperty('--q-dropdown-font-size');
|
|
82
|
+
dropdown.style.removeProperty('--q-dropdown-icon-gap');
|
|
83
|
+
document.getElementById('parent').style.width = '60px';
|
|
84
|
+
await frame();
|
|
85
|
+
expect(width(dropdown)).toBe(60);
|
|
86
|
+
expect(dropdown.scrollWidth).toBeLessThanOrEqual(60);
|
|
87
|
+
document.getElementById('parent').style.width = '600px';
|
|
88
|
+
dropdown.style.width = '150px';
|
|
89
|
+
await frame();
|
|
90
|
+
expect(width(dropdown)).toBe(150);
|
|
91
|
+
});
|
|
92
|
+
it.each(['sm', 'md', 'lg'])('fits searchable controls at size %s without crowding their arrow', async (size) => {
|
|
93
|
+
const dropdown = await fixture(`searchable size="${size}"`);
|
|
94
|
+
dropdown.value = 'Minutes';
|
|
95
|
+
await frame();
|
|
96
|
+
const input = dropdown.shadowRoot.querySelector('.dropdown-main-input');
|
|
97
|
+
const style = getComputedStyle(input);
|
|
98
|
+
const labels = dropdown.shadowRoot.querySelector('.fit-options-labels');
|
|
99
|
+
const available = input.clientWidth - parseFloat(style.paddingInlineStart) - parseFloat(style.paddingInlineEnd);
|
|
100
|
+
expect(available).toBeGreaterThanOrEqual(width(labels) - 1);
|
|
101
|
+
const arrow = dropdown.shadowRoot.querySelector('.editable-trigger > .chevron-icon');
|
|
102
|
+
expect(parseFloat(style.paddingInlineEnd) - 14 - width(arrow)).toBeGreaterThanOrEqual(9.5);
|
|
103
|
+
});
|
|
104
|
+
it('uses loaded options rather than filtered search results and supports group placement', async () => {
|
|
105
|
+
const dropdown = await fixture('searchable');
|
|
106
|
+
const group = document.createElement('q-control-group');
|
|
107
|
+
const number = document.createElement('q-input');
|
|
108
|
+
number.width = 'xs';
|
|
109
|
+
group.append(number, dropdown);
|
|
110
|
+
document.getElementById('parent').append(group);
|
|
111
|
+
await frame();
|
|
112
|
+
const initial = width(dropdown);
|
|
113
|
+
const input = dropdown.shadowRoot.querySelector('.dropdown-main-input');
|
|
114
|
+
input.value = 'Hours';
|
|
115
|
+
input.dispatchEvent(new InputEvent('input', { bubbles: true }));
|
|
116
|
+
await frame();
|
|
117
|
+
expect(width(dropdown)).toBe(initial);
|
|
118
|
+
expect(width(number)).toBe(80);
|
|
119
|
+
expect(width(dropdown)).toBeLessThan(200);
|
|
120
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { page, userEvent } from "vitest/browser";
|
|
3
|
+
// @ts-ignore - exercise the freshly built distribution including composed q-chip styles.
|
|
4
|
+
import { defineCustomElements } from "../../../../../../packages/browser/components/dist/loader";
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import "../../../../../../packages/browser/components/dist/webquark/webquark.css";
|
|
7
|
+
defineCustomElements();
|
|
8
|
+
const frame = async () => { await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve()))); };
|
|
9
|
+
const options = [{ label: 'Catalogue', value: 'catalogue' }, { label: 'Checkout', value: 'checkout' }, { label: 'Payments', value: 'payments' }];
|
|
10
|
+
async function create(props = {}, parent = document.body) {
|
|
11
|
+
const element = document.createElement('q-dropdown');
|
|
12
|
+
Object.assign(element, { label: 'Modules', multiple: true, searchable: true, options, ...props });
|
|
13
|
+
element.style.width = '380px';
|
|
14
|
+
parent.append(element);
|
|
15
|
+
await element.componentOnReady();
|
|
16
|
+
await frame();
|
|
17
|
+
return element;
|
|
18
|
+
}
|
|
19
|
+
afterEach(() => document.body.replaceChildren());
|
|
20
|
+
describe('q-dropdown multiple selection', () => {
|
|
21
|
+
it('keeps one line, hides selected choices, removes chips and emits only the array change', async () => {
|
|
22
|
+
const element = await create({ value: 'payments', searchable: false });
|
|
23
|
+
const values = vi.fn(), single = vi.fn();
|
|
24
|
+
element.addEventListener('qValuesChange', values);
|
|
25
|
+
element.addEventListener('qChange', single);
|
|
26
|
+
const input = page.getByRole('combobox', { name: 'Modules' });
|
|
27
|
+
const height = element.shadowRoot.querySelector('.multiple-trigger').getBoundingClientRect().height;
|
|
28
|
+
await userEvent.click(input);
|
|
29
|
+
await userEvent.click(page.getByRole('option', { name: 'Catalogue' }));
|
|
30
|
+
await frame();
|
|
31
|
+
expect(element.values).toEqual(['catalogue']);
|
|
32
|
+
expect(element.shadowRoot.querySelectorAll('[role=option]')).toHaveLength(2);
|
|
33
|
+
expect(element.shadowRoot.querySelector('[role=option][aria-selected="true"]')).toBeNull();
|
|
34
|
+
expect(values.mock.calls[0][0].detail).toEqual(['catalogue']);
|
|
35
|
+
expect(single).not.toHaveBeenCalled();
|
|
36
|
+
await userEvent.click(page.getByRole('button', { name: 'Remove Catalogue' }));
|
|
37
|
+
await frame();
|
|
38
|
+
expect(element.values).toEqual([]);
|
|
39
|
+
await userEvent.click(input);
|
|
40
|
+
expect(element.shadowRoot.querySelectorAll('[role=option]')).toHaveLength(3);
|
|
41
|
+
expect(element.shadowRoot.querySelector('.multiple-trigger').getBoundingClientRect().height).toBe(height);
|
|
42
|
+
});
|
|
43
|
+
it('keeps search usable and supports keyboard selection, Backspace and Escape', async () => {
|
|
44
|
+
const element = await create();
|
|
45
|
+
const input = page.getByRole('combobox', { name: 'Modules' });
|
|
46
|
+
await input.fill('Check');
|
|
47
|
+
await userEvent.keyboard('{ArrowDown}{Enter}');
|
|
48
|
+
await frame();
|
|
49
|
+
expect(element.values).toEqual(['checkout']);
|
|
50
|
+
expect(element.shadowRoot.querySelector('.multiple-input').value).toBe('');
|
|
51
|
+
await userEvent.keyboard('{Backspace}');
|
|
52
|
+
expect(element.values).toEqual([]);
|
|
53
|
+
await userEvent.keyboard('{Escape}');
|
|
54
|
+
await frame();
|
|
55
|
+
expect(element.shadowRoot.querySelector('.dropdown-menu')).toBeNull();
|
|
56
|
+
});
|
|
57
|
+
it('measures fitting chips and lets the overflow panel remove selections without growing the control', async () => {
|
|
58
|
+
const element = await create({ values: ['catalogue', 'checkout', 'payments'] });
|
|
59
|
+
element.style.width = '230px';
|
|
60
|
+
await frame();
|
|
61
|
+
await frame();
|
|
62
|
+
const field = element.shadowRoot.querySelector('.multiple-trigger');
|
|
63
|
+
const height = field.getBoundingClientRect().height;
|
|
64
|
+
const more = element.shadowRoot.querySelector('.multiple-trigger > .multiple-more');
|
|
65
|
+
expect(more).not.toBeNull();
|
|
66
|
+
expect(element.shadowRoot.querySelector('.multiple-input').getBoundingClientRect().width).toBeGreaterThanOrEqual(64);
|
|
67
|
+
more.click();
|
|
68
|
+
await frame();
|
|
69
|
+
const input = element.shadowRoot.querySelector('.multiple-input');
|
|
70
|
+
input.focus();
|
|
71
|
+
await userEvent.keyboard('{ArrowDown}');
|
|
72
|
+
await frame();
|
|
73
|
+
expect(element.shadowRoot.querySelector('[role=listbox]')).not.toBeNull();
|
|
74
|
+
more.click();
|
|
75
|
+
await frame();
|
|
76
|
+
await userEvent.click(page.getByRole('dialog', { name: 'Selected options' }).getByRole('button', { name: 'Remove Payments' }));
|
|
77
|
+
await frame();
|
|
78
|
+
expect(element.values).toEqual(['catalogue', 'checkout']);
|
|
79
|
+
await userEvent.keyboard('{Escape}');
|
|
80
|
+
element.style.width = '700px';
|
|
81
|
+
await frame();
|
|
82
|
+
await frame();
|
|
83
|
+
expect(element.shadowRoot.querySelector('.multiple-trigger > .multiple-more')).toBeNull();
|
|
84
|
+
expect(field.getBoundingClientRect().height).toBe(height);
|
|
85
|
+
});
|
|
86
|
+
it('submits repeated native form entries, validates required, resets and respects disabled fieldsets', async () => {
|
|
87
|
+
const form = document.createElement('form');
|
|
88
|
+
document.body.append(form);
|
|
89
|
+
const fieldset = document.createElement('fieldset');
|
|
90
|
+
form.append(fieldset);
|
|
91
|
+
const element = await create({ name: 'modules', required: true, values: ['catalogue'] }, fieldset);
|
|
92
|
+
expect(new FormData(form).getAll('modules')).toEqual(['catalogue']);
|
|
93
|
+
element.values = ['checkout', 'payments'];
|
|
94
|
+
await frame();
|
|
95
|
+
expect(new FormData(form).getAll('modules')).toEqual(['checkout', 'payments']);
|
|
96
|
+
element.values = [];
|
|
97
|
+
await frame();
|
|
98
|
+
expect(await element.checkValidity()).toBe(false);
|
|
99
|
+
fieldset.disabled = true;
|
|
100
|
+
await frame();
|
|
101
|
+
expect(await element.checkValidity()).toBe(true);
|
|
102
|
+
expect(new FormData(form).getAll('modules')).toEqual([]);
|
|
103
|
+
fieldset.disabled = false;
|
|
104
|
+
form.reset();
|
|
105
|
+
await frame();
|
|
106
|
+
expect(element.values).toEqual(['catalogue']);
|
|
107
|
+
});
|
|
108
|
+
it('round-trips q-form arrays and keeps external selections when the option page changes', async () => {
|
|
109
|
+
const form = document.createElement('q-form');
|
|
110
|
+
document.body.append(form);
|
|
111
|
+
await form.componentOnReady();
|
|
112
|
+
const element = await create({ name: 'modules', externalSearch: true, values: ['catalogue'] }, form);
|
|
113
|
+
await form.setValues({ modules: ['checkout', 'payments'] });
|
|
114
|
+
await frame();
|
|
115
|
+
expect(await form.getValues()).toEqual({ modules: ['checkout', 'payments'] });
|
|
116
|
+
element.options = [];
|
|
117
|
+
await frame();
|
|
118
|
+
expect(await form.getValues()).toEqual({ modules: ['checkout', 'payments'] });
|
|
119
|
+
expect(Array.from(element.shadowRoot.querySelectorAll('q-chip')).some(chip => chip.label === 'Checkout')).toBe(true);
|
|
120
|
+
await form.setValues({ modules: [] });
|
|
121
|
+
await frame();
|
|
122
|
+
expect(await form.getValues()).toEqual({ modules: [] });
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -294,11 +294,11 @@ export class QForm {
|
|
|
294
294
|
const hasHeaderContent = Boolean(this.label) || this.hasHeaderSlot;
|
|
295
295
|
const formLabelledBy = !this.ariaLabel && this.label && !this.hasHeaderSlot ? this.titleId : undefined;
|
|
296
296
|
const formAriaLabel = this.ariaLabel?.trim() || (this.label && this.hasHeaderSlot ? this.label : undefined);
|
|
297
|
-
return (h(Host, { key: '
|
|
297
|
+
return (h(Host, { key: '3c46f2d8047c1d56dda9f74fc23fff8b34cab500', style: { ...controlScope(this.size), '--q-context-feedback-min': this.reserveFeedback === undefined ? '' : 'initial', '--_q-context-feedback-reserve': this.reserveFeedback === undefined ? '' : this.reserveFeedback ? '1' : '0' } }, h("div", { key: '294ec3fd059ac12c6a87c8bef51497ea630fdd3f', class: "form-shell" }, h("div", { key: 'b5961aeba9b7fbf0b3f0a06c51ca66b1a3b332ce', class: { 'form-header': true, 'is-hidden': !hasHeaderContent, 'q-label-hidden': this.labelHidden }, part: "header" }, h("slot", { key: '36abbf859ef877111c02d9a82cbf2a8cb6b1d0b6', name: "header", ref: (el) => (this.headerSlot = el), onSlotchange: this.handleHeaderSlotChange }, this.label && h("h2", { key: 'b9d3404015cd624dad379337275f0508e1399da2', id: this.titleId, class: "form-title" }, this.label))), h("form", { key: '0337553285166e79efde0de5bcd0d532b6d9adaa', ref: (el) => (this.formEl = el), action: this.action, method: this.method, autocomplete: this.autocomplete, enctype: this.enctype, target: this.target, noValidate: this.noValidate, "aria-labelledby": formLabelledBy, "aria-label": formAriaLabel, part: "form", onSubmit: this.handleSubmit, onClick: (ev) => {
|
|
298
298
|
const image = ev.target;
|
|
299
299
|
if (image instanceof HTMLInputElement && image.type === 'image' && image.getRootNode() === this.formEl?.getRootNode())
|
|
300
300
|
this.handleComposedClick(ev);
|
|
301
|
-
}, onReset: this.handleReset }, h("div", { key: '
|
|
301
|
+
}, onReset: this.handleReset }, h("div", { key: 'c4f398715c9eeab1c47edcb4b381c6f8bccf9009', class: "form-body", part: "body" }, h("slot", { key: '1bd4f97febdf88a0c67d814c03b83375beb13d89' })), h("div", { key: '4bd533486269c7e8639a816b01d4b2a758b68830', class: { 'form-actions': true, 'is-hidden': !this.hasActionsSlot }, part: "actions" }, h("slot", { key: '640e463fcbb0d50746fd1abc26d4640d6086f876', name: "actions", ref: (el) => (this.actionsSlot = el), onSlotchange: this.handleActionsSlotChange }))))));
|
|
302
302
|
}
|
|
303
303
|
static get is() { return "q-form"; }
|
|
304
304
|
static get encapsulation() { return "shadow"; }
|
|
@@ -69,7 +69,12 @@ export function snapshotField(control) {
|
|
|
69
69
|
if (custom) {
|
|
70
70
|
state.model = custom.value();
|
|
71
71
|
if (name && active && !disabled && state.model !== null && (state.kind !== 'toggle' || state.model === true)) {
|
|
72
|
-
state.
|
|
72
|
+
if (state.kind === 'multiselect' && Array.isArray(state.model)) {
|
|
73
|
+
state.entries.push(...state.model.map(value => [name, value]));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
state.entries.push([name, String(state.model)]);
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
return state;
|
|
75
80
|
}
|
|
@@ -160,6 +160,11 @@ function prepareGroup(name, fields, value) {
|
|
|
160
160
|
if (fields.length !== 1)
|
|
161
161
|
return fail(name, 'repeated multiselect containers have an ambiguous assignment shape');
|
|
162
162
|
const selected = identities(value, name);
|
|
163
|
+
if (fields[0].custom)
|
|
164
|
+
return [() => {
|
|
165
|
+
fields[0].custom.assign(selected);
|
|
166
|
+
fields[0].custom.reconcile();
|
|
167
|
+
}];
|
|
163
168
|
const select = fields[0].control;
|
|
164
169
|
return [() => { Array.from(select.options).forEach(option => { option.selected = selected.includes(option.value); }); }];
|
|
165
170
|
}
|
|
@@ -311,3 +311,25 @@ input.input-box[type="color"]::-moz-color-swatch {
|
|
|
311
311
|
overflow-wrap: anywhere;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
|
|
315
|
+
/* Shared opt-in presentation; standalone surfaces retain their existing rules. */
|
|
316
|
+
:host([data-q-control-group]) :is(.input-control, .dropdown-trigger, .quantity-selector, .btn, .toggle-wrapper) {
|
|
317
|
+
border-start-start-radius: var(--_q-group-start-start, 0px);
|
|
318
|
+
border-start-end-radius: var(--_q-group-start-end, 0px);
|
|
319
|
+
border-end-start-radius: var(--_q-group-end-start, 0px);
|
|
320
|
+
border-end-end-radius: var(--_q-group-end-end, 0px);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
:host([data-q-control-group]) .toggle-wrapper {
|
|
324
|
+
box-sizing: border-box;
|
|
325
|
+
min-height: var(--_q-control-height);
|
|
326
|
+
padding-inline: var(--_q-control-padding);
|
|
327
|
+
border: var(--q-border, 1px solid var(--q-border-color, #4b5563));
|
|
328
|
+
background: var(--q-bg-field, var(--q-bg-surface-3, #22304d));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
:host([data-q-control-group]) :is(.btn, .toggle-wrapper, .quantity-selector) {
|
|
332
|
+
width: 100%;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
|
|
@@ -300,16 +300,16 @@ export class QInput {
|
|
|
300
300
|
const isMinDisabled = hasNumericValue && this.min !== undefined && this.min !== null && numericValue <= this.min;
|
|
301
301
|
const isMaxDisabled = hasNumericValue && this.max !== undefined && this.max !== null && numericValue >= this.max;
|
|
302
302
|
const ariaLabel = this.ariaLabel?.trim() || undefined;
|
|
303
|
-
return (h("div", { key: '
|
|
303
|
+
return (h("div", { key: 'b71bf01d50e267da7463549040d3158e2794abbd', style: feedbackStyle(this.reserveFeedback), class: {
|
|
304
304
|
'input-wrapper': true,
|
|
305
305
|
'is-disabled': this.isDisabled,
|
|
306
306
|
'has-error': hasError,
|
|
307
307
|
[`size-${this.size}`]: true
|
|
308
|
-
} }, this.label && (h("label", { key: '
|
|
308
|
+
} }, this.label && (h("label", { key: 'b958e678ddb262d48f6e425a607419b2bf43f4d8', class: { 'input-label': true, 'q-label-hidden': this.labelHidden }, htmlFor: "q-field", part: "label" }, this.label)), h("div", { key: 'fb1a9bdcb5374e4248fb979f8b3d015a7073a28c', class: "input-control", part: "control" }, h("span", { key: 'd6a2a708b5725f2ad049a1d5237d222e3634faef', class: "prefix-container", style: { display: this.hasPrefix ? 'flex' : 'none' }, part: "prefix" }, h("slot", { key: '1c456d29bf3445f1642aa82ddcb97a598042e3f3', name: "prefix", onSlotchange: this.handlePrefixSlotChange })), h("input", { key: this.type, ref: (el) => (this.inputEl = el), id: "q-field", class: {
|
|
309
309
|
'input-box': true,
|
|
310
310
|
'has-prefix-padding': this.hasPrefix,
|
|
311
311
|
'has-suffix-padding': showSuffixContainer
|
|
312
|
-
}, type: inputType, name: this.name, value: this.value, placeholder: this.placeholder, disabled: this.isDisabled, required: this.required, min: this.min, max: this.max, step: this.step, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.handleClick, onKeyDown: this.handleKeyDown, role: this.type === 'number' ? 'spinbutton' : undefined, "aria-valuenow": hasNumericValue ? String(numericValue) : undefined, "aria-valuemin": this.type === 'number' && this.min !== undefined && this.min !== null ? String(this.min) : undefined, "aria-valuemax": this.type === 'number' && this.max !== undefined && this.max !== null ? String(this.max) : undefined, "aria-invalid": hasError ? 'true' : 'false', "aria-describedby": hasError || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel }), this.type === 'number' && !this.isDisabled && (h("div", { key: '
|
|
312
|
+
}, type: inputType, name: this.name, value: this.value, placeholder: this.placeholder, disabled: this.isDisabled, required: this.required, min: this.min, max: this.max, step: this.step, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.handleClick, onKeyDown: this.handleKeyDown, role: this.type === 'number' ? 'spinbutton' : undefined, "aria-valuenow": hasNumericValue ? String(numericValue) : undefined, "aria-valuemin": this.type === 'number' && this.min !== undefined && this.min !== null ? String(this.min) : undefined, "aria-valuemax": this.type === 'number' && this.max !== undefined && this.max !== null ? String(this.max) : undefined, "aria-invalid": hasError ? 'true' : 'false', "aria-describedby": hasError || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel }), this.type === 'number' && !this.isDisabled && (h("div", { key: '0f1a9f35efb2cdd52f3524d1230f5790b2c9dde4', class: "input-spinners", part: "spinners" }, h("button", { key: '1c7655ae1ae057c9d3e5b54d209c26ff6b9add97', class: "spinner-btn spinner-up", type: "button", onClick: this.handleIncrement, disabled: isMaxDisabled, "aria-label": "Increase value" }, h("svg", { key: 'f341aabd6411329fc2688d15fcfd6bed963f2839', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "aria-hidden": "true" }, h("path", { key: '168c85528a0784965cce64f1e646360cd62bc927', d: "M18 15l-6-6-6 6" }))), h("button", { key: '48cfd65993b4a56bc0eb319565656eb28f44997f', class: "spinner-btn spinner-down", type: "button", onClick: this.handleDecrement, disabled: isMinDisabled, "aria-label": "Decrease value" }, h("svg", { key: 'a1593bac780e54e3441cb1fe8c5f8bfaeafe038f', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "aria-hidden": "true" }, h("path", { key: '8d899374a935ec843e4cc33846747af98a37878d', d: "M6 9l6 6 6-6" }))))), h("span", { key: 'f42635f7d63b90d957c008cafe777616d5523313', class: "suffix-container", style: { display: showSuffixContainer ? 'flex' : 'none' }, part: "suffix" }, showClearBtn && (h("button", { key: '4b5382c98c3ff4cf00ec32131ff7000feb55f39b', class: "clear-btn", type: "button", onClick: this.handleClear, "aria-label": "Clear input" }, h("svg", { key: 'aa79913aeb728e893da73a66a531b72f8ec0cbae', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { key: '62577d528db5bc4b5846a5f7276ed0addc22478a', d: "M18 6L6 18M6 6l12 12" })))), showPasswordToggle && (h("button", { key: 'c34bde830e34ed73aeba3a95c33010faac039d68', class: "password-toggle-btn", type: "button", onClick: this.handlePasswordToggle, "aria-label": this.passwordVisible ? 'Hide password' : 'Show password', "aria-pressed": this.passwordVisible ? 'true' : 'false' }, this.passwordVisible ? (h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "aria-hidden": "true" }, h("path", { d: "M3 3l18 18" }), h("path", { d: "M10.58 10.58A2 2 0 0 0 12 14a2 2 0 0 0 1.42-.58" }), h("path", { d: "M9.88 4.24A10.2 10.2 0 0 1 12 4c7 0 10 8 10 8a18.5 18.5 0 0 1-4.08 5.19" }), h("path", { d: "M6.61 6.61A18.5 18.5 0 0 0 2 12s3 8 10 8a10.7 10.7 0 0 0 5.39-1.61" }))) : (h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "aria-hidden": "true" }, h("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }), h("circle", { cx: "12", cy: "12", r: "3" }))))), h("span", { key: '2acf49e398fdbedf792228f8c07a5118aba3ca65', style: { display: !showClearBtn && this.hasSuffix ? 'block' : 'none' } }, h("slot", { key: '5a7972e08af55587b17dbb67e1f32b6e9fbb5c60', name: "suffix", onSlotchange: this.handleSuffixSlotChange })))), fieldFeedback('q-field-error', displayError, this.description)));
|
|
313
313
|
}
|
|
314
314
|
static get is() { return "q-input"; }
|
|
315
315
|
static get encapsulation() { return "shadow"; }
|
|
@@ -169,3 +169,25 @@
|
|
|
169
169
|
.variant-horizontal .quantity-btn { width: var(--q-quantity-selector-height, var(--_q-control-height)); min-height: calc(var(--_q-control-height) - 2px); }
|
|
170
170
|
.variant-vertical .quantity-btn { height: var(--q-quantity-selector-height, var(--_q-control-height)); }
|
|
171
171
|
.btn-icon { width: var(--_q-control-icon); height: var(--_q-control-icon); }
|
|
172
|
+
|
|
173
|
+
/* Shared opt-in presentation; standalone surfaces retain their existing rules. */
|
|
174
|
+
:host([data-q-control-group]) :is(.input-control, .dropdown-trigger, .quantity-selector, .btn, .toggle-wrapper) {
|
|
175
|
+
border-start-start-radius: var(--_q-group-start-start, 0px);
|
|
176
|
+
border-start-end-radius: var(--_q-group-start-end, 0px);
|
|
177
|
+
border-end-start-radius: var(--_q-group-end-start, 0px);
|
|
178
|
+
border-end-end-radius: var(--_q-group-end-end, 0px);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:host([data-q-control-group]) .toggle-wrapper {
|
|
182
|
+
box-sizing: border-box;
|
|
183
|
+
min-height: var(--_q-control-height);
|
|
184
|
+
padding-inline: var(--_q-control-padding);
|
|
185
|
+
border: var(--q-border, 1px solid var(--q-border-color, #4b5563));
|
|
186
|
+
background: var(--q-bg-field, var(--q-bg-surface-3, #22304d));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host([data-q-control-group]) :is(.btn, .toggle-wrapper, .quantity-selector) {
|
|
190
|
+
width: 100%;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
@@ -111,15 +111,15 @@ export class QQuantitySelector {
|
|
|
111
111
|
const hasFiniteValue = Number.isFinite(this.value);
|
|
112
112
|
const isMinDisabled = hasFiniteValue && hasQuantityBound(this.min) && finiteValue <= this.min;
|
|
113
113
|
const isMaxDisabled = hasFiniteValue && hasQuantityBound(this.max) && finiteValue >= this.max;
|
|
114
|
-
const decBtn = (h("button", { key: '
|
|
115
|
-
const incBtn = (h("button", { key: '
|
|
114
|
+
const decBtn = (h("button", { key: 'cbbda2b87d557156333f6eac8a569fe66d462a84', type: "button", class: "quantity-btn quantity-btn-decrement", onClick: this.decrement, disabled: isMinDisabled, "aria-label": "Decrement quantity" }, h("svg", { key: 'b7180042b807332f9f608384a3dae7d8d6d46d61', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "btn-icon", "aria-hidden": "true" }, h("line", { key: 'cfeb1fc1bd4ef174f5175c826427e52d86824f24', x1: "5", y1: "12", x2: "19", y2: "12" }))));
|
|
115
|
+
const incBtn = (h("button", { key: '1c5ef6890bd91c8d35f79c90a5934c0cd614d631', type: "button", class: "quantity-btn quantity-btn-increment", onClick: this.increment, disabled: isMaxDisabled, "aria-label": "Increment quantity" }, h("svg", { key: '0b8b9db431141e89faa8185f2b1ff4d23ce9916d', viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "btn-icon", "aria-hidden": "true" }, h("line", { key: 'cb831f315150171913a9c016c2a3ac2092e73d82', x1: "12", y1: "5", x2: "12", y2: "19" }), h("line", { key: 'd0c5093d484ee49facd448a02f54f0adabf5c35e', x1: "5", y1: "12", x2: "19", y2: "12" }))));
|
|
116
116
|
const calculatedWidth = orientation === 'horizontal' ? this.getCalculatedWidth() : '100%';
|
|
117
|
-
return (h("div", { key: '
|
|
117
|
+
return (h("div", { key: 'c1780e7303cfc38f06211661d470ae4529656084', class: {
|
|
118
118
|
'quantity-selector': true,
|
|
119
119
|
[`size-${this.size}`]: true,
|
|
120
120
|
[`orientation-${orientation}`]: true,
|
|
121
121
|
[`variant-${orientation}`]: true,
|
|
122
|
-
}, onClick: this.handleClick }, orientation === 'vertical' ? incBtn : decBtn, h("input", { key: '
|
|
122
|
+
}, onClick: this.handleClick }, orientation === 'vertical' ? incBtn : decBtn, h("input", { key: 'c5877e6e3caf9c348234884707a84044c71872d2', type: "text", class: "quantity-input", value: this.inputValue, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus, onChange: this.handleChange, onKeyDown: this.handleKeyDown, role: "spinbutton", "aria-valuenow": hasFiniteValue ? String(this.value) : undefined, "aria-valuemin": hasQuantityBound(this.min) ? String(this.min) : undefined, "aria-valuemax": hasQuantityBound(this.max) ? String(this.max) : undefined, "aria-label": "Quantity", style: { width: calculatedWidth }, part: "input" }), orientation === 'vertical' ? decBtn : incBtn));
|
|
123
123
|
}
|
|
124
124
|
static get is() { return "q-quantity-selector"; }
|
|
125
125
|
static get encapsulation() { return "shadow"; }
|
|
@@ -193,13 +193,13 @@ export class QRadioGroup {
|
|
|
193
193
|
const hasError = !!displayError;
|
|
194
194
|
const ariaLabel = this.ariaLabel?.trim() || undefined;
|
|
195
195
|
const radioName = this.name || this.internalName;
|
|
196
|
-
return (h("div", { key: '
|
|
196
|
+
return (h("div", { key: '2348b3c0574a2d94074fe103242b4b83bb77c5b3', style: feedbackStyle(this.reserveFeedback), class: {
|
|
197
197
|
'radio-group': true,
|
|
198
198
|
'is-disabled': this.isDisabled,
|
|
199
199
|
'has-error': hasError,
|
|
200
200
|
[`size-${this.size}`]: true,
|
|
201
201
|
[`orientation-${this.orientation}`]: true,
|
|
202
|
-
} }, h("fieldset", { key: '
|
|
202
|
+
} }, h("fieldset", { key: '7b9412fb0fecb18fb2fa52fda90758768cd85d19', ref: element => (this.fieldsetEl = element), class: "group-fieldset", part: "group", disabled: this.isDisabled, role: "radiogroup", "aria-label": !this.label ? ariaLabel : undefined, "aria-required": this.required ? 'true' : 'false', "aria-invalid": hasError ? 'true' : 'false', "aria-describedby": hasError || this.description ? 'q-radio-group-error' : undefined }, this.label && h("legend", { key: '3fd75f8eaa62aa4fcbbb150aa06679160c5eac44', part: "label", class: { 'q-label-hidden': this.labelHidden } }, this.label), h("div", { key: '4987b1b9caacae6865d8c8ca1c9db30292f68c60', class: "options", part: "options", style: { '--q-radio-group-option-count': String(Math.max(identifiedOptions.length, 1)) } }, identifiedOptions.map(({ item: option, key }) => (h("label", { key: key, class: {
|
|
203
203
|
option: true,
|
|
204
204
|
'is-selected': option.value === this.value,
|
|
205
205
|
'is-disabled': this.isDisabled || option.disabled === true,
|
|
@@ -84,7 +84,7 @@ export class QSlider {
|
|
|
84
84
|
this.qInput.emit(this.value);
|
|
85
85
|
}
|
|
86
86
|
render() {
|
|
87
|
-
return (h("div", { key: '
|
|
87
|
+
return (h("div", { key: 'c7f0371d801a02a000d92dc92df3c1bf228fc842', class: "field" }, (this.label || this.showValue) && h("div", { key: 'e33ce30e1a32013e46c670ca7c605a8a001d2ff7', class: "label-row", part: "label" }, this.label && h("label", { key: '0bb615df1af862b010c5d18a96e5cfc3eaffab61', htmlFor: "range" }, this.label), this.showValue && h("span", { key: 'f49a2cf0661d9dd9dcc79e97a061f09940970dbc', class: "badge", part: "value", "aria-hidden": "true" }, this.value, this.suffix)), h("input", { key: '878163075048af3984bdf655f29558293532c004', ref: el => this.inputEl = el, id: "range", part: "input", type: "range", min: this.lower, max: this.upper, step: this.increment, value: this.value, disabled: this.fieldDisabled, "aria-label": this.ariaLabel || (!this.label ? 'Value' : undefined), "aria-valuetext": this.suffix ? `${this.value}${this.suffix}` : undefined, onInput: event => this.onValue(event, false), onChange: event => this.onValue(event, true) })));
|
|
88
88
|
}
|
|
89
89
|
static get is() { return "q-slider"; }
|
|
90
90
|
static get encapsulation() { return "shadow"; }
|
|
@@ -234,12 +234,12 @@ export class QTextarea {
|
|
|
234
234
|
const hasError = !!(this.error || this.errorMessage);
|
|
235
235
|
const displayError = this.error || this.errorMessage;
|
|
236
236
|
const ariaLabel = this.ariaLabel?.trim() || (!this.label && this.placeholder ? this.placeholder : undefined);
|
|
237
|
-
return (h("div", { key: '
|
|
237
|
+
return (h("div", { key: 'b1dd4435db3190f58fd4bff45cb6b5bcc7eec0cf', style: feedbackStyle(this.reserveFeedback), class: {
|
|
238
238
|
'textarea-wrapper': true,
|
|
239
239
|
'is-disabled': this.isDisabled,
|
|
240
240
|
'has-error': hasError,
|
|
241
241
|
[`size-${this.size}`]: true
|
|
242
|
-
} }, h("span", { key: '
|
|
242
|
+
} }, h("span", { key: '6633f6aea71a4eada7ae9c8d0c785bc165b5a186', class: "textarea-size-probe", "aria-hidden": "true", ref: el => (this.sizeProbeEl = el) }, "M"), this.label && (h("label", { key: '19985e8ee5ab662ab1f5edc30d605d1fecf51dac', class: { 'textarea-label': true, 'q-label-hidden': this.labelHidden }, htmlFor: "q-field", part: "label" }, this.label)), h("textarea", { key: '2e3f0c3830078b5405d82b178293ca9036664458', ref: (el) => (this.textareaEl = el), id: "q-field", class: {
|
|
243
243
|
'textarea-box': true,
|
|
244
244
|
'resize-manual': this.activeResizeMode === 'manual'
|
|
245
245
|
}, part: "textarea", value: this.value, name: this.name, placeholder: this.placeholder, rows: this.rows, disabled: this.isDisabled, required: this.required, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.handleClick, "aria-invalid": hasError ? 'true' : 'false', "aria-describedby": hasError || this.description ? 'q-field-error' : undefined, "aria-label": ariaLabel }), fieldFeedback('q-field-error', displayError, this.description)));
|
|
@@ -255,3 +255,25 @@
|
|
|
255
255
|
/* Switch settings read label-first; checkbox choices retain control-first order. */
|
|
256
256
|
.type-switch .toggle-control { order: 1; margin-inline-start: auto; }
|
|
257
257
|
.toggle-label-text { min-width: 0; overflow-wrap: anywhere; }
|
|
258
|
+
|
|
259
|
+
/* Shared opt-in presentation; standalone surfaces retain their existing rules. */
|
|
260
|
+
:host([data-q-control-group]) :is(.input-control, .dropdown-trigger, .quantity-selector, .btn, .toggle-wrapper) {
|
|
261
|
+
border-start-start-radius: var(--_q-group-start-start, 0px);
|
|
262
|
+
border-start-end-radius: var(--_q-group-start-end, 0px);
|
|
263
|
+
border-end-start-radius: var(--_q-group-end-start, 0px);
|
|
264
|
+
border-end-end-radius: var(--_q-group-end-end, 0px);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
:host([data-q-control-group]) .toggle-wrapper {
|
|
268
|
+
box-sizing: border-box;
|
|
269
|
+
min-height: var(--_q-control-height);
|
|
270
|
+
padding-inline: var(--_q-control-padding);
|
|
271
|
+
border: var(--q-border, 1px solid var(--q-border-color, #4b5563));
|
|
272
|
+
background: var(--q-bg-field, var(--q-bg-surface-3, #22304d));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
:host([data-q-control-group]) :is(.btn, .toggle-wrapper, .quantity-selector) {
|
|
276
|
+
width: 100%;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
|
|
@@ -191,7 +191,7 @@ export class QToggle {
|
|
|
191
191
|
const hasLabel = this.label !== undefined && this.label !== '';
|
|
192
192
|
const showLabel = hasLabel || this.hasDefaultSlot;
|
|
193
193
|
const hasError = !!this.error;
|
|
194
|
-
return (h("div", { key: '
|
|
194
|
+
return (h("div", { key: '499ad05de934991e437c25dca47b2ab3f8528e83', class: "toggle-container", style: feedbackStyle(this.reserveFeedback) }, h("div", { key: 'dc6d9613fdb146314da88e7d089f280182e2b0f1', ref: el => (this.controlEl = el), class: {
|
|
195
195
|
'toggle-wrapper': true,
|
|
196
196
|
'is-checked': this.checked,
|
|
197
197
|
'is-disabled': this.isDisabled,
|
|
@@ -199,11 +199,11 @@ export class QToggle {
|
|
|
199
199
|
'has-error': hasError,
|
|
200
200
|
[`type-${this.type}`]: true,
|
|
201
201
|
[`size-${this.size}`]: true,
|
|
202
|
-
}, role: this.type === 'switch' ? 'switch' : 'checkbox', "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.isDisabled ? 'true' : 'false', "aria-required": this.required ? 'true' : 'false', "aria-invalid": hasError ? 'true' : 'false', "aria-describedby": hasError || this.description ? 'toggle-error-msg' : undefined, tabindex: this.isDisabled ? -1 : 0, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: '
|
|
202
|
+
}, role: this.type === 'switch' ? 'switch' : 'checkbox', "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.isDisabled ? 'true' : 'false', "aria-required": this.required ? 'true' : 'false', "aria-invalid": hasError ? 'true' : 'false', "aria-describedby": hasError || this.description ? 'toggle-error-msg' : undefined, tabindex: this.isDisabled ? -1 : 0, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: 'aec7c564a38545398b53d7b11edac6d615068efe', class: "toggle-control", part: "control" }, this.type === 'switch' ? (h("div", { class: "switch-track", part: "track" }, h("div", { class: "switch-thumb", part: "thumb" }))) : (h("div", { class: "checkbox-box", part: "box" }, h("span", { class: { 'icon-wrap': true, 'is-hidden': !this.checked }, part: "icon-checked" }, h("slot", { name: "checked-icon", onSlotchange: this.handleSlotChange }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round", "stroke-linejoin": "round", class: "default-check-icon", "aria-hidden": "true" }, h("polyline", { points: "20 6 9 17 4 12" })))), h("span", { class: { 'icon-wrap': true, 'is-hidden': this.checked }, part: "icon-unchecked" }, h("slot", { name: "unchecked-icon", onSlotchange: this.handleSlotChange }))))), h("span", { key: 'fbdd90cb7acd529717d07fd739299af8506ac678', class: {
|
|
203
203
|
'toggle-label-text': true,
|
|
204
204
|
'q-label-hidden': this.labelHidden,
|
|
205
205
|
'is-hidden': !showLabel
|
|
206
|
-
}, part: "label" }, h("slot", { key: '
|
|
206
|
+
}, part: "label" }, h("slot", { key: '3d0d6200605b69297c0d6bea7bb6e00747d0e8b6', onSlotchange: this.handleSlotChange }, this.label))), fieldFeedback('toggle-error-msg', this.error, this.description)));
|
|
207
207
|
}
|
|
208
208
|
static get is() { return "q-toggle"; }
|
|
209
209
|
static get encapsulation() { return "shadow"; }
|