@dialpad/dialtone 9.151.0 → 9.154.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -34
- package/dist/css/dialtone-default-theme.css +32 -15
- package/dist/css/dialtone-default-theme.min.css +1 -1
- package/dist/css/dialtone.css +32 -15
- package/dist/css/dialtone.min.css +1 -1
- package/dist/tokens/css/tokens-botany-dark.css +1 -1
- package/dist/tokens/css/tokens-buttercream-dark.css +1 -1
- package/dist/tokens/css/tokens-deca-light.css +3 -3
- package/dist/tokens/css/tokens-dp-dark.css +1 -1
- package/dist/tokens/css/tokens-expressive-dark.css +1 -1
- package/dist/tokens/css/tokens-expressive-sm-dark.css +1 -1
- package/dist/tokens/css/tokens-high-desert-dark.css +1 -1
- package/dist/tokens/css/tokens-plum-dark.css +1 -1
- package/dist/tokens/css/tokens-sunflower-dark.css +1 -1
- package/dist/tokens/css/tokens-tmo-dark.css +2 -2
- package/dist/tokens/doc.json +91886 -91886
- package/dist/tokens/themes/botany-dark.cjs +1 -1
- package/dist/tokens/themes/botany-dark.js +1 -1
- package/dist/tokens/themes/buttercream-dark.cjs +1 -1
- package/dist/tokens/themes/buttercream-dark.js +1 -1
- package/dist/tokens/themes/dp-dark.cjs +1 -1
- package/dist/tokens/themes/dp-dark.js +1 -1
- package/dist/tokens/themes/dp-deca-light.cjs +1 -1
- package/dist/tokens/themes/dp-deca-light.js +1 -1
- package/dist/tokens/themes/expressive-dark.cjs +1 -1
- package/dist/tokens/themes/expressive-dark.js +1 -1
- package/dist/tokens/themes/high-desert-dark.cjs +1 -1
- package/dist/tokens/themes/high-desert-dark.js +1 -1
- package/dist/tokens/themes/plum-dark.cjs +1 -1
- package/dist/tokens/themes/plum-dark.js +1 -1
- package/dist/tokens/themes/sunflower-dark.cjs +1 -1
- package/dist/tokens/themes/sunflower-dark.js +1 -1
- package/dist/tokens/themes/tmo-dark.cjs +1 -1
- package/dist/tokens/themes/tmo-dark.js +1 -1
- package/dist/vue2/component-documentation.json +1 -1
- package/dist/vue2/lib/stack/stack-constants.cjs +1 -1
- package/dist/vue2/lib/stack/stack-constants.cjs.map +1 -1
- package/dist/vue2/lib/stack/stack-constants.js +8 -8
- package/dist/vue2/lib/stack/stack-constants.js.map +1 -1
- package/dist/vue2/lib/stack/stack.cjs.map +1 -1
- package/dist/vue2/lib/stack/stack.js +1 -1
- package/dist/vue2/lib/stack/stack.js.map +1 -1
- package/dist/vue2/lib/stack/utils.cjs +1 -1
- package/dist/vue2/lib/stack/utils.cjs.map +1 -1
- package/dist/vue2/lib/stack/utils.js +56 -44
- package/dist/vue2/lib/stack/utils.js.map +1 -1
- package/dist/vue2/lib/tab/tab-group.cjs +1 -1
- package/dist/vue2/lib/tab/tab-group.cjs.map +1 -1
- package/dist/vue2/lib/tab/tab-group.js +4 -4
- package/dist/vue2/lib/tab/tab-group.js.map +1 -1
- package/dist/vue2/localization/index.cjs +1 -1
- package/dist/vue2/localization/index.cjs.map +1 -1
- package/dist/vue2/localization/index.js +46 -42
- package/dist/vue2/localization/index.js.map +1 -1
- package/dist/vue2/types/common/sr_only_close_button.vue.d.ts +2 -3
- package/dist/vue2/types/common/sr_only_close_button.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/breadcrumbs/breadcrumbs.vue.d.ts +1 -2
- package/dist/vue2/types/components/breadcrumbs/breadcrumbs.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/button/button.vue.d.ts +1 -2
- package/dist/vue2/types/components/button/button.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/chip/chip.vue.d.ts +2 -3
- package/dist/vue2/types/components/chip/chip.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/datepicker/modules/calendar.vue.d.ts +1 -2
- package/dist/vue2/types/components/datepicker/modules/calendar.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/datepicker/modules/month-year-picker.vue.d.ts +1 -2
- package/dist/vue2/types/components/datepicker/modules/month-year-picker.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/image_viewer/image_viewer.vue.d.ts +2 -3
- package/dist/vue2/types/components/image_viewer/image_viewer.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/loader/loader.vue.d.ts +1 -2
- package/dist/vue2/types/components/loader/loader.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/modal/modal.vue.d.ts +2 -3
- package/dist/vue2/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/notice/notice_action.vue.d.ts +2 -3
- package/dist/vue2/types/components/notice/notice_action.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/pagination/pagination.vue.d.ts +3 -4
- package/dist/vue2/types/components/pagination/pagination.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/popover/popover_header_footer.vue.d.ts +2 -3
- package/dist/vue2/types/components/popover/popover_header_footer.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts +1 -2
- package/dist/vue2/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue2/types/components/stack/stack_constants.d.ts.map +1 -1
- package/dist/vue2/types/components/stack/utils.d.ts.map +1 -1
- package/dist/vue2/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/cards/ivr_node/ivr_node.vue.d.ts +3 -4
- package/dist/vue2/types/recipes/cards/ivr_node/ivr_node.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts +1 -2
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts +14 -15
- package/dist/vue2/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +5 -6
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +8 -9
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +9 -10
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/general_row/general_row.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/group_row/group_row.vue.d.ts +1 -2
- package/dist/vue2/types/recipes/leftbar/group_row/group_row.vue.d.ts.map +1 -1
- package/dist/vue2/types/recipes/leftbar/unread_pill/unread_pill.vue.d.ts +2 -3
- package/dist/vue2/types/recipes/leftbar/unread_pill/unread_pill.vue.d.ts.map +1 -1
- package/dist/vue3/component-documentation.json +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.cjs.map +1 -1
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js +100 -93
- package/dist/vue3/lib/combobox-multi-select/combobox-multi-select.js.map +1 -1
- package/dist/vue3/lib/radio/radio.cjs +1 -1
- package/dist/vue3/lib/radio/radio.cjs.map +1 -1
- package/dist/vue3/lib/radio/radio.js +7 -14
- package/dist/vue3/lib/radio/radio.js.map +1 -1
- package/dist/vue3/lib/rich-text-editor/mention-suggestion.cjs +1 -1
- package/dist/vue3/lib/rich-text-editor/mention-suggestion.cjs.map +1 -1
- package/dist/vue3/lib/rich-text-editor/mention-suggestion.js +12 -2
- package/dist/vue3/lib/rich-text-editor/mention-suggestion.js.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +4 -4
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +141 -98
- package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/vue3/lib/stack/stack-constants.cjs +1 -1
- package/dist/vue3/lib/stack/stack-constants.cjs.map +1 -1
- package/dist/vue3/lib/stack/stack-constants.js +8 -8
- package/dist/vue3/lib/stack/stack-constants.js.map +1 -1
- package/dist/vue3/lib/stack/stack.cjs.map +1 -1
- package/dist/vue3/lib/stack/stack.js +1 -1
- package/dist/vue3/lib/stack/stack.js.map +1 -1
- package/dist/vue3/lib/stack/utils.cjs +1 -1
- package/dist/vue3/lib/stack/utils.cjs.map +1 -1
- package/dist/vue3/lib/stack/utils.js +56 -44
- package/dist/vue3/lib/stack/utils.js.map +1 -1
- package/dist/vue3/lib/tab/tab-group.cjs +1 -1
- package/dist/vue3/lib/tab/tab-group.cjs.map +1 -1
- package/dist/vue3/lib/tab/tab-group.js +1 -1
- package/dist/vue3/lib/tab/tab-group.js.map +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.cjs +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.cjs.map +1 -1
- package/dist/vue3/lib/tooltip-directive/tooltip.js +21 -21
- package/dist/vue3/lib/tooltip-directive/tooltip.js.map +1 -1
- package/dist/vue3/localization/index.cjs +1 -1
- package/dist/vue3/localization/index.cjs.map +1 -1
- package/dist/vue3/localization/index.js +48 -46
- package/dist/vue3/localization/index.js.map +1 -1
- package/dist/vue3/types/common/sr_only_close_button.vue.d.ts +2 -3
- package/dist/vue3/types/common/sr_only_close_button.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/breadcrumbs/breadcrumbs.vue.d.ts +1 -2
- package/dist/vue3/types/components/breadcrumbs/breadcrumbs.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/button/button.vue.d.ts +1 -2
- package/dist/vue3/types/components/button/button.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/chip/chip.vue.d.ts +2 -3
- package/dist/vue3/types/components/chip/chip.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/image_viewer/image_viewer.vue.d.ts +2 -3
- package/dist/vue3/types/components/image_viewer/image_viewer.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/modal/modal.vue.d.ts +2 -3
- package/dist/vue3/types/components/modal/modal.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/notice/notice_action.vue.d.ts +2 -3
- package/dist/vue3/types/components/notice/notice_action.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/pagination/pagination.vue.d.ts +3 -4
- package/dist/vue3/types/components/pagination/pagination.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/popover/popover_header_footer.vue.d.ts +2 -3
- package/dist/vue3/types/components/popover/popover_header_footer.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/radio/radio.vue.d.ts +1 -2
- package/dist/vue3/types/components/radio/radio.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts +3 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/channels/ChannelComponent.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/mentions/MentionComponent.vue.d.ts +3 -1
- package/dist/vue3/types/components/rich_text_editor/extensions/mentions/MentionComponent.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/mention_suggestion.d.ts +3 -0
- package/dist/vue3/types/components/rich_text_editor/mention_suggestion.d.ts.map +1 -1
- package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +4 -3
- package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +1 -1
- package/dist/vue3/types/components/stack/stack_constants.d.ts.map +1 -1
- package/dist/vue3/types/components/stack/utils.d.ts.map +1 -1
- package/dist/vue3/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/buttons/callbar_button_with_dropdown/callbar_button_with_dropdown.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/buttons/callbar_button_with_popover/callbar_button_with_popover.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/cards/ivr_node/ivr_node.vue.d.ts +3 -4
- package/dist/vue3/types/recipes/cards/ivr_node/ivr_node.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts +1 -2
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/attachment_carousel.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/conversation_view/attachment_carousel/media_components/image_carousel.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts +14 -15
- package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/emoji_row/composables/useMockReactions.d.ts +2 -0
- package/dist/vue3/types/recipes/conversation_view/emoji_row/composables/useMockReactions.d.ts.map +1 -0
- package/dist/vue3/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/conversation_view/emoji_row/emoji_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/conversation_view/feed_item_pill/feed_item_pill.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/conversation_view/message_input/extensions/meeting_pill/MeetingPill.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +5 -6
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts +8 -9
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_link.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts +9 -10
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input_topbar.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/leftbar/contact_centers_row/contact_centers_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/leftbar/general_row/general_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts +1 -2
- package/dist/vue3/types/recipes/leftbar/group_row/group_row.vue.d.ts.map +1 -1
- package/dist/vue3/types/recipes/leftbar/unread_pill/unread_pill.vue.d.ts +2 -3
- package/dist/vue3/types/recipes/leftbar/unread_pill/unread_pill.vue.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={default:"column",column:"column",row:"row","row-reverse":"row-reverse","column-reverse":"column-reverse"},t=["sm","md","lg","xl"],T=["0","50","100","200","300","350","400","450","500","525","550","600","625","650","700"],
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={default:"column",column:"column",row:"row","row-reverse":"row-reverse","column-reverse":"column-reverse"},t=["sm","md","lg","xl"],T=["0","50","100","200","300","350","400","450","500","525","550","600","625","650","700"],n=["start","center","end","stretch","baseline"],s=["start","center","end","space-around","space-between","space-evenly","around","between","evenly"],_={DT_STACK_DIRECTION:e,DT_STACK_RESPONSIVE_BREAKPOINTS:t,DT_STACK_GAP:T,DT_STACK_ALIGN:n,DT_STACK_JUSTIFY:s};exports.DT_STACK_ALIGN=n;exports.DT_STACK_DIRECTION=e;exports.DT_STACK_GAP=T;exports.DT_STACK_JUSTIFY=s;exports.DT_STACK_RESPONSIVE_BREAKPOINTS=t;exports.default=_;
|
|
2
2
|
//# sourceMappingURL=stack-constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-constants.cjs","sources":["../../../components/stack/stack_constants.js"],"sourcesContent":["/**\n * Direction values for the stack component.\n * Uses object format for historical compatibility - changing to array would be breaking.\n * The object keys are the valid values, and the values are the CSS class suffixes.\n * @type {Object<string, string>}\n */\nexport const DT_STACK_DIRECTION = {\n default: 'column',\n column: 'column',\n row: 'row',\n 'row-reverse': 'row-reverse',\n 'column-reverse': 'column-reverse',\n};\n\n/**\n * Responsive breakpoint names used for all responsive props.\n * @type {string[]}\n */\nexport const DT_STACK_RESPONSIVE_BREAKPOINTS = ['sm', 'md', 'lg', 'xl'];\n\n/**\n * Gap values for spacing between stack items.\n * Uses array format.\n * @type {string[]}\n */\nexport const DT_STACK_GAP = ['0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'];\n\n/**\n * Align values for the stack component (cross-axis alignment).\n * Uses array format - simpler structure for newer props.\n * @type {string[]}\n */\nexport const DT_STACK_ALIGN = ['start', 'center', 'end', 'stretch', 'baseline'];\n\n/**\n * Justify values for the stack component (main-axis distribution).\n * Uses array format - simpler structure for newer props.\n * @type {string[]}\n */\nexport const DT_STACK_JUSTIFY = ['start', 'center', 'end', 'around', 'between', 'evenly'];\n\nexport default {\n DT_STACK_DIRECTION,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_GAP,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n};\n"],"names":["DT_STACK_DIRECTION","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_GAP","DT_STACK_ALIGN","DT_STACK_JUSTIFY","stack_constants"],"mappings":"4GAMY,MAACA,EAAqB,CAChC,QAAS,SACT,OAAQ,SACR,IAAK,MACL,cAAe,cACf,iBAAkB,gBACpB,EAMaC,EAAkC,CAAC,KAAM,KAAM,KAAM,IAAI,EAOzDC,EAAe,CAAC,IAAK,KAAM,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,KAAK,EAOpHC,EAAiB,CAAC,QAAS,SAAU,MAAO,UAAW,UAAU,
|
|
1
|
+
{"version":3,"file":"stack-constants.cjs","sources":["../../../components/stack/stack_constants.js"],"sourcesContent":["/**\n * Direction values for the stack component.\n * Uses object format for historical compatibility - changing to array would be breaking.\n * The object keys are the valid values, and the values are the CSS class suffixes.\n * @type {Object<string, string>}\n */\nexport const DT_STACK_DIRECTION = {\n default: 'column',\n column: 'column',\n row: 'row',\n 'row-reverse': 'row-reverse',\n 'column-reverse': 'column-reverse',\n};\n\n/**\n * Responsive breakpoint names used for all responsive props.\n * @type {string[]}\n */\nexport const DT_STACK_RESPONSIVE_BREAKPOINTS = ['sm', 'md', 'lg', 'xl'];\n\n/**\n * Gap values for spacing between stack items.\n * Uses array format.\n * @type {string[]}\n */\nexport const DT_STACK_GAP = ['0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'];\n\n/**\n * Align values for the stack component (cross-axis alignment).\n * Uses array format - simpler structure for newer props.\n * @type {string[]}\n */\nexport const DT_STACK_ALIGN = ['start', 'center', 'end', 'stretch', 'baseline'];\n\n/**\n * Justify values for the stack component (main-axis distribution).\n * Uses array format - simpler structure for newer props.\n * Primary values align with CSS justify-content values.\n * @type {string[]}\n */\nexport const DT_STACK_JUSTIFY = ['start', 'center', 'end', 'space-around', 'space-between', 'space-evenly', 'around', 'between', 'evenly'];\n\nexport default {\n DT_STACK_DIRECTION,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_GAP,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n};\n"],"names":["DT_STACK_DIRECTION","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_GAP","DT_STACK_ALIGN","DT_STACK_JUSTIFY","stack_constants"],"mappings":"4GAMY,MAACA,EAAqB,CAChC,QAAS,SACT,OAAQ,SACR,IAAK,MACL,cAAe,cACf,iBAAkB,gBACpB,EAMaC,EAAkC,CAAC,KAAM,KAAM,KAAM,IAAI,EAOzDC,EAAe,CAAC,IAAK,KAAM,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,KAAK,EAOpHC,EAAiB,CAAC,QAAS,SAAU,MAAO,UAAW,UAAU,EAQjEC,EAAmB,CAAC,QAAS,SAAU,MAAO,eAAgB,gBAAiB,eAAgB,SAAU,UAAW,QAAQ,EAEzIC,EAAe,CACb,mBAAAL,EACA,gCAAAC,EACA,aAAAC,EACA,eAAAC,EACA,iBAAAC,CACF"}
|
|
@@ -4,19 +4,19 @@ const e = {
|
|
|
4
4
|
row: "row",
|
|
5
5
|
"row-reverse": "row-reverse",
|
|
6
6
|
"column-reverse": "column-reverse"
|
|
7
|
-
}, n = ["sm", "md", "lg", "xl"],
|
|
7
|
+
}, n = ["sm", "md", "lg", "xl"], s = ["0", "50", "100", "200", "300", "350", "400", "450", "500", "525", "550", "600", "625", "650", "700"], t = ["start", "center", "end", "stretch", "baseline"], r = ["start", "center", "end", "space-around", "space-between", "space-evenly", "around", "between", "evenly"], c = {
|
|
8
8
|
DT_STACK_DIRECTION: e,
|
|
9
9
|
DT_STACK_RESPONSIVE_BREAKPOINTS: n,
|
|
10
|
-
DT_STACK_GAP:
|
|
11
|
-
DT_STACK_ALIGN:
|
|
12
|
-
DT_STACK_JUSTIFY:
|
|
10
|
+
DT_STACK_GAP: s,
|
|
11
|
+
DT_STACK_ALIGN: t,
|
|
12
|
+
DT_STACK_JUSTIFY: r
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
t as DT_STACK_ALIGN,
|
|
16
16
|
e as DT_STACK_DIRECTION,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
s as DT_STACK_GAP,
|
|
18
|
+
r as DT_STACK_JUSTIFY,
|
|
19
19
|
n as DT_STACK_RESPONSIVE_BREAKPOINTS,
|
|
20
|
-
|
|
20
|
+
c as default
|
|
21
21
|
};
|
|
22
22
|
//# sourceMappingURL=stack-constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-constants.js","sources":["../../../components/stack/stack_constants.js"],"sourcesContent":["/**\n * Direction values for the stack component.\n * Uses object format for historical compatibility - changing to array would be breaking.\n * The object keys are the valid values, and the values are the CSS class suffixes.\n * @type {Object<string, string>}\n */\nexport const DT_STACK_DIRECTION = {\n default: 'column',\n column: 'column',\n row: 'row',\n 'row-reverse': 'row-reverse',\n 'column-reverse': 'column-reverse',\n};\n\n/**\n * Responsive breakpoint names used for all responsive props.\n * @type {string[]}\n */\nexport const DT_STACK_RESPONSIVE_BREAKPOINTS = ['sm', 'md', 'lg', 'xl'];\n\n/**\n * Gap values for spacing between stack items.\n * Uses array format.\n * @type {string[]}\n */\nexport const DT_STACK_GAP = ['0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'];\n\n/**\n * Align values for the stack component (cross-axis alignment).\n * Uses array format - simpler structure for newer props.\n * @type {string[]}\n */\nexport const DT_STACK_ALIGN = ['start', 'center', 'end', 'stretch', 'baseline'];\n\n/**\n * Justify values for the stack component (main-axis distribution).\n * Uses array format - simpler structure for newer props.\n * @type {string[]}\n */\nexport const DT_STACK_JUSTIFY = ['start', 'center', 'end', 'around', 'between', 'evenly'];\n\nexport default {\n DT_STACK_DIRECTION,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_GAP,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n};\n"],"names":["DT_STACK_DIRECTION","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_GAP","DT_STACK_ALIGN","DT_STACK_JUSTIFY","stack_constants"],"mappings":"AAMY,MAACA,IAAqB;AAAA,EAChC,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,eAAe;AAAA,EACf,kBAAkB;AACpB,GAMaC,IAAkC,CAAC,MAAM,MAAM,MAAM,IAAI,GAOzDC,IAAe,CAAC,KAAK,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAOpHC,IAAiB,CAAC,SAAS,UAAU,OAAO,WAAW,UAAU,
|
|
1
|
+
{"version":3,"file":"stack-constants.js","sources":["../../../components/stack/stack_constants.js"],"sourcesContent":["/**\n * Direction values for the stack component.\n * Uses object format for historical compatibility - changing to array would be breaking.\n * The object keys are the valid values, and the values are the CSS class suffixes.\n * @type {Object<string, string>}\n */\nexport const DT_STACK_DIRECTION = {\n default: 'column',\n column: 'column',\n row: 'row',\n 'row-reverse': 'row-reverse',\n 'column-reverse': 'column-reverse',\n};\n\n/**\n * Responsive breakpoint names used for all responsive props.\n * @type {string[]}\n */\nexport const DT_STACK_RESPONSIVE_BREAKPOINTS = ['sm', 'md', 'lg', 'xl'];\n\n/**\n * Gap values for spacing between stack items.\n * Uses array format.\n * @type {string[]}\n */\nexport const DT_STACK_GAP = ['0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'];\n\n/**\n * Align values for the stack component (cross-axis alignment).\n * Uses array format - simpler structure for newer props.\n * @type {string[]}\n */\nexport const DT_STACK_ALIGN = ['start', 'center', 'end', 'stretch', 'baseline'];\n\n/**\n * Justify values for the stack component (main-axis distribution).\n * Uses array format - simpler structure for newer props.\n * Primary values align with CSS justify-content values.\n * @type {string[]}\n */\nexport const DT_STACK_JUSTIFY = ['start', 'center', 'end', 'space-around', 'space-between', 'space-evenly', 'around', 'between', 'evenly'];\n\nexport default {\n DT_STACK_DIRECTION,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_GAP,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n};\n"],"names":["DT_STACK_DIRECTION","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_GAP","DT_STACK_ALIGN","DT_STACK_JUSTIFY","stack_constants"],"mappings":"AAMY,MAACA,IAAqB;AAAA,EAChC,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,eAAe;AAAA,EACf,kBAAkB;AACpB,GAMaC,IAAkC,CAAC,MAAM,MAAM,MAAM,IAAI,GAOzDC,IAAe,CAAC,KAAK,MAAM,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAOpHC,IAAiB,CAAC,SAAS,UAAU,OAAO,WAAW,UAAU,GAQjEC,IAAmB,CAAC,SAAS,UAAU,OAAO,gBAAgB,iBAAiB,gBAAgB,UAAU,WAAW,QAAQ,GAEzIC,IAAe;AAAA,EACb,oBAAAL;AAAA,EACA,iCAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.cjs","sources":["../../../components/stack/stack.vue"],"sourcesContent":["<template>\n <component\n :is=\"as\"\n data-qa=\"dt-stack\"\n :class=\"[\n 'd-stack',\n defaultDirection,\n defaultGap,\n defaultAlign,\n defaultJustify,\n stackResponsive,\n ]\"\n >\n <!-- @slot Slot for main content -->\n <slot />\n </component>\n</template>\n\n<script>\nimport { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from './stack_constants';\nimport { directionValidator, gapValidator, alignValidator, justifyValidator } from './validators';\nimport { getDefaultDirectionClass, getResponsiveClasses, getDefaultGapClass, getDefaultAlignClass, getDefaultJustifyClass } from './utils';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtStack',\n\n props: {\n /**\n * Set this prop to the direction to stack the items.\n * You can override the default direction with 'default' key.\n * All the undefined breakpoints will have 'default' value.\n * By default, for the column direction it will have `justify-content: flex-start`\n * and for the row direction `align-items: center`. This can be overridden\n * using the `align` and `justify` props.\n */\n direction: {\n type: [String, Object],\n default: 'column',\n validator: (direction) => directionValidator(direction),\n },\n\n /**\n * Set this prop to render stack as a specific HTML element.\n */\n as: {\n type: String,\n default: 'div',\n },\n\n /**\n * The gap property controls the spacing between items in the stack.\n * The gap can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default gap with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are '0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'.\n */\n gap: {\n type: [String, Object],\n default: '0',\n validator: (gap) => gapValidator(gap),\n },\n\n /**\n * The align property controls the alignment of items along the cross axis.\n * The align can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default align with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * If not specified, alignment uses CSS defaults: stretch for column direction,\n * center for row/row-reverse directions (set by CSS).\n * Valid values are 'start', 'center', 'end', 'stretch', 'baseline'.\n */\n align: {\n type: [String, Object],\n validator: (align) => alignValidator(align),\n },\n\n /**\n * The justify property controls the justification of items along the main axis.\n * The justify can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default justify with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are 'start', 'center', 'end', 'around', 'between', 'evenly'.\n */\n justify: {\n type: [String, Object],\n default: 'start',\n validator: (justify) => justifyValidator(justify),\n },\n },\n\n data () {\n return {\n DT_STACK_DIRECTION,\n DT_STACK_GAP,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n };\n },\n\n computed: {\n defaultGap () {\n return getDefaultGapClass(this.gap);\n },\n\n defaultDirection () {\n return getDefaultDirectionClass(this.direction);\n },\n\n defaultAlign () {\n return getDefaultAlignClass(this.align);\n },\n\n defaultJustify () {\n return getDefaultJustifyClass(this.justify);\n },\n\n stackResponsive () {\n return getResponsiveClasses(this.direction, this.gap, this.align, this.justify);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","direction","directionValidator","gap","gapValidator","align","alignValidator","justify","justifyValidator","DT_STACK_DIRECTION","DT_STACK_GAP","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_ALIGN","DT_STACK_JUSTIFY","getDefaultGapClass","getDefaultDirectionClass","getDefaultAlignClass","getDefaultJustifyClass","getResponsiveClasses","_createBlock","_resolveDynamicComponent","$props","_normalizeClass","$options","_withCtx","_renderSlot","_ctx"],"mappings":"uRAuBKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,UAEN,MAAO,CASL,UAAW,CACT,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,SACT,UAAYC,GAAcC,EAAAA,mBAAmBD,CAAS,GAMxD,GAAI,CACF,KAAM,OACN,QAAS,OAWX,IAAK,CACH,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,IACT,UAAYE,GAAQC,EAAAA,aAAaD,CAAG,GAatC,MAAO,CACL,KAAM,CAAC,OAAQ,MAAM,EACrB,UAAYE,GAAUC,EAAAA,eAAeD,CAAK,GAW5C,QAAS,CACP,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,QACT,UAAYE,GAAYC,EAAAA,iBAAiBD,CAAO,IAIpD,MAAQ,CACN,MAAO,CACL,mBAAAE,EAAAA,gCACAC,EAAAA,aACA,gCAAAC,EAAAA,gCACA,eAAAC,EAAAA,eACA,iBAAAC,EAAAA,iBAEJ,EAEA,SAAU,CACR,YAAc,CACZ,OAAOC,EAAAA,mBAAmB,KAAK,GAAG,CACpC,EAEA,kBAAoB,CAClB,OAAOC,EAAAA,yBAAyB,KAAK,SAAS,CAChD,EAEA,cAAgB,CACd,OAAOC,EAAAA,qBAAqB,KAAK,KAAK,CACxC,EAEA,gBAAkB,CAChB,OAAOC,EAAAA,uBAAuB,KAAK,OAAO,CAC5C,EAEA,iBAAmB,CACjB,OAAOC,EAAAA,qBAAqB,KAAK,UAAW,KAAK,IAAK,KAAK,MAAO,KAAK,OAAO,CAChF,EAEJ,+CA5HEC,EAAAA,YADFC,EAAAA,wBAESC,EAAA,EAAE,EAAA,CACP,UAAQ,WACP,MAJLC,EAAAA,eAAA,WAIqCC,EAAA,iBAAwBA,EAAA,WAAkBA,EAAA,aAAoBA,EAAA,eAAsBA,EAAA,oBAJzH,QAAAC,EAAAA,QAcI,IAAQ,CAARC,aAAQC,EAAA,OAAA,SAAA,IAdZ,EAAA"}
|
|
1
|
+
{"version":3,"file":"stack.cjs","sources":["../../../components/stack/stack.vue"],"sourcesContent":["<template>\n <component\n :is=\"as\"\n data-qa=\"dt-stack\"\n :class=\"[\n 'd-stack',\n defaultDirection,\n defaultGap,\n defaultAlign,\n defaultJustify,\n stackResponsive,\n ]\"\n >\n <!-- @slot Slot for main content -->\n <slot />\n </component>\n</template>\n\n<script>\nimport { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from './stack_constants';\nimport { directionValidator, gapValidator, alignValidator, justifyValidator } from './validators';\nimport { getDefaultDirectionClass, getResponsiveClasses, getDefaultGapClass, getDefaultAlignClass, getDefaultJustifyClass } from './utils';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtStack',\n\n props: {\n /**\n * Set this prop to the direction to stack the items.\n * You can override the default direction with 'default' key.\n * All the undefined breakpoints will have 'default' value.\n * By default, for the column direction it will have `justify-content: flex-start`\n * and for the row direction `align-items: center`. This can be overridden\n * using the `align` and `justify` props.\n */\n direction: {\n type: [String, Object],\n default: 'column',\n validator: (direction) => directionValidator(direction),\n },\n\n /**\n * Set this prop to render stack as a specific HTML element.\n */\n as: {\n type: String,\n default: 'div',\n },\n\n /**\n * The gap property controls the spacing between items in the stack.\n * The gap can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default gap with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are '0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'.\n */\n gap: {\n type: [String, Object],\n default: '0',\n validator: (gap) => gapValidator(gap),\n },\n\n /**\n * The align property controls the alignment of items along the cross axis.\n * The align can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default align with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * If not specified, alignment uses CSS defaults: stretch for column direction,\n * center for row/row-reverse directions (set by CSS).\n * Valid values are 'start', 'center', 'end', 'stretch', 'baseline'.\n */\n align: {\n type: [String, Object],\n validator: (align) => alignValidator(align),\n },\n\n /**\n * The justify property controls the justification of items along the main axis.\n * The justify can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default justify with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are 'start', 'center', 'end', 'space-around', 'space-between', 'space-evenly'.\n */\n justify: {\n type: [String, Object],\n default: 'start',\n validator: (justify) => justifyValidator(justify),\n },\n },\n\n data () {\n return {\n DT_STACK_DIRECTION,\n DT_STACK_GAP,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n };\n },\n\n computed: {\n defaultGap () {\n return getDefaultGapClass(this.gap);\n },\n\n defaultDirection () {\n return getDefaultDirectionClass(this.direction);\n },\n\n defaultAlign () {\n return getDefaultAlignClass(this.align);\n },\n\n defaultJustify () {\n return getDefaultJustifyClass(this.justify);\n },\n\n stackResponsive () {\n return getResponsiveClasses(this.direction, this.gap, this.align, this.justify);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","direction","directionValidator","gap","gapValidator","align","alignValidator","justify","justifyValidator","DT_STACK_DIRECTION","DT_STACK_GAP","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_ALIGN","DT_STACK_JUSTIFY","getDefaultGapClass","getDefaultDirectionClass","getDefaultAlignClass","getDefaultJustifyClass","getResponsiveClasses","_createBlock","_resolveDynamicComponent","$props","_normalizeClass","$options","_withCtx","_renderSlot","_ctx"],"mappings":"uRAuBKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,UAEN,MAAO,CASL,UAAW,CACT,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,SACT,UAAYC,GAAcC,EAAAA,mBAAmBD,CAAS,GAMxD,GAAI,CACF,KAAM,OACN,QAAS,OAWX,IAAK,CACH,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,IACT,UAAYE,GAAQC,EAAAA,aAAaD,CAAG,GAatC,MAAO,CACL,KAAM,CAAC,OAAQ,MAAM,EACrB,UAAYE,GAAUC,EAAAA,eAAeD,CAAK,GAW5C,QAAS,CACP,KAAM,CAAC,OAAQ,MAAM,EACrB,QAAS,QACT,UAAYE,GAAYC,EAAAA,iBAAiBD,CAAO,IAIpD,MAAQ,CACN,MAAO,CACL,mBAAAE,EAAAA,gCACAC,EAAAA,aACA,gCAAAC,EAAAA,gCACA,eAAAC,EAAAA,eACA,iBAAAC,EAAAA,iBAEJ,EAEA,SAAU,CACR,YAAc,CACZ,OAAOC,EAAAA,mBAAmB,KAAK,GAAG,CACpC,EAEA,kBAAoB,CAClB,OAAOC,EAAAA,yBAAyB,KAAK,SAAS,CAChD,EAEA,cAAgB,CACd,OAAOC,EAAAA,qBAAqB,KAAK,KAAK,CACxC,EAEA,gBAAkB,CAChB,OAAOC,EAAAA,uBAAuB,KAAK,OAAO,CAC5C,EAEA,iBAAmB,CACjB,OAAOC,EAAAA,qBAAqB,KAAK,UAAW,KAAK,IAAK,KAAK,MAAO,KAAK,OAAO,CAChF,EAEJ,+CA5HEC,EAAAA,YADFC,EAAAA,wBAESC,EAAA,EAAE,EAAA,CACP,UAAQ,WACP,MAJLC,EAAAA,eAAA,WAIqCC,EAAA,iBAAwBA,EAAA,WAAkBA,EAAA,aAAoBA,EAAA,eAAsBA,EAAA,oBAJzH,QAAAC,EAAAA,QAcI,IAAQ,CAARC,aAAQC,EAAA,OAAA,SAAA,IAdZ,EAAA"}
|
|
@@ -60,7 +60,7 @@ const v = {
|
|
|
60
60
|
* All the undefined breakpoints will have the 'default' value.
|
|
61
61
|
* You can override the default justify with 'default' key.
|
|
62
62
|
* In case of string, it will be applied to all the breakpoints.
|
|
63
|
-
* Valid values are 'start', 'center', 'end', 'around', 'between', 'evenly'.
|
|
63
|
+
* Valid values are 'start', 'center', 'end', 'space-around', 'space-between', 'space-evenly'.
|
|
64
64
|
*/
|
|
65
65
|
justify: {
|
|
66
66
|
type: [String, Object],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sources":["../../../components/stack/stack.vue"],"sourcesContent":["<template>\n <component\n :is=\"as\"\n data-qa=\"dt-stack\"\n :class=\"[\n 'd-stack',\n defaultDirection,\n defaultGap,\n defaultAlign,\n defaultJustify,\n stackResponsive,\n ]\"\n >\n <!-- @slot Slot for main content -->\n <slot />\n </component>\n</template>\n\n<script>\nimport { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from './stack_constants';\nimport { directionValidator, gapValidator, alignValidator, justifyValidator } from './validators';\nimport { getDefaultDirectionClass, getResponsiveClasses, getDefaultGapClass, getDefaultAlignClass, getDefaultJustifyClass } from './utils';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtStack',\n\n props: {\n /**\n * Set this prop to the direction to stack the items.\n * You can override the default direction with 'default' key.\n * All the undefined breakpoints will have 'default' value.\n * By default, for the column direction it will have `justify-content: flex-start`\n * and for the row direction `align-items: center`. This can be overridden\n * using the `align` and `justify` props.\n */\n direction: {\n type: [String, Object],\n default: 'column',\n validator: (direction) => directionValidator(direction),\n },\n\n /**\n * Set this prop to render stack as a specific HTML element.\n */\n as: {\n type: String,\n default: 'div',\n },\n\n /**\n * The gap property controls the spacing between items in the stack.\n * The gap can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default gap with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are '0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'.\n */\n gap: {\n type: [String, Object],\n default: '0',\n validator: (gap) => gapValidator(gap),\n },\n\n /**\n * The align property controls the alignment of items along the cross axis.\n * The align can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default align with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * If not specified, alignment uses CSS defaults: stretch for column direction,\n * center for row/row-reverse directions (set by CSS).\n * Valid values are 'start', 'center', 'end', 'stretch', 'baseline'.\n */\n align: {\n type: [String, Object],\n validator: (align) => alignValidator(align),\n },\n\n /**\n * The justify property controls the justification of items along the main axis.\n * The justify can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default justify with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are 'start', 'center', 'end', 'around', 'between', 'evenly'.\n */\n justify: {\n type: [String, Object],\n default: 'start',\n validator: (justify) => justifyValidator(justify),\n },\n },\n\n data () {\n return {\n DT_STACK_DIRECTION,\n DT_STACK_GAP,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n };\n },\n\n computed: {\n defaultGap () {\n return getDefaultGapClass(this.gap);\n },\n\n defaultDirection () {\n return getDefaultDirectionClass(this.direction);\n },\n\n defaultAlign () {\n return getDefaultAlignClass(this.align);\n },\n\n defaultJustify () {\n return getDefaultJustifyClass(this.justify);\n },\n\n stackResponsive () {\n return getResponsiveClasses(this.direction, this.gap, this.align, this.justify);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","direction","directionValidator","gap","gapValidator","align","alignValidator","justify","justifyValidator","DT_STACK_DIRECTION","DT_STACK_GAP","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_ALIGN","DT_STACK_JUSTIFY","getDefaultGapClass","getDefaultDirectionClass","getDefaultAlignClass","getDefaultJustifyClass","getResponsiveClasses","_createBlock","_resolveDynamicComponent","$props","_normalizeClass","$options","_withCtx","_renderSlot","_ctx"],"mappings":";;;;;AAuBA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,MACT,WAAW,CAACC,MAAcC,EAAmBD,CAAS;AAAA;;;;IAMxD,IAAI;AAAA,MACF,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;;;IAWX,KAAK;AAAA,MACH,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,MACT,WAAW,CAACE,MAAQC,EAAaD,CAAG;AAAA;;;;;;;;;;;IAatC,OAAO;AAAA,MACL,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,WAAW,CAACE,MAAUC,EAAeD,CAAK;AAAA;;;;;;;;;IAW5C,SAAS;AAAA,MACP,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,MACT,WAAW,CAACE,MAAYC,EAAiBD,CAAO;AAAA;;EAIpD,OAAQ;AACN,WAAO;AAAA,MACL,oBAAAE;AAAA,MACA,cAAAC;AAAA,MACA,iCAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA;EAEJ;AAAA,EAEA,UAAU;AAAA,IACR,aAAc;AACZ,aAAOC,EAAmB,KAAK,GAAG;AAAA,IACpC;AAAA,IAEA,mBAAoB;AAClB,aAAOC,EAAyB,KAAK,SAAS;AAAA,IAChD;AAAA,IAEA,eAAgB;AACd,aAAOC,EAAqB,KAAK,KAAK;AAAA,IACxC;AAAA,IAEA,iBAAkB;AAChB,aAAOC,EAAuB,KAAK,OAAO;AAAA,IAC5C;AAAA,IAEA,kBAAmB;AACjB,aAAOC,EAAqB,KAAK,WAAW,KAAK,KAAK,KAAK,OAAO,KAAK,OAAO;AAAA,IAChF;AAAA;AAEJ;;cA5HEC,EADFC,EAESC,EAAA,EAAE,GAAA;AAAA,IACP,WAAQ;AAAA,IACP,OAJLC,EAAA;AAAA;MAIqCC,EAAA;AAAA,MAAwBA,EAAA;AAAA,MAAkBA,EAAA;AAAA,MAAoBA,EAAA;AAAA,MAAsBA,EAAA;AAAA;;IAJzH,SAAAC,EAcI,MAAQ;AAAA,MAARC,EAAQC,EAAA,QAAA,SAAA;AAAA;IAdZ,GAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"stack.js","sources":["../../../components/stack/stack.vue"],"sourcesContent":["<template>\n <component\n :is=\"as\"\n data-qa=\"dt-stack\"\n :class=\"[\n 'd-stack',\n defaultDirection,\n defaultGap,\n defaultAlign,\n defaultJustify,\n stackResponsive,\n ]\"\n >\n <!-- @slot Slot for main content -->\n <slot />\n </component>\n</template>\n\n<script>\nimport { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from './stack_constants';\nimport { directionValidator, gapValidator, alignValidator, justifyValidator } from './validators';\nimport { getDefaultDirectionClass, getResponsiveClasses, getDefaultGapClass, getDefaultAlignClass, getDefaultJustifyClass } from './utils';\n\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtStack',\n\n props: {\n /**\n * Set this prop to the direction to stack the items.\n * You can override the default direction with 'default' key.\n * All the undefined breakpoints will have 'default' value.\n * By default, for the column direction it will have `justify-content: flex-start`\n * and for the row direction `align-items: center`. This can be overridden\n * using the `align` and `justify` props.\n */\n direction: {\n type: [String, Object],\n default: 'column',\n validator: (direction) => directionValidator(direction),\n },\n\n /**\n * Set this prop to render stack as a specific HTML element.\n */\n as: {\n type: String,\n default: 'div',\n },\n\n /**\n * The gap property controls the spacing between items in the stack.\n * The gap can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default gap with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are '0', '50', '100', '200', '300', '350', '400', '450', '500', '525', '550', '600', '625', '650', '700'.\n */\n gap: {\n type: [String, Object],\n default: '0',\n validator: (gap) => gapValidator(gap),\n },\n\n /**\n * The align property controls the alignment of items along the cross axis.\n * The align can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default align with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * If not specified, alignment uses CSS defaults: stretch for column direction,\n * center for row/row-reverse directions (set by CSS).\n * Valid values are 'start', 'center', 'end', 'stretch', 'baseline'.\n */\n align: {\n type: [String, Object],\n validator: (align) => alignValidator(align),\n },\n\n /**\n * The justify property controls the justification of items along the main axis.\n * The justify can be set to a string, or object with breakpoints.\n * All the undefined breakpoints will have the 'default' value.\n * You can override the default justify with 'default' key.\n * In case of string, it will be applied to all the breakpoints.\n * Valid values are 'start', 'center', 'end', 'space-around', 'space-between', 'space-evenly'.\n */\n justify: {\n type: [String, Object],\n default: 'start',\n validator: (justify) => justifyValidator(justify),\n },\n },\n\n data () {\n return {\n DT_STACK_DIRECTION,\n DT_STACK_GAP,\n DT_STACK_RESPONSIVE_BREAKPOINTS,\n DT_STACK_ALIGN,\n DT_STACK_JUSTIFY,\n };\n },\n\n computed: {\n defaultGap () {\n return getDefaultGapClass(this.gap);\n },\n\n defaultDirection () {\n return getDefaultDirectionClass(this.direction);\n },\n\n defaultAlign () {\n return getDefaultAlignClass(this.align);\n },\n\n defaultJustify () {\n return getDefaultJustifyClass(this.justify);\n },\n\n stackResponsive () {\n return getResponsiveClasses(this.direction, this.gap, this.align, this.justify);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","direction","directionValidator","gap","gapValidator","align","alignValidator","justify","justifyValidator","DT_STACK_DIRECTION","DT_STACK_GAP","DT_STACK_RESPONSIVE_BREAKPOINTS","DT_STACK_ALIGN","DT_STACK_JUSTIFY","getDefaultGapClass","getDefaultDirectionClass","getDefaultAlignClass","getDefaultJustifyClass","getResponsiveClasses","_createBlock","_resolveDynamicComponent","$props","_normalizeClass","$options","_withCtx","_renderSlot","_ctx"],"mappings":";;;;;AAuBA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,MACT,WAAW,CAACC,MAAcC,EAAmBD,CAAS;AAAA;;;;IAMxD,IAAI;AAAA,MACF,MAAM;AAAA,MACN,SAAS;AAAA;;;;;;;;;IAWX,KAAK;AAAA,MACH,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,MACT,WAAW,CAACE,MAAQC,EAAaD,CAAG;AAAA;;;;;;;;;;;IAatC,OAAO;AAAA,MACL,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,WAAW,CAACE,MAAUC,EAAeD,CAAK;AAAA;;;;;;;;;IAW5C,SAAS;AAAA,MACP,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,MACT,WAAW,CAACE,MAAYC,EAAiBD,CAAO;AAAA;;EAIpD,OAAQ;AACN,WAAO;AAAA,MACL,oBAAAE;AAAA,MACA,cAAAC;AAAA,MACA,iCAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA;EAEJ;AAAA,EAEA,UAAU;AAAA,IACR,aAAc;AACZ,aAAOC,EAAmB,KAAK,GAAG;AAAA,IACpC;AAAA,IAEA,mBAAoB;AAClB,aAAOC,EAAyB,KAAK,SAAS;AAAA,IAChD;AAAA,IAEA,eAAgB;AACd,aAAOC,EAAqB,KAAK,KAAK;AAAA,IACxC;AAAA,IAEA,iBAAkB;AAChB,aAAOC,EAAuB,KAAK,OAAO;AAAA,IAC5C;AAAA,IAEA,kBAAmB;AACjB,aAAOC,EAAqB,KAAK,WAAW,KAAK,KAAK,KAAK,OAAO,KAAK,OAAO;AAAA,IAChF;AAAA;AAEJ;;cA5HEC,EADFC,EAESC,EAAA,EAAE,GAAA;AAAA,IACP,WAAQ;AAAA,IACP,OAJLC,EAAA;AAAA;MAIqCC,EAAA;AAAA,MAAwBA,EAAA;AAAA,MAAkBA,EAAA;AAAA,MAAoBA,EAAA;AAAA,MAAsBA,EAAA;AAAA;;IAJzH,SAAAC,EAcI,MAAQ;AAAA,MAARC,EAAQC,EAAA,QAAA,SAAA;AAAA;IAdZ,GAAA;AAAA;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./stack-constants.cjs");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./stack-constants.cjs");function o(t){return t===n.DT_STACK_DIRECTION.default}function a(t){return typeof t=="string"?t:typeof t=="object"&&t!==null?t.default:null}function c(t){if(typeof t=="string")return o(t)?null:n.DT_STACK_DIRECTION[t];if(typeof t=="object"){const{default:e}=t;return o(e)?null:n.DT_STACK_DIRECTION[e]}else return null}function r(t,e,s,l="d-stack"){return typeof t!="object"||t===null?[]:n.DT_STACK_RESPONSIVE_BREAKPOINTS.map(u=>{const i=t[u];if(!i)return null;const T=Array.isArray(s)?s.includes(i):i in s,C=e===""?`${l}--${u}-${i}`:`${l}--${u}-${e}-${i}`;return T?C:null})}function _(t){return c(t)?`d-stack--${n.DT_STACK_DIRECTION[c(t)]}`:null}function D(t){return r(t,"",n.DT_STACK_DIRECTION)}function g(t){return r(t,"gap",n.DT_STACK_GAP)}function A(t){return r(t,"align",n.DT_STACK_ALIGN)}function S(t){return typeof t!="object"||t===null?[]:n.DT_STACK_RESPONSIVE_BREAKPOINTS.map(e=>{const s=t[e];if(!s)return null;const l=n.DT_STACK_JUSTIFY.includes(s),u=f(s);return l?`d-stack--${e}-justify-${u}`:null})}function d(t,e,s,l){return[...D(t),...g(e),...A(s),...S(l)]}function y(t){const e=a(t);return n.DT_STACK_GAP.includes(e)?`d-stack--gap-${e}`:null}function p(t){const e=a(t);return n.DT_STACK_ALIGN.includes(e)?`d-stack--align-${e}`:null}function f(t){return{"space-around":"around","space-between":"between","space-evenly":"evenly"}[t]||t}function I(t){const e=a(t),s=f(e);return n.DT_STACK_JUSTIFY.includes(e)?`d-stack--justify-${s}`:null}exports.getDefaultAlignClass=p;exports.getDefaultDirectionClass=_;exports.getDefaultGapClass=y;exports.getDefaultJustifyClass=I;exports.getResponsiveClasses=d;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../../components/stack/utils.js"],"sourcesContent":["import { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from '@/components/stack/stack_constants';\n\nfunction _isDefaultDirection (direction) {\n return direction === DT_STACK_DIRECTION.default;\n}\n\n/**\n * Generic helper to extract default value from string or object props\n * @param {string|Object} value - The prop value\n * @returns {string|null} The default value or null\n */\nfunction _getDefaultValue (value) {\n if (typeof value === 'string') return value;\n if (typeof value === 'object' && value !== null) return value.default;\n return null;\n}\n\nfunction _getValidDirection (direction) {\n if (typeof direction === 'string') {\n return !_isDefaultDirection(direction) ? DT_STACK_DIRECTION[direction] : null;\n } else if (typeof direction === 'object') {\n const { default: defaultStyle } = direction;\n\n return !_isDefaultDirection(defaultStyle) ? DT_STACK_DIRECTION[defaultStyle] : null;\n } else { return null; }\n}\n\n/**\n * Generic helper to generate responsive classes for any prop\n * @param {Object} propValue - The prop value object with breakpoint keys\n * @param {string} propName - The name of the prop (e.g., 'gap', 'align')\n * @param {Array|Object} validValues - Valid values (array or object for direction)\n * @param {string} classPrefix - CSS class prefix (default: 'd-stack')\n * @returns {Array} Array of CSS class names\n */\nfunction _getResponsiveClasses (propValue, propName, validValues, classPrefix = 'd-stack') {\n if (typeof propValue !== 'object' || propValue === null) return [];\n\n return DT_STACK_RESPONSIVE_BREAKPOINTS.map((breakpoint) => {\n const value = propValue[breakpoint];\n if (!value) return null;\n\n // Handle both array (gap, align, justify) and object (direction) validValues\n const isValid = Array.isArray(validValues)\n ? validValues.includes(value)\n : value in validValues;\n\n // For direction, we don't need the prop name in the class\n const className = propName === ''\n ? `${classPrefix}--${breakpoint}-${value}`\n : `${classPrefix}--${breakpoint}-${propName}-${value}`;\n\n return isValid ? className : null;\n });\n}\n\nexport function getDefaultDirectionClass (direction) {\n return _getValidDirection(direction)\n ? `d-stack--${DT_STACK_DIRECTION[_getValidDirection(direction)]}`\n : null;\n}\n\nfunction getResponsiveDirectionClasses (direction) {\n return _getResponsiveClasses(direction, '', DT_STACK_DIRECTION);\n}\n\nfunction getResponsiveGapClasses (gap) {\n return _getResponsiveClasses(gap, 'gap', DT_STACK_GAP);\n}\n\nfunction getResponsiveAlignClasses (align) {\n return _getResponsiveClasses(align, 'align', DT_STACK_ALIGN);\n}\n\nfunction getResponsiveJustifyClasses (justify) {\n
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../components/stack/utils.js"],"sourcesContent":["import { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from '@/components/stack/stack_constants';\n\nfunction _isDefaultDirection (direction) {\n return direction === DT_STACK_DIRECTION.default;\n}\n\n/**\n * Generic helper to extract default value from string or object props\n * @param {string|Object} value - The prop value\n * @returns {string|null} The default value or null\n */\nfunction _getDefaultValue (value) {\n if (typeof value === 'string') return value;\n if (typeof value === 'object' && value !== null) return value.default;\n return null;\n}\n\nfunction _getValidDirection (direction) {\n if (typeof direction === 'string') {\n return !_isDefaultDirection(direction) ? DT_STACK_DIRECTION[direction] : null;\n } else if (typeof direction === 'object') {\n const { default: defaultStyle } = direction;\n\n return !_isDefaultDirection(defaultStyle) ? DT_STACK_DIRECTION[defaultStyle] : null;\n } else { return null; }\n}\n\n/**\n * Generic helper to generate responsive classes for any prop\n * @param {Object} propValue - The prop value object with breakpoint keys\n * @param {string} propName - The name of the prop (e.g., 'gap', 'align')\n * @param {Array|Object} validValues - Valid values (array or object for direction)\n * @param {string} classPrefix - CSS class prefix (default: 'd-stack')\n * @returns {Array} Array of CSS class names\n */\nfunction _getResponsiveClasses (propValue, propName, validValues, classPrefix = 'd-stack') {\n if (typeof propValue !== 'object' || propValue === null) return [];\n\n return DT_STACK_RESPONSIVE_BREAKPOINTS.map((breakpoint) => {\n const value = propValue[breakpoint];\n if (!value) return null;\n\n // Handle both array (gap, align, justify) and object (direction) validValues\n const isValid = Array.isArray(validValues)\n ? validValues.includes(value)\n : value in validValues;\n\n // For direction, we don't need the prop name in the class\n const className = propName === ''\n ? `${classPrefix}--${breakpoint}-${value}`\n : `${classPrefix}--${breakpoint}-${propName}-${value}`;\n\n return isValid ? className : null;\n });\n}\n\nexport function getDefaultDirectionClass (direction) {\n return _getValidDirection(direction)\n ? `d-stack--${DT_STACK_DIRECTION[_getValidDirection(direction)]}`\n : null;\n}\n\nfunction getResponsiveDirectionClasses (direction) {\n return _getResponsiveClasses(direction, '', DT_STACK_DIRECTION);\n}\n\nfunction getResponsiveGapClasses (gap) {\n return _getResponsiveClasses(gap, 'gap', DT_STACK_GAP);\n}\n\nfunction getResponsiveAlignClasses (align) {\n return _getResponsiveClasses(align, 'align', DT_STACK_ALIGN);\n}\n\nfunction getResponsiveJustifyClasses (justify) {\n if (typeof justify !== 'object' || justify === null) return [];\n\n return DT_STACK_RESPONSIVE_BREAKPOINTS.map((breakpoint) => {\n const value = justify[breakpoint];\n if (!value) return null;\n\n const isValid = DT_STACK_JUSTIFY.includes(value);\n const normalizedValue = _normalizeJustifyForClass(value);\n\n return isValid ? `d-stack--${breakpoint}-justify-${normalizedValue}` : null;\n });\n}\n\nexport function getResponsiveClasses (direction, gap, align, justify) {\n return [\n ...getResponsiveDirectionClasses(direction),\n ...getResponsiveGapClasses(gap),\n ...getResponsiveAlignClasses(align),\n ...getResponsiveJustifyClasses(justify),\n ];\n}\n\nexport function getDefaultGapClass (gap) {\n const validGap = _getDefaultValue(gap);\n return DT_STACK_GAP.includes(validGap) ? `d-stack--gap-${validGap}` : null;\n}\n\nexport function getDefaultAlignClass (align) {\n const validAlign = _getDefaultValue(align);\n return DT_STACK_ALIGN.includes(validAlign) ? `d-stack--align-${validAlign}` : null;\n}\n\n/**\n * Normalizes justify value to CSS class suffix.\n * Maps CSS-aligned values (space-around, space-between, space-evenly) to shorthand\n * (around, between, evenly) for CSS class generation.\n * @param {string} value - The justify value\n * @returns {string} The normalized value for CSS class\n */\nfunction _normalizeJustifyForClass (value) {\n const normalizeMap = {\n 'space-around': 'around',\n 'space-between': 'between',\n 'space-evenly': 'evenly',\n };\n return normalizeMap[value] || value;\n}\n\nexport function getDefaultJustifyClass (justify) {\n const validJustify = _getDefaultValue(justify);\n const normalizedJustify = _normalizeJustifyForClass(validJustify);\n return DT_STACK_JUSTIFY.includes(validJustify) ? `d-stack--justify-${normalizedJustify}` : null;\n}"],"names":["_isDefaultDirection","direction","DT_STACK_DIRECTION","_getDefaultValue","value","_getValidDirection","defaultStyle","_getResponsiveClasses","propValue","propName","validValues","classPrefix","DT_STACK_RESPONSIVE_BREAKPOINTS","breakpoint","isValid","className","getDefaultDirectionClass","getResponsiveDirectionClasses","getResponsiveGapClasses","gap","DT_STACK_GAP","getResponsiveAlignClasses","align","DT_STACK_ALIGN","getResponsiveJustifyClasses","justify","DT_STACK_JUSTIFY","normalizedValue","_normalizeJustifyForClass","getResponsiveClasses","getDefaultGapClass","validGap","getDefaultAlignClass","validAlign","getDefaultJustifyClass","validJustify","normalizedJustify"],"mappings":"yHAEA,SAASA,EAAqBC,EAAW,CACvC,OAAOA,IAAcC,EAAAA,mBAAmB,OAC1C,CAOA,SAASC,EAAkBC,EAAO,CAChC,OAAI,OAAOA,GAAU,SAAiBA,EAClC,OAAOA,GAAU,UAAYA,IAAU,KAAaA,EAAM,QACvD,IACT,CAEA,SAASC,EAAoBJ,EAAW,CACtC,GAAI,OAAOA,GAAc,SACvB,OAAQD,EAAoBC,CAAS,EAAoC,KAAhCC,EAAAA,mBAAmBD,CAAS,EAChE,GAAI,OAAOA,GAAc,SAAU,CACxC,KAAM,CAAE,QAASK,CAAY,EAAKL,EAElC,OAAQD,EAAoBM,CAAY,EAAuC,KAAnCJ,EAAAA,mBAAmBI,CAAY,CAC7E,KAAS,QAAO,IAClB,CAUA,SAASC,EAAuBC,EAAWC,EAAUC,EAAaC,EAAc,UAAW,CACzF,OAAI,OAAOH,GAAc,UAAYA,IAAc,KAAa,CAAA,EAEzDI,EAAAA,gCAAgC,IAAKC,GAAe,CACzD,MAAMT,EAAQI,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B,CAAG,EACrC,OAAOC,EAAAA,aAAa,SAASW,CAAQ,EAAI,gBAAgBA,CAAQ,GAAK,IACxE,CAEO,SAASC,EAAsBV,EAAO,CAC3C,MAAMW,EAAa9B,EAAiBmB,CAAK,EACzC,OAAOC,EAAAA,eAAe,SAASU,CAAU,EAAI,kBAAkBA,CAAU,GAAK,IAChF,CASA,SAASL,EAA2BxB,EAAO,CAMzC,MALqB,CACnB,eAAgB,SAChB,gBAAiB,UACjB,eAAgB,QACpB,EACsBA,CAAK,GAAKA,CAChC,CAEO,SAAS8B,EAAwBT,EAAS,CAC/C,MAAMU,EAAehC,EAAiBsB,CAAO,EACvCW,EAAoBR,EAA0BO,CAAY,EAChE,OAAOT,EAAAA,iBAAiB,SAASS,CAAY,EAAI,oBAAoBC,CAAiB,GAAK,IAC7F"}
|
|
@@ -1,67 +1,79 @@
|
|
|
1
|
-
import { DT_STACK_DIRECTION as
|
|
2
|
-
function
|
|
3
|
-
return
|
|
1
|
+
import { DT_STACK_DIRECTION as r, DT_STACK_GAP as f, DT_STACK_ALIGN as g, DT_STACK_JUSTIFY as d, DT_STACK_RESPONSIVE_BREAKPOINTS as p } from "./stack-constants.js";
|
|
2
|
+
function o(n) {
|
|
3
|
+
return n === r.default;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return typeof
|
|
5
|
+
function i(n) {
|
|
6
|
+
return typeof n == "string" ? n : typeof n == "object" && n !== null ? n.default : null;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
if (typeof
|
|
10
|
-
return
|
|
11
|
-
if (typeof
|
|
12
|
-
const { default:
|
|
13
|
-
return
|
|
8
|
+
function c(n) {
|
|
9
|
+
if (typeof n == "string")
|
|
10
|
+
return o(n) ? null : r[n];
|
|
11
|
+
if (typeof n == "object") {
|
|
12
|
+
const { default: t } = n;
|
|
13
|
+
return o(t) ? null : r[t];
|
|
14
14
|
} else
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
const
|
|
22
|
-
return
|
|
17
|
+
function a(n, t, e, s = "d-stack") {
|
|
18
|
+
return typeof n != "object" || n === null ? [] : p.map((l) => {
|
|
19
|
+
const u = n[l];
|
|
20
|
+
if (!u) return null;
|
|
21
|
+
const y = Array.isArray(e) ? e.includes(u) : u in e, D = t === "" ? `${s}--${l}-${u}` : `${s}--${l}-${t}-${u}`;
|
|
22
|
+
return y ? D : null;
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function m(n) {
|
|
26
|
+
return c(n) ? `d-stack--${r[c(n)]}` : null;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
28
|
+
function _(n) {
|
|
29
|
+
return a(n, "", r);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function A(n) {
|
|
32
|
+
return a(n, "gap", f);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
34
|
+
function T(n) {
|
|
35
|
+
return a(n, "align", g);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
function $(n) {
|
|
38
|
+
return typeof n != "object" || n === null ? [] : p.map((t) => {
|
|
39
|
+
const e = n[t];
|
|
40
|
+
if (!e) return null;
|
|
41
|
+
const s = d.includes(e), l = C(e);
|
|
42
|
+
return s ? `d-stack--${t}-justify-${l}` : null;
|
|
43
|
+
});
|
|
39
44
|
}
|
|
40
|
-
function R(
|
|
45
|
+
function R(n, t, e, s) {
|
|
41
46
|
return [
|
|
47
|
+
..._(n),
|
|
42
48
|
...A(t),
|
|
43
|
-
...T(
|
|
44
|
-
|
|
45
|
-
...p(l)
|
|
49
|
+
...T(e),
|
|
50
|
+
...$(s)
|
|
46
51
|
];
|
|
47
52
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
return
|
|
53
|
+
function v(n) {
|
|
54
|
+
const t = i(n);
|
|
55
|
+
return f.includes(t) ? `d-stack--gap-${t}` : null;
|
|
56
|
+
}
|
|
57
|
+
function I(n) {
|
|
58
|
+
const t = i(n);
|
|
59
|
+
return g.includes(t) ? `d-stack--align-${t}` : null;
|
|
51
60
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
function C(n) {
|
|
62
|
+
return {
|
|
63
|
+
"space-around": "around",
|
|
64
|
+
"space-between": "between",
|
|
65
|
+
"space-evenly": "evenly"
|
|
66
|
+
}[n] || n;
|
|
55
67
|
}
|
|
56
|
-
function
|
|
57
|
-
const n =
|
|
58
|
-
return
|
|
68
|
+
function J(n) {
|
|
69
|
+
const t = i(n), e = C(t);
|
|
70
|
+
return d.includes(t) ? `d-stack--justify-${e}` : null;
|
|
59
71
|
}
|
|
60
72
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
I as getDefaultAlignClass,
|
|
74
|
+
m as getDefaultDirectionClass,
|
|
75
|
+
v as getDefaultGapClass,
|
|
76
|
+
J as getDefaultJustifyClass,
|
|
65
77
|
R as getResponsiveClasses
|
|
66
78
|
};
|
|
67
79
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../components/stack/utils.js"],"sourcesContent":["import { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from '@/components/stack/stack_constants';\n\nfunction _isDefaultDirection (direction) {\n return direction === DT_STACK_DIRECTION.default;\n}\n\n/**\n * Generic helper to extract default value from string or object props\n * @param {string|Object} value - The prop value\n * @returns {string|null} The default value or null\n */\nfunction _getDefaultValue (value) {\n if (typeof value === 'string') return value;\n if (typeof value === 'object' && value !== null) return value.default;\n return null;\n}\n\nfunction _getValidDirection (direction) {\n if (typeof direction === 'string') {\n return !_isDefaultDirection(direction) ? DT_STACK_DIRECTION[direction] : null;\n } else if (typeof direction === 'object') {\n const { default: defaultStyle } = direction;\n\n return !_isDefaultDirection(defaultStyle) ? DT_STACK_DIRECTION[defaultStyle] : null;\n } else { return null; }\n}\n\n/**\n * Generic helper to generate responsive classes for any prop\n * @param {Object} propValue - The prop value object with breakpoint keys\n * @param {string} propName - The name of the prop (e.g., 'gap', 'align')\n * @param {Array|Object} validValues - Valid values (array or object for direction)\n * @param {string} classPrefix - CSS class prefix (default: 'd-stack')\n * @returns {Array} Array of CSS class names\n */\nfunction _getResponsiveClasses (propValue, propName, validValues, classPrefix = 'd-stack') {\n if (typeof propValue !== 'object' || propValue === null) return [];\n\n return DT_STACK_RESPONSIVE_BREAKPOINTS.map((breakpoint) => {\n const value = propValue[breakpoint];\n if (!value) return null;\n\n // Handle both array (gap, align, justify) and object (direction) validValues\n const isValid = Array.isArray(validValues)\n ? validValues.includes(value)\n : value in validValues;\n\n // For direction, we don't need the prop name in the class\n const className = propName === ''\n ? `${classPrefix}--${breakpoint}-${value}`\n : `${classPrefix}--${breakpoint}-${propName}-${value}`;\n\n return isValid ? className : null;\n });\n}\n\nexport function getDefaultDirectionClass (direction) {\n return _getValidDirection(direction)\n ? `d-stack--${DT_STACK_DIRECTION[_getValidDirection(direction)]}`\n : null;\n}\n\nfunction getResponsiveDirectionClasses (direction) {\n return _getResponsiveClasses(direction, '', DT_STACK_DIRECTION);\n}\n\nfunction getResponsiveGapClasses (gap) {\n return _getResponsiveClasses(gap, 'gap', DT_STACK_GAP);\n}\n\nfunction getResponsiveAlignClasses (align) {\n return _getResponsiveClasses(align, 'align', DT_STACK_ALIGN);\n}\n\nfunction getResponsiveJustifyClasses (justify) {\n
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../components/stack/utils.js"],"sourcesContent":["import { DT_STACK_DIRECTION, DT_STACK_GAP, DT_STACK_RESPONSIVE_BREAKPOINTS, DT_STACK_ALIGN, DT_STACK_JUSTIFY } from '@/components/stack/stack_constants';\n\nfunction _isDefaultDirection (direction) {\n return direction === DT_STACK_DIRECTION.default;\n}\n\n/**\n * Generic helper to extract default value from string or object props\n * @param {string|Object} value - The prop value\n * @returns {string|null} The default value or null\n */\nfunction _getDefaultValue (value) {\n if (typeof value === 'string') return value;\n if (typeof value === 'object' && value !== null) return value.default;\n return null;\n}\n\nfunction _getValidDirection (direction) {\n if (typeof direction === 'string') {\n return !_isDefaultDirection(direction) ? DT_STACK_DIRECTION[direction] : null;\n } else if (typeof direction === 'object') {\n const { default: defaultStyle } = direction;\n\n return !_isDefaultDirection(defaultStyle) ? DT_STACK_DIRECTION[defaultStyle] : null;\n } else { return null; }\n}\n\n/**\n * Generic helper to generate responsive classes for any prop\n * @param {Object} propValue - The prop value object with breakpoint keys\n * @param {string} propName - The name of the prop (e.g., 'gap', 'align')\n * @param {Array|Object} validValues - Valid values (array or object for direction)\n * @param {string} classPrefix - CSS class prefix (default: 'd-stack')\n * @returns {Array} Array of CSS class names\n */\nfunction _getResponsiveClasses (propValue, propName, validValues, classPrefix = 'd-stack') {\n if (typeof propValue !== 'object' || propValue === null) return [];\n\n return DT_STACK_RESPONSIVE_BREAKPOINTS.map((breakpoint) => {\n const value = propValue[breakpoint];\n if (!value) return null;\n\n // Handle both array (gap, align, justify) and object (direction) validValues\n const isValid = Array.isArray(validValues)\n ? validValues.includes(value)\n : value in validValues;\n\n // For direction, we don't need the prop name in the class\n const className = propName === ''\n ? `${classPrefix}--${breakpoint}-${value}`\n : `${classPrefix}--${breakpoint}-${propName}-${value}`;\n\n return isValid ? className : null;\n });\n}\n\nexport function getDefaultDirectionClass (direction) {\n return _getValidDirection(direction)\n ? `d-stack--${DT_STACK_DIRECTION[_getValidDirection(direction)]}`\n : null;\n}\n\nfunction getResponsiveDirectionClasses (direction) {\n return _getResponsiveClasses(direction, '', DT_STACK_DIRECTION);\n}\n\nfunction getResponsiveGapClasses (gap) {\n return _getResponsiveClasses(gap, 'gap', DT_STACK_GAP);\n}\n\nfunction getResponsiveAlignClasses (align) {\n return _getResponsiveClasses(align, 'align', DT_STACK_ALIGN);\n}\n\nfunction getResponsiveJustifyClasses (justify) {\n if (typeof justify !== 'object' || justify === null) return [];\n\n return DT_STACK_RESPONSIVE_BREAKPOINTS.map((breakpoint) => {\n const value = justify[breakpoint];\n if (!value) return null;\n\n const isValid = DT_STACK_JUSTIFY.includes(value);\n const normalizedValue = _normalizeJustifyForClass(value);\n\n return isValid ? `d-stack--${breakpoint}-justify-${normalizedValue}` : null;\n });\n}\n\nexport function getResponsiveClasses (direction, gap, align, justify) {\n return [\n ...getResponsiveDirectionClasses(direction),\n ...getResponsiveGapClasses(gap),\n ...getResponsiveAlignClasses(align),\n ...getResponsiveJustifyClasses(justify),\n ];\n}\n\nexport function getDefaultGapClass (gap) {\n const validGap = _getDefaultValue(gap);\n return DT_STACK_GAP.includes(validGap) ? `d-stack--gap-${validGap}` : null;\n}\n\nexport function getDefaultAlignClass (align) {\n const validAlign = _getDefaultValue(align);\n return DT_STACK_ALIGN.includes(validAlign) ? `d-stack--align-${validAlign}` : null;\n}\n\n/**\n * Normalizes justify value to CSS class suffix.\n * Maps CSS-aligned values (space-around, space-between, space-evenly) to shorthand\n * (around, between, evenly) for CSS class generation.\n * @param {string} value - The justify value\n * @returns {string} The normalized value for CSS class\n */\nfunction _normalizeJustifyForClass (value) {\n const normalizeMap = {\n 'space-around': 'around',\n 'space-between': 'between',\n 'space-evenly': 'evenly',\n };\n return normalizeMap[value] || value;\n}\n\nexport function getDefaultJustifyClass (justify) {\n const validJustify = _getDefaultValue(justify);\n const normalizedJustify = _normalizeJustifyForClass(validJustify);\n return DT_STACK_JUSTIFY.includes(validJustify) ? `d-stack--justify-${normalizedJustify}` : null;\n}"],"names":["_isDefaultDirection","direction","DT_STACK_DIRECTION","_getDefaultValue","value","_getValidDirection","defaultStyle","_getResponsiveClasses","propValue","propName","validValues","classPrefix","DT_STACK_RESPONSIVE_BREAKPOINTS","breakpoint","isValid","className","getDefaultDirectionClass","getResponsiveDirectionClasses","getResponsiveGapClasses","gap","DT_STACK_GAP","getResponsiveAlignClasses","align","DT_STACK_ALIGN","getResponsiveJustifyClasses","justify","DT_STACK_JUSTIFY","normalizedValue","_normalizeJustifyForClass","getResponsiveClasses","getDefaultGapClass","validGap","getDefaultAlignClass","validAlign","getDefaultJustifyClass","validJustify","normalizedJustify"],"mappings":";AAEA,SAASA,EAAqBC,GAAW;AACvC,SAAOA,MAAcC,EAAmB;AAC1C;AAOA,SAASC,EAAkBC,GAAO;AAChC,SAAI,OAAOA,KAAU,WAAiBA,IAClC,OAAOA,KAAU,YAAYA,MAAU,OAAaA,EAAM,UACvD;AACT;AAEA,SAASC,EAAoBJ,GAAW;AACtC,MAAI,OAAOA,KAAc;AACvB,WAAQD,EAAoBC,CAAS,IAAoC,OAAhCC,EAAmBD,CAAS;AAChE,MAAI,OAAOA,KAAc,UAAU;AACxC,UAAM,EAAE,SAASK,EAAY,IAAKL;AAElC,WAAQD,EAAoBM,CAAY,IAAuC,OAAnCJ,EAAmBI,CAAY;AAAA,EAC7E;AAAS,WAAO;AAClB;AAUA,SAASC,EAAuBC,GAAWC,GAAUC,GAAaC,IAAc,WAAW;AACzF,SAAI,OAAOH,KAAc,YAAYA,MAAc,OAAa,CAAA,IAEzDI,EAAgC,IAAI,CAACC,MAAe;AACzD,UAAMT,IAAQI,EAAUK,CAAU;AAClC,QAAI,CAACT,EAAO,QAAO;AAGnB,UAAMU,IAAU,MAAM,QAAQJ,CAAW,IACrCA,EAAY,SAASN,CAAK,IAC1BA,KAASM,GAGPK,IAAYN,MAAa,KAC3B,GAAGE,CAAW,KAAKE,CAAU,IAAIT,CAAK,KACtC,GAAGO,CAAW,KAAKE,CAAU,IAAIJ,CAAQ,IAAIL,CAAK;AAEtD,WAAOU,IAAUC,IAAY;AAAA,EAC/B,CAAC;AACH;AAEO,SAASC,EAA0Bf,GAAW;AACnD,SAAOI,EAAmBJ,CAAS,IAC/B,YAAYC,EAAmBG,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BT,GAAS;AAC/C,QAAMU,IAAehC,EAAiBsB,CAAO,GACvCW,IAAoBR,EAA0BO,CAAY;AAChE,SAAOT,EAAiB,SAASS,CAAY,IAAI,oBAAoBC,CAAiB,KAAK;AAC7F;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./tabs-constants.cjs"),a=require("vue"),b=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),o={compatConfig:{MODE:3},name:"DtTabGroup",provide(){return{groupContext:this.provideObj,setFocus:this.setFocus}},props:{label:{type:String,default:""},selected:{type:String,default:""},disabled:{type:Boolean,default:!1},inverted:{type:Boolean,default:!1},borderless:{type:Boolean,default:!1},size:{type:String,default:"default",validate(t){return n.TAB_LIST_SIZES.includes(t)}},tabListClass:{type:[String,Array,Object],default:""},tabListChildProps:{type:Object,default:()=>({})}},emits:["change","before-change"],data(){return{provideObj:{selected:"",disabled:!1},focusId:null,tabs:[],TAB_LIST_SIZE_MODIFIERS:n.TAB_LIST_SIZE_MODIFIERS,TAB_LIST_KIND_MODIFIERS:n.TAB_LIST_KIND_MODIFIERS,TAB_LIST_IMPORTANCE_MODIFIERS:n.TAB_LIST_IMPORTANCE_MODIFIERS}},watch:{disabled:{immediate:!0,handler(){this.provideObj.disabled=this.disabled}},selected:{immediate:!0,handler(){this.provideObj.selected=this.selected}}},mounted(){this.updateSelected()},
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./tabs-constants.cjs"),a=require("vue"),b=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),o={compatConfig:{MODE:3},name:"DtTabGroup",provide(){return{groupContext:this.provideObj,setFocus:this.setFocus}},props:{label:{type:String,default:""},selected:{type:String,default:""},disabled:{type:Boolean,default:!1},inverted:{type:Boolean,default:!1},borderless:{type:Boolean,default:!1},size:{type:String,default:"default",validate(t){return n.TAB_LIST_SIZES.includes(t)}},tabListClass:{type:[String,Array,Object],default:""},tabListChildProps:{type:Object,default:()=>({})}},emits:["change","before-change"],data(){return{provideObj:{selected:"",disabled:!1},focusId:null,tabs:[],TAB_LIST_SIZE_MODIFIERS:n.TAB_LIST_SIZE_MODIFIERS,TAB_LIST_KIND_MODIFIERS:n.TAB_LIST_KIND_MODIFIERS,TAB_LIST_IMPORTANCE_MODIFIERS:n.TAB_LIST_IMPORTANCE_MODIFIERS}},watch:{disabled:{immediate:!0,handler(){this.provideObj.disabled=this.disabled}},selected:{immediate:!0,handler(){this.provideObj.selected=this.selected}}},mounted(){this.updateSelected()},updated(){this.updateSelected()},methods:{updateSelected(){this.provideObj.selected||(this.provideObj.selected=this.selected),this.tabs=this.getTabChildren()},setFocus(t){this.focusId=t},getTabChildren(){return Array.from(this.$refs.tabs.querySelectorAll(".d-tab")).map(e=>{var d,l;return{context:e,panelId:(d=e.getAttribute("aria-controls"))==null?void 0:d.replace("dt-panel-",""),tabId:(l=e.getAttribute("id"))==null?void 0:l.replace("dt-tab-",""),isSelected:e.getAttribute("aria-selected")==="true"}})},onChange(){this.$emit("change",{...this.provideObj})},tabLeft(){const t=this.getFocusedTabIndex();if(t===-1)return;const e=t-1<0?this.tabs.length-1:t-1;this.selectFocusOnTab(e)},tabRight(){const t=this.getFocusedTabIndex();if(t===-1)return;const e=t+1>this.tabs.length-1?0:t+1;this.selectFocusOnTab(e)},selectFocusOnTab(t){const{context:e}=this.tabs[t];e.focus()},selectTab(t){if(this.isSameTabClicked()||(this.$emit("before-change",t),t.defaultPrevented))return;const e=this.getFocusedTabIndex();this.selectTabByIndex(e),this.onChange()},selectTabByIndex(t){const{context:e,panelId:d}=this.tabs[t];this.provideObj.selected=d,e.focus()},getFocusedTabIndex(){const t=this.tabs.findIndex(e=>this.focusId?e.tabId===`${this.focusId}`:e.isSelected);return t===-1?0:t},onHomeButton(){var t,e;this.tabs.length!==0&&((e=(t=this.tabs[0])==null?void 0:t.context)==null||e.focus())},onEndButton(){var t,e;this.tabs.length!==0&&((e=(t=this.tabs[this.tabs.length-1])==null?void 0:t.context)==null||e.focus())},isSameTabClicked(){const t=this.tabs[this.getFocusedTabIndex()];return this.provideObj.selected===t.panelId}}},u={"data-qa":"dt-tab-group"},c=["aria-label"];function h(t,e,d,l,r,s){return a.openBlock(),a.createElementBlock("div",u,[a.createElementVNode("div",a.mergeProps({ref:"tabs",class:["d-tablist",r.TAB_LIST_SIZE_MODIFIERS[d.size],{[r.TAB_LIST_KIND_MODIFIERS.inverted]:d.inverted,[r.TAB_LIST_IMPORTANCE_MODIFIERS.borderless]:d.borderless},d.tabListClass]},d.tabListChildProps,{role:"tablist","aria-label":d.label,onKeyup:[e[0]||(e[0]=a.withKeys((...i)=>s.tabLeft&&s.tabLeft(...i),["left"])),e[1]||(e[1]=a.withKeys((...i)=>s.tabRight&&s.tabRight(...i),["right"])),e[2]||(e[2]=a.withKeys((...i)=>s.selectTab&&s.selectTab(...i),["enter"])),e[3]||(e[3]=a.withKeys((...i)=>s.selectTab&&s.selectTab(...i),["space"]))],onClick:e[4]||(e[4]=(...i)=>s.selectTab&&s.selectTab(...i)),onKeydown:[e[5]||(e[5]=a.withKeys((...i)=>s.onHomeButton&&s.onHomeButton(...i),["home"])),e[6]||(e[6]=a.withKeys((...i)=>s.onEndButton&&s.onEndButton(...i),["end"]))]}),[a.renderSlot(t.$slots,"tabs")],16,c),a.renderSlot(t.$slots,"default")])}const I=b._(o,[["render",h]]);exports.default=I;
|
|
2
2
|
//# sourceMappingURL=tab-group.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-group.cjs","sources":["../../../components/tab/tab_group.vue"],"sourcesContent":["<template>\n <div\n data-qa=\"dt-tab-group\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <div\n ref=\"tabs\"\n :class=\"[\n 'd-tablist',\n TAB_LIST_SIZE_MODIFIERS[size],\n {\n [TAB_LIST_KIND_MODIFIERS.inverted]: inverted,\n [TAB_LIST_IMPORTANCE_MODIFIERS.borderless]: borderless,\n },\n tabListClass,\n ]\"\n v-bind=\"tabListChildProps\"\n role=\"tablist\"\n :aria-label=\"label\"\n @keyup.left=\"tabLeft\"\n @keyup.right=\"tabRight\"\n @keyup.enter=\"selectTab\"\n @keyup.space=\"selectTab\"\n @click=\"selectTab\"\n @keydown.home=\"onHomeButton\"\n @keydown.end=\"onEndButton\"\n >\n <!-- @slot Slot for Tabs -->\n <slot name=\"tabs\" />\n </div>\n <!-- @slot Default slot for Panel -->\n <slot />\n </div>\n</template>\n\n<script>\nimport {\n TAB_LIST_SIZES,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n TAB_LIST_SIZE_MODIFIERS,\n} from './tabs_constants';\n\n/**\n * Tabs allow users to navigation between grouped content in different views while within the same page context.\n * @see https://dialtone.dialpad.com/components/tabs.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtTabGroup',\n\n provide () {\n return {\n groupContext: this.provideObj,\n setFocus: this.setFocus,\n };\n },\n\n props: {\n /**\n * Identifies the tab group\n */\n label: {\n type: String,\n default: '',\n },\n\n /**\n * The id of the selected tab panel which should be displayed\n */\n selected: {\n type: String,\n default: '',\n },\n\n /**\n * If true, disables the tab group\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies inverted styles to the tab group\n * @values true, false\n */\n inverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies borderless styles to the tab group\n * @values true, false\n */\n borderless: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If provided, applies size styles to the tab group\n * @values default, sm\n */\n size: {\n type: String,\n default: 'default',\n validate (size) {\n return TAB_LIST_SIZES.includes(size);\n },\n },\n\n /**\n * Pass through classes, used to customize the tab list\n */\n tabListClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Pass through props, used to customize the tab list\n */\n tabListChildProps: {\n type: Object,\n default: () => ({}),\n },\n },\n\n emits: [\n /**\n * Change tab event with the arguments: selected id of the current tab and disabled value\n *\n * @event change\n * @type {Object}\n */\n 'change',\n\n /**\n * Before change tab event with the event argument, useful to perform validations and prevent changing tabs if neccessary.\n *\n * @event before-change\n * @type {Event}\n */\n 'before-change',\n ],\n\n data () {\n return {\n provideObj: {\n selected: '', // the currently displayed tab id\n disabled: false, // disable group\n },\n\n focusId: null,\n tabs: [],\n TAB_LIST_SIZE_MODIFIERS,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n };\n },\n\n watch: {\n disabled: {\n immediate: true,\n handler () {\n this.provideObj.disabled = this.disabled;\n },\n },\n\n selected: {\n immediate: true,\n handler () {\n this.provideObj.selected = this.selected;\n },\n },\n },\n\n mounted () {\n this.updateSelected();\n },\n\n beforeUpdate () {\n this.updateSelected();\n },\n\n methods: {\n updateSelected () {\n /**\n * Prevent override tab selected by default\n */\n if (!this.provideObj.selected) {\n this.provideObj.selected = this.selected;\n }\n this.tabs = this.getTabChildren();\n },\n\n setFocus (focusId) {\n this.focusId = focusId;\n },\n\n getTabChildren () {\n const tabs = Array.from(this.$refs.tabs.querySelectorAll('.d-tab'));\n return tabs\n .map(el => {\n return ({\n context: el,\n panelId: el.getAttribute('aria-controls')?.replace('dt-panel-', ''),\n tabId: el.getAttribute('id')?.replace('dt-tab-', ''),\n isSelected: el.getAttribute('aria-selected') === 'true',\n });\n });\n },\n\n onChange () {\n this.$emit('change', { ...this.provideObj });\n },\n\n tabLeft () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index - 1 < 0 ? this.tabs.length - 1 : index - 1;\n this.selectFocusOnTab(indexElement);\n },\n\n tabRight () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index + 1 > this.tabs.length - 1 ? 0 : index + 1;\n this.selectFocusOnTab(indexElement);\n },\n\n selectFocusOnTab (index) {\n const { context } = this.tabs[index];\n context.focus();\n },\n\n selectTab (event) {\n if (this.isSameTabClicked()) return;\n\n this.$emit('before-change', event);\n if (event.defaultPrevented) return;\n\n const index = this.getFocusedTabIndex();\n\n this.selectTabByIndex(index);\n this.onChange();\n },\n\n selectTabByIndex (index) {\n const { context, panelId } = this.tabs[index];\n this.provideObj.selected = panelId;\n context.focus();\n },\n\n getFocusedTabIndex () {\n // Hot fix https://github.com/dialpad/dialtone/pull/849\n // The main issue is that this.tabs is not being updated at the time this is being triggered.\n\n const index = this.tabs.findIndex((context) =>\n this.focusId ? context.tabId === `${this.focusId}` : context.isSelected,\n );\n\n return index === -1 ? 0 : index;\n },\n\n onHomeButton () {\n if (this.tabs.length === 0) return;\n this.tabs[0]?.context?.focus();\n },\n\n onEndButton () {\n if (this.tabs.length === 0) return;\n this.tabs[this.tabs.length - 1]?.context?.focus();\n },\n\n isSameTabClicked () {\n const tab = this.tabs[this.getFocusedTabIndex()];\n return this.provideObj.selected === tab.panelId;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","size","TAB_LIST_SIZES","TAB_LIST_SIZE_MODIFIERS","TAB_LIST_KIND_MODIFIERS","TAB_LIST_IMPORTANCE_MODIFIERS","focusId","el","_a","_b","index","indexElement","context","event","panelId","tab","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_createElementVNode","_mergeProps","$data","$props","_cache","_withKeys","args","$options","_renderSlot","_ctx"],"mappings":"+NA+CKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,aAEN,SAAW,CACT,MAAO,CACL,aAAc,KAAK,WACnB,SAAU,KAAK,SAEnB,EAEA,MAAO,CAIL,MAAO,CACL,KAAM,OACN,QAAS,IAMX,SAAU,CACR,KAAM,OACN,QAAS,IAOX,SAAU,CACR,KAAM,QACN,QAAS,IAOX,SAAU,CACR,KAAM,QACN,QAAS,IAOX,WAAY,CACV,KAAM,QACN,QAAS,IAOX,KAAM,CACJ,KAAM,OACN,QAAS,UACT,SAAUC,EAAM,CACd,OA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GzBE,aAAoBC,EAAA,OAAA,MAAA,CA5B1B,EAAA,GAAAZ,CAAA,EA+BIW,aAAQC,EAAA,OAAA,SAAA"}
|
|
1
|
+
{"version":3,"file":"tab-group.cjs","sources":["../../../components/tab/tab_group.vue"],"sourcesContent":["<template>\n <div\n data-qa=\"dt-tab-group\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <div\n ref=\"tabs\"\n :class=\"[\n 'd-tablist',\n TAB_LIST_SIZE_MODIFIERS[size],\n {\n [TAB_LIST_KIND_MODIFIERS.inverted]: inverted,\n [TAB_LIST_IMPORTANCE_MODIFIERS.borderless]: borderless,\n },\n tabListClass,\n ]\"\n v-bind=\"tabListChildProps\"\n role=\"tablist\"\n :aria-label=\"label\"\n @keyup.left=\"tabLeft\"\n @keyup.right=\"tabRight\"\n @keyup.enter=\"selectTab\"\n @keyup.space=\"selectTab\"\n @click=\"selectTab\"\n @keydown.home=\"onHomeButton\"\n @keydown.end=\"onEndButton\"\n >\n <!-- @slot Slot for Tabs -->\n <slot name=\"tabs\" />\n </div>\n <!-- @slot Default slot for Panel -->\n <slot />\n </div>\n</template>\n\n<script>\nimport {\n TAB_LIST_SIZES,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n TAB_LIST_SIZE_MODIFIERS,\n} from './tabs_constants';\n\n/**\n * Tabs allow users to navigation between grouped content in different views while within the same page context.\n * @see https://dialtone.dialpad.com/components/tabs.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtTabGroup',\n\n provide () {\n return {\n groupContext: this.provideObj,\n setFocus: this.setFocus,\n };\n },\n\n props: {\n /**\n * Identifies the tab group\n */\n label: {\n type: String,\n default: '',\n },\n\n /**\n * The id of the selected tab panel which should be displayed\n */\n selected: {\n type: String,\n default: '',\n },\n\n /**\n * If true, disables the tab group\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies inverted styles to the tab group\n * @values true, false\n */\n inverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies borderless styles to the tab group\n * @values true, false\n */\n borderless: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If provided, applies size styles to the tab group\n * @values default, sm\n */\n size: {\n type: String,\n default: 'default',\n validate (size) {\n return TAB_LIST_SIZES.includes(size);\n },\n },\n\n /**\n * Pass through classes, used to customize the tab list\n */\n tabListClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Pass through props, used to customize the tab list\n */\n tabListChildProps: {\n type: Object,\n default: () => ({}),\n },\n },\n\n emits: [\n /**\n * Change tab event with the arguments: selected id of the current tab and disabled value\n *\n * @event change\n * @type {Object}\n */\n 'change',\n\n /**\n * Before change tab event with the event argument, useful to perform validations and prevent changing tabs if neccessary.\n *\n * @event before-change\n * @type {Event}\n */\n 'before-change',\n ],\n\n data () {\n return {\n provideObj: {\n selected: '', // the currently displayed tab id\n disabled: false, // disable group\n },\n\n focusId: null,\n tabs: [],\n TAB_LIST_SIZE_MODIFIERS,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n };\n },\n\n watch: {\n disabled: {\n immediate: true,\n handler () {\n this.provideObj.disabled = this.disabled;\n },\n },\n\n selected: {\n immediate: true,\n handler () {\n this.provideObj.selected = this.selected;\n },\n },\n },\n\n mounted () {\n this.updateSelected();\n },\n\n updated () {\n this.updateSelected();\n },\n\n methods: {\n updateSelected () {\n /**\n * Prevent override tab selected by default\n */\n if (!this.provideObj.selected) {\n this.provideObj.selected = this.selected;\n }\n this.tabs = this.getTabChildren();\n },\n\n setFocus (focusId) {\n this.focusId = focusId;\n },\n\n getTabChildren () {\n const tabs = Array.from(this.$refs.tabs.querySelectorAll('.d-tab'));\n return tabs\n .map(el => {\n return ({\n context: el,\n panelId: el.getAttribute('aria-controls')?.replace('dt-panel-', ''),\n tabId: el.getAttribute('id')?.replace('dt-tab-', ''),\n isSelected: el.getAttribute('aria-selected') === 'true',\n });\n });\n },\n\n onChange () {\n this.$emit('change', { ...this.provideObj });\n },\n\n tabLeft () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index - 1 < 0 ? this.tabs.length - 1 : index - 1;\n this.selectFocusOnTab(indexElement);\n },\n\n tabRight () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index + 1 > this.tabs.length - 1 ? 0 : index + 1;\n this.selectFocusOnTab(indexElement);\n },\n\n selectFocusOnTab (index) {\n const { context } = this.tabs[index];\n context.focus();\n },\n\n selectTab (event) {\n if (this.isSameTabClicked()) return;\n\n this.$emit('before-change', event);\n if (event.defaultPrevented) return;\n\n const index = this.getFocusedTabIndex();\n\n this.selectTabByIndex(index);\n this.onChange();\n },\n\n selectTabByIndex (index) {\n const { context, panelId } = this.tabs[index];\n this.provideObj.selected = panelId;\n context.focus();\n },\n\n getFocusedTabIndex () {\n // Hot fix https://github.com/dialpad/dialtone/pull/849\n // The main issue is that this.tabs is not being updated at the time this is being triggered.\n\n const index = this.tabs.findIndex((context) =>\n this.focusId ? context.tabId === `${this.focusId}` : context.isSelected,\n );\n\n return index === -1 ? 0 : index;\n },\n\n onHomeButton () {\n if (this.tabs.length === 0) return;\n this.tabs[0]?.context?.focus();\n },\n\n onEndButton () {\n if (this.tabs.length === 0) return;\n this.tabs[this.tabs.length - 1]?.context?.focus();\n },\n\n isSameTabClicked () {\n const tab = this.tabs[this.getFocusedTabIndex()];\n return this.provideObj.selected === tab.panelId;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","size","TAB_LIST_SIZES","TAB_LIST_SIZE_MODIFIERS","TAB_LIST_KIND_MODIFIERS","TAB_LIST_IMPORTANCE_MODIFIERS","focusId","el","_a","_b","index","indexElement","context","event","panelId","tab","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_createElementVNode","_mergeProps","$data","$props","_cache","_withKeys","args","$options","_renderSlot","_ctx"],"mappings":"+NA+CKA,EAAU,CACb,aAAc,CAA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AAAA,EAAA,UAAA,GAAAD,CAAA,GACP,UAAO,CAxBdF,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,EAAAA,SAAA,IAAAC,IAwBqBC,EAAA,cAAAA,EAAA,aAAA,GAAAD,CAAA,EAAY,CAAA,MAAA,CAAA,GAxBjCF,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,EAAAA,SAAA,IAAAC,IAyBoBC,EAAA,aAAAA,EAAA,YAAA,GAAAD,CAAA,EAAW,CAAA,KAAA,CAAA,OAGzBE,aAAoBC,EAAA,OAAA,MAAA,CA5B1B,EAAA,GAAAZ,CAAA,EA+BIW,aAAQC,EAAA,OAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-group.js","sources":["../../../components/tab/tab_group.vue"],"sourcesContent":["<template>\n <div\n data-qa=\"dt-tab-group\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <div\n ref=\"tabs\"\n :class=\"[\n 'd-tablist',\n TAB_LIST_SIZE_MODIFIERS[size],\n {\n [TAB_LIST_KIND_MODIFIERS.inverted]: inverted,\n [TAB_LIST_IMPORTANCE_MODIFIERS.borderless]: borderless,\n },\n tabListClass,\n ]\"\n v-bind=\"tabListChildProps\"\n role=\"tablist\"\n :aria-label=\"label\"\n @keyup.left=\"tabLeft\"\n @keyup.right=\"tabRight\"\n @keyup.enter=\"selectTab\"\n @keyup.space=\"selectTab\"\n @click=\"selectTab\"\n @keydown.home=\"onHomeButton\"\n @keydown.end=\"onEndButton\"\n >\n <!-- @slot Slot for Tabs -->\n <slot name=\"tabs\" />\n </div>\n <!-- @slot Default slot for Panel -->\n <slot />\n </div>\n</template>\n\n<script>\nimport {\n TAB_LIST_SIZES,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n TAB_LIST_SIZE_MODIFIERS,\n} from './tabs_constants';\n\n/**\n * Tabs allow users to navigation between grouped content in different views while within the same page context.\n * @see https://dialtone.dialpad.com/components/tabs.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtTabGroup',\n\n provide () {\n return {\n groupContext: this.provideObj,\n setFocus: this.setFocus,\n };\n },\n\n props: {\n /**\n * Identifies the tab group\n */\n label: {\n type: String,\n default: '',\n },\n\n /**\n * The id of the selected tab panel which should be displayed\n */\n selected: {\n type: String,\n default: '',\n },\n\n /**\n * If true, disables the tab group\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies inverted styles to the tab group\n * @values true, false\n */\n inverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies borderless styles to the tab group\n * @values true, false\n */\n borderless: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If provided, applies size styles to the tab group\n * @values default, sm\n */\n size: {\n type: String,\n default: 'default',\n validate (size) {\n return TAB_LIST_SIZES.includes(size);\n },\n },\n\n /**\n * Pass through classes, used to customize the tab list\n */\n tabListClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Pass through props, used to customize the tab list\n */\n tabListChildProps: {\n type: Object,\n default: () => ({}),\n },\n },\n\n emits: [\n /**\n * Change tab event with the arguments: selected id of the current tab and disabled value\n *\n * @event change\n * @type {Object}\n */\n 'change',\n\n /**\n * Before change tab event with the event argument, useful to perform validations and prevent changing tabs if neccessary.\n *\n * @event before-change\n * @type {Event}\n */\n 'before-change',\n ],\n\n data () {\n return {\n provideObj: {\n selected: '', // the currently displayed tab id\n disabled: false, // disable group\n },\n\n focusId: null,\n tabs: [],\n TAB_LIST_SIZE_MODIFIERS,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n };\n },\n\n watch: {\n disabled: {\n immediate: true,\n handler () {\n this.provideObj.disabled = this.disabled;\n },\n },\n\n selected: {\n immediate: true,\n handler () {\n this.provideObj.selected = this.selected;\n },\n },\n },\n\n mounted () {\n this.updateSelected();\n },\n\n beforeUpdate () {\n this.updateSelected();\n },\n\n methods: {\n updateSelected () {\n /**\n * Prevent override tab selected by default\n */\n if (!this.provideObj.selected) {\n this.provideObj.selected = this.selected;\n }\n this.tabs = this.getTabChildren();\n },\n\n setFocus (focusId) {\n this.focusId = focusId;\n },\n\n getTabChildren () {\n const tabs = Array.from(this.$refs.tabs.querySelectorAll('.d-tab'));\n return tabs\n .map(el => {\n return ({\n context: el,\n panelId: el.getAttribute('aria-controls')?.replace('dt-panel-', ''),\n tabId: el.getAttribute('id')?.replace('dt-tab-', ''),\n isSelected: el.getAttribute('aria-selected') === 'true',\n });\n });\n },\n\n onChange () {\n this.$emit('change', { ...this.provideObj });\n },\n\n tabLeft () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index - 1 < 0 ? this.tabs.length - 1 : index - 1;\n this.selectFocusOnTab(indexElement);\n },\n\n tabRight () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index + 1 > this.tabs.length - 1 ? 0 : index + 1;\n this.selectFocusOnTab(indexElement);\n },\n\n selectFocusOnTab (index) {\n const { context } = this.tabs[index];\n context.focus();\n },\n\n selectTab (event) {\n if (this.isSameTabClicked()) return;\n\n this.$emit('before-change', event);\n if (event.defaultPrevented) return;\n\n const index = this.getFocusedTabIndex();\n\n this.selectTabByIndex(index);\n this.onChange();\n },\n\n selectTabByIndex (index) {\n const { context, panelId } = this.tabs[index];\n this.provideObj.selected = panelId;\n context.focus();\n },\n\n getFocusedTabIndex () {\n // Hot fix https://github.com/dialpad/dialtone/pull/849\n // The main issue is that this.tabs is not being updated at the time this is being triggered.\n\n const index = this.tabs.findIndex((context) =>\n this.focusId ? context.tabId === `${this.focusId}` : context.isSelected,\n );\n\n return index === -1 ? 0 : index;\n },\n\n onHomeButton () {\n if (this.tabs.length === 0) return;\n this.tabs[0]?.context?.focus();\n },\n\n onEndButton () {\n if (this.tabs.length === 0) return;\n this.tabs[this.tabs.length - 1]?.context?.focus();\n },\n\n isSameTabClicked () {\n const tab = this.tabs[this.getFocusedTabIndex()];\n return this.provideObj.selected === tab.panelId;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","size","TAB_LIST_SIZES","TAB_LIST_SIZE_MODIFIERS","TAB_LIST_KIND_MODIFIERS","TAB_LIST_IMPORTANCE_MODIFIERS","focusId","el","_a","_b","index","indexElement","context","event","panelId","tab","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_createElementVNode","_mergeProps","$data","$props","_cache","_withKeys","args","$options","_renderSlot","_ctx"],"mappings":";;;AA+CA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,UAAW;AACT,WAAO;AAAA,MACL,cAAc,KAAK;AAAA,MACnB,UAAU,KAAK;AAAA;EAEnB;AAAA,EAEA,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAUC,GAAM;AACd,eAAOC,EAAe,SAASD,CAAI;AAAA,MACrC;AAAA;;;;IAMF,cAAc;AAAA,MACZ,MAAM,CAAC,QAAQ,OAAO,MAAM;AAAA,MAC5B,SAAS;AAAA;;;;IAMX,mBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,SAAS,OAAO,CAAA;AAAA;;EAIpB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA;AAAA;EAGF,OAAQ;AACN,WAAO;AAAA,MACL,YAAY;AAA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AA,CAAA,IAAAC,EAAA,IAAAC,MAwBqBC,EAAA,gBAAAA,EAAA,aAAA,GAAAD,CAAA,GAAY,CAAA,MAAA,CAAA;AAAA,QAxBjCF,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAAC,EAAA,IAAAC,MAyBoBC,EAAA,eAAAA,EAAA,YAAA,GAAAD,CAAA,GAAW,CAAA,KAAA,CAAA;AAAA;;MAGzBE,EAAoBC,EAAA,QAAA,MAAA;AAAA,IA5B1B,GAAA,IAAAZ,CAAA;AAAA,IA+BIW,EAAQC,EAAA,QAAA,SAAA;AAAA;;;"}
|
|
1
|
+
{"version":3,"file":"tab-group.js","sources":["../../../components/tab/tab_group.vue"],"sourcesContent":["<template>\n <div\n data-qa=\"dt-tab-group\"\n >\n <!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->\n <div\n ref=\"tabs\"\n :class=\"[\n 'd-tablist',\n TAB_LIST_SIZE_MODIFIERS[size],\n {\n [TAB_LIST_KIND_MODIFIERS.inverted]: inverted,\n [TAB_LIST_IMPORTANCE_MODIFIERS.borderless]: borderless,\n },\n tabListClass,\n ]\"\n v-bind=\"tabListChildProps\"\n role=\"tablist\"\n :aria-label=\"label\"\n @keyup.left=\"tabLeft\"\n @keyup.right=\"tabRight\"\n @keyup.enter=\"selectTab\"\n @keyup.space=\"selectTab\"\n @click=\"selectTab\"\n @keydown.home=\"onHomeButton\"\n @keydown.end=\"onEndButton\"\n >\n <!-- @slot Slot for Tabs -->\n <slot name=\"tabs\" />\n </div>\n <!-- @slot Default slot for Panel -->\n <slot />\n </div>\n</template>\n\n<script>\nimport {\n TAB_LIST_SIZES,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n TAB_LIST_SIZE_MODIFIERS,\n} from './tabs_constants';\n\n/**\n * Tabs allow users to navigation between grouped content in different views while within the same page context.\n * @see https://dialtone.dialpad.com/components/tabs.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtTabGroup',\n\n provide () {\n return {\n groupContext: this.provideObj,\n setFocus: this.setFocus,\n };\n },\n\n props: {\n /**\n * Identifies the tab group\n */\n label: {\n type: String,\n default: '',\n },\n\n /**\n * The id of the selected tab panel which should be displayed\n */\n selected: {\n type: String,\n default: '',\n },\n\n /**\n * If true, disables the tab group\n * @values true, false\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies inverted styles to the tab group\n * @values true, false\n */\n inverted: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If true, applies borderless styles to the tab group\n * @values true, false\n */\n borderless: {\n type: Boolean,\n default: false,\n },\n\n /**\n * If provided, applies size styles to the tab group\n * @values default, sm\n */\n size: {\n type: String,\n default: 'default',\n validate (size) {\n return TAB_LIST_SIZES.includes(size);\n },\n },\n\n /**\n * Pass through classes, used to customize the tab list\n */\n tabListClass: {\n type: [String, Array, Object],\n default: '',\n },\n\n /**\n * Pass through props, used to customize the tab list\n */\n tabListChildProps: {\n type: Object,\n default: () => ({}),\n },\n },\n\n emits: [\n /**\n * Change tab event with the arguments: selected id of the current tab and disabled value\n *\n * @event change\n * @type {Object}\n */\n 'change',\n\n /**\n * Before change tab event with the event argument, useful to perform validations and prevent changing tabs if neccessary.\n *\n * @event before-change\n * @type {Event}\n */\n 'before-change',\n ],\n\n data () {\n return {\n provideObj: {\n selected: '', // the currently displayed tab id\n disabled: false, // disable group\n },\n\n focusId: null,\n tabs: [],\n TAB_LIST_SIZE_MODIFIERS,\n TAB_LIST_KIND_MODIFIERS,\n TAB_LIST_IMPORTANCE_MODIFIERS,\n };\n },\n\n watch: {\n disabled: {\n immediate: true,\n handler () {\n this.provideObj.disabled = this.disabled;\n },\n },\n\n selected: {\n immediate: true,\n handler () {\n this.provideObj.selected = this.selected;\n },\n },\n },\n\n mounted () {\n this.updateSelected();\n },\n\n updated () {\n this.updateSelected();\n },\n\n methods: {\n updateSelected () {\n /**\n * Prevent override tab selected by default\n */\n if (!this.provideObj.selected) {\n this.provideObj.selected = this.selected;\n }\n this.tabs = this.getTabChildren();\n },\n\n setFocus (focusId) {\n this.focusId = focusId;\n },\n\n getTabChildren () {\n const tabs = Array.from(this.$refs.tabs.querySelectorAll('.d-tab'));\n return tabs\n .map(el => {\n return ({\n context: el,\n panelId: el.getAttribute('aria-controls')?.replace('dt-panel-', ''),\n tabId: el.getAttribute('id')?.replace('dt-tab-', ''),\n isSelected: el.getAttribute('aria-selected') === 'true',\n });\n });\n },\n\n onChange () {\n this.$emit('change', { ...this.provideObj });\n },\n\n tabLeft () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index - 1 < 0 ? this.tabs.length - 1 : index - 1;\n this.selectFocusOnTab(indexElement);\n },\n\n tabRight () {\n const index = this.getFocusedTabIndex();\n if (index === -1) return;\n\n const indexElement = index + 1 > this.tabs.length - 1 ? 0 : index + 1;\n this.selectFocusOnTab(indexElement);\n },\n\n selectFocusOnTab (index) {\n const { context } = this.tabs[index];\n context.focus();\n },\n\n selectTab (event) {\n if (this.isSameTabClicked()) return;\n\n this.$emit('before-change', event);\n if (event.defaultPrevented) return;\n\n const index = this.getFocusedTabIndex();\n\n this.selectTabByIndex(index);\n this.onChange();\n },\n\n selectTabByIndex (index) {\n const { context, panelId } = this.tabs[index];\n this.provideObj.selected = panelId;\n context.focus();\n },\n\n getFocusedTabIndex () {\n // Hot fix https://github.com/dialpad/dialtone/pull/849\n // The main issue is that this.tabs is not being updated at the time this is being triggered.\n\n const index = this.tabs.findIndex((context) =>\n this.focusId ? context.tabId === `${this.focusId}` : context.isSelected,\n );\n\n return index === -1 ? 0 : index;\n },\n\n onHomeButton () {\n if (this.tabs.length === 0) return;\n this.tabs[0]?.context?.focus();\n },\n\n onEndButton () {\n if (this.tabs.length === 0) return;\n this.tabs[this.tabs.length - 1]?.context?.focus();\n },\n\n isSameTabClicked () {\n const tab = this.tabs[this.getFocusedTabIndex()];\n return this.provideObj.selected === tab.panelId;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","size","TAB_LIST_SIZES","TAB_LIST_SIZE_MODIFIERS","TAB_LIST_KIND_MODIFIERS","TAB_LIST_IMPORTANCE_MODIFIERS","focusId","el","_a","_b","index","indexElement","context","event","panelId","tab","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_createElementVNode","_mergeProps","$data","$props","_cache","_withKeys","args","$options","_renderSlot","_ctx"],"mappings":";;;AA+CA,MAAKA,IAAU;AAAA,EACb,cAAc,EAAE,MAAM;EACtB,MAAM;AAAA,EAEN,UAAW;AACT,WAAO;AAAA,MACL,cAAc,KAAK;AAAA,MACnB,UAAU,KAAK;AAAA;EAEnB;AAAA,EAEA,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA;;;;IAMX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,UAAU;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA;;;;;IAOX,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAUC,GAAM;AACd,eAAOC,EAAe,SAASD,CAAI;AAAA,MACrC;AAAA;;;;IAMF,cAAc;AAAA,MACZ,MAAM,CAAC,QAAQ,OAAO,MAAM;AAAA,MAC5B,SAAS;AAAA;;;;IAMX,mBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,SAAS,OAAO,CAAA;AAAA;;EAIpB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA;AAAA;EAGF,OAAQ;AACN,WAAO;AAAA,MACL,YAAY;AAAA,QACV,UAAU;AAAA;AAAA,QACV,UAAU;AAAA;AAAA;MAGZ,SAAS;AAAA,MACT,MAAM,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GAAY,CAAA,MAAA,CAAA;AAAA,QAxBjCF,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAAC,EAAA,IAAAC,MAyBoBC,EAAA,eAAAA,EAAA,YAAA,GAAAD,CAAA,GAAW,CAAA,KAAA,CAAA;AAAA;;MAGzBE,EAAoBC,EAAA,QAAA,MAAA;AAAA,IA5B1B,GAAA,IAAAZ,CAAA;AAAA,IA+BIW,EAAQC,EAAA,QAAA,SAAA;AAAA;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("../../common/utils/index.cjs"),r=require("vue"),f=require("deep-equal"),n=require("../tooltip/tooltip.cjs"),m=require("../tooltip/tooltip-constants.cjs"),p={name:"dt-tooltip-directive",install(c){let a;const s=document.createElement("div");document.body.appendChild(s);const u="top";r.createApp({name:"DtTooltipDirectiveApp",components:{DtTooltip:n.default},data(){return{tooltips:[]}},created(){a=r.getCurrentInstance()},methods:{addOrUpdateTooltip(e,t){const i=this.tooltips.findIndex(o=>o.id===e);i!==-1?this.tooltips.splice(i,1,{id:e,...t}):this.tooltips.push({id:e,...t})},removeTooltip(e){this.tooltips=this.tooltips.filter(t=>t.id!==e)}},render(){return r.h("div",this.tooltips.map(({id:e,...t})=>r.h(n.default,{key:e,...t,sticky:t.sticky!==void 0?t.sticky:!0,delay:t.delay!==void 0?t.delay:process.env.NODE_ENV!=="test",externalAnchor:`[data-dt-tooltip-id="${e}"]`})))}}).mount(s),c.directive("dt-tooltip",{beforeMount(e,t){d(e,t)},updated(e,t){f(t.value,t.oldValue)||d(e,t)},unmounted(e){a.ctx.removeTooltip(e.getAttribute("data-dt-tooltip-id"))}});function d(e,t){if(t.value===null||t.value===void 0){const l=e.getAttribute("data-dt-tooltip-id");l&&a.ctx.removeTooltip(l);return}const i=e.getAttribute("data-dt-tooltip-id")||v.getUniqueString();let o;if(typeof t.value=="string")o={message:t.value,placement:t.arg||u};else if(typeof t.value=="object"&&t.value!==null)o={placement:t.arg||t.value.placement||u,...t.value};else{console.error("DtTooltipDirective: binding value must be string, object, null or undefined");return}Object.keys(t.modifiers).forEach(l=>{switch(l){case"inverted":o.inverted=!0;break;case"no-delay":o.delay=!1;break;case"no-transition":o.transition=!1;break;default:m.TOOLTIP_DIRECTIONS.includes(l)&&(o.placement=l);break}}),e.setAttribute("data-dt-tooltip-id",i),a.ctx.addOrUpdateTooltip(i,o)}}};exports.DtTooltipDirective=p;exports.default=p;
|
|
2
2
|
//# sourceMappingURL=tooltip.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.cjs","sources":["../../../directives/tooltip_directive/tooltip.js"],"sourcesContent":["import { DtTooltip, TOOLTIP_DIRECTIONS } from '@/components/tooltip';\nimport { getUniqueString } from '@/common/utils';\nimport { createApp, getCurrentInstance, h } from 'vue';\nimport deepEqual from 'deep-equal';\n\nexport const DtTooltipDirective = {\n name: 'dt-tooltip-directive',\n install (app) {\n let tooltipInstance;\n const mountPoint = document.createElement('div');\n document.body.appendChild(mountPoint);\n\n const DEFAULT_PLACEMENT = 'top';\n const DtTooltipDirectiveApp = createApp({\n name: 'DtTooltipDirectiveApp',\n components: { DtTooltip },\n data () {\n return {\n tooltips: [],\n };\n },\n\n created () {\n tooltipInstance = getCurrentInstance();\n },\n\n methods: {\n addOrUpdateTooltip (id, tooltipConfig) {\n const index = this.tooltips.findIndex(tooltip => tooltip.id === id);\n if (index !== -1) {\n // Update existing tooltip\n this.tooltips.splice(index, 1, { id, ...tooltipConfig });\n } else {\n // Add new tooltip\n this.tooltips.push({ id, ...tooltipConfig });\n }\n },\n\n removeTooltip (id) {\n this.tooltips = this.tooltips.filter(tooltip => tooltip.id !== id);\n },\n },\n\n render () {\n return h('div',\n this.tooltips.map(({ id, ...tooltipProps }) => {\n return h(DtTooltip, {\n key: id,\n ...tooltipProps,\n sticky: tooltipProps.sticky !== undefined ? tooltipProps.sticky : true,\n /**\n * Set the delay to false when running tests only.\n */\n delay: tooltipProps.delay !== undefined ? tooltipProps.delay : (process.env.NODE_ENV !== 'test'),\n externalAnchor: `[data-dt-tooltip-id=\"${id}\"]`,\n });\n }),\n );\n },\n });\n\n DtTooltipDirectiveApp.mount(mountPoint);\n\n app.directive('dt-tooltip', {\n beforeMount (anchor, binding) {\n // Initial tooltip setup\n setupTooltip(anchor, binding);\n },\n updated (anchor, binding) {\n // Update tooltip on binding value change\n // Use deep equality check to prevent infinite loops when objects are passed\n if (!deepEqual(binding.value, binding.oldValue)) {\n setupTooltip(anchor, binding);\n }\n },\n unmounted (anchor) {\n tooltipInstance.ctx.removeTooltip(anchor.getAttribute('data-dt-tooltip-id'));\n },\n });\n\n function setupTooltip (anchor, binding) {\n if (binding.value === null || binding.value === undefined) {\n const tooltipId = anchor.getAttribute('data-dt-tooltip-id');\n if (tooltipId) {\n
|
|
1
|
+
{"version":3,"file":"tooltip.cjs","sources":["../../../directives/tooltip_directive/tooltip.js"],"sourcesContent":["import { DtTooltip, TOOLTIP_DIRECTIONS } from '@/components/tooltip';\nimport { getUniqueString } from '@/common/utils';\nimport { createApp, getCurrentInstance, h } from 'vue';\nimport deepEqual from 'deep-equal';\n\nexport const DtTooltipDirective = {\n name: 'dt-tooltip-directive',\n install (app) {\n let tooltipInstance;\n const mountPoint = document.createElement('div');\n document.body.appendChild(mountPoint);\n\n const DEFAULT_PLACEMENT = 'top';\n const DtTooltipDirectiveApp = createApp({\n name: 'DtTooltipDirectiveApp',\n components: { DtTooltip },\n data () {\n return {\n tooltips: [],\n };\n },\n\n created () {\n tooltipInstance = getCurrentInstance();\n },\n\n methods: {\n addOrUpdateTooltip (id, tooltipConfig) {\n const index = this.tooltips.findIndex(tooltip => tooltip.id === id);\n if (index !== -1) {\n // Update existing tooltip\n this.tooltips.splice(index, 1, { id, ...tooltipConfig });\n } else {\n // Add new tooltip\n this.tooltips.push({ id, ...tooltipConfig });\n }\n },\n\n removeTooltip (id) {\n this.tooltips = this.tooltips.filter(tooltip => tooltip.id !== id);\n },\n },\n\n render () {\n return h('div',\n this.tooltips.map(({ id, ...tooltipProps }) => {\n return h(DtTooltip, {\n key: id,\n ...tooltipProps,\n sticky: tooltipProps.sticky !== undefined ? tooltipProps.sticky : true,\n /**\n * Set the delay to false when running tests only.\n */\n delay: tooltipProps.delay !== undefined ? tooltipProps.delay : (process.env.NODE_ENV !== 'test'),\n externalAnchor: `[data-dt-tooltip-id=\"${id}\"]`,\n });\n }),\n );\n },\n });\n\n DtTooltipDirectiveApp.mount(mountPoint);\n\n app.directive('dt-tooltip', {\n beforeMount (anchor, binding) {\n // Initial tooltip setup\n setupTooltip(anchor, binding);\n },\n updated (anchor, binding) {\n // Update tooltip on binding value change\n // Use deep equality check to prevent infinite loops when objects are passed\n if (!deepEqual(binding.value, binding.oldValue)) {\n setupTooltip(anchor, binding);\n }\n },\n unmounted (anchor) {\n tooltipInstance.ctx.removeTooltip(anchor.getAttribute('data-dt-tooltip-id'));\n },\n });\n\n function setupTooltip (anchor, binding) {\n if (binding.value === null || binding.value === undefined) {\n const tooltipId = anchor.getAttribute('data-dt-tooltip-id');\n if (tooltipId) {\n tooltipInstance.ctx.removeTooltip(tooltipId);\n }\n return;\n }\n const tooltipId = anchor.getAttribute('data-dt-tooltip-id') || getUniqueString();\n\n let tooltipConfig;\n if (typeof binding.value === 'string') {\n tooltipConfig = {\n message: binding.value,\n placement: binding.arg || DEFAULT_PLACEMENT,\n };\n } else if (typeof binding.value === 'object' && binding.value !== null) {\n tooltipConfig = {\n placement: binding.arg || binding.value.placement || DEFAULT_PLACEMENT,\n ...binding.value,\n };\n } else {\n console.error('DtTooltipDirective: binding value must be string, object, null or undefined');\n return;\n }\n\n Object.keys(binding.modifiers).forEach(modifier => {\n switch (modifier) {\n case 'inverted':\n tooltipConfig.inverted = true;\n break;\n case 'no-delay':\n tooltipConfig.delay = false;\n break;\n case 'no-transition':\n tooltipConfig.transition = false;\n break;\n default:\n if (TOOLTIP_DIRECTIONS.includes(modifier)) {\n tooltipConfig.placement = modifier;\n }\n break;\n }\n });\n\n anchor.setAttribute('data-dt-tooltip-id', tooltipId);\n tooltipInstance.ctx.addOrUpdateTooltip(tooltipId, tooltipConfig);\n }\n },\n};\n\nexport default DtTooltipDirective;\n"],"names":["DtTooltipDirective","app","tooltipInstance","mountPoint","DEFAULT_PLACEMENT","createApp","DtTooltip","getCurrentInstance","id","tooltipConfig","index","tooltip","h","tooltipProps","anchor","binding","setupTooltip","deepEqual","tooltipId","getUniqueString","modifier","TOOLTIP_DIRECTIONS"],"mappings":"uRAKaA,EAAqB,CAChC,KAAM,uBACN,QAASC,EAAK,CACZ,IAAIC,EACJ,MAAMC,EAAa,SAAS,cAAc,KAAK,EAC/C,SAAS,KAAK,YAAYA,CAAU,EAEpC,MAAMC,EAAoB,MACIC,EAAAA,UAAU,CACtC,KAAM,wBACN,WAAY,CAAA,UAAEC,EAAAA,OAAS,EACvB,MAAQ,CACN,MAAO,CACL,SAAU,CAAA,CACpB,CACM,EAEA,SAAW,CACTJ,EAAkBK,EAAAA,mBAAkB,CACtC,EAEA,QAAS,CACP,mBAAoBC,EAAIC,EAAe,CACrC,MAAMC,EAAQ,KAAK,SAAS,UAAUC,GAAWA,EAAQ,KAAOH,CAAE,EAC9DE,IAAU,GAEZ,KAAK,SAAS,OAAOA,EAAO,EAAG,CAAE,GAAAF,EAAI,GAAGC,EAAe,EAGvD,KAAK,SAAS,KAAK,CAAE,GAAAD,EAAI,GAAGC,CAAa,CAAE,CAE/C,EAEA,cAAeD,EAAI,CACjB,KAAK,SAAW,KAAK,SAAS,OAAOG,GAAWA,EAAQ,KAAOH,CAAE,CACnE,CACR,EAEM,QAAU,CACR,OAAOI,EAAAA,EAAE,MACP,KAAK,SAAS,IAAI,CAAC,CAAE,GAAAJ,EAAI,GAAGK,KACnBD,EAAAA,EAA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