@firstprateek/vastu 0.0.0-stage → 1.0.0
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 +15 -0
- package/README.md +51 -2
- package/custom-elements.json +3046 -0
- package/dist/dev/all.d.ts +9 -0
- package/dist/dev/all.d.ts.map +1 -0
- package/dist/dev/all.js +10 -0
- package/dist/dev/all.js.map +1 -0
- package/dist/dev/button/button.d.ts +98 -0
- package/dist/dev/button/button.d.ts.map +1 -0
- package/dist/dev/button/button.js +292 -0
- package/dist/dev/button/button.js.map +1 -0
- package/dist/dev/button/index.d.ts +4 -0
- package/dist/dev/button/index.d.ts.map +1 -0
- package/dist/dev/button/index.js +5 -0
- package/dist/dev/button/index.js.map +1 -0
- package/dist/dev/checkbox/checkbox.d.ts +71 -0
- package/dist/dev/checkbox/checkbox.d.ts.map +1 -0
- package/dist/dev/checkbox/checkbox.js +232 -0
- package/dist/dev/checkbox/checkbox.js.map +1 -0
- package/dist/dev/checkbox/index.d.ts +3 -0
- package/dist/dev/checkbox/index.d.ts.map +1 -0
- package/dist/dev/checkbox/index.js +5 -0
- package/dist/dev/checkbox/index.js.map +1 -0
- package/dist/dev/core/define.d.ts +3 -0
- package/dist/dev/core/define.d.ts.map +1 -0
- package/dist/dev/core/define.js +6 -0
- package/dist/dev/core/define.js.map +1 -0
- package/dist/dev/core/dev-mode.d.ts +6 -0
- package/dist/dev/core/dev-mode.d.ts.map +1 -0
- package/dist/dev/core/dev-mode.js +6 -0
- package/dist/dev/core/dev-mode.js.map +1 -0
- package/dist/dev/core/focus-ring.d.ts +3 -0
- package/dist/dev/core/focus-ring.d.ts.map +1 -0
- package/dist/dev/core/focus-ring.js +14 -0
- package/dist/dev/core/focus-ring.js.map +1 -0
- package/dist/dev/core/form-control.d.ts +47 -0
- package/dist/dev/core/form-control.d.ts.map +1 -0
- package/dist/dev/core/form-control.js +75 -0
- package/dist/dev/core/form-control.js.map +1 -0
- package/dist/dev/core/warn.d.ts +12 -0
- package/dist/dev/core/warn.d.ts.map +1 -0
- package/dist/dev/core/warn.js +35 -0
- package/dist/dev/core/warn.js.map +1 -0
- package/dist/dev/dialog/dialog.d.ts +77 -0
- package/dist/dev/dialog/dialog.d.ts.map +1 -0
- package/dist/dev/dialog/dialog.js +253 -0
- package/dist/dev/dialog/dialog.js.map +1 -0
- package/dist/dev/dialog/index.d.ts +4 -0
- package/dist/dev/dialog/index.d.ts.map +1 -0
- package/dist/dev/dialog/index.js +5 -0
- package/dist/dev/dialog/index.js.map +1 -0
- package/dist/dev/menu/index.d.ts +3 -0
- package/dist/dev/menu/index.d.ts.map +1 -0
- package/dist/dev/menu/index.js +5 -0
- package/dist/dev/menu/index.js.map +1 -0
- package/dist/dev/menu/menu.d.ts +71 -0
- package/dist/dev/menu/menu.d.ts.map +1 -0
- package/dist/dev/menu/menu.js +330 -0
- package/dist/dev/menu/menu.js.map +1 -0
- package/dist/dev/switch/index.d.ts +3 -0
- package/dist/dev/switch/index.d.ts.map +1 -0
- package/dist/dev/switch/index.js +5 -0
- package/dist/dev/switch/index.js.map +1 -0
- package/dist/dev/switch/switch.d.ts +69 -0
- package/dist/dev/switch/switch.d.ts.map +1 -0
- package/dist/dev/switch/switch.js +213 -0
- package/dist/dev/switch/switch.js.map +1 -0
- package/dist/dev/tabs/index.d.ts +3 -0
- package/dist/dev/tabs/index.d.ts.map +1 -0
- package/dist/dev/tabs/index.js +5 -0
- package/dist/dev/tabs/index.js.map +1 -0
- package/dist/dev/tabs/tabs.d.ts +64 -0
- package/dist/dev/tabs/tabs.d.ts.map +1 -0
- package/dist/dev/tabs/tabs.js +212 -0
- package/dist/dev/tabs/tabs.js.map +1 -0
- package/dist/dev/text-field/index.d.ts +3 -0
- package/dist/dev/text-field/index.d.ts.map +1 -0
- package/dist/dev/text-field/index.js +5 -0
- package/dist/dev/text-field/index.js.map +1 -0
- package/dist/dev/text-field/text-field.d.ts +91 -0
- package/dist/dev/text-field/text-field.d.ts.map +1 -0
- package/dist/dev/text-field/text-field.js +267 -0
- package/dist/dev/text-field/text-field.js.map +1 -0
- package/dist/dev/toast/index.d.ts +4 -0
- package/dist/dev/toast/index.d.ts.map +1 -0
- package/dist/dev/toast/index.js +5 -0
- package/dist/dev/toast/index.js.map +1 -0
- package/dist/dev/toast/toast.d.ts +71 -0
- package/dist/dev/toast/toast.d.ts.map +1 -0
- package/dist/dev/toast/toast.js +258 -0
- package/dist/dev/toast/toast.js.map +1 -0
- package/dist/prod/all.js +10 -0
- package/dist/prod/button/button.js +292 -0
- package/dist/prod/button/index.js +5 -0
- package/dist/prod/checkbox/checkbox.js +232 -0
- package/dist/prod/checkbox/index.js +5 -0
- package/dist/prod/core/define.js +6 -0
- package/dist/prod/core/dev-mode.js +1 -0
- package/dist/prod/core/focus-ring.js +14 -0
- package/dist/prod/core/form-control.js +75 -0
- package/dist/prod/core/warn.js +2 -0
- package/dist/prod/dialog/dialog.js +253 -0
- package/dist/prod/dialog/index.js +5 -0
- package/dist/prod/menu/index.js +5 -0
- package/dist/prod/menu/menu.js +330 -0
- package/dist/prod/switch/index.js +5 -0
- package/dist/prod/switch/switch.js +213 -0
- package/dist/prod/tabs/index.js +5 -0
- package/dist/prod/tabs/tabs.js +212 -0
- package/dist/prod/text-field/index.js +5 -0
- package/dist/prod/text-field/text-field.js +267 -0
- package/dist/prod/toast/index.js +5 -0
- package/dist/prod/toast/toast.js +258 -0
- package/package.json +95 -3
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { LitElement, css, html, nothing } from 'lit';
|
|
2
|
+
import { focusRing } from '../core/focus-ring.js';
|
|
3
|
+
import { checkTokensLoaded, devWarn } from '../core/warn.js';
|
|
4
|
+
/**
|
|
5
|
+
* A modal dialog built on the native `<dialog>`: it sits in the top layer, makes the page behind it
|
|
6
|
+
* inert, keeps focus inside, closes with Escape and returns focus to where it came from.
|
|
7
|
+
*
|
|
8
|
+
* @tag va-dialog
|
|
9
|
+
* @summary Asks the user to confirm, decide or enter something before going back to the page.
|
|
10
|
+
*
|
|
11
|
+
* @slot - The dialog's content.
|
|
12
|
+
* @slot footer - Actions, such as Cancel and Confirm buttons. Put the primary action last.
|
|
13
|
+
*
|
|
14
|
+
* @csspart dialog - The native dialog element.
|
|
15
|
+
* @csspart header - The row with the heading and the close button.
|
|
16
|
+
* @csspart heading - The heading.
|
|
17
|
+
* @csspart close-button - The close button.
|
|
18
|
+
* @csspart body - The wrapper around the content.
|
|
19
|
+
* @csspart footer - The wrapper around the actions.
|
|
20
|
+
*
|
|
21
|
+
* @cssprop {<color>} --va-dialog-bg - Background colour.
|
|
22
|
+
* @cssprop {<length>} --va-dialog-width - Maximum width.
|
|
23
|
+
* @cssprop {<length>} --va-dialog-radius - Corner radius.
|
|
24
|
+
*
|
|
25
|
+
* @cssprop-applies --va-dialog-bg dialog:open background-color
|
|
26
|
+
* @cssprop-applies --va-dialog-width dialog:open max-width
|
|
27
|
+
* @cssprop-applies --va-dialog-radius dialog:open border-top-left-radius
|
|
28
|
+
*
|
|
29
|
+
* @keyboard open: Escape | closes | Closes the dialog and returns focus to the element that opened it.
|
|
30
|
+
*
|
|
31
|
+
* @a11y-role dialog
|
|
32
|
+
* @a11y-name-from heading, accessible-label
|
|
33
|
+
* @replaces dialog
|
|
34
|
+
* @a11y-name The `heading`, or `accessible-label` when there is no visible heading.
|
|
35
|
+
* @a11y-note The page behind is inert while the dialog is open, so focus and screen readers stay inside it.
|
|
36
|
+
* @a11y-note On open, focus goes to the first element with `autofocus`, else the first focusable control in the content, else the close button.
|
|
37
|
+
*
|
|
38
|
+
* @guidance-use For a decision the user must make before going on, such as confirming a deletion, or a short focused task.
|
|
39
|
+
* @guidance-avoid For information that doesn't need a response, or for long, multi-step flows.
|
|
40
|
+
* @guidance-instead `va-toast` for confirmations that need no response; a full page for long flows.
|
|
41
|
+
*
|
|
42
|
+
* @command --show | Opens the dialog.
|
|
43
|
+
* @command --close | Closes the dialog (fires `va-close` first).
|
|
44
|
+
* @fires va-open - After the dialog has opened.
|
|
45
|
+
* @fires {CustomEvent<{ reason: 'escape' | 'close-button' | 'command' | 'method' }>} va-close - Before the dialog closes, when the user or close() asks it to. Cancel it with `preventDefault()` to keep the dialog open.
|
|
46
|
+
* @fires {CustomEvent<{ reason: 'escape' | 'close-button' | 'command' | 'method' | 'property' }>} va-closed - After the dialog has closed, however it closed (`property` when `open` was set to false). Focus is back on the element that opened it.
|
|
47
|
+
* @event-trigger va-open | call show
|
|
48
|
+
* @event-trigger va-close | press Escape | open
|
|
49
|
+
* @event-trigger va-closed | press Escape | open
|
|
50
|
+
*/
|
|
51
|
+
export class VaDialog extends LitElement {
|
|
52
|
+
static { this.properties = {
|
|
53
|
+
open: { type: Boolean, reflect: true },
|
|
54
|
+
heading: {},
|
|
55
|
+
accessibleLabel: { attribute: 'accessible-label' },
|
|
56
|
+
hideCloseButton: { type: Boolean, reflect: true, attribute: 'hide-close-button' },
|
|
57
|
+
}; }
|
|
58
|
+
#returnFocus = null;
|
|
59
|
+
#shown = false;
|
|
60
|
+
#closeReason = null;
|
|
61
|
+
constructor() {
|
|
62
|
+
super();
|
|
63
|
+
this.open = false;
|
|
64
|
+
this.heading = '';
|
|
65
|
+
this.accessibleLabel = '';
|
|
66
|
+
this.hideCloseButton = false;
|
|
67
|
+
this.addEventListener('command', this.#onCommand);
|
|
68
|
+
}
|
|
69
|
+
connectedCallback() {
|
|
70
|
+
super.connectedCallback();
|
|
71
|
+
checkTokensLoaded(this);
|
|
72
|
+
}
|
|
73
|
+
get #dialog() {
|
|
74
|
+
return this.shadowRoot?.querySelector('dialog') ?? null;
|
|
75
|
+
}
|
|
76
|
+
/** Opens the dialog as a modal. */
|
|
77
|
+
show() {
|
|
78
|
+
this.open = true;
|
|
79
|
+
}
|
|
80
|
+
/** Closes the dialog, unless a `va-close` listener cancels it. */
|
|
81
|
+
close() {
|
|
82
|
+
this.#requestClose('method');
|
|
83
|
+
}
|
|
84
|
+
#requestClose(reason) {
|
|
85
|
+
if (!this.open)
|
|
86
|
+
return;
|
|
87
|
+
const event = new CustomEvent('va-close', { detail: { reason }, bubbles: true, composed: true, cancelable: true });
|
|
88
|
+
if (!this.dispatchEvent(event))
|
|
89
|
+
return;
|
|
90
|
+
this.#closeReason = reason;
|
|
91
|
+
this.open = false;
|
|
92
|
+
}
|
|
93
|
+
#onCommand = (event) => {
|
|
94
|
+
if (event.command === '--show' || event.command === 'show-modal') {
|
|
95
|
+
// Safari doesn't focus a button on click, so remember the button that sent the command.
|
|
96
|
+
if (event.source instanceof HTMLElement)
|
|
97
|
+
this.#returnFocus = event.source;
|
|
98
|
+
this.show();
|
|
99
|
+
}
|
|
100
|
+
else if (event.command === '--close' || event.command === 'close')
|
|
101
|
+
this.#requestClose('command');
|
|
102
|
+
};
|
|
103
|
+
async updated(changed) {
|
|
104
|
+
if (!changed.has('open'))
|
|
105
|
+
return;
|
|
106
|
+
const dialog = this.#dialog;
|
|
107
|
+
if (!dialog)
|
|
108
|
+
return;
|
|
109
|
+
if (this.open && !dialog.open) {
|
|
110
|
+
if (!this.#returnFocus) {
|
|
111
|
+
let active = document.activeElement;
|
|
112
|
+
while (active?.shadowRoot?.activeElement)
|
|
113
|
+
active = active.shadowRoot.activeElement;
|
|
114
|
+
this.#returnFocus = active;
|
|
115
|
+
}
|
|
116
|
+
if (!this.heading && !this.accessibleLabel) {
|
|
117
|
+
devWarn('va-dialog', 'This dialog has no accessible name.', 'Add heading="…" (shown) or accessible-label="…" (not shown) that says what the dialog is for.');
|
|
118
|
+
}
|
|
119
|
+
dialog.showModal();
|
|
120
|
+
this.#shown = true;
|
|
121
|
+
this.#focusInitial();
|
|
122
|
+
this.dispatchEvent(new Event('va-open', { bubbles: true, composed: true }));
|
|
123
|
+
}
|
|
124
|
+
else if (!this.open && this.#shown) {
|
|
125
|
+
if (dialog.open)
|
|
126
|
+
dialog.close();
|
|
127
|
+
this.#shown = false;
|
|
128
|
+
this.#returnFocus?.focus();
|
|
129
|
+
this.#returnFocus = null;
|
|
130
|
+
const reason = this.#closeReason ?? 'property';
|
|
131
|
+
this.#closeReason = null;
|
|
132
|
+
this.dispatchEvent(new CustomEvent('va-closed', { detail: { reason }, bubbles: true, composed: true }));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
#focusInitial() {
|
|
136
|
+
const focusable = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), va-button, va-text-field, va-checkbox, va-switch';
|
|
137
|
+
const auto = this.querySelector('[autofocus]');
|
|
138
|
+
const first = [...this.querySelectorAll(focusable)].find((el) => el.slot !== 'footer' && !el.hasAttribute('disabled'));
|
|
139
|
+
const target = auto ?? first ?? this.shadowRoot?.querySelector('.close') ?? this.#dialog;
|
|
140
|
+
target?.focus();
|
|
141
|
+
}
|
|
142
|
+
#onCancel(event) {
|
|
143
|
+
// Escape: route through va-close so listeners can keep the dialog open.
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
this.#requestClose('escape');
|
|
146
|
+
}
|
|
147
|
+
#onNativeClose() {
|
|
148
|
+
// The browser closed the dialog itself (a repeated Escape, for example): keep `open` in step.
|
|
149
|
+
if (this.open) {
|
|
150
|
+
this.#closeReason = 'escape';
|
|
151
|
+
this.open = false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
render() {
|
|
155
|
+
return html `
|
|
156
|
+
<dialog
|
|
157
|
+
part="dialog"
|
|
158
|
+
aria-labelledby=${this.heading ? 'heading' : nothing}
|
|
159
|
+
aria-label=${!this.heading && this.accessibleLabel ? this.accessibleLabel : nothing}
|
|
160
|
+
@cancel=${this.#onCancel}
|
|
161
|
+
@close=${this.#onNativeClose}
|
|
162
|
+
>
|
|
163
|
+
<div part="header" class="header">
|
|
164
|
+
${this.heading ? html `<h2 part="heading" id="heading" class="heading">${this.heading}</h2>` : html `<span part="heading" class="heading"></span>`}
|
|
165
|
+
${!this.hideCloseButton
|
|
166
|
+
? html `<button part="close-button" class="close" type="button" aria-label="Close" @click=${() => this.#requestClose('close-button')}>
|
|
167
|
+
<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 6l12 12M18 6L6 18" /></svg>
|
|
168
|
+
</button>`
|
|
169
|
+
: nothing}
|
|
170
|
+
</div>
|
|
171
|
+
<div part="body" class="body"><slot></slot></div>
|
|
172
|
+
<div part="footer" class="footer"><slot name="footer"></slot></div>
|
|
173
|
+
</dialog>
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
static { this.styles = [
|
|
177
|
+
focusRing,
|
|
178
|
+
css `
|
|
179
|
+
:host {
|
|
180
|
+
display: contents;
|
|
181
|
+
}
|
|
182
|
+
dialog {
|
|
183
|
+
box-sizing: border-box;
|
|
184
|
+
width: calc(100% - 2rem);
|
|
185
|
+
max-width: var(--va-dialog-width, 32rem);
|
|
186
|
+
max-height: calc(100% - 2rem);
|
|
187
|
+
padding: 0;
|
|
188
|
+
border: 1px solid var(--va-color-border-subtle);
|
|
189
|
+
border-radius: var(--va-dialog-radius, var(--va-radius-surface));
|
|
190
|
+
background-color: var(--va-dialog-bg, var(--va-color-surface-default));
|
|
191
|
+
color: var(--va-color-text-default);
|
|
192
|
+
font-family: var(--va-font-family-ui);
|
|
193
|
+
box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);
|
|
194
|
+
}
|
|
195
|
+
dialog::backdrop {
|
|
196
|
+
background: rgb(0 0 0 / 0.45);
|
|
197
|
+
}
|
|
198
|
+
.header {
|
|
199
|
+
display: flex;
|
|
200
|
+
align-items: flex-start;
|
|
201
|
+
justify-content: space-between;
|
|
202
|
+
gap: var(--va-space-inline-md);
|
|
203
|
+
padding: var(--va-space-inline-lg) var(--va-space-inline-lg) 0;
|
|
204
|
+
}
|
|
205
|
+
.heading {
|
|
206
|
+
margin: 0;
|
|
207
|
+
font-family: var(--va-font-family-reading);
|
|
208
|
+
font-size: 1.25rem;
|
|
209
|
+
font-weight: var(--va-font-weight-bold);
|
|
210
|
+
line-height: 1.3;
|
|
211
|
+
}
|
|
212
|
+
.close {
|
|
213
|
+
flex: none;
|
|
214
|
+
display: grid;
|
|
215
|
+
place-items: center;
|
|
216
|
+
width: 2rem;
|
|
217
|
+
height: 2rem;
|
|
218
|
+
margin: -0.25rem -0.5rem 0 0;
|
|
219
|
+
padding: 0;
|
|
220
|
+
border: none;
|
|
221
|
+
border-radius: var(--va-radius-control);
|
|
222
|
+
background: transparent;
|
|
223
|
+
color: var(--va-color-text-muted);
|
|
224
|
+
cursor: pointer;
|
|
225
|
+
}
|
|
226
|
+
.close:hover {
|
|
227
|
+
background: var(--va-color-surface-subtle);
|
|
228
|
+
color: var(--va-color-text-default);
|
|
229
|
+
}
|
|
230
|
+
.close svg {
|
|
231
|
+
width: 1.25rem;
|
|
232
|
+
height: 1.25rem;
|
|
233
|
+
}
|
|
234
|
+
.body {
|
|
235
|
+
padding: var(--va-space-inline-md) var(--va-space-inline-lg);
|
|
236
|
+
line-height: 1.5;
|
|
237
|
+
}
|
|
238
|
+
.footer {
|
|
239
|
+
display: flex;
|
|
240
|
+
flex-wrap: wrap;
|
|
241
|
+
justify-content: flex-end;
|
|
242
|
+
gap: var(--va-space-gap-md);
|
|
243
|
+
padding: 0 var(--va-space-inline-lg) var(--va-space-inline-lg);
|
|
244
|
+
}
|
|
245
|
+
@media (forced-colors: active) {
|
|
246
|
+
dialog {
|
|
247
|
+
border: 2px solid CanvasText;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
`,
|
|
251
|
+
]; }
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../src/dialog/dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkD,MAAM,KAAK,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAA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OAAO;;;;;KAKhB,CAAC;IACJ,CAAC;aAEe,WAAM,GAAG;QACvB,SAAS;QACT,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwEF;KACF,CAAC","sourcesContent":["import { LitElement, css, html, nothing, type PropertyDeclarations, type PropertyValues } from 'lit';\nimport { focusRing } from '../core/focus-ring.js';\nimport { checkTokensLoaded, devWarn } from '../core/warn.js';\n\n/** Why a dialog is closing, in the `va-close` event's `detail.reason`. */\nexport type DialogCloseReason = 'escape' | 'close-button' | 'command' | 'method' | 'property';\n\n/**\n * A modal dialog built on the native `<dialog>`: it sits in the top layer, makes the page behind it\n * inert, keeps focus inside, closes with Escape and returns focus to where it came from.\n *\n * @tag va-dialog\n * @summary Asks the user to confirm, decide or enter something before going back to the page.\n *\n * @slot - The dialog's content.\n * @slot footer - Actions, such as Cancel and Confirm buttons. Put the primary action last.\n *\n * @csspart dialog - The native dialog element.\n * @csspart header - The row with the heading and the close button.\n * @csspart heading - The heading.\n * @csspart close-button - The close button.\n * @csspart body - The wrapper around the content.\n * @csspart footer - The wrapper around the actions.\n *\n * @cssprop {<color>} --va-dialog-bg - Background colour.\n * @cssprop {<length>} --va-dialog-width - Maximum width.\n * @cssprop {<length>} --va-dialog-radius - Corner radius.\n *\n * @cssprop-applies --va-dialog-bg dialog:open background-color\n * @cssprop-applies --va-dialog-width dialog:open max-width\n * @cssprop-applies --va-dialog-radius dialog:open border-top-left-radius\n *\n * @keyboard open: Escape | closes | Closes the dialog and returns focus to the element that opened it.\n *\n * @a11y-role dialog\n * @a11y-name-from heading, accessible-label\n * @replaces dialog\n * @a11y-name The `heading`, or `accessible-label` when there is no visible heading.\n * @a11y-note The page behind is inert while the dialog is open, so focus and screen readers stay inside it.\n * @a11y-note On open, focus goes to the first element with `autofocus`, else the first focusable control in the content, else the close button.\n *\n * @guidance-use For a decision the user must make before going on, such as confirming a deletion, or a short focused task.\n * @guidance-avoid For information that doesn't need a response, or for long, multi-step flows.\n * @guidance-instead `va-toast` for confirmations that need no response; a full page for long flows.\n *\n * @command --show | Opens the dialog.\n * @command --close | Closes the dialog (fires `va-close` first).\n * @fires va-open - After the dialog has opened.\n * @fires {CustomEvent<{ reason: 'escape' | 'close-button' | 'command' | 'method' }>} va-close - Before the dialog closes, when the user or close() asks it to. Cancel it with `preventDefault()` to keep the dialog open.\n * @fires {CustomEvent<{ reason: 'escape' | 'close-button' | 'command' | 'method' | 'property' }>} va-closed - After the dialog has closed, however it closed (`property` when `open` was set to false). Focus is back on the element that opened it.\n * @event-trigger va-open | call show\n * @event-trigger va-close | press Escape | open\n * @event-trigger va-closed | press Escape | open\n */\nexport class VaDialog extends LitElement {\n static override properties: PropertyDeclarations = {\n open: { type: Boolean, reflect: true },\n heading: {},\n accessibleLabel: { attribute: 'accessible-label' },\n hideCloseButton: { type: Boolean, reflect: true, attribute: 'hide-close-button' },\n };\n\n /** Whether the dialog is open. Prefer `show()` and `close()`, or `command=\"--show\"` on a `va-button`. */\n declare open: boolean;\n /** The visible heading. It is also the dialog's accessible name. */\n declare heading: string;\n /** Accessible name, when there is no visible heading. Not shown. */\n declare accessibleLabel: string;\n /** Hides the close button in the header, for a dialog that needs an explicit choice. Escape still closes it. */\n declare hideCloseButton: boolean;\n\n #returnFocus: HTMLElement | null = null;\n #shown = false;\n #closeReason: DialogCloseReason | null = null;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.accessibleLabel = '';\n this.hideCloseButton = false;\n this.addEventListener('command', this.#onCommand as EventListener);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n checkTokensLoaded(this);\n }\n\n get #dialog(): HTMLDialogElement | null {\n return this.shadowRoot?.querySelector('dialog') ?? null;\n }\n\n /** Opens the dialog as a modal. */\n show(): void {\n this.open = true;\n }\n\n /** Closes the dialog, unless a `va-close` listener cancels it. */\n close(): void {\n this.#requestClose('method');\n }\n\n #requestClose(reason: DialogCloseReason): void {\n if (!this.open) return;\n const event = new CustomEvent('va-close', { detail: { reason }, bubbles: true, composed: true, cancelable: true });\n if (!this.dispatchEvent(event)) return;\n this.#closeReason = reason;\n this.open = false;\n }\n\n #onCommand = (event: Event & { command?: string; source?: Element | null }): void => {\n if (event.command === '--show' || event.command === 'show-modal') {\n // Safari doesn't focus a button on click, so remember the button that sent the command.\n if (event.source instanceof HTMLElement) this.#returnFocus = event.source;\n this.show();\n }\n else if (event.command === '--close' || event.command === 'close') this.#requestClose('command');\n };\n\n override async updated(changed: PropertyValues): Promise<void> {\n if (!changed.has('open')) return;\n const dialog = this.#dialog;\n if (!dialog) return;\n if (this.open && !dialog.open) {\n if (!this.#returnFocus) {\n let active = document.activeElement as HTMLElement | null;\n while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement as HTMLElement;\n this.#returnFocus = active;\n }\n if (!this.heading && !this.accessibleLabel) {\n devWarn('va-dialog', 'This dialog has no accessible name.', 'Add heading=\"…\" (shown) or accessible-label=\"…\" (not shown) that says what the dialog is for.');\n }\n dialog.showModal();\n this.#shown = true;\n this.#focusInitial();\n this.dispatchEvent(new Event('va-open', { bubbles: true, composed: true }));\n } else if (!this.open && this.#shown) {\n if (dialog.open) dialog.close();\n this.#shown = false;\n this.#returnFocus?.focus();\n this.#returnFocus = null;\n const reason = this.#closeReason ?? 'property';\n this.#closeReason = null;\n this.dispatchEvent(new CustomEvent('va-closed', { detail: { reason }, bubbles: true, composed: true }));\n }\n }\n\n #focusInitial(): void {\n const focusable = 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"]), va-button, va-text-field, va-checkbox, va-switch';\n const auto = this.querySelector<HTMLElement>('[autofocus]');\n const first = [...this.querySelectorAll<HTMLElement>(focusable)].find((el) => el.slot !== 'footer' && !el.hasAttribute('disabled'));\n const target = auto ?? first ?? this.shadowRoot?.querySelector<HTMLElement>('.close') ?? this.#dialog;\n target?.focus();\n }\n\n #onCancel(event: Event): void {\n // Escape: route through va-close so listeners can keep the dialog open.\n event.preventDefault();\n this.#requestClose('escape');\n }\n\n #onNativeClose(): void {\n // The browser closed the dialog itself (a repeated Escape, for example): keep `open` in step.\n if (this.open) {\n this.#closeReason = 'escape';\n this.open = false;\n }\n }\n\n override render() {\n return html`\n <dialog\n part=\"dialog\"\n aria-labelledby=${this.heading ? 'heading' : nothing}\n aria-label=${!this.heading && this.accessibleLabel ? this.accessibleLabel : nothing}\n @cancel=${this.#onCancel}\n @close=${this.#onNativeClose}\n >\n <div part=\"header\" class=\"header\">\n ${this.heading ? html`<h2 part=\"heading\" id=\"heading\" class=\"heading\">${this.heading}</h2>` : html`<span part=\"heading\" class=\"heading\"></span>`}\n ${!this.hideCloseButton\n ? html`<button part=\"close-button\" class=\"close\" type=\"button\" aria-label=\"Close\" @click=${() => this.#requestClose('close-button')}>\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M6 6l12 12M18 6L6 18\" /></svg>\n </button>`\n : nothing}\n </div>\n <div part=\"body\" class=\"body\"><slot></slot></div>\n <div part=\"footer\" class=\"footer\"><slot name=\"footer\"></slot></div>\n </dialog>\n `;\n }\n\n static override styles = [\n focusRing,\n css`\n :host {\n display: contents;\n }\n dialog {\n box-sizing: border-box;\n width: calc(100% - 2rem);\n max-width: var(--va-dialog-width, 32rem);\n max-height: calc(100% - 2rem);\n padding: 0;\n border: 1px solid var(--va-color-border-subtle);\n border-radius: var(--va-dialog-radius, var(--va-radius-surface));\n background-color: var(--va-dialog-bg, var(--va-color-surface-default));\n color: var(--va-color-text-default);\n font-family: var(--va-font-family-ui);\n box-shadow: 0 12px 40px rgb(0 0 0 / 0.25);\n }\n dialog::backdrop {\n background: rgb(0 0 0 / 0.45);\n }\n .header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: var(--va-space-inline-md);\n padding: var(--va-space-inline-lg) var(--va-space-inline-lg) 0;\n }\n .heading {\n margin: 0;\n font-family: var(--va-font-family-reading);\n font-size: 1.25rem;\n font-weight: var(--va-font-weight-bold);\n line-height: 1.3;\n }\n .close {\n flex: none;\n display: grid;\n place-items: center;\n width: 2rem;\n height: 2rem;\n margin: -0.25rem -0.5rem 0 0;\n padding: 0;\n border: none;\n border-radius: var(--va-radius-control);\n background: transparent;\n color: var(--va-color-text-muted);\n cursor: pointer;\n }\n .close:hover {\n background: var(--va-color-surface-subtle);\n color: var(--va-color-text-default);\n }\n .close svg {\n width: 1.25rem;\n height: 1.25rem;\n }\n .body {\n padding: var(--va-space-inline-md) var(--va-space-inline-lg);\n line-height: 1.5;\n }\n .footer {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: var(--va-space-gap-md);\n padding: 0 var(--va-space-inline-lg) var(--va-space-inline-lg);\n }\n @media (forced-colors: active) {\n dialog {\n border: 2px solid CanvasText;\n }\n }\n `,\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'va-dialog': VaDialog;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,CAAC;AAGpB,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { define } from '../core/define.js';\nimport { VaDialog } from './dialog.js';\n\nexport { VaDialog };\nexport type { DialogCloseReason } from './dialog.js';\n\ndefine('va-dialog', VaDialog);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/menu/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC","sourcesContent":["import { define } from '../core/define.js';\nimport { VaMenu } from './menu.js';\n\nexport { VaMenu };\n\ndefine('va-menu', VaMenu);\n"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { LitElement, type PropertyDeclarations, type PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* A button that opens a menu of actions, following the WAI-ARIA menu button pattern.
|
|
4
|
+
*
|
|
5
|
+
* @tag va-menu
|
|
6
|
+
* @summary Opens a short list of actions from a button, such as Edit, Duplicate and Delete.
|
|
7
|
+
*
|
|
8
|
+
* @slot - The menu items, as `<button value="…">` elements.
|
|
9
|
+
*
|
|
10
|
+
* @csspart trigger - The button that opens the menu.
|
|
11
|
+
* @csspart menu - The popup list.
|
|
12
|
+
*
|
|
13
|
+
* @cssprop {<color>} --va-menu-bg - Background colour of the menu.
|
|
14
|
+
* @cssprop {<length>} --va-menu-radius - Corner radius of the menu.
|
|
15
|
+
* @cssprop {<color>} --va-menu-item-bg-hover - Background colour of the focused or hovered item.
|
|
16
|
+
*
|
|
17
|
+
* @cssprop-applies --va-menu-bg menu:open background-color
|
|
18
|
+
* @cssprop-applies --va-menu-radius menu:open border-top-left-radius
|
|
19
|
+
* @cssprop-applies --va-menu-item-bg-hover light([role="menuitem"]):focus background-color
|
|
20
|
+
*
|
|
21
|
+
* @keyboard-items [role="menuitem"]
|
|
22
|
+
* @keyboard Enter | opens | Opens the menu and focuses the first item.
|
|
23
|
+
* @keyboard Space | opens | Opens the menu and focuses the first item.
|
|
24
|
+
* @keyboard ArrowDown | opens | Opens the menu and focuses the first item.
|
|
25
|
+
* @keyboard open: ArrowDown | next | Moves to the next item, wrapping round.
|
|
26
|
+
* @keyboard open: ArrowUp | previous | Moves to the previous item, wrapping round.
|
|
27
|
+
* @keyboard open: Home | first | Moves to the first item.
|
|
28
|
+
* @keyboard open: End | last | Moves to the last item.
|
|
29
|
+
* @keyboard open: Enter | selects | Chooses the focused item and closes the menu.
|
|
30
|
+
* @keyboard open: Escape | closes | Closes the menu and returns focus to the button.
|
|
31
|
+
*
|
|
32
|
+
* @a11y-role menu
|
|
33
|
+
* @a11y-name-from label
|
|
34
|
+
* @replaces [role="menu"]
|
|
35
|
+
* @a11y-name The `label`, which is also the button's text.
|
|
36
|
+
* @a11y-note The button has `aria-haspopup="menu"` and `aria-expanded`. Items get `role="menuitem"`.
|
|
37
|
+
* @a11y-note Typing a letter moves to the next item that starts with it.
|
|
38
|
+
*
|
|
39
|
+
* @guidance-use For a few actions on one thing, when there isn't room to show them as buttons.
|
|
40
|
+
* @guidance-avoid For navigation, for choosing a value in a form, or for one or two actions.
|
|
41
|
+
* @guidance-instead Links for navigation; a select or radio group for form values; plain buttons for one or two actions.
|
|
42
|
+
*
|
|
43
|
+
* @fires {CustomEvent<{ value: string, item: HTMLElement }>} va-select - When the user chooses an item. `event.detail.value` is the item's `value`, or its text when it has none; `event.detail.item` is the item.
|
|
44
|
+
* @event-trigger va-select | press Enter | open
|
|
45
|
+
*/
|
|
46
|
+
export declare class VaMenu extends LitElement {
|
|
47
|
+
#private;
|
|
48
|
+
static shadowRootOptions: ShadowRootInit;
|
|
49
|
+
static properties: PropertyDeclarations;
|
|
50
|
+
/** Whether the menu is open. */
|
|
51
|
+
open: boolean;
|
|
52
|
+
/** The button's text, and the menu's accessible name. */
|
|
53
|
+
label: string;
|
|
54
|
+
/** The button's look, as for `va-button`. */
|
|
55
|
+
variant: 'secondary' | 'ghost';
|
|
56
|
+
/** Which edge of the button the menu lines up with. */
|
|
57
|
+
placement: 'bottom-start' | 'bottom-end';
|
|
58
|
+
constructor();
|
|
59
|
+
connectedCallback(): void;
|
|
60
|
+
disconnectedCallback(): void;
|
|
61
|
+
firstUpdated(): void;
|
|
62
|
+
updated(changed: PropertyValues): void;
|
|
63
|
+
render(): import("lit").TemplateResult<1>;
|
|
64
|
+
static styles: import("lit").CSSResult[];
|
|
65
|
+
}
|
|
66
|
+
declare global {
|
|
67
|
+
interface HTMLElementTagNameMap {
|
|
68
|
+
'va-menu': VaMenu;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/menu/menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,qBAAa,MAAO,SAAQ,UAAU;;IACpC,OAAgB,iBAAiB,EAAE,cAAc,CAA6D;IAE9G,OAAgB,UAAU,EAAE,oBAAoB,CAK9C;IAEF,gCAAgC;IACxB,IAAI,EAAE,OAAO,CAAC;IACtB,yDAAyD;IACjD,KAAK,EAAE,MAAM,CAAC;IACtB,6CAA6C;IACrC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC;IACvC,uDAAuD;IAC/C,SAAS,EAAE,cAAc,GAAG,YAAY,CAAC;;IAYxC,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAiB5B,YAAY,IAAI,IAAI;IAIpB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAqHtC,MAAM;IA+Bf,OAAgB,MAAM,4BAmGpB;CACH;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
|