@vonage/vivid 3.32.0 → 3.35.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.
Files changed (221) hide show
  1. package/accordion/index.js +5 -5
  2. package/accordion-item/index.js +4 -4
  3. package/action-group/index.js +1 -1
  4. package/alert/index.js +6 -6
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +5 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +4 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +3 -3
  14. package/checkbox/index.js +5 -3
  15. package/combobox/index.js +8 -8
  16. package/custom-elements.json +256 -18
  17. package/data-grid/index.js +2 -2
  18. package/date-picker/index.js +9 -9
  19. package/dialog/index.js +6 -6
  20. package/divider/index.js +1 -1
  21. package/elevation/index.js +1 -1
  22. package/empty-state/index.js +2 -2
  23. package/fab/index.js +4 -4
  24. package/file-picker/index.js +5 -5
  25. package/focus/index.js +1 -1
  26. package/header/index.js +2 -2
  27. package/icon/index.js +1 -1
  28. package/index.js +59 -59
  29. package/layout/index.js +1 -1
  30. package/lib/avatar/avatar.d.ts +1 -1
  31. package/lib/calendar/calendar.d.ts +1 -1
  32. package/lib/date-picker/calendar/dateStr.d.ts +1 -0
  33. package/lib/date-picker/calendar/month.d.ts +1 -0
  34. package/lib/date-picker/calendar/year.d.ts +2 -0
  35. package/lib/date-picker/date-picker.d.ts +2 -0
  36. package/lib/icon/icon.d.ts +0 -1
  37. package/lib/listbox/listbox.d.ts +9 -1
  38. package/lib/progress-ring/progress-ring.d.ts +1 -1
  39. package/lib/text-field/text-field.d.ts +1 -0
  40. package/listbox/index.js +20 -16
  41. package/locales/en-GB.js +48 -14
  42. package/locales/en-US.js +48 -14
  43. package/locales/ja-JP.js +48 -14
  44. package/locales/zh-CN.js +48 -14
  45. package/menu/index.js +8 -8
  46. package/menu-item/index.js +4 -4
  47. package/nav/index.js +1 -1
  48. package/nav-disclosure/index.js +3 -3
  49. package/nav-item/index.js +3 -3
  50. package/note/index.js +2 -3
  51. package/number-field/index.js +6 -6
  52. package/option/index.js +3 -3
  53. package/package.json +2 -16
  54. package/pagination/index.js +5 -5
  55. package/popup/index.js +6 -6
  56. package/progress/index.js +1 -1
  57. package/progress-ring/index.js +1 -1
  58. package/radio/index.js +2 -2
  59. package/radio-group/index.js +1 -1
  60. package/select/index.js +8 -8
  61. package/shared/affix.js +25 -9
  62. package/shared/apply-mixins.js +1 -1
  63. package/shared/breadcrumb-item.js +5 -5
  64. package/shared/button.js +13 -13
  65. package/shared/calendar-event.js +36 -16
  66. package/shared/definition.js +133 -194
  67. package/shared/definition10.js +225 -40
  68. package/shared/definition11.js +36 -32
  69. package/shared/definition12.js +763 -98
  70. package/shared/definition13.js +125 -89
  71. package/shared/definition14.js +207 -27
  72. package/shared/definition15.js +710 -731
  73. package/shared/definition16.js +1289 -47
  74. package/shared/definition17.js +6113 -93
  75. package/shared/definition18.js +242 -164
  76. package/shared/definition19.js +47 -692
  77. package/shared/definition2.js +199 -117
  78. package/shared/definition20.js +59 -1671
  79. package/shared/definition21.js +95 -255
  80. package/shared/definition22.js +2218 -1167
  81. package/shared/definition23.js +61 -5784
  82. package/shared/definition24.js +28 -117
  83. package/shared/definition25.js +52 -66
  84. package/shared/definition26.js +391 -214
  85. package/shared/definition27.js +441 -34
  86. package/shared/definition28.js +85 -73
  87. package/shared/definition29.js +21 -2283
  88. package/shared/definition3.js +61 -24
  89. package/shared/definition30.js +13 -49
  90. package/shared/definition31.js +54 -39
  91. package/shared/definition32.js +413 -375
  92. package/shared/definition33.js +223 -304
  93. package/shared/definition34.js +197 -13
  94. package/shared/definition35.js +88 -73
  95. package/shared/definition36.js +75 -25
  96. package/shared/definition37.js +434 -34
  97. package/shared/definition38.js +32 -432
  98. package/shared/definition39.js +677 -187
  99. package/shared/definition4.js +157 -12
  100. package/shared/definition40.js +95 -48
  101. package/shared/definition41.js +577 -31
  102. package/shared/definition42.js +126 -424
  103. package/shared/definition43.js +114 -618
  104. package/shared/definition44.js +24 -80
  105. package/shared/definition45.js +71 -543
  106. package/shared/definition46.js +499 -92
  107. package/shared/definition47.js +19 -133
  108. package/shared/definition48.js +129 -52
  109. package/shared/definition49.js +281 -17
  110. package/shared/definition5.js +71 -36
  111. package/shared/definition50.js +153 -484
  112. package/shared/definition51.js +131 -98
  113. package/shared/definition52.js +131 -16
  114. package/shared/definition53.js +80 -264
  115. package/shared/definition54.js +293 -118
  116. package/shared/definition55.js +12 -117
  117. package/shared/definition56.js +39 -68
  118. package/shared/definition57.js +166 -288
  119. package/shared/definition6.js +56 -111
  120. package/shared/definition7.js +120 -195
  121. package/shared/definition8.js +58 -23
  122. package/shared/definition9.js +92 -66
  123. package/shared/focus.js +2 -1
  124. package/shared/focus2.js +1 -1
  125. package/shared/form-associated.js +2 -2
  126. package/shared/icon.js +48 -27
  127. package/shared/index.js +7 -27
  128. package/shared/index2.js +108 -80
  129. package/shared/key-codes.js +1 -1
  130. package/shared/listbox.js +88 -11
  131. package/shared/patterns/form-elements/form-elements.d.ts +4 -4
  132. package/shared/radio.js +23 -7
  133. package/shared/repeat.js +1 -1
  134. package/shared/text-anchor.js +21 -4
  135. package/shared/text-anchor.template.js +37 -40
  136. package/shared/text-field.js +2 -2
  137. package/shared/text-field2.js +15 -15
  138. package/shared/tree-item.js +12 -12
  139. package/side-drawer/index.js +1 -1
  140. package/slider/index.js +2 -2
  141. package/split-button/index.js +3 -3
  142. package/style.css +6106 -0
  143. package/styles/core/all.css +1 -1
  144. package/styles/core/theme.css +1 -1
  145. package/styles/core/typography.css +1 -1
  146. package/styles/tokens/theme-dark.css +4 -4
  147. package/styles/tokens/theme-light.css +4 -4
  148. package/styles/tokens/vivid-2-compat.css +1 -1
  149. package/switch/index.js +3 -3
  150. package/tab/index.js +3 -3
  151. package/tab-panel/index.js +1 -1
  152. package/tabs/index.js +5 -5
  153. package/tag/index.js +3 -3
  154. package/tag-group/index.js +1 -1
  155. package/text-anchor/index.js +1 -1
  156. package/text-area/index.js +3 -3
  157. package/text-field/index.js +3 -3
  158. package/toggletip/index.js +7 -7
  159. package/tooltip/index.js +7 -7
  160. package/tree-item/index.js +3 -3
  161. package/tree-view/index.js +1 -1
  162. package/vivid.api.json +10 -1
  163. package/lib/accordion/index.d.ts +0 -1
  164. package/lib/accordion-item/index.d.ts +0 -1
  165. package/lib/action-group/index.d.ts +0 -1
  166. package/lib/alert/index.d.ts +0 -1
  167. package/lib/avatar/index.d.ts +0 -1
  168. package/lib/badge/index.d.ts +0 -1
  169. package/lib/banner/index.d.ts +0 -1
  170. package/lib/breadcrumb/index.d.ts +0 -1
  171. package/lib/breadcrumb-item/index.d.ts +0 -1
  172. package/lib/button/index.d.ts +0 -1
  173. package/lib/calendar/index.d.ts +0 -1
  174. package/lib/calendar-event/index.d.ts +0 -1
  175. package/lib/card/index.d.ts +0 -1
  176. package/lib/checkbox/index.d.ts +0 -1
  177. package/lib/combobox/index.d.ts +0 -1
  178. package/lib/data-grid/index.d.ts +0 -1
  179. package/lib/date-picker/index.d.ts +0 -1
  180. package/lib/dialog/index.d.ts +0 -1
  181. package/lib/divider/index.d.ts +0 -1
  182. package/lib/elevation/index.d.ts +0 -1
  183. package/lib/empty-state/index.d.ts +0 -1
  184. package/lib/fab/index.d.ts +0 -1
  185. package/lib/file-picker/index.d.ts +0 -1
  186. package/lib/focus/index.d.ts +0 -1
  187. package/lib/header/index.d.ts +0 -1
  188. package/lib/icon/index.d.ts +0 -1
  189. package/lib/layout/index.d.ts +0 -1
  190. package/lib/listbox/index.d.ts +0 -1
  191. package/lib/menu/index.d.ts +0 -1
  192. package/lib/menu-item/index.d.ts +0 -1
  193. package/lib/nav/index.d.ts +0 -1
  194. package/lib/nav-disclosure/index.d.ts +0 -1
  195. package/lib/nav-item/index.d.ts +0 -1
  196. package/lib/note/index.d.ts +0 -1
  197. package/lib/number-field/index.d.ts +0 -1
  198. package/lib/option/index.d.ts +0 -1
  199. package/lib/pagination/index.d.ts +0 -1
  200. package/lib/popup/index.d.ts +0 -1
  201. package/lib/progress/index.d.ts +0 -1
  202. package/lib/progress-ring/index.d.ts +0 -1
  203. package/lib/radio/index.d.ts +0 -1
  204. package/lib/radio-group/index.d.ts +0 -1
  205. package/lib/select/index.d.ts +0 -1
  206. package/lib/side-drawer/index.d.ts +0 -1
  207. package/lib/slider/index.d.ts +0 -1
  208. package/lib/split-button/index.d.ts +0 -1
  209. package/lib/switch/index.d.ts +0 -1
  210. package/lib/tab/index.d.ts +0 -1
  211. package/lib/tab-panel/index.d.ts +0 -1
  212. package/lib/tabs/index.d.ts +0 -1
  213. package/lib/tag/index.d.ts +0 -1
  214. package/lib/tag-group/index.d.ts +0 -1
  215. package/lib/text-anchor/index.d.ts +0 -1
  216. package/lib/text-area/index.d.ts +0 -1
  217. package/lib/text-field/index.d.ts +0 -1
  218. package/lib/toggletip/index.d.ts +0 -1
  219. package/lib/tooltip/index.d.ts +0 -1
  220. package/lib/tree-item/index.d.ts +0 -1
  221. package/lib/tree-view/index.d.ts +0 -1
@@ -1,98 +1,134 @@
1
- import { F as FoundationElement, _ as __decorate, o as observable, h as html, r as registerFactory } from './index.js';
2
- import { e as elements } from './node-observation.js';
1
+ import { F as FoundationElement, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { a as iconRegistries } from './definition24.js';
3
+ import { E as Elevation, e as elevationRegistries } from './definition56.js';
4
+ import { I as Icon } from './icon.js';
5
+ import { w as when } from './when.js';
3
6
  import { s as slotted } from './slotted.js';
4
- import { B as BreadcrumbItem } from './breadcrumb-item.js';
7
+ import { c as classNames } from './class-names.js';
5
8
 
6
- /**
7
- * A Breadcrumb Custom HTML Element.
8
- * @slot - The default slot for the breadcrumb items
9
- * @csspart list - The element wrapping the slotted items
10
- *
11
- * @public
12
- */
13
- class Breadcrumb$1 extends FoundationElement {
14
- slottedBreadcrumbItemsChanged() {
15
- if (this.$fastController.isConnected) {
16
- if (this.slottedBreadcrumbItems === undefined ||
17
- this.slottedBreadcrumbItems.length === 0) {
18
- return;
19
- }
20
- const lastNode = this.slottedBreadcrumbItems[this.slottedBreadcrumbItems.length - 1];
21
- this.slottedBreadcrumbItems.forEach((item) => {
22
- const itemIsLastNode = item === lastNode;
23
- this.setItemSeparator(item, itemIsLastNode);
24
- this.setAriaCurrent(item, itemIsLastNode);
25
- });
26
- }
27
- }
28
- setItemSeparator(item, isLastNode) {
29
- if (item instanceof BreadcrumbItem) {
30
- item.separator = !isLastNode;
31
- }
32
- }
33
- /**
34
- * Finds href on childnodes in the light DOM or shadow DOM.
35
- * We look in the shadow DOM because we insert an anchor when breadcrumb-item has an href.
36
- */
37
- findChildWithHref(node) {
38
- var _a, _b;
39
- if (node.childElementCount > 0) {
40
- return node.querySelector("a[href]");
41
- }
42
- else if ((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childElementCount) {
43
- return (_b = node.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("a[href]");
44
- }
45
- else
46
- return null;
47
- }
48
- /**
49
- * Sets ARIA Current for the current node
50
- * If child node with an anchor tag and with href is found then set aria-current to correct value for the child node,
51
- * otherwise apply aria-current to the host element, with an href
52
- */
53
- setAriaCurrent(item, isLastNode) {
54
- const childNodeWithHref = this.findChildWithHref(item);
55
- if (childNodeWithHref === null &&
56
- item.hasAttribute("href") &&
57
- item instanceof BreadcrumbItem) {
58
- isLastNode
59
- ? item.setAttribute("aria-current", "page")
60
- : item.removeAttribute("aria-current");
61
- }
62
- else if (childNodeWithHref !== null) {
63
- isLastNode
64
- ? childNodeWithHref.setAttribute("aria-current", "page")
65
- : childNodeWithHref.removeAttribute("aria-current");
66
- }
67
- }
9
+ const styles = "/**\n * Do not edit directly\n * Generated on Wed, 06 Sep 2023 09:40:36 GMT\n */\n:host {\n display: flex;\n}\n\n.base {\n border-radius: 6px;\n inline-size: 100%;\n text-align: start;\n}\n\n.wrapper {\n display: flex;\n overflow: hidden;\n flex-flow: column;\n block-size: 100%;\n border-radius: inherit;\n color: var(--vvd-color-canvas-text);\n}\n\n.main-content {\n display: flex;\n flex-flow: column;\n padding: 24px;\n}\n\n.header {\n display: flex;\n flex: 1;\n align-items: flex-start;\n gap: 8px;\n}\n.header-content {\n flex: 1;\n}\n.header-wrapper {\n display: flex;\n gap: 8px;\n}\n.header-headline, .header-subtitle {\n /* stylelint-disable value-no-vendor-prefix */\n display: -webkit-box;\n /* stylelint-enable value-no-vendor-prefix */\n overflow: hidden;\n -webkit-box-orient: vertical;\n}\n.header-headline {\n font: var(--vvd-typography-heading-4);\n -webkit-line-clamp: var(--headline-line-clamp);\n}\n.header-subtitle {\n font: var(--vvd-typography-base);\n -webkit-line-clamp: var(--subtitle-line-clamp);\n}\n.hide-header .header {\n display: none;\n}\n\n.header-subtitle,\n.text {\n color: var(--vvd-color-neutral-600);\n font: var(--vvd-typography-base);\n}\n\n.text {\n padding-right: 8px;\n margin-top: 12px;\n}\n\n.footer {\n display: inline-flex;\n flex-direction: column;\n align-items: flex-end;\n padding-bottom: 24px;\n margin-top: auto;\n padding-inline: 24px;\n}\n.hide-footer .footer {\n display: none;\n}\n\n::slotted([slot=graphic i]),\n.icon {\n flex-shrink: 0;\n align-self: baseline;\n margin-block-start: 4px;\n}\n\n.icon {\n font-size: 20px;\n}\n\n::slotted([slot=meta i]) {\n flex-shrink: 0;\n align-self: flex-start;\n margin-block-start: -8px;\n margin-inline-end: -8px;\n margin-inline-start: auto;\n}";
10
+
11
+ var __defProp = Object.defineProperty;
12
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
+ var __decorateClass = (decorators, target, key, kind) => {
14
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
15
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
16
+ if (decorator = decorators[i])
17
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
18
+ if (kind && result)
19
+ __defProp(target, key, result);
20
+ return result;
21
+ };
22
+ class Card extends FoundationElement {
68
23
  }
69
- __decorate([
70
- observable
71
- ], Breadcrumb$1.prototype, "slottedBreadcrumbItems", void 0);
24
+ __decorateClass([
25
+ attr
26
+ ], Card.prototype, "headline", 2);
27
+ __decorateClass([
28
+ attr
29
+ ], Card.prototype, "subtitle", 2);
30
+ __decorateClass([
31
+ attr
32
+ ], Card.prototype, "text", 2);
33
+ __decorateClass([
34
+ attr
35
+ ], Card.prototype, "icon", 2);
36
+ __decorateClass([
37
+ attr
38
+ ], Card.prototype, "elevation", 2);
39
+ __decorateClass([
40
+ observable
41
+ ], Card.prototype, "footerSlottedContent", 2);
42
+ __decorateClass([
43
+ observable
44
+ ], Card.prototype, "graphicSlottedContent", 2);
45
+ __decorateClass([
46
+ observable
47
+ ], Card.prototype, "hasMetaSlottedContent", 2);
72
48
 
73
- const breadcrumbTemplate = () => html`
74
- <nav aria-label="breadcrumbs" class="base">
75
- <div role="list" class="list">
76
- <slot
77
- ${slotted({
78
- property: 'slottedBreadcrumbItems',
79
- filter: elements()
80
- })}
81
- ></slot>
82
- </div>
83
- </nav>
84
- `;
49
+ const getClasses = (_) => classNames(
50
+ "base",
51
+ ["hide-footer", !_.footerSlottedContent || !_.footerSlottedContent.length],
52
+ ["hide-header", shouldHideHeader(_)]
53
+ );
54
+ function renderHeaderIcon(iconTag) {
55
+ return html`
56
+ <${iconTag} class="icon" inline name="${(x) => x.icon}"></${iconTag}>`;
57
+ }
58
+ function Headline() {
59
+ return html`
60
+ <div class="header-headline">${(x) => x.headline}</div>
61
+ `;
62
+ }
63
+ function Subtitle() {
64
+ return html`
65
+ <div class="header-subtitle">${(x) => x.subtitle}</div>
66
+ `;
67
+ }
68
+ function headerContent() {
69
+ return html`
70
+ <div class="header-content">
71
+ ${when((x) => x.headline, Headline())}
72
+ ${when((x) => x.subtitle, Subtitle())}
73
+ </div>
74
+ `;
75
+ }
76
+ function renderHeader(iconTag) {
77
+ return html`
78
+ <header class="header">
79
+ <slot name="graphic" ${slotted("graphicSlottedContent")}>${when((x) => x.icon, renderHeaderIcon(iconTag))}</slot>
80
+ ${when((x) => x.headline || x.subtitle, headerContent())}
81
+ </header>`;
82
+ }
83
+ function shouldHideHeader(card) {
84
+ return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
85
+ }
86
+ function renderMetaSlot() {
87
+ return html`
88
+ <slot name="meta" ${slotted("metaSlottedContent")}></slot>
89
+ `;
90
+ }
91
+ function text() {
92
+ return html`
93
+ <div class="text">${(x) => x.text}</div>
94
+ `;
95
+ }
96
+ const CardTemplate = (context) => {
97
+ const elevationTag = context.tagFor(Elevation);
98
+ const iconTag = context.tagFor(Icon);
99
+ return html`
100
+ <${elevationTag} dp=${(x) => x.elevation ?? "4"}>
85
101
 
86
- var css_248z = ".list {\n display: flex;\n}";
102
+ <div class="${getClasses}">
103
+ <div class="wrapper">
104
+ <div class="vwc-card-media">
105
+ <slot name="media"></slot>
106
+ </div>
107
+ <slot name="main">
108
+ <div class="main-content">
109
+ <div class="header-wrapper">
110
+ ${renderHeader(iconTag)}
111
+ ${renderMetaSlot()}
112
+ </div>
113
+ ${when((x) => x.text, text())}
114
+ </div>
115
+ </slot>
116
+ <div class="footer">
117
+ <slot name="footer" ${slotted("footerSlottedContent")}></slot>
118
+ </div>
119
+ </div>
120
+ </div>
87
121
 
88
- class Breadcrumb extends Breadcrumb$1 {}
122
+ </${elevationTag}>
123
+ `;
124
+ };
89
125
 
90
- const breadcrumbDefinition = Breadcrumb.compose({
91
- baseName: 'breadcrumb',
92
- template: breadcrumbTemplate,
93
- styles: css_248z
126
+ const cardDefinition = Card.compose({
127
+ baseName: "card",
128
+ template: CardTemplate,
129
+ styles
94
130
  });
95
- const breadcrumbRegistries = [breadcrumbDefinition()];
96
- const registerBreadcrumb = registerFactory(breadcrumbRegistries);
131
+ const cardRegistries = [cardDefinition(), ...iconRegistries, ...elevationRegistries];
132
+ const registerCard = registerFactory(cardRegistries);
97
133
 
98
- export { breadcrumbRegistries as a, breadcrumbDefinition as b, registerBreadcrumb as r };
134
+ export { cardRegistries as a, cardDefinition as c, registerCard as r };
@@ -1,43 +1,223 @@
1
- import { _ as __decorate, a as attr, b as __metadata, h as html, r as registerFactory } from './index.js';
2
- import { i as iconRegistries } from './definition3.js';
3
- import { f as focusRegistries } from './definition4.js';
4
- import { B as BreadcrumbItem$1 } from './breadcrumb-item.js';
5
- import { t as textAnchorTemplate } from './text-anchor.template.js';
1
+ import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
2
+ import { a as iconRegistries } from './definition24.js';
3
+ import { f as focusRegistries } from './definition55.js';
4
+ import './affix.js';
5
+ import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './index2.js';
6
+ import { C as CheckableFormAssociated } from './form-associated.js';
7
+ import { a as keySpace$1 } from './key-codes.js';
8
+ import { a as applyMixins } from './apply-mixins.js';
9
+ import { f as focusTemplateFactory } from './focus2.js';
6
10
  import { I as Icon } from './icon.js';
7
11
  import { w as when } from './when.js';
12
+ import { s as slotted } from './slotted.js';
8
13
  import { c as classNames } from './class-names.js';
9
14
 
10
- var css_248z = "/**\n * Do not edit directly\n * Generated on Tue, 22 Aug 2023 13:37:39 GMT\n */\n.base {\n display: flex;\n align-items: center;\n color: var(--vvd-color-canvas-text);\n font: var(--vvd-typography-base);\n}\n.base .separator {\n margin: 0 16px;\n color: var(--vvd-color-neutral-600);\n font-size: 12px;\n}\n\n.control {\n position: relative;\n font: inherit;\n}\n@supports selector(:focus-visible) {\n .control:focus-visible {\n outline: none;\n }\n}\n.control:any-link {\n color: var(--vvd-color-cta-600);\n text-decoration: none;\n}\n.control:any-link:hover {\n text-decoration: underline;\n}\n\n.focus-indicator {\n --focus-inset: -4px -8px;\n --focus-stroke-gap-color: transparent;\n border-radius: 6px;\n}\n.control:not(:focus-visible) > .focus-indicator {\n display: none;\n}";
15
+ class _Checkbox extends FoundationElement {
16
+ }
17
+ /**
18
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
19
+ *
20
+ * @internal
21
+ */
22
+ class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.proxy = document.createElement("input");
26
+ }
27
+ }
28
+
29
+ /**
30
+ * A Checkbox Custom HTML Element.
31
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
32
+ *
33
+ * @slot checked-indicator - The checked indicator
34
+ * @slot indeterminate-indicator - The indeterminate indicator
35
+ * @slot - The default slot for the label
36
+ * @csspart control - The element representing the visual checkbox control
37
+ * @csspart label - The label
38
+ * @fires change - Emits a custom change event when the checked state changes
39
+ *
40
+ * @public
41
+ */
42
+ let Checkbox$1 = class Checkbox extends FormAssociatedCheckbox {
43
+ constructor() {
44
+ super();
45
+ /**
46
+ * The element's value to be included in form submission when checked.
47
+ * Default to "on" to reach parity with input[type="checkbox"]
48
+ *
49
+ * @internal
50
+ */
51
+ this.initialValue = "on";
52
+ /**
53
+ * The indeterminate state of the control
54
+ */
55
+ this.indeterminate = false;
56
+ /**
57
+ * @internal
58
+ */
59
+ this.keypressHandler = (e) => {
60
+ if (this.readOnly) {
61
+ return;
62
+ }
63
+ switch (e.key) {
64
+ case keySpace$1:
65
+ if (this.indeterminate) {
66
+ this.indeterminate = false;
67
+ }
68
+ this.checked = !this.checked;
69
+ break;
70
+ }
71
+ };
72
+ /**
73
+ * @internal
74
+ */
75
+ this.clickHandler = (e) => {
76
+ if (!this.disabled && !this.readOnly) {
77
+ if (this.indeterminate) {
78
+ this.indeterminate = false;
79
+ }
80
+ this.checked = !this.checked;
81
+ }
82
+ };
83
+ this.proxy.setAttribute("type", "checkbox");
84
+ }
85
+ readOnlyChanged() {
86
+ if (this.proxy instanceof HTMLInputElement) {
87
+ this.proxy.readOnly = this.readOnly;
88
+ }
89
+ }
90
+ };
91
+ __decorate([
92
+ attr({ attribute: "readonly", mode: "boolean" })
93
+ ], Checkbox$1.prototype, "readOnly", void 0);
94
+ __decorate([
95
+ observable
96
+ ], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
97
+ __decorate([
98
+ observable
99
+ ], Checkbox$1.prototype, "indeterminate", void 0);
100
+
101
+ const styles = "/**\n * Do not edit directly\n * Generated on Wed, 06 Sep 2023 09:40:36 GMT\n */\n.base {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n vertical-align: middle;\n}\n.base.connotation-cta {\n /* @cssprop [--vvd-checkbox-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-checkbox-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-checkbox-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-checkbox-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-checkbox-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-checkbox-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-checkbox-cta-intermediate=var(--vvd-color-cta-500)] */\n --_connotation-color-intermediate: var(--vvd-checkbox-cta-intermediate, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-checkbox-cta-backdrop=var(--vvd-color-cta-50)] */\n --_connotation-color-backdrop: var(--vvd-checkbox-cta-backdrop, var(--vvd-color-cta-50));\n /* @cssprop [--vvd-checkbox-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-checkbox-cta-firm, var(--vvd-color-cta-600));\n}\n.base:not(.connotation-cta) {\n /* @cssprop [--vvd-checkbox-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-checkbox-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-checkbox-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-checkbox-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-checkbox-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-checkbox-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-checkbox-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-checkbox-accent-intermediate, var(--vvd-color-neutral-500));\n /* @cssprop [--vvd-checkbox-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-checkbox-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-checkbox-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-checkbox-accent-firm, var(--vvd-color-canvas-text));\n}\n.base {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.base:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.base:where(:checked, .checked):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: var(--_connotation-color-primary);\n}\n.base:where(:checked, .checked):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: var(--_connotation-color-primary);\n}\n.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n@supports selector(:focus-visible) {\n .base:focus-visible {\n outline: none;\n }\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 pointer-events: none;\n}\n\n.control {\n position: relative;\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n border-radius: 5px;\n box-shadow: inset 0 0 0 2px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n}\n\n.indicator {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) - 4px);\n}\n.base:not(.checked) .indicator.checkmark {\n display: none;\n}\n\n.base.checked .indicator.minus, .base:not(.indeterminate) .indicator.minus {\n display: none;\n}\n\nlabel {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n color: var(--vvd-color-canvas-text);\n column-gap: 4px;\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n.hide-label label {\n display: none;\n}\n\n.focus-indicator {\n --focus-inset: -3px;\n --focus-stroke-gap-color: transparent;\n border-radius: 6px;\n}\n.base:not(:focus-visible) .focus-indicator {\n display: none;\n}\n\n.icon {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 0.6);\n line-height: 1;\n}\n\n.message {\n margin-block-start: 4px;\n --_low-ink-color: var(--vvd-color-neutral-600);\n}";
11
102
 
12
- class BreadcrumbItem extends BreadcrumbItem$1 {
103
+ var __defProp = Object.defineProperty;
104
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
105
+ var __decorateClass = (decorators, target, key, kind) => {
106
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
107
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
108
+ if (decorator = decorators[i])
109
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
110
+ if (kind && result)
111
+ __defProp(target, key, result);
112
+ return result;
113
+ };
114
+ const keySpace = " ";
115
+ let Checkbox = class extends Checkbox$1 {
13
116
  constructor() {
14
- super();
117
+ super(...arguments);
118
+ /**
119
+ * !remove method as will be implemented by fast-foundation in version after 2.46.9
120
+ *
121
+ * @internal
122
+ */
123
+ this.keypressHandler = (event) => {
124
+ if (event.target instanceof HTMLAnchorElement) {
125
+ return true;
126
+ }
127
+ switch (event.key) {
128
+ case keySpace:
129
+ if (this.indeterminate) {
130
+ this.indeterminate = false;
131
+ }
132
+ this.checked = !this.checked;
133
+ break;
134
+ }
135
+ return false;
136
+ };
137
+ /**
138
+ * !remove method as will be implemented by fast-foundation in version after 2.46.9
139
+ *
140
+ * @internal
141
+ */
142
+ this.clickHandler = (event) => {
143
+ if (event.target instanceof HTMLAnchorElement) {
144
+ return true;
145
+ }
146
+ if (!this.disabled && !this.readOnly) {
147
+ if (this.indeterminate) {
148
+ this.indeterminate = false;
149
+ }
150
+ this.checked = !this.checked;
151
+ }
152
+ return false;
153
+ };
15
154
  }
16
- }
17
- __decorate([attr, __metadata("design:type", String)], BreadcrumbItem.prototype, "text", void 0);
155
+ };
156
+ __decorateClass([
157
+ attr
158
+ ], Checkbox.prototype, "connotation", 2);
159
+ __decorateClass([
160
+ observable
161
+ ], Checkbox.prototype, "slottedContent", 2);
162
+ Checkbox = __decorateClass([
163
+ errorText,
164
+ formElements
165
+ ], Checkbox);
166
+ applyMixins(Checkbox, FormElementHelperText, FormElementSuccessText);
18
167
 
19
- const getClasses = _ => classNames('base');
20
- const BreadcrumbItemTemplate = (context, definition) => {
168
+ const getClasses = ({
169
+ connotation,
170
+ readOnly,
171
+ checked,
172
+ disabled,
173
+ indeterminate,
174
+ errorValidationMessage,
175
+ successText,
176
+ label,
177
+ slottedContent
178
+ }) => classNames(
179
+ "base",
180
+ [`connotation-${connotation}`, Boolean(connotation)],
181
+ ["readonly", Boolean(readOnly)],
182
+ ["checked", Boolean(checked) || Boolean(indeterminate)],
183
+ ["disabled", Boolean(disabled)],
184
+ ["error connotation-alert", Boolean(errorValidationMessage)],
185
+ ["success connotation-success", !!successText],
186
+ ["hide-label", !label && !slottedContent?.length]
187
+ );
188
+ const CheckboxTemplate = (context) => {
189
+ const focusTemplate = focusTemplateFactory(context);
21
190
  const iconTag = context.tagFor(Icon);
22
- return html`
23
- <div role="listitem" class="${getClasses}">
24
- ${when(x => x.text && !x.href, html`${x => x.text}`)}
25
-
26
- ${when(x => x.text && x.href && x.href.length > 0, html`${textAnchorTemplate(context)}`)}
27
-
28
- ${when(x => x.separator, html`<${iconTag} class="separator" name="chevron-right-solid"></${iconTag}>`)}
29
- </div>`;
191
+ return html`<div class="${getClasses}"
192
+ role="checkbox"
193
+ aria-checked="${(x) => x.checked}"
194
+ aria-required="${(x) => x.required}"
195
+ aria-disabled="${(x) => x.disabled}"
196
+ aria-readonly="${(x) => x.readOnly}"
197
+ tabindex="${(x) => x.disabled ? null : 0}"
198
+ @keypress="${(x, c) => x.keypressHandler(c.event)}"
199
+ @click="${(x, c) => x.clickHandler(c.event)}">
200
+ <div class="control">
201
+ ${when((x) => x.checked, html`<${iconTag} name="check-solid" class="icon"></${iconTag}>`)}
202
+ ${when((x) => x.indeterminate, html`<${iconTag} name="minus-solid" class="icon"></${iconTag}>`)}
203
+ ${() => focusTemplate}
204
+ </div>
205
+ ${html`<label>${(x) => x.label}<slot ${slotted("slottedContent")}></slot></label>`}
206
+ </div>
207
+ ${when((x) => x.helperText?.length, getFeedbackTemplate("helper", context))}
208
+ ${when((x) => !x.successText && x.errorValidationMessage, getFeedbackTemplate("error", context))}
209
+ ${when((x) => x.successText, getFeedbackTemplate("success", context))}`;
30
210
  };
31
211
 
32
- const breadcrumbItemDefinition = BreadcrumbItem.compose({
33
- baseName: 'breadcrumb-item',
34
- template: BreadcrumbItemTemplate,
35
- styles: css_248z,
212
+ const checkboxDefinition = Checkbox.compose({
213
+ baseName: "checkbox",
214
+ template: CheckboxTemplate,
215
+ styles,
36
216
  shadowOptions: {
37
217
  delegatesFocus: true
38
218
  }
39
219
  });
40
- const breadcrumbItemRegistries = [breadcrumbItemDefinition(), ...iconRegistries, ...focusRegistries];
41
- const registerBreadcrumbItem = registerFactory(breadcrumbItemRegistries);
220
+ const checkboxRegistries = [checkboxDefinition(), ...iconRegistries, ...focusRegistries];
221
+ const registerCheckbox = registerFactory(checkboxRegistries);
42
222
 
43
- export { breadcrumbItemRegistries as a, breadcrumbItemDefinition as b, registerBreadcrumbItem as r };
223
+ export { checkboxRegistries as a, checkboxDefinition as c, registerCheckbox as r };