@dialpad/dialtone-vue 4.6.0 → 4.7.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.
Files changed (157) hide show
  1. package/dist/{RichTextEditor-DaOHmXD_.js → RichTextEditor-D8DfONFm.js} +7 -7
  2. package/dist/{RichTextEditor-DaOHmXD_.js.map → RichTextEditor-D8DfONFm.js.map} +1 -1
  3. package/dist/{RichTextEditor-7eY8gy9u.cjs → RichTextEditor-DMUDJKVn.cjs} +2 -2
  4. package/dist/{RichTextEditor-7eY8gy9u.cjs.map → RichTextEditor-DMUDJKVn.cjs.map} +1 -1
  5. package/dist/common/mixins/keyboard-list-navigation.cjs +1 -1
  6. package/dist/common/mixins/keyboard-list-navigation.cjs.map +1 -1
  7. package/dist/common/mixins/keyboard-list-navigation.js +10 -7
  8. package/dist/common/mixins/keyboard-list-navigation.js.map +1 -1
  9. package/dist/common/mixins/keyboard_list_navigation.d.ts +1 -1
  10. package/dist/common/mixins/keyboard_list_navigation.d.ts.map +1 -1
  11. package/dist/common/sr_only_close_button.vue.d.ts +4 -1
  12. package/dist/component-documentation.json +1 -1
  13. package/dist/components/Avatar/Avatar.vue.d.ts +12 -8
  14. package/dist/components/Avatar/Avatar.vue.d.ts.map +1 -1
  15. package/dist/components/Badge/Badge.vue.d.ts +1 -2
  16. package/dist/components/Banner/Banner.vue.d.ts +8 -2
  17. package/dist/components/Banner/Banner.vue.d.ts.map +1 -1
  18. package/dist/components/Button/Button.vue.d.ts +4 -1
  19. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  20. package/dist/components/Chip/Chip.vue.d.ts +4 -1
  21. package/dist/components/Chip/Chip.vue.d.ts.map +1 -1
  22. package/dist/components/Collapsible/Collapsible.vue.d.ts +4 -1
  23. package/dist/components/Collapsible/Collapsible.vue.d.ts.map +1 -1
  24. package/dist/components/Combobox/Combobox.vue.d.ts +5 -1
  25. package/dist/components/Combobox/Combobox.vue.d.ts.map +1 -1
  26. package/dist/components/Combobox/ComboboxEmptyList.vue.d.ts +2 -0
  27. package/dist/components/Combobox/ComboboxEmptyList.vue.d.ts.map +1 -1
  28. package/dist/components/Combobox/ComboboxLoadingList.vue.d.ts +2 -0
  29. package/dist/components/Combobox/ComboboxLoadingList.vue.d.ts.map +1 -1
  30. package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts +51 -7
  31. package/dist/components/ComboboxWithPopover/ComboboxWithPopover.vue.d.ts.map +1 -1
  32. package/dist/components/Dropdown/Dropdown.vue.d.ts +74 -7
  33. package/dist/components/Dropdown/Dropdown.vue.d.ts.map +1 -1
  34. package/dist/components/FilterPill/FilterPill.vue.d.ts +530 -31
  35. package/dist/components/FilterPill/FilterPill.vue.d.ts.map +1 -1
  36. package/dist/components/FilterPill/FilterPillConstants.d.ts +2 -0
  37. package/dist/components/FilterPill/FilterPillConstants.d.ts.map +1 -0
  38. package/dist/components/FilterPill/FilterPillControlled.d.ts +92 -0
  39. package/dist/components/FilterPill/FilterPillControlled.d.ts.map +1 -0
  40. package/dist/components/FilterPill/FilterPillSelection.d.ts +13 -0
  41. package/dist/components/FilterPill/FilterPillSelection.d.ts.map +1 -0
  42. package/dist/components/Hovercard/Hovercard.vue.d.ts +102 -20
  43. package/dist/components/Hovercard/Hovercard.vue.d.ts.map +1 -1
  44. package/dist/components/ImageViewer/ImageViewer.vue.d.ts +8 -2
  45. package/dist/components/ImageViewer/ImageViewer.vue.d.ts.map +1 -1
  46. package/dist/components/ListItem/ListItem.vue.d.ts +2 -0
  47. package/dist/components/ListItem/ListItem.vue.d.ts.map +1 -1
  48. package/dist/components/ListItem/ListItemConstants.d.ts +2 -0
  49. package/dist/components/ListItem/ListItemConstants.d.ts.map +1 -1
  50. package/dist/components/ListItem/index.d.ts +1 -1
  51. package/dist/components/Loader/Loader.vue.d.ts +4 -1
  52. package/dist/components/Loader/Loader.vue.d.ts.map +1 -1
  53. package/dist/components/Modal/Modal.vue.d.ts +9 -3
  54. package/dist/components/Modal/Modal.vue.d.ts.map +1 -1
  55. package/dist/components/Notice/Notice.vue.d.ts +9 -3
  56. package/dist/components/Notice/Notice.vue.d.ts.map +1 -1
  57. package/dist/components/Notice/NoticeAction.vue.d.ts +8 -2
  58. package/dist/components/Notice/NoticeAction.vue.d.ts.map +1 -1
  59. package/dist/components/Pagination/Pagination.vue.d.ts +4 -1
  60. package/dist/components/Pagination/Pagination.vue.d.ts.map +1 -1
  61. package/dist/components/Popover/Popover.vue.d.ts +42 -6
  62. package/dist/components/Popover/Popover.vue.d.ts.map +1 -1
  63. package/dist/components/Popover/PopoverHeaderFooter.vue.d.ts +13 -1
  64. package/dist/components/Popover/PopoverHeaderFooter.vue.d.ts.map +1 -1
  65. package/dist/components/RichTextEditor/Extensions/Mentions/MentionSuggestion.vue.d.ts +12 -8
  66. package/dist/components/RichTextEditor/Extensions/Suggestion/SuggestionList.vue.d.ts +2 -0
  67. package/dist/components/RichTextEditor/Extensions/Suggestion/SuggestionList.vue.d.ts.map +1 -1
  68. package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts +47 -9
  69. package/dist/components/RichTextEditor/Extensions/Variable/VariableComponent.vue.d.ts.map +1 -1
  70. package/dist/components/SegmentedControl/SegmentedControlItem.vue.d.ts.map +1 -1
  71. package/dist/components/SplitButton/SplitButton.vue.d.ts +82 -9
  72. package/dist/components/SplitButton/SplitButton.vue.d.ts.map +1 -1
  73. package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts +4 -1
  74. package/dist/components/SplitButton/SplitButtonEnd.vue.d.ts.map +1 -1
  75. package/dist/components/SplitButton/SplitButtonStart.vue.d.ts +4 -1
  76. package/dist/components/Tab/Tab.vue.d.ts +4 -1
  77. package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts +9 -3
  78. package/dist/components/Toast/Layouts/ToastLayoutAlternate.vue.d.ts.map +1 -1
  79. package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts +9 -3
  80. package/dist/components/Toast/Layouts/ToastLayoutDefault.vue.d.ts.map +1 -1
  81. package/dist/components/Toast/Toast.vue.d.ts +37 -13
  82. package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
  83. package/dist/dialtone-vue.cjs +1 -1
  84. package/dist/dialtone-vue.js +96 -96
  85. package/dist/lib/avatar/avatar.cjs +1 -1
  86. package/dist/lib/avatar/avatar.cjs.map +1 -1
  87. package/dist/lib/avatar/avatar.js +50 -47
  88. package/dist/lib/avatar/avatar.js.map +1 -1
  89. package/dist/lib/badge/badge.cjs +1 -1
  90. package/dist/lib/badge/badge.cjs.map +1 -1
  91. package/dist/lib/badge/badge.js +12 -14
  92. package/dist/lib/badge/badge.js.map +1 -1
  93. package/dist/lib/button/button.cjs +1 -1
  94. package/dist/lib/button/button.js +21 -21
  95. package/dist/lib/dropdown/dropdown.cjs +1 -1
  96. package/dist/lib/dropdown/dropdown.cjs.map +1 -1
  97. package/dist/lib/dropdown/dropdown.js +73 -13
  98. package/dist/lib/dropdown/dropdown.js.map +1 -1
  99. package/dist/lib/filter-pill/filter-pill-constants.cjs +2 -0
  100. package/dist/lib/filter-pill/filter-pill-constants.cjs.map +1 -0
  101. package/dist/lib/filter-pill/filter-pill-constants.js +7 -0
  102. package/dist/lib/filter-pill/filter-pill-constants.js.map +1 -0
  103. package/dist/lib/filter-pill/filter-pill-controlled.cjs +2 -0
  104. package/dist/lib/filter-pill/filter-pill-controlled.cjs.map +1 -0
  105. package/dist/lib/filter-pill/filter-pill-controlled.js +308 -0
  106. package/dist/lib/filter-pill/filter-pill-controlled.js.map +1 -0
  107. package/dist/lib/filter-pill/filter-pill-selection.cjs +2 -0
  108. package/dist/lib/filter-pill/filter-pill-selection.cjs.map +1 -0
  109. package/dist/lib/filter-pill/filter-pill-selection.js +32 -0
  110. package/dist/lib/filter-pill/filter-pill-selection.js.map +1 -0
  111. package/dist/lib/filter-pill/filter-pill.cjs +1 -1
  112. package/dist/lib/filter-pill/filter-pill.cjs.map +1 -1
  113. package/dist/lib/filter-pill/filter-pill.js +360 -94
  114. package/dist/lib/filter-pill/filter-pill.js.map +1 -1
  115. package/dist/lib/list-item/index.cjs +1 -1
  116. package/dist/lib/list-item/index.js +3 -3
  117. package/dist/lib/list-item/list-item-constants.cjs +1 -1
  118. package/dist/lib/list-item/list-item-constants.cjs.map +1 -1
  119. package/dist/lib/list-item/list-item-constants.js +12 -6
  120. package/dist/lib/list-item/list-item-constants.js.map +1 -1
  121. package/dist/lib/list-item/list-item.cjs +1 -1
  122. package/dist/lib/list-item/list-item.cjs.map +1 -1
  123. package/dist/lib/list-item/list-item.js +36 -32
  124. package/dist/lib/list-item/list-item.js.map +1 -1
  125. package/dist/lib/loader/loader.cjs +3 -3
  126. package/dist/lib/loader/loader.cjs.map +1 -1
  127. package/dist/lib/loader/loader.js +28 -20
  128. package/dist/lib/loader/loader.js.map +1 -1
  129. package/dist/lib/modal/modal.cjs +1 -1
  130. package/dist/lib/modal/modal.cjs.map +1 -1
  131. package/dist/lib/modal/modal.js +6 -5
  132. package/dist/lib/modal/modal.js.map +1 -1
  133. package/dist/lib/popover/popover-header-footer.cjs +1 -1
  134. package/dist/lib/popover/popover-header-footer.cjs.map +1 -1
  135. package/dist/lib/popover/popover-header-footer.js +7 -1
  136. package/dist/lib/popover/popover-header-footer.js.map +1 -1
  137. package/dist/lib/popover/popover.cjs +1 -1
  138. package/dist/lib/popover/popover.cjs.map +1 -1
  139. package/dist/lib/popover/popover.js +57 -21
  140. package/dist/lib/popover/popover.js.map +1 -1
  141. package/dist/lib/rich-text-editor/index.cjs +1 -1
  142. package/dist/lib/rich-text-editor/index.js +1 -1
  143. package/dist/lib/rich-text-editor/rich-text-editor.cjs +1 -1
  144. package/dist/lib/rich-text-editor/rich-text-editor.js +1 -1
  145. package/dist/lib/segmented-control/segmented-control-item.cjs.map +1 -1
  146. package/dist/lib/segmented-control/segmented-control-item.js.map +1 -1
  147. package/dist/lib/text/text.cjs.map +1 -1
  148. package/dist/lib/text/text.js.map +1 -1
  149. package/dist/localization/en-US.cjs +9 -0
  150. package/dist/localization/en-US.cjs.map +1 -1
  151. package/dist/localization/en-US.js +1 -1
  152. package/dist/localization/en-US.js.map +1 -1
  153. package/dist/localization/index.cjs +1 -1
  154. package/dist/localization/index.cjs.map +1 -1
  155. package/dist/localization/index.js +50 -33
  156. package/dist/localization/index.js.map +1 -1
  157. package/package.json +3 -3
@@ -1,15 +1,15 @@
1
1
  import { ordinalSizeValidator as e } from "../../common/validators/index.js";
2
2
  import { hasSlotContent as t } from "../../common/utils/index.js";
3
3
  import { t as n } from "../../_plugin-vue_export-helper-BTgDAbhb.js";
4
- import r from "../loader/loader.js";
5
- import { BUTTON_ICON_SIZES as i, BUTTON_IMPORTANCE_MODIFIERS as a, BUTTON_KIND_MODIFIERS as o, BUTTON_SIZE_MODIFIERS as s, BUTTON_TYPES as c, ICON_POSITION_MODIFIERS as l, INVALID_COMBINATION as u } from "./button-constants.js";
6
- import { LINK_KIND_MODIFIERS as d, getLinkKindModifier as f } from "../link/link-constants.js";
7
- import { DialtoneLocalization as p } from "../../localization/index.js";
4
+ import { DialtoneLocalization as r } from "../../localization/index.js";
5
+ import i from "../loader/loader.js";
6
+ import { BUTTON_ICON_SIZES as a, BUTTON_IMPORTANCE_MODIFIERS as o, BUTTON_KIND_MODIFIERS as s, BUTTON_SIZE_MODIFIERS as c, BUTTON_TYPES as l, ICON_POSITION_MODIFIERS as u, INVALID_COMBINATION as d } from "./button-constants.js";
7
+ import { LINK_KIND_MODIFIERS as f, getLinkKindModifier as p } from "../link/link-constants.js";
8
8
  import { createBlock as m, createCommentVNode as h, createElementBlock as g, mergeProps as _, normalizeClass as v, openBlock as y, renderSlot as b, resolveComponent as x, resolveDynamicComponent as S, toHandlers as C, warn as w, withCtx as T } from "vue";
9
9
  //#region components/Button/Button.vue
10
10
  var E = {
11
11
  name: "DtButton",
12
- components: { DtLoader: r },
12
+ components: { DtLoader: i },
13
13
  props: {
14
14
  circle: {
15
15
  type: Boolean,
@@ -18,12 +18,12 @@ var E = {
18
18
  iconPosition: {
19
19
  type: String,
20
20
  default: "start",
21
- validator: (e) => Object.keys(l).includes(e)
21
+ validator: (e) => Object.keys(u).includes(e)
22
22
  },
23
23
  importance: {
24
24
  type: String,
25
25
  default: "primary",
26
- validator: (e) => Object.keys(a).includes(e)
26
+ validator: (e) => Object.keys(o).includes(e)
27
27
  },
28
28
  link: {
29
29
  type: Boolean,
@@ -32,7 +32,7 @@ var E = {
32
32
  linkKind: {
33
33
  type: String,
34
34
  default: "default",
35
- validator: (e) => Object.keys(d).includes(e)
35
+ validator: (e) => Object.keys(f).includes(e)
36
36
  },
37
37
  linkInverted: {
38
38
  type: Boolean,
@@ -53,7 +53,7 @@ var E = {
53
53
  type: {
54
54
  type: String,
55
55
  default: "button",
56
- validator: (e) => c.includes(e)
56
+ validator: (e) => l.includes(e)
57
57
  },
58
58
  width: {
59
59
  type: String,
@@ -62,7 +62,7 @@ var E = {
62
62
  size: {
63
63
  type: [String, Number],
64
64
  default: 300,
65
- validator: e(s)
65
+ validator: e(c)
66
66
  },
67
67
  labelClass: {
68
68
  type: [
@@ -135,7 +135,7 @@ var E = {
135
135
  kind: {
136
136
  type: String,
137
137
  default: "default",
138
- validator: (e) => Object.keys(o).includes(e)
138
+ validator: (e) => Object.keys(s).includes(e)
139
139
  },
140
140
  assertiveOnFocus: {
141
141
  type: Boolean,
@@ -169,10 +169,10 @@ var E = {
169
169
  emits: ["focusin", "focusout"],
170
170
  data() {
171
171
  return {
172
- ICON_POSITION_MODIFIERS: l,
172
+ ICON_POSITION_MODIFIERS: u,
173
173
  isInFocus: !1,
174
174
  hasSlotContent: t,
175
- i18n: new p()
175
+ i18n: new r()
176
176
  };
177
177
  },
178
178
  computed: {
@@ -225,10 +225,10 @@ var E = {
225
225
  return this.assertiveOnFocus && this.isInFocus ? "assertive" : this.$attrs.ariaLive;
226
226
  },
227
227
  iconSize() {
228
- return i[String(this.size)];
228
+ return a[String(this.size)];
229
229
  },
230
230
  loaderSize() {
231
- return i[String(this.size)];
231
+ return a[String(this.size)];
232
232
  },
233
233
  propCombination() {
234
234
  return [
@@ -257,14 +257,14 @@ var E = {
257
257
  buttonClasses() {
258
258
  return this.link ? [
259
259
  "d-link",
260
- f(this.linkKind, this.linkInverted),
261
- s[String(this.size)],
260
+ p(this.linkKind, this.linkInverted),
261
+ c[String(this.size)],
262
262
  { "d-link--no-underline": !this.resolvedUnderline }
263
263
  ] : this.kind === "unstyled" ? ["d-btn--unstyled"] : [
264
264
  "d-btn",
265
- a[this.importance],
266
- o[this.kind],
267
- s[String(this.size)],
265
+ o[this.importance],
266
+ s[this.kind],
267
+ c[String(this.size)],
268
268
  {
269
269
  "d-btn--circle": this.circle,
270
270
  "d-btn--loading": this.loading,
@@ -276,7 +276,7 @@ var E = {
276
276
  },
277
277
  isInvalidPropCombination(e, t, n) {
278
278
  if (this.kind === "unstyled") return !0;
279
- for (let r of u) if (e === r.circle && t === r.kind && n === r.importance) return w(r.message), !1;
279
+ for (let r of d) if (e === r.circle && t === r.kind && n === r.importance) return w(r.message), !1;
280
280
  return !0;
281
281
  },
282
282
  hasStartIcon() {
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/keyboard-list-navigation.cjs`),i=require(`../../mode_constants-CzYJW9ua.cjs`),a=require(`../list-item/list-item-constants.cjs`),o=require(`../popover/popover-constants.cjs`),s=require(`../popover/popover.cjs`),c=require(`./dropdown-constants.cjs`);let l=require(`vue`);var u={name:`DtDropdown`,components:{DtPopover:s.default},mixins:[r.default({indexKey:`highlightIndex`,idKey:`highlightId`,listElementKey:`getListElement`,listItemRole:`menuitem`,afterHighlightMethod:`afterHighlight`,beginningOfListMethod:`beginningOfListMethod`,endOfListMethod:`endOfListMethod`,activeItemKey:`activeItemEl`,focusOnKeyboardNavigation:!0})],inheritAttrs:!1,props:{contentMode:i.t,open:{type:[Boolean,null],default:null},openOnContext:{type:Boolean,default:!1},padding:{type:String,default:`small`,validator:e=>Object.keys(c.DROPDOWN_PADDING_CLASSES).some(t=>t===e)},modal:{type:Boolean,default:!0},contentWidth:{type:String,default:null},maxHeight:{type:String,default:``},maxWidth:{type:String,default:``},listId:{type:String,default(){return t.getUniqueString()}},navigationType:{type:String,default:a.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,validator:e=>Object.values(a.LIST_ITEM_NAVIGATION_TYPES).includes(e)},fallbackPlacements:{type:Array,default:()=>[`auto`]},placement:{type:String,default:`bottom`},onBeginningOfList:{type:Function,default:null},onEndOfList:{type:Function,default:null},listClass:{type:[String,Array,Object],default:``},footerClass:{type:[String,Array,Object],default:``},appendTo:{type:[e.HTML_ELEMENT_TYPE,String],default:`body`,validator:e=>o.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},tether:{type:Boolean,default:!0},transition:{type:String,default:`fade`}},emits:[`keydown`,`highlight`,`update:open`,`opened`],data(){return{LIST_ITEM_NAVIGATION_TYPES:a.LIST_ITEM_NAVIGATION_TYPES,DROPDOWN_PADDING_CLASSES:c.DROPDOWN_PADDING_CLASSES,EVENT_KEYNAMES:e.EVENT_KEYNAMES,openedWithKeyboard:!1,isOpen:null}},computed:{dropdownListeners(){return{"update:open":e=>{this.$emit(`update:open`,e)},opened:e=>{this.updateInitialHighlightIndex(e)},keydown:t=>{switch(t.code){case e.EVENT_KEYNAMES.up:case e.EVENT_KEYNAMES.arrowup:this.onUpKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.down:case e.EVENT_KEYNAMES.arrowdown:this.onDownKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.space:case e.EVENT_KEYNAMES.spacebar:this.onSpaceKey();break;case e.EVENT_KEYNAMES.enter:this.onEnterKey();break;case e.EVENT_KEYNAMES.home:this.onHomeKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.end:this.onEndKeyPress(t),t.stopPropagation(),t.preventDefault();break;default:this.onKeyPress(t);break}this.$emit(`keydown`,t)}}},beginningOfListMethod(){return this.onBeginningOfList||this.jumpToEnd},endOfListMethod(){return this.onEndOfList||this.jumpToBeginning},activeItemEl(){return this.getListElement().querySelector(`#`+this.highlightId)},isArrowKeyNav(){return this.navigationType===this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS},listClasses(){return[`d-dropdown-list`,c.DROPDOWN_PADDING_CLASSES[this.padding],this.listClass,{"d-context-menu-list":this.openOnContext}]},shouldOpenWithArrowKeys(){return!this.openOnContext}},methods:{onMouseHighlight(e){let t=e.target.closest(`li`);t&&t.role&&this.highlightId!==t.id&&(this.setHighlightId(t.id),t.focus())},getListElement(){return this.$refs.listWrapper},clearHighlightIndex(){this.setHighlightIndex(-1)},afterHighlight(){this.highlightIndex!==this._itemsLength()-1&&this.$emit(`highlight`,this.highlightIndex)},updateInitialHighlightIndex(e){this.isOpen=e,e?(this.openedWithKeyboard&&this.isArrowKeyNav&&this.setHighlightIndex(0),this.$emit(`opened`,!0)):(this.clearHighlightIndex(),this.openedWithKeyboard=!1,this.$emit(`opened`,!1))},onSpaceKey(){this.open||(this.openedWithKeyboard=!0)},onEnterKey(){this.open||(this.openedWithKeyboard=!0)},onUpKeyPress(){if(!this.isOpen){this.openedWithKeyboard=!0;return}if(this.isArrowKeyNav)return this.onUpKey()},onDownKeyPress(){if(!this.isOpen){this.openedWithKeyboard=!0;return}if(this.isArrowKeyNav)return this.onDownKey()},onHomeKeyPress(){if(!(!this.isOpen||!this.isArrowKeyNav))return this.onHomeKey()},onEndKeyPress(){if(!(!this.isOpen||!this.isArrowKeyNav))return this.onEndKey()},onKeyPress(e){if(!(!this.isOpen||!this.isArrowKeyNav||!this.isValidLetter(e.key)))return e.stopPropagation(),e.preventDefault(),this.onNavigationKey(e.key)}}},d=[`id`];function f(e,t,n,r,i,a){let o=(0,l.resolveComponent)(`dt-popover`);return(0,l.openBlock)(),(0,l.createBlock)(o,(0,l.mergeProps)({ref:`popover`,"content-width":n.contentWidth,"content-mode":n.contentMode,open:n.open,placement:n.placement,"initial-focus-element":i.openedWithKeyboard?`first`:`dialog`,"fallback-placements":n.fallbackPlacements,padding:`none`,role:`menu`,"append-to":n.appendTo,modal:n.modal,"max-height":n.maxHeight,"max-width":n.maxWidth,"open-with-arrow-keys":a.shouldOpenWithArrowKeys,"open-on-context":n.openOnContext},e.$attrs,{tether:n.tether,transition:n.transition,"footer-class":n.footerClass},(0,l.toHandlers)(a.dropdownListeners)),{anchor:(0,l.withCtx)(({attrs:t})=>[(0,l.renderSlot)(e.$slots,`anchor`,(0,l.mergeProps)({ref:`anchor`},t))]),content:(0,l.withCtx)(({close:r})=>[(0,l.createElementVNode)(`ul`,{id:n.listId,ref:`listWrapper`,class:(0,l.normalizeClass)(a.listClasses),"data-qa":`dt-dropdown-list-wrapper`,onMouseleave:t[0]||(t[0]=(...e)=>a.clearHighlightIndex&&a.clearHighlightIndex(...e)),onMousemoveCapture:t[1]||(t[1]=(...e)=>a.onMouseHighlight&&a.onMouseHighlight(...e))},[(0,l.renderSlot)(e.$slots,`list`,{close:r})],42,d)]),footerContent:(0,l.withCtx)(({close:t})=>[(0,l.renderSlot)(e.$slots,`footer`,{close:t})]),_:3},16,[`content-width`,`content-mode`,`open`,`placement`,`initial-focus-element`,`fallback-placements`,`append-to`,`modal`,`max-height`,`max-width`,`open-with-arrow-keys`,`open-on-context`,`tether`,`transition`,`footer-class`])}var p=n.t(u,[[`render`,f]]);exports.default=p;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/constants/index.cjs`),t=require(`../../common/utils/index.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../../common/mixins/keyboard-list-navigation.cjs`),i=require(`../../mode_constants-CzYJW9ua.cjs`),a=require(`../list-item/list-item-constants.cjs`),o=require(`../popover/popover-constants.cjs`),s=require(`../popover/popover.cjs`),c=require(`./dropdown-constants.cjs`);let l=require(`vue`);var u={name:`DtDropdown`,components:{DtPopover:s.default},mixins:[r.default({indexKey:`highlightIndex`,idKey:`highlightId`,listElementKey:`getListElement`,listItemRole:[`menuitem`,`menuitemradio`],afterHighlightMethod:`afterHighlight`,beginningOfListMethod:`beginningOfListMethod`,endOfListMethod:`endOfListMethod`,activeItemKey:`activeItemEl`,focusOnKeyboardNavigation:!0})],inheritAttrs:!1,props:{contentMode:i.t,open:{type:[Boolean,null],default:null},visibilityChangeCallback:{type:Function,default:null},forwardAnchorArrowKeys:{type:Boolean,default:!1},openOnContext:{type:Boolean,default:!1},padding:{type:String,default:`small`,validator:e=>Object.keys(c.DROPDOWN_PADDING_CLASSES).some(t=>t===e)},modal:{type:Boolean,default:!0},contentWidth:{type:String,default:null},maxHeight:{type:String,default:``},maxWidth:{type:String,default:``},listId:{type:String,default(){return t.getUniqueString()}},navigationType:{type:String,default:a.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,validator:e=>Object.values(a.LIST_ITEM_NAVIGATION_TYPES).includes(e)},fallbackPlacements:{type:Array,default:()=>[`auto`]},placement:{type:String,default:`bottom`},onBeginningOfList:{type:Function,default:null},onEndOfList:{type:Function,default:null},listClass:{type:[String,Array,Object],default:``},footerClass:{type:[String,Array,Object],default:``},appendTo:{type:[e.HTML_ELEMENT_TYPE,String],default:`body`,validator:e=>o.POPOVER_APPEND_TO_VALUES.includes(e)||e instanceof HTMLElement},tether:{type:Boolean,default:!0},transition:{type:String,default:`fade`}},emits:[`keydown`,`highlight`,`update:open`,`opened`],data(){return{LIST_ITEM_NAVIGATION_TYPES:a.LIST_ITEM_NAVIGATION_TYPES,DROPDOWN_PADDING_CLASSES:c.DROPDOWN_PADDING_CLASSES,EVENT_KEYNAMES:e.EVENT_KEYNAMES,openedWithKeyboard:!1,pendingArrowOpening:null,isOpen:null,isLogicallyOpen:!1}},computed:{popoverAttrs(){let{dialogClass:e,"dialog-class":t,...n}=this.$attrs;return{...n,dialogClass:[e,t,{"d-dropdown__menu--arrow-keys":this.isArrowKeyNav&&(!(`role`in n)||n.role===`menu`)}]}},dropdownListeners(){return{"update:open":e=>{this.$emit(`update:open`,e)},opened:e=>{this.updateInitialHighlightIndex(e)},keydown:t=>{let n=t.code,r=[e.EVENT_KEYNAMES.up,e.EVENT_KEYNAMES.arrowup,e.EVENT_KEYNAMES.down,e.EVENT_KEYNAMES.arrowdown].includes(n);if(this.forwardAnchorArrowKeys&&this.open!==null&&!this.isLogicallyOpen&&r&&this.$refs.popover?.$refs.anchor?.contains(t.target)){let e=Symbol(`arrow-opening`);this.pendingArrowOpening=e,this.openedWithKeyboard=!0,this.$emit(`keydown`,t),this.$nextTick(()=>{this.pendingArrowOpening===e&&!this.isLogicallyOpen&&(this.openedWithKeyboard=!1)});return}switch(n){case e.EVENT_KEYNAMES.up:case e.EVENT_KEYNAMES.arrowup:this.onUpKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.down:case e.EVENT_KEYNAMES.arrowdown:this.onDownKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.space:case e.EVENT_KEYNAMES.spacebar:this.onSpaceKey();break;case e.EVENT_KEYNAMES.enter:this.onEnterKey();break;case e.EVENT_KEYNAMES.home:this.onHomeKeyPress(t),t.stopPropagation(),t.preventDefault();break;case e.EVENT_KEYNAMES.end:this.onEndKeyPress(t),t.stopPropagation(),t.preventDefault();break;default:this.onKeyPress(t);break}this.$emit(`keydown`,t)}}},beginningOfListMethod(){return this.onBeginningOfList||this.onBeginningOfMenu},endOfListMethod(){return this.onEndOfList||this.onEndOfMenu},activeItemEl(){return this.highlightId&&this._getListItemNodes()?.find(e=>e.id===this.highlightId)||null},isArrowKeyNav(){return this.navigationType===this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS},listClasses(){return[`d-dropdown-list`,c.DROPDOWN_PADDING_CLASSES[this.padding],this.listClass,{"d-context-menu-list":this.openOnContext}]},shouldOpenWithArrowKeys(){return!this.openOnContext}},methods:{onVisibilityChange(e){this.isLogicallyOpen=e,this.visibilityChangeCallback?.(e)},onMouseHighlight(e){let t=e.target.closest(`li`);t?.role&&t.id&&this.highlightId!==t.id&&(this.setHighlightId(t.id),this._getListItemNodes()?.includes(t)&&t.focus())},getListElement(){return this.$refs.listWrapper},getMenuCloseButton(){let e=this.$refs.popover;return e?.role===`menu`?e.getCloseButtonElement():null},isMenuCloseFocused(){let e=this.getMenuCloseButton();return e&&e.getRootNode().activeElement===e},focusMenuClose(){let e=this.getMenuCloseButton();return e?(this.highlightIndex=-1,this.highlightId=``,e.focus(),!0):!1},onBeginningOfMenu(){this.focusMenuClose()||this.jumpToEnd()},onEndOfMenu(){this.focusMenuClose()||this.jumpToBeginning()},clearHighlightIndex(){this.setHighlightIndex(-1)},afterHighlight(){this.highlightIndex!==this._itemsLength()-1&&this.$emit(`highlight`,this.highlightIndex)},updateInitialHighlightIndex(e){this.isOpen=e,e?(this.openedWithKeyboard&&this.isArrowKeyNav&&(this._itemsLength()||!this.focusMenuClose())&&this.setHighlightIndex(0),this.$emit(`opened`,!0)):(this.clearHighlightIndex(),this.openedWithKeyboard=!1,this.$emit(`opened`,!1))},onSpaceKey(){this.open||(this.openedWithKeyboard=!0)},onEnterKey(){this.open||(this.openedWithKeyboard=!0)},onUpKeyPress(){if(!this.isOpen){this.openedWithKeyboard=!0;return}if(this.isArrowKeyNav)return this.isMenuCloseFocused()?this.onEndKey():this.onUpKey()},onDownKeyPress(){if(!this.isOpen){this.openedWithKeyboard=!0;return}if(this.isArrowKeyNav)return this.isMenuCloseFocused()?this.onHomeKey():this.onDownKey()},onHomeKeyPress(){if(!(!this.isOpen||!this.isArrowKeyNav)&&!(!this._itemsLength()&&this.focusMenuClose()))return this.onHomeKey()},onEndKeyPress(){if(!(!this.isOpen||!this.isArrowKeyNav)&&!this.focusMenuClose())return this.onEndKey()},onKeyPress(e){if(!(!this.isOpen||!this.isArrowKeyNav||!this.isValidLetter(e.key)))return e.stopPropagation(),e.preventDefault(),this.onNavigationKey(e.key)}}},d=[`id`];function f(e,t,n,r,i,a){let o=(0,l.resolveComponent)(`dt-popover`);return(0,l.openBlock)(),(0,l.createBlock)(o,(0,l.mergeProps)({ref:`popover`,"content-width":n.contentWidth,"content-mode":n.contentMode,open:n.open,"forward-anchor-arrow-keys":n.forwardAnchorArrowKeys,"visibility-change-callback":a.onVisibilityChange,placement:n.placement,"initial-focus-element":i.openedWithKeyboard?`first`:`dialog`,"fallback-placements":n.fallbackPlacements,padding:`none`,role:`menu`,"append-to":n.appendTo,modal:n.modal,"max-height":n.maxHeight,"max-width":n.maxWidth,"open-with-arrow-keys":a.shouldOpenWithArrowKeys,"open-on-context":n.openOnContext},a.popoverAttrs,{tether:n.tether,transition:n.transition,"footer-class":n.footerClass},(0,l.toHandlers)(a.dropdownListeners)),{anchor:(0,l.withCtx)(({attrs:t})=>[(0,l.renderSlot)(e.$slots,`anchor`,(0,l.mergeProps)({ref:`anchor`},t))]),content:(0,l.withCtx)(({close:r})=>[(0,l.createElementVNode)(`ul`,{id:n.listId,ref:`listWrapper`,role:`none`,class:(0,l.normalizeClass)(a.listClasses),"data-qa":`dt-dropdown-list-wrapper`,onMouseleave:t[0]||(t[0]=(...e)=>a.clearHighlightIndex&&a.clearHighlightIndex(...e)),onMousemoveCapture:t[1]||(t[1]=(...e)=>a.onMouseHighlight&&a.onMouseHighlight(...e))},[(0,l.renderSlot)(e.$slots,`list`,{close:r})],42,d)]),footerContent:(0,l.withCtx)(({close:t})=>[(0,l.renderSlot)(e.$slots,`footer`,{close:t})]),_:3},16,[`content-width`,`content-mode`,`open`,`forward-anchor-arrow-keys`,`visibility-change-callback`,`placement`,`initial-focus-element`,`fallback-placements`,`append-to`,`modal`,`max-height`,`max-width`,`open-with-arrow-keys`,`open-on-context`,`tether`,`transition`,`footer-class`])}var p=n.t(u,[[`render`,f]]);exports.default=p;
2
2
  //# sourceMappingURL=dropdown.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown.cjs","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"$attrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!-- @slot Anchor element that activates the dropdown -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: 'menuitem',\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"placement\",\n * it will attempt to change it's direction to the \"fallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired when dropdown is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n isOpen: null,\n };\n },\n\n computed: {\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.jumpToEnd;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.jumpToBeginning;\n },\n\n activeItemEl () {\n return this.getListElement().querySelector('#' + this.highlightId);\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement && liElement.role && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script>\n"],"mappings":"ukBAqEA,IAAK,EAAU,CACb,KAAM,aAEN,WAAY,CACV,UAAA,EAAA,QACD,CAED,OAAQ,CACN,EAAA,QAAmB,CACjB,SAAU,iBACV,MAAO,cACP,eAAgB,iBAChB,aAAc,WACd,qBAAsB,iBACtB,sBAAuB,wBACvB,gBAAiB,kBACjB,cAAe,eACf,0BAA2B,GAC5B,CAAC,CACH,CAED,aAAc,GAEd,MAAO,CAKL,YAAa,EAAA,EAQb,KAAM,CACJ,KAAM,CAAC,QAAS,KAAK,CACrB,QAAS,KACV,CAMD,cAAe,CACb,KAAM,QACN,QAAS,GACV,CAMD,QAAS,CACP,KAAM,OACN,QAAS,QACT,UAAY,GACH,OAAO,KAAK,EAAA,yBAAyB,CAAC,KAAM,GAAS,IAAS,EAAQ,CAEhF,CAMD,MAAO,CACL,KAAM,QACN,QAAS,GACV,CAOD,aAAc,CACZ,KAAM,OACN,QAAS,KACV,CAMD,UAAW,CACT,KAAM,OACN,QAAS,GACV,CAMD,SAAU,CACR,KAAM,OACN,QAAS,GACV,CAMD,OAAQ,CACN,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CASD,eAAgB,CACd,KAAM,OACN,QAAS,EAAA,2BAA2B,WACpC,UAAY,GAAM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,EAAA,oBAgBpB,KAAA,CAZF,GAAI,EAAA,OACL,IAAI,cACH,OAAA,EAAA,EAAA,gBAAO,EAAA,YAAW,CACnB,UAAQ,2BACP,aAAU,EAAA,KAAA,EAAA,IAAA,GAAA,IAAE,EAAA,qBAAA,EAAA,oBAAA,GAAA,EAAmB,yCACZ,EAAA,kBAAA,EAAA,iBAAA,GAAA,EAAgB,qBAMlC,EAAA,OAAA,OAAA,CADQ,QAAK,CAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA,CAIR,eAAA,EAAA,EAAA,UAKP,CALwB,WAAK,EAAA,EAAA,EAAA,YAK7B,EAAA,OAAA,SAAA,CADQ,QAAK,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"dropdown.cjs","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :forward-anchor-arrow-keys=\"forwardAnchorArrowKeys\"\n :visibility-change-callback=\"onVisibilityChange\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"popoverAttrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!--\n @slot Dropdown trigger. Bind the three ARIA slot props individually to the trigger to preserve consumer refs.\n @binding {string} ref Internal ref key. Do not forward it to the trigger.\n @binding {string} aria-expanded Whether the dropdown is open, as \"true\" or \"false\".\n @binding {string} aria-controls ID of the popup element with role=\"menu\".\n @binding {string} aria-haspopup Popup role, \"menu\".\n -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n role=\"none\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: ['menuitem', 'menuitemradio'],\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Optional callback receiving the open boolean synchronously on logical visibility changes.\n * Includes initial true during creation, before mount, when open=true.\n * Does not declare or emit an open-change event.\n * For modal removal, keep modal=true, its anchor and scroll container unchanged until opened(false).\n * Changing modal or the anchor's scroll context after opening can retain the original lock.\n * opened(false) reports transition completion, not global scroll-lock ownership.\n * A closed modal with no pending transition or retained scroll lock can be removed immediately.\n * Defer direct app.unmount() until Vue's next tick.\n */\n visibilityChangeCallback: {\n type: Function,\n default: null,\n },\n\n /**\n * Forwards anchor ArrowUp/ArrowDown with a boolean open prop without toggling.\n * Closed anchor arrows retain their default action and propagation for consumer handling.\n * Accept opening synchronously in the emitted keydown callback for first-row focus.\n * @values true, false\n */\n forwardAnchorArrowKeys: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"placement\",\n * it will attempt to change it's direction to the \"fallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired after the current transition and initial focus work complete\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n pendingArrowOpening: null,\n isOpen: null,\n isLogicallyOpen: false,\n };\n },\n\n computed: {\n popoverAttrs () {\n const { dialogClass, 'dialog-class': kebabDialogClass, ...attrs } = this.$attrs;\n return {\n ...attrs,\n dialogClass: [dialogClass, kebabDialogClass, {\n 'd-dropdown__menu--arrow-keys': this.isArrowKeyNav && (!('role' in attrs) || attrs.role === 'menu'),\n }],\n };\n },\n\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n const isArrow = [EVENT_KEYNAMES.up, EVENT_KEYNAMES.arrowup,\n EVENT_KEYNAMES.down, EVENT_KEYNAMES.arrowdown].includes(eventCode);\n\n if (this.forwardAnchorArrowKeys && this.open !== null && !this.isLogicallyOpen && isArrow &&\n this.$refs.popover?.$refs.anchor?.contains(event.target)) {\n const pending = Symbol('arrow-opening');\n this.pendingArrowOpening = pending;\n this.openedWithKeyboard = true;\n this.$emit('keydown', event);\n // Let synchronous acceptance in the emitted handler flush before discarding ignored modality.\n this.$nextTick(() => {\n if (this.pendingArrowOpening === pending && !this.isLogicallyOpen) {\n this.openedWithKeyboard = false;\n }\n });\n return;\n }\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.onBeginningOfMenu;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.onEndOfMenu;\n },\n\n activeItemEl () {\n if (!this.highlightId) return null;\n return this._getListItemNodes()?.find(item => item.id === this.highlightId) || null;\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onVisibilityChange (isOpen) {\n this.isLogicallyOpen = isOpen;\n this.visibilityChangeCallback?.(isOpen);\n },\n\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement?.role && liElement.id && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n if (this._getListItemNodes()?.includes(liElement)) liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n getMenuCloseButton () {\n const popover = this.$refs.popover;\n return popover?.role === 'menu' ? popover.getCloseButtonElement() : null;\n },\n\n isMenuCloseFocused () {\n const closeButton = this.getMenuCloseButton();\n return closeButton && closeButton.getRootNode().activeElement === closeButton;\n },\n\n focusMenuClose () {\n const closeButton = this.getMenuCloseButton();\n if (!closeButton) return false;\n // Close has no application row index and must not emit a choice highlight.\n this.highlightIndex = -1;\n this.highlightId = '';\n closeButton.focus();\n return true;\n },\n\n onBeginningOfMenu () {\n if (!this.focusMenuClose()) this.jumpToEnd();\n },\n\n onEndOfMenu () {\n if (!this.focusMenuClose()) this.jumpToBeginning();\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n if (this._itemsLength() || !this.focusMenuClose()) this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n if (this.isMenuCloseFocused()) return this.onEndKey();\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n if (this.isMenuCloseFocused()) return this.onHomeKey();\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n if (!this._itemsLength() && this.focusMenuClose()) return;\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n if (this.focusMenuClose()) return;\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script>\n"],"mappings":"ukBA8EA,IAAK,EAAU,CACb,KAAM,aAEN,WAAY,CACV,UAAA,EAAA,QACD,CAED,OAAQ,CACN,EAAA,QAAmB,CACjB,SAAU,iBACV,MAAO,cACP,eAAgB,iBAChB,aAAc,CAAC,WAAY,gBAAgB,CAC3C,qBAAsB,iBACtB,sBAAuB,wBACvB,gBAAiB,kBACjB,cAAe,eACf,0BAA2B,GAC5B,CAAC,CACH,CAED,aAAc,GAEd,MAAO,CAKL,YAAa,EAAA,EAQb,KAAM,CACJ,KAAM,CAAC,QAAS,KAAK,CACrB,QAAS,KACV,CAYD,yBAA0B,CACxB,KAAM,SACN,QAAS,KACV,CAQD,uBAAwB,CACtB,KAAM,QACN,QAAS,GACV,CAMD,cAAe,CACb,KAAM,QACN,QAAS,GACV,CAMD,QAAS,CACP,KAAM,OACN,QAAS,QACT,UAAY,GACH,OAAO,KAAK,EAAA,yBAAyB,CAAC,KAAM,GAAS,IAAS,EAAQ,CAEhF,CAMD,MAAO,CACL,KAAM,QACN,QAAS,GACV,CAOD,aAAc,CACZ,KAAM,OACN,QAAS,KACV,CAMD,UAAW,CACT,KAAM,OACN,QAAS,GACV,CAMD,SAAU,CACR,KAAM,OACN,QAAS,GACV,CAMD,OAAQ,CACN,KAAM,OACN,SAAW,CAAE,OAAO,EAAA,iBAAiB,EACtC,CASD,eAAgB,CACd,KAAM,OACN,QAAS,EAAA,2BAA2B,WACpC,UAAY,GAAM,OAAO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AAc,EAAA,8BACS,EAAlB,kBAAiB,CAAA,CAAA,CAEZ,QAAA,EAAA,EAAA,UAYP,CAZiB,WAAK,EAAA,EAAA,EAAA,YAYtB,EAAA,OAAA,UAAA,EAAA,EAAA,YAAA,CAHA,IAAI,SAAQ,CAEJ,EAAK,CAAA,CAAA,CAAA,CAGN,SAAA,EAAA,EAAA,UAiBJ,CAjBe,WAAK,EAAA,EAAA,EAAA,oBAiBpB,KAAA,CAbF,GAAI,EAAA,OACL,IAAI,cACJ,KAAK,OACJ,OAAA,EAAA,EAAA,gBAAO,EAAA,YAAW,CACnB,UAAQ,2BACP,aAAU,EAAA,KAAA,EAAA,IAAA,GAAA,IAAE,EAAA,qBAAA,EAAA,oBAAA,GAAA,EAAmB,yCACZ,EAAA,kBAAA,EAAA,iBAAA,GAAA,EAAgB,qBAMlC,EAAA,OAAA,OAAA,CADQ,QAAK,CAAA,CAAA,CAAA,GAAA,EAAA,CAAA,CAAA,CAIR,eAAA,EAAA,EAAA,UAKP,CALwB,WAAK,EAAA,EAAA,EAAA,YAK7B,EAAA,OAAA,SAAA,CADQ,QAAK,CAAA,CAAA,CAAA"}
@@ -16,7 +16,7 @@ var y = {
16
16
  indexKey: "highlightIndex",
17
17
  idKey: "highlightId",
18
18
  listElementKey: "getListElement",
19
- listItemRole: "menuitem",
19
+ listItemRole: ["menuitem", "menuitemradio"],
20
20
  afterHighlightMethod: "afterHighlight",
21
21
  beginningOfListMethod: "beginningOfListMethod",
22
22
  endOfListMethod: "endOfListMethod",
@@ -30,6 +30,14 @@ var y = {
30
30
  type: [Boolean, null],
31
31
  default: null
32
32
  },
33
+ visibilityChangeCallback: {
34
+ type: Function,
35
+ default: null
36
+ },
37
+ forwardAnchorArrowKeys: {
38
+ type: Boolean,
39
+ default: !1
40
+ },
33
41
  openOnContext: {
34
42
  type: Boolean,
35
43
  default: !1
@@ -124,10 +132,23 @@ var y = {
124
132
  DROPDOWN_PADDING_CLASSES: l,
125
133
  EVENT_KEYNAMES: e,
126
134
  openedWithKeyboard: !1,
127
- isOpen: null
135
+ pendingArrowOpening: null,
136
+ isOpen: null,
137
+ isLogicallyOpen: !1
128
138
  };
129
139
  },
130
140
  computed: {
141
+ popoverAttrs() {
142
+ let { dialogClass: e, "dialog-class": t, ...n } = this.$attrs;
143
+ return {
144
+ ...n,
145
+ dialogClass: [
146
+ e,
147
+ t,
148
+ { "d-dropdown__menu--arrow-keys": this.isArrowKeyNav && (!("role" in n) || n.role === "menu") }
149
+ ]
150
+ };
151
+ },
131
152
  dropdownListeners() {
132
153
  return {
133
154
  "update:open": (e) => {
@@ -137,7 +158,20 @@ var y = {
137
158
  this.updateInitialHighlightIndex(e);
138
159
  },
139
160
  keydown: (t) => {
140
- switch (t.code) {
161
+ let n = t.code, r = [
162
+ e.up,
163
+ e.arrowup,
164
+ e.down,
165
+ e.arrowdown
166
+ ].includes(n);
167
+ if (this.forwardAnchorArrowKeys && this.open !== null && !this.isLogicallyOpen && r && this.$refs.popover?.$refs.anchor?.contains(t.target)) {
168
+ let e = Symbol("arrow-opening");
169
+ this.pendingArrowOpening = e, this.openedWithKeyboard = !0, this.$emit("keydown", t), this.$nextTick(() => {
170
+ this.pendingArrowOpening === e && !this.isLogicallyOpen && (this.openedWithKeyboard = !1);
171
+ });
172
+ return;
173
+ }
174
+ switch (n) {
141
175
  case e.up:
142
176
  case e.arrowup:
143
177
  this.onUpKeyPress(t), t.stopPropagation(), t.preventDefault();
@@ -168,13 +202,13 @@ var y = {
168
202
  };
169
203
  },
170
204
  beginningOfListMethod() {
171
- return this.onBeginningOfList || this.jumpToEnd;
205
+ return this.onBeginningOfList || this.onBeginningOfMenu;
172
206
  },
173
207
  endOfListMethod() {
174
- return this.onEndOfList || this.jumpToBeginning;
208
+ return this.onEndOfList || this.onEndOfMenu;
175
209
  },
176
210
  activeItemEl() {
177
- return this.getListElement().querySelector("#" + this.highlightId);
211
+ return this.highlightId && this._getListItemNodes()?.find((e) => e.id === this.highlightId) || null;
178
212
  },
179
213
  isArrowKeyNav() {
180
214
  return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;
@@ -192,13 +226,34 @@ var y = {
192
226
  }
193
227
  },
194
228
  methods: {
229
+ onVisibilityChange(e) {
230
+ this.isLogicallyOpen = e, this.visibilityChangeCallback?.(e);
231
+ },
195
232
  onMouseHighlight(e) {
196
233
  let t = e.target.closest("li");
197
- t && t.role && this.highlightId !== t.id && (this.setHighlightId(t.id), t.focus());
234
+ t?.role && t.id && this.highlightId !== t.id && (this.setHighlightId(t.id), this._getListItemNodes()?.includes(t) && t.focus());
198
235
  },
199
236
  getListElement() {
200
237
  return this.$refs.listWrapper;
201
238
  },
239
+ getMenuCloseButton() {
240
+ let e = this.$refs.popover;
241
+ return e?.role === "menu" ? e.getCloseButtonElement() : null;
242
+ },
243
+ isMenuCloseFocused() {
244
+ let e = this.getMenuCloseButton();
245
+ return e && e.getRootNode().activeElement === e;
246
+ },
247
+ focusMenuClose() {
248
+ let e = this.getMenuCloseButton();
249
+ return e ? (this.highlightIndex = -1, this.highlightId = "", e.focus(), !0) : !1;
250
+ },
251
+ onBeginningOfMenu() {
252
+ this.focusMenuClose() || this.jumpToEnd();
253
+ },
254
+ onEndOfMenu() {
255
+ this.focusMenuClose() || this.jumpToBeginning();
256
+ },
202
257
  clearHighlightIndex() {
203
258
  this.setHighlightIndex(-1);
204
259
  },
@@ -206,7 +261,7 @@ var y = {
206
261
  this.highlightIndex !== this._itemsLength() - 1 && this.$emit("highlight", this.highlightIndex);
207
262
  },
208
263
  updateInitialHighlightIndex(e) {
209
- this.isOpen = e, e ? (this.openedWithKeyboard && this.isArrowKeyNav && this.setHighlightIndex(0), this.$emit("opened", !0)) : (this.clearHighlightIndex(), this.openedWithKeyboard = !1, this.$emit("opened", !1));
264
+ this.isOpen = e, e ? (this.openedWithKeyboard && this.isArrowKeyNav && (this._itemsLength() || !this.focusMenuClose()) && this.setHighlightIndex(0), this.$emit("opened", !0)) : (this.clearHighlightIndex(), this.openedWithKeyboard = !1, this.$emit("opened", !1));
210
265
  },
211
266
  onSpaceKey() {
212
267
  this.open || (this.openedWithKeyboard = !0);
@@ -219,20 +274,20 @@ var y = {
219
274
  this.openedWithKeyboard = !0;
220
275
  return;
221
276
  }
222
- if (this.isArrowKeyNav) return this.onUpKey();
277
+ if (this.isArrowKeyNav) return this.isMenuCloseFocused() ? this.onEndKey() : this.onUpKey();
223
278
  },
224
279
  onDownKeyPress() {
225
280
  if (!this.isOpen) {
226
281
  this.openedWithKeyboard = !0;
227
282
  return;
228
283
  }
229
- if (this.isArrowKeyNav) return this.onDownKey();
284
+ if (this.isArrowKeyNav) return this.isMenuCloseFocused() ? this.onHomeKey() : this.onDownKey();
230
285
  },
231
286
  onHomeKeyPress() {
232
- if (!(!this.isOpen || !this.isArrowKeyNav)) return this.onHomeKey();
287
+ if (!(!this.isOpen || !this.isArrowKeyNav) && !(!this._itemsLength() && this.focusMenuClose())) return this.onHomeKey();
233
288
  },
234
289
  onEndKeyPress() {
235
- if (!(!this.isOpen || !this.isArrowKeyNav)) return this.onEndKey();
290
+ if (!(!this.isOpen || !this.isArrowKeyNav) && !this.focusMenuClose()) return this.onEndKey();
236
291
  },
237
292
  onKeyPress(e) {
238
293
  if (!(!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key))) return e.stopPropagation(), e.preventDefault(), this.onNavigationKey(e.key);
@@ -246,6 +301,8 @@ function x(e, t, n, r, i, a) {
246
301
  "content-width": n.contentWidth,
247
302
  "content-mode": n.contentMode,
248
303
  open: n.open,
304
+ "forward-anchor-arrow-keys": n.forwardAnchorArrowKeys,
305
+ "visibility-change-callback": a.onVisibilityChange,
249
306
  placement: n.placement,
250
307
  "initial-focus-element": i.openedWithKeyboard ? "first" : "dialog",
251
308
  "fallback-placements": n.fallbackPlacements,
@@ -257,7 +314,7 @@ function x(e, t, n, r, i, a) {
257
314
  "max-width": n.maxWidth,
258
315
  "open-with-arrow-keys": a.shouldOpenWithArrowKeys,
259
316
  "open-on-context": n.openOnContext
260
- }, e.$attrs, {
317
+ }, a.popoverAttrs, {
261
318
  tether: n.tether,
262
319
  transition: n.transition,
263
320
  "footer-class": n.footerClass
@@ -266,6 +323,7 @@ function x(e, t, n, r, i, a) {
266
323
  content: v(({ close: r }) => [d("ul", {
267
324
  id: n.listId,
268
325
  ref: "listWrapper",
326
+ role: "none",
269
327
  class: p(a.listClasses),
270
328
  "data-qa": "dt-dropdown-list-wrapper",
271
329
  onMouseleave: t[0] || (t[0] = (...e) => a.clearHighlightIndex && a.clearHighlightIndex(...e)),
@@ -277,6 +335,8 @@ function x(e, t, n, r, i, a) {
277
335
  "content-width",
278
336
  "content-mode",
279
337
  "open",
338
+ "forward-anchor-arrow-keys",
339
+ "visibility-change-callback",
280
340
  "placement",
281
341
  "initial-focus-element",
282
342
  "fallback-placements",
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown.js","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"$attrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!-- @slot Anchor element that activates the dropdown -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: 'menuitem',\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"placement\",\n * it will attempt to change it's direction to the \"fallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired when dropdown is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n isOpen: null,\n };\n },\n\n computed: {\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.jumpToEnd;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.jumpToBeginning;\n },\n\n activeItemEl () {\n return this.getListElement().querySelector('#' + this.highlightId);\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement && liElement.role && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;AAqEA,IAAK,IAAU;CACb,MAAM;CAEN,YAAY,EACV,WAAA,GACD;CAED,QAAQ,CACN,EAAmB;EACjB,UAAU;EACV,OAAO;EACP,gBAAgB;EAChB,cAAc;EACd,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,eAAe;EACf,2BAA2B;EAC5B,CAAC,CACH;CAED,cAAc;CAEd,OAAO;EAKL,aAAa;EAQb,MAAM;GACJ,MAAM,CAAC,SAAS,KAAK;GACrB,SAAS;GACV;EAMD,eAAe;GACb,MAAM;GACN,SAAS;GACV;EAMD,SAAS;GACP,MAAM;GACN,SAAS;G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V,EAAA,QAAM;EACb,QAAQ,EAAA;EACR,YAAY,EAAA;EACZ,gBAAc,EAAA;IACf,EAAwB,EAAlB,kBAAiB,CAAA,EAAA;EAEZ,QAAM,GAMb,EANiB,eAAK,CAExB,EAIE,EAAA,QAAA,UAJF,EAIE,EAHA,KAAI,UAAQ,EAEJ,EAAK,CAAA,CAAA,CAAA;EAGN,SAAO,GAgBX,EAhBe,eAAK,CAGzB,EAaK,MAAA;GAZF,IAAI,EAAA;GACL,KAAI;GACH,OAAK,EAAE,EAAA,YAAW;GACnB,WAAQ;GACP,cAAU,EAAA,OAAA,EAAA,MAAA,GAAA,MAAE,EAAA,uBAAA,EAAA,oBAAA,GAAA,EAAmB;iDACZ,EAAA,oBAAA,EAAA,iBAAA,GAAA,EAAgB;MAGpC,EAGE,EAAA,QAAA,QAAA,EADQ,UAAK,CAAA,CAAA,EAAA,IAAA,EAAA,CAAA,CAAA;EAIR,eAAa,GAKpB,EALwB,eAAK,CAE/B,EAGE,EAAA,QAAA,UAAA,EADQ,UAAK,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"dropdown.js","names":[],"sources":["../../../components/Dropdown/Dropdown.vue"],"sourcesContent":["<!-- eslint-disable max-lines -->\n<template>\n <dt-popover\n ref=\"popover\"\n :content-width=\"contentWidth\"\n :content-mode=\"contentMode\"\n :open=\"open\"\n :forward-anchor-arrow-keys=\"forwardAnchorArrowKeys\"\n :visibility-change-callback=\"onVisibilityChange\"\n :placement=\"placement\"\n :initial-focus-element=\"openedWithKeyboard ? 'first' : 'dialog'\"\n :fallback-placements=\"fallbackPlacements\"\n padding=\"none\"\n role=\"menu\"\n :append-to=\"appendTo\"\n :modal=\"modal\"\n :max-height=\"maxHeight\"\n :max-width=\"maxWidth\"\n :open-with-arrow-keys=\"shouldOpenWithArrowKeys\"\n :open-on-context=\"openOnContext\"\n v-bind=\"popoverAttrs\"\n :tether=\"tether\"\n :transition=\"transition\"\n :footer-class=\"footerClass\"\n v-on=\"dropdownListeners\"\n >\n <template #anchor=\"{ attrs }\">\n <!--\n @slot Dropdown trigger. Bind the three ARIA slot props individually to the trigger to preserve consumer refs.\n @binding {string} ref Internal ref key. Do not forward it to the trigger.\n @binding {string} aria-expanded Whether the dropdown is open, as \"true\" or \"false\".\n @binding {string} aria-controls ID of the popup element with role=\"menu\".\n @binding {string} aria-haspopup Popup role, \"menu\".\n -->\n <slot\n ref=\"anchor\"\n name=\"anchor\"\n v-bind=\"attrs\"\n />\n </template>\n <template #content=\"{ close }\">\n <!-- eslint-disable-next-line max-len -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events vuejs-accessibility/no-static-element-interactions -->\n <ul\n :id=\"listId\"\n ref=\"listWrapper\"\n role=\"none\"\n :class=\"listClasses\"\n data-qa=\"dt-dropdown-list-wrapper\"\n @mouseleave=\"clearHighlightIndex\"\n @mousemove.capture=\"onMouseHighlight\"\n >\n <!-- @slot Slot for the list component -->\n <slot\n name=\"list\"\n :close=\"close\"\n />\n </ul>\n </template>\n <template #footerContent=\"{ close }\">\n <!-- @slot Slot for the footer content -->\n <slot\n name=\"footer\"\n :close=\"close\"\n />\n </template>\n </dt-popover>\n</template>\n\n<script>\nimport KeyboardNavigation from '@/common/mixins/keyboard_list_navigation';\nimport { DtPopover, POPOVER_APPEND_TO_VALUES } from '@/components/Popover';\nimport { LIST_ITEM_NAVIGATION_TYPES } from '@/components/ListItem';\nimport { DROPDOWN_PADDING_CLASSES } from './DropdownConstants';\nimport { getUniqueString } from '@/common/utils';\nimport { EVENT_KEYNAMES, HTML_ELEMENT_TYPE } from '@/common/constants';\nimport { CONTENT_MODE_PROP } from '@/common/mode_constants';\n\nexport default {\n name: 'DtDropdown',\n\n components: {\n DtPopover,\n },\n\n mixins: [\n KeyboardNavigation({\n indexKey: 'highlightIndex',\n idKey: 'highlightId',\n listElementKey: 'getListElement',\n listItemRole: ['menuitem', 'menuitemradio'],\n afterHighlightMethod: 'afterHighlight',\n beginningOfListMethod: 'beginningOfListMethod',\n endOfListMethod: 'endOfListMethod',\n activeItemKey: 'activeItemEl',\n focusOnKeyboardNavigation: true,\n }),\n ],\n\n inheritAttrs: false,\n\n props: {\n /**\n * Applies a color mode to the positioned content element.\n * @values light, dark, invert\n */\n contentMode: CONTENT_MODE_PROP,\n\n /**\n * Controls whether the dropdown is shown. When null (default), the dropdown\n * toggles on click. When set to true or false, the default trigger is\n * disabled and the parent controls visibility via v-model:open.\n * @values null, true, false\n */\n open: {\n type: [Boolean, null],\n default: null,\n },\n\n /**\n * Optional callback receiving the open boolean synchronously on logical visibility changes.\n * Includes initial true during creation, before mount, when open=true.\n * Does not declare or emit an open-change event.\n * For modal removal, keep modal=true, its anchor and scroll container unchanged until opened(false).\n * Changing modal or the anchor's scroll context after opening can retain the original lock.\n * opened(false) reports transition completion, not global scroll-lock ownership.\n * A closed modal with no pending transition or retained scroll lock can be removed immediately.\n * Defer direct app.unmount() until Vue's next tick.\n */\n visibilityChangeCallback: {\n type: Function,\n default: null,\n },\n\n /**\n * Forwards anchor ArrowUp/ArrowDown with a boolean open prop without toggling.\n * Closed anchor arrows retain their default action and propagation for consumer handling.\n * Accept opening synchronously in the emitted keydown callback for first-row focus.\n * @values true, false\n */\n forwardAnchorArrowKeys: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Opens the dropdown on right click (context menu). If you set this value to `true`,\n * the default trigger behavior will be disabled.\n */\n openOnContext: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Vertical padding size around the list element.\n * @values none, small, large\n */\n padding: {\n type: String,\n default: 'small',\n validator: (padding) => {\n return Object.keys(DROPDOWN_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * Determines modal state, dropdown has a modal overlay preventing interaction with elements\n * below it, but it is invisible.\n */\n modal: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Width configuration for the popover content. When its value is 'anchor',\n * the popover content will have the same width as the anchor.\n * @values null, anchor\n */\n contentWidth: {\n type: String,\n default: null,\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n maxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n maxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Sets an ID on the list element of the component. Used by several aria attributes\n * as well as when deriving the IDs for each item.\n */\n listId: {\n type: String,\n default () { return getUniqueString(); },\n },\n\n /**\n * The type of navigation that this component should support.\n * - \"arrow-keys\" for items that are navigated with UP/DOWN keys.\n * - \"tab\" for items that are navigated using the TAB key.\n * - \"none\" for static items that are not interactive.\n * @values arrow-keys, tab, none\n */\n navigationType: {\n type: String,\n default: LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS,\n validator: (t) => Object.values(LIST_ITEM_NAVIGATION_TYPES).includes(t),\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"placement\",\n * it will attempt to change it's direction to the \"fallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n fallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * The direction the dropdown displays relative to the anchor.\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n placement: {\n type: String,\n default: 'bottom',\n },\n\n /**\n * A method that will be called when the selection goes past the beginning of the list.\n */\n onBeginningOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * A method that will be called when the selection goes past the end of the list.\n */\n onEndOfList: {\n type: Function,\n default: null,\n },\n\n /**\n * Additional class for the wrapper list element.\n */\n listClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Additional class for the footer wrapper element.\n */\n footerClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Sets the element to which the popover is going to append to.\n * 'body' will append to the nearest body (supports shadow DOM).\n * @values 'body', 'parent', 'root', HTMLElement,\n */\n appendTo: {\n type: [HTML_ELEMENT_TYPE, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If set to false the dialog will display over top of the anchor when there is insufficient space.\n * If set to true it will never move from its position relative to the anchor and will clip instead.\n * <a\n * class=\"d-link\"\n * href=\"https://popper.js.org/docs/v2/modifiers/prevent-overflow/#tether\"\n * target=\"_blank\"\n * >\n * Popper.js docs\n * </a>\n * @values true, false\n */\n tether: {\n type: Boolean,\n default: true,\n },\n\n /**\n * Named transition when the content display is toggled.\n * @see DtLazyShow\n */\n transition: {\n type: String,\n default: 'fade',\n },\n },\n\n emits: [\n /**\n * Native keydown event\n *\n * @event keydown\n * @type {KeyboardEvent}\n */\n 'keydown',\n\n /**\n * Event fired when the highlight changes\n *\n * @event highlight\n * @type {Number}\n */\n 'highlight',\n\n /**\n * Event fired to sync the open prop with the parent component\n * @event update:open\n */\n 'update:open',\n\n /**\n * Event fired after the current transition and initial focus work complete\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'opened',\n\n ],\n\n data () {\n return {\n LIST_ITEM_NAVIGATION_TYPES,\n DROPDOWN_PADDING_CLASSES,\n EVENT_KEYNAMES,\n openedWithKeyboard: false,\n pendingArrowOpening: null,\n isOpen: null,\n isLogicallyOpen: false,\n };\n },\n\n computed: {\n popoverAttrs () {\n const { dialogClass, 'dialog-class': kebabDialogClass, ...attrs } = this.$attrs;\n return {\n ...attrs,\n dialogClass: [dialogClass, kebabDialogClass, {\n 'd-dropdown__menu--arrow-keys': this.isArrowKeyNav && (!('role' in attrs) || attrs.role === 'menu'),\n }],\n };\n },\n\n dropdownListeners () {\n return {\n\n 'update:open': value => {\n this.$emit('update:open', value);\n },\n\n opened: isPopoverOpen => {\n this.updateInitialHighlightIndex(isPopoverOpen);\n },\n\n keydown: event => {\n const eventCode = event.code;\n const isArrow = [EVENT_KEYNAMES.up, EVENT_KEYNAMES.arrowup,\n EVENT_KEYNAMES.down, EVENT_KEYNAMES.arrowdown].includes(eventCode);\n\n if (this.forwardAnchorArrowKeys && this.open !== null && !this.isLogicallyOpen && isArrow &&\n this.$refs.popover?.$refs.anchor?.contains(event.target)) {\n const pending = Symbol('arrow-opening');\n this.pendingArrowOpening = pending;\n this.openedWithKeyboard = true;\n this.$emit('keydown', event);\n // Let synchronous acceptance in the emitted handler flush before discarding ignored modality.\n this.$nextTick(() => {\n if (this.pendingArrowOpening === pending && !this.isLogicallyOpen) {\n this.openedWithKeyboard = false;\n }\n });\n return;\n }\n\n switch (eventCode) {\n case EVENT_KEYNAMES.up:\n case EVENT_KEYNAMES.arrowup:\n this.onUpKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.down:\n case EVENT_KEYNAMES.arrowdown:\n this.onDownKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.space:\n case EVENT_KEYNAMES.spacebar:\n this.onSpaceKey();\n break;\n case EVENT_KEYNAMES.enter:\n this.onEnterKey();\n break;\n case EVENT_KEYNAMES.home:\n this.onHomeKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n case EVENT_KEYNAMES.end:\n this.onEndKeyPress(event);\n event.stopPropagation();\n event.preventDefault();\n break;\n default:\n this.onKeyPress(event);\n break;\n }\n\n this.$emit('keydown', event);\n },\n };\n },\n\n beginningOfListMethod () {\n return this.onBeginningOfList || this.onBeginningOfMenu;\n },\n\n endOfListMethod () {\n return this.onEndOfList || this.onEndOfMenu;\n },\n\n activeItemEl () {\n if (!this.highlightId) return null;\n return this._getListItemNodes()?.find(item => item.id === this.highlightId) || null;\n },\n\n isArrowKeyNav () {\n return this.navigationType === this.LIST_ITEM_NAVIGATION_TYPES.ARROW_KEYS;\n },\n\n listClasses () {\n return [\n 'd-dropdown-list',\n DROPDOWN_PADDING_CLASSES[this.padding],\n this.listClass,\n { 'd-context-menu-list': this.openOnContext },\n ];\n },\n\n shouldOpenWithArrowKeys () {\n return !this.openOnContext;\n },\n },\n\n methods: {\n onVisibilityChange (isOpen) {\n this.isLogicallyOpen = isOpen;\n this.visibilityChangeCallback?.(isOpen);\n },\n\n onMouseHighlight (e) {\n const liElement = e.target.closest('li');\n\n if (liElement?.role && liElement.id && this.highlightId !== liElement.id) {\n this.setHighlightId(liElement.id);\n if (this._getListItemNodes()?.includes(liElement)) liElement.focus();\n }\n },\n\n getListElement () {\n return this.$refs.listWrapper;\n },\n\n getMenuCloseButton () {\n const popover = this.$refs.popover;\n return popover?.role === 'menu' ? popover.getCloseButtonElement() : null;\n },\n\n isMenuCloseFocused () {\n const closeButton = this.getMenuCloseButton();\n return closeButton && closeButton.getRootNode().activeElement === closeButton;\n },\n\n focusMenuClose () {\n const closeButton = this.getMenuCloseButton();\n if (!closeButton) return false;\n // Close has no application row index and must not emit a choice highlight.\n this.highlightIndex = -1;\n this.highlightId = '';\n closeButton.focus();\n return true;\n },\n\n onBeginningOfMenu () {\n if (!this.focusMenuClose()) this.jumpToEnd();\n },\n\n onEndOfMenu () {\n if (!this.focusMenuClose()) this.jumpToBeginning();\n },\n\n clearHighlightIndex () {\n this.setHighlightIndex(-1);\n },\n\n afterHighlight () {\n if (this.highlightIndex === this._itemsLength() - 1) {\n return;\n }\n\n this.$emit('highlight', this.highlightIndex);\n },\n\n updateInitialHighlightIndex (isPopoverOpen) {\n this.isOpen = isPopoverOpen;\n\n if (isPopoverOpen) {\n if (this.openedWithKeyboard && this.isArrowKeyNav) {\n if (this._itemsLength() || !this.focusMenuClose()) this.setHighlightIndex(0);\n }\n this.$emit('opened', true);\n } else {\n this.clearHighlightIndex();\n this.openedWithKeyboard = false;\n this.$emit('opened', false);\n }\n },\n\n onSpaceKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onEnterKey () {\n if (!this.open) {\n this.openedWithKeyboard = true;\n }\n },\n\n onUpKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n if (this.isMenuCloseFocused()) return this.onEndKey();\n return this.onUpKey();\n }\n },\n\n onDownKeyPress () {\n if (!this.isOpen) {\n this.openedWithKeyboard = true;\n return;\n }\n if (this.isArrowKeyNav) {\n if (this.isMenuCloseFocused()) return this.onHomeKey();\n return this.onDownKey();\n }\n },\n\n onHomeKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n if (!this._itemsLength() && this.focusMenuClose()) return;\n return this.onHomeKey();\n },\n\n onEndKeyPress () {\n if (!this.isOpen || !this.isArrowKeyNav) {\n return;\n }\n\n if (this.focusMenuClose()) return;\n return this.onEndKey();\n },\n\n onKeyPress (e) {\n if (!this.isOpen || !this.isArrowKeyNav || !this.isValidLetter(e.key)) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n\n return this.onNavigationKey(e.key);\n },\n },\n};\n</script>\n"],"mappings":";;;;;;;;;;;AA8EA,IAAK,IAAU;CACb,MAAM;CAEN,YAAY,EACV,WAAA,GACD;CAED,QAAQ,CACN,EAAmB;EACjB,UAAU;EACV,OAAO;EACP,gBAAgB;EAChB,cAAc,CAAC,YAAY,gBAAgB;EAC3C,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,eAAe;EACf,2BAA2B;EAC5B,CAAC,CACH;CAED,cAAc;CAEd,OAAO;EAKL,aAAa;EAQb,MAAM;GACJ,MAAM,CAAC,SAAS,KAAK;GACrB,SAAS;GACV;EAYD,0BAA0B;GACxB,MAAM;GACN,SAAS;GACV;EAQD,wBAAwB;GACtB,MAAM;GACN,SAAS;GACV;EAMD,eAAe;GACb,MAAM;GACN,SAAS;GACV;EAMD,SAAS;GACP,MAAM;GACN,SAAS;GACT,YAAY,MACH,OAAO,KAAK,EAAyB,CAAC,MAAM,MAAS,MAAS,EAAQ;GAEhF;EAMD,OAAO;GACL,MAAM;GACN,SAAS;GACV;EAOD,cAAc;GACZ,MAAM;GACN,SAAS;GACV;EAMD,WAAW;GACT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K;EACJ,aAAW,EAAA;EACX,OAAO,EAAA;EACP,cAAY,EAAA;EACZ,aAAW,EAAA;EACX,wBAAsB,EAAA;EACtB,mBAAiB,EAAA;IACV,EAAA,cAAY;EACnB,QAAQ,EAAA;EACR,YAAY,EAAA;EACZ,gBAAc,EAAA;IACf,EAAwB,EAAlB,kBAAiB,CAAA,EAAA;EAEZ,QAAM,GAYb,EAZiB,eAAK,CAQxB,EAIE,EAAA,QAAA,UAJF,EAIE,EAHA,KAAI,UAAQ,EAEJ,EAAK,CAAA,CAAA,CAAA;EAGN,SAAO,GAiBX,EAjBe,eAAK,CAGzB,EAcK,MAAA;GAbF,IAAI,EAAA;GACL,KAAI;GACJ,MAAK;GACJ,OAAK,EAAE,EAAA,YAAW;GACnB,WAAQ;GACP,cAAU,EAAA,OAAA,EAAA,MAAA,GAAA,MAAE,EAAA,uBAAA,EAAA,oBAAA,GAAA,EAAmB;iDACZ,EAAA,oBAAA,EAAA,iBAAA,GAAA,EAAgB;MAGpC,EAGE,EAAA,QAAA,QAAA,EADQ,UAAK,CAAA,CAAA,EAAA,IAAA,EAAA,CAAA,CAAA;EAIR,eAAa,GAKpB,EALwB,eAAK,CAE/B,EAGE,EAAA,QAAA,UAAA,EADQ,UAAK,CAAA,CAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=[`anchor`,...require(`../../common/constants/layout.cjs`).LAYOUT_SIZE_VALUES];exports.FILTER_PILL_OVERLAY_MIN_INLINE_SIZE_VALUES=e;
2
+ //# sourceMappingURL=filter-pill-constants.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-pill-constants.cjs","names":["LAYOUT_SIZE_VALUES"],"sources":["../../../components/FilterPill/FilterPillConstants.js"],"sourcesContent":["import { LAYOUT_SIZE_VALUES } from '@/common/constants';\n\nexport const FILTER_PILL_OVERLAY_MIN_INLINE_SIZE_VALUES = ['anchor', ...LAYOUT_SIZE_VALUES];\n"],"mappings":"mEAEA,IAAa,EAA6C,CAAC,SAAU,gDAAGA,mBAAmB"}
@@ -0,0 +1,7 @@
1
+ import { LAYOUT_SIZE_VALUES as e } from "../../common/constants/layout.js";
2
+ //#region components/FilterPill/FilterPillConstants.js
3
+ var t = ["anchor", ...e];
4
+ //#endregion
5
+ export { t as FILTER_PILL_OVERLAY_MIN_INLINE_SIZE_VALUES };
6
+
7
+ //# sourceMappingURL=filter-pill-constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-pill-constants.js","names":[],"sources":["../../../components/FilterPill/FilterPillConstants.js"],"sourcesContent":["import { LAYOUT_SIZE_VALUES } from '@/common/constants';\n\nexport const FILTER_PILL_OVERLAY_MIN_INLINE_SIZE_VALUES = ['anchor', ...LAYOUT_SIZE_VALUES];\n"],"mappings":";;AAEA,IAAa,IAA6C,CAAC,UAAU,GAAG,EAAmB"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../../common/utils/index.cjs`),t=require(`./filter-pill-selection.cjs`);var n=new Set([`options`,`selected`,`neutralValue`,`neutral-value`,`open`,`anchorEndClass`,`anchor-end-class`,`optionEndClass`,`option-end-class`,`headerContentClass`,`header-content-class`,`onUpdate:selected`,`onSelectionChange`,`onSelection-change`,`onUpdate:open`,`onOpened`]),r={data(){return{controlledAtBirth:Array.isArray(this.options),controlledDropdown:this.useDropdown,controlledDraft:null,checkboxRenderValues:[],draftBase:``,draftSession:0,reconciliation:0,applying:!1,controlledDisposed:!1,rejectedLockedOpen:!1,optionIds:new Map,controlledWarnings:new Set,clearFocusCandidate:null}},computed:{controlledState(){return t.getSelectionState(this.options,this.selected,{useDropdown:this.controlledDropdown,neutralValue:this.neutralValue})},controlledContractValid(){return Array.isArray(this.options)&&this.useDropdown===this.controlledDropdown},controlledCanSelect(){return this.controlledContractValid&&this.controlledState.valid&&!this.disabled&&!this.readOnly},controlledDeferred(){return!this.controlledDropdown&&this.deferSelection},controlledBase(){let e=this.controlledState;return JSON.stringify(Array.isArray(e.value)?[...e.value].sort():e.value)},controlledOptionValues(){return this.controlledState.options.map(e=>e.value)},controlledDisplayLabel(){let e=this.controlledState;if(!e.valid||!e.values.length)return this.label||``;if(this.controlledDropdown){let t=e.selectedOptions[0];return t?t.shortLabel??t.label:e.value===this.neutralValue?this.label||``:this.unavailableLabel}if(this.controlledAllSelected)return this.i18n.$t(`DIALTONE_FILTER_PILL_ALL_LABEL`);let t=e.values.map(t=>e.options.find(e=>e.value===t)).find(Boolean);return t?t.shortLabel??t.label:this.unavailableLabel},controlledAllSelected(){let e=this.controlledState;return!e.unknownValues.length&&e.options.length>1&&e.values.length===e.options.length},controlledDraftOpen(){return this.controlledDeferred&&this.isOpen&&this.controlledDraft!==null},controlledOverflow(){let e=this.controlledState;return!e.valid||this.controlledDropdown||e.value.length<=1||this.controlledAllSelected?``:`+${e.value.length-1}`},controlledAccessibleLabel(){let e=this.controlledDisplayLabel;return this.label?this.label===e?e:this.i18n.$t(`DIALTONE_FILTER_PILL_SELECTION_LABEL`,{label:this.label,selection:e}):e||this.i18n.$t(`DIALTONE_FILTER_PILL_FILTER_LABEL`)},unavailableLabel(){return this.i18n.$t(`DIALTONE_FILTER_PILL_UNAVAILABLE_LABEL`)},controlledAnchorBindings(){return{label:this.label,selected:t.selectionSnapshot(this.controlledState.value),selectedOptions:[...this.controlledState.selectedOptions],displayLabel:this.controlledDisplayLabel,isActive:this.isActive}},controlledContentBindings(){return{close:this.closeControlled,selected:t.selectionSnapshot(this.controlledState.value),pendingSelected:this.controlledDraft===null?null:[...this.controlledDraft],setSelected:this.setControlledSelected,apply:this.applySelection,cancel:this.cancelSelection}}},watch:{open(e){!this.controlledAtBirth||this.controlledDisposed||e===null||(e||(this.rejectedLockedOpen=!1),this.requestControlledOpen(e,!1))},deferSelection(){this.controlledAtBirth&&this.isOpen&&this.resetControlledDraft()},disabled(){this.closeWhenLocked()},readOnly(){this.closeWhenLocked()},options(){this.checkControlledConfiguration()},controlledOptionValues(e,t){if(this.controlledAtBirth){this.restoreRemovedOptionFocus(t),this.syncCheckboxRender();for(let t of this.optionIds.keys())e.includes(t)||this.optionIds.delete(t)}},useDropdown(){this.checkControlledConfiguration()},controlledBase(){this.controlledAtBirth&&(this.isOpen&&this.controlledDeferred&&this.rebaseControlledDraft(),this.syncCheckboxRender(),this.checkControlledConfiguration())},hasClear(e,t){if(!this.controlledAtBirth||!t||e||this.isOpen)return;let n=this.$refs.clearButton?.$el;document.activeElement===n&&(this.clearFocusCandidate=n,this.$nextTick(()=>{if(this.controlledDisposed||this.hasClear||this.disabled)return;let e=document.activeElement;(e===document.body||e===this.clearFocusCandidate)&&this.$refs.primaryButton?.$el?.focus(),this.clearFocusCandidate=null}))}},created(){if(this.checkControlledConfiguration(),!this.controlledAtBirth){let e={...this.$.emitsOptions};for(let t of[`update:selected`,`selection-change`,`update:open`,`opened`])delete e[t];this.$.emitsOptions=e;return}this.syncCheckboxRender(),this.open===!0&&this.requestControlledOpen(!0,!1)},updated(){this.checkControlledConfiguration()},beforeUnmount(){this.controlledDisposed=!0,this.reconciliation++,this.draftSession++},methods:{anchorAttributes(e){return this.overlayUseDropdown?this.controlledAtBirth?{"aria-expanded":e[`aria-expanded`],"aria-controls":e[`aria-controls`],"aria-haspopup":e[`aria-haspopup`]}:e:e.attrs},legacyRootAttrs(){return this.controlledAtBirth?{}:Object.fromEntries(Object.entries(this.$.vnode.props||{}).filter(([e])=>{let t=e.startsWith(`on`)?e.replace(/(?:Once|Passive|Capture)+$/,``):e;return n.has(t)}))},warnControlled(e){process.env.NODE_ENV===`production`||this.controlledWarnings.has(e)||(this.controlledWarnings.add(e),console.warn(`[Dialtone FilterPill] ${e}`))},checkControlledConfiguration(){if((Array.isArray(this.options)!==this.controlledAtBirth||this.controlledAtBirth&&this.useDropdown!==this.controlledDropdown)&&(this.warnControlled(`Selection contract and controlled useDropdown cannot change in place; remount with a key.`),this.controlledAtBirth&&this.requestControlledOpen(!1)),!this.controlledAtBirth)return;let e=this.$.vnode.props||{};(Object.prototype.hasOwnProperty.call(e,`modelValue`)||Object.prototype.hasOwnProperty.call(e,`model-value`))&&this.warnControlled(`modelValue is ignored when controlled options are supplied.`),this.controlledState.issues.forEach(this.warnControlled)},controlledOptionId(t){return this.optionIds.has(t)||this.optionIds.set(t,e.getUniqueString(`dt-filter-pill-option-`)),this.optionIds.get(t)},controlledRowSelected(e){return this.controlledState.valid?(this.controlledDraft??this.controlledState.values).includes(e):!1},syncCheckboxRender(){this.controlledDisposed||this.controlledDropdown||(this.checkboxRenderValues=this.controlledState.valid?[...this.controlledDraft??this.controlledState.values]:[])},async reconcileCheckboxes(){let e=++this.reconciliation;await this.$nextTick(),!(this.controlledDisposed||e!==this.reconciliation)&&this.syncCheckboxRender()},toggleControlledOption(e,t){if(!this.controlledCanSelect){this.reconcileCheckboxes();return}let n=this.controlledDraft??this.controlledState.value,r=n.filter(t=>t!==e);t&&(r=n.includes(e)?[...n]:[...n,e]),this.controlledDraftOpen?this.controlledDraft=r:this.commitControlled(r,`toggle`),this.reconcileCheckboxes()},selectControlledOption(e){this.commitControlled(e,`select`,!0)},setControlledSelected(e){if(!this.controlledCanSelect)return;let n=t.getSelectionState(this.options,e,{useDropdown:this.controlledDropdown});if(e===void 0||!n.valid){this.warnControlled(`setSelected requires the selected shape for this pattern.`);return}this.controlledDraftOpen?(this.controlledDraft=[...n.value],this.syncCheckboxRender()):(this.commitControlled(n.value,this.controlledDropdown?`select`:`toggle`,this.controlledDropdown),this.reconcileCheckboxes())},commitControlled(e,n,r=!1,i){if(this.controlledDisposed||!this.controlledCanSelect)return;let a=t.selectionSnapshot(this.controlledState.value),o=t.selectionSnapshot(e),s=!t.sameSelection(o,a),c={value:o,previousValue:a,reason:n,changed:s};s&&this.$emit(`update:selected`,t.selectionSnapshot(o)),!this.controlledDisposed&&(this.$emit(`selection-change`,c),!this.controlledDisposed&&(n===`clear`&&this.$emit(`clear`,i),n===`apply`&&this.$emit(`apply`),!this.controlledDisposed&&r&&this.requestControlledOpen(!1)))},resetControlledDraft(){let e=++this.draftSession;return this.applying=!1,this.isOpen&&this.controlledDeferred?this.rebaseControlledDraft():this.controlledDraft=null,this.syncCheckboxRender(),e},rebaseControlledDraft(){this.controlledDraft=[...this.controlledState.values],this.draftBase=this.controlledBase,this.syncCheckboxRender()},async applyControlledSelection(){if(this.controlledDisposed||this.applying||!this.controlledDeferred||!this.isOpen||this.controlledDraft===null||!this.controlledCanSelect)return;this.applying=!0;let e=this.draftSession;if(await Promise.resolve(),await this.$nextTick(),this.controlledDisposed||e!==this.draftSession||!this.isOpen||this.controlledDraft===null||!this.controlledCanSelect){!this.controlledDisposed&&e===this.draftSession&&(this.applying=!1);return}this.draftBase!==this.controlledBase&&this.rebaseControlledDraft(),this.commitControlled([...this.controlledDraft],`apply`,!0),!this.controlledDisposed&&e===this.draftSession&&(this.applying=!1)},requestControlledOpen(e,t=!0){if(this.controlledDisposed)return;if(e&&(!this.controlledContractValid||this.disabled||this.readOnly)){this.open===!0&&!this.rejectedLockedOpen&&(this.rejectedLockedOpen=!0,this.$emit(`update:open`,!1));return}if(e===this.isOpen)return;this.isOpen=e;let n=this.resetControlledDraft();t&&typeof this.open==`boolean`&&this.$emit(`update:open`,e),!(this.controlledDisposed||n!==this.draftSession)&&this.$emit(`open`,e)},onControlledVisibility(e){this.controlledAtBirth&&this.requestControlledOpen(e)},onOverlayOpened(e){this.controlledAtBirth&&!this.controlledDisposed&&e===this.isOpen&&this.$emit(`opened`,e)},onOverlayTerminalOpen(e){this.controlledAtBirth||(this.isOpen=e)},onAnchorArrow(){this.controlledAtBirth?this.controlledDropdown||this.requestControlledOpen(!0):this.openPopover()},onOverlayKeydown(e){!this.controlledAtBirth||!this.controlledDropdown||this.isOpen||![`ArrowDown`,`ArrowUp`].includes(e.key)||!this.$refs.primaryButton?.$el?.contains(e.target)||(e.preventDefault(),this.requestControlledOpen(!0))},closeControlled(){this.requestControlledOpen(!1)},closeWhenLocked(){!this.controlledAtBirth||!this.disabled&&!this.readOnly||(this.isOpen?(this.rejectedLockedOpen=this.open===!0,this.requestControlledOpen(!1)):this.open===!0&&this.requestControlledOpen(!0))},async restoreRemovedOptionFocus(e){if(!this.isOpen||!Array.isArray(e))return;let t=this.$refs.overlay,n=(this.controlledDropdown?t?.$refs.popover:t)?.$refs.popover__content?.getRootNode(),r=n?.activeElement;if(!r)return;let i=e.findIndex(e=>this.optionIds.get(e)===r?.id);if(i<0)return;let a=this.controlledState.options.find(e=>this.optionIds.get(e.value)===r.id),o=this.draftSession;await this.$nextTick();let s=n.activeElement??r.ownerDocument.activeElement;if(this.controlledDisposed||!this.isOpen||o!==this.draftSession||![r,r.ownerDocument.body,n.host].includes(s))return;let c=this.controlledState.options,l=a??c[Math.min(i,c.length-1)],u=this.$refs.primaryButton?.$el?.getAttribute(`aria-controls`),d=l?n.getElementById(this.controlledOptionId(l.value)):n.getElementById(u);this.controlledDropdown&&(l&&d?this.$refs.overlay?.setHighlightId(d.id):this.$refs.overlay?.clearHighlightIndex()),d?.focus()}}};exports.default=r;
2
+ //# sourceMappingURL=filter-pill-controlled.cjs.map