@vonage/vivid 5.17.0 → 5.18.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/definition.cjs +6 -6
- package/accordion/definition.js +1 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +2 -2
- package/accordion-item/definition.cjs +5 -5
- package/accordion-item/definition.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +2 -2
- package/alert/definition.cjs +5 -5
- package/alert/definition.js +1 -1
- package/alert/index.cjs +2 -2
- package/alert/index.js +6 -5
- package/audio-player/definition.cjs +5 -5
- package/audio-player/definition.js +1 -1
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +2 -1
- package/avatar/definition.cjs +5 -5
- package/avatar/definition.js +1 -1
- package/avatar/index.cjs +3 -3
- package/avatar/index.js +6 -5
- package/badge/definition.cjs +5 -5
- package/badge/definition.js +1 -1
- package/badge/index.cjs +1 -4
- package/badge/index.js +4 -20
- package/banner/definition.cjs +5 -5
- package/banner/definition.js +1 -1
- package/banner/index.cjs +2 -2
- package/banner/index.js +5 -4
- package/breadcrumb-item/definition.cjs +4 -4
- package/breadcrumb-item/definition.js +1 -1
- package/breadcrumb-item/index.cjs +1 -1
- package/breadcrumb-item/index.js +1 -0
- package/bundled/affix.cjs +1 -1
- package/bundled/affix.js +5 -5
- package/bundled/definition11.cjs +2 -2
- package/bundled/definition11.js +5 -5
- package/bundled/definition12.cjs +3 -3
- package/bundled/definition12.js +5 -5
- package/bundled/definition13.cjs +2 -2
- package/bundled/definition13.js +4 -4
- package/bundled/definition15.cjs +3 -3
- package/bundled/definition15.js +7 -7
- package/bundled/definition17.cjs +3 -3
- package/bundled/definition17.js +8 -8
- package/bundled/definition18.cjs +2 -2
- package/bundled/definition18.js +6 -6
- package/bundled/definition2.cjs +3 -14
- package/bundled/definition2.js +15 -48
- package/bundled/definition20.cjs +5 -5
- package/bundled/definition20.js +8 -8
- package/bundled/definition22.cjs +4 -39
- package/bundled/definition22.js +18 -70
- package/bundled/definition23.cjs +12 -0
- package/bundled/definition23.js +37 -0
- package/bundled/definition24.cjs +39 -0
- package/bundled/definition24.js +72 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +9 -6
- package/bundled/definition4.cjs +2 -2
- package/bundled/definition4.js +5 -5
- package/bundled/definition6.cjs +11 -11
- package/bundled/definition6.js +45 -29
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +1 -0
- package/bundled/mixins.cjs +4 -4
- package/bundled/mixins.js +7 -7
- package/bundled/numberConverter.cjs +12 -0
- package/bundled/numberConverter.js +38 -0
- package/bundled/picker-field.template.cjs +2 -1
- package/bundled/picker-field.template.js +2 -1
- package/bundled/utils.cjs +1 -0
- package/bundled/utils.js +1420 -0
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/button/definition.cjs +5 -5
- package/button/definition.js +1 -1
- package/button/index.cjs +1 -1
- package/button/index.js +1 -1
- package/card/definition.cjs +5 -5
- package/card/definition.js +1 -1
- package/card/index.cjs +4 -4
- package/card/index.js +7 -6
- package/checkbox/definition.cjs +5 -5
- package/checkbox/definition.js +1 -1
- package/checkbox/index.cjs +1 -1
- package/checkbox/index.js +1 -1
- package/color-picker/definition.cjs +5 -5
- package/color-picker/definition.js +1 -1
- package/color-picker/index.cjs +7 -7
- package/color-picker/index.js +55 -54
- package/combobox/definition.cjs +5 -5
- package/combobox/definition.js +1 -1
- package/combobox/index.cjs +2 -2
- package/combobox/index.js +8 -7
- package/contextual-help/definition.cjs +5 -5
- package/contextual-help/definition.js +1 -1
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/country/definition.cjs +5 -5
- package/country/definition.js +1 -1
- package/country/index.cjs +1 -12
- package/country/index.js +4 -1216
- package/country-group/definition.cjs +6 -0
- package/country-group/definition.js +3 -0
- package/country-group/index.cjs +43 -0
- package/country-group/index.js +166 -0
- package/custom-elements.json +1112 -450
- package/data-grid/definition.cjs +9 -9
- package/data-grid/definition.js +2 -2
- package/data-grid/index.cjs +4 -4
- package/data-grid/index.js +47 -46
- package/date-picker/definition.cjs +5 -5
- package/date-picker/definition.js +2 -2
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +1 -1
- package/date-range-picker/definition.cjs +5 -5
- package/date-range-picker/definition.js +2 -2
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +1 -1
- package/date-time-picker/definition.cjs +5 -5
- package/date-time-picker/definition.js +2 -2
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +1 -1
- package/dial-pad/definition.cjs +5 -5
- package/dial-pad/definition.js +2 -2
- package/dial-pad/index.cjs +4 -4
- package/dial-pad/index.js +9 -8
- package/dialog/definition.cjs +5 -5
- package/dialog/definition.js +2 -2
- package/dialog/index.cjs +4 -4
- package/dialog/index.js +12 -11
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/empty-state/definition.cjs +5 -5
- package/empty-state/definition.js +2 -2
- package/empty-state/index.cjs +2 -2
- package/empty-state/index.js +6 -5
- package/fab/definition.cjs +5 -5
- package/fab/definition.js +2 -2
- package/fab/index.cjs +2 -2
- package/fab/index.js +5 -4
- package/file-picker/definition.cjs +5 -5
- package/file-picker/definition.js +2 -2
- package/file-picker/index.cjs +6 -6
- package/file-picker/index.js +9 -8
- package/flag/definition.cjs +6 -0
- package/flag/definition.js +3 -0
- package/flag/index.cjs +10 -0
- package/flag/index.js +61 -0
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/icon/definition.cjs +1 -0
- package/icon/definition.js +1 -0
- package/icon/index.cjs +1 -1
- package/icon/index.js +1 -0
- package/index.cjs +183 -174
- package/index.js +48 -45
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/lib/button/button.d.ts +1 -0
- package/lib/components.d.ts +2 -0
- package/lib/country/countries-data.d.ts +1 -0
- package/lib/country/{country-code-to-flag-icon.d.ts → utils.d.ts} +0 -3
- package/lib/country-group/country-group.d.ts +829 -0
- package/lib/country-group/country-group.template.d.ts +3 -0
- package/lib/country-group/definition.d.ts +3 -0
- package/lib/country-group/index.d.ts +1 -0
- package/lib/country-group/locale.d.ts +3 -0
- package/lib/date-picker/date-picker.d.ts +4 -0
- package/lib/date-range-picker/date-range-picker.d.ts +2 -0
- package/lib/date-time-picker/date-time-picker.d.ts +4 -0
- package/lib/flag/definition.d.ts +3 -0
- package/lib/flag/flag.d.ts +8 -0
- package/lib/flag/flag.template.d.ts +3 -0
- package/lib/flag/index.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -2
- package/lib/searchable-select/option-tag.d.ts +3 -1
- package/lib/searchable-select/searchable-select.d.ts +3 -1
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/time-picker/time-picker.d.ts +2 -0
- package/locales/de-DE.cjs +1 -0
- package/locales/de-DE.js +1 -0
- package/locales/en-GB.cjs +1 -0
- package/locales/en-GB.js +1 -0
- package/locales/en-US.cjs +1 -0
- package/locales/en-US.js +1 -0
- package/locales/ja-JP.cjs +1 -0
- package/locales/ja-JP.js +1 -0
- package/locales/zh-CN.cjs +1 -0
- package/locales/zh-CN.js +1 -0
- package/menu/definition.cjs +5 -5
- package/menu/definition.js +1 -1
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/definition.cjs +6 -6
- package/menu-item/definition.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav/definition.cjs +1 -1
- package/nav/definition.js +1 -1
- package/nav-disclosure/definition.cjs +5 -5
- package/nav-disclosure/definition.js +2 -2
- package/nav-disclosure/index.cjs +2 -2
- package/nav-disclosure/index.js +6 -5
- package/nav-item/definition.cjs +5 -5
- package/nav-item/definition.js +2 -2
- package/nav-item/index.cjs +2 -2
- package/nav-item/index.js +5 -4
- package/note/definition.cjs +5 -5
- package/note/definition.js +2 -2
- package/note/index.cjs +2 -2
- package/note/index.js +5 -4
- package/number-field/definition.cjs +5 -5
- package/number-field/definition.js +2 -2
- package/number-field/index.cjs +2 -2
- package/number-field/index.js +6 -5
- package/option/definition.cjs +5 -5
- package/option/definition.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +4 -4
- package/pagination/definition.cjs +5 -5
- package/pagination/definition.js +2 -2
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +1 -1
- package/popover/definition.cjs +5 -5
- package/popover/definition.js +2 -2
- package/popover/index.cjs +4 -4
- package/popover/index.js +7 -6
- package/popup/definition.cjs +4 -4
- package/popup/definition.js +1 -1
- package/popup/index.cjs +1 -1
- package/popup/index.js +1 -1
- package/progress/definition.cjs +1 -1
- package/progress/definition.js +1 -1
- package/radio/definition.cjs +1 -1
- package/radio/definition.js +1 -1
- package/radio-group/definition.cjs +5 -5
- package/radio-group/definition.js +2 -2
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/definition.cjs +5 -5
- package/range-slider/definition.js +2 -2
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +22 -19
- package/rich-text-editor/definition.cjs +32 -32
- package/rich-text-editor/definition.js +2 -2
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +2 -2
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/searchable-select/definition.cjs +4 -4
- package/searchable-select/definition.js +2 -2
- package/searchable-select/index.cjs +6 -4
- package/searchable-select/index.js +76 -73
- package/select/definition.cjs +5 -5
- package/select/definition.js +2 -2
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/definition.cjs +5 -5
- package/selectable-box/definition.js +2 -2
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/icon/utils.d.ts +1 -0
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +1 -0
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-date-picker.d.ts +1 -0
- package/shared/picker-field/mixins/single-value-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.d.ts +1 -0
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +2 -0
- package/shared/picker-field/picker-field.d.ts +2 -0
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +5 -5
- package/simple-color-picker/definition.js +2 -2
- package/simple-color-picker/index.cjs +2 -2
- package/simple-color-picker/index.js +6 -5
- package/slider/definition.cjs +5 -5
- package/slider/definition.js +1 -1
- package/slider/index.cjs +1 -1
- package/slider/index.js +1 -1
- package/split-button/definition.cjs +5 -5
- package/split-button/definition.js +2 -2
- package/split-button/index.cjs +2 -2
- package/split-button/index.js +7 -6
- package/status/definition.cjs +5 -5
- package/status/definition.js +2 -2
- package/status/index.cjs +2 -2
- package/status/index.js +5 -4
- package/switch/definition.cjs +5 -5
- package/switch/definition.js +2 -2
- package/switch/index.cjs +2 -2
- package/switch/index.js +6 -5
- package/tab/definition.cjs +5 -5
- package/tab/definition.js +2 -2
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/table/definition.cjs +17 -17
- package/table/definition.js +2 -2
- package/table/index.cjs +3 -3
- package/table/index.js +6 -5
- package/tabs/definition.cjs +6 -6
- package/tabs/definition.js +2 -2
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +1 -1
- package/tag/definition.cjs +5 -5
- package/tag/definition.js +2 -2
- package/tag/index.cjs +4 -4
- package/tag/index.js +6 -5
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/text-area/definition.cjs +5 -5
- package/text-area/definition.js +2 -2
- package/text-area/index.cjs +1 -1
- package/text-area/index.js +1 -1
- package/text-field/definition.cjs +5 -5
- package/text-field/definition.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/definition.cjs +4 -4
- package/time-picker/definition.js +2 -2
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +5 -5
- package/toggletip/definition.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +5 -5
- package/tooltip/definition.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/definition.cjs +5 -5
- package/tree-item/definition.js +2 -2
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/definition.cjs +5 -5
- package/tree-view/definition.js +2 -2
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +1 -1
- package/unbundled/definition11.cjs +6 -0
- package/unbundled/definition11.js +6 -0
- package/unbundled/definition14.cjs +1 -0
- package/unbundled/definition14.js +1 -0
- package/unbundled/definition2.cjs +5 -75
- package/unbundled/definition2.js +1 -71
- package/unbundled/definition28.cjs +1 -0
- package/unbundled/definition28.js +1 -0
- package/unbundled/definition31.cjs +2 -1189
- package/unbundled/definition31.js +1 -1188
- package/unbundled/definition32.cjs +207 -1835
- package/unbundled/definition32.js +203 -1807
- package/unbundled/definition33.cjs +83 -311
- package/unbundled/definition33.js +79 -235
- package/unbundled/definition34.cjs +1887 -25
- package/unbundled/definition34.js +1857 -24
- package/unbundled/definition35.cjs +315 -121
- package/unbundled/definition35.js +236 -114
- package/unbundled/definition36.cjs +25 -405
- package/unbundled/definition36.js +22 -397
- package/unbundled/definition37.cjs +47 -142
- package/unbundled/definition37.js +44 -139
- package/unbundled/definition38.cjs +345 -330
- package/unbundled/definition38.js +343 -328
- package/unbundled/definition39.cjs +183 -235
- package/unbundled/definition39.js +181 -233
- package/unbundled/definition40.cjs +377 -47
- package/unbundled/definition40.js +372 -42
- package/unbundled/definition41.cjs +256 -57
- package/unbundled/definition41.js +255 -56
- package/unbundled/definition42.cjs +45 -432
- package/unbundled/definition42.js +41 -428
- package/unbundled/definition43.cjs +63 -49
- package/unbundled/definition43.js +61 -47
- package/unbundled/definition44.cjs +438 -30
- package/unbundled/definition44.js +434 -25
- package/unbundled/definition45.cjs +46 -84
- package/unbundled/definition45.js +43 -81
- package/unbundled/definition46.cjs +29 -54
- package/unbundled/definition46.js +24 -50
- package/unbundled/definition47.cjs +93 -21
- package/unbundled/definition47.js +91 -16
- package/unbundled/definition48.cjs +49 -33
- package/unbundled/definition48.js +46 -30
- package/unbundled/definition49.cjs +22 -347
- package/unbundled/definition49.js +16 -344
- package/unbundled/definition50.cjs +34 -211
- package/unbundled/definition50.js +30 -207
- package/unbundled/definition51.cjs +282 -242
- package/unbundled/definition51.js +275 -235
- package/unbundled/definition52.cjs +211 -51
- package/unbundled/definition52.js +209 -48
- package/unbundled/definition53.cjs +275 -131
- package/unbundled/definition53.js +272 -127
- package/unbundled/definition54.cjs +50 -261
- package/unbundled/definition54.js +48 -260
- package/unbundled/definition55.cjs +126 -443
- package/unbundled/definition55.js +123 -441
- package/unbundled/definition56.cjs +234 -3596
- package/unbundled/definition56.js +229 -3428
- package/unbundled/definition57.cjs +407 -728
- package/unbundled/definition57.js +405 -726
- package/unbundled/definition58.cjs +3618 -106
- package/unbundled/definition58.js +3449 -100
- package/unbundled/definition59.cjs +624 -868
- package/unbundled/definition59.js +619 -863
- package/unbundled/definition60.cjs +106 -108
- package/unbundled/definition60.js +102 -104
- package/unbundled/definition61.cjs +1040 -71
- package/unbundled/definition61.js +1035 -65
- package/unbundled/definition62.cjs +105 -169
- package/unbundled/definition62.js +101 -165
- package/unbundled/definition63.cjs +70 -113
- package/unbundled/definition63.js +65 -109
- package/unbundled/definition64.cjs +181 -53
- package/unbundled/definition64.js +178 -50
- package/unbundled/definition65.cjs +109 -76
- package/unbundled/definition65.js +109 -75
- package/unbundled/definition66.cjs +58 -21
- package/unbundled/definition66.js +55 -15
- package/unbundled/definition67.cjs +81 -74
- package/unbundled/definition67.js +79 -73
- package/unbundled/definition68.cjs +19 -344
- package/unbundled/definition68.js +14 -335
- package/unbundled/definition69.cjs +88 -26
- package/unbundled/definition69.js +85 -22
- package/unbundled/definition7.cjs +18 -3
- package/unbundled/definition7.js +18 -3
- package/unbundled/definition70.cjs +330 -111
- package/unbundled/definition70.js +320 -108
- package/unbundled/definition71.cjs +26 -271
- package/unbundled/definition71.js +21 -267
- package/unbundled/definition72.cjs +134 -27
- package/unbundled/definition72.js +125 -25
- package/unbundled/definition73.cjs +245 -113
- package/unbundled/definition73.js +242 -104
- package/unbundled/definition74.cjs +28 -212
- package/unbundled/definition74.js +26 -202
- package/unbundled/definition75.cjs +117 -479
- package/unbundled/definition75.js +109 -475
- package/unbundled/definition76.cjs +232 -0
- package/unbundled/definition76.js +213 -0
- package/unbundled/definition77.cjs +533 -0
- package/unbundled/definition77.js +513 -0
- package/unbundled/numberConverter.cjs +91 -0
- package/unbundled/numberConverter.js +74 -0
- package/unbundled/picker-field.template.cjs +2 -0
- package/unbundled/picker-field.template.js +2 -0
- package/unbundled/utils.cjs +1439 -0
- package/unbundled/utils.js +1428 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/vivid.api.json +513 -0
- /package/{lib/icon/icon.placeholder.d.ts → shared/icon/icon-placeholder.d.ts} +0 -0
|
@@ -1,213 +1,149 @@
|
|
|
1
1
|
require("./chunk.cjs");
|
|
2
2
|
const require_vivid_element = require("./vivid-element.cjs");
|
|
3
|
-
const require_definition = require("./definition2.cjs");
|
|
4
3
|
const require_decorate = require("./decorate.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const require_definition$
|
|
9
|
-
const require_base_color_picker = require("./base-color-picker.cjs");
|
|
4
|
+
const require_delegates_aria = require("./delegates-aria.cjs");
|
|
5
|
+
const require_enums = require("./enums.cjs");
|
|
6
|
+
const require_definition = require("./definition23.cjs");
|
|
7
|
+
const require_definition$1 = require("./definition55.cjs");
|
|
10
8
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
11
9
|
let _microsoft_fast_web_utilities = require("@microsoft/fast-web-utilities");
|
|
12
|
-
//#region src/lib/
|
|
13
|
-
var
|
|
10
|
+
//#region src/lib/selectable-box/selectable-box.scss?inline
|
|
11
|
+
var selectable_box_default = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all:var(--vvd-selectable-box-cta-firm-all,var(--vvd-color-cta-600));--_connotation-color-pale:var(--vvd-selectable-box-cta-pale,var(--vvd-color-cta-300));--_connotation-color-fierce:var(--vvd-selectable-box-cta-fierce,var(--vvd-color-cta-700));--_connotation-color-faint:var(--vvd-selectable-box-cta-faint,var(--vvd-color-cta-50));--_connotation-color-soft:var(--vvd-selectable-box-cta-soft,var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all:var(--vvd-selectable-box-accent-firm-all,var(--vvd-color-neutral-600));--_connotation-color-pale:var(--vvd-selectable-box-accent-pale,var(--vvd-color-neutral-300));--_connotation-color-fierce:var(--vvd-selectable-box-accent-fierce,var(--vvd-color-neutral-700));--_connotation-color-faint:var(--vvd-selectable-box-accent-faint,var(--vvd-color-neutral-50));--_connotation-color-soft:var(--vvd-selectable-box-accent-soft,var(--vvd-color-neutral-100))}.base{--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--_connotation-color-pale)}@media (hover:hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--_connotation-color-firm-all)}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--_connotation-color-firm-all)}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:var(--_connotation-color-soft);--_appearance-color-outline:var(--_connotation-color-pale)}@media (hover:hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:var(--_connotation-color-firm-all)}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:var(--_connotation-color-firm-all)}.base:disabled,.base.disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--vvd-color-neutral-100)}.base{--control-offset:calc(var(--selectable-box-spacing,16px) + 36px);padding:var(--selectable-box-spacing,16px);border:1px solid var(--_appearance-color-outline);background-color:var(--_appearance-color-fill);text-align:start;border-radius:8px;inline-size:100%;position:relative}.base.control-placement-end-stacked,.base.control-placement-start-stacked{padding-block-start:var(--control-offset)}.base.control-placement-start{padding-inline-start:var(--control-offset)}.base.control-placement-end{padding-inline-end:var(--control-offset)}.base:focus-visible{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,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))}.base.tight{min-height:calc(var(--selectable-box-spacing,16px) * 2 + 22px);padding:0;overflow:hidden}.base.selected{background-color:var(--selectable-box-checked-bg,var(--_appearance-color-fill))}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing,16px)}.control.start-stacked,.control.start{inset-inline-start:var(--selectable-box-spacing,16px)}.control.end-stacked,.control.end{inset-inline-end:var(--selectable-box-spacing,16px)}";
|
|
14
12
|
//#endregion
|
|
15
|
-
//#region src/lib/
|
|
13
|
+
//#region src/lib/selectable-box/selectable-box.ts
|
|
16
14
|
/**
|
|
17
15
|
* @public
|
|
18
|
-
* @component
|
|
19
|
-
* @slot
|
|
20
|
-
* @event {CustomEvent<undefined>} change -
|
|
21
|
-
* @
|
|
16
|
+
* @component selectable-box
|
|
17
|
+
* @slot default - Slot for box's content.
|
|
18
|
+
* @event {CustomEvent<undefined>} change - Fired when the checked state changes
|
|
19
|
+
* @testAction check check #control
|
|
20
|
+
* @testAction uncheck uncheck #control
|
|
21
|
+
* @testQuery checked checked true
|
|
22
|
+
* @testQuery unchecked checked false
|
|
23
|
+
* @testRef control nestedShadow [data-vvd-component].control div.control
|
|
22
24
|
*/
|
|
23
|
-
var
|
|
25
|
+
var SelectableBox = class extends require_delegates_aria.DelegatesAria(require_vivid_element.VividElement) {
|
|
24
26
|
constructor(..._args) {
|
|
25
27
|
super(..._args);
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/* v8 ignore else -- @preserve */
|
|
32
|
-
if (clickedOutside || clickedOnAnchor) this.open = false;
|
|
33
|
-
};
|
|
34
|
-
this._closeOnEscape = (e) => {
|
|
35
|
-
/* v8 ignore else -- @preserve */
|
|
36
|
-
if (e.key === "Escape") this.open = false;
|
|
37
|
-
};
|
|
28
|
+
this.checked = false;
|
|
29
|
+
this.clickableBox = false;
|
|
30
|
+
this.controlPlacement = "end-stacked";
|
|
31
|
+
this.tight = false;
|
|
32
|
+
this.disabled = false;
|
|
38
33
|
}
|
|
39
34
|
/**
|
|
40
35
|
* @internal
|
|
41
36
|
*/
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
if (this.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (this.#openedByKeyboard) {
|
|
48
|
-
const selectedIndex = this.swatches.findIndex((swatch) => swatch.value === this.value);
|
|
49
|
-
const targetIndex = selectedIndex >= 0 ? selectedIndex : 0;
|
|
50
|
-
this._focusSwatchByIndex(targetIndex);
|
|
51
|
-
}
|
|
52
|
-
this.#openedByKeyboard = false;
|
|
53
|
-
});
|
|
37
|
+
_handleCheckedChange() {
|
|
38
|
+
if (this.disabled) return;
|
|
39
|
+
if (this.controlType === "radio" && this.checked) return;
|
|
40
|
+
this.checked = !this.checked;
|
|
41
|
+
if (this.clickableBox) this.$emit("change");
|
|
54
42
|
}
|
|
55
43
|
/**
|
|
56
44
|
* @internal
|
|
57
45
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
super.connectedCallback();
|
|
63
|
-
this._updateListeners();
|
|
64
|
-
}
|
|
65
|
-
disconnectedCallback() {
|
|
66
|
-
super.disconnectedCallback();
|
|
67
|
-
this._updateListeners();
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
_updateListeners() {
|
|
73
|
-
document.removeEventListener("click", this._closeOnClickOutside);
|
|
74
|
-
document.removeEventListener("keydown", this._closeOnEscape);
|
|
75
|
-
if (this.open && this.isConnected) {
|
|
76
|
-
document.addEventListener("click", this._closeOnClickOutside);
|
|
77
|
-
document.addEventListener("keydown", this._closeOnEscape);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
_getFocusReturnEl() {
|
|
84
|
-
return this._anchorEl ?? null;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* @internal
|
|
88
|
-
*/
|
|
89
|
-
_anchorElChanged(oldValue, newValue) {
|
|
90
|
-
if (oldValue) this.#cleanupAnchor(oldValue);
|
|
91
|
-
if (newValue) this.#setupAnchor(newValue);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* @internal
|
|
95
|
-
*/
|
|
96
|
-
#updateAnchor(a) {
|
|
97
|
-
a.setAttribute("aria-expanded", this.open.toString());
|
|
98
|
-
a.setAttribute("data-expanded", this.open.toString());
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* @internal
|
|
102
|
-
*/
|
|
103
|
-
#setupAnchor(a) {
|
|
104
|
-
this.#updateAnchor(a);
|
|
105
|
-
a.addEventListener("click", this.#openPopup, true);
|
|
106
|
-
a.addEventListener("keydown", this.#handleAnchorKeydown);
|
|
107
|
-
a.setAttribute("aria-haspopup", "true");
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* @internal
|
|
111
|
-
*/
|
|
112
|
-
#cleanupAnchor(a) {
|
|
113
|
-
a.removeEventListener("click", this.#openPopup, true);
|
|
114
|
-
a.removeEventListener("keydown", this.#handleAnchorKeydown);
|
|
115
|
-
a.removeAttribute("aria-expanded");
|
|
116
|
-
a.removeAttribute("data-expanded");
|
|
117
|
-
a.removeAttribute("aria-haspopup");
|
|
46
|
+
_handleKeydown(event) {
|
|
47
|
+
if (this.disabled) return true;
|
|
48
|
+
if ((event.code === "Space" || event.code === "Enter") && this.clickableBox) return this._handleCheckedChange();
|
|
49
|
+
return true;
|
|
118
50
|
}
|
|
119
|
-
/**
|
|
120
|
-
* @internal
|
|
121
|
-
*/
|
|
122
|
-
#openedByKeyboard = false;
|
|
123
|
-
/**
|
|
124
|
-
* @internal
|
|
125
|
-
*/
|
|
126
|
-
#openPopup = () => {
|
|
127
|
-
if (!this.open) {
|
|
128
|
-
this.#openedByKeyboard = false;
|
|
129
|
-
_microsoft_fast_element.Updates.enqueue(() => this.open = true);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* @internal
|
|
134
|
-
*/
|
|
135
|
-
#handleAnchorKeydown = (event) => {
|
|
136
|
-
/* v8 ignore next -- @preserve */
|
|
137
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
138
|
-
if (!this.open) {
|
|
139
|
-
this.#openedByKeyboard = true;
|
|
140
|
-
_microsoft_fast_element.Updates.enqueue(() => this.open = true);
|
|
141
|
-
}
|
|
142
|
-
event.preventDefault();
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
51
|
};
|
|
146
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "
|
|
52
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], SelectableBox.prototype, "checked", void 0);
|
|
147
53
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
148
|
-
attribute: "
|
|
149
|
-
mode: "
|
|
150
|
-
|
|
151
|
-
|
|
54
|
+
attribute: "clickable-box",
|
|
55
|
+
mode: "boolean"
|
|
56
|
+
})], SelectableBox.prototype, "clickableBox", void 0);
|
|
57
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], SelectableBox.prototype, "connotation", void 0);
|
|
58
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "control-type" })], SelectableBox.prototype, "controlType", void 0);
|
|
59
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({
|
|
60
|
+
attribute: "control-placement",
|
|
61
|
+
mode: "fromView"
|
|
62
|
+
})], SelectableBox.prototype, "controlPlacement", void 0);
|
|
63
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], SelectableBox.prototype, "tight", void 0);
|
|
64
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], SelectableBox.prototype, "disabled", void 0);
|
|
152
65
|
//#endregion
|
|
153
|
-
//#region src/lib/
|
|
154
|
-
var getClasses = (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
<${
|
|
66
|
+
//#region src/lib/selectable-box/selectable-box.template.ts
|
|
67
|
+
var getClasses = ({ connotation, tight, checked, clickableBox, controlPlacement, disabled }) => (0, _microsoft_fast_web_utilities.classNames)("base", [`connotation-${connotation}`, Boolean(connotation)], ["tight", tight], ["selected", checked], ["clickable", clickableBox], ["readonly", !clickableBox], [`control-placement-${controlPlacement}`, Boolean(controlPlacement)], ["disabled", disabled]);
|
|
68
|
+
function handleControlChange(x) {
|
|
69
|
+
if (!x.clickableBox) x._handleCheckedChange();
|
|
70
|
+
}
|
|
71
|
+
function checkbox(context) {
|
|
72
|
+
const checkboxTag = context.tagFor(require_definition.Checkbox);
|
|
73
|
+
return _microsoft_fast_element.html`${(0, _microsoft_fast_element.when)((x) => x.controlType !== "radio", _microsoft_fast_element.html`
|
|
74
|
+
<${checkboxTag}
|
|
75
|
+
${require_delegates_aria.delegateAria({ ariaLabel: (x) => !x.clickableBox && x.ariaLabel ? x.ariaLabel : null }, { onlySpecified: true })}
|
|
76
|
+
@change="${(x) => handleControlChange(x)}"
|
|
77
|
+
class="control checkbox ${(x) => x.controlPlacement}"
|
|
78
|
+
connotation="${(x) => x.connotation === "cta" ? require_enums.Connotation.CTA : require_enums.Connotation.Accent}"
|
|
79
|
+
:checked="${(x) => x.checked}"
|
|
80
|
+
?disabled="${(x) => x.disabled}"
|
|
81
|
+
inert="${(x) => x.clickableBox ? true : null}"
|
|
82
|
+
></${checkboxTag}>`)} `;
|
|
83
|
+
}
|
|
84
|
+
function radio(context) {
|
|
85
|
+
const radioTag = context.tagFor(require_definition$1.Radio);
|
|
86
|
+
return _microsoft_fast_element.html`${(0, _microsoft_fast_element.when)((x) => x.controlType === "radio", _microsoft_fast_element.html`
|
|
87
|
+
<${radioTag}
|
|
88
|
+
${require_delegates_aria.delegateAria({ ariaLabel: (x) => !x.clickableBox && x.ariaLabel ? x.ariaLabel : null }, { onlySpecified: true })}
|
|
89
|
+
@change="${(x) => handleControlChange(x)}"
|
|
90
|
+
class="control radio ${(x) => x.controlPlacement}"
|
|
91
|
+
connotation="${(x) => x.connotation === "cta" ? require_enums.Connotation.CTA : require_enums.Connotation.Accent}"
|
|
92
|
+
:checked="${(x) => x.checked}"
|
|
93
|
+
?disabled="${(x) => x.disabled}"
|
|
94
|
+
inert="${(x) => x.clickableBox ? true : null}"
|
|
95
|
+
></${radioTag}>`)} `;
|
|
96
|
+
}
|
|
97
|
+
var SelectableBoxTemplate = (context) => {
|
|
98
|
+
return _microsoft_fast_element.html`<template>
|
|
99
|
+
<div
|
|
162
100
|
class="${getClasses}"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
101
|
+
tabindex="${(x) => x.clickableBox && !x.disabled ? "0" : null}"
|
|
102
|
+
${require_delegates_aria.delegateAria({
|
|
103
|
+
role: (x) => x.clickableBox ? "button" : null,
|
|
104
|
+
ariaPressed: (x) => x.clickableBox ? x.checked ? "true" : "false" : null,
|
|
105
|
+
ariaLabel: (x) => x.clickableBox ? x.ariaLabel : null,
|
|
106
|
+
ariaDisabled: (x) => x.clickableBox && x.disabled ? "true" : null
|
|
107
|
+
})}
|
|
108
|
+
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
109
|
+
@click="${(x) => x.clickableBox ? x._handleCheckedChange() : null}"
|
|
171
110
|
>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
aria-label="${(x) => x.locale.simpleColorPicker.colorPaletteLabel}">
|
|
177
|
-
${(0, _microsoft_fast_element.repeat)((x) => x.swatches, (x) => x._renderColorSwatch(iconTag, tooltipTag), { positioning: true })}
|
|
178
|
-
</div>
|
|
179
|
-
</${popupTag}>
|
|
180
|
-
`;
|
|
111
|
+
${checkbox(context)} ${radio(context)}
|
|
112
|
+
<slot></slot>
|
|
113
|
+
</div>
|
|
114
|
+
</template>`;
|
|
181
115
|
};
|
|
182
116
|
//#endregion
|
|
183
|
-
//#region src/lib/
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
117
|
+
//#region src/lib/selectable-box/definition.ts
|
|
118
|
+
/**
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
var selectableBoxDefinition = require_vivid_element.defineVividComponent("selectable-box", SelectableBox, SelectableBoxTemplate, [require_definition.checkboxDefinition, require_definition$1.radioDefinition], {
|
|
122
|
+
styles: selectable_box_default,
|
|
123
|
+
shadowOptions: { delegatesFocus: true }
|
|
124
|
+
});
|
|
189
125
|
/**
|
|
190
|
-
* Registers the
|
|
126
|
+
* Registers the selectable-box element with the design system.
|
|
191
127
|
*
|
|
192
128
|
* @param prefix - the prefix to use for the component name
|
|
193
129
|
*/
|
|
194
|
-
var
|
|
130
|
+
var registerSelectableBox = require_vivid_element.createRegisterFunction(selectableBoxDefinition);
|
|
195
131
|
//#endregion
|
|
196
|
-
Object.defineProperty(exports, "
|
|
132
|
+
Object.defineProperty(exports, "SelectableBox", {
|
|
197
133
|
enumerable: true,
|
|
198
134
|
get: function() {
|
|
199
|
-
return
|
|
135
|
+
return SelectableBox;
|
|
200
136
|
}
|
|
201
137
|
});
|
|
202
|
-
Object.defineProperty(exports, "
|
|
138
|
+
Object.defineProperty(exports, "registerSelectableBox", {
|
|
203
139
|
enumerable: true,
|
|
204
140
|
get: function() {
|
|
205
|
-
return
|
|
141
|
+
return registerSelectableBox;
|
|
206
142
|
}
|
|
207
143
|
});
|
|
208
|
-
Object.defineProperty(exports, "
|
|
144
|
+
Object.defineProperty(exports, "selectableBoxDefinition", {
|
|
209
145
|
enumerable: true,
|
|
210
146
|
get: function() {
|
|
211
|
-
return
|
|
147
|
+
return selectableBoxDefinition;
|
|
212
148
|
}
|
|
213
149
|
});
|
|
@@ -1,195 +1,131 @@
|
|
|
1
1
|
import { o as defineVividComponent, s as createRegisterFunction, t as VividElement } from "./vivid-element.js";
|
|
2
|
-
import { r as Icon, t as iconDefinition } from "./definition2.js";
|
|
3
2
|
import { t as __decorate } from "./decorate.js";
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { Updates, attr, html, nullableNumberConverter, repeat } from "@microsoft/fast-element";
|
|
3
|
+
import { n as delegateAria, t as DelegatesAria } from "./delegates-aria.js";
|
|
4
|
+
import { r as Connotation } from "./enums.js";
|
|
5
|
+
import { r as Checkbox, t as checkboxDefinition } from "./definition23.js";
|
|
6
|
+
import { r as Radio, t as radioDefinition } from "./definition55.js";
|
|
7
|
+
import { attr, html, when } from "@microsoft/fast-element";
|
|
10
8
|
import { classNames } from "@microsoft/fast-web-utilities";
|
|
11
|
-
//#region src/lib/
|
|
12
|
-
var
|
|
9
|
+
//#region src/lib/selectable-box/selectable-box.scss?inline
|
|
10
|
+
var selectable_box_default = ":host{display:flex}.base.connotation-cta{--_connotation-color-firm-all:var(--vvd-selectable-box-cta-firm-all,var(--vvd-color-cta-600));--_connotation-color-pale:var(--vvd-selectable-box-cta-pale,var(--vvd-color-cta-300));--_connotation-color-fierce:var(--vvd-selectable-box-cta-fierce,var(--vvd-color-cta-700));--_connotation-color-faint:var(--vvd-selectable-box-cta-faint,var(--vvd-color-cta-50));--_connotation-color-soft:var(--vvd-selectable-box-cta-soft,var(--vvd-color-cta-100))}.base:not(.connotation-cta){--_connotation-color-firm-all:var(--vvd-selectable-box-accent-firm-all,var(--vvd-color-neutral-600));--_connotation-color-pale:var(--vvd-selectable-box-accent-pale,var(--vvd-color-neutral-300));--_connotation-color-fierce:var(--vvd-selectable-box-accent-fierce,var(--vvd-color-neutral-700));--_connotation-color-faint:var(--vvd-selectable-box-accent-faint,var(--vvd-color-neutral-50));--_connotation-color-soft:var(--vvd-selectable-box-accent-soft,var(--vvd-color-neutral-100))}.base{--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--_connotation-color-pale)}@media (hover:hover){.base:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--_connotation-color-firm-all)}}.base.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--_connotation-color-firm-all)}.base.selected:where(:not(.disabled,:disabled)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:var(--_connotation-color-soft);--_appearance-color-outline:var(--_connotation-color-pale)}@media (hover:hover){.base.selected:hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:var(--_connotation-color-firm-all)}}.base.selected.hover:where(:not(.disabled,:disabled,.readonly)){--_appearance-color-text:var(--_connotation-color-firm-all);--_appearance-color-fill:var(--_connotation-color-faint);--_appearance-color-outline:var(--_connotation-color-firm-all)}.base:disabled,.base.disabled{--_appearance-color-text:var(--vvd-color-neutral-300);--_appearance-color-fill:transparent;--_appearance-color-outline:var(--vvd-color-neutral-100)}.base{--control-offset:calc(var(--selectable-box-spacing,16px) + 36px);padding:var(--selectable-box-spacing,16px);border:1px solid var(--_appearance-color-outline);background-color:var(--_appearance-color-fill);text-align:start;border-radius:8px;inline-size:100%;position:relative}.base.control-placement-end-stacked,.base.control-placement-start-stacked{padding-block-start:var(--control-offset)}.base.control-placement-start{padding-inline-start:var(--control-offset)}.base.control-placement-end{padding-inline-end:var(--control-offset)}.base:focus-visible{--focus-stroke-gap-color:transparent;box-shadow:0 0 0 4px color-mix(in srgb, var(--focus-stroke-color,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))}.base.tight{min-height:calc(var(--selectable-box-spacing,16px) * 2 + 22px);padding:0;overflow:hidden}.base.selected{background-color:var(--selectable-box-checked-bg,var(--_appearance-color-fill))}.base.clickable{cursor:pointer}.control{position:absolute;inset-block-start:var(--selectable-box-spacing,16px)}.control.start-stacked,.control.start{inset-inline-start:var(--selectable-box-spacing,16px)}.control.end-stacked,.control.end{inset-inline-end:var(--selectable-box-spacing,16px)}";
|
|
13
11
|
//#endregion
|
|
14
|
-
//#region src/lib/
|
|
12
|
+
//#region src/lib/selectable-box/selectable-box.ts
|
|
15
13
|
/**
|
|
16
14
|
* @public
|
|
17
|
-
* @component
|
|
18
|
-
* @slot
|
|
19
|
-
* @event {CustomEvent<undefined>} change -
|
|
20
|
-
* @
|
|
15
|
+
* @component selectable-box
|
|
16
|
+
* @slot default - Slot for box's content.
|
|
17
|
+
* @event {CustomEvent<undefined>} change - Fired when the checked state changes
|
|
18
|
+
* @testAction check check #control
|
|
19
|
+
* @testAction uncheck uncheck #control
|
|
20
|
+
* @testQuery checked checked true
|
|
21
|
+
* @testQuery unchecked checked false
|
|
22
|
+
* @testRef control nestedShadow [data-vvd-component].control div.control
|
|
21
23
|
*/
|
|
22
|
-
var
|
|
24
|
+
var SelectableBox = class extends DelegatesAria(VividElement) {
|
|
23
25
|
constructor(..._args) {
|
|
24
26
|
super(..._args);
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/* v8 ignore else -- @preserve */
|
|
31
|
-
if (clickedOutside || clickedOnAnchor) this.open = false;
|
|
32
|
-
};
|
|
33
|
-
this._closeOnEscape = (e) => {
|
|
34
|
-
/* v8 ignore else -- @preserve */
|
|
35
|
-
if (e.key === "Escape") this.open = false;
|
|
36
|
-
};
|
|
27
|
+
this.checked = false;
|
|
28
|
+
this.clickableBox = false;
|
|
29
|
+
this.controlPlacement = "end-stacked";
|
|
30
|
+
this.tight = false;
|
|
31
|
+
this.disabled = false;
|
|
37
32
|
}
|
|
38
33
|
/**
|
|
39
34
|
* @internal
|
|
40
35
|
*/
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
if (this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (this.#openedByKeyboard) {
|
|
47
|
-
const selectedIndex = this.swatches.findIndex((swatch) => swatch.value === this.value);
|
|
48
|
-
const targetIndex = selectedIndex >= 0 ? selectedIndex : 0;
|
|
49
|
-
this._focusSwatchByIndex(targetIndex);
|
|
50
|
-
}
|
|
51
|
-
this.#openedByKeyboard = false;
|
|
52
|
-
});
|
|
36
|
+
_handleCheckedChange() {
|
|
37
|
+
if (this.disabled) return;
|
|
38
|
+
if (this.controlType === "radio" && this.checked) return;
|
|
39
|
+
this.checked = !this.checked;
|
|
40
|
+
if (this.clickableBox) this.$emit("change");
|
|
53
41
|
}
|
|
54
42
|
/**
|
|
55
43
|
* @internal
|
|
56
44
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
super.connectedCallback();
|
|
62
|
-
this._updateListeners();
|
|
63
|
-
}
|
|
64
|
-
disconnectedCallback() {
|
|
65
|
-
super.disconnectedCallback();
|
|
66
|
-
this._updateListeners();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
_updateListeners() {
|
|
72
|
-
document.removeEventListener("click", this._closeOnClickOutside);
|
|
73
|
-
document.removeEventListener("keydown", this._closeOnEscape);
|
|
74
|
-
if (this.open && this.isConnected) {
|
|
75
|
-
document.addEventListener("click", this._closeOnClickOutside);
|
|
76
|
-
document.addEventListener("keydown", this._closeOnEscape);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @internal
|
|
81
|
-
*/
|
|
82
|
-
_getFocusReturnEl() {
|
|
83
|
-
return this._anchorEl ?? null;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
_anchorElChanged(oldValue, newValue) {
|
|
89
|
-
if (oldValue) this.#cleanupAnchor(oldValue);
|
|
90
|
-
if (newValue) this.#setupAnchor(newValue);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
#updateAnchor(a) {
|
|
96
|
-
a.setAttribute("aria-expanded", this.open.toString());
|
|
97
|
-
a.setAttribute("data-expanded", this.open.toString());
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* @internal
|
|
101
|
-
*/
|
|
102
|
-
#setupAnchor(a) {
|
|
103
|
-
this.#updateAnchor(a);
|
|
104
|
-
a.addEventListener("click", this.#openPopup, true);
|
|
105
|
-
a.addEventListener("keydown", this.#handleAnchorKeydown);
|
|
106
|
-
a.setAttribute("aria-haspopup", "true");
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* @internal
|
|
110
|
-
*/
|
|
111
|
-
#cleanupAnchor(a) {
|
|
112
|
-
a.removeEventListener("click", this.#openPopup, true);
|
|
113
|
-
a.removeEventListener("keydown", this.#handleAnchorKeydown);
|
|
114
|
-
a.removeAttribute("aria-expanded");
|
|
115
|
-
a.removeAttribute("data-expanded");
|
|
116
|
-
a.removeAttribute("aria-haspopup");
|
|
45
|
+
_handleKeydown(event) {
|
|
46
|
+
if (this.disabled) return true;
|
|
47
|
+
if ((event.code === "Space" || event.code === "Enter") && this.clickableBox) return this._handleCheckedChange();
|
|
48
|
+
return true;
|
|
117
49
|
}
|
|
118
|
-
/**
|
|
119
|
-
* @internal
|
|
120
|
-
*/
|
|
121
|
-
#openedByKeyboard = false;
|
|
122
|
-
/**
|
|
123
|
-
* @internal
|
|
124
|
-
*/
|
|
125
|
-
#openPopup = () => {
|
|
126
|
-
if (!this.open) {
|
|
127
|
-
this.#openedByKeyboard = false;
|
|
128
|
-
Updates.enqueue(() => this.open = true);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* @internal
|
|
133
|
-
*/
|
|
134
|
-
#handleAnchorKeydown = (event) => {
|
|
135
|
-
/* v8 ignore next -- @preserve */
|
|
136
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
137
|
-
if (!this.open) {
|
|
138
|
-
this.#openedByKeyboard = true;
|
|
139
|
-
Updates.enqueue(() => this.open = true);
|
|
140
|
-
}
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
50
|
};
|
|
145
|
-
__decorate([attr({ mode: "
|
|
51
|
+
__decorate([attr({ mode: "boolean" })], SelectableBox.prototype, "checked", void 0);
|
|
52
|
+
__decorate([attr({
|
|
53
|
+
attribute: "clickable-box",
|
|
54
|
+
mode: "boolean"
|
|
55
|
+
})], SelectableBox.prototype, "clickableBox", void 0);
|
|
56
|
+
__decorate([attr], SelectableBox.prototype, "connotation", void 0);
|
|
57
|
+
__decorate([attr({ attribute: "control-type" })], SelectableBox.prototype, "controlType", void 0);
|
|
146
58
|
__decorate([attr({
|
|
147
|
-
attribute: "
|
|
148
|
-
mode: "fromView"
|
|
149
|
-
|
|
150
|
-
})],
|
|
59
|
+
attribute: "control-placement",
|
|
60
|
+
mode: "fromView"
|
|
61
|
+
})], SelectableBox.prototype, "controlPlacement", void 0);
|
|
62
|
+
__decorate([attr({ mode: "boolean" })], SelectableBox.prototype, "tight", void 0);
|
|
63
|
+
__decorate([attr({ mode: "boolean" })], SelectableBox.prototype, "disabled", void 0);
|
|
151
64
|
//#endregion
|
|
152
|
-
//#region src/lib/
|
|
153
|
-
var getClasses = (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<${
|
|
65
|
+
//#region src/lib/selectable-box/selectable-box.template.ts
|
|
66
|
+
var getClasses = ({ connotation, tight, checked, clickableBox, controlPlacement, disabled }) => classNames("base", [`connotation-${connotation}`, Boolean(connotation)], ["tight", tight], ["selected", checked], ["clickable", clickableBox], ["readonly", !clickableBox], [`control-placement-${controlPlacement}`, Boolean(controlPlacement)], ["disabled", disabled]);
|
|
67
|
+
function handleControlChange(x) {
|
|
68
|
+
if (!x.clickableBox) x._handleCheckedChange();
|
|
69
|
+
}
|
|
70
|
+
function checkbox(context) {
|
|
71
|
+
const checkboxTag = context.tagFor(Checkbox);
|
|
72
|
+
return html`${when((x) => x.controlType !== "radio", html`
|
|
73
|
+
<${checkboxTag}
|
|
74
|
+
${delegateAria({ ariaLabel: (x) => !x.clickableBox && x.ariaLabel ? x.ariaLabel : null }, { onlySpecified: true })}
|
|
75
|
+
@change="${(x) => handleControlChange(x)}"
|
|
76
|
+
class="control checkbox ${(x) => x.controlPlacement}"
|
|
77
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
78
|
+
:checked="${(x) => x.checked}"
|
|
79
|
+
?disabled="${(x) => x.disabled}"
|
|
80
|
+
inert="${(x) => x.clickableBox ? true : null}"
|
|
81
|
+
></${checkboxTag}>`)} `;
|
|
82
|
+
}
|
|
83
|
+
function radio(context) {
|
|
84
|
+
const radioTag = context.tagFor(Radio);
|
|
85
|
+
return html`${when((x) => x.controlType === "radio", html`
|
|
86
|
+
<${radioTag}
|
|
87
|
+
${delegateAria({ ariaLabel: (x) => !x.clickableBox && x.ariaLabel ? x.ariaLabel : null }, { onlySpecified: true })}
|
|
88
|
+
@change="${(x) => handleControlChange(x)}"
|
|
89
|
+
class="control radio ${(x) => x.controlPlacement}"
|
|
90
|
+
connotation="${(x) => x.connotation === "cta" ? Connotation.CTA : Connotation.Accent}"
|
|
91
|
+
:checked="${(x) => x.checked}"
|
|
92
|
+
?disabled="${(x) => x.disabled}"
|
|
93
|
+
inert="${(x) => x.clickableBox ? true : null}"
|
|
94
|
+
></${radioTag}>`)} `;
|
|
95
|
+
}
|
|
96
|
+
var SelectableBoxTemplate = (context) => {
|
|
97
|
+
return html`<template>
|
|
98
|
+
<div
|
|
161
99
|
class="${getClasses}"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
100
|
+
tabindex="${(x) => x.clickableBox && !x.disabled ? "0" : null}"
|
|
101
|
+
${delegateAria({
|
|
102
|
+
role: (x) => x.clickableBox ? "button" : null,
|
|
103
|
+
ariaPressed: (x) => x.clickableBox ? x.checked ? "true" : "false" : null,
|
|
104
|
+
ariaLabel: (x) => x.clickableBox ? x.ariaLabel : null,
|
|
105
|
+
ariaDisabled: (x) => x.clickableBox && x.disabled ? "true" : null
|
|
106
|
+
})}
|
|
107
|
+
@keydown="${(x, c) => x._handleKeydown(c.event)}"
|
|
108
|
+
@click="${(x) => x.clickableBox ? x._handleCheckedChange() : null}"
|
|
170
109
|
>
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
aria-label="${(x) => x.locale.simpleColorPicker.colorPaletteLabel}">
|
|
176
|
-
${repeat((x) => x.swatches, (x) => x._renderColorSwatch(iconTag, tooltipTag), { positioning: true })}
|
|
177
|
-
</div>
|
|
178
|
-
</${popupTag}>
|
|
179
|
-
`;
|
|
110
|
+
${checkbox(context)} ${radio(context)}
|
|
111
|
+
<slot></slot>
|
|
112
|
+
</div>
|
|
113
|
+
</template>`;
|
|
180
114
|
};
|
|
181
115
|
//#endregion
|
|
182
|
-
//#region src/lib/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
116
|
+
//#region src/lib/selectable-box/definition.ts
|
|
117
|
+
/**
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
var selectableBoxDefinition = defineVividComponent("selectable-box", SelectableBox, SelectableBoxTemplate, [checkboxDefinition, radioDefinition], {
|
|
121
|
+
styles: selectable_box_default,
|
|
122
|
+
shadowOptions: { delegatesFocus: true }
|
|
123
|
+
});
|
|
188
124
|
/**
|
|
189
|
-
* Registers the
|
|
125
|
+
* Registers the selectable-box element with the design system.
|
|
190
126
|
*
|
|
191
127
|
* @param prefix - the prefix to use for the component name
|
|
192
128
|
*/
|
|
193
|
-
var
|
|
129
|
+
var registerSelectableBox = createRegisterFunction(selectableBoxDefinition);
|
|
194
130
|
//#endregion
|
|
195
|
-
export {
|
|
131
|
+
export { selectableBoxDefinition as n, SelectableBox as r, registerSelectableBox as t };
|