@vonage/vivid 5.3.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.
- package/accordion-item/definition.js +1 -1
- package/alert/definition.cjs +1 -1
- package/alert/definition.js +2 -2
- package/badge/definition.js +1 -1
- package/banner/definition.js +1 -1
- package/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +98 -81
- package/bundled/calendar-picker.template.cjs +7 -7
- package/bundled/calendar-picker.template.js +102 -102
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +1 -1
- package/bundled/definition10.js +2 -2
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +87 -66
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +217 -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 +83 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +114 -71
- package/bundled/definition19.cjs +26 -27
- package/bundled/definition19.js +171 -180
- package/bundled/definition2.cjs +9 -9
- package/bundled/definition2.js +84 -129
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition6.cjs +3 -3
- package/bundled/definition6.js +19 -19
- package/bundled/definition9.cjs +5 -5
- package/bundled/definition9.js +394 -392
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +82 -102
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +48 -31
- package/bundled/mixins.cjs +1 -1
- package/bundled/mixins.js +1 -1
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +35 -56
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +13 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +5 -1
- package/bundled/vivid-element.js +401 -358
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +171 -143
- package/card/definition.cjs +1 -1
- package/card/definition.js +1 -1
- package/color-picker/definition.cjs +209 -113
- package/color-picker/definition.js +209 -113
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +412 -326
- package/combobox/definition.cjs +7 -27
- package/combobox/definition.js +8 -28
- package/combobox/index.cjs +6 -6
- package/combobox/index.js +57 -71
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +354 -2
- package/data-grid/index.cjs +1 -1
- package/data-grid/index.js +1 -1
- package/date-picker/definition.cjs +1 -1
- package/date-picker/definition.js +1 -1
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +1 -1
- package/date-range-picker/definition.js +1 -1
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-time-picker/definition.cjs +1 -1
- package/date-time-picker/definition.js +1 -1
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +139 -0
- package/dial-pad/definition.js +139 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +177 -100
- package/dialog/definition.cjs +2 -2
- package/dialog/definition.js +2 -2
- package/dialog/index.cjs +7 -7
- package/dialog/index.js +6 -6
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/elevation/definition.cjs +1 -1
- package/elevation/definition.js +1 -1
- package/fab/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/icon/definition.cjs +56 -22
- package/icon/definition.js +56 -22
- package/index.cjs +3 -4
- package/index.js +2 -3
- package/lib/accordion/accordion.d.ts +1 -1
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/combobox/combobox.d.ts +1 -0
- package/lib/combobox/combobox.options.d.ts +1 -1
- 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/divider/divider.d.ts +1 -1
- package/lib/icon/icon.d.ts +1 -0
- package/lib/menu-item/menu-item-role.d.ts +1 -1
- package/lib/popup/popup.d.ts +1 -1
- package/lib/searchable-select/locale.d.ts +4 -0
- package/lib/searchable-select/searchable-select.d.ts +3 -0
- package/lib/select/select.d.ts +3 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -1
- package/lib/slider/slider.d.ts +1 -1
- package/lib/tabs/tabs.d.ts +2 -2
- 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/locales/de-DE.cjs +20 -3
- package/locales/de-DE.js +20 -3
- package/locales/en-GB.cjs +21 -4
- package/locales/en-GB.js +21 -4
- package/locales/en-US.cjs +21 -4
- package/locales/en-US.js +21 -4
- package/locales/ja-JP.cjs +20 -3
- package/locales/ja-JP.js +20 -3
- package/locales/zh-CN.cjs +19 -2
- package/locales/zh-CN.js +19 -2
- package/menu/definition.cjs +4 -4
- package/menu/definition.js +4 -4
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +3 -3
- package/option/definition.cjs +6 -77
- package/option/definition.js +3 -78
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +31 -5
- package/popup/definition.cjs +2 -2
- package/popup/definition.js +2 -2
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- 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 +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +2 -3
- package/rich-text-editor/definition.js +1 -2
- package/rich-text-editor/index.cjs +27 -27
- package/rich-text-editor/index.js +1209 -1199
- package/searchable-select/definition.cjs +103 -11
- package/searchable-select/definition.js +103 -11
- package/searchable-select/index.cjs +81 -69
- package/searchable-select/index.js +359 -273
- package/select/definition.cjs +30 -44
- package/select/definition.js +30 -44
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +2 -2
- package/shared/aria/aria-mixin.d.ts +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/foundation/listbox/listbox.d.ts +4 -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/simple-color-picker/definition.cjs +9 -7
- package/simple-color-picker/definition.js +9 -7
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +41 -39
- package/slider/definition.cjs +1 -1
- package/slider/definition.js +1 -1
- package/split-button/definition.js +1 -1
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -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/tab/definition.js +1 -1
- package/tag/definition.cjs +34 -14
- package/tag/definition.js +35 -15
- 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/index.cjs +1 -1
- package/text-area/index.js +2 -2
- package/text-field/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +1 -1
- package/toggletip/definition.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +3 -3
- package/tooltip/definition.js +3 -3
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/affix.js +1 -1
- package/unbundled/base-color-picker.cjs +36 -18
- package/unbundled/base-color-picker.js +36 -18
- package/unbundled/calendar-picker.template.cjs +2 -2
- package/unbundled/calendar-picker.template.js +2 -2
- package/unbundled/definition.js +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition3.cjs +222 -141
- package/unbundled/definition3.js +220 -139
- package/unbundled/definition4.cjs +145 -235
- package/unbundled/definition4.js +143 -233
- package/unbundled/definition5.cjs +269 -27
- package/unbundled/definition5.js +267 -26
- package/unbundled/definition6.cjs +56 -0
- package/unbundled/definition6.js +52 -0
- package/unbundled/listbox.cjs +41 -63
- package/unbundled/listbox.js +39 -61
- package/unbundled/picker-field.template.cjs +3 -36
- package/unbundled/picker-field.template.js +3 -35
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +2 -1
- package/unbundled/time-selection-picker.template.js +2 -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 +56 -16
- package/video-player/definition.js +56 -16
- package/video-player/index.cjs +36 -36
- package/video-player/index.js +2461 -2445
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +285 -38
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
- package/bundled/option.cjs +0 -1
- package/bundled/option.js +0 -158
- package/unbundled/option.cjs +0 -217
- package/unbundled/option.js +0 -214
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
2
2
|
import { iconDefinition } from '../icon/definition.js';
|
|
3
3
|
import { attr, nullableNumberConverter, observable, html, ref, slotted, when } from '@microsoft/fast-element';
|
|
4
|
-
import {
|
|
4
|
+
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from '../unbundled/affix.js';
|
|
5
5
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
6
6
|
|
|
7
7
|
const styles = ":host{--_vvd-accordion-item-accent-firm-wrapper: var( --vvd-accordion-item-accent-firm )}.heading-button{--vvd-accordion-item-accent-firm: var( --_vvd-accordion-item-accent-firm-wrapper, var(--vvd-accordion-item-accent-primary) )}:host{display:flex;box-sizing:border-box;flex-direction:column}.heading-container{margin:0}.heading-button,.heading-button.appearance-ghost-light{--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: transparent;--_appearance-color-outline: transparent}.heading-button.appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}@media (hover: hover){.heading-button:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.heading-button:hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost-light{--_appearance-color-text: var(--_connotation-color-fierce-primary);--_appearance-color-fill: color-mix(in srgb, var(--_connotation-color-primary), transparent 90%);--_appearance-color-outline: transparent}.heading-button:hover:where(:not(.disabled,:disabled,.readonly)).appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}}.heading-button.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-faint);--_appearance-color-outline: transparent}.heading-button.hover:where(:not(.disabled,:disabled,.readonly)).appearance-ghost-light{--_appearance-color-text: var(--_connotation-color-fierce-primary);--_appearance-color-fill: color-mix(in srgb, var(--_connotation-color-primary), transparent 90%);--_appearance-color-outline: transparent}.heading-button.hover:where(:not(.disabled,:disabled,.readonly)).appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary-increment);--_appearance-color-outline: transparent}.heading-button:active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.heading-button:active:where(:not(.disabled,:disabled)).appearance-ghost-light{--_appearance-color-text: var(--_connotation-color-fierce-primary);--_appearance-color-fill: color-mix(in srgb, var(--_connotation-color-primary), transparent 80%);--_appearance-color-outline: transparent}.heading-button:active:where(:not(.disabled,:disabled)).appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-fierce);--_appearance-color-outline: transparent}.heading-button.active:where(:not(.disabled,:disabled)){--_appearance-color-text: var(--_connotation-color-firm);--_appearance-color-fill: var(--_connotation-color-soft);--_appearance-color-outline: transparent}.heading-button.active:where(:not(.disabled,:disabled)).appearance-ghost-light{--_appearance-color-text: var(--_connotation-color-fierce-primary);--_appearance-color-fill: color-mix(in srgb, var(--_connotation-color-primary), transparent 80%);--_appearance-color-outline: transparent}.heading-button.active:where(:not(.disabled,:disabled)).appearance-filled{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-fierce);--_appearance-color-outline: transparent}.heading-button{--_connotation-color-primary: var(--vvd-accordion-item-accent-primary, var(--vvd-color-canvas-text));--_connotation-color-primary-text: var(--vvd-accordion-item-accent-primary-text, var(--vvd-color-canvas));--_connotation-color-primary-increment: var(--vvd-accordion-item-accent-primary-increment, var(--vvd-color-neutral-800));--_connotation-color-fierce: var(--vvd-accordion-item-accent-fierce, var(--vvd-color-neutral-700));--_connotation-color-faint: var(--vvd-accordion-item-accent-faint, var(--vvd-color-neutral-50));--_connotation-color-soft: var(--vvd-accordion-item-accent-soft, var(--vvd-color-neutral-100));--_connotation-color-firm: var(--vvd-accordion-item-accent-firm, var(--vvd-color-canvas-text))}.heading-button{--focus-stroke-gap-color: transparent;display:flex;width:100%;align-items:center;padding:16px;border:none;background-color:var(--_appearance-color-fill);color:var(--_appearance-color-text);cursor:pointer;text-align:left}.heading-button: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))}.heading-button.size-condensed{font:var(--vvd-typography-base-extended-bold);gap:12px}.heading-button:not(.size-condensed){font:var(--vvd-typography-heading-4);gap:16px}.heading-content{flex:auto}.meta{overflow:hidden;max-width:var(--accordion-item-meta-inline-size, 20%);flex-shrink:0;color:var(--vvd-color-neutral-600);text-align:end;text-overflow:ellipsis;white-space:nowrap}.heading-button:not(.size-condensed) .meta{font:var(--vvd-typography-base-bold)}.heading-button.size-condensed .meta{font:var(--vvd-typography-base-condensed-bold)}.region{display:none;padding:8px 32px 24px 16px}.region:not(.size-condensed).padded{padding-inline-start:52px}:host([expanded]) .region{display:block}.region.size-condensed.padded{padding-inline-start:44px}slot[name=icon]{color:var(--vvd-color-neutral-600)}.heading-button:not(.size-condensed) slot[name=icon]{font:inherit}.heading-button.size-condensed slot[name=icon]{font:var(--vvd-typography-base-extended)}:host(:not([icon-trailing])) slot[name=icon]:last-of-type{color:var(--_appearance-color-text)}";
|
package/alert/definition.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const button_definition = require('../unbundled/definition.cjs');
|
|
6
|
-
const elevation_definition = require('../unbundled/
|
|
6
|
+
const elevation_definition = require('../unbundled/definition6.cjs');
|
|
7
7
|
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
8
8
|
const icon_definition = require('../icon/definition.cjs');
|
|
9
9
|
const fastElement = require('@microsoft/fast-element');
|
package/alert/definition.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { B as Button, b as buttonDefinition } from '../unbundled/definition.js';
|
|
2
|
-
import { E as Elevation, e as elevationDefinition } from '../unbundled/
|
|
2
|
+
import { E as Elevation, e as elevationDefinition } from '../unbundled/definition6.js';
|
|
3
3
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
4
4
|
import { iconDefinition } from '../icon/definition.js';
|
|
5
5
|
import { attr, nullableNumberConverter, when, html } from '@microsoft/fast-element';
|
|
6
6
|
import { C as Connotation } from '../unbundled/enums.js';
|
|
7
|
-
import {
|
|
7
|
+
import { A as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper, c as IconAriaHidden } from '../unbundled/affix.js';
|
|
8
8
|
import { h as handleEscapeKeyAndStopPropogation } from '../unbundled/index.js';
|
|
9
9
|
import { L as Localized } from '../unbundled/localized.js';
|
|
10
10
|
import { classNames } from '@microsoft/fast-web-utilities';
|
package/badge/definition.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
2
2
|
import { iconDefinition } from '../icon/definition.js';
|
|
3
3
|
import { attr, when, html } from '@microsoft/fast-element';
|
|
4
|
-
import {
|
|
4
|
+
import { b as AffixIconWithTrailing, a as affixIconTemplateFactory, I as IconWrapper } from '../unbundled/affix.js';
|
|
5
5
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
package/banner/definition.js
CHANGED
|
@@ -4,7 +4,7 @@ import { V as VividElement, d as defineVividComponent, c as createRegisterFuncti
|
|
|
4
4
|
import { attr, observable, slotted, when, html } from '@microsoft/fast-element';
|
|
5
5
|
import { C as Connotation } from '../unbundled/enums.js';
|
|
6
6
|
import { D as DelegatesAria, d as delegateAria } from '../unbundled/delegates-aria.js';
|
|
7
|
-
import {
|
|
7
|
+
import { A as AffixIcon, a as affixIconTemplateFactory, I as IconWrapper, c as IconAriaHidden } from '../unbundled/affix.js';
|
|
8
8
|
import { L as Localized } from '../unbundled/localized.js';
|
|
9
9
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
10
10
|
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
"use strict";const m=require("./form-associated.cjs"),u=require("./vivid-element.cjs"),
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
"use strict";const m=require("./form-associated.cjs"),u=require("./vivid-element.cjs"),g=require("./when.cjs"),y=require("./localized.cjs"),S=require("./form-element.cjs"),b=require("./class-names.cjs");function C(a){if(!a)return null;const s=a.trim().replace(/^#/,"");return/^[0-9a-fA-F]{3}$/.test(s)?s.split("").map(n=>n+n).join("").toLowerCase():/^[0-9a-fA-F]{6}$/.test(s)?s.toLowerCase():null}function I(a){return C(a)!==null}function w(a){const s=C(a);if(!s)return 0;const n=parseInt(s.slice(0,2),16)/255,t=parseInt(s.slice(2,4),16)/255,o=parseInt(s.slice(4,6),16)/255,e=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),r=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4);return .2126*e+.7152*r+.0722*l}function B(a,s){const n=w(a),t=w(s),o=Math.max(n,t),e=Math.min(n,t);return(o+.05)/(e+.05)}function _(a,s){return s||(s=document.querySelector(".vvd-root")||document.documentElement),getComputedStyle(s).getPropertyValue(a).trim()}var $=Object.defineProperty,d=(a,s,n,t)=>{for(var o=void 0,e=a.length-1,r;e>=0;e--)(r=a[e])&&(o=r(s,n,o)||o);return o&&$(s,n,o),o};const A=a=>{class s extends y.Localized(S.FormElement(m.FormAssociated(a))){constructor(){super(...arguments),this.proxy=document.createElement("input"),this.open=!1,this.swatches=[],this._canvasColor=""}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._refreshCanvasColor()})}get _computedCanvasColor(){return this._canvasColor||(this._canvasColor=_("--vvd-color-canvas",this)),this._canvasColor}_refreshCanvasColor(){this._canvasColor=_("--vvd-color-canvas",this)}_applyContrastClass(t,o=3){if(!t)return!1;const e=this._computedCanvasColor;return e?B(t,e)<o:!1}_getRowLength(){return 7}_handleSwatchSelection(t){this.value===t?this.value="":this.value=t,this.$emit("change"),this.open=!1}_handleColorSaving(){}_getFocusReturnEl(){return null}_returnFocusToAnchor(){const t=this._getFocusReturnEl();t&&u.Updates.enqueue(()=>t.focus())}_getGridCells(){const t=this.shadowRoot?.querySelector('[role="grid"]');return t?Array.from(t.querySelectorAll('[role="gridcell"], [data-vvd-role="gridcell"]')):[]}_handleCellKeydown(t,o,e,r){const l=this._getRowLength(),c=this._getGridCells().length,h=Math.floor(e/l),f=e%l,p=Math.ceil(c/l);switch(t.key){case"ArrowRight":return f<l-1&&e+1<c&&this._focusSwatchByIndex(e+1),!1;case"ArrowLeft":return f>0&&this._focusSwatchByIndex(e-1),!1;case"ArrowDown":return h<p-1&&e+l<c&&this._focusSwatchByIndex(e+l),!1;case"ArrowUp":return h>0&&this._focusSwatchByIndex(e-l),!1;case"PageDown":{const i=(p-1)*l,v=Math.min(i+f,c-1);return e!==v&&this._focusSwatchByIndex(v),!1}case"PageUp":{const i=Math.min(f,c-1);return e!==i&&this._focusSwatchByIndex(i),!1}case"Home":return t.ctrlKey?this._focusSwatchByIndex(0):this._focusSwatchByIndex(h*l),!1;case"End":if(t.ctrlKey)this._focusSwatchByIndex(c-1);else{const i=Math.min((h+1)*l-1,c-1);this._focusSwatchByIndex(i)}return!1;case"Enter":case" ":return r&&this._handleColorSaving(),o&&!r&&(this._handleSwatchSelection(o),this._returnFocusToAnchor()),!1;case"Escape":return this.open=!1,this._returnFocusToAnchor(),!1;case"Tab":return this.open=!1,!0;default:return!0}}_focusSwatchByIndex(t){const o=this._getGridCells();t<0||t>=o.length||o[t]?.focus()}_renderColorSwatch(t,o){return u.html`
|
|
2
|
+
<${o} placement="top"
|
|
3
|
+
text="${e=>e.label??e.value}"
|
|
4
|
+
exportparts="vvd-theme-alternate">
|
|
5
|
+
<button
|
|
6
|
+
slot="anchor"
|
|
7
|
+
class="swatch ${(e,r)=>b.classNames(r.parent.value===e.value?"selected":"",r.parent._applyContrastClass(e.value)?"contrast":"")}"
|
|
8
|
+
role="gridcell"
|
|
9
|
+
style="--swatch-color: ${e=>e.value};"
|
|
10
|
+
tabindex="${(e,r)=>r.index===0?"0":"-1"}"
|
|
11
|
+
aria-label="${(e,r)=>r.parent.locale.baseColorPicker.colorSwatchLabel(e.value,e.label,r.parent.value===e.value)}"
|
|
12
|
+
@click="${(e,r)=>r.parent._handleSwatchSelection(e.value)}"
|
|
13
|
+
@keydown="${(e,r)=>r.parent._handleCellKeydown(r.event,e.value,r.index)}"
|
|
14
|
+
>
|
|
15
|
+
${g.when((e,r)=>r.parent.value===e.value,u.html`<${t} size="-6" name="check-solid" aria-hidden="true"></${t}>`)}
|
|
16
|
+
</button>
|
|
17
|
+
</${o}>
|
|
18
|
+
`}}return d([u.attr({mode:"boolean"})],s.prototype,"open"),d([u.observable],s.prototype,"swatches"),d([u.observable],s.prototype,"_canvasColor"),s};exports.BaseColorPicker=A;exports.isValidHexColor=I;
|
|
@@ -1,56 +1,66 @@
|
|
|
1
|
-
import { F as
|
|
2
|
-
import { U as
|
|
3
|
-
import { w as
|
|
4
|
-
import { L as
|
|
5
|
-
import { F as
|
|
6
|
-
import { c as
|
|
7
|
-
function
|
|
8
|
-
if (!
|
|
9
|
-
const s =
|
|
10
|
-
return /^[0-9a-fA-F]{3}$/.test(s) ? s.split("").map((
|
|
1
|
+
import { F as g } from "./form-associated.js";
|
|
2
|
+
import { U as y, h as m, a as S, o as w } from "./vivid-element.js";
|
|
3
|
+
import { w as b } from "./when.js";
|
|
4
|
+
import { L as I } from "./localized.js";
|
|
5
|
+
import { F as B } from "./form-element.js";
|
|
6
|
+
import { c as $ } from "./class-names.js";
|
|
7
|
+
function C(a) {
|
|
8
|
+
if (!a) return null;
|
|
9
|
+
const s = a.trim().replace(/^#/, "");
|
|
10
|
+
return /^[0-9a-fA-F]{3}$/.test(s) ? s.split("").map((n) => n + n).join("").toLowerCase() : /^[0-9a-fA-F]{6}$/.test(s) ? s.toLowerCase() : null;
|
|
11
11
|
}
|
|
12
|
-
function P(
|
|
13
|
-
return
|
|
12
|
+
function P(a) {
|
|
13
|
+
return C(a) !== null;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const s =
|
|
15
|
+
function _(a) {
|
|
16
|
+
const s = C(a);
|
|
17
17
|
if (!s) return 0;
|
|
18
|
-
const
|
|
19
|
-
return 0.2126 *
|
|
18
|
+
const n = parseInt(s.slice(0, 2), 16) / 255, t = parseInt(s.slice(2, 4), 16) / 255, o = parseInt(s.slice(4, 6), 16) / 255, e = n <= 0.03928 ? n / 12.92 : Math.pow((n + 0.055) / 1.055, 2.4), r = t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4), l = o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
|
|
19
|
+
return 0.2126 * e + 0.7152 * r + 0.0722 * l;
|
|
20
20
|
}
|
|
21
|
-
function A(
|
|
22
|
-
const
|
|
23
|
-
return (
|
|
21
|
+
function A(a, s) {
|
|
22
|
+
const n = _(a), t = _(s), o = Math.max(n, t), e = Math.min(n, t);
|
|
23
|
+
return (o + 0.05) / (e + 0.05);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return s || (s = document.querySelector(".vvd-root") || document.documentElement), getComputedStyle(s).getPropertyValue(
|
|
25
|
+
function v(a, s) {
|
|
26
|
+
return s || (s = document.querySelector(".vvd-root") || document.documentElement), getComputedStyle(s).getPropertyValue(a).trim();
|
|
27
27
|
}
|
|
28
|
-
var x = Object.defineProperty,
|
|
29
|
-
for (var
|
|
30
|
-
(
|
|
31
|
-
return
|
|
28
|
+
var x = Object.defineProperty, f = (a, s, n, t) => {
|
|
29
|
+
for (var o = void 0, e = a.length - 1, r; e >= 0; e--)
|
|
30
|
+
(r = a[e]) && (o = r(s, n, o) || o);
|
|
31
|
+
return o && x(s, n, o), o;
|
|
32
32
|
};
|
|
33
|
-
const q = (
|
|
34
|
-
class s extends
|
|
35
|
-
|
|
33
|
+
const q = (a) => {
|
|
34
|
+
class s extends I(
|
|
35
|
+
B(g(a))
|
|
36
36
|
) {
|
|
37
37
|
constructor() {
|
|
38
38
|
super(...arguments), this.proxy = document.createElement("input"), this.open = !1, this.swatches = [], this._canvasColor = "";
|
|
39
39
|
}
|
|
40
40
|
connectedCallback() {
|
|
41
|
-
super.connectedCallback(),
|
|
41
|
+
super.connectedCallback(), requestAnimationFrame(() => {
|
|
42
|
+
this._refreshCanvasColor();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
48
|
+
get _computedCanvasColor() {
|
|
49
|
+
return this._canvasColor || (this._canvasColor = v("--vvd-color-canvas", this)), this._canvasColor;
|
|
42
50
|
}
|
|
43
51
|
/**
|
|
44
52
|
* @internal
|
|
45
53
|
*/
|
|
46
54
|
_refreshCanvasColor() {
|
|
47
|
-
this._canvasColor =
|
|
55
|
+
this._canvasColor = v("--vvd-color-canvas", this);
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* @internal
|
|
51
59
|
*/
|
|
52
|
-
_applyContrastClass(
|
|
53
|
-
|
|
60
|
+
_applyContrastClass(t, o = 3) {
|
|
61
|
+
if (!t) return !1;
|
|
62
|
+
const e = this._computedCanvasColor;
|
|
63
|
+
return e ? A(t, e) < o : !1;
|
|
54
64
|
}
|
|
55
65
|
/**
|
|
56
66
|
* @internal
|
|
@@ -61,8 +71,8 @@ const q = (o) => {
|
|
|
61
71
|
/**
|
|
62
72
|
* @internal
|
|
63
73
|
*/
|
|
64
|
-
_handleSwatchSelection(
|
|
65
|
-
this.value ===
|
|
74
|
+
_handleSwatchSelection(t) {
|
|
75
|
+
this.value === t ? this.value = "" : this.value = t, this.$emit("change"), this.open = !1;
|
|
66
76
|
}
|
|
67
77
|
/**
|
|
68
78
|
* @internal
|
|
@@ -79,16 +89,16 @@ const q = (o) => {
|
|
|
79
89
|
* @internal
|
|
80
90
|
*/
|
|
81
91
|
_returnFocusToAnchor() {
|
|
82
|
-
const
|
|
83
|
-
|
|
92
|
+
const t = this._getFocusReturnEl();
|
|
93
|
+
t && y.enqueue(() => t.focus());
|
|
84
94
|
}
|
|
85
95
|
/**
|
|
86
96
|
* @internal
|
|
87
97
|
*/
|
|
88
98
|
_getGridCells() {
|
|
89
|
-
const
|
|
90
|
-
return
|
|
91
|
-
|
|
99
|
+
const t = this.shadowRoot?.querySelector('[role="grid"]');
|
|
100
|
+
return t ? Array.from(
|
|
101
|
+
t.querySelectorAll(
|
|
92
102
|
'[role="gridcell"], [data-vvd-role="gridcell"]'
|
|
93
103
|
)
|
|
94
104
|
) : [];
|
|
@@ -96,36 +106,36 @@ const q = (o) => {
|
|
|
96
106
|
/**
|
|
97
107
|
* @internal
|
|
98
108
|
*/
|
|
99
|
-
_handleCellKeydown(
|
|
100
|
-
const
|
|
101
|
-
switch (
|
|
109
|
+
_handleCellKeydown(t, o, e, r) {
|
|
110
|
+
const l = this._getRowLength(), c = this._getGridCells().length, u = Math.floor(e / l), h = e % l, d = Math.ceil(c / l);
|
|
111
|
+
switch (t.key) {
|
|
102
112
|
case "ArrowRight":
|
|
103
|
-
return h <
|
|
113
|
+
return h < l - 1 && e + 1 < c && this._focusSwatchByIndex(e + 1), !1;
|
|
104
114
|
case "ArrowLeft":
|
|
105
|
-
return h > 0 && this._focusSwatchByIndex(
|
|
115
|
+
return h > 0 && this._focusSwatchByIndex(e - 1), !1;
|
|
106
116
|
case "ArrowDown":
|
|
107
|
-
return u <
|
|
117
|
+
return u < d - 1 && e + l < c && this._focusSwatchByIndex(e + l), !1;
|
|
108
118
|
case "ArrowUp":
|
|
109
|
-
return u > 0 && this._focusSwatchByIndex(
|
|
119
|
+
return u > 0 && this._focusSwatchByIndex(e - l), !1;
|
|
110
120
|
case "PageDown": {
|
|
111
|
-
const i = (
|
|
121
|
+
const i = (d - 1) * l, p = Math.min(
|
|
112
122
|
i + h,
|
|
113
123
|
c - 1
|
|
114
124
|
);
|
|
115
|
-
return
|
|
125
|
+
return e !== p && this._focusSwatchByIndex(p), !1;
|
|
116
126
|
}
|
|
117
127
|
case "PageUp": {
|
|
118
128
|
const i = Math.min(h, c - 1);
|
|
119
|
-
return
|
|
129
|
+
return e !== i && this._focusSwatchByIndex(i), !1;
|
|
120
130
|
}
|
|
121
131
|
case "Home":
|
|
122
|
-
return
|
|
132
|
+
return t.ctrlKey ? this._focusSwatchByIndex(0) : this._focusSwatchByIndex(u * l), !1;
|
|
123
133
|
case "End":
|
|
124
|
-
if (
|
|
134
|
+
if (t.ctrlKey)
|
|
125
135
|
this._focusSwatchByIndex(c - 1);
|
|
126
136
|
else {
|
|
127
137
|
const i = Math.min(
|
|
128
|
-
(u + 1) *
|
|
138
|
+
(u + 1) * l - 1,
|
|
129
139
|
c - 1
|
|
130
140
|
);
|
|
131
141
|
this._focusSwatchByIndex(i);
|
|
@@ -133,7 +143,7 @@ const q = (o) => {
|
|
|
133
143
|
return !1;
|
|
134
144
|
case "Enter":
|
|
135
145
|
case " ":
|
|
136
|
-
return
|
|
146
|
+
return r && this._handleColorSaving(), o && !r && (this._handleSwatchSelection(o), this._returnFocusToAnchor()), !1;
|
|
137
147
|
case "Escape":
|
|
138
148
|
return this.open = !1, this._returnFocusToAnchor(), !1;
|
|
139
149
|
case "Tab":
|
|
@@ -145,48 +155,55 @@ const q = (o) => {
|
|
|
145
155
|
/**
|
|
146
156
|
* @internal
|
|
147
157
|
*/
|
|
148
|
-
_focusSwatchByIndex(
|
|
149
|
-
const
|
|
150
|
-
|
|
158
|
+
_focusSwatchByIndex(t) {
|
|
159
|
+
const o = this._getGridCells();
|
|
160
|
+
t < 0 || t >= o.length || o[t]?.focus();
|
|
151
161
|
}
|
|
152
162
|
/**
|
|
153
163
|
* @internal
|
|
154
164
|
*/
|
|
155
|
-
_renderColorSwatch(
|
|
156
|
-
return
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
_renderColorSwatch(t, o) {
|
|
166
|
+
return m`
|
|
167
|
+
<${o} placement="top"
|
|
168
|
+
text="${(e) => e.label ?? e.value}"
|
|
169
|
+
exportparts="vvd-theme-alternate">
|
|
170
|
+
<button
|
|
171
|
+
slot="anchor"
|
|
172
|
+
class="swatch ${(e, r) => $(
|
|
173
|
+
r.parent.value === e.value ? "selected" : "",
|
|
174
|
+
r.parent._applyContrastClass(e.value) ? "contrast" : ""
|
|
161
175
|
)}"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
role="gridcell"
|
|
177
|
+
style="--swatch-color: ${(e) => e.value};"
|
|
178
|
+
tabindex="${(e, r) => r.index === 0 ? "0" : "-1"}"
|
|
179
|
+
aria-label="${(e, r) => r.parent.locale.baseColorPicker.colorSwatchLabel(
|
|
166
180
|
e.value,
|
|
167
181
|
e.label,
|
|
168
|
-
|
|
182
|
+
r.parent.value === e.value
|
|
169
183
|
)}"
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
@click="${(e, r) => r.parent._handleSwatchSelection(e.value)}"
|
|
185
|
+
@keydown="${(e, r) => r.parent._handleCellKeydown(
|
|
186
|
+
r.event,
|
|
173
187
|
e.value,
|
|
174
|
-
|
|
188
|
+
r.index
|
|
175
189
|
)}"
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
(e,
|
|
179
|
-
|
|
190
|
+
>
|
|
191
|
+
${b(
|
|
192
|
+
(e, r) => r.parent.value === e.value,
|
|
193
|
+
m`<${t} size="-6" name="check-solid" aria-hidden="true"></${t}>`
|
|
180
194
|
)}
|
|
181
|
-
|
|
195
|
+
</button>
|
|
196
|
+
</${o}>
|
|
182
197
|
`;
|
|
183
198
|
}
|
|
184
199
|
}
|
|
185
|
-
return
|
|
186
|
-
|
|
187
|
-
], s.prototype, "open"),
|
|
188
|
-
|
|
189
|
-
], s.prototype, "swatches"),
|
|
200
|
+
return f([
|
|
201
|
+
S({ mode: "boolean" })
|
|
202
|
+
], s.prototype, "open"), f([
|
|
203
|
+
w
|
|
204
|
+
], s.prototype, "swatches"), f([
|
|
205
|
+
w
|
|
206
|
+
], s.prototype, "_canvasColor"), s;
|
|
190
207
|
};
|
|
191
208
|
export {
|
|
192
209
|
q as B,
|