@vonage/vivid 3.39.0 → 3.41.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 (182) hide show
  1. package/accordion/index.js +2 -2
  2. package/accordion-item/index.js +2 -2
  3. package/alert/index.js +7 -5
  4. package/audio-player/index.js +33 -0
  5. package/avatar/index.js +2 -2
  6. package/badge/index.js +2 -2
  7. package/banner/index.js +9 -5
  8. package/breadcrumb/index.js +1 -1
  9. package/breadcrumb-item/index.js +3 -3
  10. package/button/index.js +5 -4
  11. package/calendar/index.js +1 -1
  12. package/calendar-event/index.js +1 -1
  13. package/card/index.js +4 -3
  14. package/checkbox/index.js +3 -3
  15. package/combobox/index.js +9 -7
  16. package/custom-elements.json +809 -5
  17. package/data-grid/index.js +3 -2
  18. package/date-picker/index.js +11 -9
  19. package/date-range-picker/index.js +11 -9
  20. package/dialog/index.js +10 -6
  21. package/divider/index.js +1 -1
  22. package/elevation/index.js +1 -1
  23. package/empty-state/index.js +2 -2
  24. package/fab/index.js +3 -3
  25. package/file-picker/index.js +6 -5
  26. package/focus/index.js +1 -1
  27. package/header/index.js +2 -2
  28. package/icon/index.js +1 -1
  29. package/index.js +60 -55
  30. package/layout/index.js +1 -1
  31. package/lib/alert/alert.d.ts +3 -1
  32. package/lib/alert/locale.d.ts +3 -0
  33. package/lib/audio-player/audio-player.d.ts +17 -0
  34. package/lib/audio-player/audio-player.template.d.ts +4 -0
  35. package/lib/audio-player/definition.d.ts +4 -0
  36. package/lib/audio-player/locale.d.ts +5 -0
  37. package/lib/banner/banner.d.ts +3 -1
  38. package/lib/banner/locale.d.ts +3 -0
  39. package/lib/card/card.d.ts +3 -0
  40. package/lib/card/card.template.d.ts +1 -1
  41. package/lib/card/definition.d.ts +1 -0
  42. package/lib/checkbox/checkbox.d.ts +2 -0
  43. package/lib/components.d.ts +2 -0
  44. package/lib/dialog/dialog.d.ts +4 -0
  45. package/lib/dialog/locale.d.ts +3 -0
  46. package/lib/enums.d.ts +2 -1
  47. package/lib/menu/menu.d.ts +1 -0
  48. package/lib/number-field/locale.d.ts +4 -0
  49. package/lib/number-field/number-field.d.ts +4 -2
  50. package/lib/progress/progress.d.ts +1 -0
  51. package/lib/progress-ring/progress-ring.d.ts +1 -0
  52. package/lib/radio/radio.d.ts +1 -0
  53. package/lib/selectable-box/definition.d.ts +3 -0
  54. package/lib/selectable-box/selectable-box.d.ts +12 -0
  55. package/lib/selectable-box/selectable-box.template.d.ts +4 -0
  56. package/lib/slider/definition.d.ts +1 -0
  57. package/lib/slider/slider.d.ts +5 -0
  58. package/lib/split-button/locale.d.ts +3 -0
  59. package/lib/split-button/split-button.d.ts +3 -1
  60. package/lib/text-area/text-area.d.ts +3 -0
  61. package/lib/text-field/text-field.d.ts +5 -2
  62. package/listbox/index.js +5 -4
  63. package/locales/en-GB.js +21 -0
  64. package/locales/en-US.js +21 -0
  65. package/locales/ja-JP.js +21 -0
  66. package/locales/zh-CN.js +21 -0
  67. package/menu/index.js +9 -8
  68. package/menu-item/index.js +3 -3
  69. package/nav/index.js +1 -1
  70. package/nav-disclosure/index.js +3 -3
  71. package/nav-item/index.js +3 -3
  72. package/note/index.js +2 -2
  73. package/number-field/index.js +8 -6
  74. package/option/index.js +3 -3
  75. package/package.json +1 -1
  76. package/pagination/index.js +6 -5
  77. package/popup/index.js +7 -6
  78. package/progress/index.js +1 -1
  79. package/progress-ring/index.js +1 -1
  80. package/radio/index.js +2 -2
  81. package/radio-group/index.js +2 -2
  82. package/select/index.js +10 -8
  83. package/selectable-box/index.js +23 -0
  84. package/shared/Reflector.js +65 -0
  85. package/shared/date-picker/calendar/segment.d.ts +21 -0
  86. package/shared/date-picker/date-picker-base.d.ts +1 -0
  87. package/shared/definition.js +3 -3
  88. package/shared/definition10.js +89 -227
  89. package/shared/definition11.js +151 -29
  90. package/shared/definition12.js +37 -766
  91. package/shared/definition13.js +747 -106
  92. package/shared/definition14.js +122 -192
  93. package/shared/definition15.js +156 -664
  94. package/shared/definition16.js +576 -1123
  95. package/shared/definition17.js +1278 -143
  96. package/shared/definition18.js +64 -298
  97. package/shared/definition19.js +358 -211
  98. package/shared/definition2.js +2 -2
  99. package/shared/definition20.js +259 -67
  100. package/shared/definition21.js +66 -58
  101. package/shared/definition22.js +43 -84
  102. package/shared/definition23.js +76 -2352
  103. package/shared/definition24.js +2362 -45
  104. package/shared/definition25.js +63 -27
  105. package/shared/definition26.js +24 -51
  106. package/shared/definition27.js +36 -813
  107. package/shared/definition28.js +837 -49
  108. package/shared/definition29.js +52 -89
  109. package/shared/definition3.js +1 -1
  110. package/shared/definition30.js +88 -24
  111. package/shared/definition31.js +25 -12
  112. package/shared/definition32.js +12 -52
  113. package/shared/definition33.js +28 -487
  114. package/shared/definition34.js +442 -197
  115. package/shared/definition35.js +260 -185
  116. package/shared/definition36.js +188 -69
  117. package/shared/definition37.js +72 -52
  118. package/shared/definition38.js +65 -421
  119. package/shared/definition39.js +435 -35
  120. package/shared/definition4.js +44 -16
  121. package/shared/definition40.js +32 -680
  122. package/shared/definition41.js +661 -77
  123. package/shared/definition42.js +103 -555
  124. package/shared/definition43.js +76 -103
  125. package/shared/definition44.js +522 -87
  126. package/shared/definition45.js +133 -22
  127. package/shared/definition46.js +131 -58
  128. package/shared/definition47.js +16 -501
  129. package/shared/definition48.js +69 -23
  130. package/shared/definition49.js +477 -108
  131. package/shared/definition5.js +160 -44
  132. package/shared/definition50.js +25 -271
  133. package/shared/definition51.js +103 -122
  134. package/shared/definition52.js +277 -122
  135. package/shared/definition53.js +274 -103
  136. package/shared/definition54.js +126 -71
  137. package/shared/definition55.js +128 -294
  138. package/shared/definition56.js +91 -13
  139. package/shared/definition57.js +298 -39
  140. package/shared/definition58.js +11 -175
  141. package/shared/definition59.js +47 -0
  142. package/shared/definition6.js +43 -33
  143. package/shared/definition60.js +181 -0
  144. package/shared/definition7.js +39 -105
  145. package/shared/definition8.js +122 -38
  146. package/shared/definition9.js +56 -89
  147. package/shared/enums.js +72 -0
  148. package/shared/icon.js +2 -2
  149. package/shared/index2.js +28 -1
  150. package/shared/key-codes.js +1 -1
  151. package/shared/key-codes2.js +9 -0
  152. package/shared/listbox.js +3 -8
  153. package/shared/localization/Locale.d.ts +12 -0
  154. package/shared/patterns/form-elements/form-elements.d.ts +6 -6
  155. package/shared/presentationDate.js +196 -143
  156. package/shared/radio.js +7 -0
  157. package/shared/text-field.js +1 -1
  158. package/shared/utils/Reflector.d.ts +8 -0
  159. package/shared/utils/randomId.d.ts +1 -0
  160. package/side-drawer/index.js +1 -1
  161. package/slider/index.js +3 -3
  162. package/split-button/index.js +6 -3
  163. package/style.css +889 -722
  164. package/styles/core/all.css +1 -1
  165. package/styles/core/theme.css +1 -1
  166. package/styles/core/typography.css +1 -1
  167. package/styles/tokens/theme-dark.css +4 -4
  168. package/styles/tokens/theme-light.css +4 -4
  169. package/styles/tokens/vivid-2-compat.css +1 -1
  170. package/switch/index.js +3 -3
  171. package/tab/index.js +3 -3
  172. package/tab-panel/index.js +1 -1
  173. package/tabs/index.js +5 -5
  174. package/tag/index.js +3 -3
  175. package/tag-group/index.js +1 -1
  176. package/text-area/index.js +4 -3
  177. package/text-field/index.js +4 -3
  178. package/toggletip/index.js +8 -7
  179. package/tooltip/index.js +8 -7
  180. package/tree-item/index.js +3 -3
  181. package/tree-view/index.js +1 -1
  182. package/vivid.api.json +392 -0
@@ -1,104 +1,13 @@
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 './definition25.js';
3
- import { f as focusRegistries } from './definition56.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';
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 './definition26.js';
3
+ import { E as Elevation, e as elevationRegistries } from './definition59.js';
4
+ import { A as Appearance } from './enums.js';
10
5
  import { I as Icon } from './icon.js';
11
6
  import { w as when } from './when.js';
12
7
  import { s as slotted } from './slotted.js';
13
8
  import { c as classNames } from './class-names.js';
14
9
 
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 Tue, 17 Oct 2023 15:27:52 GMT\n */\n:host([disabled]) {\n cursor: not-allowed;\n}\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 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}";
10
+ const styles = "/**\n * Do not edit directly\n * Generated on Wed, 22 Nov 2023 16:09:43 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}";
102
11
 
103
12
  var __defProp = Object.defineProperty;
104
13
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -111,113 +20,134 @@ var __decorateClass = (decorators, target, key, kind) => {
111
20
  __defProp(target, key, result);
112
21
  return result;
113
22
  };
114
- const keySpace = " ";
115
- let Checkbox = class extends Checkbox$1 {
116
- constructor() {
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
- };
154
- }
155
- };
23
+ class Card extends FoundationElement {
24
+ }
25
+ __decorateClass([
26
+ attr
27
+ ], Card.prototype, "appearance", 2);
28
+ __decorateClass([
29
+ attr
30
+ ], Card.prototype, "headline", 2);
31
+ __decorateClass([
32
+ attr
33
+ ], Card.prototype, "subtitle", 2);
34
+ __decorateClass([
35
+ attr
36
+ ], Card.prototype, "text", 2);
37
+ __decorateClass([
38
+ attr
39
+ ], Card.prototype, "icon", 2);
156
40
  __decorateClass([
157
41
  attr
158
- ], Checkbox.prototype, "connotation", 2);
42
+ ], Card.prototype, "elevation", 2);
159
43
  __decorateClass([
160
44
  observable
161
- ], Checkbox.prototype, "slottedContent", 2);
162
- Checkbox = __decorateClass([
163
- errorText,
164
- formElements
165
- ], Checkbox);
166
- applyMixins(Checkbox, FormElementHelperText, FormElementSuccessText);
45
+ ], Card.prototype, "footerSlottedContent", 2);
46
+ __decorateClass([
47
+ observable
48
+ ], Card.prototype, "graphicSlottedContent", 2);
49
+ __decorateClass([
50
+ observable
51
+ ], Card.prototype, "hasMetaSlottedContent", 2);
167
52
 
168
- const getClasses = ({
169
- connotation,
170
- readOnly,
171
- checked,
172
- disabled,
173
- indeterminate,
174
- errorValidationMessage,
175
- successText,
176
- label,
177
- slottedContent
178
- }) => classNames(
53
+ const getClasses = (_) => classNames(
179
54
  "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]
55
+ ["hide-footer", !_.footerSlottedContent || !_.footerSlottedContent.length],
56
+ ["hide-header", shouldHideHeader(_)]
187
57
  );
188
- const CheckboxTemplate = (context) => {
189
- const focusTemplate = focusTemplateFactory(context);
58
+ function renderHeaderIcon(iconTag) {
59
+ return html`
60
+ <${iconTag} class="icon" inline name="${(x) => x.icon}"></${iconTag}>`;
61
+ }
62
+ function Headline() {
63
+ return html`
64
+ <div class="header-headline">${(x) => x.headline}</div>
65
+ `;
66
+ }
67
+ function Subtitle() {
68
+ return html`
69
+ <div class="header-subtitle">${(x) => x.subtitle}</div>
70
+ `;
71
+ }
72
+ function headerContent() {
73
+ return html`
74
+ <div class="header-content">
75
+ ${when((x) => x.headline, Headline())}
76
+ ${when((x) => x.subtitle, Subtitle())}
77
+ </div>
78
+ `;
79
+ }
80
+ function renderHeader(iconTag) {
81
+ return html`
82
+ <header class="header">
83
+ <slot name="graphic" ${slotted("graphicSlottedContent")}>${when((x) => x.icon, renderHeaderIcon(iconTag))}</slot>
84
+ ${when((x) => x.headline || x.subtitle, headerContent())}
85
+ </header>`;
86
+ }
87
+ function shouldHideHeader(card) {
88
+ return !card.headline && !card.subtitle && !card.icon && (!card.graphicSlottedContent || !card.graphicSlottedContent.length);
89
+ }
90
+ function renderMetaSlot() {
91
+ return html`
92
+ <slot name="meta" ${slotted("metaSlottedContent")}></slot>
93
+ `;
94
+ }
95
+ function text() {
96
+ return html`
97
+ <div class="text">${(x) => x.text}</div>
98
+ `;
99
+ }
100
+ function renderCardContent(context) {
190
101
  const iconTag = context.tagFor(Icon);
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}
102
+ return html`
103
+ <div class="${getClasses}">
104
+ <div class="wrapper">
105
+ <div class="vwc-card-media">
106
+ <slot name="media"></slot>
107
+ </div>
108
+ <slot name="main">
109
+ <div class="main-content">
110
+ <div class="header-wrapper">
111
+ ${renderHeader(iconTag)}
112
+ ${renderMetaSlot()}
113
+ </div>
114
+ ${when((x) => x.text, text())}
115
+ </div>
116
+ </slot>
117
+ <div class="footer">
118
+ <slot name="footer" ${slotted("footerSlottedContent")}></slot>
119
+ </div>
204
120
  </div>
205
- ${html`<label>${(x) => x.label}<slot ${slotted("slottedContent")}></slot></label>`}
206
121
  </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))}`;
122
+ `;
123
+ }
124
+ const CardTemplate = (context) => {
125
+ const elevationTag = context.tagFor(Elevation);
126
+ return html`
127
+ ${when((x) => x.appearance !== Appearance.Ghost && x.appearance !== Appearance.Outlined, html`
128
+ <${elevationTag} dp=${(x) => x.elevation ?? "4"}>
129
+ ${renderCardContent(context)}
130
+ </${elevationTag}>
131
+ `)}
132
+
133
+ ${when((x) => x.appearance === Appearance.Outlined, html`
134
+ <${elevationTag} dp='0')}>
135
+ ${renderCardContent(context)}
136
+ </${elevationTag}>
137
+ `)}
138
+
139
+ ${when((x) => x.appearance === Appearance.Ghost, html`
140
+ ${renderCardContent(context)}
141
+ `)}
142
+ `;
210
143
  };
211
144
 
212
- const checkboxDefinition = Checkbox.compose({
213
- baseName: "checkbox",
214
- template: CheckboxTemplate,
215
- styles,
216
- shadowOptions: {
217
- delegatesFocus: true
218
- }
145
+ const cardDefinition = Card.compose({
146
+ baseName: "card",
147
+ template: CardTemplate,
148
+ styles
219
149
  });
220
- const checkboxRegistries = [checkboxDefinition(), ...iconRegistries, ...focusRegistries];
221
- const registerCheckbox = registerFactory(checkboxRegistries);
150
+ const cardRegistries = [cardDefinition(), ...iconRegistries, ...elevationRegistries];
151
+ const registerCard = registerFactory(cardRegistries);
222
152
 
223
- export { checkboxRegistries as a, checkboxDefinition as c, registerCheckbox as r };
153
+ export { cardRegistries as a, cardDefinition as c, registerCard as r };