@vonage/vivid 3.0.0-next.71 → 3.0.0-next.73

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.
Files changed (49) hide show
  1. package/accordion/index.js +1 -1
  2. package/accordion-item/index.js +1 -1
  3. package/action-group/index.js +1 -1
  4. package/avatar/index.js +1 -1
  5. package/badge/index.js +5 -3
  6. package/banner/index.js +2 -2
  7. package/breadcrumb-item/index.js +1 -1
  8. package/button/index.js +9 -116
  9. package/calendar/index.js +1 -1
  10. package/calendar-event/index.js +1 -1
  11. package/card/index.js +2 -2
  12. package/checkbox/index.js +1 -1
  13. package/dialog/index.js +2 -2
  14. package/divider/index.js +3 -86
  15. package/elevation/index.js +1 -1
  16. package/fab/index.js +1 -1
  17. package/focus/index.js +1 -1
  18. package/header/index.js +2 -2
  19. package/index.js +6 -5
  20. package/lib/number-field/index.d.ts +4 -0
  21. package/lib/number-field/number-field.d.ts +16 -0
  22. package/lib/number-field/number-field.template.d.ts +4 -0
  23. package/menu/index.js +6 -5
  24. package/menu-item/index.js +1 -1
  25. package/nav-disclosure/index.js +1 -1
  26. package/nav-item/index.js +1 -1
  27. package/note/index.js +1 -1
  28. package/number-field/index.js +522 -0
  29. package/package.json +3 -2
  30. package/popup/index.js +3 -2
  31. package/progress/index.js +1 -1
  32. package/progress-ring/index.js +1 -1
  33. package/shared/enums.js +1 -1
  34. package/shared/index2.js +105 -22
  35. package/shared/index3.js +21 -2103
  36. package/shared/index4.js +41 -326
  37. package/shared/index5.js +2100 -0
  38. package/shared/index6.js +371 -0
  39. package/shared/patterns/form-elements.d.ts +1 -1
  40. package/shared/regexp-flags.js +21 -0
  41. package/side-drawer/index.js +1 -1
  42. package/styles/core/all.css +1 -1
  43. package/styles/core/theme.css +1 -1
  44. package/styles/core/typography.css +1 -1
  45. package/styles/tokens/theme-dark.css +3 -3
  46. package/styles/tokens/theme-light.css +3 -3
  47. package/text-area/index.js +1 -1
  48. package/text-field/index.js +1 -1
  49. package/tooltip/index.js +5 -4
package/shared/index4.js CHANGED
@@ -1,83 +1,36 @@
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 { a as applyMixins } from './apply-mixins.js';
6
- import { g as keyArrowLeft, h as keyArrowRight, a as keySpace, k as keyEnter } from './key-codes.js';
7
- import { f as focusTemplateFactory } from './focus2.js';
8
- import { w as when } from './when.js';
1
+ import { F as FoundationElement, _ as __decorate, a as attr, h as html, d as designSystem } from './index.js';
9
2
  import { c as classNames } from './class-names.js';
10
3
 
11
4
  /**
12
- * Expose ltr and rtl strings
5
+ * Standard orientation values
13
6
  */
14
- var Direction;
15
- (function (Direction) {
16
- Direction["ltr"] = "ltr";
17
- Direction["rtl"] = "rtl";
18
- })(Direction || (Direction = {}));
19
-
20
- /**
21
- * a method to determine the current localization direction of the view
22
- * @param rootNode - the HTMLElement to begin the query from, usually "this" when used in a component controller
23
- * @public
24
- */
25
- const getDirection = (rootNode) => {
26
- const dirNode = rootNode.closest("[dir]");
27
- return dirNode !== null && dirNode.dir === "rtl" ? Direction.rtl : Direction.ltr;
7
+ const Orientation = {
8
+ horizontal: "horizontal",
9
+ vertical: "vertical",
28
10
  };
29
11
 
30
12
  /**
31
- * Menu items roles.
13
+ * Divider roles
32
14
  * @public
33
15
  */
34
- const MenuItemRole = {
16
+ const DividerRole = {
35
17
  /**
36
- * The menu item has a "menuitem" role
18
+ * The divider semantically separates content
37
19
  */
38
- menuitem: "menuitem",
20
+ separator: "separator",
39
21
  /**
40
- * The menu item has a "menuitemcheckbox" role
22
+ * The divider has no semantic value and is for visual presentation only.
41
23
  */
42
- menuitemcheckbox: "menuitemcheckbox",
43
- /**
44
- * The menu item has a "menuitemradio" role
45
- */
46
- menuitemradio: "menuitemradio",
47
- };
48
- /**
49
- * @internal
50
- */
51
- const roleForMenuItem = {
52
- [MenuItemRole.menuitem]: "menuitem",
53
- [MenuItemRole.menuitemcheckbox]: "menuitemcheckbox",
54
- [MenuItemRole.menuitemradio]: "menuitemradio",
24
+ presentation: "presentation",
55
25
  };
56
26
 
57
27
  /**
58
- * A Switch Custom HTML Element.
59
- * 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 }.
60
- *
61
- * @slot checked-indicator - The checked indicator
62
- * @slot radio-indicator - The radio indicator
63
- * @slot start - Content which can be provided before the menu item content
64
- * @slot end - Content which can be provided after the menu item content
65
- * @slot - The default slot for menu item content
66
- * @slot expand-collapse-indicator - The expand/collapse indicator
67
- * @slot submenu - Used to nest menu's within menu items
68
- * @csspart input-container - The element representing the visual checked or radio indicator
69
- * @csspart checkbox - The element wrapping the `menuitemcheckbox` indicator
70
- * @csspart radio - The element wrapping the `menuitemradio` indicator
71
- * @csspart content - The element wrapping the menu item content
72
- * @csspart expand-collapse-glyph-container - The element wrapping the expand collapse element
73
- * @csspart expand-collapse - The expand/collapse element
74
- * @csspart submenu-region - The container for the submenu, used for positioning
75
- * @fires expanded-change - Fires a custom 'expanded-change' event when the expanded state changes
76
- * @fires change - Fires a custom 'change' event when a non-submenu item with a role of `menuitemcheckbox`, `menuitemradio`, or `menuitem` is invoked
28
+ * A Divider Custom HTML Element.
29
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#separator | ARIA separator } or {@link https://www.w3.org/TR/wai-aria-1.1/#presentation | ARIA presentation}.
77
30
  *
78
31
  * @public
79
32
  */
80
- class MenuItem$1 extends FoundationElement {
33
+ class Divider$1 extends FoundationElement {
81
34
  constructor() {
82
35
  super(...arguments);
83
36
  /**
@@ -87,285 +40,47 @@ class MenuItem$1 extends FoundationElement {
87
40
  * @remarks
88
41
  * HTML Attribute: role
89
42
  */
90
- this.role = MenuItemRole.menuitem;
91
- /**
92
- * @internal
93
- */
94
- this.hasSubmenu = false;
95
- /**
96
- * Track current direction to pass to the anchored region
97
- *
98
- * @internal
99
- */
100
- this.currentDirection = Direction.ltr;
101
- this.focusSubmenuOnLoad = false;
43
+ this.role = DividerRole.separator;
102
44
  /**
103
- * @internal
104
- */
105
- this.handleMenuItemKeyDown = (e) => {
106
- if (e.defaultPrevented) {
107
- return false;
108
- }
109
- switch (e.key) {
110
- case keyEnter:
111
- case keySpace:
112
- this.invoke();
113
- return false;
114
- case keyArrowRight:
115
- //open/focus on submenu
116
- this.expandAndFocus();
117
- return false;
118
- case keyArrowLeft:
119
- //close submenu
120
- if (this.expanded) {
121
- this.expanded = false;
122
- this.focus();
123
- return false;
124
- }
125
- }
126
- return true;
127
- };
128
- /**
129
- * @internal
130
- */
131
- this.handleMenuItemClick = (e) => {
132
- if (e.defaultPrevented || this.disabled) {
133
- return false;
134
- }
135
- this.invoke();
136
- return false;
137
- };
138
- /**
139
- * @internal
140
- */
141
- this.submenuLoaded = () => {
142
- if (!this.focusSubmenuOnLoad) {
143
- return;
144
- }
145
- this.focusSubmenuOnLoad = false;
146
- if (this.hasSubmenu) {
147
- this.submenu.focus();
148
- this.setAttribute("tabindex", "-1");
149
- }
150
- };
151
- /**
152
- * @internal
153
- */
154
- this.handleMouseOver = (e) => {
155
- if (this.disabled || !this.hasSubmenu || this.expanded) {
156
- return false;
157
- }
158
- this.expanded = true;
159
- return false;
160
- };
161
- /**
162
- * @internal
163
- */
164
- this.handleMouseOut = (e) => {
165
- if (!this.expanded || this.contains(document.activeElement)) {
166
- return false;
167
- }
168
- this.expanded = false;
169
- return false;
170
- };
171
- /**
172
- * @internal
173
- */
174
- this.expandAndFocus = () => {
175
- if (!this.hasSubmenu) {
176
- return;
177
- }
178
- this.focusSubmenuOnLoad = true;
179
- this.expanded = true;
180
- };
181
- /**
182
- * @internal
183
- */
184
- this.invoke = () => {
185
- if (this.disabled) {
186
- return;
187
- }
188
- switch (this.role) {
189
- case MenuItemRole.menuitemcheckbox:
190
- this.checked = !this.checked;
191
- break;
192
- case MenuItemRole.menuitem:
193
- // update submenu
194
- this.updateSubmenu();
195
- if (this.hasSubmenu) {
196
- this.expandAndFocus();
197
- }
198
- else {
199
- this.$emit("change");
200
- }
201
- break;
202
- case MenuItemRole.menuitemradio:
203
- if (!this.checked) {
204
- this.checked = true;
205
- }
206
- break;
207
- }
208
- };
209
- /**
210
- * Gets the submenu element if any
45
+ * The orientation of the divider.
211
46
  *
212
- * @internal
47
+ * @public
48
+ * @remarks
49
+ * HTML Attribute: orientation
213
50
  */
214
- this.updateSubmenu = () => {
215
- this.submenu = this.domChildren().find((element) => {
216
- return element.getAttribute("role") === "menu";
217
- });
218
- this.hasSubmenu = this.submenu === undefined ? false : true;
219
- };
220
- }
221
- expandedChanged(oldValue) {
222
- if (this.$fastController.isConnected) {
223
- if (this.submenu === undefined) {
224
- return;
225
- }
226
- if (this.expanded === false) {
227
- this.submenu.collapseExpandedItem();
228
- }
229
- else {
230
- this.currentDirection = getDirection(this);
231
- }
232
- this.$emit("expanded-change", this, { bubbles: false });
233
- }
234
- }
235
- checkedChanged(oldValue, newValue) {
236
- if (this.$fastController.isConnected) {
237
- this.$emit("change");
238
- }
239
- }
240
- /**
241
- * @internal
242
- */
243
- connectedCallback() {
244
- super.connectedCallback();
245
- DOM.queueUpdate(() => {
246
- this.updateSubmenu();
247
- });
248
- if (!this.startColumnCount) {
249
- this.startColumnCount = 1;
250
- }
251
- this.observer = new MutationObserver(this.updateSubmenu);
252
- }
253
- /**
254
- * @internal
255
- */
256
- disconnectedCallback() {
257
- super.disconnectedCallback();
258
- this.submenu = undefined;
259
- if (this.observer !== undefined) {
260
- this.observer.disconnect();
261
- this.observer = undefined;
262
- }
263
- }
264
- /**
265
- * get an array of valid DOM children
266
- */
267
- domChildren() {
268
- return Array.from(this.children).filter(child => !child.hasAttribute("hidden"));
51
+ this.orientation = Orientation.horizontal;
269
52
  }
270
53
  }
271
- __decorate([
272
- attr({ mode: "boolean" })
273
- ], MenuItem$1.prototype, "disabled", void 0);
274
- __decorate([
275
- attr({ mode: "boolean" })
276
- ], MenuItem$1.prototype, "expanded", void 0);
277
- __decorate([
278
- observable
279
- ], MenuItem$1.prototype, "startColumnCount", void 0);
280
54
  __decorate([
281
55
  attr
282
- ], MenuItem$1.prototype, "role", void 0);
56
+ ], Divider$1.prototype, "role", void 0);
283
57
  __decorate([
284
- attr({ mode: "boolean" })
285
- ], MenuItem$1.prototype, "checked", void 0);
286
- __decorate([
287
- observable
288
- ], MenuItem$1.prototype, "submenuRegion", void 0);
289
- __decorate([
290
- observable
291
- ], MenuItem$1.prototype, "hasSubmenu", void 0);
292
- __decorate([
293
- observable
294
- ], MenuItem$1.prototype, "currentDirection", void 0);
295
- __decorate([
296
- observable
297
- ], MenuItem$1.prototype, "submenu", void 0);
298
- applyMixins(MenuItem$1, StartEnd);
299
-
300
- var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 06 Oct 2022 14:03:46 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: 40px;\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n font: var(--vvd-font-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: transaprent;\n --_appearance-color-outline: transaprent;\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: transaprent;\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: transaprent;\n}\n.base:where(.selected, [aria-current]):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transaprent;\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: transaprent;\n --_appearance-color-outline: transaprent;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\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}";
301
-
302
- class MenuItem extends MenuItem$1 {}
58
+ attr
59
+ ], Divider$1.prototype, "orientation", void 0);
303
60
 
304
- __decorate([attr, __metadata("design:type", String)], MenuItem.prototype, "text", void 0);
61
+ var css_248z = "/**\n * Do not edit directly\n * Generated on Wed, 12 Oct 2022 06:56:20 GMT\n */\n:host {\n display: block;\n}\n\n.base {\n display: block;\n background-color: var(--vvd-color-neutral-200);\n}\n.base:not(.vertical) {\n block-size: 1px;\n inline-size: 100%;\n}\n.base.vertical {\n block-size: 100%;\n inline-size: 1px;\n}";
305
62
 
306
- applyMixins(MenuItem, AffixIcon);
63
+ class Divider extends Divider$1 {}
307
64
 
308
65
  let _ = t => t,
309
- _t,
310
- _t2,
311
- _t3,
312
- _t4,
313
- _t5;
66
+ _t;
314
67
 
315
68
  const getClasses = ({
316
- disabled,
317
- checked,
318
- expanded,
319
- role
320
- }) => classNames('base', ['disabled', Boolean(disabled)], ['selected', role !== MenuItemRole.menuitem && Boolean(checked)], ['expanded', Boolean(expanded)], ['item-checkbox', role === MenuItemRole.menuitemcheckbox], ['item-radio', role === MenuItemRole.menuitemradio]);
321
-
322
- const MenuItemTemplate = (context, definition) => {
323
- const affixIconTemplate = affixIconTemplateFactory(context);
324
- const focusTemplate = focusTemplateFactory(context);
325
- return html(_t || (_t = _`
326
- <template
327
- aria-checked="${0}"
328
- aria-disabled="${0}"
329
- aria-expanded="${0}"
330
- @keydown="${0}"
331
- @click="${0}"
332
- @mouseover="${0}"
333
- @mouseout="${0}"
334
- >
335
- <div class="${0}">
336
-
337
- ${0}
338
- ${0}
339
-
340
- ${0}
341
-
342
- ${0}
343
-
344
- ${0}
345
-
346
- <span class="text">
347
- ${0}
348
- </span>
349
- </div>
350
- </template>
351
- `), 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 = _`
352
- <div
353
- class="expand-collapse-glyph-container"
354
- >
355
- <span class="expand-collapse">
356
- <slot name="expand-collapse-indicator">
357
- ${0}
358
- </slot>
359
- </span>
360
- </div>
361
- `), 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);
362
- };
363
-
364
- const vividMenuItem = MenuItem.compose({
365
- baseName: 'menu-item',
366
- template: MenuItemTemplate,
69
+ orientation
70
+ }) => classNames('base', [`${orientation}`, Boolean(orientation)]);
71
+
72
+ const DividerTemplate = () => html(_t || (_t = _`
73
+ <span
74
+ class="${0}"
75
+ orientation="${0}"
76
+ role="${0}"
77
+ ></span>`), getClasses, x => x.orientation, x => x.role);
78
+
79
+ const vividDivider = Divider.compose({
80
+ baseName: 'divider',
81
+ template: DividerTemplate,
367
82
  styles: css_248z
368
83
  });
369
- designSystem.register(vividMenuItem());
84
+ designSystem.register(vividDivider());
370
85
 
371
- export { MenuItem$1 as M, MenuItemRole as a, roleForMenuItem as r, vividMenuItem as v };
86
+ export { Divider as D, vividDivider as v };