@vonage/vivid 5.4.0 → 5.6.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.
- package/LICENSE.md +201 -0
- package/accordion/definition.cjs +5 -0
- package/accordion/definition.js +5 -0
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +14 -3
- package/alert/definition.cjs +4 -12
- package/alert/definition.js +5 -13
- package/alert/index.cjs +11 -11
- package/alert/index.js +33 -37
- package/audio-player/definition.cjs +4 -0
- package/audio-player/definition.js +4 -0
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +8 -2
- package/banner/definition.cjs +2 -4
- package/banner/definition.js +2 -4
- package/banner/index.cjs +2 -2
- package/banner/index.js +1 -1
- package/breadcrumb/definition.cjs +1 -0
- package/breadcrumb/definition.js +1 -0
- package/breadcrumb/index.cjs +1 -1
- package/breadcrumb/index.js +1 -0
- package/bundled/affix.js +1 -1
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/attribute-binding-behaviour.cjs +1 -1
- package/bundled/attribute-binding-behaviour.js +3 -1
- package/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +107 -84
- package/bundled/base-progress.cjs +1 -1
- package/bundled/base-progress.js +3 -0
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +14 -10
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +4 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +7 -7
- package/bundled/definition10.js +29 -19
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +73 -204
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +218 -36
- package/bundled/definition13.cjs +10 -1
- package/bundled/definition13.js +38 -14
- package/bundled/definition14.cjs +1 -5
- package/bundled/definition14.js +15 -24
- package/bundled/definition15.cjs +5 -30
- package/bundled/definition15.js +22 -73
- package/bundled/definition16.cjs +30 -19
- package/bundled/definition16.js +74 -97
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +86 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +125 -71
- package/bundled/definition19.cjs +16 -16
- package/bundled/definition19.js +132 -94
- package/bundled/definition2.cjs +8 -9
- package/bundled/definition2.js +89 -142
- package/bundled/definition22.cjs +1 -1
- package/bundled/definition22.js +1 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +2 -1
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +9 -3
- package/bundled/definition6.cjs +1 -1
- package/bundled/definition6.js +1 -0
- package/bundled/definition7.cjs +1 -1
- package/bundled/definition7.js +7 -4
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +1 -0
- package/bundled/definition9.cjs +6 -6
- package/bundled/definition9.js +545 -488
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +3 -1
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +11 -3
- package/bundled/host-semantics.js +4 -4
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +22 -4
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +149 -66
- package/bundled/mixins.cjs +4 -4
- package/bundled/mixins.js +11 -8
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +36 -56
- package/bundled/scrollIntoView.cjs +1 -1
- package/bundled/scrollIntoView.js +4 -1
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +16 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +4 -4
- package/bundled/vivid-element.js +529 -492
- package/calendar/definition.cjs +2 -0
- package/calendar/definition.js +2 -0
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +174 -144
- package/checkbox/definition.cjs +1 -0
- package/checkbox/definition.js +1 -0
- package/color-picker/definition.cjs +213 -112
- package/color-picker/definition.js +213 -112
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +417 -326
- package/combobox/definition.cjs +17 -6
- package/combobox/definition.js +17 -6
- package/combobox/index.cjs +14 -9
- package/combobox/index.js +54 -42
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +6976 -484
- package/data-grid/definition.cjs +105 -7
- package/data-grid/definition.js +105 -7
- package/data-grid/index.cjs +52 -38
- package/data-grid/index.js +313 -242
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +2 -0
- package/date-range-picker/definition.js +2 -0
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +7 -3
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +148 -0
- package/dial-pad/definition.js +148 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +202 -101
- package/dialog/definition.cjs +1 -0
- package/dialog/definition.js +1 -0
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -0
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/fab/definition.cjs +1 -0
- package/fab/definition.js +1 -0
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -0
- package/file-picker/definition.cjs +7 -2
- package/file-picker/definition.js +7 -2
- package/file-picker/index.cjs +6 -6
- package/file-picker/index.js +82 -73
- package/icon/definition.cjs +66 -41
- package/icon/definition.js +67 -42
- package/index.cjs +21 -0
- package/index.js +1 -1
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/data-grid/locale.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +38 -38
- package/lib/date-range-picker/date-range-picker.d.ts +20 -20
- package/lib/date-time-picker/date-time-picker.d.ts +40 -40
- package/lib/dial-pad/dial-pad.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -1
- package/lib/menu/menu.d.ts +4 -4
- package/lib/rich-text-editor/definition.d.ts +3 -2
- package/lib/rich-text-editor/locale.d.ts +29 -3
- package/lib/rich-text-editor/popover.d.ts +19 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +16 -45
- package/lib/rich-text-editor/rich-text-editor.template.d.ts +2 -2
- package/lib/rich-text-editor/rte/config.d.ts +18 -0
- package/lib/rich-text-editor/rte/document.d.ts +28 -0
- package/lib/rich-text-editor/rte/exports.d.ts +23 -0
- package/lib/rich-text-editor/rte/feature.d.ts +46 -0
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +33 -0
- package/lib/rich-text-editor/rte/features/internal/foreign-html.d.ts +11 -0
- package/lib/rich-text-editor/rte/features/internal/history.d.ts +10 -0
- package/lib/rich-text-editor/rte/features/internal/text-style.d.ts +18 -0
- package/lib/rich-text-editor/rte/html-parser.d.ts +24 -0
- package/lib/rich-text-editor/rte/html-serializer.d.ts +30 -0
- package/lib/rich-text-editor/rte/instance.d.ts +57 -0
- package/lib/rich-text-editor/rte/utils/default-textblock.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/impl.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/textblock-attrs.d.ts +29 -0
- package/lib/rich-text-editor/rte/utils/textblock-marks.d.ts +10 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +109 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +6 -5
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -1
- package/lib/time-picker/time-picker.d.ts +20 -20
- package/lib/toggletip/toggletip.d.ts +4 -4
- package/lib/tooltip/tooltip.d.ts +4 -4
- package/locales/de-DE.cjs +58 -7
- package/locales/de-DE.js +58 -7
- package/locales/en-GB.cjs +60 -9
- package/locales/en-GB.js +60 -9
- package/locales/en-US.cjs +60 -9
- package/locales/en-US.js +60 -9
- package/locales/ja-JP.cjs +59 -8
- package/locales/ja-JP.js +59 -8
- package/locales/zh-CN.cjs +58 -7
- package/locales/zh-CN.js +58 -7
- package/menu/definition.cjs +1 -0
- package/menu/definition.js +1 -0
- package/number-field/definition.cjs +5 -3
- package/number-field/definition.js +5 -3
- package/number-field/index.cjs +5 -3
- package/number-field/index.js +34 -32
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +76 -62
- package/pagination/definition.cjs +2 -0
- package/pagination/definition.js +2 -0
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +2 -0
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/definition.cjs +4 -0
- package/radio/definition.js +4 -0
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/definition.cjs +2 -1
- package/range-slider/definition.js +2 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +3 -1
- package/rich-text-editor/definition.cjs +17942 -1074
- package/rich-text-editor/definition.js +17926 -1079
- package/rich-text-editor/index.cjs +29 -130
- package/rich-text-editor/index.js +5565 -2474
- package/searchable-select/definition.cjs +6 -2
- package/searchable-select/definition.js +6 -2
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +14 -10
- package/select/definition.cjs +22 -4
- package/select/definition.js +22 -4
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/patterns/anchored.d.ts +8 -8
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/localized.d.ts +386 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
- package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
- package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
- package/shared/utils/promise.d.ts +7 -0
- package/simple-color-picker/definition.cjs +11 -6
- package/simple-color-picker/definition.js +11 -6
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +44 -39
- package/slider/definition.cjs +7 -1
- package/slider/definition.js +7 -1
- package/styles/core/all.css +5 -1
- package/styles/core/theme.css +5 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/definition.cjs +1 -0
- package/switch/definition.js +1 -0
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -0
- package/tabs/definition.cjs +2 -0
- package/tabs/definition.js +2 -0
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +2 -0
- package/tag/definition.cjs +34 -14
- package/tag/definition.js +34 -14
- package/tag/index.cjs +25 -12
- package/tag/index.js +64 -47
- package/tag-group/definition.cjs +1 -2
- package/tag-group/definition.js +1 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +11 -12
- package/text-area/definition.cjs +13 -7
- package/text-area/definition.js +13 -7
- package/text-area/index.cjs +6 -6
- package/text-area/index.js +20 -14
- package/text-field/definition.cjs +16 -6
- package/text-field/definition.js +16 -6
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +5 -1
- package/toggletip/definition.js +5 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +6 -3
- package/tooltip/definition.js +6 -3
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-view/definition.cjs +28 -6
- package/tree-view/definition.js +28 -6
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +28 -6
- package/unbundled/_commonjsHelpers.cjs +0 -26
- package/unbundled/_commonjsHelpers.js +1 -26
- package/unbundled/attribute-binding-behaviour.cjs +1 -0
- package/unbundled/attribute-binding-behaviour.js +1 -0
- package/unbundled/base-color-picker.cjs +45 -21
- package/unbundled/base-color-picker.js +45 -21
- package/unbundled/base-progress.cjs +3 -0
- package/unbundled/base-progress.js +3 -0
- package/unbundled/button.cjs +14 -10
- package/unbundled/button.js +14 -10
- package/unbundled/calendar-picker.template.cjs +3 -1
- package/unbundled/calendar-picker.template.js +3 -1
- package/unbundled/definition.cjs +1 -0
- package/unbundled/definition.js +1 -0
- package/unbundled/definition2.cjs +4 -1
- package/unbundled/definition2.js +4 -1
- package/unbundled/definition3.cjs +1 -0
- package/unbundled/definition3.js +1 -0
- package/unbundled/definition4.cjs +1 -0
- package/unbundled/definition4.js +1 -0
- package/unbundled/definition5.cjs +3 -2
- package/unbundled/definition5.js +4 -3
- package/unbundled/delegates-aria.cjs +1 -0
- package/unbundled/delegates-aria.js +1 -0
- package/unbundled/form-associated.cjs +4 -0
- package/unbundled/form-associated.js +4 -0
- package/unbundled/listbox.cjs +16 -1
- package/unbundled/listbox.js +16 -1
- package/unbundled/localized.cjs +36 -0
- package/unbundled/localized.js +37 -2
- package/unbundled/mixins.cjs +2 -0
- package/unbundled/mixins.js +2 -0
- package/unbundled/picker-field.template.cjs +3 -35
- package/unbundled/picker-field.template.js +3 -34
- package/unbundled/scrollIntoView.cjs +1 -0
- package/unbundled/scrollIntoView.js +1 -0
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +5 -1
- package/unbundled/time-selection-picker.template.js +5 -1
- package/unbundled/trapped-focus.cjs +37 -0
- package/unbundled/trapped-focus.js +34 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +54 -44
- package/video-player/definition.js +50 -40
- package/video-player/index.cjs +28 -28
- package/video-player/index.js +1448 -1442
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +6463 -6099
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +0 -4
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +0 -18
- package/lib/rich-text-editor/image-placeholder/definition.d.ts +0 -2
- package/lib/rich-text-editor/image-placeholder/image-placeholder.d.ts +0 -7
- package/lib/rich-text-editor/image-placeholder/image-placeholder.template.d.ts +0 -4
- package/lib/rich-text-editor/menubar/consts.d.ts +0 -18
- package/lib/rich-text-editor/menubar/definition.d.ts +0 -2
- package/lib/rich-text-editor/menubar/menubar.d.ts +0 -386
- package/lib/rich-text-editor/menubar/menubar.template.d.ts +0 -4
|
@@ -8,15 +8,18 @@ const icon_definition = require('../icon/definition.cjs');
|
|
|
8
8
|
const mixins = require('../unbundled/mixins.cjs');
|
|
9
9
|
const fastElement = require('@microsoft/fast-element');
|
|
10
10
|
const delegatesAria = require('../unbundled/delegates-aria.cjs');
|
|
11
|
+
const index = require('../unbundled/index.cjs');
|
|
11
12
|
const withContextualHelp = require('../unbundled/with-contextual-help.cjs');
|
|
13
|
+
const trappedFocus = require('../unbundled/trapped-focus.cjs');
|
|
12
14
|
const baseColorPicker = require('../unbundled/base-color-picker.cjs');
|
|
13
15
|
const withErrorText = require('../unbundled/with-error-text.cjs');
|
|
14
16
|
const withSuccessText = require('../unbundled/with-success-text.cjs');
|
|
15
17
|
const fastWebUtilities = require('@microsoft/fast-web-utilities');
|
|
16
18
|
const textField_definition = require('../text-field/definition.cjs');
|
|
17
19
|
const button_definition = require('../unbundled/definition.cjs');
|
|
20
|
+
const tooltip_definition = require('../tooltip/definition.cjs');
|
|
18
21
|
|
|
19
|
-
const styles = ".palette{display:grid;grid-template-columns:repeat(var(--swatches-per-row, 7),var(--_color-swatch-size, 24px))}.swatch{position:relative;padding:0;border
|
|
22
|
+
const styles = ".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)}";
|
|
20
23
|
|
|
21
24
|
// Clamps a value between an upper and lower bound.
|
|
22
25
|
// We use ternary operators because it makes the minified code
|
|
@@ -596,9 +599,11 @@ class VvdHexInput extends HexInput {
|
|
|
596
599
|
this.displayName = "VvdHexInput";
|
|
597
600
|
}
|
|
598
601
|
}
|
|
602
|
+
/* v8 ignore if -- @preserve */
|
|
599
603
|
if (!customElements.get(VC_HEX_PICKER_TAG)) {
|
|
600
604
|
customElements.define(VC_HEX_PICKER_TAG, VvdHexPicker);
|
|
601
605
|
}
|
|
606
|
+
/* v8 ignore if -- @preserve */
|
|
602
607
|
if (!customElements.get(VC_HEX_INPUT_TAG)) {
|
|
603
608
|
customElements.define(VC_HEX_INPUT_TAG, VvdHexInput);
|
|
604
609
|
}
|
|
@@ -606,7 +611,11 @@ const vcPickerTag = VC_HEX_PICKER_TAG;
|
|
|
606
611
|
const vcInputTag = VC_HEX_INPUT_TAG;
|
|
607
612
|
class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
608
613
|
mixins.WithFeedback(
|
|
609
|
-
withErrorText.WithErrorText(
|
|
614
|
+
withErrorText.WithErrorText(
|
|
615
|
+
withSuccessText.WithSuccessText(
|
|
616
|
+
delegatesAria.DelegatesAria(trappedFocus.TrappedFocus(baseColorPicker.BaseColorPicker(vividElement.VividElement)))
|
|
617
|
+
)
|
|
618
|
+
)
|
|
610
619
|
)
|
|
611
620
|
) {
|
|
612
621
|
constructor() {
|
|
@@ -614,20 +623,6 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
614
623
|
this.disableSavedColors = false;
|
|
615
624
|
this.savedColors = [];
|
|
616
625
|
this.maxSwatches = 6;
|
|
617
|
-
this.copyIconName = "copy-2-line";
|
|
618
|
-
this.#iconResetTimer = null;
|
|
619
|
-
/**
|
|
620
|
-
* @internal
|
|
621
|
-
*/
|
|
622
|
-
this._copyValueToClipboard = async (value) => {
|
|
623
|
-
try {
|
|
624
|
-
await navigator.clipboard.writeText(value);
|
|
625
|
-
this._setTemporaryCopyIcon("check-circle-line");
|
|
626
|
-
} catch {
|
|
627
|
-
alert(this.locale?.colorPicker?.copyErrorText);
|
|
628
|
-
this._setTemporaryCopyIcon("error-line");
|
|
629
|
-
}
|
|
630
|
-
};
|
|
631
626
|
/**
|
|
632
627
|
* @internal
|
|
633
628
|
*/
|
|
@@ -637,14 +632,23 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
637
632
|
}
|
|
638
633
|
this.open = false;
|
|
639
634
|
};
|
|
635
|
+
this.copyIconName = "copy-2-line";
|
|
636
|
+
this.#iconResetTimer = null;
|
|
640
637
|
/**
|
|
641
638
|
* @internal
|
|
642
639
|
*/
|
|
643
|
-
this
|
|
644
|
-
|
|
645
|
-
|
|
640
|
+
this._copyValueToClipboard = async (value) => {
|
|
641
|
+
try {
|
|
642
|
+
await navigator.clipboard.writeText(value);
|
|
643
|
+
this._setTemporaryCopyIcon("check-circle-line");
|
|
644
|
+
this._ariaLiveDescription = this.locale.colorPicker.copySuccessMessage(value);
|
|
645
|
+
} catch {
|
|
646
|
+
alert(this.locale.colorPicker.copyErrorText);
|
|
647
|
+
this._setTemporaryCopyIcon("error-line");
|
|
648
|
+
this._ariaLiveDescription = this.locale.colorPicker.copyErrorText;
|
|
646
649
|
}
|
|
647
650
|
};
|
|
651
|
+
this._ariaLiveDescription = "";
|
|
648
652
|
}
|
|
649
653
|
static {
|
|
650
654
|
/**
|
|
@@ -658,6 +662,7 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
658
662
|
* @internal
|
|
659
663
|
*/
|
|
660
664
|
placeholderChanged() {
|
|
665
|
+
/* v8 ignore if -- @preserve */
|
|
661
666
|
if (this.proxy instanceof HTMLInputElement) {
|
|
662
667
|
this.proxy.placeholder = this.placeholder;
|
|
663
668
|
}
|
|
@@ -670,6 +675,16 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
670
675
|
handleChange() {
|
|
671
676
|
this.$emit("change");
|
|
672
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* @internal
|
|
680
|
+
*/
|
|
681
|
+
openChanged(_oldValue, newValue) {
|
|
682
|
+
if (newValue && this.isConnected) {
|
|
683
|
+
requestAnimationFrame(() => {
|
|
684
|
+
this._refreshCanvasColor();
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
}
|
|
673
688
|
/**
|
|
674
689
|
* @internal
|
|
675
690
|
*/
|
|
@@ -690,6 +705,71 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
690
705
|
_handleColorSaving() {
|
|
691
706
|
this._saveCurrentColor();
|
|
692
707
|
}
|
|
708
|
+
/**
|
|
709
|
+
* @internal
|
|
710
|
+
*/
|
|
711
|
+
_saveCurrentColor() {
|
|
712
|
+
const value = this.value;
|
|
713
|
+
if (typeof value !== "string" || !baseColorPicker.isValidHexColor(value)) return;
|
|
714
|
+
const swatches = Array.isArray(this.savedColors) ? [...this.savedColors] : [];
|
|
715
|
+
const idx = swatches.findIndex((s) => s?.value === value);
|
|
716
|
+
if (idx !== -1) swatches.splice(idx, 1);
|
|
717
|
+
swatches.unshift({ value });
|
|
718
|
+
this.savedColors = swatches.slice(0, this._maxSwatchesNormalized);
|
|
719
|
+
this._setSavedColors(this.savedColors);
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* @internal
|
|
723
|
+
*/
|
|
724
|
+
_loadSavedColors() {
|
|
725
|
+
try {
|
|
726
|
+
const savedColors = localStorage.getItem(this._savedColorsStorageKey);
|
|
727
|
+
if (!savedColors) return [];
|
|
728
|
+
const parsed = JSON.parse(savedColors);
|
|
729
|
+
if (!Array.isArray(parsed)) return [];
|
|
730
|
+
return parsed.filter(
|
|
731
|
+
(x) => x && typeof x.value === "string" && baseColorPicker.isValidHexColor(x.value)
|
|
732
|
+
).map((x) => ({
|
|
733
|
+
value: x.value,
|
|
734
|
+
label: typeof x.label === "string" ? x.label : void 0
|
|
735
|
+
}));
|
|
736
|
+
} catch {
|
|
737
|
+
return [];
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* @internal
|
|
742
|
+
*/
|
|
743
|
+
_setSavedColors(swatches) {
|
|
744
|
+
try {
|
|
745
|
+
localStorage.setItem(
|
|
746
|
+
this._savedColorsStorageKey,
|
|
747
|
+
JSON.stringify(swatches)
|
|
748
|
+
);
|
|
749
|
+
} catch {
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Get all color swatches combined, both from swatches property and saved colors
|
|
754
|
+
* @internal
|
|
755
|
+
*/
|
|
756
|
+
get allSwatches() {
|
|
757
|
+
const predefinedColors = Array.isArray(this.swatches) ? this.swatches : [];
|
|
758
|
+
const savedColors = Array.isArray(this.savedColors) ? this.savedColors : [];
|
|
759
|
+
const seen = /* @__PURE__ */ new Set();
|
|
760
|
+
const merged = [];
|
|
761
|
+
const appendIfUniqueAndValid = (swatch) => {
|
|
762
|
+
if (!swatch || typeof swatch.value !== "string") return;
|
|
763
|
+
if (!baseColorPicker.isValidHexColor(swatch.value) || seen.has(swatch.value)) return;
|
|
764
|
+
seen.add(swatch.value);
|
|
765
|
+
merged.push(swatch);
|
|
766
|
+
};
|
|
767
|
+
if (!this.disableSavedColors) {
|
|
768
|
+
savedColors.forEach(appendIfUniqueAndValid);
|
|
769
|
+
}
|
|
770
|
+
predefinedColors.forEach(appendIfUniqueAndValid);
|
|
771
|
+
return merged.slice(0, this._maxSwatchesNormalized);
|
|
772
|
+
}
|
|
693
773
|
/**
|
|
694
774
|
* @internal
|
|
695
775
|
*/
|
|
@@ -736,6 +816,7 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
736
816
|
* @internal
|
|
737
817
|
*/
|
|
738
818
|
get _buttonColor() {
|
|
819
|
+
/* v8 ignore else -- @preserve */
|
|
739
820
|
if (!this._canvasColor) {
|
|
740
821
|
this._refreshCanvasColor();
|
|
741
822
|
}
|
|
@@ -764,24 +845,11 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
764
845
|
const path = e.composedPath?.();
|
|
765
846
|
return !!(path && path.includes(el));
|
|
766
847
|
}
|
|
767
|
-
#
|
|
768
|
-
/**
|
|
769
|
-
* @internal
|
|
770
|
-
*/
|
|
771
|
-
_setTemporaryCopyIcon(name, ms = 2e3) {
|
|
772
|
-
this.copyIconName = name;
|
|
773
|
-
if (this.#iconResetTimer) clearTimeout(this.#iconResetTimer);
|
|
774
|
-
this.#iconResetTimer = setTimeout(() => {
|
|
775
|
-
this.copyIconName = "copy-2-line";
|
|
776
|
-
this.#iconResetTimer = null;
|
|
777
|
-
}, ms);
|
|
778
|
-
}
|
|
848
|
+
#closeOnPointerOutside;
|
|
779
849
|
connectedCallback() {
|
|
780
850
|
super.connectedCallback();
|
|
781
|
-
this._refreshCanvasColor();
|
|
782
851
|
this.savedColors = this._loadSavedColors();
|
|
783
852
|
document.addEventListener("mousedown", this.#closeOnPointerOutside, true);
|
|
784
|
-
document.addEventListener("keydown", this.#closeOnEscape);
|
|
785
853
|
}
|
|
786
854
|
disconnectedCallback() {
|
|
787
855
|
super.disconnectedCallback();
|
|
@@ -790,74 +858,67 @@ class ColorPicker extends withContextualHelp.WithContextualHelp(
|
|
|
790
858
|
this.#closeOnPointerOutside,
|
|
791
859
|
true
|
|
792
860
|
);
|
|
793
|
-
document.removeEventListener("keydown", this.#closeOnEscape);
|
|
794
861
|
}
|
|
795
|
-
#
|
|
796
|
-
#closeOnEscape;
|
|
862
|
+
#iconResetTimer;
|
|
797
863
|
/**
|
|
798
864
|
* @internal
|
|
799
865
|
*/
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
if (
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
this.savedColors = swatches.slice(0, this._maxSwatchesNormalized);
|
|
808
|
-
this._setSavedColors(this.savedColors);
|
|
866
|
+
_setTemporaryCopyIcon(name, ms = 2e3) {
|
|
867
|
+
this.copyIconName = name;
|
|
868
|
+
if (this.#iconResetTimer) clearTimeout(this.#iconResetTimer);
|
|
869
|
+
this.#iconResetTimer = setTimeout(() => {
|
|
870
|
+
this.copyIconName = "copy-2-line";
|
|
871
|
+
this.#iconResetTimer = null;
|
|
872
|
+
}, ms);
|
|
809
873
|
}
|
|
874
|
+
// --- Trapped focus ---
|
|
810
875
|
/**
|
|
811
876
|
* @internal
|
|
812
877
|
*/
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
const parsed = JSON.parse(savedColors);
|
|
818
|
-
if (!Array.isArray(parsed)) return [];
|
|
819
|
-
return parsed.filter(
|
|
820
|
-
(x) => x && typeof x.value === "string" && baseColorPicker.isValidHexColor(x.value)
|
|
821
|
-
).map((x) => ({
|
|
822
|
-
value: x.value,
|
|
823
|
-
label: typeof x.label === "string" ? x.label : void 0
|
|
824
|
-
}));
|
|
825
|
-
} catch {
|
|
826
|
-
return [];
|
|
878
|
+
_onBaseKeydown(event) {
|
|
879
|
+
if (this.open && index.handleEscapeKeyAndStopPropogation(event)) {
|
|
880
|
+
this.open = false;
|
|
881
|
+
return false;
|
|
827
882
|
}
|
|
883
|
+
if (this._trappedFocus(event, () => this._focusableElsWithinDialog())) {
|
|
884
|
+
return false;
|
|
885
|
+
}
|
|
886
|
+
return true;
|
|
828
887
|
}
|
|
829
888
|
/**
|
|
830
889
|
* @internal
|
|
831
890
|
*/
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
891
|
+
_focusableElsWithinDialog() {
|
|
892
|
+
return this._popupEl.querySelectorAll(
|
|
893
|
+
'button:not([role="gridcell"]), [data-vvd-component="button"], vwc-button:not([role="gridcell"])'
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* @internal
|
|
898
|
+
*/
|
|
899
|
+
_handleCellKeydown(event, value, index, isSaveCell) {
|
|
900
|
+
if (event.key === "Tab") {
|
|
901
|
+
event.preventDefault();
|
|
902
|
+
const focusableEls = this._focusableElsWithinDialog();
|
|
903
|
+
const idx = Array.prototype.indexOf.call(
|
|
904
|
+
focusableEls,
|
|
905
|
+
event.currentTarget
|
|
837
906
|
);
|
|
838
|
-
|
|
907
|
+
const nextIdx = event.shiftKey ? (idx - 1 + focusableEls.length) % focusableEls.length : (idx + 1) % focusableEls.length;
|
|
908
|
+
focusableEls[nextIdx]?.focus();
|
|
909
|
+
return false;
|
|
839
910
|
}
|
|
911
|
+
return super._handleCellKeydown(event, value, index, isSaveCell);
|
|
840
912
|
}
|
|
841
913
|
/**
|
|
842
|
-
* Get all color swatches combined, both from swatches property and saved colors
|
|
843
914
|
* @internal
|
|
844
915
|
*/
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
const merged = [];
|
|
850
|
-
const appendIfUniqueAndValid = (swatch) => {
|
|
851
|
-
if (!swatch || typeof swatch.value !== "string") return;
|
|
852
|
-
if (!baseColorPicker.isValidHexColor(swatch.value) || seen.has(swatch.value)) return;
|
|
853
|
-
seen.add(swatch.value);
|
|
854
|
-
merged.push(swatch);
|
|
855
|
-
};
|
|
856
|
-
if (!this.disableSavedColors) {
|
|
857
|
-
savedColors.forEach(appendIfUniqueAndValid);
|
|
916
|
+
_handleSwatchSelection(value) {
|
|
917
|
+
/* v8 ignore else -- @preserve */
|
|
918
|
+
if (this.value !== value) {
|
|
919
|
+
this._ariaLiveDescription = this.locale.colorPicker.selectionSuccessMessage(value);
|
|
858
920
|
}
|
|
859
|
-
|
|
860
|
-
return merged.slice(0, this._maxSwatchesNormalized);
|
|
921
|
+
super._handleSwatchSelection(value);
|
|
861
922
|
}
|
|
862
923
|
}
|
|
863
924
|
__decorateClass([
|
|
@@ -885,6 +946,9 @@ __decorateClass([
|
|
|
885
946
|
__decorateClass([
|
|
886
947
|
fastElement.observable
|
|
887
948
|
], ColorPicker.prototype, "copyIconName");
|
|
949
|
+
__decorateClass([
|
|
950
|
+
fastElement.observable
|
|
951
|
+
], ColorPicker.prototype, "_ariaLiveDescription");
|
|
888
952
|
|
|
889
953
|
function renderTextField(textFieldTag, iconTag) {
|
|
890
954
|
const getClasses = (_) => fastWebUtilities.classNames("control");
|
|
@@ -915,6 +979,8 @@ function renderTextField(textFieldTag, iconTag) {
|
|
|
915
979
|
>
|
|
916
980
|
<button
|
|
917
981
|
aria-label="${(x) => x.locale.colorPicker.pickerButtonLabel}"
|
|
982
|
+
aria-expanded="${(x) => x.open}"
|
|
983
|
+
aria-haspopup="dialog"
|
|
918
984
|
class="button ${(x) => fastWebUtilities.classNames(
|
|
919
985
|
x._applyContrastClass(x._buttonColor) ? "contrast" : "",
|
|
920
986
|
x.disabled ? "disabled" : ""
|
|
@@ -942,9 +1008,9 @@ function renderTextField(textFieldTag, iconTag) {
|
|
|
942
1008
|
function renderPopupHeader(buttonTag, iconTag) {
|
|
943
1009
|
return fastElement.html`
|
|
944
1010
|
<div class="header">
|
|
945
|
-
<
|
|
1011
|
+
<h2 class="header-title" id="color-picker-title">
|
|
946
1012
|
<slot name="popup-text">${(x) => x.locale.colorPicker.popupLabel}</slot>
|
|
947
|
-
</
|
|
1013
|
+
</h2>
|
|
948
1014
|
<${buttonTag} size="condensed"
|
|
949
1015
|
aria-label="${(x) => x.locale.colorPicker.closeButtonLabel}"
|
|
950
1016
|
@click="${(x) => x._handleCloseRequest()}">
|
|
@@ -953,7 +1019,7 @@ function renderPopupHeader(buttonTag, iconTag) {
|
|
|
953
1019
|
</div>
|
|
954
1020
|
`;
|
|
955
1021
|
}
|
|
956
|
-
function renderPopupBody(buttonTag, iconTag) {
|
|
1022
|
+
function renderPopupBody(buttonTag, iconTag, tooltipTag) {
|
|
957
1023
|
return fastElement.html`
|
|
958
1024
|
<div class="body">
|
|
959
1025
|
<${fastElement.html.partial(vcPickerTag)}
|
|
@@ -969,24 +1035,37 @@ function renderPopupBody(buttonTag, iconTag) {
|
|
|
969
1035
|
color="${(x) => x.value}"
|
|
970
1036
|
@color-changed="${(x, c) => x._onPickerColorChanged(c.event)}"
|
|
971
1037
|
${fastElement.ref("_vcHexInputEl")}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
</${
|
|
1038
|
+
>
|
|
1039
|
+
<input name="hex-code-input" aria-label="${(x) => x.locale.colorPicker.hexInputLabel}"
|
|
1040
|
+
placeholder="${(x) => x.placeholder}"
|
|
1041
|
+
@blur="${(x, c) => c.event.stopImmediatePropagation()}"
|
|
1042
|
+
part="input">
|
|
1043
|
+
</${fastElement.html.partial(vcInputTag)}>
|
|
1044
|
+
<${tooltipTag} placement="top"
|
|
1045
|
+
text="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
1046
|
+
exportparts="vvd-theme-alternate">
|
|
1047
|
+
<${buttonTag}
|
|
1048
|
+
slot="anchor" size="normal"
|
|
1049
|
+
aria-label="${(x) => x.locale.colorPicker.copyButtonLabel}"
|
|
1050
|
+
@click="${(x) => x._copyValueToClipboard(x.value)}">
|
|
1051
|
+
<${iconTag} slot="icon" name="${(x) => x.copyIconName}"></${iconTag}>
|
|
1052
|
+
</${buttonTag}>
|
|
1053
|
+
</${tooltipTag}>
|
|
978
1054
|
</div>
|
|
979
1055
|
</div>
|
|
980
1056
|
`;
|
|
981
1057
|
}
|
|
982
|
-
function renderPopupFooter(buttonTag, iconTag) {
|
|
1058
|
+
function renderPopupFooter(buttonTag, iconTag, tooltipTag) {
|
|
983
1059
|
return fastElement.html`
|
|
984
1060
|
<div class="footer">
|
|
985
|
-
<
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1061
|
+
<div class="footer-header">
|
|
1062
|
+
<span class="footer-title" id="color-picker-footer-title"
|
|
1063
|
+
><slot name="swatches-text"
|
|
1064
|
+
>${(x) => x.locale.colorPicker.swatchesLabel}</slot
|
|
1065
|
+
></span
|
|
1066
|
+
>
|
|
1067
|
+
${fastElement.when((x) => !x.disableSavedColors, renderSwatchesCount())}
|
|
1068
|
+
</div>
|
|
990
1069
|
<div
|
|
991
1070
|
class="palette"
|
|
992
1071
|
role="grid"
|
|
@@ -997,41 +1076,62 @@ function renderPopupFooter(buttonTag, iconTag) {
|
|
|
997
1076
|
>
|
|
998
1077
|
${fastElement.repeat(
|
|
999
1078
|
(x) => x.allSwatches,
|
|
1000
|
-
(x) => x._renderColorSwatch(iconTag),
|
|
1079
|
+
(x) => x._renderColorSwatch(iconTag, tooltipTag),
|
|
1001
1080
|
{ positioning: true }
|
|
1002
1081
|
)}
|
|
1003
1082
|
${fastElement.when(
|
|
1004
1083
|
(x) => !x.disableSavedColors,
|
|
1005
1084
|
fastElement.html`
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1085
|
+
<${tooltipTag} placement="top"
|
|
1086
|
+
text="${(x) => x.locale.colorPicker.saveButtonLabel}"
|
|
1087
|
+
exportparts="vvd-theme-alternate">
|
|
1088
|
+
<${buttonTag}
|
|
1089
|
+
slot="anchor"
|
|
1090
|
+
appearance="outlined"
|
|
1091
|
+
size="super-condensed"
|
|
1092
|
+
role="gridcell"
|
|
1093
|
+
tabindex="${(x) => x.allSwatches.length ? "-1" : "0"}"
|
|
1094
|
+
aria-label="${(x) => x.locale.colorPicker.saveButtonLabel}"
|
|
1095
|
+
@click="${(x) => x._saveCurrentColor()}"
|
|
1096
|
+
@keydown="${(x, c) => x._handleCellKeydown(
|
|
1014
1097
|
c.event,
|
|
1015
1098
|
x.value,
|
|
1016
1099
|
x.allSwatches.length,
|
|
1017
1100
|
true
|
|
1018
1101
|
)}">
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1102
|
+
<${iconTag} slot="icon" name="plus-line"></${iconTag}>
|
|
1103
|
+
</${buttonTag}>
|
|
1104
|
+
</${tooltipTag}>
|
|
1105
|
+
`
|
|
1023
1106
|
)}
|
|
1024
1107
|
</div>
|
|
1025
1108
|
</div>
|
|
1026
1109
|
`;
|
|
1027
1110
|
}
|
|
1111
|
+
function renderSwatchesCount() {
|
|
1112
|
+
return fastElement.html`
|
|
1113
|
+
<span
|
|
1114
|
+
id="swatches-count"
|
|
1115
|
+
class="swatches-count"
|
|
1116
|
+
aria-label="${(x) => x.locale.colorPicker.maxSwatchesMessage(
|
|
1117
|
+
x.allSwatches.length,
|
|
1118
|
+
x.maxSwatches
|
|
1119
|
+
)}"
|
|
1120
|
+
>${(x) => `${x.allSwatches.length}/${x.maxSwatches}`}</span
|
|
1121
|
+
>
|
|
1122
|
+
`;
|
|
1123
|
+
}
|
|
1028
1124
|
const ColorPickerTemplate = (context) => {
|
|
1029
1125
|
const textFieldTag = context.tagFor(textField_definition.VwcTextFieldElement);
|
|
1030
1126
|
const iconTag = context.tagFor(icon_definition.VwcIconElement);
|
|
1031
1127
|
const popupTag = context.tagFor(popup_definition.Popup);
|
|
1032
1128
|
const buttonTag = context.tagFor(button_definition.Button);
|
|
1129
|
+
const tooltipTag = context.tagFor(tooltip_definition.VwcTooltipElement);
|
|
1033
1130
|
return fastElement.html`
|
|
1034
|
-
<div class="base">
|
|
1131
|
+
<div class="base" @keydown="${(x, { event }) => x._onBaseKeydown(event)}">
|
|
1132
|
+
<span aria-live="assertive" aria-relevant="text" class="visually-hidden">
|
|
1133
|
+
${(x) => x._ariaLiveDescription}
|
|
1134
|
+
</span>
|
|
1035
1135
|
${renderTextField(textFieldTag, iconTag)}
|
|
1036
1136
|
<${popupTag}
|
|
1037
1137
|
:open="${(x) => x.open}"
|
|
@@ -1044,10 +1144,10 @@ const ColorPickerTemplate = (context) => {
|
|
|
1044
1144
|
aria-modal="true"
|
|
1045
1145
|
aria-labelledby="color-picker-title">
|
|
1046
1146
|
${renderPopupHeader(buttonTag, iconTag)}
|
|
1047
|
-
${renderPopupBody(buttonTag, iconTag)}
|
|
1147
|
+
${renderPopupBody(buttonTag, iconTag, tooltipTag)}
|
|
1048
1148
|
${fastElement.when(
|
|
1049
1149
|
(x) => !x.disableSavedColors || x.allSwatches.length > 0,
|
|
1050
|
-
renderPopupFooter(buttonTag, iconTag)
|
|
1150
|
+
renderPopupFooter(buttonTag, iconTag, tooltipTag)
|
|
1051
1151
|
)}
|
|
1052
1152
|
</div>
|
|
1053
1153
|
</${popupTag}>
|
|
@@ -1064,6 +1164,7 @@ const colorPickerDefinition = vividElement.defineVividComponent(
|
|
|
1064
1164
|
icon_definition.iconDefinition,
|
|
1065
1165
|
textField_definition.textFieldDefinition,
|
|
1066
1166
|
button_definition.buttonDefinition,
|
|
1167
|
+
tooltip_definition.tooltipDefinition,
|
|
1067
1168
|
mixins.feedbackMessageDefinition
|
|
1068
1169
|
],
|
|
1069
1170
|
{
|