@quieto/ui 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +142 -2
- package/custom-elements.json +6121 -0
- package/dist/components/qds-accordion/qds-accordion.d.ts +39 -0
- package/dist/components/qds-accordion/qds-accordion.d.ts.map +1 -0
- package/dist/components/qds-accordion/qds-accordion.js +130 -0
- package/dist/components/qds-accordion/qds-accordion.js.map +1 -0
- package/dist/components/qds-accordion-item/qds-accordion-item.d.ts +68 -0
- package/dist/components/qds-accordion-item/qds-accordion-item.d.ts.map +1 -0
- package/dist/components/qds-accordion-item/qds-accordion-item.js +250 -0
- package/dist/components/qds-accordion-item/qds-accordion-item.js.map +1 -0
- package/dist/components/qds-button/qds-button.d.ts +92 -0
- package/dist/components/qds-button/qds-button.d.ts.map +1 -0
- package/dist/components/qds-button/qds-button.js +418 -0
- package/dist/components/qds-button/qds-button.js.map +1 -0
- package/dist/components/qds-card/qds-card.d.ts +48 -0
- package/dist/components/qds-card/qds-card.d.ts.map +1 -0
- package/dist/components/qds-card/qds-card.js +152 -0
- package/dist/components/qds-card/qds-card.js.map +1 -0
- package/dist/components/qds-checkbox/qds-checkbox.d.ts +85 -0
- package/dist/components/qds-checkbox/qds-checkbox.d.ts.map +1 -0
- package/dist/components/qds-checkbox/qds-checkbox.js +316 -0
- package/dist/components/qds-checkbox/qds-checkbox.js.map +1 -0
- package/dist/components/qds-chip/qds-chip.d.ts +79 -0
- package/dist/components/qds-chip/qds-chip.d.ts.map +1 -0
- package/dist/components/qds-chip/qds-chip.js +314 -0
- package/dist/components/qds-chip/qds-chip.js.map +1 -0
- package/dist/components/qds-input/qds-input.d.ts +64 -0
- package/dist/components/qds-input/qds-input.d.ts.map +1 -0
- package/dist/components/qds-input/qds-input.js +224 -0
- package/dist/components/qds-input/qds-input.js.map +1 -0
- package/dist/components/qds-modal/qds-modal.d.ts +76 -0
- package/dist/components/qds-modal/qds-modal.d.ts.map +1 -0
- package/dist/components/qds-modal/qds-modal.js +362 -0
- package/dist/components/qds-modal/qds-modal.js.map +1 -0
- package/dist/components/qds-progress-bar/qds-progress-bar.d.ts +47 -0
- package/dist/components/qds-progress-bar/qds-progress-bar.d.ts.map +1 -0
- package/dist/components/qds-progress-bar/qds-progress-bar.js +180 -0
- package/dist/components/qds-progress-bar/qds-progress-bar.js.map +1 -0
- package/dist/components/qds-radio/qds-radio.d.ts +62 -0
- package/dist/components/qds-radio/qds-radio.d.ts.map +1 -0
- package/dist/components/qds-radio/qds-radio.js +213 -0
- package/dist/components/qds-radio/qds-radio.js.map +1 -0
- package/dist/components/qds-radio-group/qds-radio-group.d.ts +72 -0
- package/dist/components/qds-radio-group/qds-radio-group.d.ts.map +1 -0
- package/dist/components/qds-radio-group/qds-radio-group.js +317 -0
- package/dist/components/qds-radio-group/qds-radio-group.js.map +1 -0
- package/dist/components/qds-stack/qds-stack.d.ts +46 -0
- package/dist/components/qds-stack/qds-stack.d.ts.map +1 -0
- package/dist/components/qds-stack/qds-stack.js +149 -0
- package/dist/components/qds-stack/qds-stack.js.map +1 -0
- package/dist/components/qds-tab/qds-tab.d.ts +55 -0
- package/dist/components/qds-tab/qds-tab.d.ts.map +1 -0
- package/dist/components/qds-tab/qds-tab.js +162 -0
- package/dist/components/qds-tab/qds-tab.js.map +1 -0
- package/dist/components/qds-tab-panel/qds-tab-panel.d.ts +32 -0
- package/dist/components/qds-tab-panel/qds-tab-panel.d.ts.map +1 -0
- package/dist/components/qds-tab-panel/qds-tab-panel.js +72 -0
- package/dist/components/qds-tab-panel/qds-tab-panel.js.map +1 -0
- package/dist/components/qds-tabs/qds-tabs.d.ts +54 -0
- package/dist/components/qds-tabs/qds-tabs.d.ts.map +1 -0
- package/dist/components/qds-tabs/qds-tabs.js +196 -0
- package/dist/components/qds-tabs/qds-tabs.js.map +1 -0
- package/dist/components/qds-text-field/qds-text-field.d.ts +94 -0
- package/dist/components/qds-text-field/qds-text-field.d.ts.map +1 -0
- package/dist/components/qds-text-field/qds-text-field.js +332 -0
- package/dist/components/qds-text-field/qds-text-field.js.map +1 -0
- package/dist/components/qds-toggle/qds-toggle.d.ts +68 -0
- package/dist/components/qds-toggle/qds-toggle.d.ts.map +1 -0
- package/dist/components/qds-toggle/qds-toggle.js +260 -0
- package/dist/components/qds-toggle/qds-toggle.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/qds-element.d.ts +31 -0
- package/dist/internal/qds-element.d.ts.map +1 -0
- package/dist/internal/qds-element.js +68 -0
- package/dist/internal/qds-element.js.map +1 -0
- package/dist/internal/qds-text-control.d.ts +79 -0
- package/dist/internal/qds-text-control.d.ts.map +1 -0
- package/dist/internal/qds-text-control.js +159 -0
- package/dist/internal/qds-text-control.js.map +1 -0
- package/package.json +125 -3
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html, nothing } from 'lit';
|
|
8
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
9
|
+
import { QdsElement } from '../../internal/qds-element.js';
|
|
10
|
+
import { QdsRadio } from '../qds-radio/qds-radio.js';
|
|
11
|
+
/**
|
|
12
|
+
* A set of `qds-radio` options, of which at most one is chosen.
|
|
13
|
+
*
|
|
14
|
+
* The group owns everything that makes radios a group: the value, form
|
|
15
|
+
* submission, required validation, and keyboard navigation. Tab moves into the
|
|
16
|
+
* group and lands on the chosen option (or the first, if none is chosen); arrow
|
|
17
|
+
* keys then move between options and choose as they go, following the ARIA
|
|
18
|
+
* radio group pattern.
|
|
19
|
+
*
|
|
20
|
+
* @element qds-radio-group
|
|
21
|
+
*
|
|
22
|
+
* @slot - The `qds-radio` options.
|
|
23
|
+
* @slot label - The group label, in place of the `label` attribute when it needs markup.
|
|
24
|
+
*
|
|
25
|
+
* @fires {CustomEvent<{ value: string }>} qds-change - Fired when the user
|
|
26
|
+
* chooses an option. Not fired for programmatic changes.
|
|
27
|
+
*
|
|
28
|
+
* @csspart base - The element carrying the radiogroup role.
|
|
29
|
+
* @csspart label - The group label.
|
|
30
|
+
* @csspart options - The wrapper around the options.
|
|
31
|
+
*
|
|
32
|
+
* @cssprop [--qds-component-radio-group-gap] - Space between options.
|
|
33
|
+
* @cssprop [--qds-component-radio-group-font-size] - Group label size.
|
|
34
|
+
* @cssprop [--qds-component-radio-group-font-weight] - Group label weight.
|
|
35
|
+
* @cssprop [--qds-component-radio-group-color-content-rest] - Group label color.
|
|
36
|
+
*/
|
|
37
|
+
let QdsRadioGroup = class QdsRadioGroup extends QdsElement {
|
|
38
|
+
static { this.formAssociated = true; }
|
|
39
|
+
static { this.styles = [
|
|
40
|
+
QdsElement.baseStyles,
|
|
41
|
+
css `
|
|
42
|
+
:host {
|
|
43
|
+
display: block;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.label {
|
|
47
|
+
margin-block-end: var(--qds-component-radio-group-gap, 0.5rem);
|
|
48
|
+
font-family: var(--qds-typography-font-family-sans, inherit);
|
|
49
|
+
font-size: var(--qds-component-radio-group-font-size, 0.875rem);
|
|
50
|
+
font-weight: var(--qds-component-radio-group-font-weight, 600);
|
|
51
|
+
color: var(--qds-component-radio-group-color-content-rest, #0f172a);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.options {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
align-items: flex-start;
|
|
58
|
+
gap: var(--qds-component-radio-group-gap, 0.5rem);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([orientation='inline']) .options {
|
|
62
|
+
flex-direction: row;
|
|
63
|
+
flex-wrap: wrap;
|
|
64
|
+
column-gap: calc(var(--qds-component-radio-group-gap, 0.5rem) * 2);
|
|
65
|
+
}
|
|
66
|
+
`,
|
|
67
|
+
]; }
|
|
68
|
+
#internals;
|
|
69
|
+
/** The value restored on form reset, captured from the markup on first sync. */
|
|
70
|
+
#defaultValue;
|
|
71
|
+
constructor() {
|
|
72
|
+
super();
|
|
73
|
+
/** The chosen option's value, or an empty string when none is chosen. */
|
|
74
|
+
this.value = '';
|
|
75
|
+
/** Field name used when the form is submitted. */
|
|
76
|
+
this.name = '';
|
|
77
|
+
/** Visible group label. Also the group's accessible name. */
|
|
78
|
+
this.label = '';
|
|
79
|
+
/** Makes the form invalid until an option is chosen. */
|
|
80
|
+
this.required = false;
|
|
81
|
+
/** Disables every option. */
|
|
82
|
+
this.disabled = false;
|
|
83
|
+
/** Lays the options out in a column (`block`) or a row (`inline`). */
|
|
84
|
+
this.orientation = 'block';
|
|
85
|
+
/** Disabled by its own attribute or by an ancestor `<fieldset disabled>`. */
|
|
86
|
+
this.formDisabled = false;
|
|
87
|
+
this.hasLabelSlot = false;
|
|
88
|
+
/** The value restored on form reset, captured from the markup on first sync. */
|
|
89
|
+
this.#defaultValue = null;
|
|
90
|
+
this.#handleSelect = (event) => {
|
|
91
|
+
if (this.disabled || this.formDisabled)
|
|
92
|
+
return;
|
|
93
|
+
const radio = event.target;
|
|
94
|
+
// A nested group's radio bubbles its event up through this one too.
|
|
95
|
+
if (!this.#radios.includes(radio))
|
|
96
|
+
return;
|
|
97
|
+
this.#choose(radio);
|
|
98
|
+
radio.focus();
|
|
99
|
+
};
|
|
100
|
+
this.#handleKeydown = (event) => {
|
|
101
|
+
if (this.disabled || this.formDisabled)
|
|
102
|
+
return;
|
|
103
|
+
// Alt+Left is the browser's Back; leave every modified key to the browser.
|
|
104
|
+
if (event.altKey || event.ctrlKey || event.metaKey)
|
|
105
|
+
return;
|
|
106
|
+
const radios = this.#enabledRadios;
|
|
107
|
+
const current = radios.indexOf(event.target);
|
|
108
|
+
if (current === -1)
|
|
109
|
+
return;
|
|
110
|
+
// Left and Right follow the visual order, which reverses under RTL.
|
|
111
|
+
const rtl = getComputedStyle(this).direction === 'rtl';
|
|
112
|
+
const forward = (current + 1) % radios.length;
|
|
113
|
+
const backward = (current - 1 + radios.length) % radios.length;
|
|
114
|
+
let next;
|
|
115
|
+
switch (event.key) {
|
|
116
|
+
case 'ArrowDown':
|
|
117
|
+
next = forward;
|
|
118
|
+
break;
|
|
119
|
+
case 'ArrowUp':
|
|
120
|
+
next = backward;
|
|
121
|
+
break;
|
|
122
|
+
case 'ArrowRight':
|
|
123
|
+
next = rtl ? backward : forward;
|
|
124
|
+
break;
|
|
125
|
+
case 'ArrowLeft':
|
|
126
|
+
next = rtl ? forward : backward;
|
|
127
|
+
break;
|
|
128
|
+
case ' ':
|
|
129
|
+
next = current;
|
|
130
|
+
break;
|
|
131
|
+
default:
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
// Arrow keys and Space would otherwise scroll the page.
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
const radio = radios[next];
|
|
137
|
+
this.#choose(radio);
|
|
138
|
+
radio.focus();
|
|
139
|
+
};
|
|
140
|
+
this.#internals = this.attachInternals();
|
|
141
|
+
this.addEventListener('qds-radio-select', this.#handleSelect);
|
|
142
|
+
this.addEventListener('keydown', this.#handleKeydown);
|
|
143
|
+
}
|
|
144
|
+
/** The form this group belongs to, if any. */
|
|
145
|
+
get form() {
|
|
146
|
+
return this.#internals.form;
|
|
147
|
+
}
|
|
148
|
+
/** Same as the native `checkValidity()`. */
|
|
149
|
+
checkValidity() {
|
|
150
|
+
return this.#internals.checkValidity();
|
|
151
|
+
}
|
|
152
|
+
/** Same as the native `reportValidity()`. */
|
|
153
|
+
reportValidity() {
|
|
154
|
+
return this.#internals.reportValidity();
|
|
155
|
+
}
|
|
156
|
+
/** Same as the native `validity`. */
|
|
157
|
+
get validity() {
|
|
158
|
+
return this.#internals.validity;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* This group's radios: every qds-radio inside it, however deeply wrapped for
|
|
162
|
+
* layout, except those that belong to a group nested inside this one.
|
|
163
|
+
*/
|
|
164
|
+
get #radios() {
|
|
165
|
+
return [...this.querySelectorAll('qds-radio')].filter((radio) => radio.closest('qds-radio-group') === this);
|
|
166
|
+
}
|
|
167
|
+
get #enabledRadios() {
|
|
168
|
+
return this.#radios.filter((radio) => !radio.disabled);
|
|
169
|
+
}
|
|
170
|
+
willUpdate(changed) {
|
|
171
|
+
if (changed.has('value')) {
|
|
172
|
+
this.#internals.setFormValue(this.value || null);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
firstUpdated() {
|
|
176
|
+
// Not left to slotchange alone. When the docs site server-renders this into
|
|
177
|
+
// declarative shadow DOM, the radios are already assigned to the slot before
|
|
178
|
+
// the element hydrates, so slotchange never fires and nothing would sync.
|
|
179
|
+
//
|
|
180
|
+
// After updateComplete, because the first client update of a server-rendered
|
|
181
|
+
// element adopts the existing DOM rather than writing to it: a label-slot
|
|
182
|
+
// change made during it would silently not be applied.
|
|
183
|
+
void this.updateComplete.then(() => {
|
|
184
|
+
this.hasLabelSlot = this.querySelector(':scope > [slot="label"]') !== null;
|
|
185
|
+
this.#captureDefault();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
updated() {
|
|
189
|
+
// Syncing before the default is captured would uncheck every radio while the
|
|
190
|
+
// value is still empty, erasing a `checked` attribute in the markup before
|
|
191
|
+
// #captureDefault gets the chance to read it.
|
|
192
|
+
if (this.#defaultValue !== null)
|
|
193
|
+
this.#syncRadios();
|
|
194
|
+
}
|
|
195
|
+
/** Called by the form on reset. */
|
|
196
|
+
formResetCallback() {
|
|
197
|
+
this.value = this.#defaultValue ?? '';
|
|
198
|
+
}
|
|
199
|
+
/** Called when this element's disabled state changes, from its own attribute or a fieldset. */
|
|
200
|
+
formDisabledCallback(disabled) {
|
|
201
|
+
this.formDisabled = disabled;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Adopt a radio's `checked` attribute as the initial value, so markup can mark
|
|
205
|
+
* the default on the option itself. The group's own value wins. Runs once, as
|
|
206
|
+
* soon as there are radios to read: when the parser upgrades the group before
|
|
207
|
+
* reaching its children, the first slotchange is what finds them.
|
|
208
|
+
*/
|
|
209
|
+
#captureDefault() {
|
|
210
|
+
const radios = this.#radios;
|
|
211
|
+
if (this.#defaultValue !== null || radios.length === 0)
|
|
212
|
+
return;
|
|
213
|
+
if (!this.value) {
|
|
214
|
+
this.value = radios.find((radio) => radio.hasAttribute('checked'))?.value ?? '';
|
|
215
|
+
}
|
|
216
|
+
this.#defaultValue = this.value;
|
|
217
|
+
this.#syncRadios();
|
|
218
|
+
}
|
|
219
|
+
#handleSlotChange() {
|
|
220
|
+
this.#captureDefault();
|
|
221
|
+
if (this.#defaultValue !== null)
|
|
222
|
+
this.#syncRadios();
|
|
223
|
+
}
|
|
224
|
+
#syncRadios() {
|
|
225
|
+
const groupDisabled = this.disabled || this.formDisabled;
|
|
226
|
+
const radios = this.#radios;
|
|
227
|
+
for (const radio of radios) {
|
|
228
|
+
radio.checked = this.value !== '' && radio.value === this.value;
|
|
229
|
+
radio.groupDisabled = groupDisabled;
|
|
230
|
+
}
|
|
231
|
+
// Roving tabindex: exactly one option is in the tab order — the chosen one,
|
|
232
|
+
// or the first enabled one when nothing is chosen yet.
|
|
233
|
+
const tabbable = groupDisabled
|
|
234
|
+
? undefined
|
|
235
|
+
: (radios.find((radio) => radio.checked && !radio.disabled) ?? this.#enabledRadios[0]);
|
|
236
|
+
for (const radio of radios) {
|
|
237
|
+
radio.tabIndex = radio === tabbable ? 0 : -1;
|
|
238
|
+
}
|
|
239
|
+
const anchor = radios[0];
|
|
240
|
+
if (this.required && !this.value) {
|
|
241
|
+
this.#internals.setValidity({ valueMissing: true }, 'Select one of these options.', anchor);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
this.#internals.setValidity({});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
#choose(radio) {
|
|
248
|
+
if (radio.value === this.value)
|
|
249
|
+
return;
|
|
250
|
+
this.value = radio.value;
|
|
251
|
+
// Synchronously, not left to willUpdate and updated: a qds-change listener
|
|
252
|
+
// reading FormData or validity would otherwise see the previous state.
|
|
253
|
+
this.#internals.setFormValue(this.value);
|
|
254
|
+
this.#syncRadios();
|
|
255
|
+
this.dispatchEvent(new CustomEvent('qds-change', {
|
|
256
|
+
detail: { value: this.value },
|
|
257
|
+
bubbles: true,
|
|
258
|
+
composed: true,
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
#handleSelect;
|
|
262
|
+
#handleKeydown;
|
|
263
|
+
render() {
|
|
264
|
+
const labelled = this.label || this.hasLabelSlot;
|
|
265
|
+
return html `
|
|
266
|
+
<div
|
|
267
|
+
part="base"
|
|
268
|
+
role="radiogroup"
|
|
269
|
+
aria-labelledby=${labelled ? 'label' : nothing}
|
|
270
|
+
aria-required=${this.required ? 'true' : nothing}
|
|
271
|
+
aria-disabled=${this.disabled || this.formDisabled ? 'true' : nothing}
|
|
272
|
+
>
|
|
273
|
+
<div id="label" class="label" part="label" ?hidden=${!labelled}>
|
|
274
|
+
<slot
|
|
275
|
+
name="label"
|
|
276
|
+
@slotchange=${(event) => {
|
|
277
|
+
this.hasLabelSlot = event.target.assignedNodes().length > 0;
|
|
278
|
+
}}
|
|
279
|
+
>${this.label}</slot
|
|
280
|
+
>
|
|
281
|
+
</div>
|
|
282
|
+
<div class="options" part="options">
|
|
283
|
+
<slot @slotchange=${this.#handleSlotChange}></slot>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
`;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
__decorate([
|
|
290
|
+
property()
|
|
291
|
+
], QdsRadioGroup.prototype, "value", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
property()
|
|
294
|
+
], QdsRadioGroup.prototype, "name", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property()
|
|
297
|
+
], QdsRadioGroup.prototype, "label", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property({ type: Boolean, reflect: true })
|
|
300
|
+
], QdsRadioGroup.prototype, "required", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property({ type: Boolean, reflect: true })
|
|
303
|
+
], QdsRadioGroup.prototype, "disabled", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property({ reflect: true })
|
|
306
|
+
], QdsRadioGroup.prototype, "orientation", void 0);
|
|
307
|
+
__decorate([
|
|
308
|
+
state()
|
|
309
|
+
], QdsRadioGroup.prototype, "formDisabled", void 0);
|
|
310
|
+
__decorate([
|
|
311
|
+
state()
|
|
312
|
+
], QdsRadioGroup.prototype, "hasLabelSlot", void 0);
|
|
313
|
+
QdsRadioGroup = __decorate([
|
|
314
|
+
customElement('qds-radio-group')
|
|
315
|
+
], QdsRadioGroup);
|
|
316
|
+
export { QdsRadioGroup };
|
|
317
|
+
//# sourceMappingURL=qds-radio-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qds-radio-group.js","sourceRoot":"","sources":["../../../src/components/qds-radio-group/qds-radio-group.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAIrD;;;;;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AI,EAAE,CAAC;+CAC1B;AAIjB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAC1B;AAIjB;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACoB;AAIxC;IADP,KAAK,EAAE;mDACqB;AAGrB;IADP,KAAK,EAAE;mDACqB;AA9DlB,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA8RzB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { QdsElement } from '../../internal/qds-element.js';
|
|
3
|
+
export type QdsStackDirection = 'block' | 'inline';
|
|
4
|
+
export type QdsStackGap = '0' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
5
|
+
export type QdsStackAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
6
|
+
export type QdsStackJustify = 'start' | 'center' | 'end' | 'between' | 'around';
|
|
7
|
+
/**
|
|
8
|
+
* Layout primitive that spaces its children using the spacing scale.
|
|
9
|
+
*
|
|
10
|
+
* Deliberately the least visual component in the library: its whole job is to
|
|
11
|
+
* prove that the non-color tiers flow through the pipeline. A colour token
|
|
12
|
+
* failing is obvious on sight, whereas a broken spacing token just looks like
|
|
13
|
+
* slightly-off design, so `gap` is constrained to scale steps and nothing else —
|
|
14
|
+
* an arbitrary value cannot be passed in.
|
|
15
|
+
*
|
|
16
|
+
* @element qds-stack
|
|
17
|
+
*
|
|
18
|
+
* @slot - The items to lay out.
|
|
19
|
+
*
|
|
20
|
+
* @cssprop [--qds-spacing-{step}] - The spacing scale this reads `gap` from.
|
|
21
|
+
*/
|
|
22
|
+
export declare class QdsStack extends QdsElement {
|
|
23
|
+
static styles: import("lit").CSSResult[];
|
|
24
|
+
/**
|
|
25
|
+
* Stacking axis. Named `block`/`inline` rather than `vertical`/`horizontal`
|
|
26
|
+
* because the layout follows writing mode — `inline` runs right-to-left in an
|
|
27
|
+
* RTL context, which is the behavior you want and the wrong thing to call
|
|
28
|
+
* "horizontal".
|
|
29
|
+
*/
|
|
30
|
+
direction: QdsStackDirection;
|
|
31
|
+
/** Spacing scale step. */
|
|
32
|
+
gap: QdsStackGap;
|
|
33
|
+
/** Cross-axis alignment. */
|
|
34
|
+
align?: QdsStackAlign;
|
|
35
|
+
/** Main-axis distribution. */
|
|
36
|
+
justify?: QdsStackJustify;
|
|
37
|
+
/** Allows items to wrap onto multiple lines. */
|
|
38
|
+
wrap: boolean;
|
|
39
|
+
render(): TemplateResult;
|
|
40
|
+
}
|
|
41
|
+
declare global {
|
|
42
|
+
interface HTMLElementTagNameMap {
|
|
43
|
+
'qds-stack': QdsStack;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=qds-stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qds-stack.d.ts","sourceRoot":"","sources":["../../../src/components/qds-stack/qds-stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AACtG,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;AAChF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEhF;;;;;;;;;;;;;;GAcG;AACH,qBACa,QAAS,SAAQ,UAAU;IACtC,OAAgB,MAAM,4BAqFpB;IAEF;;;;;OAKG;IAEH,SAAS,EAAE,iBAAiB,CAAW;IAEvC,0BAA0B;IAE1B,GAAG,EAAE,WAAW,CAAS;IAEzB,4BAA4B;IAE5B,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB,8BAA8B;IAE9B,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B,gDAAgD;IAEhD,IAAI,UAAS;IAEJ,MAAM,IAAI,cAAc;CAGlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { css, html } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import { QdsElement } from '../../internal/qds-element.js';
|
|
10
|
+
/**
|
|
11
|
+
* Layout primitive that spaces its children using the spacing scale.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately the least visual component in the library: its whole job is to
|
|
14
|
+
* prove that the non-color tiers flow through the pipeline. A colour token
|
|
15
|
+
* failing is obvious on sight, whereas a broken spacing token just looks like
|
|
16
|
+
* slightly-off design, so `gap` is constrained to scale steps and nothing else —
|
|
17
|
+
* an arbitrary value cannot be passed in.
|
|
18
|
+
*
|
|
19
|
+
* @element qds-stack
|
|
20
|
+
*
|
|
21
|
+
* @slot - The items to lay out.
|
|
22
|
+
*
|
|
23
|
+
* @cssprop [--qds-spacing-{step}] - The spacing scale this reads `gap` from.
|
|
24
|
+
*/
|
|
25
|
+
let QdsStack = class QdsStack extends QdsElement {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
/**
|
|
29
|
+
* Stacking axis. Named `block`/`inline` rather than `vertical`/`horizontal`
|
|
30
|
+
* because the layout follows writing mode — `inline` runs right-to-left in an
|
|
31
|
+
* RTL context, which is the behavior you want and the wrong thing to call
|
|
32
|
+
* "horizontal".
|
|
33
|
+
*/
|
|
34
|
+
this.direction = 'block';
|
|
35
|
+
/** Spacing scale step. */
|
|
36
|
+
this.gap = '400';
|
|
37
|
+
/** Allows items to wrap onto multiple lines. */
|
|
38
|
+
this.wrap = false;
|
|
39
|
+
}
|
|
40
|
+
static { this.styles = [
|
|
41
|
+
QdsElement.baseStyles,
|
|
42
|
+
css `
|
|
43
|
+
:host {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: var(--_gap, var(--qds-spacing-400, 1rem));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host([direction='inline']) {
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([wrap]) {
|
|
54
|
+
flex-wrap: wrap;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* One rule per scale step, because CSS cannot build a variable name from an
|
|
59
|
+
* attribute value. Constraining gap to the scale is the point: it makes
|
|
60
|
+
* gap="17px" impossible rather than merely discouraged.
|
|
61
|
+
*/
|
|
62
|
+
:host([gap='0']) {
|
|
63
|
+
--_gap: var(--qds-spacing-0, 0rem);
|
|
64
|
+
}
|
|
65
|
+
:host([gap='100']) {
|
|
66
|
+
--_gap: var(--qds-spacing-100, 0.25rem);
|
|
67
|
+
}
|
|
68
|
+
:host([gap='200']) {
|
|
69
|
+
--_gap: var(--qds-spacing-200, 0.5rem);
|
|
70
|
+
}
|
|
71
|
+
:host([gap='300']) {
|
|
72
|
+
--_gap: var(--qds-spacing-300, 0.75rem);
|
|
73
|
+
}
|
|
74
|
+
:host([gap='400']) {
|
|
75
|
+
--_gap: var(--qds-spacing-400, 1rem);
|
|
76
|
+
}
|
|
77
|
+
:host([gap='500']) {
|
|
78
|
+
--_gap: var(--qds-spacing-500, 1.5rem);
|
|
79
|
+
}
|
|
80
|
+
:host([gap='600']) {
|
|
81
|
+
--_gap: var(--qds-spacing-600, 2rem);
|
|
82
|
+
}
|
|
83
|
+
:host([gap='700']) {
|
|
84
|
+
--_gap: var(--qds-spacing-700, 3rem);
|
|
85
|
+
}
|
|
86
|
+
:host([gap='800']) {
|
|
87
|
+
--_gap: var(--qds-spacing-800, 4rem);
|
|
88
|
+
}
|
|
89
|
+
:host([gap='900']) {
|
|
90
|
+
--_gap: var(--qds-spacing-900, 6rem);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:host([align='start']) {
|
|
94
|
+
align-items: flex-start;
|
|
95
|
+
}
|
|
96
|
+
:host([align='center']) {
|
|
97
|
+
align-items: center;
|
|
98
|
+
}
|
|
99
|
+
:host([align='end']) {
|
|
100
|
+
align-items: flex-end;
|
|
101
|
+
}
|
|
102
|
+
:host([align='stretch']) {
|
|
103
|
+
align-items: stretch;
|
|
104
|
+
}
|
|
105
|
+
:host([align='baseline']) {
|
|
106
|
+
align-items: baseline;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host([justify='start']) {
|
|
110
|
+
justify-content: flex-start;
|
|
111
|
+
}
|
|
112
|
+
:host([justify='center']) {
|
|
113
|
+
justify-content: center;
|
|
114
|
+
}
|
|
115
|
+
:host([justify='end']) {
|
|
116
|
+
justify-content: flex-end;
|
|
117
|
+
}
|
|
118
|
+
:host([justify='between']) {
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
}
|
|
121
|
+
:host([justify='around']) {
|
|
122
|
+
justify-content: space-around;
|
|
123
|
+
}
|
|
124
|
+
`,
|
|
125
|
+
]; }
|
|
126
|
+
render() {
|
|
127
|
+
return html `<slot></slot>`;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
__decorate([
|
|
131
|
+
property({ reflect: true })
|
|
132
|
+
], QdsStack.prototype, "direction", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
property({ reflect: true })
|
|
135
|
+
], QdsStack.prototype, "gap", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ reflect: true })
|
|
138
|
+
], QdsStack.prototype, "align", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ reflect: true })
|
|
141
|
+
], QdsStack.prototype, "justify", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: Boolean, reflect: true })
|
|
144
|
+
], QdsStack.prototype, "wrap", void 0);
|
|
145
|
+
QdsStack = __decorate([
|
|
146
|
+
customElement('qds-stack')
|
|
147
|
+
], QdsStack);
|
|
148
|
+
export { QdsStack };
|
|
149
|
+
//# sourceMappingURL=qds-stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qds-stack.js","sourceRoot":"","sources":["../../../src/components/qds-stack/qds-stack.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAO3D;;;;;;;;;;;;;;GAcG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAwFL;;;;;WAKG;QAEH,cAAS,GAAsB,OAAO,CAAC;QAEvC,0BAA0B;QAE1B,QAAG,GAAgB,KAAK,CAAC;QAUzB,gDAAgD;QAEhD,SAAI,GAAG,KAAK,CAAC;IAKf,CAAC;aAnHiB,WAAM,GAAG;QACvB,UAAU,CAAC,UAAU;QACrB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkFF;KACF,AArFqB,CAqFpB;IA2BO,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AApBD;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CACW;AAIvC;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCACH;AAIzB;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCACN;AAItB;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCACF;AAI1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAC9B;AA/GF,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAoHpB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { QdsElement } from '../../internal/qds-element.js';
|
|
3
|
+
/**
|
|
4
|
+
* One tab in a `qds-tabs` tab list.
|
|
5
|
+
*
|
|
6
|
+
* The host takes the `tab` role itself rather than wrapping a button, because
|
|
7
|
+
* `aria-controls` must point at its panel by ID, and an ID reference only
|
|
8
|
+
* resolves within one tree: the tab host and the `qds-tab-panel` host are both
|
|
9
|
+
* in the light DOM, so the reference works. `qds-tabs` manages the IDs, the
|
|
10
|
+
* selection, and the tab order.
|
|
11
|
+
*
|
|
12
|
+
* The role and states are host attributes, not ElementInternals ARIA. Browsers
|
|
13
|
+
* read either, but auditing tools such as axe only read attributes, and would
|
|
14
|
+
* report a tab list with no tabs in it.
|
|
15
|
+
*
|
|
16
|
+
* Put it in the `tab` slot: `<qds-tab slot="tab">`. If the slot is left off the
|
|
17
|
+
* tab assigns it when it upgrades, but setting it in the markup keeps the tab
|
|
18
|
+
* in the tab list before then, too.
|
|
19
|
+
*
|
|
20
|
+
* @element qds-tab
|
|
21
|
+
*
|
|
22
|
+
* @slot - The tab label.
|
|
23
|
+
*
|
|
24
|
+
* @cssprop [--qds-component-tabs-tab-padding-block] - Vertical padding.
|
|
25
|
+
* @cssprop [--qds-component-tabs-tab-padding-inline] - Horizontal padding.
|
|
26
|
+
* @cssprop [--qds-component-tabs-tab-font-size] - Label size.
|
|
27
|
+
* @cssprop [--qds-component-tabs-tab-font-weight] - Label weight.
|
|
28
|
+
* @cssprop [--qds-component-tabs-tab-line-height] - Label line height.
|
|
29
|
+
* @cssprop [--qds-component-tabs-tab-color-content-{state}] - Label color: `rest`, `hover`, `selected`, `disabled`.
|
|
30
|
+
* @cssprop [--qds-component-tabs-tab-color-background-hover] - Fill under the pointer.
|
|
31
|
+
* @cssprop [--qds-component-tabs-indicator-border-width] - Thickness of the selected tab's underline.
|
|
32
|
+
* @cssprop [--qds-component-tabs-indicator-color-border-selected] - Color of the selected tab's underline.
|
|
33
|
+
* @cssprop [--qds-component-tabs-duration] - Color transition duration.
|
|
34
|
+
*/
|
|
35
|
+
export declare class QdsTab extends QdsElement {
|
|
36
|
+
#private;
|
|
37
|
+
static styles: import("lit").CSSResult[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether this tab is the selected one. `qds-tabs` manages this; as an
|
|
40
|
+
* attribute in markup it marks the tab selected initially.
|
|
41
|
+
*/
|
|
42
|
+
selected: boolean;
|
|
43
|
+
/** Prevents selecting this tab. Arrow keys skip it. */
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
constructor();
|
|
46
|
+
connectedCallback(): void;
|
|
47
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
48
|
+
render(): TemplateResult;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
'qds-tab': QdsTab;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=qds-tab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qds-tab.d.ts","sourceRoot":"","sources":["../../../src/components/qds-tab/qds-tab.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG1E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBACa,MAAO,SAAQ,UAAU;;IACpC,OAAgB,MAAM,4BAqEpB;IAEF;;;OAGG;IAEH,QAAQ,UAAS;IAEjB,uDAAuD;IAEvD,QAAQ,UAAS;;IAOR,iBAAiB,IAAI,IAAI;cAOf,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAetD,MAAM,IAAI,cAAc;CAGlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|