@vonage/vivid 5.2.0 → 5.4.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.cjs +2 -1
- package/accordion-item/definition.js +3 -2
- package/alert/definition.cjs +1 -1
- package/alert/definition.js +2 -2
- package/alert/index.cjs +1 -1
- package/alert/index.js +1 -1
- package/audio-player/definition.cjs +4 -2
- package/audio-player/definition.js +4 -2
- package/audio-player/index.cjs +5 -3
- package/audio-player/index.js +5 -3
- package/badge/definition.js +1 -1
- package/badge/index.cjs +2 -2
- package/badge/index.js +4 -4
- package/banner/definition.js +1 -1
- package/banner/index.cjs +3 -3
- package/banner/index.js +6 -6
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -1
- package/bundled/affix.cjs +7 -7
- package/bundled/affix.js +5 -5
- 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 +15 -13
- package/bundled/base-color-picker.cjs +13 -0
- package/bundled/base-color-picker.js +194 -0
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +2 -2
- package/bundled/calendar-picker.template.cjs +7 -7
- package/bundled/calendar-picker.template.js +118 -118
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/children.cjs +1 -1
- package/bundled/children.js +28 -20
- package/bundled/definition.cjs +3 -3
- package/bundled/definition.js +38 -38
- package/bundled/definition10.cjs +72 -18
- package/bundled/definition10.js +351 -65
- package/bundled/definition11.cjs +19 -10
- package/bundled/definition11.js +217 -36
- package/bundled/definition12.cjs +10 -1
- package/bundled/definition12.js +38 -14
- package/bundled/definition13.cjs +1 -73
- package/bundled/definition13.js +15 -354
- package/bundled/definition15.cjs +1 -1
- package/bundled/definition15.js +1 -1
- package/bundled/definition16.cjs +2 -2
- package/bundled/definition16.js +8 -8
- package/bundled/definition17.cjs +7 -7
- package/bundled/definition17.js +17 -17
- package/bundled/definition19.cjs +23 -24
- package/bundled/definition19.js +151 -163
- package/bundled/definition2.cjs +9 -5
- package/bundled/definition2.js +21 -17
- package/bundled/definition22.cjs +9 -9
- package/bundled/definition22.js +31 -31
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +1 -1
- package/bundled/definition6.cjs +3 -3
- package/bundled/definition6.js +28 -28
- package/bundled/definition7.cjs +1 -1
- package/bundled/definition7.js +6 -6
- package/bundled/definition8.cjs +2 -2
- package/bundled/definition8.js +4 -4
- package/bundled/definition9.cjs +5 -5
- package/bundled/definition9.js +394 -392
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +59 -46
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +3 -3
- package/bundled/host-semantics.cjs +1 -1
- package/bundled/host-semantics.js +48 -34
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +82 -102
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +51 -36
- package/bundled/mixins.cjs +18 -18
- package/bundled/mixins.js +99 -93
- package/bundled/normalize.cjs +1 -0
- package/bundled/normalize.js +7 -0
- package/bundled/picker-field.template.cjs +1 -1
- package/bundled/picker-field.template.js +4 -4
- package/bundled/ref.cjs +1 -1
- package/bundled/ref.js +8 -25
- package/bundled/repeat.cjs +1 -1
- package/bundled/repeat.js +459 -233
- package/bundled/slider.template.cjs +1 -1
- package/bundled/slider.template.js +2 -2
- package/bundled/slotted.cjs +1 -1
- package/bundled/slotted.js +62 -45
- package/bundled/time-selection-picker.template.cjs +1 -1
- package/bundled/time-selection-picker.template.js +5 -5
- package/bundled/vivid-element.cjs +5 -1
- package/bundled/vivid-element.js +2159 -1162
- package/bundled/when.cjs +1 -1
- package/bundled/when.js +8 -7
- package/calendar/definition.cjs +1 -1
- package/calendar/definition.js +2 -2
- package/calendar/index.cjs +1 -1
- package/calendar/index.js +15 -15
- package/calendar-event/index.cjs +1 -1
- package/calendar-event/index.js +1 -1
- package/card/definition.cjs +11 -3
- package/card/definition.js +11 -3
- package/card/index.cjs +19 -11
- package/card/index.js +35 -27
- package/color-picker/definition.cjs +1079 -0
- package/color-picker/definition.js +1073 -0
- package/color-picker/index.cjs +127 -0
- package/color-picker/index.js +726 -0
- package/combobox/definition.cjs +8 -28
- package/combobox/definition.js +10 -30
- package/combobox/index.cjs +7 -7
- package/combobox/index.js +60 -74
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +1670 -163
- package/data-grid/definition.cjs +862 -27
- package/data-grid/definition.js +863 -28
- package/data-grid/index.cjs +25 -25
- package/data-grid/index.js +175 -168
- 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 +4 -0
- package/dial-pad/definition.js +4 -0
- package/dial-pad/index.cjs +3 -3
- package/dial-pad/index.js +42 -39
- package/dialog/definition.cjs +6 -3
- package/dialog/definition.js +6 -3
- package/dialog/index.cjs +22 -19
- package/dialog/index.js +48 -45
- package/elevation/definition.cjs +1 -1
- package/elevation/definition.js +1 -1
- package/empty-state/definition.cjs +7 -2
- package/empty-state/definition.js +7 -2
- package/empty-state/index.cjs +10 -5
- package/empty-state/index.js +18 -13
- package/fab/definition.js +1 -1
- package/fab/index.cjs +2 -2
- package/fab/index.js +4 -4
- package/file-picker/definition.cjs +2 -2
- package/file-picker/definition.js +3 -3
- package/file-picker/index.cjs +1 -1
- package/file-picker/index.js +4 -4
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/icon/definition.cjs +10 -6
- package/icon/definition.js +10 -6
- package/index.cjs +7 -4
- package/index.js +3 -3
- package/lib/accordion/accordion.d.ts +1 -1
- package/lib/accordion/definition.d.ts +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -2
- package/lib/action-group/action-group.d.ts +2 -2
- package/lib/alert/alert.d.ts +4 -4
- package/lib/audio-player/audio-player.d.ts +3 -3
- package/lib/avatar/avatar.d.ts +2 -2
- package/lib/badge/badge.d.ts +2 -2
- package/lib/banner/banner.d.ts +6 -6
- package/lib/breadcrumb/breadcrumb.d.ts +2 -2
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +2 -2
- package/lib/button/button.d.ts +6 -6
- package/lib/button/button.template.d.ts +2 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/calendar-event/calendar-event.d.ts +2 -2
- package/lib/card/card.d.ts +2 -2
- package/lib/checkbox/checkbox.d.ts +12 -12
- package/lib/color-picker/color-picker.d.ts +2420 -0
- package/lib/color-picker/color-picker.template.d.ts +3 -0
- package/lib/color-picker/definition.d.ts +4 -0
- package/lib/color-picker/locale.d.ts +9 -0
- package/lib/combobox/combobox.d.ts +15 -14
- package/lib/combobox/combobox.options.d.ts +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/data-grid/data-grid-cell.d.ts +4 -4
- package/lib/data-grid/data-grid-row.d.ts +3 -4
- package/lib/data-grid/data-grid.d.ts +1 -2
- package/lib/date-picker/date-picker.d.ts +54 -54
- package/lib/date-range-picker/date-range-picker.d.ts +28 -28
- package/lib/date-time-picker/date-time-picker.d.ts +56 -56
- package/lib/dial-pad/dial-pad.d.ts +3 -2
- package/lib/dialog/dialog.d.ts +4 -4
- package/lib/divider/divider.d.ts +3 -3
- package/lib/fab/fab.d.ts +2 -2
- package/lib/file-picker/file-picker.d.ts +14 -14
- package/lib/header/header.d.ts +2 -2
- package/lib/menu/menu.d.ts +4 -4
- package/lib/menu-item/menu-item-role.d.ts +1 -1
- package/lib/menu-item/menu-item.d.ts +4 -4
- package/lib/nav/nav.d.ts +2 -2
- package/lib/nav-disclosure/nav-disclosure.d.ts +4 -4
- package/lib/nav-item/nav-item.d.ts +4 -4
- package/lib/note/note.d.ts +2 -2
- package/lib/number-field/number-field.d.ts +18 -18
- package/lib/option/option.d.ts +4 -4
- package/lib/pagination/pagination.d.ts +2 -2
- package/lib/popup/popup.d.ts +1 -1
- package/lib/progress/progress.d.ts +2 -2
- package/lib/progress-ring/progress-ring.d.ts +2 -2
- package/lib/radio/radio.d.ts +6 -6
- package/lib/radio-group/radio-group.d.ts +2 -2
- package/lib/range-slider/range-slider.d.ts +6 -6
- package/lib/rich-text-editor/menubar/menubar.d.ts +2 -2
- package/lib/rich-text-editor/rich-text-editor.d.ts +2 -2
- package/lib/searchable-select/locale.d.ts +4 -0
- package/lib/searchable-select/option-tag.d.ts +2 -2
- package/lib/searchable-select/searchable-select.d.ts +21 -18
- package/lib/select/select.d.ts +19 -17
- package/lib/selectable-box/selectable-box.d.ts +2 -2
- package/lib/simple-color-picker/locale.d.ts +0 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +47 -821
- package/lib/slider/slider.d.ts +7 -7
- package/lib/split-button/split-button.d.ts +6 -6
- package/lib/switch/switch.d.ts +4 -4
- package/lib/tab/tab.d.ts +6 -6
- package/lib/tab-panel/tab-panel.d.ts +2 -2
- package/lib/tabs/tabs.d.ts +2 -2
- package/lib/tag/tag.d.ts +6 -6
- package/lib/tag-group/tag-group.d.ts +2 -2
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-area/text-area.d.ts +17 -17
- package/lib/text-field/text-field.d.ts +19 -19
- package/lib/time-picker/time-picker.d.ts +28 -28
- package/lib/toggletip/toggletip.d.ts +4 -4
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tree-item/tree-item.d.ts +4 -4
- package/lib/tree-view/tree-view.d.ts +2 -2
- package/lib/video-player/video-player.d.ts +2 -2
- package/locales/de-DE.cjs +17 -2
- package/locales/de-DE.js +17 -2
- package/locales/en-GB.cjs +17 -2
- package/locales/en-GB.js +17 -2
- package/locales/en-US.cjs +17 -2
- package/locales/en-US.js +17 -2
- package/locales/ja-JP.cjs +17 -2
- package/locales/ja-JP.js +17 -2
- package/locales/zh-CN.cjs +17 -2
- package/locales/zh-CN.js +17 -2
- package/menu/definition.cjs +6 -6
- package/menu/definition.js +7 -7
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.js +1 -1
- package/note/index.cjs +2 -2
- package/note/index.js +4 -4
- package/number-field/definition.cjs +1 -1
- package/number-field/definition.js +3 -3
- package/number-field/index.cjs +5 -5
- package/number-field/index.js +21 -21
- 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 +34 -8
- package/pagination/definition.cjs +2 -1
- package/pagination/definition.js +2 -1
- package/pagination/index.cjs +12 -12
- package/pagination/index.js +59 -59
- package/popup/definition.cjs +2 -2
- package/popup/definition.js +2 -2
- package/progress/index.cjs +1 -1
- package/progress/index.js +1 -1
- package/radio/definition.cjs +9 -9
- package/radio/definition.js +10 -10
- package/radio-group/definition.cjs +2 -1
- package/radio-group/definition.js +2 -1
- package/radio-group/index.cjs +5 -5
- package/radio-group/index.js +80 -77
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +1 -1
- package/rich-text-editor/definition.cjs +3 -4
- package/rich-text-editor/definition.js +3 -4
- package/rich-text-editor/index.cjs +27 -27
- package/rich-text-editor/index.js +1208 -1198
- package/searchable-select/definition.cjs +106 -14
- package/searchable-select/definition.js +107 -15
- package/searchable-select/index.cjs +81 -69
- package/searchable-select/index.js +362 -276
- package/select/definition.cjs +25 -42
- package/select/definition.js +26 -43
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/selectable-box/index.cjs +3 -3
- package/selectable-box/index.js +20 -20
- package/shared/aria/aria-change-subscription.d.ts +0 -1
- package/shared/aria/aria-mixin.d.ts +3 -3
- package/shared/aria/delegate-aria-behavior.d.ts +5 -10
- package/shared/aria/delegates-aria.d.ts +3 -3
- package/shared/aria/host-semantics-behavior.d.ts +5 -8
- package/shared/aria/host-semantics.d.ts +3 -3
- package/shared/color-picker/base-color-picker.d.ts +436 -0
- package/shared/color-picker/index.d.ts +1 -0
- package/shared/color-picker/locale.d.ts +3 -0
- package/shared/color-picker/utils.d.ts +1 -0
- package/shared/deprecation/replaced-props.d.ts +317 -2
- package/shared/design-system/defineVividComponent.d.ts +2 -2
- package/shared/feedback/feedback-message.d.ts +2 -2
- package/shared/feedback/mixins.d.ts +4 -4
- package/shared/foundation/button/button.d.ts +4 -4
- package/shared/foundation/form-associated/form-associated.d.ts +4 -4
- package/shared/foundation/listbox/listbox.d.ts +4 -0
- package/shared/foundation/vivid-element/vivid-element.d.ts +335 -8
- package/shared/localization/Locale.d.ts +4 -0
- package/shared/patterns/affix.d.ts +4 -4
- package/shared/patterns/anchored.d.ts +4 -4
- package/shared/patterns/char-count/char-count.d.ts +2 -2
- package/shared/patterns/form-elements/form-element.d.ts +4 -4
- package/shared/patterns/form-elements/with-contextual-help.d.ts +6 -6
- package/shared/patterns/form-elements/with-error-text.d.ts +6 -6
- package/shared/patterns/form-elements/with-success-text.d.ts +2 -2
- package/shared/patterns/linkable.d.ts +2 -2
- package/shared/patterns/localized.d.ts +2 -2
- package/shared/patterns/trapped-focus.d.ts +2 -2
- package/shared/picker-field/mixins/calendar-picker.d.ts +14 -14
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +14 -14
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +2 -2
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-date-picker.d.ts +40 -40
- package/shared/picker-field/mixins/single-value-picker.d.ts +12 -12
- package/shared/picker-field/mixins/time-selection-picker.d.ts +29 -29
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +28 -28
- package/shared/picker-field/picker-field.d.ts +14 -14
- package/shared/templating/attribute-binding-behaviour.d.ts +3 -4
- package/shared/templating/render-in-light-dom.d.ts +13 -12
- package/side-drawer/index.cjs +1 -1
- package/side-drawer/index.js +1 -1
- package/simple-color-picker/definition.cjs +29 -216
- package/simple-color-picker/definition.js +30 -217
- package/simple-color-picker/index.cjs +9 -21
- package/simple-color-picker/index.js +71 -185
- 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/switch/index.cjs +2 -2
- package/switch/index.js +4 -4
- package/tab/definition.js +1 -1
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +2 -2
- package/tabs/index.cjs +2 -2
- package/tabs/index.js +16 -16
- package/tag/definition.js +1 -1
- package/tag/index.cjs +1 -1
- package/tag/index.js +1 -1
- package/text-area/index.cjs +3 -3
- package/text-area/index.js +8 -8
- package/text-field/definition.cjs +2 -2
- package/text-field/definition.js +4 -4
- package/text-field/index.cjs +1 -1
- package/text-field/index.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 +2 -2
- package/toggletip/definition.cjs +2 -2
- package/toggletip/definition.js +3 -3
- package/tooltip/definition.cjs +1 -1
- package/tooltip/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +2 -2
- package/tree-view/definition.js +3 -3
- package/tree-view/index.cjs +2 -2
- package/tree-view/index.js +6 -6
- package/unbundled/_commonjsHelpers.cjs +36 -0
- package/unbundled/_commonjsHelpers.js +32 -0
- package/unbundled/affix.cjs +1 -1
- package/unbundled/affix.js +2 -2
- package/unbundled/attribute-binding-behaviour.cjs +11 -10
- package/unbundled/attribute-binding-behaviour.js +11 -10
- package/unbundled/base-color-picker.cjs +278 -0
- package/unbundled/base-color-picker.js +275 -0
- package/unbundled/button.cjs +1 -1
- package/unbundled/button.js +2 -2
- package/unbundled/calendar-picker.template.cjs +4 -4
- package/unbundled/calendar-picker.template.js +5 -5
- package/unbundled/definition.js +1 -1
- package/unbundled/definition2.cjs +1 -1
- package/unbundled/definition2.js +3 -3
- package/unbundled/definition3.cjs +222 -140
- package/unbundled/definition3.js +220 -138
- 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/delegates-aria.cjs +67 -33
- package/unbundled/delegates-aria.js +69 -35
- package/unbundled/form-associated.cjs +2 -2
- package/unbundled/form-associated.js +3 -3
- package/unbundled/host-semantics.cjs +47 -22
- package/unbundled/host-semantics.js +48 -23
- package/unbundled/listbox.cjs +41 -63
- package/unbundled/listbox.js +39 -61
- package/unbundled/mixins.cjs +34 -27
- package/unbundled/mixins.js +35 -28
- package/unbundled/picker-field.template.cjs +3 -3
- package/unbundled/picker-field.template.js +4 -4
- package/unbundled/slider.template.cjs +1 -1
- package/unbundled/slider.template.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +4 -4
- package/unbundled/time-selection-picker.template.js +5 -5
- package/unbundled/vivid-element.cjs +22 -15
- package/unbundled/vivid-element.js +23 -15
- package/video-player/definition.cjs +69047 -1
- package/video-player/definition.js +69047 -1
- package/video-player/index.cjs +36 -36
- package/video-player/index.js +1895 -1905
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +719 -224
- package/bundled/option.cjs +0 -1
- package/bundled/option.js +0 -158
- package/unbundled/option.cjs +0 -217
- package/unbundled/option.js +0 -214
package/tree-item/definition.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '../icon/definition.js';
|
|
2
2
|
import '../unbundled/vivid-element.js';
|
|
3
|
-
export { T as VwcTreeItemElement, r as registerTreeItem, t as treeItemDefinition } from '../unbundled/
|
|
3
|
+
export { T as VwcTreeItemElement, r as registerTreeItem, t as treeItemDefinition } from '../unbundled/definition4.js';
|
package/tree-view/definition.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
5
|
const vividElement = require('../unbundled/vivid-element.cjs');
|
|
6
|
-
const treeItem_definition = require('../unbundled/
|
|
6
|
+
const treeItem_definition = require('../unbundled/definition4.cjs');
|
|
7
7
|
const fastElement = require('@microsoft/fast-element');
|
|
8
8
|
const fastWebUtilities = require('@microsoft/fast-web-utilities');
|
|
9
9
|
const hostSemantics = require('../unbundled/host-semantics.cjs');
|
|
@@ -191,7 +191,7 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
191
191
|
connectedCallback() {
|
|
192
192
|
super.connectedCallback();
|
|
193
193
|
this.setAttribute("tabindex", "0");
|
|
194
|
-
fastElement.
|
|
194
|
+
fastElement.Updates.enqueue(() => {
|
|
195
195
|
this.setItems();
|
|
196
196
|
});
|
|
197
197
|
}
|
package/tree-view/definition.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { V as VividElement, d as defineVividComponent, c as createRegisterFunction } from '../unbundled/vivid-element.js';
|
|
2
|
-
import { T as TreeItem, i as isTreeItemElement, t as treeItemDefinition } from '../unbundled/
|
|
3
|
-
import {
|
|
2
|
+
import { T as TreeItem, i as isTreeItemElement, t as treeItemDefinition } from '../unbundled/definition4.js';
|
|
3
|
+
import { Updates, attr, observable, ref, slotted, html } from '@microsoft/fast-element';
|
|
4
4
|
import { keyEnter, keyArrowUp, keyArrowDown, keyArrowRight, keyArrowLeft, keyEnd, keyHome, isHTMLElement, classNames } from '@microsoft/fast-web-utilities';
|
|
5
5
|
import { H as HostSemantics, a as applyHostSemantics } from '../unbundled/host-semantics.js';
|
|
6
6
|
|
|
@@ -187,7 +187,7 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
187
187
|
connectedCallback() {
|
|
188
188
|
super.connectedCallback();
|
|
189
189
|
this.setAttribute("tabindex", "0");
|
|
190
|
-
|
|
190
|
+
Updates.enqueue(() => {
|
|
191
191
|
this.setItems();
|
|
192
192
|
});
|
|
193
193
|
}
|
package/tree-view/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("../bundled/vivid-element.cjs"),n=require("../bundled/definition22.cjs"),m=require("../bundled/host-semantics.cjs"),c=require("../bundled/key-codes.cjs"),h=require("../bundled/dom.cjs"),f=require("../bundled/ref.cjs"),g=require("../bundled/
|
|
1
|
+
"use strict";const l=require("../bundled/vivid-element.cjs"),n=require("../bundled/definition22.cjs"),m=require("../bundled/host-semantics.cjs"),c=require("../bundled/key-codes.cjs"),h=require("../bundled/dom.cjs"),f=require("../bundled/ref.cjs"),g=require("../bundled/slotted.cjs"),I=require("../bundled/class-names.cjs"),p=".control{position:relative;display:flex;flex-direction:column;gap:4px}";var b=Object.defineProperty,d=(r,e,t,s)=>{for(var i=void 0,a=r.length-1,u;a>=0;a--)(u=r[a])&&(i=u(e,t,i)||i);return i&&b(e,t,i),i};function T(r,e){return h.isHTMLElement(r)?Array.from(r.querySelectorAll(e)).filter(i=>{if(i.parentElement instanceof n.TreeItem){if(i.parentElement.expanded)return!0}else return!0;return!1}):[]}class o extends m.HostSemantics(l.VividElement){constructor(){super(...arguments),this.currentFocused=null,this.handleFocus=e=>{if(this.slottedTreeItems.length>0){if(e.target===this){this.currentFocused!==null&&n.TreeItem.focusItem(this.currentFocused);return}this.contains(e.target)&&(this.setAttribute("tabindex","-1"),this.currentFocused=e.target)}},this.handleBlur=e=>{e.target instanceof HTMLElement&&(e.relatedTarget===null||!this.contains(e.relatedTarget))&&this.setAttribute("tabindex","0")},this.handleKeyDown=e=>{if(this.slottedTreeItems.length<1)return!0;if(!e.defaultPrevented){const t=this.getVisibleNodes();switch(e.key){case c.keyHome:t.length&&n.TreeItem.focusItem(t[0]);return;case c.keyEnd:t.length&&n.TreeItem.focusItem(t[t.length-1]);return;case c.keyArrowLeft:if(e.target&&this.isFocusableElement(e.target)){const s=e.target;s instanceof n.TreeItem&&s.childItemLength()>0&&s.expanded?s.expanded=!1:s instanceof n.TreeItem&&s.parentElement instanceof n.TreeItem&&n.TreeItem.focusItem(s.parentElement)}return!1;case c.keyArrowRight:if(e.target&&this.isFocusableElement(e.target)){const s=e.target;s instanceof n.TreeItem&&s.childItemLength()>0&&!s.expanded?s.expanded=!0:s instanceof n.TreeItem&&s.childItemLength()>0&&this.focusNextNode(1,e.target)}return;case c.keyArrowDown:e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(1,e.target);return;case c.keyArrowUp:e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(-1,e.target);return;case c.keyEnter:this.handleClick(e);return}}return!0},this.handleSelectedChange=e=>{if(!e.defaultPrevented){if(!(e.target instanceof Element)||!n.isTreeItemElement(e.target))return!0;const t=e.target;t.selected?(this.currentSelected&&this.currentSelected!==t&&(this.currentSelected.selected=!1),this.currentSelected=t):!t.selected&&this.currentSelected===t&&(this.currentSelected=null);return}},this.setItems=()=>{const e=this.treeView.querySelector("[selected]");this.currentSelected=e,(this.currentFocused===null||!this.contains(this.currentFocused))&&(this.currentFocused=this.getValidFocusableItem()),this.nested=this.checkForNestedItems(),this.getVisibleNodes().forEach(s=>{n.isTreeItemElement(s)&&(s.nested=this.nested)})},this.isFocusableElement=e=>n.isTreeItemElement(e),this.isSelectedElement=e=>e.selected}slottedTreeItemsChanged(){this.$fastController.isConnected&&this.setItems()}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),l.Updates.enqueue(()=>{this.setItems()})}handleClick(e){if(!e.defaultPrevented){if(!(e.target instanceof Element)||!n.isTreeItemElement(e.target))return!0;const t=e.target;t.disabled||(t.selected=!t.selected);return}}focusNextNode(e,t){const s=this.getVisibleNodes();if(s){const i=s[s.indexOf(t)+e];h.isHTMLElement(i)&&n.TreeItem.focusItem(i)}}getValidFocusableItem(){const e=this.getVisibleNodes();let t=e.findIndex(this.isSelectedElement);return t===-1&&(t=e.findIndex(this.isFocusableElement)),t!==-1?e[t]:null}checkForNestedItems(){return this.slottedTreeItems.some(e=>n.isTreeItemElement(e)&&e.querySelector("[data-vvd-component='tree-item']"))}getVisibleNodes(){return T(this,"[data-vvd-component='tree-item']")}}d([l.attr({attribute:"render-collapsed-nodes"})],o.prototype,"renderCollapsedNodes");d([l.observable],o.prototype,"currentSelected");d([l.observable],o.prototype,"slottedTreeItems");const v=r=>I.classNames("control"),E=l.html` <template
|
|
2
2
|
${f.ref("treeView")}
|
|
3
3
|
${m.applyHostSemantics({role:"tree"})}
|
|
4
4
|
@keydown="${(r,e)=>r.handleKeyDown(e.event)}"
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
@selected-change="${(r,e)=>r.handleSelectedChange(e.event)}"
|
|
9
9
|
>
|
|
10
10
|
<div class="${v}">
|
|
11
|
-
<slot ${
|
|
11
|
+
<slot ${g.slotted("slottedTreeItems")}></slot>
|
|
12
12
|
</div>
|
|
13
13
|
</template>`,y=l.defineVividComponent("tree-view",o,E,[n.treeItemDefinition],{styles:p}),N=l.createRegisterFunction(y);N();
|
package/tree-view/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { V as h,
|
|
1
|
+
import { V as h, U as m, a as g, o as u, h as p, c as I, d as b } from "../bundled/vivid-element.js";
|
|
2
2
|
import { T as n, i as l, t as v } from "../bundled/definition22.js";
|
|
3
3
|
import { H as y, a as E } from "../bundled/host-semantics.js";
|
|
4
4
|
import { f as x, c as F, b as N, g as k, h as S, k as T, a as w } from "../bundled/key-codes.js";
|
|
5
5
|
import { i as f } from "../bundled/dom.js";
|
|
6
6
|
import { r as V } from "../bundled/ref.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { s as C } from "../bundled/slotted.js";
|
|
8
|
+
import { c as $ } from "../bundled/class-names.js";
|
|
9
9
|
const A = ".control{position:relative;display:flex;flex-direction:column;gap:4px}";
|
|
10
10
|
var D = Object.defineProperty, c = (r, e, t, s) => {
|
|
11
11
|
for (var i = void 0, o = r.length - 1, d; o >= 0; o--)
|
|
@@ -90,7 +90,7 @@ class a extends y(h) {
|
|
|
90
90
|
this.$fastController.isConnected && this.setItems();
|
|
91
91
|
}
|
|
92
92
|
connectedCallback() {
|
|
93
|
-
super.connectedCallback(), this.setAttribute("tabindex", "0"), m.
|
|
93
|
+
super.connectedCallback(), this.setAttribute("tabindex", "0"), m.enqueue(() => {
|
|
94
94
|
this.setItems();
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -145,7 +145,7 @@ c([
|
|
|
145
145
|
c([
|
|
146
146
|
u
|
|
147
147
|
], a.prototype, "slottedTreeItems");
|
|
148
|
-
const L = (r) =>
|
|
148
|
+
const L = (r) => $("control"), P = p` <template
|
|
149
149
|
${V("treeView")}
|
|
150
150
|
${E({
|
|
151
151
|
role: "tree"
|
|
@@ -157,7 +157,7 @@ const L = (r) => C("control"), P = p` <template
|
|
|
157
157
|
@selected-change="${(r, e) => r.handleSelectedChange(e.event)}"
|
|
158
158
|
>
|
|
159
159
|
<div class="${L}">
|
|
160
|
-
<slot ${
|
|
160
|
+
<slot ${C("slottedTreeItems")}></slot>
|
|
161
161
|
</div>
|
|
162
162
|
</template>`, _ = b(
|
|
163
163
|
"tree-view",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4
|
+
|
|
5
|
+
function getDefaultExportFromCjs (x) {
|
|
6
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getAugmentedNamespace(n) {
|
|
10
|
+
if (n.__esModule) return n;
|
|
11
|
+
var f = n.default;
|
|
12
|
+
if (typeof f == "function") {
|
|
13
|
+
var a = function a () {
|
|
14
|
+
if (this instanceof a) {
|
|
15
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
16
|
+
}
|
|
17
|
+
return f.apply(this, arguments);
|
|
18
|
+
};
|
|
19
|
+
a.prototype = f.prototype;
|
|
20
|
+
} else a = {};
|
|
21
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
22
|
+
Object.keys(n).forEach(function (k) {
|
|
23
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
24
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return n[k];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return a;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.commonjsGlobal = commonjsGlobal;
|
|
35
|
+
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
36
|
+
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
|
+
|
|
3
|
+
function getDefaultExportFromCjs (x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function getAugmentedNamespace(n) {
|
|
8
|
+
if (n.__esModule) return n;
|
|
9
|
+
var f = n.default;
|
|
10
|
+
if (typeof f == "function") {
|
|
11
|
+
var a = function a () {
|
|
12
|
+
if (this instanceof a) {
|
|
13
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
14
|
+
}
|
|
15
|
+
return f.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
a.prototype = f.prototype;
|
|
18
|
+
} else a = {};
|
|
19
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
20
|
+
Object.keys(n).forEach(function (k) {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
22
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return n[k];
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
return a;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { getAugmentedNamespace as a, commonjsGlobal as c, getDefaultExportFromCjs as g };
|
package/unbundled/affix.cjs
CHANGED
|
@@ -58,7 +58,7 @@ const affixIconTemplateFactory = (context) => {
|
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
const iconTemplate = fastElement.html`<${iconTag} :name="${() => icon}" :label="${() => announcement?.label || void 0}"></${iconTag}>`;
|
|
61
|
-
const wrapperTag = slottedState ? "span" : "slot";
|
|
61
|
+
const wrapperTag = fastElement.html.partial(slottedState ? "span" : "slot");
|
|
62
62
|
return fastElement.html`<${wrapperTag}
|
|
63
63
|
class="${() => slottedState ? "icon" : void 0}"
|
|
64
64
|
:name="${() => slottedState ? void 0 : "icon"}"
|
package/unbundled/affix.js
CHANGED
|
@@ -56,7 +56,7 @@ const affixIconTemplateFactory = (context) => {
|
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
const iconTemplate = html`<${iconTag} :name="${() => icon}" :label="${() => announcement?.label || void 0}"></${iconTag}>`;
|
|
59
|
-
const wrapperTag = slottedState ? "span" : "slot";
|
|
59
|
+
const wrapperTag = html.partial(slottedState ? "span" : "slot");
|
|
60
60
|
return html`<${wrapperTag}
|
|
61
61
|
class="${() => slottedState ? "icon" : void 0}"
|
|
62
62
|
:name="${() => slottedState ? void 0 : "icon"}"
|
|
@@ -69,4 +69,4 @@ const affixIconTemplateFactory = (context) => {
|
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
export {
|
|
72
|
+
export { AffixIcon as A, IconWrapper as I, affixIconTemplateFactory as a, AffixIconWithTrailing as b, IconAriaHidden as c };
|
|
@@ -11,23 +11,24 @@ class AttributeBindingBehavior {
|
|
|
11
11
|
this.source = null;
|
|
12
12
|
this.context = null;
|
|
13
13
|
}
|
|
14
|
-
bind(
|
|
15
|
-
this.source = source;
|
|
16
|
-
this.context = context;
|
|
14
|
+
bind(controller) {
|
|
15
|
+
this.source = controller.source;
|
|
16
|
+
this.context = controller.context;
|
|
17
17
|
if (!this.bindingObserver) {
|
|
18
18
|
this.bindingObserver = fastElement.Observable.binding(
|
|
19
|
-
this.binding,
|
|
19
|
+
this.binding.evaluate,
|
|
20
20
|
this,
|
|
21
21
|
this.isBindingVolatile
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
unbind() {
|
|
27
|
-
this.bindingObserver.disconnect();
|
|
28
|
-
this.source = null;
|
|
29
|
-
this.context = null;
|
|
24
|
+
this.bindingObserver.observe(this.source, this.context);
|
|
25
|
+
this.updateTarget(this.bindingObserver.observe(this.source, this.context));
|
|
30
26
|
}
|
|
27
|
+
// unbind() {
|
|
28
|
+
// this.bindingObserver!.dispose();
|
|
29
|
+
// this.source = null;
|
|
30
|
+
// this.context = null;
|
|
31
|
+
// }
|
|
31
32
|
handleChange() {
|
|
32
33
|
this.updateTarget(
|
|
33
34
|
this.bindingObserver.observe(this.source, this.context)
|
|
@@ -9,23 +9,24 @@ class AttributeBindingBehavior {
|
|
|
9
9
|
this.source = null;
|
|
10
10
|
this.context = null;
|
|
11
11
|
}
|
|
12
|
-
bind(
|
|
13
|
-
this.source = source;
|
|
14
|
-
this.context = context;
|
|
12
|
+
bind(controller) {
|
|
13
|
+
this.source = controller.source;
|
|
14
|
+
this.context = controller.context;
|
|
15
15
|
if (!this.bindingObserver) {
|
|
16
16
|
this.bindingObserver = Observable.binding(
|
|
17
|
-
this.binding,
|
|
17
|
+
this.binding.evaluate,
|
|
18
18
|
this,
|
|
19
19
|
this.isBindingVolatile
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
unbind() {
|
|
25
|
-
this.bindingObserver.disconnect();
|
|
26
|
-
this.source = null;
|
|
27
|
-
this.context = null;
|
|
22
|
+
this.bindingObserver.observe(this.source, this.context);
|
|
23
|
+
this.updateTarget(this.bindingObserver.observe(this.source, this.context));
|
|
28
24
|
}
|
|
25
|
+
// unbind() {
|
|
26
|
+
// this.bindingObserver!.dispose();
|
|
27
|
+
// this.source = null;
|
|
28
|
+
// this.context = null;
|
|
29
|
+
// }
|
|
29
30
|
handleChange() {
|
|
30
31
|
this.updateTarget(
|
|
31
32
|
this.bindingObserver.observe(this.source, this.context)
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fastElement = require('@microsoft/fast-element');
|
|
4
|
+
const fastWebUtilities = require('@microsoft/fast-web-utilities');
|
|
5
|
+
const formAssociated = require('./form-associated.cjs');
|
|
6
|
+
const localized = require('./localized.cjs');
|
|
7
|
+
const formElement = require('./form-element.cjs');
|
|
8
|
+
|
|
9
|
+
function parseHexColor(input) {
|
|
10
|
+
if (!input) return null;
|
|
11
|
+
const hex = input.trim().replace(/^#/, "");
|
|
12
|
+
if (/^[0-9a-fA-F]{3}$/.test(hex)) {
|
|
13
|
+
return hex.split("").map((char) => char + char).join("").toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
if (/^[0-9a-fA-F]{6}$/.test(hex)) {
|
|
16
|
+
return hex.toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function isValidHexColor(input) {
|
|
21
|
+
return parseHexColor(input) !== null;
|
|
22
|
+
}
|
|
23
|
+
function getLuminance(hexColor) {
|
|
24
|
+
const hex = parseHexColor(hexColor);
|
|
25
|
+
if (!hex) return 0;
|
|
26
|
+
const r = parseInt(hex.slice(0, 2), 16) / 255;
|
|
27
|
+
const g = parseInt(hex.slice(2, 4), 16) / 255;
|
|
28
|
+
const b = parseInt(hex.slice(4, 6), 16) / 255;
|
|
29
|
+
const sR = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
|
|
30
|
+
const sG = g <= 0.03928 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4);
|
|
31
|
+
const sB = b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);
|
|
32
|
+
return 0.2126 * sR + 0.7152 * sG + 0.0722 * sB;
|
|
33
|
+
}
|
|
34
|
+
function getContrastRatio(color1, color2) {
|
|
35
|
+
const lum1 = getLuminance(color1);
|
|
36
|
+
const lum2 = getLuminance(color2);
|
|
37
|
+
const brightest = Math.max(lum1, lum2);
|
|
38
|
+
const darkest = Math.min(lum1, lum2);
|
|
39
|
+
return (brightest + 0.05) / (darkest + 0.05);
|
|
40
|
+
}
|
|
41
|
+
function getCSSCustomProperty(propertyName, element) {
|
|
42
|
+
if (!element) {
|
|
43
|
+
element = document.querySelector(".vvd-root") || document.documentElement;
|
|
44
|
+
}
|
|
45
|
+
return getComputedStyle(element).getPropertyValue(propertyName).trim();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var __defProp = Object.defineProperty;
|
|
49
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
50
|
+
var result = void 0 ;
|
|
51
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
52
|
+
if (decorator = decorators[i])
|
|
53
|
+
result = (decorator(target, key, result) ) || result;
|
|
54
|
+
if (result) __defProp(target, key, result);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
const BaseColorPicker = (Base) => {
|
|
58
|
+
class BaseColorPickerElement extends localized.Localized(
|
|
59
|
+
formElement.FormElement(formAssociated.FormAssociated(Base))
|
|
60
|
+
) {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(...arguments);
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
this.proxy = document.createElement("input");
|
|
67
|
+
this.open = false;
|
|
68
|
+
this.swatches = [];
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
this._canvasColor = "";
|
|
73
|
+
}
|
|
74
|
+
connectedCallback() {
|
|
75
|
+
super.connectedCallback();
|
|
76
|
+
this._refreshCanvasColor();
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
_refreshCanvasColor() {
|
|
82
|
+
this._canvasColor = getCSSCustomProperty("--vvd-color-canvas", this);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
_applyContrastClass(color, threshold = 3) {
|
|
88
|
+
if (!color || !this._canvasColor) return false;
|
|
89
|
+
const ratio = getContrastRatio(color, this._canvasColor);
|
|
90
|
+
return ratio < threshold;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
_getRowLength() {
|
|
96
|
+
return 7;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
_handleSwatchSelection(value) {
|
|
102
|
+
if (this.value === value) {
|
|
103
|
+
this.value = "";
|
|
104
|
+
} else {
|
|
105
|
+
this.value = value;
|
|
106
|
+
}
|
|
107
|
+
this.$emit("change");
|
|
108
|
+
this.open = false;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
_handleColorSaving() {
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
_getFocusReturnEl() {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
_returnFocusToAnchor() {
|
|
125
|
+
const el = this._getFocusReturnEl();
|
|
126
|
+
if (!el) return;
|
|
127
|
+
fastElement.Updates.enqueue(() => el.focus());
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
_getGridCells() {
|
|
133
|
+
const grid = this.shadowRoot?.querySelector('[role="grid"]');
|
|
134
|
+
return grid ? Array.from(
|
|
135
|
+
grid.querySelectorAll(
|
|
136
|
+
'[role="gridcell"], [data-vvd-role="gridcell"]'
|
|
137
|
+
)
|
|
138
|
+
) : [];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
_handleCellKeydown(event, value, index, isSaveCell) {
|
|
144
|
+
const rowLength = this._getRowLength();
|
|
145
|
+
const totalCells = this._getGridCells().length;
|
|
146
|
+
const currentRow = Math.floor(index / rowLength);
|
|
147
|
+
const currentCol = index % rowLength;
|
|
148
|
+
const totalRows = Math.ceil(totalCells / rowLength);
|
|
149
|
+
switch (event.key) {
|
|
150
|
+
case "ArrowRight":
|
|
151
|
+
if (currentCol < rowLength - 1 && index + 1 < totalCells) {
|
|
152
|
+
this._focusSwatchByIndex(index + 1);
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
case "ArrowLeft":
|
|
156
|
+
if (currentCol > 0) {
|
|
157
|
+
this._focusSwatchByIndex(index - 1);
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
case "ArrowDown":
|
|
161
|
+
if (currentRow < totalRows - 1 && index + rowLength < totalCells) {
|
|
162
|
+
this._focusSwatchByIndex(index + rowLength);
|
|
163
|
+
}
|
|
164
|
+
return false;
|
|
165
|
+
case "ArrowUp":
|
|
166
|
+
if (currentRow > 0) {
|
|
167
|
+
this._focusSwatchByIndex(index - rowLength);
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
case "PageDown": {
|
|
171
|
+
const lastRowStart = (totalRows - 1) * rowLength;
|
|
172
|
+
const targetIndex = Math.min(
|
|
173
|
+
lastRowStart + currentCol,
|
|
174
|
+
totalCells - 1
|
|
175
|
+
);
|
|
176
|
+
if (index !== targetIndex) {
|
|
177
|
+
this._focusSwatchByIndex(targetIndex);
|
|
178
|
+
}
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
case "PageUp": {
|
|
182
|
+
const targetIndex = Math.min(currentCol, totalCells - 1);
|
|
183
|
+
if (index !== targetIndex) {
|
|
184
|
+
this._focusSwatchByIndex(targetIndex);
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
case "Home":
|
|
189
|
+
if (event.ctrlKey) {
|
|
190
|
+
this._focusSwatchByIndex(0);
|
|
191
|
+
} else {
|
|
192
|
+
this._focusSwatchByIndex(currentRow * rowLength);
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
case "End":
|
|
196
|
+
if (event.ctrlKey) {
|
|
197
|
+
this._focusSwatchByIndex(totalCells - 1);
|
|
198
|
+
} else {
|
|
199
|
+
const rowEnd = Math.min(
|
|
200
|
+
(currentRow + 1) * rowLength - 1,
|
|
201
|
+
totalCells - 1
|
|
202
|
+
);
|
|
203
|
+
this._focusSwatchByIndex(rowEnd);
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
case "Enter":
|
|
207
|
+
case " ":
|
|
208
|
+
if (isSaveCell) {
|
|
209
|
+
this._handleColorSaving();
|
|
210
|
+
}
|
|
211
|
+
if (value && !isSaveCell) {
|
|
212
|
+
this._handleSwatchSelection(value);
|
|
213
|
+
this._returnFocusToAnchor();
|
|
214
|
+
}
|
|
215
|
+
return false;
|
|
216
|
+
case "Escape":
|
|
217
|
+
this.open = false;
|
|
218
|
+
this._returnFocusToAnchor();
|
|
219
|
+
return false;
|
|
220
|
+
case "Tab":
|
|
221
|
+
this.open = false;
|
|
222
|
+
return true;
|
|
223
|
+
default:
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
_focusSwatchByIndex(index) {
|
|
231
|
+
const cells = this._getGridCells();
|
|
232
|
+
if (index < 0 || index >= cells.length) return;
|
|
233
|
+
cells[index]?.focus();
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* @internal
|
|
237
|
+
*/
|
|
238
|
+
_renderColorSwatch(iconTag) {
|
|
239
|
+
return fastElement.html`
|
|
240
|
+
<button
|
|
241
|
+
class="swatch ${(x, c) => fastWebUtilities.classNames(
|
|
242
|
+
c.parent.value === x.value ? "selected" : "",
|
|
243
|
+
c.parent._applyContrastClass(x.value) ? "contrast" : ""
|
|
244
|
+
)}"
|
|
245
|
+
role="gridcell"
|
|
246
|
+
style="--swatch-color: ${(x) => x.value};"
|
|
247
|
+
tabindex="${(x, c) => c.index === 0 ? "0" : "-1"}"
|
|
248
|
+
aria-label="${(x, c) => c.parent.locale.baseColorPicker.colorSwatchLabel(
|
|
249
|
+
x.value,
|
|
250
|
+
x.label,
|
|
251
|
+
c.parent.value === x.value
|
|
252
|
+
)}"
|
|
253
|
+
@click="${(x, c) => c.parent._handleSwatchSelection(x.value)}"
|
|
254
|
+
@keydown="${(x, c) => c.parent._handleCellKeydown(
|
|
255
|
+
c.event,
|
|
256
|
+
x.value,
|
|
257
|
+
c.index
|
|
258
|
+
)}"
|
|
259
|
+
>
|
|
260
|
+
${fastElement.when(
|
|
261
|
+
(x, c) => c.parent.value === x.value,
|
|
262
|
+
fastElement.html`<${iconTag} size="-6" name="check-solid" aria-hidden="true"></${iconTag}>`
|
|
263
|
+
)}
|
|
264
|
+
</button>
|
|
265
|
+
`;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
__decorateClass([
|
|
269
|
+
fastElement.attr({ mode: "boolean" })
|
|
270
|
+
], BaseColorPickerElement.prototype, "open");
|
|
271
|
+
__decorateClass([
|
|
272
|
+
fastElement.observable
|
|
273
|
+
], BaseColorPickerElement.prototype, "swatches");
|
|
274
|
+
return BaseColorPickerElement;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
exports.BaseColorPicker = BaseColorPicker;
|
|
278
|
+
exports.isValidHexColor = isValidHexColor;
|