@dialpad/dialtone 9.158.0 → 9.160.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 (166) hide show
  1. package/dist/css/dialtone-default-theme.css +20 -1
  2. package/dist/css/dialtone-default-theme.min.css +1 -1
  3. package/dist/css/dialtone-docs.json +1 -1
  4. package/dist/css/dialtone.css +20 -1
  5. package/dist/css/dialtone.min.css +1 -1
  6. package/dist/tokens/doc.json +84323 -84323
  7. package/dist/vue3/common/test-utils/node-traversal.cjs +2 -0
  8. package/dist/vue3/common/test-utils/node-traversal.cjs.map +1 -0
  9. package/dist/vue3/common/test-utils/node-traversal.js +54 -0
  10. package/dist/vue3/common/test-utils/node-traversal.js.map +1 -0
  11. package/dist/vue3/component-documentation.json +1 -1
  12. package/dist/vue3/dialtone-vue.cjs +1 -1
  13. package/dist/vue3/dialtone-vue.js +155 -153
  14. package/dist/vue3/dialtone-vue.js.map +1 -1
  15. package/dist/vue3/lib/button/button.cjs +1 -1
  16. package/dist/vue3/lib/button/button.cjs.map +1 -1
  17. package/dist/vue3/lib/button/button.js +146 -81
  18. package/dist/vue3/lib/button/button.js.map +1 -1
  19. package/dist/vue3/lib/datepicker/datepicker.cjs +1 -1
  20. package/dist/vue3/lib/datepicker/datepicker.cjs.map +1 -1
  21. package/dist/vue3/lib/datepicker/datepicker.js +306 -242
  22. package/dist/vue3/lib/datepicker/datepicker.js.map +1 -1
  23. package/dist/vue3/lib/datepicker/utils.cjs +1 -1
  24. package/dist/vue3/lib/datepicker/utils.cjs.map +1 -1
  25. package/dist/vue3/lib/datepicker/utils.js +40 -40
  26. package/dist/vue3/lib/datepicker/utils.js.map +1 -1
  27. package/dist/vue3/lib/dropdown/dropdown-separator.cjs +1 -1
  28. package/dist/vue3/lib/editor/editor.cjs +1 -1
  29. package/dist/vue3/lib/editor/editor.cjs.map +1 -1
  30. package/dist/vue3/lib/editor/editor.js +284 -148
  31. package/dist/vue3/lib/editor/editor.js.map +1 -1
  32. package/dist/vue3/lib/general-row/index.cjs +1 -1
  33. package/dist/vue3/lib/general-row/index.js +6 -4
  34. package/dist/vue3/lib/general-row/index.js.map +1 -1
  35. package/dist/vue3/lib/link/link.cjs +1 -1
  36. package/dist/vue3/lib/link/link.cjs.map +1 -1
  37. package/dist/vue3/lib/link/link.js +58 -18
  38. package/dist/vue3/lib/link/link.js.map +1 -1
  39. package/dist/vue3/lib/list-item-group/list-item-group.cjs +1 -1
  40. package/dist/vue3/lib/list-item-group/list-item-group.js +5 -5
  41. package/dist/vue3/lib/message-input/message-input.cjs +1 -1
  42. package/dist/vue3/lib/message-input/message-input.cjs.map +1 -1
  43. package/dist/vue3/lib/message-input/message-input.js +9 -7
  44. package/dist/vue3/lib/message-input/message-input.js.map +1 -1
  45. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +4 -4
  46. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  47. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +466 -283
  48. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  49. package/dist/vue3/lib/tooltip-directive/tooltip.cjs +1 -1
  50. package/dist/vue3/lib/tooltip-directive/tooltip.cjs.map +1 -1
  51. package/dist/vue3/lib/tooltip-directive/tooltip.js +69 -67
  52. package/dist/vue3/lib/tooltip-directive/tooltip.js.map +1 -1
  53. package/dist/vue3/localization/en-US.cjs +6 -0
  54. package/dist/vue3/localization/en-US.cjs.map +1 -1
  55. package/dist/vue3/localization/en-US.js +6 -0
  56. package/dist/vue3/localization/en-US.js.map +1 -1
  57. package/dist/vue3/types/common/sr_only_close_button.vue.d.ts +68 -1
  58. package/dist/vue3/types/common/test_utils/node_traversal.d.ts +10 -0
  59. package/dist/vue3/types/common/test_utils/node_traversal.d.ts.map +1 -0
  60. package/dist/vue3/types/components/banner/banner.vue.d.ts +136 -2
  61. package/dist/vue3/types/components/banner/banner.vue.d.ts.map +1 -1
  62. package/dist/vue3/types/components/breadcrumbs/breadcrumb_item.vue.d.ts +39 -1
  63. package/dist/vue3/types/components/breadcrumbs/breadcrumb_item.vue.d.ts.map +1 -1
  64. package/dist/vue3/types/components/breadcrumbs/breadcrumbs.vue.d.ts +39 -1
  65. package/dist/vue3/types/components/button/button.vue.d.ts +68 -1
  66. package/dist/vue3/types/components/button/button.vue.d.ts.map +1 -1
  67. package/dist/vue3/types/components/chip/chip.vue.d.ts +68 -1
  68. package/dist/vue3/types/components/chip/chip.vue.d.ts.map +1 -1
  69. package/dist/vue3/types/components/collapsible/collapsible.vue.d.ts +68 -1
  70. package/dist/vue3/types/components/collapsible/collapsible.vue.d.ts.map +1 -1
  71. package/dist/vue3/types/components/datepicker/composables/useMonthYearPicker.d.ts +4 -0
  72. package/dist/vue3/types/components/datepicker/composables/useMonthYearPicker.d.ts.map +1 -1
  73. package/dist/vue3/types/components/datepicker/datepicker.vue.d.ts +8 -0
  74. package/dist/vue3/types/components/datepicker/datepicker.vue.d.ts.map +1 -1
  75. package/dist/vue3/types/components/datepicker/modules/month-year-picker.vue.d.ts +4 -0
  76. package/dist/vue3/types/components/datepicker/modules/month-year-picker.vue.d.ts.map +1 -1
  77. package/dist/vue3/types/components/datepicker/utils.d.ts +1 -1
  78. package/dist/vue3/types/components/datepicker/utils.d.ts.map +1 -1
  79. package/dist/vue3/types/components/dropdown/dropdown.vue.d.ts +136 -2
  80. package/dist/vue3/types/components/dropdown/dropdown.vue.d.ts.map +1 -1
  81. package/dist/vue3/types/components/hovercard/hovercard.vue.d.ts +272 -4
  82. package/dist/vue3/types/components/hovercard/hovercard.vue.d.ts.map +1 -1
  83. package/dist/vue3/types/components/image_viewer/image_viewer.vue.d.ts +136 -2
  84. package/dist/vue3/types/components/image_viewer/image_viewer.vue.d.ts.map +1 -1
  85. package/dist/vue3/types/components/link/link.vue.d.ts +39 -1
  86. package/dist/vue3/types/components/link/link.vue.d.ts.map +1 -1
  87. package/dist/vue3/types/components/modal/modal.vue.d.ts +136 -2
  88. package/dist/vue3/types/components/modal/modal.vue.d.ts.map +1 -1
  89. package/dist/vue3/types/components/notice/notice.vue.d.ts +136 -2
  90. package/dist/vue3/types/components/notice/notice.vue.d.ts.map +1 -1
  91. package/dist/vue3/types/components/notice/notice_action.vue.d.ts +136 -2
  92. package/dist/vue3/types/components/notice/notice_action.vue.d.ts.map +1 -1
  93. package/dist/vue3/types/components/pagination/pagination.vue.d.ts +68 -1
  94. package/dist/vue3/types/components/pagination/pagination.vue.d.ts.map +1 -1
  95. package/dist/vue3/types/components/popover/popover.vue.d.ts +136 -2
  96. package/dist/vue3/types/components/popover/popover.vue.d.ts.map +1 -1
  97. package/dist/vue3/types/components/popover/popover_header_footer.vue.d.ts +68 -1
  98. package/dist/vue3/types/components/popover/popover_header_footer.vue.d.ts.map +1 -1
  99. package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts +39 -1
  100. package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts.map +1 -1
  101. package/dist/vue3/types/components/rich_text_editor/extensions/mentions/MentionComponent.vue.d.ts +39 -1
  102. package/dist/vue3/types/components/rich_text_editor/extensions/variable/VariableComponent.vue.d.ts +1804 -0
  103. package/dist/vue3/types/components/rich_text_editor/extensions/variable/VariableComponent.vue.d.ts.map +1 -0
  104. package/dist/vue3/types/components/rich_text_editor/extensions/variable/index.d.ts +3 -0
  105. package/dist/vue3/types/components/rich_text_editor/extensions/variable/index.d.ts.map +1 -0
  106. package/dist/vue3/types/components/rich_text_editor/extensions/variable/variable.d.ts +3 -0
  107. package/dist/vue3/types/components/rich_text_editor/extensions/variable/variable.d.ts.map +1 -0
  108. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +87 -1
  109. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
  110. package/dist/vue3/types/components/split_button/split_button-alpha.vue.d.ts +68 -1
  111. package/dist/vue3/types/components/split_button/split_button-omega.vue.d.ts +68 -1
  112. package/dist/vue3/types/components/split_button/split_button-omega.vue.d.ts.map +1 -1
  113. package/dist/vue3/types/components/split_button/split_button.vue.d.ts +272 -4
  114. package/dist/vue3/types/components/split_button/split_button.vue.d.ts.map +1 -1
  115. package/dist/vue3/types/components/tab/tab.vue.d.ts +68 -1
  116. package/dist/vue3/types/components/toast/layouts/toast_layout_alternate.vue.d.ts +136 -2
  117. package/dist/vue3/types/components/toast/layouts/toast_layout_alternate.vue.d.ts.map +1 -1
  118. package/dist/vue3/types/components/toast/layouts/toast_layout_default.vue.d.ts +136 -2
  119. package/dist/vue3/types/components/toast/layouts/toast_layout_default.vue.d.ts.map +1 -1
  120. package/dist/vue3/types/components/toast/toast.vue.d.ts +544 -8
  121. package/dist/vue3/types/components/toast/toast.vue.d.ts.map +1 -1
  122. package/dist/vue3/types/directives/tooltip_directive/tooltip.d.ts.map +1 -1
  123. package/dist/vue3/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts +68 -1
  124. package/dist/vue3/types/recipes/buttons/callbar_button/callbar_button.vue.d.ts.map +1 -1
  125. package/dist/vue3/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +272 -4
  126. package/dist/vue3/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts.map +1 -1
  127. package/dist/vue3/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +272 -4
  128. package/dist/vue3/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
  129. package/dist/vue3/types/recipes/cards/ivr_node/ivr_node.vue.d.ts +204 -3
  130. package/dist/vue3/types/recipes/cards/ivr_node/ivr_node.vue.d.ts.map +1 -1
  131. package/dist/vue3/types/recipes/chips/grouped_chip/grouped_chip.vue.d.ts +68 -1
  132. package/dist/vue3/types/recipes/chips/grouped_chip/grouped_chip.vue.d.ts.map +1 -1
  133. package/dist/vue3/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts +136 -2
  134. package/dist/vue3/types/recipes/comboboxes/combobox_with_popover/combobox_with_popover.vue.d.ts.map +1 -1
  135. package/dist/vue3/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts +272 -4
  136. package/dist/vue3/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts.map +1 -1
  137. package/dist/vue3/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts +204 -3
  138. package/dist/vue3/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts.map +1 -1
  139. package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts +664 -4
  140. package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
  141. package/dist/vue3/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +68 -1
  142. package/dist/vue3/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts.map +1 -1
  143. package/dist/vue3/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +68 -1
  144. package/dist/vue3/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts.map +1 -1
  145. package/dist/vue3/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts +68 -1
  146. package/dist/vue3/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts.map +1 -1
  147. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +631 -9
  148. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
  149. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts +68 -1
  150. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_button.vue.d.ts.map +1 -1
  151. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +272 -4
  152. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -1
  153. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +68 -1
  154. package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -1
  155. package/dist/vue3/types/recipes/header/settings_menu_button/settings_menu_button.vue.d.ts +68 -1
  156. package/dist/vue3/types/recipes/header/settings_menu_button/settings_menu_button.vue.d.ts.map +1 -1
  157. package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts +68 -1
  158. package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts.map +1 -1
  159. package/dist/vue3/types/recipes/leftbar/contact_row/contact_row.vue.d.ts +68 -1
  160. package/dist/vue3/types/recipes/leftbar/contact_row/contact_row.vue.d.ts.map +1 -1
  161. package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts +68 -1
  162. package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
  163. package/dist/vue3/types/recipes/leftbar/general_row/index.d.ts +1 -0
  164. package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts +68 -1
  165. package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts.map +1 -1
  166. package/package.json +4 -4
@@ -1,10 +1,10 @@
1
- import { warn as m, openBlock as a, createElementBlock as o, mergeProps as y, toHandlers as O, normalizeClass as u, renderSlot as c, createCommentVNode as f } from "vue";
2
- import { hasSlotContent as l } from "../../common/utils/index.js";
3
- import { INVALID_COMBINATION as _, BUTTON_SIZE_MODIFIERS as r, BUTTON_IMPORTANCE_MODIFIERS as h, BUTTON_KIND_MODIFIERS as b, BUTTON_ICON_SIZES as p, ICON_POSITION_MODIFIERS as I, BUTTON_TYPES as k } from "./button-constants.js";
4
- import { DialtoneLocalization as S } from "../../localization/index.js";
5
- import { _ as v } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
6
- import { getLinkKindModifier as N, LINK_KIND_MODIFIERS as B } from "../link/link-constants.js";
7
- const g = {
1
+ import { warn as l, resolveComponent as y, openBlock as r, createBlock as I, resolveDynamicComponent as k, mergeProps as O, toHandlers as _, withCtx as v, createElementBlock as u, normalizeClass as c, renderSlot as f, createCommentVNode as h } from "vue";
2
+ import { hasSlotContent as o } from "../../common/utils/index.js";
3
+ import { INVALID_COMBINATION as S, BUTTON_SIZE_MODIFIERS as d, BUTTON_IMPORTANCE_MODIFIERS as b, BUTTON_KIND_MODIFIERS as p, BUTTON_ICON_SIZES as g, ICON_POSITION_MODIFIERS as m, BUTTON_TYPES as N } from "./button-constants.js";
4
+ import { DialtoneLocalization as B } from "../../localization/index.js";
5
+ import { _ as D } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
6
+ import { getLinkKindModifier as C, LINK_KIND_MODIFIERS as T } from "../link/link-constants.js";
7
+ const L = {
8
8
  compatConfig: { MODE: 3 },
9
9
  name: "DtButton",
10
10
  props: {
@@ -23,7 +23,7 @@ const g = {
23
23
  iconPosition: {
24
24
  type: String,
25
25
  default: "left",
26
- validator: (t) => Object.keys(I).includes(t)
26
+ validator: (t) => Object.keys(m).includes(t)
27
27
  },
28
28
  /**
29
29
  * The fill and outline of the button associated with its visual importance.
@@ -32,7 +32,7 @@ const g = {
32
32
  importance: {
33
33
  type: String,
34
34
  default: "primary",
35
- validator: (t) => Object.keys(h).includes(t)
35
+ validator: (t) => Object.keys(b).includes(t)
36
36
  },
37
37
  /**
38
38
  * Whether the button should be styled as a link or not.
@@ -51,7 +51,7 @@ const g = {
51
51
  linkKind: {
52
52
  type: String,
53
53
  default: "default",
54
- validator: (t) => Object.keys(B).includes(t)
54
+ validator: (t) => Object.keys(T).includes(t)
55
55
  },
56
56
  /**
57
57
  * Determines whether the link should have inverted styling if the button is styled as a link.
@@ -73,26 +73,17 @@ const g = {
73
73
  },
74
74
  /**
75
75
  * HTML button type attribute
76
- * <a
77
- * class="d-link"
78
- * href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type"
79
- * target="_blank"
80
- * >
81
- * (Reference)
82
- * </a>
76
+ * <a class="d-link" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type" target="_blank">(Reference)</a>
83
77
  * @values button, submit, reset
84
78
  */
85
79
  type: {
86
80
  type: String,
87
81
  default: "button",
88
- validator: (t) => k.includes(t)
82
+ validator: (t) => N.includes(t)
89
83
  },
90
84
  /**
91
85
  * Button width, accepts
92
- * <a class="d-link" href="https://developer.mozilla.org/en-US/docs/Web/CSS/width" target="_blank">
93
- * CSS width attribute
94
- * </a>
95
- * values
86
+ * <a class="d-link" href="https://developer.mozilla.org/en-US/docs/Web/CSS/width" target="_blank">CSS width attribute</a> values
96
87
  */
97
88
  width: {
98
89
  type: String,
@@ -105,7 +96,7 @@ const g = {
105
96
  size: {
106
97
  type: String,
107
98
  default: "md",
108
- validator: (t) => Object.keys(r).includes(t)
99
+ validator: (t) => Object.keys(d).includes(t)
109
100
  },
110
101
  /**
111
102
  * Used to customize the label container
@@ -129,7 +120,7 @@ const g = {
129
120
  kind: {
130
121
  type: String,
131
122
  default: "default",
132
- validator: (t) => Object.keys(b).includes(t)
123
+ validator: (t) => Object.keys(p).includes(t)
133
124
  },
134
125
  /**
135
126
  * Determines whether a screenreader reads live updates of
@@ -149,6 +140,46 @@ const g = {
149
140
  active: {
150
141
  type: Boolean,
151
142
  default: !1
143
+ },
144
+ /**
145
+ * vue-router `to` prop. When provided, renders a `<router-link>`
146
+ * for client-side SPA navigation.
147
+ * @see https://router.vuejs.org/api/interfaces/RouterLinkProps.html#to
148
+ */
149
+ to: {
150
+ type: [String, Object],
151
+ default: null
152
+ },
153
+ /**
154
+ * When provided, renders an `<a>` element for standard browser navigation.
155
+ */
156
+ href: {
157
+ type: String,
158
+ default: null
159
+ },
160
+ /**
161
+ * HTML anchor target attribute. Only applied when using the `href` prop.
162
+ * @values _self, _blank, _parent, _top
163
+ */
164
+ target: {
165
+ type: String,
166
+ default: null
167
+ },
168
+ /**
169
+ * HTML anchor rel attribute. Only applied when using the `href` prop.
170
+ */
171
+ rel: {
172
+ type: String,
173
+ default: null
174
+ },
175
+ /**
176
+ * vue-router `replace` prop. When true, navigation will not leave a
177
+ * history entry. Only applied when using the `to` prop.
178
+ * @values true, false
179
+ */
180
+ replace: {
181
+ type: Boolean,
182
+ default: !1
152
183
  }
153
184
  },
154
185
  emits: [
@@ -169,29 +200,55 @@ const g = {
169
200
  ],
170
201
  data() {
171
202
  return {
172
- ICON_POSITION_MODIFIERS: I,
203
+ ICON_POSITION_MODIFIERS: m,
173
204
  // whether the button is currently in focus
174
205
  isInFocus: !1,
175
- hasSlotContent: l,
176
- i18n: new S()
206
+ hasSlotContent: o,
207
+ i18n: new B()
177
208
  };
178
209
  },
179
210
  computed: {
180
- buttonListeners() {
181
- return {
182
- focusin: (t) => {
183
- this.isInFocus = this.assertiveOnFocus, this.$emit("focusin", t);
211
+ computedTag() {
212
+ return this.to ? this.resolveRouterLink() : this.href ? "a" : "button";
213
+ },
214
+ isNativeButton() {
215
+ return !this.to && !this.href;
216
+ },
217
+ computedAttrs() {
218
+ return this.to ? {
219
+ to: this.to,
220
+ replace: this.replace,
221
+ ...this.disabled && { "aria-disabled": "true", tabindex: "-1" }
222
+ } : this.href ? {
223
+ href: this.disabled ? null : this.href,
224
+ target: this.target,
225
+ rel: this.rel,
226
+ ...this.disabled && { "aria-disabled": "true", tabindex: "-1" }
227
+ } : {
228
+ type: this.type,
229
+ disabled: this.disabled
230
+ };
231
+ },
232
+ computedListeners() {
233
+ const t = {
234
+ focusin: (e) => {
235
+ this.isInFocus = this.assertiveOnFocus, this.$emit("focusin", e);
184
236
  },
185
- focusout: (t) => {
186
- this.isInFocus = !1, this.$emit("focusout", t);
237
+ focusout: (e) => {
238
+ this.isInFocus = !1, this.$emit("focusout", e);
187
239
  }
188
240
  };
241
+ return this.isNativeButton || (this.disabled && (t.click = (e) => {
242
+ e.preventDefault(), e.stopImmediatePropagation();
243
+ }), t.keydown = (e) => {
244
+ (e.key === " " || e.code === "Space") && (e.preventDefault(), this.disabled || e.target.click());
245
+ }), t;
189
246
  },
190
247
  computedAriaLive() {
191
248
  return this.assertiveOnFocus && this.isInFocus ? "assertive" : this.$attrs.ariaLive;
192
249
  },
193
250
  iconSize() {
194
- return p[this.size];
251
+ return g[this.size];
195
252
  }
196
253
  },
197
254
  watch: {
@@ -199,21 +256,28 @@ const g = {
199
256
  deep: !0,
200
257
  immediate: !0,
201
258
  handler() {
202
- process.env.NODE_ENV !== "production" && (this.circle && this.link && m("You cannot enable circle and link at the same time", this), this.isInvalidPropCombination(this.circle, this.kind, this.importance));
259
+ process.env.NODE_ENV !== "production" && (this.circle && this.link && l("You cannot enable circle and link at the same time", this), this.isInvalidPropCombination(this.circle, this.kind, this.importance));
203
260
  }
204
261
  }
205
262
  },
206
263
  methods: {
264
+ resolveRouterLink() {
265
+ try {
266
+ return y("RouterLink");
267
+ } catch {
268
+ return l('DtButton: "to" prop requires vue-router. Falling back to <a>.'), "a";
269
+ }
270
+ },
207
271
  buttonClasses() {
208
272
  return this.link ? [
209
273
  "d-link",
210
- N(this.linkKind, this.linkInverted),
211
- r[this.size]
274
+ C(this.linkKind, this.linkInverted),
275
+ d[this.size]
212
276
  ] : this.kind === "unstyled" ? ["d-btn--unstyled"] : [
213
277
  "d-btn",
214
- h[this.importance],
215
- b[this.kind],
216
- r[this.size],
278
+ b[this.importance],
279
+ p[this.kind],
280
+ d[this.size],
217
281
  {
218
282
  "d-btn--circle": this.circle,
219
283
  "d-btn--loading": this.loading,
@@ -223,66 +287,67 @@ const g = {
223
287
  }
224
288
  ];
225
289
  },
226
- isInvalidPropCombination(t, d, e) {
290
+ isInvalidPropCombination(t, e, i) {
227
291
  if (this.kind === "unstyled")
228
292
  return !0;
229
- for (const i of _)
230
- if (t === i.circle && d === i.kind && e === i.importance)
231
- return console.warn(i.message), !1;
293
+ for (const s of S)
294
+ if (t === s.circle && e === s.kind && i === s.importance)
295
+ return l(s.message), !1;
232
296
  return !0;
233
297
  },
234
298
  shouldRenderIcon() {
235
- return l(this.$slots.icon) && !this.link;
299
+ return o(this.$slots.icon) && !this.link;
236
300
  },
237
301
  isIconOnly() {
238
- return this.shouldRenderIcon() && !l(this.$slots.default);
302
+ return this.shouldRenderIcon() && !o(this.$slots.default);
239
303
  },
240
304
  isVerticalIconLayout() {
241
305
  return !this.isIconOnly() && ["top", "bottom"].includes(this.iconPosition);
242
306
  }
243
307
  }
244
- }, C = ["type", "disabled", "aria-live", "aria-label"];
245
- function D(t, d, e, i, s, n) {
246
- return a(), o("button", y({
308
+ };
309
+ function E(t, e, i, s, a, n) {
310
+ return r(), I(k(n.computedTag), O({
247
311
  class: [
248
312
  "base-button__button",
249
313
  n.buttonClasses()
250
314
  ],
251
315
  "data-qa": "dt-button",
252
- type: e.type,
253
- disabled: e.disabled,
254
- style: { width: e.width },
316
+ style: { width: i.width },
255
317
  "aria-live": n.computedAriaLive,
256
- "aria-label": e.loading ? s.i18n.$t("DIALTONE_LOADING") : t.$attrs["aria-label"]
257
- }, O(n.buttonListeners, !0)), [
258
- n.shouldRenderIcon() ? (a(), o("span", {
259
- key: 0,
260
- "data-qa": "dt-button-icon",
261
- class: u([
262
- "base-button__icon",
263
- {
264
- "d-btn__icon": e.kind !== "unstyled",
265
- [s.ICON_POSITION_MODIFIERS[e.iconPosition]]: e.kind !== "unstyled"
266
- }
267
- ])
268
- }, [
269
- c(t.$slots, "icon", { iconSize: n.iconSize })
270
- ], 2)) : f("", !0),
271
- s.hasSlotContent(t.$slots.default) ? (a(), o("span", {
272
- key: 1,
273
- "data-qa": "dt-button-label",
274
- class: u([
275
- "base-button__label",
276
- { "d-btn__label": e.kind !== "unstyled" },
277
- e.labelClass
278
- ])
279
- }, [
280
- c(t.$slots, "default")
281
- ], 2)) : f("", !0)
282
- ], 16, C);
318
+ "aria-label": i.loading ? a.i18n.$t("DIALTONE_LOADING") : t.$attrs["aria-label"]
319
+ }, n.computedAttrs, _(n.computedListeners)), {
320
+ default: v(() => [
321
+ n.shouldRenderIcon() ? (r(), u("span", {
322
+ key: 0,
323
+ "data-qa": "dt-button-icon",
324
+ class: c([
325
+ "base-button__icon",
326
+ {
327
+ "d-btn__icon": i.kind !== "unstyled",
328
+ [a.ICON_POSITION_MODIFIERS[i.iconPosition]]: i.kind !== "unstyled"
329
+ }
330
+ ])
331
+ }, [
332
+ f(t.$slots, "icon", { iconSize: n.iconSize })
333
+ ], 2)) : h("", !0),
334
+ a.hasSlotContent(t.$slots.default) ? (r(), u("span", {
335
+ key: 1,
336
+ "data-qa": "dt-button-label",
337
+ class: c([
338
+ "base-button__label",
339
+ { "d-btn__label": i.kind !== "unstyled" },
340
+ i.labelClass
341
+ ])
342
+ }, [
343
+ f(t.$slots, "default")
344
+ ], 2)) : h("", !0)
345
+ ]),
346
+ _: 3
347
+ }, 16, ["class", "style", "aria-live", "aria-label"]);
283
348
  }
284
- const R = /* @__PURE__ */ v(g, [["render", D]]);
349
+ const z = /* @__PURE__ */ D(L, [["render", E]]);
285
350
  export {
286
- R as default
351
+ z as default
287
352
  };
288
353
  //# sourceMappingURL=button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../../components/button/button.vue"],"sourcesContent":["<template>\n <button\n :class=\"[\n 'base-button__button',\n buttonClasses(),\n ]\"\n data-qa=\"dt-button\"\n :type=\"type\"\n :disabled=\"disabled\"\n :style=\"{ width: width }\"\n :aria-live=\"computedAriaLive\"\n :aria-label=\"loading ? i18n.$t('DIALTONE_LOADING') : $attrs['aria-label']\"\n v-on=\"buttonListeners\"\n >\n <!-- NOTE(cormac): This span is needed since we can't apply styles to slots. -->\n <span\n v-if=\"shouldRenderIcon()\"\n data-qa=\"dt-button-icon\"\n :class=\"[\n 'base-button__icon',\n {\n 'd-btn__icon': kind !== 'unstyled',\n [ICON_POSITION_MODIFIERS[iconPosition]]: kind !== 'unstyled',\n },\n ]\"\n >\n <!-- @slot Button icon -->\n <slot\n name=\"icon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span\n v-if=\"hasSlotContent($slots.default)\"\n data-qa=\"dt-button-label\"\n :class=\"[\n 'base-button__label',\n { 'd-btn__label': kind !== 'unstyled' },\n labelClass,\n ]\"\n >\n <!-- @slot Content within button -->\n <slot />\n </span>\n </button>\n</template>\n\n<script>\nimport { warn } from 'vue';\nimport { hasSlotContent } from '@/common/utils';\n\nimport {\n BUTTON_SIZE_MODIFIERS,\n BUTTON_KIND_MODIFIERS,\n BUTTON_IMPORTANCE_MODIFIERS,\n BUTTON_ICON_SIZES,\n BUTTON_TYPES,\n ICON_POSITION_MODIFIERS,\n INVALID_COMBINATION,\n} from './button_constants';\n\nimport { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * A button is a UI element which allows users to take an action throughout the app.\n * It is important a button is identifiable, consistent, and communicates its actions clearly,\n * and is appropriately sized to its action.\n * @see https://dialtone.dialpad.com/components/button.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtButton',\n\n props: {\n /**\n * Whether the button is a circle or not.\n * @values true, false\n */\n circle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The position of the icon slot within the button.\n * @values left, right, top, bottom\n */\n iconPosition: {\n type: String,\n default: 'left',\n validator: (position) => Object.keys(ICON_POSITION_MODIFIERS).includes(position),\n },\n\n /**\n * The fill and outline of the button associated with its visual importance.\n * @values clear, outlined, primary\n */\n importance: {\n type: String,\n default: 'primary',\n validator: (i) => Object.keys(BUTTON_IMPORTANCE_MODIFIERS).includes(i),\n },\n\n /**\n * Whether the button should be styled as a link or not.\n * @values true, false\n * @see DtLink\n */\n link: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the link and button if the button is styled as a link.\n * @values default, warning, danger, success, muted\n * @see DtLink\n */\n linkKind: {\n type: String,\n default: 'default',\n validator: (lk) => Object.keys(LINK_KIND_MODIFIERS).includes(lk),\n },\n\n /**\n * Determines whether the link should have inverted styling if the button is styled as a link.\n * @values true, false\n * @see DtLink\n */\n linkInverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button disabled attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled\" target=\"_blank\"> (Reference) </a>\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button type attribute\n * <a\n * class=\"d-link\"\n * href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type\"\n * target=\"_blank\"\n * >\n * (Reference)\n * </a>\n * @values button, submit, reset\n */\n type: {\n type: String,\n default: 'button',\n validator: (t) => BUTTON_TYPES.includes(t),\n },\n\n /**\n * Button width, accepts\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/width\" target=\"_blank\">\n * CSS width attribute\n * </a>\n * values\n */\n width: {\n type: String,\n default: null,\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Whether the button should display a loading animation or not.\n * @values true, false\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the button.\n * @values default, unstyled, muted, danger, positive, inverted\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(BUTTON_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Determines whether a screenreader reads live updates of\n * the button content to the user while the button\n * is in focus. default is to not.\n * @values true, false\n */\n assertiveOnFocus: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n */\n active: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button focus in event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native button focus out event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n ],\n\n data () {\n return {\n ICON_POSITION_MODIFIERS,\n // whether the button is currently in focus\n isInFocus: false,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n\n buttonListeners () {\n return {\n focusin: (e) => {\n this.isInFocus = this.assertiveOnFocus;\n this.$emit('focusin', e);\n },\n\n focusout: (e) => {\n this.isInFocus = false;\n this.$emit('focusout', e);\n },\n };\n },\n\n computedAriaLive () {\n return this.assertiveOnFocus && this.isInFocus ? 'assertive' : this.$attrs.ariaLive;\n },\n\n iconSize () {\n return BUTTON_ICON_SIZES[this.size];\n },\n },\n\n watch: {\n $props: {\n deep: true,\n immediate: true,\n handler () {\n if (process.env.NODE_ENV === 'production') return;\n\n if (this.circle && this.link) {\n warn('You cannot enable circle and link at the same time', this);\n }\n\n this.isInvalidPropCombination(this.circle, this.kind, this.importance);\n },\n },\n },\n\n methods: {\n buttonClasses () {\n if (this.link) {\n return [\n 'd-link',\n getLinkKindModifier(this.linkKind, this.linkInverted),\n BUTTON_SIZE_MODIFIERS[this.size],\n ];\n }\n if (this.kind === 'unstyled') {\n return ['d-btn--unstyled'];\n }\n return [\n 'd-btn',\n BUTTON_IMPORTANCE_MODIFIERS[this.importance],\n BUTTON_KIND_MODIFIERS[this.kind],\n BUTTON_SIZE_MODIFIERS[this.size],\n {\n 'd-btn--circle': this.circle,\n 'd-btn--loading': this.loading,\n 'd-btn--icon-only': this.isIconOnly(),\n 'd-btn--vertical': this.isVerticalIconLayout(),\n 'd-btn--active': this.active,\n },\n ];\n },\n\n isInvalidPropCombination (circle, kind, importance) {\n // Skip validation if unstyled is true\n if (this.kind === 'unstyled') {\n return true;\n }\n\n for (const row of INVALID_COMBINATION) {\n if (circle === row.circle && kind === row.kind && importance === row.importance) {\n console.warn(row.message);\n return false;\n }\n }\n return true;\n },\n\n shouldRenderIcon () {\n return hasSlotContent(this.$slots.icon) && !this.link;\n },\n\n isIconOnly () {\n return this.shouldRenderIcon() && !hasSlotContent(this.$slots.default);\n },\n\n isVerticalIconLayout () {\n return !this.isIconOnly() && ['top', 'bottom'].includes(this.iconPosition);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","position","ICON_POSITION_MODIFIERS","i","BUTTON_IMPORTANCE_MODIFIERS","lk","LINK_KIND_MODIFIERS","BUTTON_TYPES","s","BUTTON_SIZE_MODIFIERS","k","BUTTON_KIND_MODIFIERS","hasSlotContent","DialtoneLocalization","e","BUTTON_ICON_SIZES","warn","getLinkKindModifier","circle","kind","importance","row","INVALID_COMBINATION","_openBlock","_createElementBlock","_mergeProps","$options","$props","$data","_ctx","_toHandlers","_normalizeClass","_renderSlot"],"mappings":";;;;;;AAsEA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACC,MAAa,OAAO,KAAKC,CAAuB,EAAE,SAASD,CAAQ;AAAA;;;;;IAOjF,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAM,OAAO,KAAKC,CAA2B,EAAE,SAASD,CAAC;AAAA;;;;;;IAQvE,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAO,OAAO,KAAKC,CAAmB,EAAE,SAASD,CAAE;AAAA;;;;;;IAQjE,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;;;;;;IAcX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAAC,MAAME,EAAa,SAAS,CAAC;AAAA;;;;;;;;IAU3C,OAAO;AAAA,MACL,MAAM;AAAA,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2CS,UA3CTC,EA2CS;AAAA,IA1CN,OAAK;AAAA;MAAuCC,EAAA,cAAa;AAAA;IAI1D,WAAQ;AAAA,IACP,MAAMC,EAAA;AAAA,IACN,UAAUA,EAAA;AAAA,IACV,gBAAgBA,EAAA,MAAK;AAAA,IACrB,aAAWD,EAAA;AAAA,IACX,cAAYC,EAAA,UAAUC,OAAK,yBAAyBC,EAAA,OAAM,YAAA;AAAA,EAC3D,GAAAC,EAAsBJ,EAAhB,iBAAe,EAAA,CAAA,GAAA;AAAA,IAIbA,EAAA,iBAAgB,UADxBF,EAgBO,QAAA;AAAA;MAdL,WAAQ;AAAA,MACP,OAAKO,EAAA;AAAA;;yBAAoEJ,EAAA,SAAI;AAAA,WAA4BC,EAAA,wBAAwBD,EAAA,YAAY,CAAA,GAAIA,EAAA,SAAI;AAAA;;;MAStJK,EAGEH,EAAA,QAAA,QAAA,EADC,UAAWH,EAAA,SAAQ,CAAA;AAAA;IAIhBE,EAAA,eAAeC,EAAA,OAAO,OAAO,UADrCL,EAWO,QAAA;AAAA;MATL,WAAQ;AAAA,MACP,OAAKO,EAAA;AAAA;0BAA4DJ,EAAA,SAAI,WAAA;AAAA,QAA2BA,EAAA;AAAA;;MAOjGK,EAAQH,EAAA,QAAA,SAAA;AAAA;;;;"}
1
+ {"version":3,"file":"button.js","sources":["../../../components/button/button.vue"],"sourcesContent":["<template>\n <component\n :is=\"computedTag\"\n :class=\"[\n 'base-button__button',\n buttonClasses(),\n ]\"\n data-qa=\"dt-button\"\n :style=\"{ width: width }\"\n :aria-live=\"computedAriaLive\"\n :aria-label=\"loading ? i18n.$t('DIALTONE_LOADING') : $attrs['aria-label']\"\n v-bind=\"computedAttrs\"\n v-on=\"computedListeners\"\n >\n <!-- NOTE(cormac): This span is needed since we can't apply styles to slots. -->\n <span\n v-if=\"shouldRenderIcon()\"\n data-qa=\"dt-button-icon\"\n :class=\"[\n 'base-button__icon',\n {\n 'd-btn__icon': kind !== 'unstyled',\n [ICON_POSITION_MODIFIERS[iconPosition]]: kind !== 'unstyled',\n },\n ]\"\n >\n <!-- @slot Button icon -->\n <slot\n name=\"icon\"\n :icon-size=\"iconSize\"\n />\n </span>\n <span\n v-if=\"hasSlotContent($slots.default)\"\n data-qa=\"dt-button-label\"\n :class=\"[\n 'base-button__label',\n { 'd-btn__label': kind !== 'unstyled' },\n labelClass,\n ]\"\n >\n <!-- @slot Content within button -->\n <slot />\n </span>\n </component>\n</template>\n\n<script>\nimport { warn, resolveComponent } from 'vue';\nimport { hasSlotContent } from '@/common/utils';\n\nimport {\n BUTTON_SIZE_MODIFIERS,\n BUTTON_KIND_MODIFIERS,\n BUTTON_IMPORTANCE_MODIFIERS,\n BUTTON_ICON_SIZES,\n BUTTON_TYPES,\n ICON_POSITION_MODIFIERS,\n INVALID_COMBINATION,\n} from './button_constants';\n\nimport { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * A button is a UI element which allows users to take an action throughout the app.\n * It is important a button is identifiable, consistent, and communicates its actions clearly,\n * and is appropriately sized to its action.\n * @see https://dialtone.dialpad.com/components/button.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtButton',\n\n props: {\n /**\n * Whether the button is a circle or not.\n * @values true, false\n */\n circle: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The position of the icon slot within the button.\n * @values left, right, top, bottom\n */\n iconPosition: {\n type: String,\n default: 'left',\n validator: (position) => Object.keys(ICON_POSITION_MODIFIERS).includes(position),\n },\n\n /**\n * The fill and outline of the button associated with its visual importance.\n * @values clear, outlined, primary\n */\n importance: {\n type: String,\n default: 'primary',\n validator: (i) => Object.keys(BUTTON_IMPORTANCE_MODIFIERS).includes(i),\n },\n\n /**\n * Whether the button should be styled as a link or not.\n * @values true, false\n * @see DtLink\n */\n link: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the link and button if the button is styled as a link.\n * @values default, warning, danger, success, muted\n * @see DtLink\n */\n linkKind: {\n type: String,\n default: 'default',\n validator: (lk) => Object.keys(LINK_KIND_MODIFIERS).includes(lk),\n },\n\n /**\n * Determines whether the link should have inverted styling if the button is styled as a link.\n * @values true, false\n * @see DtLink\n */\n linkInverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button disabled attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#disabled\" target=\"_blank\"> (Reference) </a>\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * HTML button type attribute\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type\" target=\"_blank\">(Reference)</a>\n * @values button, submit, reset\n */\n type: {\n type: String,\n default: 'button',\n validator: (t) => BUTTON_TYPES.includes(t),\n },\n\n /**\n * Button width, accepts\n * <a class=\"d-link\" href=\"https://developer.mozilla.org/en-US/docs/Web/CSS/width\" target=\"_blank\">CSS width attribute</a> values\n */\n width: {\n type: String,\n default: null,\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'md',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * Used to customize the label container\n */\n labelClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Whether the button should display a loading animation or not.\n * @values true, false\n */\n loading: {\n type: Boolean,\n default: false,\n },\n\n /**\n * The color of the button.\n * @values default, unstyled, muted, danger, positive, inverted\n */\n kind: {\n type: String,\n default: 'default',\n validator: (k) => Object.keys(BUTTON_KIND_MODIFIERS).includes(k),\n },\n\n /**\n * Determines whether a screenreader reads live updates of\n * the button content to the user while the button\n * is in focus. default is to not.\n * @values true, false\n */\n assertiveOnFocus: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Determines whether the button should have active styling\n * default is false.\n * @values true, false\n */\n active: {\n type: Boolean,\n default: false,\n },\n\n /**\n * vue-router `to` prop. When provided, renders a `<router-link>`\n * for client-side SPA navigation.\n * @see https://router.vuejs.org/api/interfaces/RouterLinkProps.html#to\n */\n to: {\n type: [String, Object],\n default: null,\n },\n\n /**\n * When provided, renders an `<a>` element for standard browser navigation.\n */\n href: {\n type: String,\n default: null,\n },\n\n /**\n * HTML anchor target attribute. Only applied when using the `href` prop.\n * @values _self, _blank, _parent, _top\n */\n target: {\n type: String,\n default: null,\n },\n\n /**\n * HTML anchor rel attribute. Only applied when using the `href` prop.\n */\n rel: {\n type: String,\n default: null,\n },\n\n /**\n * vue-router `replace` prop. When true, navigation will not leave a\n * history entry. Only applied when using the `to` prop.\n * @values true, false\n */\n replace: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Native button focus in event\n *\n * @event focusin\n * @type {FocusEvent}\n */\n 'focusin',\n\n /**\n * Native button focus out event\n *\n * @event focusout\n * @type {FocusEvent}\n */\n 'focusout',\n ],\n\n data () {\n return {\n ICON_POSITION_MODIFIERS,\n // whether the button is currently in focus\n isInFocus: false,\n hasSlotContent,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n computedTag () {\n if (this.to) return this.resolveRouterLink();\n if (this.href) return 'a';\n return 'button';\n },\n\n isNativeButton () {\n return !this.to && !this.href;\n },\n\n computedAttrs () {\n if (this.to) {\n return {\n to: this.to,\n replace: this.replace,\n ...(this.disabled && { 'aria-disabled': 'true', tabindex: '-1' }),\n };\n }\n if (this.href) {\n return {\n href: this.disabled ? null : this.href,\n target: this.target,\n rel: this.rel,\n ...(this.disabled && { 'aria-disabled': 'true', tabindex: '-1' }),\n };\n }\n return {\n type: this.type,\n disabled: this.disabled,\n };\n },\n\n computedListeners () {\n const listeners = {\n focusin: (e) => {\n this.isInFocus = this.assertiveOnFocus;\n this.$emit('focusin', e);\n },\n\n focusout: (e) => {\n this.isInFocus = false;\n this.$emit('focusout', e);\n },\n };\n\n if (!this.isNativeButton) {\n // Prevent click when disabled for link elements.\n // stopImmediatePropagation prevents parent onClick attrs from firing.\n if (this.disabled) {\n listeners.click = (e) => {\n e.preventDefault();\n e.stopImmediatePropagation();\n };\n }\n\n // Space key handler: <a> only responds to Enter natively,\n // but buttons respond to both Enter and Space.\n listeners.keydown = (e) => {\n if (e.key === ' ' || e.code === 'Space') {\n e.preventDefault();\n if (!this.disabled) {\n e.target.click();\n }\n }\n };\n }\n\n return listeners;\n },\n\n computedAriaLive () {\n return this.assertiveOnFocus && this.isInFocus ? 'assertive' : this.$attrs.ariaLive;\n },\n\n iconSize () {\n return BUTTON_ICON_SIZES[this.size];\n },\n },\n\n watch: {\n $props: {\n deep: true,\n immediate: true,\n handler () {\n if (process.env.NODE_ENV === 'production') return;\n\n if (this.circle && this.link) {\n warn('You cannot enable circle and link at the same time', this);\n }\n\n this.isInvalidPropCombination(this.circle, this.kind, this.importance);\n },\n },\n },\n\n methods: {\n resolveRouterLink () {\n try {\n return resolveComponent('RouterLink');\n } catch {\n warn('DtButton: \"to\" prop requires vue-router. Falling back to <a>.');\n return 'a';\n }\n },\n\n buttonClasses () {\n if (this.link) {\n return [\n 'd-link',\n getLinkKindModifier(this.linkKind, this.linkInverted),\n BUTTON_SIZE_MODIFIERS[this.size],\n ];\n }\n if (this.kind === 'unstyled') {\n return ['d-btn--unstyled'];\n }\n return [\n 'd-btn',\n BUTTON_IMPORTANCE_MODIFIERS[this.importance],\n BUTTON_KIND_MODIFIERS[this.kind],\n BUTTON_SIZE_MODIFIERS[this.size],\n {\n 'd-btn--circle': this.circle,\n 'd-btn--loading': this.loading,\n 'd-btn--icon-only': this.isIconOnly(),\n 'd-btn--vertical': this.isVerticalIconLayout(),\n 'd-btn--active': this.active,\n },\n ];\n },\n\n isInvalidPropCombination (circle, kind, importance) {\n // Skip validation if unstyled is true\n if (this.kind === 'unstyled') {\n return true;\n }\n\n for (const row of INVALID_COMBINATION) {\n if (circle === row.circle && kind === row.kind && importance === row.importance) {\n warn(row.message);\n return false;\n }\n }\n return true;\n },\n\n shouldRenderIcon () {\n return hasSlotContent(this.$slots.icon) && !this.link;\n },\n\n isIconOnly () {\n return this.shouldRenderIcon() && !hasSlotContent(this.$slots.default);\n },\n\n isVerticalIconLayout () {\n return !this.isIconOnly() && ['top', 'bottom'].includes(this.iconPosition);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","position","ICON_POSITION_MODIFIERS","i","BUTTON_IMPORTANCE_MODIFIERS","lk","LINK_KIND_MODIFIERS","BUTTON_TYPES","s","BUTTON_SIZE_MODIFIERS","k","BUTTON_KIND_MODIFIERS","hasSlotContent","DialtoneLocalization","listeners","BUTTON_ICON_SIZES","warn","resolveComponent","getLinkKindModifier","circle","kind","importance","row","INVALID_COMBINATION","_createBlock","_resolveDynamicComponent","$options","_mergeProps","$props","$data","_ctx","_toHandlers","_createElementBlock","_normalizeClass","_renderSlot"],"mappings":";;;;;;AAsEA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACC,MAAa,OAAO,KAAKC,CAAuB,EAAE,SAASD,CAAQ;AAAA;;;;;IAOjF,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAM,OAAO,KAAKC,CAA2B,EAAE,SAASD,CAAC;AAAA;;;;;;IAQvE,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACE,MAAO,OAAO,KAAKC,CAAmB,EAAE,SAASD,CAAE;AAAA;;;;;;IAQjE,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;IAQX,MAAM;AA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AAwB;AACtB,aAAO,CAAC,KAAK,WAAU,KAAM,CAAC,OAAO,QAAQ,EAAE,SAAS,KAAK,YAAY;AAAA,IAC3E;AAAA;AAEJ;;cAvcEY,EA2CYC,EA1CLC,EAAA,WAAW,GADlBC,EA2CY;AAAA,IAzCT,OAAK;AAAA;MAAuCD,EAAA,cAAa;AAAA;IAI1D,WAAQ;AAAA,IACP,gBAAgBE,EAAA,MAAK;AAAA,IACrB,aAAWF,EAAA;AAAA,IACX,cAAYE,EAAA,UAAUC,OAAK,yBAAyBC,EAAA,OAAM,YAAA;AAAA,KACnDJ,EAAA,eACRK,EAAML,EAAA,iBAAiB,CAAA,GAAA;AAAA,eAGvB,MAgBO;AAAA,MAfCA,EAAA,iBAAgB,UADxBM,EAgBO,QAAA;AAAA;QAdL,WAAQ;AAAA,QACP,OAAKC,EAAA;AAAA;;2BAAoEL,EAAA,SAAI;AAAA,aAA4BC,EAAA,wBAAwBD,EAAA,YAAY,CAAA,GAAIA,EAAA,SAAI;AAAA;;;QAStJM,EAGEJ,EAAA,QAAA,QAAA,EADC,UAAWJ,EAAA,SAAQ,CAAA;AAAA;MAIhBG,EAAA,eAAeC,EAAA,OAAO,OAAO,UADrCE,EAWO,QAAA;AAAA;QATL,WAAQ;AAAA,QACP,OAAKC,EAAA;AAAA;4BAA4DL,EAAA,SAAI,WAAA;AAAA,UAA2BA,EAAA;AAAA;;QAOjGM,EAAQJ,EAAA,QAAA,SAAA;AAAA;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),A=require("@dialpad/dialtone-icons/vue3"),h=require("date-fns"),$=require("./utils.cjs"),x=require("./datepicker-constants.cjs"),v=require("../../common/utils/index.cjs"),L=require("../../localization/index.cjs"),M=require("../stack/stack.cjs"),C=require("../tooltip/tooltip.cjs"),N=require("../button/button.cjs");function P(i,u){const c=e.ref(h.getMonth(i.selectedDate)),t=e.ref(h.getYear(i.selectedDate)),r=e.ref(null),n=e.ref(0),p=e.ref([]),f=new L.DialtoneLocalization,m=e.computed(()=>$.getCalendarDays(c.value,t.value,r.value));e.watch(c,()=>{l(),u("calendar-days",m.value)},{immediate:!0}),e.watch(t,()=>{l(),u("calendar-days",m.value)},{immediate:!0});function D(a){return $.formatMonth(a,x.INTL_MONTH_FORMAT,f.currentLocale)}function _(a){p.value.includes(a)||p.value.push(a)}function k(){v.returnFirstEl(p.value[0].$el).focus()}function b(a){switch(a.key){case"ArrowLeft":a.preventDefault(),n.value===0?(n.value=3,v.returnFirstEl(p.value[n.value].$el).focus()):(n.value--,v.returnFirstEl(p.value[n.value].$el).focus());break;case"ArrowRight":a.preventDefault(),n.value===3?(n.value=0,v.returnFirstEl(p.value[n.value].$el).focus()):(n.value++,v.returnFirstEl(p.value[n.value].$el).focus());break;case"ArrowDown":a.preventDefault(),u("focus-first-day");break;case"Tab":a.preventDefault(),u("focus-first-day");break;case"Escape":u("close-datepicker");break}}function l(){const a=h.getYear(i.selectedDate),g=h.getMonth(i.selectedDate);a!==t.value||g!==c.value?r.value=null:r.value=h.getDate(i.selectedDate)}function o(a){(c.value===0&&a===-1||c.value===11&&a===1)&&(t.value+=a);const g=h.set(i.selectedDate,{month:c.value,year:t.value}),R=a===1?h.addMonths(g,1):h.subMonths(g,1);c.value=h.getMonth(R)}function y(a){t.value=t.value+a}function d(){o(1)}function T(){o(-1)}function E(){return`${f.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${f.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR")} ${t.value-1}`}function w(){return`${f.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${f.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH")} ${D(c.value-1)}`}function I(){return`${f.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${f.$t("DIALTONE_DATEPICKER_NEXT_YEAR")} ${t.value+1}`}function s(){return`${f.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${f.$t("DIALTONE_DATEPICKER_NEXT_MONTH")} ${D(c.value+1)}`}return{selectMonth:c,selectYear:t,formattedMonth:D,setDayRef:_,focusMonthYearPicker:k,handleKeyDown:b,changeMonth:o,changeYear:y,goToNextMonth:d,goToPrevMonth:T,previousYearAriaLabel:E,previousMonthAriaLabel:w,nextYearAriaLabel:I,nextMonthAriaLabel:s}}const F={id:"calendar-heading",class:"d-datepicker__month-year-title"},O={__name:"month-year-picker",props:{selectedDate:{type:Date,required:!0}},emits:["calendar-days","focus-first-day","focus-last-day","close-datepicker"],setup(i,{expose:u,emit:c}){const t=i,r=c,n=new L.DialtoneLocalization,{selectMonth:p,selectYear:f,formattedMonth:m,setDayRef:D,focusMonthYearPicker:_,handleKeyDown:k,changeMonth:b,changeYear:l,goToNextMonth:o,goToPrevMonth:y,previousYearAriaLabel:d,previousMonthAriaLabel:T,nextMonthAriaLabel:E,nextYearAriaLabel:w}=P(t,r);return e.onMounted(()=>{_()}),u({focusMonthYearPicker:_,goToNextMonth:o,goToPrevMonth:y}),(I,s)=>(e.openBlock(),e.createBlock(e.unref(M.default),{class:"d-datepicker__month-year",direction:"row",gap:"300"},{default:e.withCtx(()=>[e.createVNode(e.unref(M.default),{as:"nav",class:"d-datepicker__nav",direction:"row",gap:"200"},{default:e.withCtx(()=>[e.createVNode(e.unref(C.default),{"fallback-placements":["top-start","auto"],message:e.unref(n).$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(N.default),{id:"prevYearButton",ref:a=>{a&&e.unref(D)(a)},"aria-label":e.unref(d)(),circle:!0,class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:s[0]||(s[0]=a=>e.unref(l)(-1)),onKeydown:s[1]||(s[1]=a=>e.unref(k)(a))},{default:e.withCtx(()=>[e.createVNode(e.unref(A.DtIconChevronsLeft),{size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"]),e.createVNode(e.unref(C.default),{"fallback-placements":["top-start","auto"],message:e.unref(n).$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(N.default),{id:"prevMonthButton",ref:a=>{a&&e.unref(D)(a)},"aria-label":e.unref(T)(),circle:!0,class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:s[2]||(s[2]=a=>e.unref(b)(-1)),onKeydown:s[3]||(s[3]=a=>e.unref(k)(a))},{default:e.withCtx(()=>[e.createVNode(e.unref(A.DtIconChevronLeft),{size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"])]),_:1}),e.createElementVNode("div",F,e.toDisplayString(e.unref(m)(e.unref(p)))+" "+e.toDisplayString(e.unref(f)),1),e.createVNode(e.unref(M.default),{as:"nav",class:"d-datepicker__nav",direction:"row",gap:"200"},{default:e.withCtx(()=>[e.createVNode(e.unref(C.default),{"fallback-placements":["top-end","auto"],message:e.unref(n).$t("DIALTONE_DATEPICKER_NEXT_MONTH"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(N.default),{id:"nextMonthButton",ref:a=>{a&&e.unref(D)(a)},"aria-label":e.unref(E)(),circle:!0,class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:s[4]||(s[4]=a=>e.unref(b)(1)),onKeydown:s[5]||(s[5]=a=>e.unref(k)(a))},{default:e.withCtx(()=>[e.createVNode(e.unref(A.DtIconChevronRight),{size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"]),e.createVNode(e.unref(C.default),{"fallback-placements":["top-end","auto"],message:e.unref(n).$t("DIALTONE_DATEPICKER_NEXT_YEAR"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(N.default),{id:"nextYearButton",ref:a=>{a&&e.unref(D)(a)},"aria-label":e.unref(w)(),circle:!0,class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:s[6]||(s[6]=a=>e.unref(l)(1)),onKeydown:s[7]||(s[7]=a=>e.unref(k)(a))},{default:e.withCtx(()=>[e.createVNode(e.unref(A.DtIconChevronsRight),{size:"200"})]),_:1},8,["aria-label"])]),_:1},8,["message"])]),_:1})]),_:1}))}};function V(i,u){const c=e.ref(null),t=e.ref(0),r=e.ref([]),n=new L.DialtoneLocalization,p=e.computed(()=>$.getWeekDayNames(i.locale,x.WEEK_START));e.watch(()=>i.calendarDays,()=>{t.value=0,r.value=[],c.value=null});function f(l){return n.$t("DIALTONE_DATEPICKER_SELECT_DAY")+` ${$.formatDate(l.value,x.INTL_MONTH_FORMAT,n.currentLocale)}`}function m(l,o){!r.value.some(y=>y.el===l)&&o.currentMonth&&r.value.push({el:l,day:o})}function D(l){switch(l.key){case"ArrowUp":l.preventDefault(),t.value-=7;try{v.returnFirstEl(r.value[t.value].el.$el).focus()}catch{const o=$.calculatePrevFocusDate(r.value[t.value+7].day.value);u("go-to-prev-month"),e.nextTick(()=>{v.returnFirstEl(r.value[o-1].el.$el).focus(),t.value+=o-1})}break;case"ArrowDown":l.preventDefault(),t.value+=7;try{v.returnFirstEl(r.value[t.value].el.$el).focus()}catch{const o=$.calculateNextFocusDate(r.value[t.value-7].day.value);u("go-to-next-month"),e.nextTick(()=>{v.returnFirstEl(r.value[o-1].el.$el).focus(),t.value+=o-1})}break;case"ArrowLeft":l.preventDefault(),t.value>0?(t.value-=1,v.returnFirstEl(r.value[t.value].el.$el).focus()):(u("go-to-prev-month"),k());break;case"ArrowRight":l.preventDefault(),t.value<r.value.length-1?(t.value+=1,v.returnFirstEl(r.value[t.value].el.$el).focus()):(u("go-to-next-month"),_());break;case"Tab":l.preventDefault(),u("focus-month-year-picker");break;case"Escape":u("close-datepicker");break}}function _(){t.value=0,e.nextTick(()=>{v.returnFirstEl(r.value[t.value].el.$el).focus()})}function k(){e.nextTick(()=>{t.value=r.value.length-1,v.returnFirstEl(r.value[t.value].el.$el).focus()})}function b(l){l.currentMonth&&(c.value=l.text,u("select-date",l.value))}return{selectedDay:c,weekDays:p,dayAriaLabel:f,setDayRef:m,handleKeyDown:D,focusFirstDay:_,selectDay:b}}const Y={class:"d-datepicker__calendar","aria-labelledby":"calendar-heading"},K=["title","aria-label"],B={__name:"calendar",props:{calendarDays:{type:Array,required:!0}},emits:["select-date","focus-month-year-picker","close-datepicker","go-to-next-month","go-to-prev-month"],setup(i,{expose:u,emit:c}){const t=i,r=c,{selectedDay:n,weekDays:p,dayAriaLabel:f,setDayRef:m,handleKeyDown:D,focusFirstDay:_,selectDay:k}=V(t,r);return u({focusFirstDay:_}),(b,l)=>(e.openBlock(),e.createElementBlock("table",Y,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),o=>(e.openBlock(),e.createElementBlock("th",{key:o,scope:"col",class:"d-datepicker__cell d-datepicker__cell--header"},[e.createElementVNode("span",{class:"d-datepicker__weekday",title:o,"aria-label":o},e.toDisplayString(o),9,K)]))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.calendarDays,(o,y)=>(e.openBlock(),e.createElementBlock("tr",{key:y},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.days,(d,T)=>(e.openBlock(),e.createElementBlock("td",{key:y+T,class:"d-datepicker__cell",role:"listbox"},[e.createVNode(e.unref(N.default),{ref_for:!0,ref:E=>{E&&e.unref(m)(E,d)},class:e.normalizeClass(["d-datepicker__day",{"d-datepicker__day--disabled":!d.currentMonth,"d-datepicker__day--selected":e.unref(n)?d.text===e.unref(n)&&d.currentMonth:d.selected}]),circle:!0,size:"sm",importance:"clear",disabled:!d.currentMonth,type:"button","aria-selected":e.unref(n)?d.text===e.unref(n)&&d.currentMonth:d.selected,"aria-label":e.unref(f)(d),role:"option",onClick:E=>e.unref(k)(d),onKeydown:l[0]||(l[0]=E=>e.unref(D)(E))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.text),1)]),_:2},1032,["disabled","class","aria-selected","aria-label","onClick"])]))),128))]))),128))])]))}},z={class:"d-datepicker__hd"},S={class:"d-datepicker__bd"},q={__name:"datepicker",props:{selectedDate:{type:Date,default:()=>new Date}},emits:["selected-date","close-datepicker"],setup(i){const u=e.ref([]);function c(t){u.value=t}return e.onMounted(()=>{const t=e.getCurrentInstance();v.warnIfUnmounted(v.returnFirstEl(t.proxy.$el),"datepicker")}),(t,r)=>(e.openBlock(),e.createBlock(e.unref(M.default),{class:"d-datepicker",gap:"400"},{default:e.withCtx(()=>[e.createElementVNode("div",z,[e.createVNode(O,{ref:"monthYearPicker","selected-date":i.selectedDate,onCalendarDays:c,onFocusFirstDay:r[0]||(r[0]=n=>t.$refs.calendar.focusFirstDay()),onFocusLastDay:r[1]||(r[1]=n=>t.$refs.calendar.focusLastDay()),onCloseDatepicker:r[2]||(r[2]=n=>t.$emit("close-datepicker"))},null,8,["selected-date"])]),e.createElementVNode("div",S,[e.createVNode(B,{ref:"calendar","calendar-days":u.value,onSelectDate:r[3]||(r[3]=n=>t.$emit("selected-date",n)),onFocusMonthYearPicker:r[4]||(r[4]=n=>t.$refs.monthYearPicker.focusMonthYearPicker()),onCloseDatepicker:r[5]||(r[5]=n=>t.$emit("close-datepicker")),onGoToNextMonth:r[6]||(r[6]=n=>t.$refs.monthYearPicker.goToNextMonth()),onGoToPrevMonth:r[7]||(r[7]=n=>t.$refs.monthYearPicker.goToPrevMonth())},null,8,["calendar-days"])])]),_:1}))}};exports.default=q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("@dialpad/dialtone-icons/vue3"),c=require("date-fns"),N=require("./utils.cjs"),P=require("./datepicker-constants.cjs"),v=require("../../common/utils/index.cjs"),R=require("../../localization/index.cjs"),A=require("../stack/stack.cjs"),M=require("../tooltip/tooltip.cjs"),T=require("../button/button.cjs");function V(r,o){const s=e.ref(c.getMonth(r.selectedDate)),a=e.ref(c.getYear(r.selectedDate)),n=e.ref(null),l=e.ref(0),m=e.ref([]),D=new R.DialtoneLocalization,b=e.computed(()=>N.getCalendarDays(s.value,a.value,n.value,r.minDate,r.maxDate)),k=e.computed(()=>{if(!r.minDate)return!1;const t=c.subMonths(new Date(a.value,s.value,1),1);return c.endOfMonth(t)<c.startOfDay(r.minDate)}),E=e.computed(()=>{if(!r.maxDate)return!1;const t=c.addMonths(new Date(a.value,s.value,1),1);return c.startOfMonth(t)>c.startOfDay(r.maxDate)}),p=e.computed(()=>{if(!r.minDate)return!1;const t=new Date(a.value-1,s.value,1);return c.endOfMonth(t)<c.startOfDay(r.minDate)}),_=e.computed(()=>{if(!r.maxDate)return!1;const t=new Date(a.value+1,s.value,1);return c.startOfMonth(t)>c.startOfDay(r.maxDate)});e.watch(s,()=>{$(),o("calendar-days",b.value)},{immediate:!0}),e.watch(a,()=>{$(),o("calendar-days",b.value)},{immediate:!0}),e.watch(()=>r.minDate,()=>{o("calendar-days",b.value)}),e.watch(()=>r.maxDate,()=>{o("calendar-days",b.value)});function u(t){return N.formatMonth(t,P.INTL_MONTH_FORMAT,D.currentLocale)}function i(t){m.value.includes(t)||m.value.push(t)}function y(){v.returnFirstEl(m.value[0].$el).focus()}function f(t){switch(t.key){case"ArrowLeft":t.preventDefault(),l.value===0?(l.value=3,v.returnFirstEl(m.value[l.value].$el).focus()):(l.value--,v.returnFirstEl(m.value[l.value].$el).focus());break;case"ArrowRight":t.preventDefault(),l.value===3?(l.value=0,v.returnFirstEl(m.value[l.value].$el).focus()):(l.value++,v.returnFirstEl(m.value[l.value].$el).focus());break;case"ArrowDown":t.preventDefault(),o("focus-first-day");break;case"Tab":t.preventDefault(),o("focus-first-day");break;case"Escape":o("close-datepicker");break}}function $(){const t=c.getYear(r.selectedDate),x=c.getMonth(r.selectedDate);t!==a.value||x!==s.value?n.value=null:n.value=c.getDate(r.selectedDate)}function h(t){if(t===-1&&k.value||t===1&&E.value)return;(s.value===0&&t===-1||s.value===11&&t===1)&&(a.value+=t);const x=c.set(r.selectedDate,{month:s.value,year:a.value}),F=t===1?c.addMonths(x,1):c.subMonths(x,1);s.value=c.getMonth(F)}function w(t){t===-1&&p.value||t===1&&_.value||(a.value=a.value+t)}function C(){h(1)}function L(){h(-1)}function I(){return`${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR")} ${a.value-1}`}function O(){return`${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH")} ${u(s.value-1)}`}function Y(){return`${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_NEXT_YEAR")} ${a.value+1}`}function d(){return`${D.$t("DIALTONE_DATEPICKER_CHANGE_TO")} ${D.$t("DIALTONE_DATEPICKER_NEXT_MONTH")} ${u(s.value+1)}`}return{selectMonth:s,selectYear:a,formattedMonth:u,setDayRef:i,focusMonthYearPicker:y,handleKeyDown:f,changeMonth:h,changeYear:w,goToNextMonth:C,goToPrevMonth:L,isPrevMonthDisabled:k,isNextMonthDisabled:E,isPrevYearDisabled:p,isNextYearDisabled:_,previousYearAriaLabel:I,previousMonthAriaLabel:O,nextYearAriaLabel:Y,nextMonthAriaLabel:d}}const K={id:"calendar-heading",class:"d-datepicker__month-year-title"},B={__name:"month-year-picker",props:{selectedDate:{type:Date,required:!0},minDate:{type:Date,default:null},maxDate:{type:Date,default:null}},emits:["calendar-days","focus-first-day","focus-last-day","close-datepicker"],setup(r,{expose:o,emit:s}){const a=r,n=s,l=new R.DialtoneLocalization,{selectMonth:m,selectYear:D,formattedMonth:b,setDayRef:k,focusMonthYearPicker:E,handleKeyDown:p,changeMonth:_,changeYear:u,goToNextMonth:i,goToPrevMonth:y,isPrevMonthDisabled:f,isNextMonthDisabled:$,isPrevYearDisabled:h,isNextYearDisabled:w,previousYearAriaLabel:C,previousMonthAriaLabel:L,nextMonthAriaLabel:I,nextYearAriaLabel:O}=V(a,n);return e.onMounted(()=>{E()}),o({focusMonthYearPicker:E,goToNextMonth:i,goToPrevMonth:y}),(Y,d)=>(e.openBlock(),e.createBlock(e.unref(A.default),{class:"d-datepicker__month-year",direction:"row",gap:"300"},{default:e.withCtx(()=>[e.createVNode(e.unref(A.default),{as:"nav",class:"d-datepicker__nav",direction:"row",gap:"200"},{default:e.withCtx(()=>[e.createVNode(e.unref(M.default),{"fallback-placements":["top-start","auto"],message:e.unref(l).$t("DIALTONE_DATEPICKER_PREVIOUS_YEAR"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(T.default),{id:"prevYearButton",ref:t=>{t&&e.unref(k)(t)},"aria-label":e.unref(C)(),circle:!0,disabled:e.unref(h),class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:d[0]||(d[0]=t=>e.unref(u)(-1)),onKeydown:d[1]||(d[1]=t=>e.unref(p)(t))},{default:e.withCtx(()=>[e.createVNode(e.unref(g.DtIconChevronsLeft),{size:"200"})]),_:1},8,["aria-label","disabled"])]),_:1},8,["message"]),e.createVNode(e.unref(M.default),{"fallback-placements":["top-start","auto"],message:e.unref(l).$t("DIALTONE_DATEPICKER_PREVIOUS_MONTH"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(T.default),{id:"prevMonthButton",ref:t=>{t&&e.unref(k)(t)},"aria-label":e.unref(L)(),circle:!0,disabled:e.unref(f),class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:d[2]||(d[2]=t=>e.unref(_)(-1)),onKeydown:d[3]||(d[3]=t=>e.unref(p)(t))},{default:e.withCtx(()=>[e.createVNode(e.unref(g.DtIconChevronLeft),{size:"200"})]),_:1},8,["aria-label","disabled"])]),_:1},8,["message"])]),_:1}),e.createElementVNode("div",K,e.toDisplayString(e.unref(b)(e.unref(m)))+" "+e.toDisplayString(e.unref(D)),1),e.createVNode(e.unref(A.default),{as:"nav",class:"d-datepicker__nav",direction:"row",gap:"200"},{default:e.withCtx(()=>[e.createVNode(e.unref(M.default),{"fallback-placements":["top-end","auto"],message:e.unref(l).$t("DIALTONE_DATEPICKER_NEXT_MONTH"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(T.default),{id:"nextMonthButton",ref:t=>{t&&e.unref(k)(t)},"aria-label":e.unref(I)(),circle:!0,disabled:e.unref($),class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:d[4]||(d[4]=t=>e.unref(_)(1)),onKeydown:d[5]||(d[5]=t=>e.unref(p)(t))},{default:e.withCtx(()=>[e.createVNode(e.unref(g.DtIconChevronRight),{size:"200"})]),_:1},8,["aria-label","disabled"])]),_:1},8,["message"]),e.createVNode(e.unref(M.default),{"fallback-placements":["top-end","auto"],message:e.unref(l).$t("DIALTONE_DATEPICKER_NEXT_YEAR"),placement:"top"},{anchor:e.withCtx(()=>[e.createVNode(e.unref(T.default),{id:"nextYearButton",ref:t=>{t&&e.unref(k)(t)},"aria-label":e.unref(O)(),circle:!0,disabled:e.unref(w),class:"d-datepicker__nav-btn",importance:"clear",kind:"muted",size:"xs",type:"button",onClick:d[6]||(d[6]=t=>e.unref(u)(1)),onKeydown:d[7]||(d[7]=t=>e.unref(p)(t))},{default:e.withCtx(()=>[e.createVNode(e.unref(g.DtIconChevronsRight),{size:"200"})]),_:1},8,["aria-label","disabled"])]),_:1},8,["message"])]),_:1})]),_:1}))}};function z(r,o){const s=e.ref(null),a=e.ref(0),n=e.ref([]),l=new R.DialtoneLocalization,m=e.computed(()=>N.getWeekDayNames(r.locale,P.WEEK_START));e.watch(()=>r.calendarDays,()=>{a.value=0,n.value=[],s.value=null});function D(u){return l.$t("DIALTONE_DATEPICKER_SELECT_DAY")+` ${N.formatDate(u.value,P.INTL_MONTH_FORMAT,l.currentLocale)}`}function b(u,i){!n.value.some(y=>y.el===u)&&!i.disabled&&n.value.push({el:u,day:i})}function k(u){switch(u.key){case"ArrowUp":u.preventDefault(),a.value-=7;try{v.returnFirstEl(n.value[a.value].el.$el).focus()}catch{const i=N.calculatePrevFocusDate(n.value[a.value+7].day.value);o("go-to-prev-month"),e.nextTick(()=>{v.returnFirstEl(n.value[i-1].el.$el).focus(),a.value+=i-1})}break;case"ArrowDown":u.preventDefault(),a.value+=7;try{v.returnFirstEl(n.value[a.value].el.$el).focus()}catch{const i=N.calculateNextFocusDate(n.value[a.value-7].day.value);o("go-to-next-month"),e.nextTick(()=>{v.returnFirstEl(n.value[i-1].el.$el).focus(),a.value+=i-1})}break;case"ArrowLeft":u.preventDefault(),a.value>0?(a.value-=1,v.returnFirstEl(n.value[a.value].el.$el).focus()):(o("go-to-prev-month"),p());break;case"ArrowRight":u.preventDefault(),a.value<n.value.length-1?(a.value+=1,v.returnFirstEl(n.value[a.value].el.$el).focus()):(o("go-to-next-month"),E());break;case"Tab":u.preventDefault(),o("focus-month-year-picker");break;case"Escape":o("close-datepicker");break}}function E(){a.value=0,e.nextTick(()=>{v.returnFirstEl(n.value[a.value].el.$el).focus()})}function p(){e.nextTick(()=>{a.value=n.value.length-1,v.returnFirstEl(n.value[a.value].el.$el).focus()})}function _(u){u.disabled||(s.value=u.text,o("select-date",u.value))}return{selectedDay:s,weekDays:m,dayAriaLabel:D,setDayRef:b,handleKeyDown:k,focusFirstDay:E,selectDay:_}}const q={class:"d-datepicker__calendar","aria-labelledby":"calendar-heading"},S=["title","aria-label"],H={__name:"calendar",props:{calendarDays:{type:Array,required:!0}},emits:["select-date","focus-month-year-picker","close-datepicker","go-to-next-month","go-to-prev-month"],setup(r,{expose:o,emit:s}){const a=r,n=s,{selectedDay:l,weekDays:m,dayAriaLabel:D,setDayRef:b,handleKeyDown:k,focusFirstDay:E,selectDay:p}=z(a,n);return o({focusFirstDay:E}),(_,u)=>(e.openBlock(),e.createElementBlock("table",q,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),i=>(e.openBlock(),e.createElementBlock("th",{key:i,scope:"col",class:"d-datepicker__cell d-datepicker__cell--header"},[e.createElementVNode("span",{class:"d-datepicker__weekday",title:i,"aria-label":i},e.toDisplayString(i),9,S)]))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.calendarDays,(i,y)=>(e.openBlock(),e.createElementBlock("tr",{key:y},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.days,(f,$)=>(e.openBlock(),e.createElementBlock("td",{key:y+$,class:"d-datepicker__cell",role:"listbox"},[e.createVNode(e.unref(T.default),{ref_for:!0,ref:h=>{h&&e.unref(b)(h,f)},class:e.normalizeClass(["d-datepicker__day",{"d-datepicker__day--disabled":f.disabled,"d-datepicker__day--selected":e.unref(l)?f.text===e.unref(l)&&!f.disabled:f.selected}]),circle:!0,size:"sm",importance:"clear",disabled:f.disabled,type:"button","aria-selected":e.unref(l)?f.text===e.unref(l)&&!f.disabled:f.selected,"aria-label":e.unref(D)(f),role:"option",onClick:h=>e.unref(p)(f),onKeydown:u[0]||(u[0]=h=>e.unref(k)(h))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.text),1)]),_:2},1032,["disabled","class","aria-selected","aria-label","onClick"])]))),128))]))),128))])]))}},G={class:"d-datepicker__hd"},U={class:"d-datepicker__bd"},X={__name:"datepicker",props:{selectedDate:{type:Date,default:()=>new Date},minDate:{type:Date,default:null},maxDate:{type:Date,default:null,validator:(r,o)=>r&&o.minDate&&r<o.minDate?(console.warn("[DtDatepicker]: maxDate must be after or equal to minDate."),!1):!0}},emits:["selected-date","close-datepicker"],setup(r){const o=e.ref([]);function s(a){o.value=a}return e.onMounted(()=>{const a=e.getCurrentInstance();v.warnIfUnmounted(v.returnFirstEl(a.proxy.$el),"datepicker")}),(a,n)=>(e.openBlock(),e.createBlock(e.unref(A.default),{class:"d-datepicker",gap:"400"},{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createVNode(B,{ref:"monthYearPicker","selected-date":r.selectedDate,"min-date":r.minDate,"max-date":r.maxDate,onCalendarDays:s,onFocusFirstDay:n[0]||(n[0]=l=>a.$refs.calendar.focusFirstDay()),onFocusLastDay:n[1]||(n[1]=l=>a.$refs.calendar.focusLastDay()),onCloseDatepicker:n[2]||(n[2]=l=>a.$emit("close-datepicker"))},null,8,["selected-date","min-date","max-date"])]),e.createElementVNode("div",U,[e.createVNode(H,{ref:"calendar","calendar-days":o.value,onSelectDate:n[3]||(n[3]=l=>a.$emit("selected-date",l)),onFocusMonthYearPicker:n[4]||(n[4]=l=>a.$refs.monthYearPicker.focusMonthYearPicker()),onCloseDatepicker:n[5]||(n[5]=l=>a.$emit("close-datepicker")),onGoToNextMonth:n[6]||(n[6]=l=>a.$refs.monthYearPicker.goToNextMonth()),onGoToPrevMonth:n[7]||(n[7]=l=>a.$refs.monthYearPicker.goToPrevMonth())},null,8,["calendar-days"])])]),_:1}))}};exports.default=X;
2
2
  //# sourceMappingURL=datepicker.cjs.map