@vonage/vivid 5.4.0 → 5.5.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 (161) hide show
  1. package/bundled/base-color-picker.cjs +18 -13
  2. package/bundled/base-color-picker.js +98 -81
  3. package/bundled/calendar-picker.template.cjs +1 -1
  4. package/bundled/calendar-picker.template.js +2 -2
  5. package/bundled/char-count.cjs +1 -1
  6. package/bundled/char-count.js +1 -1
  7. package/bundled/definition10.cjs +1 -1
  8. package/bundled/definition10.js +2 -2
  9. package/bundled/definition11.cjs +12 -19
  10. package/bundled/definition11.js +73 -204
  11. package/bundled/definition12.cjs +19 -10
  12. package/bundled/definition12.js +217 -36
  13. package/bundled/definition13.cjs +10 -1
  14. package/bundled/definition13.js +38 -14
  15. package/bundled/definition14.cjs +1 -5
  16. package/bundled/definition14.js +15 -24
  17. package/bundled/definition15.cjs +5 -30
  18. package/bundled/definition15.js +22 -73
  19. package/bundled/definition16.cjs +30 -19
  20. package/bundled/definition16.js +74 -97
  21. package/bundled/definition17.cjs +19 -13
  22. package/bundled/definition17.js +83 -117
  23. package/bundled/definition18.cjs +13 -12
  24. package/bundled/definition18.js +114 -71
  25. package/bundled/definition19.cjs +16 -16
  26. package/bundled/definition19.js +87 -84
  27. package/bundled/definition2.cjs +9 -9
  28. package/bundled/definition2.js +84 -129
  29. package/bundled/definition3.cjs +1 -1
  30. package/bundled/definition3.js +1 -1
  31. package/bundled/listbox.cjs +1 -1
  32. package/bundled/listbox.js +1 -1
  33. package/bundled/localized.cjs +1 -1
  34. package/bundled/localized.js +48 -35
  35. package/bundled/mixins.cjs +1 -1
  36. package/bundled/mixins.js +1 -1
  37. package/bundled/picker-field.template.cjs +14 -14
  38. package/bundled/picker-field.template.js +35 -56
  39. package/bundled/time-selection-picker.template.cjs +12 -12
  40. package/bundled/time-selection-picker.template.js +13 -12
  41. package/bundled/trapped-focus.cjs +1 -0
  42. package/bundled/trapped-focus.js +26 -0
  43. package/bundled/vivid-element.cjs +1 -1
  44. package/bundled/vivid-element.js +1 -1
  45. package/calendar/index.cjs +13 -13
  46. package/calendar/index.js +172 -144
  47. package/color-picker/definition.cjs +208 -112
  48. package/color-picker/definition.js +208 -112
  49. package/color-picker/index.cjs +104 -75
  50. package/color-picker/index.js +412 -326
  51. package/combobox/index.cjs +1 -1
  52. package/combobox/index.js +1 -1
  53. package/contextual-help/index.cjs +1 -1
  54. package/contextual-help/index.js +1 -1
  55. package/custom-elements.json +49 -0
  56. package/data-grid/index.cjs +1 -1
  57. package/data-grid/index.js +1 -1
  58. package/date-picker/index.cjs +1 -1
  59. package/date-picker/index.js +2 -2
  60. package/date-range-picker/index.cjs +1 -1
  61. package/date-range-picker/index.js +2 -2
  62. package/date-time-picker/index.cjs +1 -1
  63. package/date-time-picker/index.js +2 -2
  64. package/dial-pad/definition.cjs +139 -0
  65. package/dial-pad/definition.js +139 -0
  66. package/dial-pad/index.cjs +27 -20
  67. package/dial-pad/index.js +177 -100
  68. package/divider/index.cjs +1 -1
  69. package/divider/index.js +1 -1
  70. package/icon/definition.cjs +56 -22
  71. package/icon/definition.js +56 -22
  72. package/lib/color-picker/color-picker.d.ts +390 -12
  73. package/lib/color-picker/locale.d.ts +4 -0
  74. package/lib/date-picker/date-picker.d.ts +38 -38
  75. package/lib/date-range-picker/date-range-picker.d.ts +20 -20
  76. package/lib/date-time-picker/date-time-picker.d.ts +40 -40
  77. package/lib/dial-pad/dial-pad.d.ts +1 -0
  78. package/lib/icon/icon.d.ts +1 -0
  79. package/lib/simple-color-picker/simple-color-picker.d.ts +2 -1
  80. package/lib/time-picker/time-picker.d.ts +20 -20
  81. package/locales/de-DE.cjs +16 -3
  82. package/locales/de-DE.js +16 -3
  83. package/locales/en-GB.cjs +17 -4
  84. package/locales/en-GB.js +17 -4
  85. package/locales/en-US.cjs +17 -4
  86. package/locales/en-US.js +17 -4
  87. package/locales/ja-JP.cjs +16 -3
  88. package/locales/ja-JP.js +16 -3
  89. package/locales/zh-CN.cjs +15 -2
  90. package/locales/zh-CN.js +15 -2
  91. package/number-field/index.cjs +1 -1
  92. package/number-field/index.js +3 -3
  93. package/option/index.cjs +1 -1
  94. package/option/index.js +1 -1
  95. package/package.json +1 -1
  96. package/progress-ring/index.cjs +1 -1
  97. package/progress-ring/index.js +1 -1
  98. package/radio/index.cjs +1 -1
  99. package/radio/index.js +1 -1
  100. package/radio-group/index.cjs +1 -1
  101. package/radio-group/index.js +1 -1
  102. package/rich-text-editor/index.cjs +1 -1
  103. package/rich-text-editor/index.js +3 -3
  104. package/searchable-select/index.cjs +1 -1
  105. package/searchable-select/index.js +3 -3
  106. package/select/definition.cjs +6 -3
  107. package/select/definition.js +6 -3
  108. package/selectable-box/index.cjs +1 -1
  109. package/selectable-box/index.js +1 -1
  110. package/shared/color-picker/base-color-picker.d.ts +2 -1
  111. package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
  112. package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
  113. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
  114. package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
  115. package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
  116. package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
  117. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
  118. package/simple-color-picker/definition.cjs +8 -6
  119. package/simple-color-picker/definition.js +8 -6
  120. package/simple-color-picker/index.cjs +6 -6
  121. package/simple-color-picker/index.js +41 -39
  122. package/styles/core/all.css +1 -1
  123. package/styles/core/theme.css +1 -1
  124. package/styles/core/typography.css +1 -1
  125. package/styles/tokens/theme-dark.css +4 -4
  126. package/styles/tokens/theme-light.css +4 -4
  127. package/styles/tokens/vivid-2-compat.css +1 -1
  128. package/tag/definition.cjs +34 -14
  129. package/tag/definition.js +34 -14
  130. package/tag/index.cjs +25 -12
  131. package/tag/index.js +64 -47
  132. package/tag-group/definition.cjs +1 -2
  133. package/tag-group/definition.js +1 -2
  134. package/tag-group/index.cjs +1 -1
  135. package/tag-group/index.js +11 -12
  136. package/text-area/index.cjs +1 -1
  137. package/text-area/index.js +2 -2
  138. package/time-picker/index.cjs +1 -1
  139. package/time-picker/index.js +1 -1
  140. package/toggletip/index.cjs +1 -1
  141. package/toggletip/index.js +1 -1
  142. package/tooltip/definition.cjs +2 -2
  143. package/tooltip/definition.js +2 -2
  144. package/tooltip/index.cjs +1 -1
  145. package/tooltip/index.js +1 -1
  146. package/unbundled/base-color-picker.cjs +36 -18
  147. package/unbundled/base-color-picker.js +36 -18
  148. package/unbundled/calendar-picker.template.cjs +1 -1
  149. package/unbundled/calendar-picker.template.js +1 -1
  150. package/unbundled/picker-field.template.cjs +2 -35
  151. package/unbundled/picker-field.template.js +2 -34
  152. package/unbundled/time-selection-picker.template.cjs +2 -1
  153. package/unbundled/time-selection-picker.template.js +2 -1
  154. package/unbundled/trapped-focus.cjs +37 -0
  155. package/unbundled/trapped-focus.js +34 -0
  156. package/unbundled/vivid-element.cjs +1 -1
  157. package/unbundled/vivid-element.js +1 -1
  158. package/visually-hidden/index.cjs +1 -1
  159. package/visually-hidden/index.js +1 -1
  160. package/bundled/_has.cjs +0 -1
  161. package/bundled/_has.js +0 -34
@@ -1,133 +1,136 @@
1
- import { V as ee, a as x, o as G, n as te, h as n, c as oe, d as se } from "../bundled/vivid-element.js";
2
- import { P as re, p as ae } from "../bundled/definition9.js";
1
+ import { V as ee, a as y, o as L, n as te, h as n, c as oe, d as re } from "../bundled/vivid-element.js";
2
+ import { P as se, p as ae } from "../bundled/definition9.js";
3
3
  import { I as ie, i as le } from "../bundled/definition2.js";
4
4
  import { W as ne, f as ce } from "../bundled/mixins.js";
5
5
  import { D as de, d as pe } from "../bundled/delegates-aria.js";
6
- import { B as he, i as f } from "../bundled/base-color-picker.js";
7
- import { W as ue } from "../bundled/with-contextual-help.js";
8
- import { W as ve } from "../bundled/with-error-text.js";
9
- import { W as fe } from "../bundled/with-success-text.js";
10
- import { T as be, t as me } from "../bundled/definition10.js";
11
- import { B as ge, b as xe } from "../bundled/definition3.js";
12
- import { r as u } from "../bundled/ref.js";
13
- import { w as J } from "../bundled/when.js";
14
- import { s as L } from "../bundled/slotted.js";
15
- import { r as Ce } from "../bundled/repeat.js";
16
- import { c as M } from "../bundled/class-names.js";
17
- const ye = ".palette{display:grid;grid-template-columns:repeat(var(--swatches-per-row, 7),var(--_color-swatch-size, 24px))}.swatch{position:relative;padding:0;border:none;border-radius:4px;background-color:var(--swatch-color);block-size:var(--_color-swatch-size, 24px);color:var(--vvd-color-canvas);cursor:pointer;inline-size:var(--_color-swatch-size, 24px)}.swatch.contrast{color:var(--vvd-color-canvas-text)}.swatch:focus-visible{outline:none;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--focus-inset: -3px}:host{display:inline-block}.base{display:inline-block;min-inline-size:var(--_color-picker-min-inline-size, 280px)}.control{inline-size:100%}.button{display:inline-flex;box-sizing:border-box;align-items:center;border:0 none;border-radius:4px;margin:0;background-color:var(--button-color, var(--vvd-color-canvas-text));block-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)));color:var(--vvd-color-canvas);inline-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-inline:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/4);text-decoration:none;vertical-align:middle}.button.contrast{color:var(--vvd-color-canvas-text)}.button:not(.disabled){cursor:pointer}.button.disabled{background-color:var(--vvd-color-neutral-300);color:var(--vvd-color-neutral-500);cursor:not-allowed}.button:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.button [data-vvd-component=icon]{font-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2);line-height:1}.dialog{display:flex;flex-direction:column;min-inline-size:var(--_color-picker-popup-min-inline-size, 264px)}.dialog .header{display:inline-flex;align-items:center;justify-content:space-between;padding-block:8px;padding-inline:16px}.dialog .header-title{font:var(--vvd-typography-base-extended-bold)}.dialog .body{display:flex;flex-direction:column;gap:16px;margin-block-end:16px;padding-inline:16px}.dialog .hex-input-wrapper{display:flex;align-items:stretch;gap:8px}.dialog .hex-input-wrapper [data-vvd-component=button]{flex:0 0 auto}.dialog .footer{padding:16px;border-top:1px solid var(--vvd-color-neutral-200)}.dialog .footer-title{display:block;margin-block-end:8px}.dialog .palette{gap:var(--_color-swatches-gap, 8px)}vvd-hex-input{min-width:0;flex:1 1 auto}vvd-hex-input::part(input){width:100%;height:100%;box-sizing:border-box;border:0 none;border-radius:8px;background-color:var(--vvd-color-canvas);box-shadow:inset 0 0 0 1px var(--vvd-color-neutral-500);font:var(--vvd-typography-base);outline:transparent;padding-inline:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))*.4)}vvd-hex-input::part(input):focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}vvd-hex-picker{width:auto;height:auto;gap:16px;inline-size:100%}vvd-hex-picker::part(saturation){border-radius:8px;block-size:120px}vvd-hex-picker::part(hue){flex:0 0 8px;border-radius:8px}vvd-hex-picker::part(hue-pointer){width:10px;height:10px}vvd-hex-picker::part(saturation-pointer){width:18px;height:18px}::part(popup-base){inline-size:max-content;min-block-size:var(--_color-picker-popup-min-inline-size, 264px);min-inline-size:var(--_color-picker-popup-min-inline-size, 264px)}", v = (o, e = 0, t = 1) => o > t ? t : o < e ? e : o, l = (o, e = 0, t = Math.pow(10, e)) => Math.round(t * o) / t, $e = (o) => Ee(E(o)), E = (o) => (o[0] === "#" && (o = o.substring(1)), o.length < 6 ? {
18
- r: parseInt(o[0] + o[0], 16),
19
- g: parseInt(o[1] + o[1], 16),
20
- b: parseInt(o[2] + o[2], 16),
21
- a: o.length === 4 ? l(parseInt(o[3] + o[3], 16) / 255, 2) : 1
6
+ import { h as he } from "../bundled/index.js";
7
+ import { B as ue, i as b } from "../bundled/base-color-picker.js";
8
+ import { W as ve } from "../bundled/with-contextual-help.js";
9
+ import { W as fe } from "../bundled/with-error-text.js";
10
+ import { W as be } from "../bundled/with-success-text.js";
11
+ import { T as me } from "../bundled/trapped-focus.js";
12
+ import { T as ge, t as xe } from "../bundled/definition10.js";
13
+ import { B as ye, b as Ce } from "../bundled/definition3.js";
14
+ import { T as $e, t as ke } from "../bundled/definition11.js";
15
+ import { r as v } from "../bundled/ref.js";
16
+ import { w as E } from "../bundled/when.js";
17
+ import { s as F } from "../bundled/slotted.js";
18
+ import { r as we } from "../bundled/repeat.js";
19
+ import { c as N } from "../bundled/class-names.js";
20
+ const _e = ".palette{display:grid;grid-template-columns:repeat(var(--swatches-per-row, 7),var(--_color-swatch-size, 24px))}.swatch{position:relative;padding:0;border-radius:4px;background-color:var(--swatch-color);block-size:var(--_color-swatch-size, 24px);color:var(--vvd-color-canvas);cursor:pointer;inline-size:var(--_color-swatch-size, 24px)}.swatch:not(.contrast){border:none}.swatch.contrast{border:1px solid var(--vvd-color-neutral-400);color:var(--vvd-color-canvas-text)}.swatch:focus-visible{outline:none;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--focus-inset: -3px}:host{display:inline-block;--_low-ink-color: var(--vvd-color-neutral-600)}.base{display:inline-block;min-inline-size:var(--_color-picker-min-inline-size, 280px)}.control{inline-size:100%}.button{display:inline-flex;box-sizing:border-box;align-items:center;border:0 none;border-radius:4px;margin:0;background-color:var(--button-color, var(--vvd-color-canvas-text));block-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)));color:var(--vvd-color-canvas);inline-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2)));padding-inline:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/4);text-decoration:none;vertical-align:middle}.button.contrast{color:var(--vvd-color-canvas-text)}.button:not(.disabled){cursor:pointer}.button.disabled{background-color:var(--vvd-color-neutral-300);color:var(--vvd-color-neutral-500);cursor:not-allowed}.button:focus-visible{--focus-stroke-gap-color: transparent;box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px))}.button [data-vvd-component=icon]{font-size:calc(1px*(32 + 4*clamp(-1,var(--vvd-size-density, 0),2))/2);line-height:1}.dialog{display:flex;flex-direction:column;min-inline-size:var(--_color-picker-popup-min-inline-size, 264px)}.dialog .header{display:inline-flex;align-items:center;justify-content:space-between;padding-block:8px;padding-inline:16px}.dialog .header-title{font:var(--vvd-typography-base-extended-bold);margin-block:0}.dialog .body{display:flex;flex-direction:column;gap:16px;margin-block-end:16px;padding-inline:16px}.dialog .hex-input-wrapper{display:flex;align-items:stretch;gap:8px}.dialog .hex-input-wrapper [data-vvd-component=button]{flex:0 0 auto}.dialog .footer{padding:16px;border-top:1px solid var(--vvd-color-neutral-200)}.dialog .footer-header{margin-block-end:8px}.dialog .swatches-count{color:var(--_low-ink-color);font:var(--vvd-typography-base)}.dialog .palette{gap:var(--_color-swatches-gap, 8px)}vvd-hex-input{min-width:0;flex:1 1 auto}vvd-hex-input::part(input),vvd-hex-input>input{width:100%;height:100%;box-sizing:border-box;border:0 none;border-radius:8px;background-color:var(--vvd-color-canvas);box-shadow:inset 0 0 0 1px var(--vvd-color-neutral-500);font:var(--vvd-typography-base);outline:transparent;padding-inline:calc(1px*(40 + 4*clamp(-1,var(--vvd-size-density, 0),2))*.4)}vvd-hex-input::part(input):focus-visible,vvd-hex-input>input:focus-visible{box-shadow:0 0 0 4px color-mix(in srgb,var(--vvd-color-cta-500),transparent 85%),inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:1px solid var(--focus-stroke-color, var(--vvd-color-cta-500));outline-offset:calc(-1px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent}vvd-hex-picker{width:auto;height:auto;gap:16px;inline-size:100%}vvd-hex-picker::part(saturation){border-radius:8px;block-size:120px}vvd-hex-picker::part(hue){flex:0 0 8px;border-radius:8px}vvd-hex-picker::part(hue-pointer){width:10px;height:10px}vvd-hex-picker::part(saturation-pointer){width:18px;height:18px}::part(popup-base){inline-size:max-content;min-block-size:var(--_color-picker-popup-min-inline-size, 264px);min-inline-size:var(--_color-picker-popup-min-inline-size, 264px)}.visually-hidden{position:absolute;overflow:hidden;width:1px;height:1px;padding:0;border:0;margin:-1px;clip:rect(0 0 0 0)}", f = (r, e = 0, o = 1) => r > o ? o : r < e ? e : r, l = (r, e = 0, o = Math.pow(10, e)) => Math.round(o * r) / o, Se = (r) => Ie(P(r)), P = (r) => (r[0] === "#" && (r = r.substring(1)), r.length < 6 ? {
21
+ r: parseInt(r[0] + r[0], 16),
22
+ g: parseInt(r[1] + r[1], 16),
23
+ b: parseInt(r[2] + r[2], 16),
24
+ a: r.length === 4 ? l(parseInt(r[3] + r[3], 16) / 255, 2) : 1
22
25
  } : {
23
- r: parseInt(o.substring(0, 2), 16),
24
- g: parseInt(o.substring(2, 4), 16),
25
- b: parseInt(o.substring(4, 6), 16),
26
- a: o.length === 8 ? l(parseInt(o.substring(6, 8), 16) / 255, 2) : 1
27
- }), ke = (o) => Se(_e(o)), we = ({ h: o, s: e, v: t, a: s }) => {
28
- const r = (200 - e) * t / 100;
26
+ r: parseInt(r.substring(0, 2), 16),
27
+ g: parseInt(r.substring(2, 4), 16),
28
+ b: parseInt(r.substring(4, 6), 16),
29
+ a: r.length === 8 ? l(parseInt(r.substring(6, 8), 16) / 255, 2) : 1
30
+ }), Ee = (r) => He(Te(r)), Pe = ({ h: r, s: e, v: o, a: t }) => {
31
+ const s = (200 - e) * o / 100;
29
32
  return {
30
- h: l(o),
31
- s: l(r > 0 && r < 200 ? e * t / 100 / (r <= 100 ? r : 200 - r) * 100 : 0),
32
- l: l(r / 2),
33
- a: l(s, 2)
33
+ h: l(r),
34
+ s: l(s > 0 && s < 200 ? e * o / 100 / (s <= 100 ? s : 200 - s) * 100 : 0),
35
+ l: l(s / 2),
36
+ a: l(t, 2)
34
37
  };
35
- }, H = (o) => {
36
- const { h: e, s: t, l: s } = we(o);
37
- return `hsl(${e}, ${t}%, ${s}%)`;
38
- }, _e = ({ h: o, s: e, v: t, a: s }) => {
39
- o = o / 360 * 6, e = e / 100, t = t / 100;
40
- const r = Math.floor(o), a = t * (1 - e), i = t * (1 - (o - r) * e), C = t * (1 - (1 - o + r) * e), y = r % 6;
38
+ }, T = (r) => {
39
+ const { h: e, s: o, l: t } = Pe(r);
40
+ return `hsl(${e}, ${o}%, ${t}%)`;
41
+ }, Te = ({ h: r, s: e, v: o, a: t }) => {
42
+ r = r / 360 * 6, e = e / 100, o = o / 100;
43
+ const s = Math.floor(r), i = o * (1 - e), a = o * (1 - (r - s) * e), d = o * (1 - (1 - r + s) * e), C = s % 6;
41
44
  return {
42
- r: l([t, i, a, a, C, t][y] * 255),
43
- g: l([C, t, t, i, a, a][y] * 255),
44
- b: l([a, a, C, t, t, i][y] * 255),
45
- a: l(s, 2)
45
+ r: l([o, a, i, i, d, o][C] * 255),
46
+ g: l([d, o, o, a, i, i][C] * 255),
47
+ b: l([i, i, d, o, o, a][C] * 255),
48
+ a: l(t, 2)
46
49
  };
47
- }, b = (o) => {
48
- const e = o.toString(16);
50
+ }, m = (r) => {
51
+ const e = r.toString(16);
49
52
  return e.length < 2 ? "0" + e : e;
50
- }, Se = ({ r: o, g: e, b: t, a: s }) => {
51
- const r = s < 1 ? b(l(s * 255)) : "";
52
- return "#" + b(o) + b(e) + b(t) + r;
53
- }, Ee = ({ r: o, g: e, b: t, a: s }) => {
54
- const r = Math.max(o, e, t), a = r - Math.min(o, e, t), i = a ? r === o ? (e - t) / a : r === e ? 2 + (t - o) / a : 4 + (o - e) / a : 0;
53
+ }, He = ({ r, g: e, b: o, a: t }) => {
54
+ const s = t < 1 ? m(l(t * 255)) : "";
55
+ return "#" + m(r) + m(e) + m(o) + s;
56
+ }, Ie = ({ r, g: e, b: o, a: t }) => {
57
+ const s = Math.max(r, e, o), i = s - Math.min(r, e, o), a = i ? s === r ? (e - o) / i : s === e ? 2 + (o - r) / i : 4 + (r - e) / i : 0;
55
58
  return {
56
- h: l(60 * (i < 0 ? i + 6 : i)),
57
- s: l(r ? a / r * 100 : 0),
58
- v: l(r / 255 * 100),
59
- a: s
59
+ h: l(60 * (a < 0 ? a + 6 : a)),
60
+ s: l(s ? i / s * 100 : 0),
61
+ v: l(s / 255 * 100),
62
+ a: t
60
63
  };
61
- }, U = (o, e) => {
62
- if (o === e)
64
+ }, U = (r, e) => {
65
+ if (r === e)
63
66
  return !0;
64
- for (const t in o)
65
- if (o[t] !== e[t])
67
+ for (const o in r)
68
+ if (r[o] !== e[o])
66
69
  return !1;
67
70
  return !0;
68
- }, He = (o, e) => o.toLowerCase() === e.toLowerCase() ? !0 : U(E(o), E(e)), N = {}, I = (o) => {
69
- let e = N[o];
70
- return e || (e = document.createElement("template"), e.innerHTML = o, N[o] = e), e;
71
- }, A = (o, e, t) => {
72
- o.dispatchEvent(new CustomEvent(e, {
71
+ }, ze = (r, e) => r.toLowerCase() === e.toLowerCase() ? !0 : U(P(r), P(e)), D = {}, A = (r) => {
72
+ let e = D[r];
73
+ return e || (e = document.createElement("template"), e.innerHTML = r, D[r] = e), e;
74
+ }, M = (r, e, o) => {
75
+ r.dispatchEvent(new CustomEvent(e, {
73
76
  bubbles: !0,
74
- detail: t
77
+ detail: o
75
78
  }));
76
79
  };
77
- let d = !1;
78
- const P = (o) => "touches" in o, Pe = (o) => d && !P(o) ? !1 : (d || (d = P(o)), !0), F = (o, e) => {
79
- const t = P(e) ? e.touches[0] : e, s = o.el.getBoundingClientRect();
80
- A(o.el, "move", o.getMove({
81
- x: v((t.pageX - (s.left + window.pageXOffset)) / s.width),
82
- y: v((t.pageY - (s.top + window.pageYOffset)) / s.height)
80
+ let h = !1;
81
+ const H = (r) => "touches" in r, Le = (r) => h && !H(r) ? !1 : (h || (h = H(r)), !0), B = (r, e) => {
82
+ const o = H(e) ? e.touches[0] : e, t = r.el.getBoundingClientRect();
83
+ M(r.el, "move", r.getMove({
84
+ x: f((o.pageX - (t.left + window.pageXOffset)) / t.width),
85
+ y: f((o.pageY - (t.top + window.pageYOffset)) / t.height)
83
86
  }));
84
- }, Te = (o, e) => {
85
- const t = e.keyCode;
86
- t > 40 || o.xy && t < 37 || t < 33 || (e.preventDefault(), A(o.el, "move", o.getMove({
87
- x: t === 39 ? 0.01 : t === 37 ? -0.01 : t === 34 ? 0.05 : t === 33 ? -0.05 : t === 35 ? 1 : t === 36 ? -1 : 0,
88
- y: t === 40 ? 0.01 : t === 38 ? -0.01 : 0
87
+ }, Ae = (r, e) => {
88
+ const o = e.keyCode;
89
+ o > 40 || r.xy && o < 37 || o < 33 || (e.preventDefault(), M(r.el, "move", r.getMove({
90
+ x: o === 39 ? 0.01 : o === 37 ? -0.01 : o === 34 ? 0.05 : o === 33 ? -0.05 : o === 35 ? 1 : o === 36 ? -1 : 0,
91
+ y: o === 40 ? 0.01 : o === 38 ? -0.01 : 0
89
92
  }, !0)));
90
93
  };
91
94
  class Y {
92
- constructor(e, t, s, r) {
93
- const a = I(`<div role="slider" tabindex="0" part="${t}" ${s}><div part="${t}-pointer"></div></div>`);
94
- e.appendChild(a.content.cloneNode(!0));
95
- const i = e.querySelector(`[part=${t}]`);
96
- i.addEventListener("mousedown", this), i.addEventListener("touchstart", this), i.addEventListener("keydown", this), this.el = i, this.xy = r, this.nodes = [i.firstChild, i];
95
+ constructor(e, o, t, s) {
96
+ const i = A(`<div role="slider" tabindex="0" part="${o}" ${t}><div part="${o}-pointer"></div></div>`);
97
+ e.appendChild(i.content.cloneNode(!0));
98
+ const a = e.querySelector(`[part=${o}]`);
99
+ a.addEventListener("mousedown", this), a.addEventListener("touchstart", this), a.addEventListener("keydown", this), this.el = a, this.xy = s, this.nodes = [a.firstChild, a];
97
100
  }
98
101
  set dragging(e) {
99
- const t = e ? document.addEventListener : document.removeEventListener;
100
- t(d ? "touchmove" : "mousemove", this), t(d ? "touchend" : "mouseup", this);
102
+ const o = e ? document.addEventListener : document.removeEventListener;
103
+ o(h ? "touchmove" : "mousemove", this), o(h ? "touchend" : "mouseup", this);
101
104
  }
102
105
  handleEvent(e) {
103
106
  switch (e.type) {
104
107
  case "mousedown":
105
108
  case "touchstart":
106
- if (e.preventDefault(), !Pe(e) || !d && e.button != 0)
109
+ if (e.preventDefault(), !Le(e) || !h && e.button != 0)
107
110
  return;
108
- this.el.focus(), F(this, e), this.dragging = !0;
111
+ this.el.focus(), B(this, e), this.dragging = !0;
109
112
  break;
110
113
  case "mousemove":
111
114
  case "touchmove":
112
- e.preventDefault(), F(this, e);
115
+ e.preventDefault(), B(this, e);
113
116
  break;
114
117
  case "mouseup":
115
118
  case "touchend":
116
119
  this.dragging = !1;
117
120
  break;
118
121
  case "keydown":
119
- Te(this, e);
122
+ Ae(this, e);
120
123
  break;
121
124
  }
122
125
  }
123
126
  style(e) {
124
- e.forEach((t, s) => {
125
- for (const r in t)
126
- this.nodes[s].style.setProperty(r, t[r]);
127
+ e.forEach((o, t) => {
128
+ for (const s in o)
129
+ this.nodes[t].style.setProperty(s, o[s]);
127
130
  });
128
131
  }
129
132
  }
130
- class ze extends Y {
133
+ class Me extends Y {
131
134
  constructor(e) {
132
135
  super(e, "hue", 'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"', !1);
133
136
  }
@@ -135,15 +138,15 @@ class ze extends Y {
135
138
  this.h = e, this.style([
136
139
  {
137
140
  left: `${e / 360 * 100}%`,
138
- color: H({ h: e, s: 100, v: 100, a: 1 })
141
+ color: T({ h: e, s: 100, v: 100, a: 1 })
139
142
  }
140
143
  ]), this.el.setAttribute("aria-valuenow", `${l(e)}`);
141
144
  }
142
- getMove(e, t) {
143
- return { h: t ? v(this.h + e.x * 360, 0, 360) : 360 * e.x };
145
+ getMove(e, o) {
146
+ return { h: o ? f(this.h + e.x * 360, 0, 360) : 360 * e.x };
144
147
  }
145
148
  }
146
- class Ie extends Y {
149
+ class Fe extends Y {
147
150
  constructor(e) {
148
151
  super(e, "saturation", 'aria-label="Color"', !0);
149
152
  }
@@ -152,44 +155,44 @@ class Ie extends Y {
152
155
  {
153
156
  top: `${100 - e.v}%`,
154
157
  left: `${e.s}%`,
155
- color: H(e)
158
+ color: T(e)
156
159
  },
157
160
  {
158
- "background-color": H({ h: e.h, s: 100, v: 100, a: 1 })
161
+ "background-color": T({ h: e.h, s: 100, v: 100, a: 1 })
159
162
  }
160
163
  ]), this.el.setAttribute("aria-valuetext", `Saturation ${l(e.s)}%, Brightness ${l(e.v)}%`);
161
164
  }
162
- getMove(e, t) {
165
+ getMove(e, o) {
163
166
  return {
164
- s: t ? v(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
165
- v: t ? v(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
167
+ s: o ? f(this.hsva.s + e.x * 100, 0, 100) : e.x * 100,
168
+ v: o ? f(this.hsva.v - e.y * 100, 0, 100) : Math.round(100 - e.y * 100)
166
169
  };
167
170
  }
168
171
  }
169
- const Ae = ':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}', Le = "[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}", Me = "[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}", m = Symbol("same"), $ = Symbol("color"), O = Symbol("hsva"), k = Symbol("update"), B = Symbol("parts"), R = Symbol("css"), V = Symbol("sliders");
170
- let Ne = class extends HTMLElement {
172
+ const Ne = ':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}', De = "[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}", Be = "[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}", g = Symbol("same"), $ = Symbol("color"), O = Symbol("hsva"), k = Symbol("update"), R = Symbol("parts"), K = Symbol("css"), V = Symbol("sliders");
173
+ let Oe = class extends HTMLElement {
171
174
  static get observedAttributes() {
172
175
  return ["color"];
173
176
  }
174
- get [R]() {
175
- return [Ae, Le, Me];
177
+ get [K]() {
178
+ return [Ne, De, Be];
176
179
  }
177
180
  get [V]() {
178
- return [Ie, ze];
181
+ return [Fe, Me];
179
182
  }
180
183
  get color() {
181
184
  return this[$];
182
185
  }
183
186
  set color(e) {
184
- if (!this[m](e)) {
185
- const t = this.colorModel.toHsva(e);
186
- this[k](t), this[$] = e;
187
+ if (!this[g](e)) {
188
+ const o = this.colorModel.toHsva(e);
189
+ this[k](o), this[$] = e;
187
190
  }
188
191
  }
189
192
  constructor() {
190
193
  super();
191
- const e = I(`<style>${this[R].join("")}</style>`), t = this.attachShadow({ mode: "open" });
192
- t.appendChild(e.content.cloneNode(!0)), t.addEventListener("move", this), this[B] = this[V].map((s) => new s(t));
194
+ const e = A(`<style>${this[K].join("")}</style>`), o = this.attachShadow({ mode: "open" });
195
+ o.appendChild(e.content.cloneNode(!0)), o.addEventListener("move", this), this[R] = this[V].map((t) => new t(o));
193
196
  }
194
197
  connectedCallback() {
195
198
  if (this.hasOwnProperty("color")) {
@@ -197,73 +200,73 @@ let Ne = class extends HTMLElement {
197
200
  delete this.color, this.color = e;
198
201
  } else this.color || (this.color = this.colorModel.defaultColor);
199
202
  }
200
- attributeChangedCallback(e, t, s) {
201
- const r = this.colorModel.fromAttr(s);
202
- this[m](r) || (this.color = r);
203
+ attributeChangedCallback(e, o, t) {
204
+ const s = this.colorModel.fromAttr(t);
205
+ this[g](s) || (this.color = s);
203
206
  }
204
207
  handleEvent(e) {
205
- const t = this[O], s = { ...t, ...e.detail };
206
- this[k](s);
207
- let r;
208
- !U(s, t) && !this[m](r = this.colorModel.fromHsva(s)) && (this[$] = r, A(this, "color-changed", { value: r }));
208
+ const o = this[O], t = { ...o, ...e.detail };
209
+ this[k](t);
210
+ let s;
211
+ !U(t, o) && !this[g](s = this.colorModel.fromHsva(t)) && (this[$] = s, M(this, "color-changed", { value: s }));
209
212
  }
210
- [m](e) {
213
+ [g](e) {
211
214
  return this.color && this.colorModel.equal(e, this.color);
212
215
  }
213
216
  [k](e) {
214
- this[O] = e, this[B].forEach((t) => t.update(e));
217
+ this[O] = e, this[R].forEach((o) => o.update(e));
215
218
  }
216
219
  };
217
- const Fe = {
220
+ const Re = {
218
221
  defaultColor: "#000",
219
- toHsva: $e,
220
- fromHsva: ({ h: o, s: e, v: t }) => ke({ h: o, s: e, v: t, a: 1 }),
221
- equal: He,
222
- fromAttr: (o) => o
222
+ toHsva: Se,
223
+ fromHsva: ({ h: r, s: e, v: o }) => Ee({ h: r, s: e, v: o, a: 1 }),
224
+ equal: ze,
225
+ fromAttr: (r) => r
223
226
  };
224
- class Oe extends Ne {
227
+ class Ke extends Oe {
225
228
  get colorModel() {
226
- return Fe;
229
+ return Re;
227
230
  }
228
231
  }
229
- class Q extends Oe {
232
+ class Q extends Ke {
230
233
  }
231
234
  customElements.define("hex-color-picker", Q);
232
- const Be = /^#?([0-9A-F]{3,8})$/i, w = (o, e) => {
233
- const t = Be.exec(o), s = t ? t[1].length : 0;
234
- return s === 3 || // '#rgb' format
235
- s === 6 || // '#rrggbb' format
236
- !!e && s === 4 || // '#rgba' format
237
- !!e && s === 8;
238
- }, Re = I('<slot><input part="input" spellcheck="false"></slot>'), q = (o, e) => o.replace(/([^0-9A-F]+)/gi, "").substring(0, e ? 8 : 6), D = Symbol("alpha"), g = Symbol("color"), K = Symbol("saved"), _ = Symbol("input"), S = Symbol("init"), W = Symbol("prefix"), h = Symbol("update");
239
- class Ve extends HTMLElement {
235
+ const Ve = /^#?([0-9A-F]{3,8})$/i, w = (r, e) => {
236
+ const o = Ve.exec(r), t = o ? o[1].length : 0;
237
+ return t === 3 || // '#rgb' format
238
+ t === 6 || // '#rrggbb' format
239
+ !!e && t === 4 || // '#rgba' format
240
+ !!e && t === 8;
241
+ }, qe = A('<slot><input part="input" spellcheck="false"></slot>'), q = (r, e) => r.replace(/([^0-9A-F]+)/gi, "").substring(0, e ? 8 : 6), W = Symbol("alpha"), x = Symbol("color"), X = Symbol("saved"), _ = Symbol("input"), S = Symbol("init"), j = Symbol("prefix"), u = Symbol("update");
242
+ class We extends HTMLElement {
240
243
  static get observedAttributes() {
241
244
  return ["alpha", "color", "prefixed"];
242
245
  }
243
246
  get color() {
244
- return this[g];
247
+ return this[x];
245
248
  }
246
249
  set color(e) {
247
- this[g] = e, this[h](e);
250
+ this[x] = e, this[u](e);
248
251
  }
249
252
  get alpha() {
250
- return this[D];
253
+ return this[W];
251
254
  }
252
255
  set alpha(e) {
253
- this[D] = e, this.toggleAttribute("alpha", e);
254
- const t = this.color;
255
- t && !w(t, e) && (this.color = t.startsWith("#") ? t.substring(0, t.length === 5 ? 4 : 7) : t.substring(0, t.length === 4 ? 3 : 6));
256
+ this[W] = e, this.toggleAttribute("alpha", e);
257
+ const o = this.color;
258
+ o && !w(o, e) && (this.color = o.startsWith("#") ? o.substring(0, o.length === 5 ? 4 : 7) : o.substring(0, o.length === 4 ? 3 : 6));
256
259
  }
257
260
  get prefixed() {
258
- return this[W];
261
+ return this[j];
259
262
  }
260
263
  set prefixed(e) {
261
- this[W] = e, this.toggleAttribute("prefixed", e), this[h](this.color);
264
+ this[j] = e, this.toggleAttribute("prefixed", e), this[u](this.color);
262
265
  }
263
266
  constructor() {
264
267
  super();
265
268
  const e = this.attachShadow({ mode: "open" });
266
- e.appendChild(Re.content.cloneNode(!0)), e.firstElementChild.addEventListener("slotchange", () => this[S](e));
269
+ e.appendChild(qe.content.cloneNode(!0)), e.firstElementChild.addEventListener("slotchange", () => this[S](e));
267
270
  }
268
271
  connectedCallback() {
269
272
  if (this[S](this.shadowRoot), this.hasOwnProperty("alpha")) {
@@ -279,80 +282,82 @@ class Ve extends HTMLElement {
279
282
  if (this.hasOwnProperty("color")) {
280
283
  const e = this.color;
281
284
  delete this.color, this.color = e;
282
- } else this.color == null ? this.color = this.getAttribute("color") || "" : this[g] && this[h](this[g]);
285
+ } else this.color == null ? this.color = this.getAttribute("color") || "" : this[x] && this[u](this[x]);
283
286
  }
284
287
  handleEvent(e) {
285
- const t = e.target, { value: s } = t;
288
+ const o = e.target, { value: t } = o;
286
289
  switch (e.type) {
287
290
  case "input":
288
- const r = q(s, this.alpha);
289
- this[K] = this.color, (w(r, this.alpha) || s === "") && (this.color = r, this.dispatchEvent(new CustomEvent("color-changed", {
291
+ const s = q(t, this.alpha);
292
+ this[X] = this.color, (w(s, this.alpha) || t === "") && (this.color = s, this.dispatchEvent(new CustomEvent("color-changed", {
290
293
  bubbles: !0,
291
- detail: { value: r ? "#" + r : "" }
294
+ detail: { value: s ? "#" + s : "" }
292
295
  })));
293
296
  break;
294
297
  case "blur":
295
- s && !w(s, this.alpha) && (this.color = this[K]);
298
+ t && !w(t, this.alpha) && (this.color = this[X]);
296
299
  }
297
300
  }
298
- attributeChangedCallback(e, t, s) {
299
- e === "color" && this.color !== s && (this.color = s);
300
- const r = s != null;
301
- e === "alpha" && this.alpha !== r && (this.alpha = r), e === "prefixed" && this.prefixed !== r && (this.prefixed = r);
301
+ attributeChangedCallback(e, o, t) {
302
+ e === "color" && this.color !== t && (this.color = t);
303
+ const s = t != null;
304
+ e === "alpha" && this.alpha !== s && (this.alpha = s), e === "prefixed" && this.prefixed !== s && (this.prefixed = s);
302
305
  }
303
306
  [S](e) {
304
- let t = this.querySelector("input");
305
- if (!t) {
306
- let s;
307
- for (; s = this.firstChild; )
308
- s.remove();
309
- t = e.querySelector("input");
307
+ let o = this.querySelector("input");
308
+ if (!o) {
309
+ let t;
310
+ for (; t = this.firstChild; )
311
+ t.remove();
312
+ o = e.querySelector("input");
310
313
  }
311
- t.addEventListener("input", this), t.addEventListener("blur", this), this[_] = t, this[h](this.color);
314
+ o.addEventListener("input", this), o.addEventListener("blur", this), this[_] = o, this[u](this.color);
312
315
  }
313
- [h](e) {
316
+ [u](e) {
314
317
  this[_] && (this[_].value = e == null || e == "" ? "" : (this.prefixed ? "#" : "") + q(e, this.alpha));
315
318
  }
316
319
  }
317
- class Z extends Ve {
320
+ class Z extends We {
318
321
  }
319
322
  customElements.define("hex-input", Z);
320
- var qe = Object.defineProperty, p = (o, e, t, s) => {
321
- for (var r = void 0, a = o.length - 1, i; a >= 0; a--)
322
- (i = o[a]) && (r = i(e, t, r) || r);
323
- return r && qe(e, t, r), r;
323
+ var Xe = Object.defineProperty, p = (r, e, o, t) => {
324
+ for (var s = void 0, i = r.length - 1, a; i >= 0; i--)
325
+ (a = r[i]) && (s = a(e, o, s) || s);
326
+ return s && Xe(e, o, s), s;
324
327
  };
325
- const T = "vvd-hex-picker", z = "vvd-hex-input";
326
- class De extends Q {
328
+ const I = "vvd-hex-picker", z = "vvd-hex-input";
329
+ class je extends Q {
327
330
  static {
328
331
  this.displayName = "VvdHexPicker";
329
332
  }
330
333
  }
331
- class Ke extends Z {
334
+ class Ge extends Z {
332
335
  static {
333
336
  this.displayName = "VvdHexInput";
334
337
  }
335
338
  }
336
- customElements.get(T) || customElements.define(T, De);
337
- customElements.get(z) || customElements.define(z, Ke);
338
- const X = T, j = z;
339
- class c extends ue(
339
+ customElements.get(I) || customElements.define(I, je);
340
+ customElements.get(z) || customElements.define(z, Ge);
341
+ const G = I, J = z;
342
+ class c extends ve(
340
343
  ne(
341
- ve(fe(de(he(ee))))
344
+ fe(
345
+ be(
346
+ de(me(ue(ee)))
347
+ )
348
+ )
342
349
  )
343
350
  ) {
344
351
  constructor() {
345
- super(...arguments), this.disableSavedColors = !1, this.savedColors = [], this.maxSwatches = 6, this.copyIconName = "copy-2-line", this.#e = null, this._copyValueToClipboard = async (e) => {
352
+ super(...arguments), this.disableSavedColors = !1, this.savedColors = [], this.maxSwatches = 6, this.#t = (e) => {
353
+ this._isInPath(e, this._buttonEl) || this._isInPath(e, this._popupEl) || (this.open = !1);
354
+ }, this.copyIconName = "copy-2-line", this.#e = null, this._copyValueToClipboard = async (e) => {
346
355
  try {
347
- await navigator.clipboard.writeText(e), this._setTemporaryCopyIcon("check-circle-line");
356
+ await navigator.clipboard.writeText(e), this._setTemporaryCopyIcon("check-circle-line"), this._ariaLiveDescription = this.locale.colorPicker.copySuccessMessage(e);
348
357
  } catch {
349
- alert(this.locale?.colorPicker?.copyErrorText), this._setTemporaryCopyIcon("error-line");
358
+ alert(this.locale.colorPicker.copyErrorText), this._setTemporaryCopyIcon("error-line"), this._ariaLiveDescription = this.locale.colorPicker.copyErrorText;
350
359
  }
351
- }, this.#t = (e) => {
352
- this._isInPath(e, this._buttonEl) || this._isInPath(e, this._popupEl) || (this.open = !1);
353
- }, this.#o = (e) => {
354
- e.key === "Escape" && (this.open = !1);
355
- };
360
+ }, this._ariaLiveDescription = "";
356
361
  }
357
362
  static {
358
363
  this.HEX_COLOR_PATTERN = /^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$/;
@@ -371,6 +376,14 @@ class c extends ue(
371
376
  handleChange() {
372
377
  this.$emit("change");
373
378
  }
379
+ /**
380
+ * @internal
381
+ */
382
+ openChanged(e, o) {
383
+ o && this.isConnected && requestAnimationFrame(() => {
384
+ this._refreshCanvasColor();
385
+ });
386
+ }
374
387
  /**
375
388
  * @internal
376
389
  */
@@ -389,6 +402,55 @@ class c extends ue(
389
402
  _handleColorSaving() {
390
403
  this._saveCurrentColor();
391
404
  }
405
+ /**
406
+ * @internal
407
+ */
408
+ _saveCurrentColor() {
409
+ const e = this.value;
410
+ if (typeof e != "string" || !b(e)) return;
411
+ const o = Array.isArray(this.savedColors) ? [...this.savedColors] : [], t = o.findIndex((s) => s?.value === e);
412
+ t !== -1 && o.splice(t, 1), o.unshift({ value: e }), this.savedColors = o.slice(0, this._maxSwatchesNormalized), this._setSavedColors(this.savedColors);
413
+ }
414
+ /**
415
+ * @internal
416
+ */
417
+ _loadSavedColors() {
418
+ try {
419
+ const e = localStorage.getItem(this._savedColorsStorageKey);
420
+ if (!e) return [];
421
+ const o = JSON.parse(e);
422
+ return Array.isArray(o) ? o.filter(
423
+ (t) => t && typeof t.value == "string" && b(t.value)
424
+ ).map((t) => ({
425
+ value: t.value,
426
+ label: typeof t.label == "string" ? t.label : void 0
427
+ })) : [];
428
+ } catch {
429
+ return [];
430
+ }
431
+ }
432
+ /**
433
+ * @internal
434
+ */
435
+ _setSavedColors(e) {
436
+ try {
437
+ localStorage.setItem(
438
+ this._savedColorsStorageKey,
439
+ JSON.stringify(e)
440
+ );
441
+ } catch {
442
+ }
443
+ }
444
+ /**
445
+ * Get all color swatches combined, both from swatches property and saved colors
446
+ * @internal
447
+ */
448
+ get allSwatches() {
449
+ const e = Array.isArray(this.swatches) ? this.swatches : [], o = Array.isArray(this.savedColors) ? this.savedColors : [], t = /* @__PURE__ */ new Set(), s = [], i = (a) => {
450
+ !a || typeof a.value != "string" || !b(a.value) || t.has(a.value) || (t.add(a.value), s.push(a));
451
+ };
452
+ return this.disableSavedColors || o.forEach(i), e.forEach(i), s.slice(0, this._maxSwatchesNormalized);
453
+ }
392
454
  /**
393
455
  * @internal
394
456
  */
@@ -411,21 +473,21 @@ class c extends ue(
411
473
  /**
412
474
  * @internal
413
475
  */
414
- valueChanged(e, t) {
415
- this._vcHexPickerEl && typeof t == "string" && (this._vcHexPickerEl.color = t), this._vcHexInputEl && typeof t == "string" && (this._vcHexInputEl.color = t);
476
+ valueChanged(e, o) {
477
+ this._vcHexPickerEl && typeof o == "string" && (this._vcHexPickerEl.color = o), this._vcHexInputEl && typeof o == "string" && (this._vcHexInputEl.color = o);
416
478
  }
417
479
  /**
418
480
  * @internal
419
481
  */
420
482
  _onTextFieldInput(e) {
421
- const t = e.currentTarget;
422
- this.value = t.value;
483
+ const o = e.currentTarget;
484
+ this.value = o.value;
423
485
  }
424
486
  /**
425
487
  * @internal
426
488
  */
427
489
  get _buttonColor() {
428
- return this._canvasColor || this._refreshCanvasColor(), this.value && f(this.value) ? this.value : "var(--vvd-color-canvas-text)";
490
+ return this._canvasColor || this._refreshCanvasColor(), this.value && b(this.value) ? this.value : "var(--vvd-color-canvas-text)";
429
491
  }
430
492
  /**
431
493
  * @internal
@@ -442,207 +504,210 @@ class c extends ue(
442
504
  /**
443
505
  * @internal
444
506
  */
445
- _isInPath(e, t) {
446
- if (!t) return !1;
447
- const s = e.composedPath?.();
448
- return !!(s && s.includes(t));
449
- }
450
- #e;
451
- /**
452
- * @internal
453
- */
454
- _setTemporaryCopyIcon(e, t = 2e3) {
455
- this.copyIconName = e, this.#e && clearTimeout(this.#e), this.#e = setTimeout(() => {
456
- this.copyIconName = "copy-2-line", this.#e = null;
457
- }, t);
507
+ _isInPath(e, o) {
508
+ if (!o) return !1;
509
+ const t = e.composedPath?.();
510
+ return !!(t && t.includes(o));
458
511
  }
512
+ #t;
459
513
  connectedCallback() {
460
- super.connectedCallback(), this._refreshCanvasColor(), this.savedColors = this._loadSavedColors(), document.addEventListener("mousedown", this.#t, !0), document.addEventListener("keydown", this.#o);
514
+ super.connectedCallback(), this.savedColors = this._loadSavedColors(), document.addEventListener("mousedown", this.#t, !0);
461
515
  }
462
516
  disconnectedCallback() {
463
517
  super.disconnectedCallback(), document.removeEventListener(
464
518
  "mousedown",
465
519
  this.#t,
466
520
  !0
467
- ), document.removeEventListener("keydown", this.#o);
521
+ );
468
522
  }
469
- #t;
470
- #o;
523
+ #e;
471
524
  /**
472
525
  * @internal
473
526
  */
474
- _saveCurrentColor() {
475
- const e = this.value;
476
- if (typeof e != "string" || !f(e)) return;
477
- const t = Array.isArray(this.savedColors) ? [...this.savedColors] : [], s = t.findIndex((r) => r?.value === e);
478
- s !== -1 && t.splice(s, 1), t.unshift({ value: e }), this.savedColors = t.slice(0, this._maxSwatchesNormalized), this._setSavedColors(this.savedColors);
527
+ _setTemporaryCopyIcon(e, o = 2e3) {
528
+ this.copyIconName = e, this.#e && clearTimeout(this.#e), this.#e = setTimeout(() => {
529
+ this.copyIconName = "copy-2-line", this.#e = null;
530
+ }, o);
479
531
  }
532
+ // --- Trapped focus ---
480
533
  /**
481
534
  * @internal
482
535
  */
483
- _loadSavedColors() {
484
- try {
485
- const e = localStorage.getItem(this._savedColorsStorageKey);
486
- if (!e) return [];
487
- const t = JSON.parse(e);
488
- return Array.isArray(t) ? t.filter(
489
- (s) => s && typeof s.value == "string" && f(s.value)
490
- ).map((s) => ({
491
- value: s.value,
492
- label: typeof s.label == "string" ? s.label : void 0
493
- })) : [];
494
- } catch {
495
- return [];
496
- }
536
+ _onBaseKeydown(e) {
537
+ return this.open && he(e) ? (this.open = !1, !1) : !this._trappedFocus(e, () => this._focusableElsWithinDialog());
497
538
  }
498
539
  /**
499
540
  * @internal
500
541
  */
501
- _setSavedColors(e) {
502
- try {
503
- localStorage.setItem(
504
- this._savedColorsStorageKey,
505
- JSON.stringify(e)
506
- );
507
- } catch {
542
+ _focusableElsWithinDialog() {
543
+ return this._popupEl.querySelectorAll(
544
+ 'button:not([role="gridcell"]), [data-vvd-component="button"], vwc-button:not([role="gridcell"])'
545
+ );
546
+ }
547
+ /**
548
+ * @internal
549
+ */
550
+ _handleCellKeydown(e, o, t, s) {
551
+ if (e.key === "Tab") {
552
+ e.preventDefault();
553
+ const i = this._focusableElsWithinDialog(), a = Array.prototype.indexOf.call(
554
+ i,
555
+ e.currentTarget
556
+ ), d = e.shiftKey ? (a - 1 + i.length) % i.length : (a + 1) % i.length;
557
+ return i[d]?.focus(), !1;
508
558
  }
559
+ return super._handleCellKeydown(e, o, t, s);
509
560
  }
510
561
  /**
511
- * Get all color swatches combined, both from swatches property and saved colors
512
562
  * @internal
513
563
  */
514
- get allSwatches() {
515
- const e = Array.isArray(this.swatches) ? this.swatches : [], t = Array.isArray(this.savedColors) ? this.savedColors : [], s = /* @__PURE__ */ new Set(), r = [], a = (i) => {
516
- !i || typeof i.value != "string" || !f(i.value) || s.has(i.value) || (s.add(i.value), r.push(i));
517
- };
518
- return this.disableSavedColors || t.forEach(a), e.forEach(a), r.slice(0, this._maxSwatchesNormalized);
564
+ _handleSwatchSelection(e) {
565
+ this.value !== e && (this._ariaLiveDescription = this.locale.colorPicker.selectionSuccessMessage(e)), super._handleSwatchSelection(e);
519
566
  }
520
567
  }
521
568
  p([
522
- x
569
+ y
523
570
  ], c.prototype, "placeholder");
524
571
  p([
525
- x({ attribute: "saved-colors-key" })
572
+ y({ attribute: "saved-colors-key" })
526
573
  ], c.prototype, "savedColorsKey");
527
574
  p([
528
- x({
575
+ y({
529
576
  mode: "boolean",
530
577
  attribute: "disable-saved-colors"
531
578
  })
532
579
  ], c.prototype, "disableSavedColors");
533
580
  p([
534
- G
581
+ L
535
582
  ], c.prototype, "savedColors");
536
583
  p([
537
- x({
584
+ y({
538
585
  attribute: "max-swatches",
539
586
  mode: "fromView",
540
587
  converter: te
541
588
  })
542
589
  ], c.prototype, "maxSwatches");
543
590
  p([
544
- G
591
+ L
545
592
  ], c.prototype, "copyIconName");
546
- function We(o, e) {
593
+ p([
594
+ L
595
+ ], c.prototype, "_ariaLiveDescription");
596
+ function Je(r, e) {
547
597
  return n`
548
- <${o}
598
+ <${r}
549
599
  id="text-field"
550
- class="${(s) => M("control")}"
600
+ class="${(t) => N("control")}"
551
601
  pattern="${c.HEX_COLOR_PATTERN.source}"
552
602
  maxlength="7"
553
- label="${(s) => s.label}"
554
- :value="${(s) => s.value}"
555
- placeholder="${(s) => s.placeholder}"
556
- helper-text="${(s) => s.helperText}"
557
- error-text="${(s) => s.errorValidationMessage}"
558
- success-text="${(s) => s.successText}"
559
- ?disabled="${(s) => s.disabled}"
560
- ?required="${(s) => s.required}"
561
- @input='${(s, r) => s._onTextFieldInput(r.event)}'
562
- @change="${(s) => s.handleChange()}"
563
- @blur="${(s) => {
564
- s.$emit("blur", void 0, { bubbles: !1 });
603
+ label="${(t) => t.label}"
604
+ :value="${(t) => t.value}"
605
+ placeholder="${(t) => t.placeholder}"
606
+ helper-text="${(t) => t.helperText}"
607
+ error-text="${(t) => t.errorValidationMessage}"
608
+ success-text="${(t) => t.successText}"
609
+ ?disabled="${(t) => t.disabled}"
610
+ ?required="${(t) => t.required}"
611
+ @input='${(t, s) => t._onTextFieldInput(s.event)}'
612
+ @change="${(t) => t.handleChange()}"
613
+ @blur="${(t) => {
614
+ t.$emit("blur", void 0, { bubbles: !1 });
565
615
  }}"
566
- @focus="${(s) => {
567
- s.$emit("focus", void 0, { bubbles: !1 });
616
+ @focus="${(t) => {
617
+ t.$emit("focus", void 0, { bubbles: !1 });
568
618
  }}"
569
619
  ${pe()}
570
- ${u("_textFieldEl")}
620
+ ${v("_textFieldEl")}
571
621
  >
572
622
  <button
573
- aria-label="${(s) => s.locale.colorPicker.pickerButtonLabel}"
574
- class="button ${(s) => M(
575
- s._applyContrastClass(s._buttonColor) ? "contrast" : "",
576
- s.disabled ? "disabled" : ""
623
+ aria-label="${(t) => t.locale.colorPicker.pickerButtonLabel}"
624
+ aria-expanded="${(t) => t.open}"
625
+ aria-haspopup="dialog"
626
+ class="button ${(t) => N(
627
+ t._applyContrastClass(t._buttonColor) ? "contrast" : "",
628
+ t.disabled ? "disabled" : ""
577
629
  )}"
578
- style="--button-color: ${(s) => s._buttonColor};"
579
- ?disabled="${(s) => s.disabled}"
580
- @click="${(s) => s._onButtonClick()}"
630
+ style="--button-color: ${(t) => t._buttonColor};"
631
+ ?disabled="${(t) => t.disabled}"
632
+ @click="${(t) => t._onButtonClick()}"
581
633
  slot="action-items"
582
- ${u("_buttonEl")}>
634
+ ${v("_buttonEl")}>
583
635
  <${e} name="edit-line"></${e}>
584
636
  </button>
585
637
  <slot
586
- slot="${(s) => s._helperTextSlottedContent?.length ? "helper-text" : void 0}"
638
+ slot="${(t) => t._helperTextSlottedContent?.length ? "helper-text" : void 0}"
587
639
  name="helper-text"
588
- ${L("_helperTextSlottedContent")}
640
+ ${F("_helperTextSlottedContent")}
589
641
  ></slot>
590
642
  <slot
591
- slot='${(s) => s._contextualHelpSlottedContent?.length ? "contextual-help" : void 0}'
643
+ slot='${(t) => t._contextualHelpSlottedContent?.length ? "contextual-help" : void 0}'
592
644
  name='contextual-help'
593
- ${L("_contextualHelpSlottedContent")}
645
+ ${F("_contextualHelpSlottedContent")}
594
646
  ></slot>
595
- </${o}>
647
+ </${r}>
596
648
  `;
597
649
  }
598
- function Xe(o, e) {
650
+ function Ue(r, e) {
599
651
  return n`
600
652
  <div class="header">
601
- <span class="header-title" id="color-picker-title">
602
- <slot name="popup-text">${(t) => t.locale.colorPicker.popupLabel}</slot>
603
- </span>
604
- <${o} size="condensed"
605
- aria-label="${(t) => t.locale.colorPicker.closeButtonLabel}"
606
- @click="${(t) => t._handleCloseRequest()}">
653
+ <h2 class="header-title" id="color-picker-title">
654
+ <slot name="popup-text">${(o) => o.locale.colorPicker.popupLabel}</slot>
655
+ </h2>
656
+ <${r} size="condensed"
657
+ aria-label="${(o) => o.locale.colorPicker.closeButtonLabel}"
658
+ @click="${(o) => o._handleCloseRequest()}">
607
659
  <${e} slot="icon" name="close-line"></${e}>
608
- </${o}>
660
+ </${r}>
609
661
  </div>
610
662
  `;
611
663
  }
612
- function je(o, e) {
664
+ function Ye(r, e, o) {
613
665
  return n`
614
666
  <div class="body">
615
- <${n.partial(X)}
667
+ <${n.partial(G)}
616
668
  part="hex-picker"
617
669
  color="${(t) => t.value}"
618
670
  @color-changed="${(t, s) => t._onPickerColorChanged(s.event)}"
619
- ${u("_vcHexPickerEl")}
620
- ></${n.partial(X)}>
671
+ ${v("_vcHexPickerEl")}
672
+ ></${n.partial(G)}>
621
673
  <div class="hex-input-wrapper">
622
- <${n.partial(j)}
674
+ <${n.partial(J)}
623
675
  part="hex-input"
624
676
  prefixed
625
677
  color="${(t) => t.value}"
626
678
  @color-changed="${(t, s) => t._onPickerColorChanged(s.event)}"
627
- ${u("_vcHexInputEl")}
628
- ></${n.partial(j)}>
629
- <${o} size="normal"
630
- aria-label="${(t) => t.locale.colorPicker.copyButtonLabel}"
631
- @click="${(t) => t._copyValueToClipboard(t.value)}">
632
- <${e} slot="icon" name="${(t) => t.copyIconName}"></${e}>
679
+ ${v("_vcHexInputEl")}
680
+ >
681
+ <input name="hex-code-input" aria-label="${(t) => t.locale.colorPicker.hexInputLabel}"
682
+ placeholder="${(t) => t.placeholder}"
683
+ @blur="${(t, s) => s.event.stopImmediatePropagation()}"
684
+ part="input">
685
+ </${n.partial(J)}>
686
+ <${o} placement="top"
687
+ text="${(t) => t.locale.colorPicker.copyButtonLabel}"
688
+ exportparts="vvd-theme-alternate">
689
+ <${r}
690
+ slot="anchor" size="normal"
691
+ aria-label="${(t) => t.locale.colorPicker.copyButtonLabel}"
692
+ @click="${(t) => t._copyValueToClipboard(t.value)}">
693
+ <${e} slot="icon" name="${(t) => t.copyIconName}"></${e}>
694
+ </${r}>
633
695
  </${o}>
634
696
  </div>
635
697
  </div>
636
698
  `;
637
699
  }
638
- function Ge(o, e) {
700
+ function Qe(r, e, o) {
639
701
  return n`
640
702
  <div class="footer">
641
- <span class="footer-title" id="color-picker-footer-title"
642
- ><slot name="swatches-text"
643
- >${(t) => t.locale.colorPicker.swatchesLabel}</slot
644
- ></span
645
- >
703
+ <div class="footer-header">
704
+ <span class="footer-title" id="color-picker-footer-title"
705
+ ><slot name="swatches-text"
706
+ >${(t) => t.locale.colorPicker.swatchesLabel}</slot
707
+ ></span
708
+ >
709
+ ${E((t) => !t.disableSavedColors, Ze())}
710
+ </div>
646
711
  <div
647
712
  class="palette"
648
713
  role="grid"
@@ -651,76 +716,97 @@ function Ge(o, e) {
651
716
  style="--swatches-per-row: ${(t) => t._getRowLength()};"
652
717
  aria-labelledby="color-picker-footer-title"
653
718
  >
654
- ${Ce(
719
+ ${we(
655
720
  (t) => t.allSwatches,
656
- (t) => t._renderColorSwatch(e),
721
+ (t) => t._renderColorSwatch(e, o),
657
722
  { positioning: !0 }
658
723
  )}
659
- ${J(
724
+ ${E(
660
725
  (t) => !t.disableSavedColors,
661
726
  n`
662
- <${o}
663
- appearance="outlined"
664
- size="super-condensed"
665
- role="gridcell"
666
- tabindex="${(t) => t.allSwatches.length ? "-1" : "0"}"
667
- aria-label="${(t) => t.locale.colorPicker.saveButtonLabel}"
668
- @click="${(t) => t._saveCurrentColor()}"
669
- @keydown="${(t, s) => t._handleCellKeydown(
727
+ <${o} placement="top"
728
+ text="${(t) => t.locale.colorPicker.saveButtonLabel}"
729
+ exportparts="vvd-theme-alternate">
730
+ <${r}
731
+ slot="anchor"
732
+ appearance="outlined"
733
+ size="super-condensed"
734
+ role="gridcell"
735
+ tabindex="${(t) => t.allSwatches.length ? "-1" : "0"}"
736
+ aria-label="${(t) => t.locale.colorPicker.saveButtonLabel}"
737
+ @click="${(t) => t._saveCurrentColor()}"
738
+ @keydown="${(t, s) => t._handleCellKeydown(
670
739
  s.event,
671
740
  t.value,
672
741
  t.allSwatches.length,
673
742
  !0
674
743
  )}">
675
- >
676
- <${e} slot="icon" name="plus-line"></${e}>
677
- </${o}>
678
- `
744
+ <${e} slot="icon" name="plus-line"></${e}>
745
+ </${r}>
746
+ </${o}>
747
+ `
679
748
  )}
680
749
  </div>
681
750
  </div>
682
751
  `;
683
752
  }
684
- const Je = (o) => {
685
- const e = o.tagFor(be), t = o.tagFor(ie), s = o.tagFor(re), r = o.tagFor(ge);
753
+ function Ze() {
686
754
  return n`
687
- <div class="base">
688
- ${We(e, t)}
689
- <${s}
755
+ <span
756
+ id="swatches-count"
757
+ class="swatches-count"
758
+ aria-label="${(r) => r.locale.colorPicker.maxSwatchesMessage(
759
+ r.allSwatches.length,
760
+ r.maxSwatches
761
+ )}"
762
+ >${(r) => `${r.allSwatches.length}/${r.maxSwatches}`}</span
763
+ >
764
+ `;
765
+ }
766
+ const et = (r) => {
767
+ const e = r.tagFor(ge), o = r.tagFor(ie), t = r.tagFor(se), s = r.tagFor(ye), i = r.tagFor($e);
768
+ return n`
769
+ <div class="base" @keydown="${(a, { event: d }) => a._onBaseKeydown(d)}">
770
+ <span aria-live="assertive" aria-relevant="text" class="visually-hidden">
771
+ ${(a) => a._ariaLiveDescription}
772
+ </span>
773
+ ${Je(e, o)}
774
+ <${t}
690
775
  :open="${(a) => a.open}"
691
776
  :anchor="${(a) => a._buttonEl}"
692
777
  placement="top"
693
778
  offset="10"
694
- ${u("_popupEl")}>
779
+ ${v("_popupEl")}>
695
780
  <div class="dialog"
696
781
  role="dialog"
697
782
  aria-modal="true"
698
783
  aria-labelledby="color-picker-title">
699
- ${Xe(r, t)}
700
- ${je(r, t)}
701
- ${J(
784
+ ${Ue(s, o)}
785
+ ${Ye(s, o, i)}
786
+ ${E(
702
787
  (a) => !a.disableSavedColors || a.allSwatches.length > 0,
703
- Ge(r, t)
788
+ Qe(s, o, i)
704
789
  )}
705
790
  </div>
706
- </${s}>
791
+ </${t}>
707
792
  </div>
708
793
  `;
709
- }, Ue = se(
794
+ }, tt = re(
710
795
  "color-picker",
711
796
  c,
712
- Je,
797
+ et,
713
798
  [
714
799
  ae,
715
800
  le,
716
- me,
717
801
  xe,
802
+ Ce,
803
+ ke,
718
804
  ce
719
805
  ],
720
806
  {
721
- styles: ye
807
+ styles: _e
722
808
  }
723
- ), Ye = oe(
724
- Ue
809
+ ), ot = oe(
810
+ tt
725
811
  );
726
- Ye();
812
+ ot();