@vonage/vivid 5.23.1 → 5.24.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/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/audio-player/index.cjs +2 -2
- package/audio-player/index.js +3 -3
- package/badge/index.cjs +1 -1
- package/badge/index.js +1 -1
- package/bundled/definition15.cjs +8 -7
- package/bundled/definition15.js +26 -24
- package/bundled/definition17.cjs +2 -2
- package/bundled/definition17.js +2 -2
- package/bundled/definition18.cjs +12 -83
- package/bundled/definition18.js +35 -419
- package/bundled/definition19.cjs +87 -7
- package/bundled/definition19.js +432 -16
- package/bundled/definition20.cjs +7 -37
- package/bundled/definition20.js +17 -172
- package/bundled/definition21.cjs +35 -27
- package/bundled/definition21.js +154 -154
- package/bundled/definition22.cjs +29 -6
- package/bundled/definition22.js +172 -20
- package/bundled/definition23.cjs +6 -12
- package/bundled/definition23.js +17 -32
- package/bundled/definition24.cjs +12 -39
- package/bundled/definition24.js +32 -67
- package/bundled/definition25.cjs +44 -0
- package/bundled/definition25.js +77 -0
- package/bundled/extractOptions.cjs +1 -0
- package/bundled/extractOptions.js +11 -0
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +24 -11
- package/bundled/render-in-light-dom.cjs +1 -1
- package/bundled/render-in-light-dom.js +16 -19
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +9 -1
- package/combobox/definition.cjs +1 -1
- package/combobox/definition.js +1 -1
- package/combobox/index.cjs +7 -7
- package/combobox/index.js +29 -21
- package/country/definition.cjs +1 -1
- package/country/definition.js +1 -1
- package/country/index.cjs +1 -1
- package/country/index.js +1 -1
- package/country-group/definition.cjs +1 -1
- package/country-group/definition.js +1 -1
- package/country-group/index.cjs +1 -1
- package/country-group/index.js +2 -2
- package/custom-elements.json +3102 -2842
- package/data-grid/definition.cjs +1 -1
- package/data-grid/definition.js +1 -1
- package/data-grid/index.cjs +4 -4
- package/data-grid/index.js +5 -5
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dial-pad/definition.cjs +1 -1
- package/dial-pad/definition.js +1 -1
- package/dial-pad/index.cjs +24 -24
- package/dial-pad/index.js +120 -51
- package/dialog/definition.cjs +1 -1
- package/dialog/definition.js +1 -1
- package/divider/definition.cjs +1 -1
- package/divider/definition.js +1 -1
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/empty-state/definition.cjs +1 -1
- package/empty-state/definition.js +1 -1
- package/fab/definition.cjs +1 -1
- package/fab/definition.js +1 -1
- package/file-picker/definition.cjs +1 -1
- package/file-picker/definition.js +1 -1
- package/flag/definition.cjs +1 -1
- package/flag/definition.js +1 -1
- package/header/definition.cjs +1 -1
- package/header/definition.js +1 -1
- package/header/index.cjs +3 -3
- package/header/index.js +3 -3
- package/index.cjs +200 -196
- package/index.js +53 -52
- package/kbd-key/definition.cjs +1 -1
- package/kbd-key/definition.js +1 -1
- package/kbd-shortcut/definition.cjs +1 -1
- package/kbd-shortcut/definition.js +1 -1
- package/layout/definition.cjs +1 -1
- package/layout/definition.js +1 -1
- package/lib/accordion-item/accordion-item.d.ts +2 -1
- package/lib/action-group/action-group.d.ts +1 -1
- package/lib/alert/alert.d.ts +2 -2
- package/lib/audio-player/audio-player.d.ts +1 -1
- package/lib/avatar/avatar.d.ts +1 -1
- package/lib/badge/badge.d.ts +1 -1
- package/lib/banner/banner.d.ts +3 -3
- package/lib/breadcrumb/breadcrumb.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/button/button.d.ts +3 -3
- package/lib/calendar-event/calendar-event.d.ts +1 -1
- package/lib/card/card.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +6 -6
- package/lib/color-picker/color-picker.d.ts +7 -7
- package/lib/combobox/combobox.d.ts +7 -7
- package/lib/components.d.ts +1 -0
- package/lib/country-group/country-group.d.ts +2 -2
- package/lib/data-grid/data-grid-cell.d.ts +4 -3
- package/lib/data-grid/data-grid-row.d.ts +3 -2
- package/lib/data-grid/data-grid.options.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +8 -8
- package/lib/date-range-picker/date-range-picker.d.ts +4 -4
- package/lib/date-time-picker/date-time-picker.d.ts +8 -8
- package/lib/dial-pad/dial-pad.d.ts +2 -1
- package/lib/dialog/dialog.d.ts +2 -2
- package/lib/divider/divider.d.ts +1 -1
- package/lib/fab/fab.d.ts +1 -1
- package/lib/file-picker/file-picker.d.ts +7 -7
- package/lib/header/header.d.ts +1 -1
- package/lib/menu/menu.d.ts +2 -2
- package/lib/menu-item/menu-item.d.ts +3 -3
- package/lib/nav/nav.d.ts +1 -1
- package/lib/nav-disclosure/nav-disclosure.d.ts +2 -2
- package/lib/nav-item/nav-item.d.ts +2 -2
- package/lib/note/note.d.ts +1 -1
- package/lib/number-field/number-field.d.ts +9 -9
- package/lib/optgroup/definition.d.ts +3 -0
- package/lib/optgroup/index.d.ts +1 -0
- package/lib/optgroup/optgroup.d.ts +430 -0
- package/lib/optgroup/optgroup.template.d.ts +2 -0
- package/lib/optgroup/variations.browser-spec.d.ts +1 -0
- package/lib/option/option.d.ts +2 -2
- package/lib/pagination/pagination.d.ts +1 -1
- package/lib/popover/popover.d.ts +2 -2
- package/lib/progress/progress.d.ts +1 -1
- package/lib/progress-ring/progress-ring.d.ts +1 -1
- package/lib/radio/radio.d.ts +3 -3
- package/lib/radio-group/radio-group.d.ts +1 -1
- package/lib/range-slider/range-slider.d.ts +3 -3
- package/lib/rich-text-editor/rich-text-editor.d.ts +1 -1
- package/lib/searchable-select/option-tag.d.ts +1 -1
- package/lib/searchable-select/searchable-select.d.ts +47 -47
- package/lib/select/select.d.ts +9 -9
- package/lib/selectable-box/selectable-box.d.ts +1 -1
- package/lib/simple-color-picker/simple-color-picker.d.ts +2 -2
- package/lib/slider/slider.d.ts +3 -3
- package/lib/split-button/split-button.d.ts +3 -3
- package/lib/status/status.d.ts +1 -1
- package/lib/switch/switch.d.ts +2 -2
- package/lib/tab/tab.d.ts +3 -3
- package/lib/tab-panel/tab-panel.d.ts +1 -1
- package/lib/table/table-cell.d.ts +1 -1
- package/lib/table/table-header-cell.d.ts +1 -1
- package/lib/table/table-row.d.ts +1 -1
- package/lib/table/table-sorting-button.d.ts +1 -1
- package/lib/tag/tag.d.ts +3 -3
- package/lib/tag-group/tag-group.d.ts +1 -1
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-area/text-area.d.ts +8 -8
- package/lib/text-field/text-field.d.ts +9 -9
- package/lib/time-picker/time-picker.d.ts +4 -4
- package/lib/toggletip/toggletip.d.ts +2 -2
- package/lib/tooltip/tooltip.d.ts +2 -2
- package/lib/tree-item/tree-item.d.ts +2 -2
- package/lib/tree-view/tree-view.d.ts +1 -1
- package/lib/video-player/video-player.d.ts +1 -1
- package/menu/index.cjs +1 -1
- package/menu/index.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 +1 -1
- package/nav-disclosure/definition.js +1 -1
- package/nav-item/definition.cjs +1 -1
- package/nav-item/definition.js +1 -1
- package/note/definition.cjs +1 -1
- package/note/definition.js +1 -1
- package/number-field/definition.cjs +1 -1
- package/number-field/definition.js +1 -1
- package/number-field/index.cjs +1 -1
- package/number-field/index.js +1 -1
- package/optgroup/definition.cjs +5 -0
- package/optgroup/definition.js +2 -0
- package/optgroup/index.cjs +1 -0
- package/optgroup/index.js +4 -0
- package/package.json +6 -6
- package/pagination/definition.cjs +1 -1
- package/pagination/definition.js +1 -1
- package/platform-switch/definition.cjs +1 -1
- package/platform-switch/definition.js +1 -1
- package/popover/definition.cjs +1 -1
- package/popover/definition.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 +1 -1
- package/radio-group/definition.js +1 -1
- package/range-slider/definition.cjs +1 -1
- package/range-slider/definition.js +1 -1
- package/rich-text-editor/definition.cjs +1 -1
- package/rich-text-editor/definition.js +1 -1
- package/rich-text-editor/index.cjs +1 -1
- package/rich-text-editor/index.js +4 -4
- package/rich-text-view/definition.cjs +1 -1
- package/rich-text-view/definition.js +1 -1
- package/searchable-select/definition.cjs +1 -1
- package/searchable-select/definition.js +1 -1
- package/searchable-select/index.cjs +19 -19
- package/searchable-select/index.js +60 -45
- package/select/definition.cjs +1 -1
- package/select/definition.js +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/definition.cjs +1 -1
- package/selectable-box/definition.js +1 -1
- package/shared/aria/delegates-aria.d.ts +1 -1
- package/shared/aria/host-semantics.d.ts +1 -1
- package/shared/color-picker/base-color-picker.d.ts +1 -1
- package/shared/feedback/feedback-message.d.ts +1 -1
- package/shared/feedback/mixins.d.ts +2 -2
- package/shared/foundation/button/button.d.ts +2 -2
- package/shared/foundation/form-associated/form-associated.d.ts +2 -2
- package/shared/foundation/listbox/extractOptions.d.ts +2 -0
- package/shared/foundation/listbox/listbox.d.ts +2 -0
- package/shared/patterns/affix.d.ts +2 -2
- package/shared/patterns/anchored.d.ts +2 -2
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/form-elements/form-element.d.ts +1 -1
- package/shared/patterns/form-elements/with-contextual-help.d.ts +1 -1
- package/shared/patterns/form-elements/with-error-text.d.ts +1 -1
- package/shared/patterns/form-elements/with-success-text.d.ts +1 -1
- package/shared/patterns/kbd-shortcut.d.ts +1 -1
- package/shared/patterns/linkable.d.ts +1 -1
- package/shared/patterns/localized.d.ts +2 -2
- package/shared/patterns/trapped-focus.d.ts +1 -1
- package/shared/picker-field/mixins/calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +2 -2
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +1 -1
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-date-picker.d.ts +2 -2
- package/shared/picker-field/mixins/single-value-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.d.ts +2 -2
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +4 -4
- package/shared/picker-field/picker-field.d.ts +7 -7
- package/side-drawer/definition.cjs +1 -1
- package/side-drawer/definition.js +1 -1
- package/simple-color-picker/definition.cjs +1 -1
- package/simple-color-picker/definition.js +1 -1
- package/split-button/definition.cjs +1 -1
- package/split-button/definition.js +1 -1
- package/split-button/index.cjs +1 -0
- package/split-button/index.js +1 -0
- package/status/definition.cjs +1 -1
- package/status/definition.js +1 -1
- package/switch/definition.cjs +1 -1
- package/switch/definition.js +1 -1
- package/switch/index.cjs +6 -5
- package/switch/index.js +16 -14
- package/tab/definition.cjs +1 -1
- package/tab/definition.js +1 -1
- package/tab-panel/definition.cjs +1 -1
- package/tab-panel/definition.js +1 -1
- package/table/definition.cjs +1 -1
- package/table/definition.js +1 -1
- package/tabs/definition.cjs +1 -1
- package/tabs/definition.js +1 -1
- package/tag/definition.cjs +1 -1
- package/tag/definition.js +1 -1
- package/tag-group/definition.cjs +1 -1
- package/tag-group/definition.js +1 -1
- package/text-area/definition.cjs +1 -1
- package/text-area/definition.js +1 -1
- package/time-picker/definition.cjs +1 -1
- package/time-picker/definition.js +1 -1
- package/tree-item/definition.cjs +1 -1
- package/tree-item/definition.js +1 -1
- package/tree-view/definition.cjs +1 -1
- package/tree-view/definition.js +1 -1
- package/unbundled/definition13.cjs +1 -1
- package/unbundled/definition13.js +1 -1
- package/unbundled/definition2.cjs +9 -3
- package/unbundled/definition2.js +9 -3
- package/unbundled/definition23.cjs +1 -0
- package/unbundled/definition23.js +2 -1
- package/unbundled/definition29.cjs +2 -2
- package/unbundled/definition29.js +2 -2
- package/unbundled/definition30.cjs +65 -484
- package/unbundled/definition30.js +57 -482
- package/unbundled/definition31.cjs +501 -39
- package/unbundled/definition31.js +499 -37
- package/unbundled/definition32.cjs +38 -239
- package/unbundled/definition32.js +35 -236
- package/unbundled/definition33.cjs +236 -74
- package/unbundled/definition33.js +233 -71
- package/unbundled/definition34.cjs +74 -1968
- package/unbundled/definition34.js +70 -1940
- package/unbundled/definition35.cjs +1992 -26
- package/unbundled/definition35.js +1964 -27
- package/unbundled/definition36.cjs +26 -111
- package/unbundled/definition36.js +23 -103
- package/unbundled/definition37.cjs +53 -294
- package/unbundled/definition37.js +50 -291
- package/unbundled/definition38.cjs +282 -132
- package/unbundled/definition38.js +279 -129
- package/unbundled/definition39.cjs +165 -339
- package/unbundled/definition39.js +163 -337
- package/unbundled/definition40.cjs +394 -228
- package/unbundled/definition40.js +391 -225
- package/unbundled/definition41.cjs +263 -46
- package/unbundled/definition41.js +258 -41
- package/unbundled/definition42.cjs +47 -67
- package/unbundled/definition42.js +45 -65
- package/unbundled/definition43.cjs +56 -383
- package/unbundled/definition43.js +55 -382
- package/unbundled/definition44.cjs +386 -44
- package/unbundled/definition44.js +382 -40
- package/unbundled/definition45.cjs +53 -45
- package/unbundled/definition45.js +49 -41
- package/unbundled/definition46.cjs +40 -164
- package/unbundled/definition46.js +36 -160
- package/unbundled/definition47.cjs +171 -31
- package/unbundled/definition47.js +168 -22
- package/unbundled/definition48.cjs +30 -89
- package/unbundled/definition48.js +22 -87
- package/unbundled/definition49.cjs +70 -33
- package/unbundled/definition49.js +67 -30
- package/unbundled/definition50.cjs +54 -23
- package/unbundled/definition50.js +52 -18
- package/unbundled/definition51.cjs +23 -39
- package/unbundled/definition51.js +17 -36
- package/unbundled/definition52.cjs +29 -314
- package/unbundled/definition52.js +27 -312
- package/unbundled/definition53.cjs +301 -195
- package/unbundled/definition53.js +297 -191
- package/unbundled/definition54.cjs +210 -40
- package/unbundled/definition54.js +206 -36
- package/unbundled/definition55.cjs +42 -266
- package/unbundled/definition55.js +38 -262
- package/unbundled/definition56.cjs +266 -50
- package/unbundled/definition56.js +263 -46
- package/unbundled/definition57.cjs +48 -146
- package/unbundled/definition57.js +47 -143
- package/unbundled/definition58.cjs +127 -225
- package/unbundled/definition58.js +122 -223
- package/unbundled/definition59.cjs +199 -418
- package/unbundled/definition59.js +196 -415
- package/unbundled/definition60.cjs +441 -3738
- package/unbundled/definition60.js +431 -3565
- package/unbundled/definition61.cjs +3712 -728
- package/unbundled/definition61.js +3538 -717
- package/unbundled/definition62.cjs +769 -97
- package/unbundled/definition62.js +766 -94
- package/unbundled/definition63.cjs +100 -981
- package/unbundled/definition63.js +98 -976
- package/unbundled/definition64.cjs +988 -93
- package/unbundled/definition64.js +982 -90
- package/unbundled/definition65.cjs +109 -73
- package/unbundled/definition65.js +105 -63
- package/unbundled/definition66.cjs +69 -155
- package/unbundled/definition66.js +60 -152
- package/unbundled/definition67.cjs +154 -118
- package/unbundled/definition67.js +151 -115
- package/unbundled/definition68.cjs +124 -49
- package/unbundled/definition68.js +120 -45
- package/unbundled/definition69.cjs +51 -84
- package/unbundled/definition69.js +50 -80
- package/unbundled/definition70.cjs +91 -19
- package/unbundled/definition70.js +86 -14
- package/unbundled/definition71.cjs +20 -87
- package/unbundled/definition71.js +14 -84
- package/unbundled/definition72.cjs +76 -294
- package/unbundled/definition72.js +71 -217
- package/unbundled/definition73.cjs +288 -311
- package/unbundled/definition73.js +218 -306
- package/unbundled/definition74.cjs +326 -26
- package/unbundled/definition74.js +317 -23
- package/unbundled/definition75.cjs +27 -122
- package/unbundled/definition75.js +22 -118
- package/unbundled/definition76.cjs +103 -232
- package/unbundled/definition76.js +99 -228
- package/unbundled/definition77.cjs +259 -26
- package/unbundled/definition77.js +249 -23
- package/unbundled/definition78.cjs +29 -148
- package/unbundled/definition78.js +27 -133
- package/unbundled/definition79.cjs +117 -173
- package/unbundled/definition79.js +108 -169
- package/unbundled/definition80.cjs +181 -477
- package/unbundled/definition80.js +176 -471
- package/unbundled/definition81.cjs +517 -0
- package/unbundled/definition81.js +497 -0
- package/unbundled/extractOptions.cjs +21 -0
- package/unbundled/extractOptions.js +16 -0
- package/unbundled/listbox.cjs +23 -6
- package/unbundled/listbox.js +23 -6
- package/unbundled/vivid-element.cjs +10 -1
- package/unbundled/vivid-element.js +10 -1
- package/video-player/definition.cjs +1 -1
- package/video-player/definition.js +1 -1
- package/vivid.api.json +194 -0
|
@@ -1,277 +1,76 @@
|
|
|
1
1
|
require("./chunk.cjs");
|
|
2
2
|
const require_vivid_element = require("./vivid-element.cjs");
|
|
3
|
+
const require_definition = require("./definition.cjs");
|
|
3
4
|
const require_decorate = require("./decorate.cjs");
|
|
4
|
-
const require_delegates_aria = require("./delegates-aria.cjs");
|
|
5
|
-
const require_localized = require("./localized.cjs");
|
|
6
|
-
const require_definition = require("./definition9.cjs");
|
|
7
|
-
const require_definition$1 = require("./definition15.cjs");
|
|
8
|
-
const require_definition$2 = require("./definition31.cjs");
|
|
9
5
|
const require_utils = require("./utils.cjs");
|
|
10
6
|
let _microsoft_fast_element = require("@microsoft/fast-element");
|
|
11
|
-
//#region src/lib/country
|
|
12
|
-
var
|
|
7
|
+
//#region src/lib/country/country.scss?inline
|
|
8
|
+
var country_default = ":host{display:inline-flex}.base{align-items:center;column-gap:8px;display:inline-flex}.icon{align-items:center;display:inline-flex}.icon [data-vvd-component=icon]{block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16));flex-shrink:0;inline-size:auto}.icon ::slotted(*){block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16));object-fit:contain;border-radius:2px;inline-size:auto;display:block}.text{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}";
|
|
13
9
|
//#endregion
|
|
14
|
-
//#region src/lib/country
|
|
15
|
-
var FULLY_VISIBLE_INTERSECTION_RATIO = .99;
|
|
10
|
+
//#region src/lib/country/country.ts
|
|
16
11
|
/**
|
|
17
12
|
* @public
|
|
18
|
-
* @component country
|
|
19
|
-
* @slot
|
|
13
|
+
* @component country
|
|
14
|
+
* @slot icon - Optional custom flag or graphic. When `code` is set and no content is slotted, a default flag icon (Vivid/Vonage icon set) is shown.
|
|
20
15
|
*/
|
|
21
|
-
var
|
|
22
|
-
constructor(..._args) {
|
|
23
|
-
super(..._args);
|
|
24
|
-
this.items = [];
|
|
25
|
-
this.lastVisibleIndex = 0;
|
|
26
|
-
this.computedAriaLabel = null;
|
|
27
|
-
this.popupOpen = false;
|
|
28
|
-
this.#observer = null;
|
|
29
|
-
this.#visibleMap = /* @__PURE__ */ new Map();
|
|
30
|
-
this.#candidateVisible = -1;
|
|
31
|
-
this.#candidateStreak = 0;
|
|
32
|
-
this.#onSlotChange = () => {
|
|
33
|
-
this.#syncFromSlot();
|
|
34
|
-
this.#updateAriaLabel();
|
|
35
|
-
this.#requestFit();
|
|
36
|
-
};
|
|
37
|
-
this.#handleIntersection = (entries) => {
|
|
38
|
-
for (const entry of entries) this.#visibleMap.set(entry.target, (entry.intersectionRatio ?? 0) >= FULLY_VISIBLE_INTERSECTION_RATIO);
|
|
39
|
-
this.#requestFit();
|
|
40
|
-
let firstHidden = -1;
|
|
41
|
-
for (let i = 0; i < this.items.length; i++) if (!(this.#visibleMap.get(this.items[i]) ?? true)) {
|
|
42
|
-
firstHidden = i;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
let nextVisible = firstHidden === -1 ? this.items.length : firstHidden;
|
|
46
|
-
if (firstHidden === this.items.length - 1 && this.badgeEl && (this.#visibleMap.get(this.badgeEl) ?? false)) nextVisible = this.items.length;
|
|
47
|
-
if (nextVisible < this.items.length && this.badgeEl && this.#visibleMap.has(this.badgeEl) && this.#visibleMap.get(this.badgeEl) === false) nextVisible = Math.max(1, nextVisible - 1);
|
|
48
|
-
this.#proposeVisibleCount(nextVisible);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
get overflowCount() {
|
|
52
|
-
return Math.max(0, this.items.length - this.lastVisibleIndex);
|
|
53
|
-
}
|
|
54
|
-
#observer;
|
|
55
|
-
#visibleMap;
|
|
56
|
-
#candidateVisible;
|
|
57
|
-
#candidateStreak;
|
|
58
|
-
#countryNameForCode(code) {
|
|
59
|
-
if (!code) return "";
|
|
60
|
-
return require_utils.countries.find((c) => c.code.toUpperCase() === code.toUpperCase())?.label ?? "";
|
|
61
|
-
}
|
|
62
|
-
#applyLayout(visibleCount, mode) {
|
|
63
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
64
|
-
const el = this.items[i];
|
|
65
|
-
el.style.order = `${i < visibleCount ? i : i + 1}`;
|
|
66
|
-
if (i < visibleCount) {
|
|
67
|
-
el.setAttribute("data-visible", "true");
|
|
68
|
-
el.style.display = "";
|
|
69
|
-
el.style.position = "";
|
|
70
|
-
el.style.inset = "";
|
|
71
|
-
el.style.visibility = "";
|
|
72
|
-
el.style.pointerEvents = "";
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
el.setAttribute("data-visible", "false");
|
|
76
|
-
el.style.display = "";
|
|
77
|
-
el.style.pointerEvents = "none";
|
|
78
|
-
if (mode === "final") {
|
|
79
|
-
el.style.position = "absolute";
|
|
80
|
-
el.style.inset = "0 auto auto 0";
|
|
81
|
-
el.style.visibility = "hidden";
|
|
82
|
-
} else {
|
|
83
|
-
el.style.position = "";
|
|
84
|
-
el.style.inset = "";
|
|
85
|
-
el.style.visibility = "hidden";
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
connectedCallback() {
|
|
90
|
-
super.connectedCallback();
|
|
91
|
-
this.#syncFromSlot();
|
|
92
|
-
this.#updateAriaLabel();
|
|
93
|
-
this.slotEl?.addEventListener("slotchange", this.#onSlotChange);
|
|
94
|
-
this.#ensureObserver();
|
|
95
|
-
this.#requestFit();
|
|
96
|
-
}
|
|
97
|
-
disconnectedCallback() {
|
|
98
|
-
this.slotEl?.removeEventListener("slotchange", this.#onSlotChange);
|
|
99
|
-
this.#observer?.disconnect();
|
|
100
|
-
this.#observer = null;
|
|
101
|
-
this.#visibleMap.clear();
|
|
102
|
-
this.#candidateVisible = -1;
|
|
103
|
-
this.#candidateStreak = 0;
|
|
104
|
-
super.disconnectedCallback();
|
|
105
|
-
}
|
|
106
|
-
#onSlotChange;
|
|
107
|
-
#ensureObserver() {
|
|
108
|
-
if (this.#observer) return;
|
|
109
|
-
this.#observer = new IntersectionObserver(this.#handleIntersection, {
|
|
110
|
-
root: this,
|
|
111
|
-
threshold: [FULLY_VISIBLE_INTERSECTION_RATIO]
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
#requestFit() {
|
|
115
|
-
this.#prepareForFit();
|
|
116
|
-
this.#observeAll();
|
|
117
|
-
}
|
|
118
|
-
#observeAll() {
|
|
119
|
-
const observer = this.#observer;
|
|
120
|
-
observer.disconnect();
|
|
121
|
-
for (const el of this.items) observer.observe(el);
|
|
122
|
-
if (this.badgeEl && this.overflowCount > 0) observer.observe(this.badgeEl);
|
|
123
|
-
}
|
|
124
|
-
#syncFromSlot() {
|
|
125
|
-
const assigned = this.slotEl.assignedElements({ flatten: true });
|
|
126
|
-
this.items = assigned.filter((n) => n instanceof require_definition$2.Country);
|
|
127
|
-
this.#visibleMap.clear();
|
|
128
|
-
for (const el of this.items) this.#visibleMap.set(el, true);
|
|
129
|
-
this.lastVisibleIndex = this.items.length;
|
|
130
|
-
this.#applyLayout(this.lastVisibleIndex, "final");
|
|
131
|
-
}
|
|
132
|
-
#updateAriaLabel() {
|
|
133
|
-
const prefix = this.locale.countryGroup.ariaLabelPrefix;
|
|
134
|
-
const names = [];
|
|
135
|
-
for (const el of this.items) {
|
|
136
|
-
const label = (el.getAttribute("label") ?? "").trim();
|
|
137
|
-
const code = (el.getAttribute("code") ?? "").trim();
|
|
138
|
-
const fullName = this.#countryNameForCode(code);
|
|
139
|
-
const value = label || fullName || code;
|
|
140
|
-
if (value) names.push(value);
|
|
141
|
-
}
|
|
142
|
-
const joined = names.join(", ");
|
|
143
|
-
this.computedAriaLabel = joined ? `${prefix} ${joined}` : prefix;
|
|
144
|
-
}
|
|
145
|
-
#handleIntersection;
|
|
146
|
-
#proposeVisibleCount(nextVisible) {
|
|
147
|
-
if (this.#candidateVisible === nextVisible) this.#candidateStreak++;
|
|
148
|
-
else {
|
|
149
|
-
this.#candidateVisible = nextVisible;
|
|
150
|
-
this.#candidateStreak = 1;
|
|
151
|
-
}
|
|
152
|
-
if (this.#candidateStreak < 2) return;
|
|
153
|
-
if (this.lastVisibleIndex === nextVisible) return;
|
|
154
|
-
this.lastVisibleIndex = this.#candidateVisible;
|
|
155
|
-
this.#applyLayout(this.lastVisibleIndex, "final");
|
|
156
|
-
if (this.overflowCount === 0) this.popupOpen = false;
|
|
157
|
-
this.fillOverflowGrid();
|
|
158
|
-
}
|
|
159
|
-
#prepareForFit() {
|
|
160
|
-
this.#applyLayout(this.lastVisibleIndex, "fit");
|
|
161
|
-
}
|
|
162
|
-
/** @internal */
|
|
163
|
-
handleMouseEnter() {
|
|
164
|
-
this.popupOpen = true;
|
|
165
|
-
}
|
|
16
|
+
var Country = class extends require_vivid_element.VividElement {
|
|
166
17
|
/** @internal */
|
|
167
|
-
|
|
168
|
-
this.
|
|
18
|
+
get flagIconName() {
|
|
19
|
+
return require_utils.getFlagIconName(this.code);
|
|
169
20
|
}
|
|
170
21
|
/** @internal */
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
fillOverflowGrid() {
|
|
177
|
-
if (!this.overflowGridEl) return;
|
|
178
|
-
if (this.overflowCount === 0) return;
|
|
179
|
-
this.overflowGridEl.replaceChildren();
|
|
180
|
-
const overflowed = this.items.slice(this.lastVisibleIndex);
|
|
181
|
-
for (const it of overflowed) {
|
|
182
|
-
const clone = it.cloneNode(true);
|
|
183
|
-
clone.setAttribute("aria-hidden", "true");
|
|
184
|
-
clone.removeAttribute("style");
|
|
185
|
-
this.overflowGridEl.appendChild(clone);
|
|
186
|
-
}
|
|
22
|
+
get displayText() {
|
|
23
|
+
const customLabel = this.label?.trim();
|
|
24
|
+
if (customLabel) return customLabel;
|
|
25
|
+
const codeValue = this.code?.trim();
|
|
26
|
+
return codeValue ? codeValue.toUpperCase() : void 0;
|
|
187
27
|
}
|
|
188
28
|
};
|
|
189
|
-
require_decorate.__decorate([_microsoft_fast_element.
|
|
190
|
-
require_decorate.__decorate([_microsoft_fast_element.
|
|
191
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], CountryGroup.prototype, "computedAriaLabel", void 0);
|
|
192
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], CountryGroup.prototype, "popupOpen", void 0);
|
|
29
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Country.prototype, "code", void 0);
|
|
30
|
+
require_decorate.__decorate([_microsoft_fast_element.attr], Country.prototype, "label", void 0);
|
|
193
31
|
//#endregion
|
|
194
|
-
//#region src/lib/country
|
|
195
|
-
var
|
|
196
|
-
const
|
|
197
|
-
const popupTag = context.tagFor(require_definition.Popup);
|
|
32
|
+
//#region src/lib/country/country.template.ts
|
|
33
|
+
var CountryTemplate = (context) => {
|
|
34
|
+
const iconTag = context.tagFor(require_definition.Icon);
|
|
198
35
|
return _microsoft_fast_element.html`
|
|
199
|
-
<div
|
|
200
|
-
class="
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
})}
|
|
205
|
-
>
|
|
206
|
-
<slot ${(0, _microsoft_fast_element.ref)("slotEl")}></slot>
|
|
207
|
-
${(0, _microsoft_fast_element.when)((x) => x.overflowCount > 0, _microsoft_fast_element.html`
|
|
208
|
-
<div
|
|
209
|
-
class="overflow-wrap"
|
|
210
|
-
${(0, _microsoft_fast_element.ref)("overflowWrapEl")}
|
|
211
|
-
style="order: ${(x) => x.lastVisibleIndex};"
|
|
212
|
-
@mouseenter="${(x) => x.handleMouseEnter()}"
|
|
213
|
-
@mouseleave="${(x) => x.handleMouseLeave()}"
|
|
214
|
-
>
|
|
215
|
-
<${badgeTag}
|
|
216
|
-
${(0, _microsoft_fast_element.ref)("badgeEl")}
|
|
217
|
-
connotation="cta"
|
|
218
|
-
appearance="duotone"
|
|
219
|
-
shape="pill"
|
|
220
|
-
text="${(x) => `+${x.overflowCount}`}"
|
|
221
|
-
></${badgeTag}>
|
|
222
|
-
</div>
|
|
223
|
-
`)}
|
|
224
|
-
</div>
|
|
225
|
-
|
|
226
|
-
${(0, _microsoft_fast_element.when)((x) => x.overflowCount > 0, _microsoft_fast_element.html`
|
|
227
|
-
<${popupTag}
|
|
228
|
-
strategy="fixed"
|
|
229
|
-
placement="top"
|
|
230
|
-
alternate
|
|
231
|
-
arrow
|
|
232
|
-
:anchor="${(x) => x.overflowWrapEl}"
|
|
233
|
-
:open="${(x) => x.popupOpen}"
|
|
234
|
-
exportparts="vvd-theme-alternate"
|
|
235
|
-
>
|
|
236
|
-
<div
|
|
237
|
-
class="overflow-grid"
|
|
238
|
-
${(0, _microsoft_fast_element.ref)("overflowGridEl")}
|
|
36
|
+
<div class="base">
|
|
37
|
+
<slot name="icon" class="icon">
|
|
38
|
+
${(0, _microsoft_fast_element.when)((x) => x.flagIconName, _microsoft_fast_element.html`<${iconTag}
|
|
39
|
+
size="-4"
|
|
40
|
+
name="${(x) => x.flagIconName}"
|
|
239
41
|
aria-hidden="true"
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
42
|
+
></${iconTag}>`)}
|
|
43
|
+
</slot>
|
|
44
|
+
${(0, _microsoft_fast_element.when)((x) => x.displayText, _microsoft_fast_element.html`<span class="text">${(x) => x.displayText}</span>`)}
|
|
45
|
+
</div>
|
|
243
46
|
`;
|
|
244
47
|
};
|
|
245
48
|
//#endregion
|
|
246
|
-
//#region src/lib/country
|
|
49
|
+
//#region src/lib/country/definition.ts
|
|
247
50
|
/** @internal */
|
|
248
|
-
var
|
|
249
|
-
require_definition$2.countryDefinition,
|
|
250
|
-
require_definition$1.badgeDefinition,
|
|
251
|
-
require_definition.popupDefinition
|
|
252
|
-
], { styles: country_group_default });
|
|
51
|
+
var countryDefinition = require_vivid_element.defineVividComponent("country", Country, CountryTemplate, [require_definition.iconDefinition], { styles: country_default });
|
|
253
52
|
/**
|
|
254
|
-
* Registers the country
|
|
53
|
+
* Registers the country element with the design system.
|
|
255
54
|
*
|
|
256
55
|
* @param prefix - the prefix to use for the component name
|
|
257
56
|
*/
|
|
258
|
-
var
|
|
57
|
+
var registerCountry = require_vivid_element.createRegisterFunction(countryDefinition);
|
|
259
58
|
//#endregion
|
|
260
|
-
Object.defineProperty(exports, "
|
|
59
|
+
Object.defineProperty(exports, "Country", {
|
|
261
60
|
enumerable: true,
|
|
262
61
|
get: function() {
|
|
263
|
-
return
|
|
62
|
+
return Country;
|
|
264
63
|
}
|
|
265
64
|
});
|
|
266
|
-
Object.defineProperty(exports, "
|
|
65
|
+
Object.defineProperty(exports, "countryDefinition", {
|
|
267
66
|
enumerable: true,
|
|
268
67
|
get: function() {
|
|
269
|
-
return
|
|
68
|
+
return countryDefinition;
|
|
270
69
|
}
|
|
271
70
|
});
|
|
272
|
-
Object.defineProperty(exports, "
|
|
71
|
+
Object.defineProperty(exports, "registerCountry", {
|
|
273
72
|
enumerable: true,
|
|
274
73
|
get: function() {
|
|
275
|
-
return
|
|
74
|
+
return registerCountry;
|
|
276
75
|
}
|
|
277
76
|
});
|
|
@@ -1,259 +1,58 @@
|
|
|
1
1
|
import { d as createRegisterFunction, t as VividElement, u as defineVividComponent } from "./vivid-element.js";
|
|
2
|
+
import { r as Icon, t as iconDefinition } from "./definition.js";
|
|
2
3
|
import { t as __decorate } from "./decorate.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { r as Country, t as countryDefinition } from "./definition31.js";
|
|
8
|
-
import { n as countries } from "./utils.js";
|
|
9
|
-
import { html, observable, ref, when } from "@microsoft/fast-element";
|
|
10
|
-
//#region src/lib/country-group/country-group.scss?inline
|
|
11
|
-
var country_group_default = ":host{flex-direction:column;block-size:100%;inline-size:100%;display:flex;overflow:hidden}.container{flex-wrap:wrap;flex:auto;align-content:flex-start;align-items:center;gap:8px;min-block-size:0;display:flex;position:relative}.container slot{display:contents}.overflow-wrap{align-self:center;line-height:0}.overflow-grid{font:var(--vvd-typography-base);grid-template-columns:repeat(3,auto);gap:8px;padding:8px;display:grid}";
|
|
4
|
+
import { t as getFlagIconName } from "./utils.js";
|
|
5
|
+
import { attr, html, when } from "@microsoft/fast-element";
|
|
6
|
+
//#region src/lib/country/country.scss?inline
|
|
7
|
+
var country_default = ":host{display:inline-flex}.base{align-items:center;column-gap:8px;display:inline-flex}.icon{align-items:center;display:inline-flex}.icon [data-vvd-component=icon]{block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16));flex-shrink:0;inline-size:auto}.icon ::slotted(*){block-size:calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density,0), 2) - 16));object-fit:contain;border-radius:2px;inline-size:auto;display:block}.text{color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base)}";
|
|
12
8
|
//#endregion
|
|
13
|
-
//#region src/lib/country
|
|
14
|
-
var FULLY_VISIBLE_INTERSECTION_RATIO = .99;
|
|
9
|
+
//#region src/lib/country/country.ts
|
|
15
10
|
/**
|
|
16
11
|
* @public
|
|
17
|
-
* @component country
|
|
18
|
-
* @slot
|
|
12
|
+
* @component country
|
|
13
|
+
* @slot icon - Optional custom flag or graphic. When `code` is set and no content is slotted, a default flag icon (Vivid/Vonage icon set) is shown.
|
|
19
14
|
*/
|
|
20
|
-
var
|
|
21
|
-
constructor(..._args) {
|
|
22
|
-
super(..._args);
|
|
23
|
-
this.items = [];
|
|
24
|
-
this.lastVisibleIndex = 0;
|
|
25
|
-
this.computedAriaLabel = null;
|
|
26
|
-
this.popupOpen = false;
|
|
27
|
-
this.#observer = null;
|
|
28
|
-
this.#visibleMap = /* @__PURE__ */ new Map();
|
|
29
|
-
this.#candidateVisible = -1;
|
|
30
|
-
this.#candidateStreak = 0;
|
|
31
|
-
this.#onSlotChange = () => {
|
|
32
|
-
this.#syncFromSlot();
|
|
33
|
-
this.#updateAriaLabel();
|
|
34
|
-
this.#requestFit();
|
|
35
|
-
};
|
|
36
|
-
this.#handleIntersection = (entries) => {
|
|
37
|
-
for (const entry of entries) this.#visibleMap.set(entry.target, (entry.intersectionRatio ?? 0) >= FULLY_VISIBLE_INTERSECTION_RATIO);
|
|
38
|
-
this.#requestFit();
|
|
39
|
-
let firstHidden = -1;
|
|
40
|
-
for (let i = 0; i < this.items.length; i++) if (!(this.#visibleMap.get(this.items[i]) ?? true)) {
|
|
41
|
-
firstHidden = i;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
let nextVisible = firstHidden === -1 ? this.items.length : firstHidden;
|
|
45
|
-
if (firstHidden === this.items.length - 1 && this.badgeEl && (this.#visibleMap.get(this.badgeEl) ?? false)) nextVisible = this.items.length;
|
|
46
|
-
if (nextVisible < this.items.length && this.badgeEl && this.#visibleMap.has(this.badgeEl) && this.#visibleMap.get(this.badgeEl) === false) nextVisible = Math.max(1, nextVisible - 1);
|
|
47
|
-
this.#proposeVisibleCount(nextVisible);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
get overflowCount() {
|
|
51
|
-
return Math.max(0, this.items.length - this.lastVisibleIndex);
|
|
52
|
-
}
|
|
53
|
-
#observer;
|
|
54
|
-
#visibleMap;
|
|
55
|
-
#candidateVisible;
|
|
56
|
-
#candidateStreak;
|
|
57
|
-
#countryNameForCode(code) {
|
|
58
|
-
if (!code) return "";
|
|
59
|
-
return countries.find((c) => c.code.toUpperCase() === code.toUpperCase())?.label ?? "";
|
|
60
|
-
}
|
|
61
|
-
#applyLayout(visibleCount, mode) {
|
|
62
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
63
|
-
const el = this.items[i];
|
|
64
|
-
el.style.order = `${i < visibleCount ? i : i + 1}`;
|
|
65
|
-
if (i < visibleCount) {
|
|
66
|
-
el.setAttribute("data-visible", "true");
|
|
67
|
-
el.style.display = "";
|
|
68
|
-
el.style.position = "";
|
|
69
|
-
el.style.inset = "";
|
|
70
|
-
el.style.visibility = "";
|
|
71
|
-
el.style.pointerEvents = "";
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
el.setAttribute("data-visible", "false");
|
|
75
|
-
el.style.display = "";
|
|
76
|
-
el.style.pointerEvents = "none";
|
|
77
|
-
if (mode === "final") {
|
|
78
|
-
el.style.position = "absolute";
|
|
79
|
-
el.style.inset = "0 auto auto 0";
|
|
80
|
-
el.style.visibility = "hidden";
|
|
81
|
-
} else {
|
|
82
|
-
el.style.position = "";
|
|
83
|
-
el.style.inset = "";
|
|
84
|
-
el.style.visibility = "hidden";
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
connectedCallback() {
|
|
89
|
-
super.connectedCallback();
|
|
90
|
-
this.#syncFromSlot();
|
|
91
|
-
this.#updateAriaLabel();
|
|
92
|
-
this.slotEl?.addEventListener("slotchange", this.#onSlotChange);
|
|
93
|
-
this.#ensureObserver();
|
|
94
|
-
this.#requestFit();
|
|
95
|
-
}
|
|
96
|
-
disconnectedCallback() {
|
|
97
|
-
this.slotEl?.removeEventListener("slotchange", this.#onSlotChange);
|
|
98
|
-
this.#observer?.disconnect();
|
|
99
|
-
this.#observer = null;
|
|
100
|
-
this.#visibleMap.clear();
|
|
101
|
-
this.#candidateVisible = -1;
|
|
102
|
-
this.#candidateStreak = 0;
|
|
103
|
-
super.disconnectedCallback();
|
|
104
|
-
}
|
|
105
|
-
#onSlotChange;
|
|
106
|
-
#ensureObserver() {
|
|
107
|
-
if (this.#observer) return;
|
|
108
|
-
this.#observer = new IntersectionObserver(this.#handleIntersection, {
|
|
109
|
-
root: this,
|
|
110
|
-
threshold: [FULLY_VISIBLE_INTERSECTION_RATIO]
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
#requestFit() {
|
|
114
|
-
this.#prepareForFit();
|
|
115
|
-
this.#observeAll();
|
|
116
|
-
}
|
|
117
|
-
#observeAll() {
|
|
118
|
-
const observer = this.#observer;
|
|
119
|
-
observer.disconnect();
|
|
120
|
-
for (const el of this.items) observer.observe(el);
|
|
121
|
-
if (this.badgeEl && this.overflowCount > 0) observer.observe(this.badgeEl);
|
|
122
|
-
}
|
|
123
|
-
#syncFromSlot() {
|
|
124
|
-
const assigned = this.slotEl.assignedElements({ flatten: true });
|
|
125
|
-
this.items = assigned.filter((n) => n instanceof Country);
|
|
126
|
-
this.#visibleMap.clear();
|
|
127
|
-
for (const el of this.items) this.#visibleMap.set(el, true);
|
|
128
|
-
this.lastVisibleIndex = this.items.length;
|
|
129
|
-
this.#applyLayout(this.lastVisibleIndex, "final");
|
|
130
|
-
}
|
|
131
|
-
#updateAriaLabel() {
|
|
132
|
-
const prefix = this.locale.countryGroup.ariaLabelPrefix;
|
|
133
|
-
const names = [];
|
|
134
|
-
for (const el of this.items) {
|
|
135
|
-
const label = (el.getAttribute("label") ?? "").trim();
|
|
136
|
-
const code = (el.getAttribute("code") ?? "").trim();
|
|
137
|
-
const fullName = this.#countryNameForCode(code);
|
|
138
|
-
const value = label || fullName || code;
|
|
139
|
-
if (value) names.push(value);
|
|
140
|
-
}
|
|
141
|
-
const joined = names.join(", ");
|
|
142
|
-
this.computedAriaLabel = joined ? `${prefix} ${joined}` : prefix;
|
|
143
|
-
}
|
|
144
|
-
#handleIntersection;
|
|
145
|
-
#proposeVisibleCount(nextVisible) {
|
|
146
|
-
if (this.#candidateVisible === nextVisible) this.#candidateStreak++;
|
|
147
|
-
else {
|
|
148
|
-
this.#candidateVisible = nextVisible;
|
|
149
|
-
this.#candidateStreak = 1;
|
|
150
|
-
}
|
|
151
|
-
if (this.#candidateStreak < 2) return;
|
|
152
|
-
if (this.lastVisibleIndex === nextVisible) return;
|
|
153
|
-
this.lastVisibleIndex = this.#candidateVisible;
|
|
154
|
-
this.#applyLayout(this.lastVisibleIndex, "final");
|
|
155
|
-
if (this.overflowCount === 0) this.popupOpen = false;
|
|
156
|
-
this.fillOverflowGrid();
|
|
157
|
-
}
|
|
158
|
-
#prepareForFit() {
|
|
159
|
-
this.#applyLayout(this.lastVisibleIndex, "fit");
|
|
160
|
-
}
|
|
161
|
-
/** @internal */
|
|
162
|
-
handleMouseEnter() {
|
|
163
|
-
this.popupOpen = true;
|
|
164
|
-
}
|
|
15
|
+
var Country = class extends VividElement {
|
|
165
16
|
/** @internal */
|
|
166
|
-
|
|
167
|
-
this.
|
|
17
|
+
get flagIconName() {
|
|
18
|
+
return getFlagIconName(this.code);
|
|
168
19
|
}
|
|
169
20
|
/** @internal */
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
fillOverflowGrid() {
|
|
176
|
-
if (!this.overflowGridEl) return;
|
|
177
|
-
if (this.overflowCount === 0) return;
|
|
178
|
-
this.overflowGridEl.replaceChildren();
|
|
179
|
-
const overflowed = this.items.slice(this.lastVisibleIndex);
|
|
180
|
-
for (const it of overflowed) {
|
|
181
|
-
const clone = it.cloneNode(true);
|
|
182
|
-
clone.setAttribute("aria-hidden", "true");
|
|
183
|
-
clone.removeAttribute("style");
|
|
184
|
-
this.overflowGridEl.appendChild(clone);
|
|
185
|
-
}
|
|
21
|
+
get displayText() {
|
|
22
|
+
const customLabel = this.label?.trim();
|
|
23
|
+
if (customLabel) return customLabel;
|
|
24
|
+
const codeValue = this.code?.trim();
|
|
25
|
+
return codeValue ? codeValue.toUpperCase() : void 0;
|
|
186
26
|
}
|
|
187
27
|
};
|
|
188
|
-
__decorate([
|
|
189
|
-
__decorate([
|
|
190
|
-
__decorate([observable], CountryGroup.prototype, "computedAriaLabel", void 0);
|
|
191
|
-
__decorate([observable], CountryGroup.prototype, "popupOpen", void 0);
|
|
28
|
+
__decorate([attr], Country.prototype, "code", void 0);
|
|
29
|
+
__decorate([attr], Country.prototype, "label", void 0);
|
|
192
30
|
//#endregion
|
|
193
|
-
//#region src/lib/country
|
|
194
|
-
var
|
|
195
|
-
const
|
|
196
|
-
const popupTag = context.tagFor(Popup);
|
|
31
|
+
//#region src/lib/country/country.template.ts
|
|
32
|
+
var CountryTemplate = (context) => {
|
|
33
|
+
const iconTag = context.tagFor(Icon);
|
|
197
34
|
return html`
|
|
198
|
-
<div
|
|
199
|
-
class="
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
})}
|
|
204
|
-
>
|
|
205
|
-
<slot ${ref("slotEl")}></slot>
|
|
206
|
-
${when((x) => x.overflowCount > 0, html`
|
|
207
|
-
<div
|
|
208
|
-
class="overflow-wrap"
|
|
209
|
-
${ref("overflowWrapEl")}
|
|
210
|
-
style="order: ${(x) => x.lastVisibleIndex};"
|
|
211
|
-
@mouseenter="${(x) => x.handleMouseEnter()}"
|
|
212
|
-
@mouseleave="${(x) => x.handleMouseLeave()}"
|
|
213
|
-
>
|
|
214
|
-
<${badgeTag}
|
|
215
|
-
${ref("badgeEl")}
|
|
216
|
-
connotation="cta"
|
|
217
|
-
appearance="duotone"
|
|
218
|
-
shape="pill"
|
|
219
|
-
text="${(x) => `+${x.overflowCount}`}"
|
|
220
|
-
></${badgeTag}>
|
|
221
|
-
</div>
|
|
222
|
-
`)}
|
|
223
|
-
</div>
|
|
224
|
-
|
|
225
|
-
${when((x) => x.overflowCount > 0, html`
|
|
226
|
-
<${popupTag}
|
|
227
|
-
strategy="fixed"
|
|
228
|
-
placement="top"
|
|
229
|
-
alternate
|
|
230
|
-
arrow
|
|
231
|
-
:anchor="${(x) => x.overflowWrapEl}"
|
|
232
|
-
:open="${(x) => x.popupOpen}"
|
|
233
|
-
exportparts="vvd-theme-alternate"
|
|
234
|
-
>
|
|
235
|
-
<div
|
|
236
|
-
class="overflow-grid"
|
|
237
|
-
${ref("overflowGridEl")}
|
|
35
|
+
<div class="base">
|
|
36
|
+
<slot name="icon" class="icon">
|
|
37
|
+
${when((x) => x.flagIconName, html`<${iconTag}
|
|
38
|
+
size="-4"
|
|
39
|
+
name="${(x) => x.flagIconName}"
|
|
238
40
|
aria-hidden="true"
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
41
|
+
></${iconTag}>`)}
|
|
42
|
+
</slot>
|
|
43
|
+
${when((x) => x.displayText, html`<span class="text">${(x) => x.displayText}</span>`)}
|
|
44
|
+
</div>
|
|
242
45
|
`;
|
|
243
46
|
};
|
|
244
47
|
//#endregion
|
|
245
|
-
//#region src/lib/country
|
|
48
|
+
//#region src/lib/country/definition.ts
|
|
246
49
|
/** @internal */
|
|
247
|
-
var
|
|
248
|
-
countryDefinition,
|
|
249
|
-
badgeDefinition,
|
|
250
|
-
popupDefinition
|
|
251
|
-
], { styles: country_group_default });
|
|
50
|
+
var countryDefinition = defineVividComponent("country", Country, CountryTemplate, [iconDefinition], { styles: country_default });
|
|
252
51
|
/**
|
|
253
|
-
* Registers the country
|
|
52
|
+
* Registers the country element with the design system.
|
|
254
53
|
*
|
|
255
54
|
* @param prefix - the prefix to use for the component name
|
|
256
55
|
*/
|
|
257
|
-
var
|
|
56
|
+
var registerCountry = createRegisterFunction(countryDefinition);
|
|
258
57
|
//#endregion
|
|
259
|
-
export {
|
|
58
|
+
export { registerCountry as n, Country as r, countryDefinition as t };
|