@vonage/vivid 3.0.0-next.92 → 3.0.0-next.94
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/accordion/index.js +1 -1
- package/accordion-item/index.js +2 -1
- package/action-group/index.js +1 -1
- package/avatar/index.js +2 -1
- package/badge/index.js +2 -1
- package/banner/index.js +2 -1
- package/breadcrumb-item/index.js +2 -1
- package/button/index.js +1 -0
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +2 -1
- package/checkbox/index.js +2 -1
- package/dialog/index.js +2 -1
- package/fab/index.js +2 -1
- package/focus/index.js +1 -1
- package/header/index.js +1 -1
- package/icon/index.js +1 -0
- package/index.js +9 -3
- package/lib/components.d.ts +2 -0
- package/lib/listbox/index.d.ts +4 -0
- package/lib/listbox/listbox.d.ts +9 -0
- package/lib/listbox/listbox.template.d.ts +4 -0
- package/lib/slider/index.d.ts +3 -0
- package/lib/slider/slider.d.ts +4 -0
- package/lib/slider/slider.template.d.ts +4 -0
- package/listbox/index.js +1090 -0
- package/listbox-option/index.js +13 -239
- package/menu/index.js +5 -10
- package/menu-item/index.js +2 -1
- package/nav-disclosure/index.js +2 -1
- package/nav-item/index.js +2 -1
- package/note/index.js +2 -1
- package/number-field/index.js +6 -61
- package/package.json +5 -3
- package/popup/index.js +2 -1
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.js +2 -2
- package/shared/dom.js +8 -0
- package/shared/es.object.assign.js +1 -1
- package/shared/es.regexp.to-string.js +59 -0
- package/shared/export.js +1 -1
- package/shared/form-elements.js +1 -1
- package/shared/icon.js +10 -45
- package/shared/index2.js +1 -1
- package/shared/index4.js +1 -1
- package/shared/index5.js +220 -1492
- package/shared/index6.js +1490 -314
- package/shared/index7.js +349 -0
- package/shared/key-codes.js +2 -1
- package/shared/numbers.js +25 -0
- package/shared/object-keys.js +1 -1
- package/shared/patterns/form-elements/form-elements.d.ts +1 -1
- package/shared/string-trim.js +40 -0
- package/shared/web.dom-collections.iterator.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +596 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/text-anchor/index.js +1 -0
- package/text-area/index.js +2 -1
- package/text-field/index.js +2 -1
- package/tooltip/index.js +3 -2
package/shared/index7.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import '../icon/index.js';
|
|
2
|
+
import { F as FoundationElement, D as DOM, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, d as designSystem } from './index.js';
|
|
3
|
+
import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
4
|
+
import { S as StartEnd } from './start-end.js';
|
|
5
|
+
import { D as Direction, g as getDirection } from './direction.js';
|
|
6
|
+
import { a as applyMixins } from './apply-mixins.js';
|
|
7
|
+
import { h as keyArrowLeft, i as keyArrowRight, a as keySpace, k as keyEnter } from './key-codes.js';
|
|
8
|
+
import { f as focusTemplateFactory } from './focus2.js';
|
|
9
|
+
import { w as when } from './when.js';
|
|
10
|
+
import { c as classNames } from './class-names.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Menu items roles.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
const MenuItemRole = {
|
|
17
|
+
/**
|
|
18
|
+
* The menu item has a "menuitem" role
|
|
19
|
+
*/
|
|
20
|
+
menuitem: "menuitem",
|
|
21
|
+
/**
|
|
22
|
+
* The menu item has a "menuitemcheckbox" role
|
|
23
|
+
*/
|
|
24
|
+
menuitemcheckbox: "menuitemcheckbox",
|
|
25
|
+
/**
|
|
26
|
+
* The menu item has a "menuitemradio" role
|
|
27
|
+
*/
|
|
28
|
+
menuitemradio: "menuitemradio",
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
const roleForMenuItem = {
|
|
34
|
+
[MenuItemRole.menuitem]: "menuitem",
|
|
35
|
+
[MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
|
|
36
|
+
[MenuItemRole.menuitemradio]: "menuitemradio",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A Switch Custom HTML Element.
|
|
41
|
+
* Implements {@link https://www.w3.org/TR/wai-aria-1.1/#menuitem | ARIA menuitem }, {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemcheckbox | ARIA menuitemcheckbox}, or {@link https://www.w3.org/TR/wai-aria-1.1/#menuitemradio | ARIA menuitemradio }.
|
|
42
|
+
*
|
|
43
|
+
* @slot checked-indicator - The checked indicator
|
|
44
|
+
* @slot radio-indicator - The radio indicator
|
|
45
|
+
* @slot start - Content which can be provided before the menu item content
|
|
46
|
+
* @slot end - Content which can be provided after the menu item content
|
|
47
|
+
* @slot - The default slot for menu item content
|
|
48
|
+
* @slot expand-collapse-indicator - The expand/collapse indicator
|
|
49
|
+
* @slot submenu - Used to nest menu's within menu items
|
|
50
|
+
* @csspart input-container - The element representing the visual checked or radio indicator
|
|
51
|
+
* @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
|
|
52
|
+
* @csspart radio - The element wrapping the `menuitemradio` indicator
|
|
53
|
+
* @csspart content - The element wrapping the menu item content
|
|
54
|
+
* @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
|
|
55
|
+
* @csspart expand-collapse - The expand/collapse element
|
|
56
|
+
* @csspart submenu-region - The container for the submenu, used for positioning
|
|
57
|
+
* @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
|
|
58
|
+
* @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
class MenuItem$1 extends FoundationElement {
|
|
63
|
+
constructor() {
|
|
64
|
+
super(...arguments);
|
|
65
|
+
/**
|
|
66
|
+
* The role of the element.
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
* @remarks
|
|
70
|
+
* HTML Attribute: role
|
|
71
|
+
*/
|
|
72
|
+
this.role = MenuItemRole.menuitem;
|
|
73
|
+
/**
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
this.hasSubmenu = false;
|
|
77
|
+
/**
|
|
78
|
+
* Track current direction to pass to the anchored region
|
|
79
|
+
*
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
this.currentDirection = Direction.ltr;
|
|
83
|
+
this.focusSubmenuOnLoad = false;
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
this.handleMenuItemKeyDown = (e) => {
|
|
88
|
+
if (e.defaultPrevented) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
switch (e.key) {
|
|
92
|
+
case keyEnter:
|
|
93
|
+
case keySpace:
|
|
94
|
+
this.invoke();
|
|
95
|
+
return false;
|
|
96
|
+
case keyArrowRight:
|
|
97
|
+
//open/focus on submenu
|
|
98
|
+
this.expandAndFocus();
|
|
99
|
+
return false;
|
|
100
|
+
case keyArrowLeft:
|
|
101
|
+
//close submenu
|
|
102
|
+
if (this.expanded) {
|
|
103
|
+
this.expanded = false;
|
|
104
|
+
this.focus();
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
this.handleMenuItemClick = (e) => {
|
|
114
|
+
if (e.defaultPrevented || this.disabled) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
this.invoke();
|
|
118
|
+
return false;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
this.submenuLoaded = () => {
|
|
124
|
+
if (!this.focusSubmenuOnLoad) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this.focusSubmenuOnLoad = false;
|
|
128
|
+
if (this.hasSubmenu) {
|
|
129
|
+
this.submenu.focus();
|
|
130
|
+
this.setAttribute("tabindex", "-1");
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
this.handleMouseOver = (e) => {
|
|
137
|
+
if (this.disabled || !this.hasSubmenu || this.expanded) {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
this.expanded = true;
|
|
141
|
+
return false;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
this.handleMouseOut = (e) => {
|
|
147
|
+
if (!this.expanded || this.contains(document.activeElement)) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
this.expanded = false;
|
|
151
|
+
return false;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
this.expandAndFocus = () => {
|
|
157
|
+
if (!this.hasSubmenu) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.focusSubmenuOnLoad = true;
|
|
161
|
+
this.expanded = true;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
166
|
+
this.invoke = () => {
|
|
167
|
+
if (this.disabled) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
switch (this.role) {
|
|
171
|
+
case MenuItemRole.menuitemcheckbox:
|
|
172
|
+
this.checked = !this.checked;
|
|
173
|
+
break;
|
|
174
|
+
case MenuItemRole.menuitem:
|
|
175
|
+
// update submenu
|
|
176
|
+
this.updateSubmenu();
|
|
177
|
+
if (this.hasSubmenu) {
|
|
178
|
+
this.expandAndFocus();
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.$emit("change");
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case MenuItemRole.menuitemradio:
|
|
185
|
+
if (!this.checked) {
|
|
186
|
+
this.checked = true;
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Gets the submenu element if any
|
|
193
|
+
*
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
196
|
+
this.updateSubmenu = () => {
|
|
197
|
+
this.submenu = this.domChildren().find((element) => {
|
|
198
|
+
return element.getAttribute("role") === "menu";
|
|
199
|
+
});
|
|
200
|
+
this.hasSubmenu = this.submenu === undefined ? false : true;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
expandedChanged(oldValue) {
|
|
204
|
+
if (this.$fastController.isConnected) {
|
|
205
|
+
if (this.submenu === undefined) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (this.expanded === false) {
|
|
209
|
+
this.submenu.collapseExpandedItem();
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
this.currentDirection = getDirection(this);
|
|
213
|
+
}
|
|
214
|
+
this.$emit("expanded-change", this, { bubbles: false });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
checkedChanged(oldValue, newValue) {
|
|
218
|
+
if (this.$fastController.isConnected) {
|
|
219
|
+
this.$emit("change");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
connectedCallback() {
|
|
226
|
+
super.connectedCallback();
|
|
227
|
+
DOM.queueUpdate(() => {
|
|
228
|
+
this.updateSubmenu();
|
|
229
|
+
});
|
|
230
|
+
if (!this.startColumnCount) {
|
|
231
|
+
this.startColumnCount = 1;
|
|
232
|
+
}
|
|
233
|
+
this.observer = new MutationObserver(this.updateSubmenu);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* @internal
|
|
237
|
+
*/
|
|
238
|
+
disconnectedCallback() {
|
|
239
|
+
super.disconnectedCallback();
|
|
240
|
+
this.submenu = undefined;
|
|
241
|
+
if (this.observer !== undefined) {
|
|
242
|
+
this.observer.disconnect();
|
|
243
|
+
this.observer = undefined;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* get an array of valid DOM children
|
|
248
|
+
*/
|
|
249
|
+
domChildren() {
|
|
250
|
+
return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
__decorate([
|
|
254
|
+
attr({ mode: "boolean" })
|
|
255
|
+
], MenuItem$1.prototype, "disabled", void 0);
|
|
256
|
+
__decorate([
|
|
257
|
+
attr({ mode: "boolean" })
|
|
258
|
+
], MenuItem$1.prototype, "expanded", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
observable
|
|
261
|
+
], MenuItem$1.prototype, "startColumnCount", void 0);
|
|
262
|
+
__decorate([
|
|
263
|
+
attr
|
|
264
|
+
], MenuItem$1.prototype, "role", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
attr({ mode: "boolean" })
|
|
267
|
+
], MenuItem$1.prototype, "checked", void 0);
|
|
268
|
+
__decorate([
|
|
269
|
+
observable
|
|
270
|
+
], MenuItem$1.prototype, "submenuRegion", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
observable
|
|
273
|
+
], MenuItem$1.prototype, "hasSubmenu", void 0);
|
|
274
|
+
__decorate([
|
|
275
|
+
observable
|
|
276
|
+
], MenuItem$1.prototype, "currentDirection", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
observable
|
|
279
|
+
], MenuItem$1.prototype, "submenu", void 0);
|
|
280
|
+
applyMixins(MenuItem$1, StartEnd);
|
|
281
|
+
|
|
282
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 08 Nov 2022 16:43:57 GMT\n */\n@supports selector(:focus-visible) {\n :host(:focus) {\n outline: none;\n }\n}\n.base {\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 8 * clamp(-1, var(--vvd-size-density, 0), 1)));\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-typography-base);\n gap: 8px;\n inline-size: 100%;\n padding-inline: 8px;\n}\n.base {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.base:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:not(:disabled, .disabled, :hover, .hover)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.base:where(.selected, [aria-current]):where(:hover, .hover) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-faint: var(--vvd-color-neutral-50);\n --_connotation-color-soft: var(--vvd-color-neutral-100);\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n}\n\n.focus-indicator {\n border-radius: 6px;\n}\n:host(:not(:focus-visible)) .focus-indicator {\n display: none;\n}\n\n.icon {\n font-size: 20px;\n}\n.base:not(.item-checkbox, .item-radio) .icon {\n color: var(--vvd-color-neutral-600);\n}\n\n.text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}";
|
|
283
|
+
|
|
284
|
+
class MenuItem extends MenuItem$1 {}
|
|
285
|
+
__decorate([attr, __metadata("design:type", String)], MenuItem.prototype, "text", void 0);
|
|
286
|
+
applyMixins(MenuItem, AffixIcon);
|
|
287
|
+
|
|
288
|
+
let _ = t => t,
|
|
289
|
+
_t,
|
|
290
|
+
_t2,
|
|
291
|
+
_t3,
|
|
292
|
+
_t4,
|
|
293
|
+
_t5;
|
|
294
|
+
const getClasses = ({
|
|
295
|
+
disabled,
|
|
296
|
+
checked,
|
|
297
|
+
expanded,
|
|
298
|
+
role
|
|
299
|
+
}) => classNames('base', ['disabled', Boolean(disabled)], ['selected', role !== MenuItemRole.menuitem && Boolean(checked)], ['expanded', Boolean(expanded)], ['item-checkbox', role === MenuItemRole.menuitemcheckbox], ['item-radio', role === MenuItemRole.menuitemradio]);
|
|
300
|
+
const MenuItemTemplate = (context, definition) => {
|
|
301
|
+
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
302
|
+
const focusTemplate = focusTemplateFactory(context);
|
|
303
|
+
return html(_t || (_t = _`
|
|
304
|
+
<template
|
|
305
|
+
aria-checked="${0}"
|
|
306
|
+
aria-disabled="${0}"
|
|
307
|
+
aria-expanded="${0}"
|
|
308
|
+
@keydown="${0}"
|
|
309
|
+
@click="${0}"
|
|
310
|
+
@mouseover="${0}"
|
|
311
|
+
@mouseout="${0}"
|
|
312
|
+
>
|
|
313
|
+
<div class="${0}">
|
|
314
|
+
|
|
315
|
+
${0}
|
|
316
|
+
${0}
|
|
317
|
+
|
|
318
|
+
${0}
|
|
319
|
+
|
|
320
|
+
${0}
|
|
321
|
+
|
|
322
|
+
${0}
|
|
323
|
+
|
|
324
|
+
<span class="text">
|
|
325
|
+
${0}
|
|
326
|
+
</span>
|
|
327
|
+
</div>
|
|
328
|
+
</template>
|
|
329
|
+
`), x => x.role !== MenuItemRole.menuitem ? x.checked : void 0, x => x.disabled, x => x.expanded, (x, c) => x.handleMenuItemKeyDown(c.event), (x, c) => x.handleMenuItemClick(c.event), (x, c) => x.handleMouseOver(c.event), (x, c) => x.handleMouseOut(c.event), getClasses, when(x => x.hasSubmenu, html(_t2 || (_t2 = _`
|
|
330
|
+
<div
|
|
331
|
+
class="expand-collapse-glyph-container"
|
|
332
|
+
>
|
|
333
|
+
<span class="expand-collapse">
|
|
334
|
+
<slot name="expand-collapse-indicator">
|
|
335
|
+
${0}
|
|
336
|
+
</slot>
|
|
337
|
+
</span>
|
|
338
|
+
</div>
|
|
339
|
+
`), definition.expandCollapseGlyph || '')), () => focusTemplate, when(x => x.role === MenuItemRole.menuitemcheckbox, html(_t3 || (_t3 = _`${0}`), x => affixIconTemplate(x.checked ? 'checkbox-checked-line' : 'checkbox-unchecked-line'))), when(x => x.role === MenuItemRole.menuitemradio, html(_t4 || (_t4 = _`${0}`), x => affixIconTemplate(x.checked ? 'radio-checked-line' : 'radio-unchecked-line'))), when(x => x.role === MenuItemRole.menuitem && x.icon, html(_t5 || (_t5 = _`${0}`), x => affixIconTemplate(x.icon))), x => x.text);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
const vividMenuItem = MenuItem.compose({
|
|
343
|
+
baseName: 'menu-item',
|
|
344
|
+
template: MenuItemTemplate,
|
|
345
|
+
styles: css_248z
|
|
346
|
+
});
|
|
347
|
+
designSystem.register(vividMenuItem());
|
|
348
|
+
|
|
349
|
+
export { MenuItem$1 as M, MenuItemRole as a, roleForMenuItem as r, vividMenuItem as v };
|
package/shared/key-codes.js
CHANGED
|
@@ -86,6 +86,7 @@ const keyEscape = "Escape";
|
|
|
86
86
|
const keyHome = "Home";
|
|
87
87
|
const keyEnd = "End";
|
|
88
88
|
const keySpace = " ";
|
|
89
|
+
const keyTab = "Tab";
|
|
89
90
|
const ArrowKeys = {
|
|
90
91
|
ArrowDown: keyArrowDown,
|
|
91
92
|
ArrowLeft: keyArrowLeft,
|
|
@@ -93,4 +94,4 @@ const ArrowKeys = {
|
|
|
93
94
|
ArrowUp: keyArrowUp,
|
|
94
95
|
};
|
|
95
96
|
|
|
96
|
-
export { ArrowKeys as A, keySpace as a,
|
|
97
|
+
export { ArrowKeys as A, keySpace as a, keyEscape as b, keyTab as c, keyEnd as d, keyArrowUp as e, keyArrowDown as f, keyHome as g, keyArrowLeft as h, keyArrowRight as i, keyEnter as k };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This method keeps a given value within the bounds of a min and max value. If the value
|
|
3
|
+
* is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
|
|
4
|
+
* the maximum will be returned. Otherwise, the value is returned un-changed.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
|
|
8
|
+
* If value is greater than max, max will be returned.
|
|
9
|
+
*/
|
|
10
|
+
function limit(min, max, value) {
|
|
11
|
+
return Math.min(Math.max(value, min), max);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Determines if a number value is within a specified range.
|
|
15
|
+
*
|
|
16
|
+
* @param value - the value to check
|
|
17
|
+
* @param min - the range start
|
|
18
|
+
* @param max - the range end
|
|
19
|
+
*/
|
|
20
|
+
function inRange(value, min, max = 0) {
|
|
21
|
+
[min, max] = [min, max].sort((a, b) => a - b);
|
|
22
|
+
return min <= value && value < max;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { inRange as i, limit as l };
|
package/shared/object-keys.js
CHANGED
|
@@ -18,7 +18,7 @@ export declare function formElements<T extends {
|
|
|
18
18
|
successText?: string | undefined;
|
|
19
19
|
charCount: boolean;
|
|
20
20
|
userValid: boolean;
|
|
21
|
-
"__#
|
|
21
|
+
"__#6895@#blurred": boolean;
|
|
22
22
|
readonly errorValidationMessage: any;
|
|
23
23
|
validate: () => void;
|
|
24
24
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { f as functionUncurryThis, L as requireObjectCoercible$1 } from './export.js';
|
|
2
|
+
import { t as toString$1 } from './to-string.js';
|
|
3
|
+
|
|
4
|
+
// a string of all valid unicode whitespaces
|
|
5
|
+
var whitespaces$1 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
6
|
+
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
7
|
+
|
|
8
|
+
var uncurryThis = functionUncurryThis;
|
|
9
|
+
var requireObjectCoercible = requireObjectCoercible$1;
|
|
10
|
+
var toString = toString$1;
|
|
11
|
+
var whitespaces = whitespaces$1;
|
|
12
|
+
|
|
13
|
+
var replace = uncurryThis(''.replace);
|
|
14
|
+
var whitespace = '[' + whitespaces + ']';
|
|
15
|
+
var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
|
16
|
+
var rtrim = RegExp(whitespace + whitespace + '*$');
|
|
17
|
+
|
|
18
|
+
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
19
|
+
var createMethod = function (TYPE) {
|
|
20
|
+
return function ($this) {
|
|
21
|
+
var string = toString(requireObjectCoercible($this));
|
|
22
|
+
if (TYPE & 1) string = replace(string, ltrim, '');
|
|
23
|
+
if (TYPE & 2) string = replace(string, rtrim, '');
|
|
24
|
+
return string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var stringTrim = {
|
|
29
|
+
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
30
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
31
|
+
start: createMethod(1),
|
|
32
|
+
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
33
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
34
|
+
end: createMethod(2),
|
|
35
|
+
// `String.prototype.trim` method
|
|
36
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
37
|
+
trim: createMethod(3)
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { stringTrim as s, whitespaces$1 as w };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as descriptors,
|
|
1
|
+
import { d as descriptors, D as v8PrototypeDefineBug, o as objectDefineProperty, j as anObject$2, E as toIndexedObject$2, F as sharedKey$2, G as enumBugKeys$1, H as hiddenKeys$1, p as documentCreateElement$2, w as wellKnownSymbol$4, e as fails$2, q as hasOwnProperty_1, i as isCallable$3, I as toObject$1, z as isObject$1, v as defineBuiltIn$2, J as createPropertyDescriptor$1, _ as _export, K as createNonEnumerableProperty$2, x as functionCall, C as functionName, y as internalState, g as global$1 } from './export.js';
|
|
2
2
|
import { o as objectKeys$1 } from './object-keys.js';
|
|
3
3
|
import { h as html$1, s as setToStringTag$2, i as iterators, o as objectSetPrototypeOf } from './iterators.js';
|
|
4
4
|
|
package/side-drawer/index.js
CHANGED
|
@@ -44,7 +44,7 @@ __decorate([attr({
|
|
|
44
44
|
mode: 'boolean'
|
|
45
45
|
}), __metadata("design:type", Object)], SideDrawer.prototype, "trailing", void 0);
|
|
46
46
|
|
|
47
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on
|
|
47
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 08 Nov 2022 16:43:57 GMT\n */\n.control {\n position: fixed;\n z-index: 1;\n background-color: var(--vvd-color-canvas);\n color: var(--vvd-color-canvas-text);\n inline-size: 280px;\n inset-block: 0;\n overflow-y: auto;\n}\n.control[part~=vvd-theme-alternate] {\n background-color: var(--vvd-color-canvas);\n color: var(--vvd-color-canvas-text);\n color-scheme: var(--vvd-color-scheme);\n}\n.control.trailing {\n inset-inline-end: 0;\n}\n.control:not(.open).trailing {\n transform: translateX(100%);\n}\n.control:not(.open):not(.trailing) {\n transform: translateX(-100%);\n}\n.control.open:not(.modal).trailing + .side-drawer-app-content {\n margin-inline-end: var(--side-drawer-app-content-offset, 280px);\n}\n.control.open:not(.modal):not(.trailing) + .side-drawer-app-content {\n margin-inline-start: var(--side-drawer-app-content-offset, 280px);\n}\n@media (prefers-reduced-motion: no-preference) {\n .control {\n transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);\n }\n}\n\n.scrim {\n background-color: var(--vvd-color-canvas-text);\n opacity: 0.5;\n position: fixed;\n inset: 0;\n}\n.scrim:not(.open) {\n display: none;\n}";
|
|
48
48
|
|
|
49
49
|
let _ = t => t,
|
|
50
50
|
_t,
|