@leaflink/stash 42.8.1 → 43.0.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 -1
- package/dist/AddressSelect.js +9 -10
- package/dist/AddressSelect.js.map +1 -1
- package/dist/Alert.js +9 -9
- package/dist/Alert.js.map +1 -1
- package/dist/AppSidebar.js +11 -11
- package/dist/AppSidebar.js.map +1 -1
- package/dist/Avatar.js +33 -32
- package/dist/Avatar.js.map +1 -1
- package/dist/Avatar.vue.d.ts +16 -95
- package/dist/Badge.js +2 -2
- package/dist/Badge.js.map +1 -1
- package/dist/Checkbox.js +4 -4
- package/dist/Checkbox.js.map +1 -1
- package/dist/{Checkbox.vue_vue_type_style_index_0_scoped_0cd31c8f_lang-4ed993c7.js → Checkbox.vue_vue_type_style_index_0_scoped_0d7e7fd0_lang-4ed993c7.js} +1 -1
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_0d7e7fd0_lang-4ed993c7.js.map +1 -0
- package/dist/Chip.js +32 -30
- package/dist/Chip.js.map +1 -1
- package/dist/Chip.vue.d.ts +16 -95
- package/dist/ConfirmationCodeInput.js +23 -23
- package/dist/ConfirmationCodeInput.js.map +1 -1
- package/dist/ContextSwitcher.js +2 -2
- package/dist/ContextSwitcher.js.map +1 -1
- package/dist/Copy.js +1 -1
- package/dist/Copy.js.map +1 -1
- package/dist/DataView.js +1 -1
- package/dist/DataViewFilters.js +23 -24
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/DataViewSortButton.js +11 -11
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewToolbar.js +1 -1
- package/dist/Dialog.js +10 -10
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.js +7 -7
- package/dist/Dropdown.js.map +1 -1
- package/dist/FilterChip.js +2 -3
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterDrawerItem.js +5 -6
- package/dist/FilterDrawerItem.js.map +1 -1
- package/dist/FilterDropdown.js +3 -4
- package/dist/FilterDropdown.js.map +1 -1
- package/dist/FilterSelect.js +26 -27
- package/dist/FilterSelect.js.map +1 -1
- package/dist/Filters.js +3 -4
- package/dist/Filters.js.map +1 -1
- package/dist/HttpError.js +18 -18
- package/dist/HttpError.js.map +1 -1
- package/dist/IconLabel.js +12 -13
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +9 -75
- package/dist/Illustration.js +1 -1
- package/dist/Illustration.js.map +1 -1
- package/dist/Illustration.vue.d.ts +19 -14
- package/dist/InputOptions.js +7 -8
- package/dist/InputOptions.js.map +1 -1
- package/dist/LicenseChip.js +32 -26
- package/dist/LicenseChip.js.map +1 -1
- package/dist/LicenseChip.vue.d.ts +2 -4
- package/dist/ListItem.js +1 -1
- package/dist/ListView.js +30 -31
- package/dist/ListView.js.map +1 -1
- package/dist/MenuItem.js +4 -4
- package/dist/MenuItem.js.map +1 -1
- package/dist/Metric.js +1 -1
- package/dist/Metric.js.map +1 -1
- package/dist/Metric.vue.d.ts +8 -74
- package/dist/Modal.js +13 -13
- package/dist/Modal.js.map +1 -1
- package/dist/Module.js +1 -1
- package/dist/Module.js.map +1 -1
- package/dist/ModuleFooter.js +1 -1
- package/dist/ModuleFooter.js.map +1 -1
- package/dist/ModuleHeader.js +1 -1
- package/dist/ModuleHeader.js.map +1 -1
- package/dist/PageNavigation.js +28 -29
- package/dist/PageNavigation.js.map +1 -1
- package/dist/Paginate.js +1 -1
- package/dist/Paginate.js.map +1 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-bfccf992.js +11 -0
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-bfccf992.js.map +1 -0
- package/dist/QuickAction.js +14 -14
- package/dist/QuickAction.js.map +1 -1
- package/dist/RadioNew.js +14 -14
- package/dist/SearchBar.js +15 -15
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +92 -93
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +53 -51
- package/dist/SelectStatus.js.map +1 -1
- package/dist/SelectStatus.vue.d.ts +52 -1
- package/dist/Step.js +28 -28
- package/dist/Step.js.map +1 -1
- package/dist/Tab.js +1 -1
- package/dist/Table.js +2 -2
- package/dist/TableCell.js +2 -2
- package/dist/TableHeaderCell.js +2 -2
- package/dist/TableHeaderRow.js +2 -2
- package/dist/TableRow.js +2 -2
- package/dist/Tabs.js +2 -2
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-aca4f8b8.js → Tabs.vue_vue_type_script_setup_true_lang-56e85faa.js} +3 -3
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-56e85faa.js.map +1 -0
- package/dist/Textarea.js +1 -1
- package/dist/Textarea.js.map +1 -1
- package/dist/Toast.js +1 -1
- package/dist/Toasts.js +1 -1
- package/dist/ToastsPlugin.js +1 -1
- package/dist/colorScheme.d.ts +3 -16
- package/dist/components.css +1 -1
- package/dist/index.d.ts +64 -25
- package/dist/index.js +188 -186
- package/dist/index.js.map +1 -1
- package/dist/statusLevels-a8b041f4.js +7 -0
- package/dist/statusLevels-a8b041f4.js.map +1 -0
- package/dist/tailwind-base.d.ts +0 -10
- package/dist/tailwind-base.js +22 -20
- package/dist/tailwind-base.js.map +1 -1
- package/dist/utils/colorScheme.js +1 -1
- package/dist/utils/colorScheme.js.map +1 -1
- package/package.json +1 -1
- package/styles/base.css +2 -2
- package/tailwind-base.ts +22 -21
- package/types/colors.ts +84 -26
- package/types/statusLevels.ts +4 -4
- package/dist/Checkbox.vue_vue_type_style_index_0_scoped_0cd31c8f_lang-4ed993c7.js.map +0 -1
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-e579235f.js +0 -11
- package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-e579235f.js.map +0 -1
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-aca4f8b8.js.map +0 -1
- package/dist/colors-13e95ebf.js +0 -6
- package/dist/colors-13e95ebf.js.map +0 -1
- package/dist/statusLevels-aabf1e3c.js +0 -7
- package/dist/statusLevels-aabf1e3c.js.map +0 -1
package/dist/Modal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as H, useSlots as I, ref as d, computed as x, watch as $, onBeforeUnmount as K, openBlock as a, createElementBlock as
|
|
1
|
+
import { defineComponent as H, useSlots as I, ref as d, computed as x, watch as $, onBeforeUnmount as K, openBlock as a, createElementBlock as f, normalizeClass as s, withKeys as R, createVNode as C, withModifiers as j, createElementVNode as g, unref as w, renderSlot as m, toDisplayString as T, createCommentVNode as i, createBlock as F, withCtx as L } from "vue";
|
|
2
2
|
import V from "lodash-es/uniqueId";
|
|
3
3
|
import { FOCUS_ELEMENTS_SELECTOR as A } from "./constants.js";
|
|
4
4
|
import { t as M } from "./locale.js";
|
|
@@ -65,7 +65,7 @@ const G = ["onKeydown"], J = ["aria-labelledby"], Q = { class: "tw-flex tw-place
|
|
|
65
65
|
var c, S;
|
|
66
66
|
t.key === "Tab" && (t.shiftKey && document.activeElement === b.value ? ((c = k.value) == null || c.focus(), t.preventDefault()) : document.activeElement === k.value && ((S = b.value) == null || S.focus(), t.preventDefault()));
|
|
67
67
|
}
|
|
68
|
-
return (t, c) => o.value ? (a(),
|
|
68
|
+
return (t, c) => o.value ? (a(), f("div", {
|
|
69
69
|
key: 0,
|
|
70
70
|
ref_key: "rootRef",
|
|
71
71
|
ref: r,
|
|
@@ -85,7 +85,7 @@ const G = ["onKeydown"], J = ["aria-labelledby"], Q = { class: "tw-flex tw-place
|
|
|
85
85
|
g("div", {
|
|
86
86
|
"aria-modal": "true",
|
|
87
87
|
role: "dialog",
|
|
88
|
-
"aria-labelledby":
|
|
88
|
+
"aria-labelledby": w(B),
|
|
89
89
|
class: s(["stash-modal__dialog tw-flex tw-flex-col tw-h-screen tw-w-full lg:tw-shadow tw-relative", [
|
|
90
90
|
`stash-modal__dialog--size-${e.size}`,
|
|
91
91
|
`stash-modal__dialog--position-${e.position}`,
|
|
@@ -106,24 +106,24 @@ const G = ["onKeydown"], J = ["aria-labelledby"], Q = { class: "tw-flex tw-place
|
|
|
106
106
|
onClick: c[0] || (c[0] = j(() => {
|
|
107
107
|
}, ["stop"]))
|
|
108
108
|
}, [
|
|
109
|
-
e.hideHeader ? i("", !0) : (a(),
|
|
109
|
+
e.hideHeader ? i("", !0) : (a(), f("header", {
|
|
110
110
|
key: 0,
|
|
111
111
|
"data-test": "stash-modal__header",
|
|
112
|
-
class: s(["stash-modal__header tw-bg-purple tw-h-12 tw-grid tw-place-items-center", { "lg:tw-rounded-t": !n.value }])
|
|
112
|
+
class: s(["stash-modal__header tw-bg-purple-500 tw-h-12 tw-grid tw-place-items-center", { "lg:tw-rounded-t": !n.value }])
|
|
113
113
|
}, [
|
|
114
114
|
g("div", Q, [
|
|
115
115
|
m(t.$slots, "headerAction", {}, void 0, !0)
|
|
116
116
|
]),
|
|
117
|
-
e.title ? (a(),
|
|
117
|
+
e.title ? (a(), f("h3", {
|
|
118
118
|
key: 0,
|
|
119
|
-
id:
|
|
119
|
+
id: w(B),
|
|
120
120
|
class: "tw-text-white tw-flex-1 tw-leading-6 tw-m-0"
|
|
121
121
|
}, T(e.title), 9, X)) : i("", !0),
|
|
122
122
|
e.hideClose ? i("", !0) : (a(), F(N, {
|
|
123
123
|
key: 1,
|
|
124
124
|
icon: "",
|
|
125
125
|
"data-test": "ll-modal-close",
|
|
126
|
-
title:
|
|
126
|
+
title: w(M)("ll.closeModal"),
|
|
127
127
|
type: "button",
|
|
128
128
|
onClick: v
|
|
129
129
|
}, {
|
|
@@ -142,7 +142,7 @@ const G = ["onKeydown"], J = ["aria-labelledby"], Q = { class: "tw-flex tw-place
|
|
|
142
142
|
icon: "",
|
|
143
143
|
"data-test": "ll-modal-close",
|
|
144
144
|
type: "button",
|
|
145
|
-
title:
|
|
145
|
+
title: w(M)("ll.closeModal"),
|
|
146
146
|
onClick: v
|
|
147
147
|
}, {
|
|
148
148
|
default: L(() => [
|
|
@@ -153,7 +153,7 @@ const G = ["onKeydown"], J = ["aria-labelledby"], Q = { class: "tw-flex tw-place
|
|
|
153
153
|
]),
|
|
154
154
|
_: 1
|
|
155
155
|
}, 8, ["title"])) : i("", !0),
|
|
156
|
-
|
|
156
|
+
w(y)["featured-content"] ? (a(), f("div", {
|
|
157
157
|
key: 2,
|
|
158
158
|
class: s(["tw-relative stash-modal__featured-content", {
|
|
159
159
|
"tw-rounded-t": e.hideHeader
|
|
@@ -175,7 +175,7 @@ const G = ["onKeydown"], J = ["aria-labelledby"], Q = { class: "tw-flex tw-place
|
|
|
175
175
|
}, [
|
|
176
176
|
m(t.$slots, "default", {}, void 0, !0)
|
|
177
177
|
], 2),
|
|
178
|
-
z.value ? (a(),
|
|
178
|
+
z.value ? (a(), f("footer", {
|
|
179
179
|
key: 3,
|
|
180
180
|
class: s(["stash-modal__footer tw-bg-ice-100 tw-border-ice-500 tw-p-3 lg:tw-p-6", { "lg:tw-rounded-b": !n.value }])
|
|
181
181
|
}, [
|
|
@@ -189,10 +189,10 @@ const G = ["onKeydown"], J = ["aria-labelledby"], Q = { class: "tw-flex tw-place
|
|
|
189
189
|
], 42, G)) : i("", !0);
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
|
-
const
|
|
192
|
+
const fe = /* @__PURE__ */ P(Z, [["__scopeId", "data-v-6f372886"]]);
|
|
193
193
|
export {
|
|
194
194
|
W as ModalPosition,
|
|
195
195
|
U as ModalSize,
|
|
196
|
-
|
|
196
|
+
fe as default
|
|
197
197
|
};
|
|
198
198
|
//# sourceMappingURL=Modal.js.map
|
package/dist/Modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sources":["../src/components/Modal/Modal.types.ts","../src/components/Modal/Modal.vue"],"sourcesContent":["export enum ModalSize {\n Narrow = 'narrow',\n Medium = 'medium',\n Wide = 'wide',\n}\n\nexport type ModalSizes = `${ModalSize}`;\n\nexport enum ModalPosition {\n Center = 'center',\n Left = 'left',\n Right = 'right',\n}\n\nexport type ModalPositions = `${ModalPosition}`;\n","<script lang=\"ts\">\n import { ModalPositions, ModalSizes } from './Modal.types';\n\n export * from './Modal.types';\n\n export interface ModalProps {\n /**\n * Hides the \"close\" button\n */\n hideClose?: boolean;\n\n /**\n * Opens the modal when truthy; hides the modal when falsy.\n * @deprecated Use `isOpen` instead\n */\n open?: boolean;\n\n /**\n * Opens the modal when truthy; hides the modal when falsy.\n */\n isOpen?: boolean;\n\n /**\n * Use v-model:is-open or :is-open instead of :model-value and v-model.\n * @deprecated\n */\n modelValue?: boolean;\n\n /**\n * Sets a preset max-width on the modal.\n * Options: default (648px), narrow (360px), wide (960px)\n */\n size?: ModalSizes;\n\n /**\n * Should the modal be scrollable within the content area. This prop is treated as `true` when the `position` prop is set to \"left\" or \"right\".\n */\n scrollable?: boolean;\n\n /**\n * Gives the modal body have a light gray background\n */\n contrast?: boolean;\n\n /**\n * Text to display in the modal header\n */\n title?: string;\n\n /**\n * Disables the default padding in the modal body.\n */\n disableBodyPadding?: boolean;\n\n /**\n * The position on the screen to display the modal.\n */\n position?: ModalPositions;\n\n /**\n * Hide the header. Typically used with the featuredContent slot to display a graphic and create a \"promo\" modal.\n */\n hideHeader?: boolean;\n\n /**\n * Add classes to the close button. This can be used with the hideHeader prop and featuredContent slot to\n * accommodate images with different color backgrounds.\n */\n closeButtonColorClass?: string;\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, onBeforeUnmount, ref, useSlots, watch } from 'vue';\n\n import { FOCUS_ELEMENTS_SELECTOR } from '../../constants';\n import { t } from '../../locale';\n import Backdrop from '../Backdrop/Backdrop.vue';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({ name: 'll-modal' });\n\n const props = withDefaults(defineProps<ModalProps>(), {\n hideClose: false,\n open: false,\n isOpen: false,\n modelValue: false,\n size: 'medium',\n scrollable: false,\n contrast: false,\n title: '',\n position: 'center',\n hideHeader: false,\n closeButtonColorClass: 'tw-text-white/50',\n });\n\n const emit =\n defineEmits<{\n /**\n * @deprecated Use the `update:is-open` event instead\n */\n (e: 'update:open', isOpen?: boolean): void;\n (e: 'update:is-open', isOpen?: boolean): void;\n (e: 'dismiss'): void;\n }>();\n\n const slots = useSlots();\n\n const rootRef = ref<HTMLElement>();\n const lastExternalFocusedElement = ref<HTMLElement>();\n const focusElements = ref<HTMLElement[]>([]);\n const firstFocusElement = ref<HTMLElement>();\n const lastFocusElement = ref<HTMLElement>();\n const initialPageScrollingElementStyle = ref({ height: '', overflow: '' });\n const headerId = uniqueId('modal-header-');\n const hasFooterContent = computed(() => !!slots.actions || !!slots.footer);\n const isModalOpen = computed(() => props.open || props.isOpen);\n const isDrawer = computed(() => props.position === 'left' || props.position === 'right');\n\n function getPageScrollingElement() {\n return (document.scrollingElement || document.body) as HTMLElement;\n }\n\n watch(\n isModalOpen,\n () => {\n if (isModalOpen.value) {\n Object.assign(initialPageScrollingElementStyle.value, {\n height: getPageScrollingElement().style.height,\n overflow: getPageScrollingElement().style.overflow,\n });\n }\n\n Object.assign(getPageScrollingElement().style, {\n overflow: isModalOpen.value ? 'hidden' : initialPageScrollingElementStyle.value.overflow, // Prevents page from scrolling when modal is open\n height: isModalOpen.value ? '100%' : initialPageScrollingElementStyle.value.height, // Ensures the backdrop covers the entire page when modal is open; see https://github.com/LeafLink/stash/pull/713#issuecomment-1184602535\n });\n },\n { immediate: true },\n );\n\n onBeforeUnmount(() => {\n // In cases where the watchEffect for isModalOpen isn't triggered while closing/nagivating away from modal, this ensures scrolling returns to normal\n Object.assign(getPageScrollingElement().style, {\n overflow: initialPageScrollingElementStyle.value.overflow,\n height: initialPageScrollingElementStyle.value.height,\n });\n\n // Clear focus trap tab listener\n document.removeEventListener('keydown', handleTab);\n lastExternalFocusedElement.value?.focus();\n });\n\n function dismiss() {\n emit('update:open', false);\n emit('update:is-open', false);\n emit('dismiss');\n }\n\n // This watcher ensures the Tab key cycles through focusable elements within the modal.\n watch(rootRef, () => {\n if (!rootRef.value) {\n return;\n }\n\n lastExternalFocusedElement.value = document.activeElement as HTMLElement;\n rootRef.value.focus();\n\n focusElements.value = Array.from(rootRef.value.querySelectorAll<HTMLElement>(FOCUS_ELEMENTS_SELECTOR));\n firstFocusElement.value = focusElements.value[0];\n lastFocusElement.value = focusElements.value[focusElements.value.length - 1];\n document.addEventListener('keydown', handleTab);\n });\n\n function handleTab(e) {\n if (e.key === 'Tab') {\n if (e.shiftKey && document.activeElement === firstFocusElement.value) {\n lastFocusElement.value?.focus();\n e.preventDefault();\n } else if (document.activeElement === lastFocusElement.value) {\n firstFocusElement.value?.focus();\n e.preventDefault();\n }\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"isModalOpen\"\n ref=\"rootRef\"\n class=\"stash-modal tw-fixed tw-inset-0 tw-overflow-y-auto\"\n :class=\"{\n 'tw-invisible tw-z-behind': !isModalOpen,\n 'tw-visible tw-z-modal': isModalOpen,\n 'lg:tw-flex lg:tw-flex-col lg:tw-justify-center lg:tw-items-center': props.position === 'center',\n }\"\n data-test=\"ll-modal\"\n tabindex=\"0\"\n @keydown.esc=\"dismiss\"\n >\n <Backdrop class=\"stash-modal__backdrop\" @click.stop=\"dismiss\" />\n <div\n aria-modal=\"true\"\n role=\"dialog\"\n :aria-labelledby=\"headerId\"\n class=\"stash-modal__dialog tw-flex tw-flex-col tw-h-screen tw-w-full lg:tw-shadow tw-relative\"\n :class=\"[\n `stash-modal__dialog--size-${props.size}`,\n `stash-modal__dialog--position-${props.position}`,\n {\n 'stash-modal__dialog--is-open': isModalOpen,\n 'stash-modal__dialog--is-drawer': isDrawer,\n 'stash-modal__dialog--is-contrast': props.contrast,\n 'stash-modal__dialog--is-scrollable': props.scrollable,\n 'lg:tw-w-[360px]': props.size === 'narrow',\n 'lg:tw-w-[648px]': props.size === 'medium',\n 'lg:tw-w-[960px]': props.size === 'wide',\n 'lg:tw-h-auto lg:tw-my-0 lg:tw-max-h-[90vh]': props.position === 'center',\n 'lg:tw-h-screen lg:tw-absolute': isDrawer,\n 'lg:tw-left-0': props.position === 'left',\n 'lg:tw-right-0': props.position === 'right',\n },\n ]\"\n @click.stop\n >\n <header\n v-if=\"!props.hideHeader\"\n data-test=\"stash-modal__header\"\n class=\"stash-modal__header tw-bg-purple tw-h-12 tw-grid tw-place-items-center\"\n :class=\"{ 'lg:tw-rounded-t': !isDrawer }\"\n >\n <div class=\"tw-flex tw-place-items-center\">\n <!-- @slot Adds an action to the left side of the header bar. An example usage is a modal with multiple pages and a back button can be inserted here -->\n <slot name=\"headerAction\"></slot>\n </div>\n\n <h3 v-if=\"props.title\" :id=\"headerId\" class=\"tw-text-white tw-flex-1 tw-leading-6 tw-m-0\">\n {{ props.title }}\n </h3>\n\n <Button\n v-if=\"!props.hideClose\"\n icon\n data-test=\"ll-modal-close\"\n :title=\"t('ll.closeModal')\"\n type=\"button\"\n @click=\"dismiss\"\n >\n <Icon class=\"tw-text-white\" name=\"close\" />\n </Button>\n </header>\n\n <Button\n v-if=\"!props.hideClose && props.hideHeader\"\n class=\"tw-absolute tw-right-0 tw-top-0 tw-z-10\"\n icon\n data-test=\"ll-modal-close\"\n type=\"button\"\n :title=\"t('ll.closeModal')\"\n @click=\"dismiss\"\n >\n <Icon class=\"tw-drop-shadow-md\" name=\"close\" :class=\"[props.closeButtonColorClass]\" />\n </Button>\n\n <div\n v-if=\"!!slots['featured-content']\"\n class=\"tw-relative stash-modal__featured-content\"\n :class=\"{\n 'tw-rounded-t': props.hideHeader,\n }\"\n >\n <slot name=\"featured-content\"></slot>\n </div>\n\n <div\n class=\"stash-modal__body tw-flex-1 tw-overflow-y-auto\"\n :class=\"[\n {\n 'tw-p-3 lg:tw-p-6': !props.disableBodyPadding,\n 'lg:tw-overflow-y-visible': !props.scrollable && !isDrawer,\n 'lg:tw-rounded-b': !hasFooterContent && !isDrawer,\n 'tw-bg-white': !props.contrast,\n 'tw-bg-ice-200': props.contrast,\n },\n ]\"\n data-test=\"stash-modal__body\"\n >\n <slot></slot>\n </div>\n\n <footer\n v-if=\"hasFooterContent\"\n class=\"stash-modal__footer tw-bg-ice-100 tw-border-ice-500 tw-p-3 lg:tw-p-6\"\n :class=\"{ 'lg:tw-rounded-b': !isDrawer }\"\n >\n <!-- @slot Overrides the whole footer section. Used for rendering custom footers with more than 2 actions. If defined, \"actions\" slot will get ignored. -->\n <slot name=\"footer\">\n <div class=\"stash-modal__footer__actions tw-flex tw-flex-col tw-justify-end lg:tw-flex-row\">\n <!-- @slot Modal footer actions, supports rendering up to 2 `<Button>` children -->\n <slot name=\"actions\"></slot>\n </div>\n </slot>\n </footer>\n </div>\n </div>\n</template>\n\n<style scoped>\n .stash-modal__header {\n grid-template-columns: 48px 1fr 48px;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(1) {\n order: 2;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(2) {\n margin-bottom: var(--ll-space-2);\n order: 1;\n }\n\n @media screen and (width >= 961px) {\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(1) {\n order: 1;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(2) {\n margin-bottom: 0;\n order: 2;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button + .stash-button) {\n margin-left: var(--grid-gutter);\n }\n }\n\n .stash-modal__featured-content > :deep(*) {\n border-radius: inherit;\n }\n</style>\n"],"names":["ModalSize","ModalPosition","slots","useSlots","rootRef","ref","lastExternalFocusedElement","focusElements","firstFocusElement","lastFocusElement","initialPageScrollingElementStyle","headerId","uniqueId","hasFooterContent","computed","isModalOpen","props","isDrawer","getPageScrollingElement","watch","onBeforeUnmount","handleTab","_a","dismiss","emit","FOCUS_ELEMENTS_SELECTOR","e","_b"],"mappings":";;;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,OAAO,QAHGA,IAAAA,KAAA,CAAA,CAAA,GAQAC,sBAAAA,OACVA,EAAA,SAAS,U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e,EAAK,GACzBA,EAAK,kBAAkB,EAAK,GAC5BA,EAAK,SAAS;AAAA,IAChB;AAGA,IAAAL,EAAMf,GAAS,MAAM;AACf,MAACA,EAAQ,UAIbE,EAA2B,QAAQ,SAAS,eAC5CF,EAAQ,MAAM,SAEdG,EAAc,QAAQ,MAAM,KAAKH,EAAQ,MAAM,iBAA8BqB,CAAuB,CAAC,GACnFjB,EAAA,QAAQD,EAAc,MAAM,CAAC,GAC/CE,EAAiB,QAAQF,EAAc,MAAMA,EAAc,MAAM,SAAS,CAAC,GAClE,SAAA,iBAAiB,WAAWc,CAAS;AAAA,IAAA,CAC/C;AAED,aAASA,EAAUK,GAAG;;AAChB,MAAAA,EAAE,QAAQ,UACRA,EAAE,YAAY,SAAS,kBAAkBlB,EAAkB,UAC7Dc,IAAAb,EAAiB,UAAjB,QAAAa,EAAwB,SACxBI,EAAE,eAAe,KACR,SAAS,kBAAkBjB,EAAiB,WACrDkB,IAAAnB,EAAkB,UAAlB,QAAAmB,EAAyB,SACzBD,EAAE,eAAe;AAAA,IAGvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Modal.js","sources":["../src/components/Modal/Modal.types.ts","../src/components/Modal/Modal.vue"],"sourcesContent":["export enum ModalSize {\n Narrow = 'narrow',\n Medium = 'medium',\n Wide = 'wide',\n}\n\nexport type ModalSizes = `${ModalSize}`;\n\nexport enum ModalPosition {\n Center = 'center',\n Left = 'left',\n Right = 'right',\n}\n\nexport type ModalPositions = `${ModalPosition}`;\n","<script lang=\"ts\">\n import { ModalPositions, ModalSizes } from './Modal.types';\n\n export * from './Modal.types';\n\n export interface ModalProps {\n /**\n * Hides the \"close\" button\n */\n hideClose?: boolean;\n\n /**\n * Opens the modal when truthy; hides the modal when falsy.\n * @deprecated Use `isOpen` instead\n */\n open?: boolean;\n\n /**\n * Opens the modal when truthy; hides the modal when falsy.\n */\n isOpen?: boolean;\n\n /**\n * Use v-model:is-open or :is-open instead of :model-value and v-model.\n * @deprecated\n */\n modelValue?: boolean;\n\n /**\n * Sets a preset max-width on the modal.\n * Options: default (648px), narrow (360px), wide (960px)\n */\n size?: ModalSizes;\n\n /**\n * Should the modal be scrollable within the content area. This prop is treated as `true` when the `position` prop is set to \"left\" or \"right\".\n */\n scrollable?: boolean;\n\n /**\n * Gives the modal body have a light gray background\n */\n contrast?: boolean;\n\n /**\n * Text to display in the modal header\n */\n title?: string;\n\n /**\n * Disables the default padding in the modal body.\n */\n disableBodyPadding?: boolean;\n\n /**\n * The position on the screen to display the modal.\n */\n position?: ModalPositions;\n\n /**\n * Hide the header. Typically used with the featuredContent slot to display a graphic and create a \"promo\" modal.\n */\n hideHeader?: boolean;\n\n /**\n * Add classes to the close button. This can be used with the hideHeader prop and featuredContent slot to\n * accommodate images with different color backgrounds.\n */\n closeButtonColorClass?: string;\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, onBeforeUnmount, ref, useSlots, watch } from 'vue';\n\n import { FOCUS_ELEMENTS_SELECTOR } from '../../constants';\n import { t } from '../../locale';\n import Backdrop from '../Backdrop/Backdrop.vue';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({ name: 'll-modal' });\n\n const props = withDefaults(defineProps<ModalProps>(), {\n hideClose: false,\n open: false,\n isOpen: false,\n modelValue: false,\n size: 'medium',\n scrollable: false,\n contrast: false,\n title: '',\n position: 'center',\n hideHeader: false,\n closeButtonColorClass: 'tw-text-white/50',\n });\n\n const emit =\n defineEmits<{\n /**\n * @deprecated Use the `update:is-open` event instead\n */\n (e: 'update:open', isOpen?: boolean): void;\n (e: 'update:is-open', isOpen?: boolean): void;\n (e: 'dismiss'): void;\n }>();\n\n const slots = useSlots();\n\n const rootRef = ref<HTMLElement>();\n const lastExternalFocusedElement = ref<HTMLElement>();\n const focusElements = ref<HTMLElement[]>([]);\n const firstFocusElement = ref<HTMLElement>();\n const lastFocusElement = ref<HTMLElement>();\n const initialPageScrollingElementStyle = ref({ height: '', overflow: '' });\n const headerId = uniqueId('modal-header-');\n const hasFooterContent = computed(() => !!slots.actions || !!slots.footer);\n const isModalOpen = computed(() => props.open || props.isOpen);\n const isDrawer = computed(() => props.position === 'left' || props.position === 'right');\n\n function getPageScrollingElement() {\n return (document.scrollingElement || document.body) as HTMLElement;\n }\n\n watch(\n isModalOpen,\n () => {\n if (isModalOpen.value) {\n Object.assign(initialPageScrollingElementStyle.value, {\n height: getPageScrollingElement().style.height,\n overflow: getPageScrollingElement().style.overflow,\n });\n }\n\n Object.assign(getPageScrollingElement().style, {\n overflow: isModalOpen.value ? 'hidden' : initialPageScrollingElementStyle.value.overflow, // Prevents page from scrolling when modal is open\n height: isModalOpen.value ? '100%' : initialPageScrollingElementStyle.value.height, // Ensures the backdrop covers the entire page when modal is open; see https://github.com/LeafLink/stash/pull/713#issuecomment-1184602535\n });\n },\n { immediate: true },\n );\n\n onBeforeUnmount(() => {\n // In cases where the watchEffect for isModalOpen isn't triggered while closing/nagivating away from modal, this ensures scrolling returns to normal\n Object.assign(getPageScrollingElement().style, {\n overflow: initialPageScrollingElementStyle.value.overflow,\n height: initialPageScrollingElementStyle.value.height,\n });\n\n // Clear focus trap tab listener\n document.removeEventListener('keydown', handleTab);\n lastExternalFocusedElement.value?.focus();\n });\n\n function dismiss() {\n emit('update:open', false);\n emit('update:is-open', false);\n emit('dismiss');\n }\n\n // This watcher ensures the Tab key cycles through focusable elements within the modal.\n watch(rootRef, () => {\n if (!rootRef.value) {\n return;\n }\n\n lastExternalFocusedElement.value = document.activeElement as HTMLElement;\n rootRef.value.focus();\n\n focusElements.value = Array.from(rootRef.value.querySelectorAll<HTMLElement>(FOCUS_ELEMENTS_SELECTOR));\n firstFocusElement.value = focusElements.value[0];\n lastFocusElement.value = focusElements.value[focusElements.value.length - 1];\n document.addEventListener('keydown', handleTab);\n });\n\n function handleTab(e) {\n if (e.key === 'Tab') {\n if (e.shiftKey && document.activeElement === firstFocusElement.value) {\n lastFocusElement.value?.focus();\n e.preventDefault();\n } else if (document.activeElement === lastFocusElement.value) {\n firstFocusElement.value?.focus();\n e.preventDefault();\n }\n }\n }\n</script>\n\n<template>\n <div\n v-if=\"isModalOpen\"\n ref=\"rootRef\"\n class=\"stash-modal tw-fixed tw-inset-0 tw-overflow-y-auto\"\n :class=\"{\n 'tw-invisible tw-z-behind': !isModalOpen,\n 'tw-visible tw-z-modal': isModalOpen,\n 'lg:tw-flex lg:tw-flex-col lg:tw-justify-center lg:tw-items-center': props.position === 'center',\n }\"\n data-test=\"ll-modal\"\n tabindex=\"0\"\n @keydown.esc=\"dismiss\"\n >\n <Backdrop class=\"stash-modal__backdrop\" @click.stop=\"dismiss\" />\n <div\n aria-modal=\"true\"\n role=\"dialog\"\n :aria-labelledby=\"headerId\"\n class=\"stash-modal__dialog tw-flex tw-flex-col tw-h-screen tw-w-full lg:tw-shadow tw-relative\"\n :class=\"[\n `stash-modal__dialog--size-${props.size}`,\n `stash-modal__dialog--position-${props.position}`,\n {\n 'stash-modal__dialog--is-open': isModalOpen,\n 'stash-modal__dialog--is-drawer': isDrawer,\n 'stash-modal__dialog--is-contrast': props.contrast,\n 'stash-modal__dialog--is-scrollable': props.scrollable,\n 'lg:tw-w-[360px]': props.size === 'narrow',\n 'lg:tw-w-[648px]': props.size === 'medium',\n 'lg:tw-w-[960px]': props.size === 'wide',\n 'lg:tw-h-auto lg:tw-my-0 lg:tw-max-h-[90vh]': props.position === 'center',\n 'lg:tw-h-screen lg:tw-absolute': isDrawer,\n 'lg:tw-left-0': props.position === 'left',\n 'lg:tw-right-0': props.position === 'right',\n },\n ]\"\n @click.stop\n >\n <header\n v-if=\"!props.hideHeader\"\n data-test=\"stash-modal__header\"\n class=\"stash-modal__header tw-bg-purple-500 tw-h-12 tw-grid tw-place-items-center\"\n :class=\"{ 'lg:tw-rounded-t': !isDrawer }\"\n >\n <div class=\"tw-flex tw-place-items-center\">\n <!-- @slot Adds an action to the left side of the header bar. An example usage is a modal with multiple pages and a back button can be inserted here -->\n <slot name=\"headerAction\"></slot>\n </div>\n\n <h3 v-if=\"props.title\" :id=\"headerId\" class=\"tw-text-white tw-flex-1 tw-leading-6 tw-m-0\">\n {{ props.title }}\n </h3>\n\n <Button\n v-if=\"!props.hideClose\"\n icon\n data-test=\"ll-modal-close\"\n :title=\"t('ll.closeModal')\"\n type=\"button\"\n @click=\"dismiss\"\n >\n <Icon class=\"tw-text-white\" name=\"close\" />\n </Button>\n </header>\n\n <Button\n v-if=\"!props.hideClose && props.hideHeader\"\n class=\"tw-absolute tw-right-0 tw-top-0 tw-z-10\"\n icon\n data-test=\"ll-modal-close\"\n type=\"button\"\n :title=\"t('ll.closeModal')\"\n @click=\"dismiss\"\n >\n <Icon class=\"tw-drop-shadow-md\" name=\"close\" :class=\"[props.closeButtonColorClass]\" />\n </Button>\n\n <div\n v-if=\"!!slots['featured-content']\"\n class=\"tw-relative stash-modal__featured-content\"\n :class=\"{\n 'tw-rounded-t': props.hideHeader,\n }\"\n >\n <slot name=\"featured-content\"></slot>\n </div>\n\n <div\n class=\"stash-modal__body tw-flex-1 tw-overflow-y-auto\"\n :class=\"[\n {\n 'tw-p-3 lg:tw-p-6': !props.disableBodyPadding,\n 'lg:tw-overflow-y-visible': !props.scrollable && !isDrawer,\n 'lg:tw-rounded-b': !hasFooterContent && !isDrawer,\n 'tw-bg-white': !props.contrast,\n 'tw-bg-ice-200': props.contrast,\n },\n ]\"\n data-test=\"stash-modal__body\"\n >\n <slot></slot>\n </div>\n\n <footer\n v-if=\"hasFooterContent\"\n class=\"stash-modal__footer tw-bg-ice-100 tw-border-ice-500 tw-p-3 lg:tw-p-6\"\n :class=\"{ 'lg:tw-rounded-b': !isDrawer }\"\n >\n <!-- @slot Overrides the whole footer section. Used for rendering custom footers with more than 2 actions. If defined, \"actions\" slot will get ignored. -->\n <slot name=\"footer\">\n <div class=\"stash-modal__footer__actions tw-flex tw-flex-col tw-justify-end lg:tw-flex-row\">\n <!-- @slot Modal footer actions, supports rendering up to 2 `<Button>` children -->\n <slot name=\"actions\"></slot>\n </div>\n </slot>\n </footer>\n </div>\n </div>\n</template>\n\n<style scoped>\n .stash-modal__header {\n grid-template-columns: 48px 1fr 48px;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(1) {\n order: 2;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(2) {\n margin-bottom: var(--ll-space-2);\n order: 1;\n }\n\n @media screen and (width >= 961px) {\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(1) {\n order: 1;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button):nth-of-type(2) {\n margin-bottom: 0;\n order: 2;\n }\n\n .stash-modal__footer__actions > :deep(.stash-button + .stash-button) {\n margin-left: var(--grid-gutter);\n }\n }\n\n .stash-modal__featured-content > :deep(*) {\n border-radius: inherit;\n }\n</style>\n"],"names":["ModalSize","ModalPosition","slots","useSlots","rootRef","ref","lastExternalFocusedElement","focusElements","firstFocusElement","lastFocusElement","initialPageScrollingElementStyle","headerId","uniqueId","hasFooterContent","computed","isModalOpen","props","isDrawer","getPageScrollingElement","watch","onBeforeUnmount","handleTab","_a","dismiss","emit","FOCUS_ELEMENTS_SELECTOR","e","_b"],"mappings":";;;;;;;;;;;;AAAY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,OAAO,QAHGA,IAAAA,KAAA,CAAA,CAAA,GAQAC,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,QAAQ,SAHEA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;iBCoGJC,IAAQC,KAERC,IAAUC,KACVC,IAA6BD,KAC7BE,IAAgBF,EAAmB,CAAA,CAA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AEdG,EAAc,QAAQ,MAAM,KAAKH,EAAQ,MAAM,iBAA8BqB,CAAuB,CAAC,GACnFjB,EAAA,QAAQD,EAAc,MAAM,CAAC,GAC/CE,EAAiB,QAAQF,EAAc,MAAMA,EAAc,MAAM,SAAS,CAAC,GAClE,SAAA,iBAAiB,WAAWc,CAAS;AAAA,IAAA,CAC/C;AAED,aAASA,EAAUK,GAAG;;AAChB,MAAAA,EAAE,QAAQ,UACRA,EAAE,YAAY,SAAS,kBAAkBlB,EAAkB,UAC7Dc,IAAAb,EAAiB,UAAjB,QAAAa,EAAwB,SACxBI,EAAE,eAAe,KACR,SAAS,kBAAkBjB,EAAiB,WACrDkB,IAAAnB,EAAkB,UAAlB,QAAAmB,EAAyB,SACzBD,EAAE,eAAe;AAAA,IAGvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Module.js
CHANGED
|
@@ -20,7 +20,7 @@ const y = /* @__PURE__ */ i({
|
|
|
20
20
|
}), s(w.key, { variant: d(() => a.variant) }), (n, f) => (p(), u(v, {
|
|
21
21
|
class: b(["stash-module tw-flex tw-flex-col", {
|
|
22
22
|
"tw-shadow-none lg:tw-shadow tw-bg-transparent": a.variant === t(e).Table,
|
|
23
|
-
"tw-border tw-border-ice": a.variant === t(e).Card,
|
|
23
|
+
"tw-border tw-border-ice-500": a.variant === t(e).Card,
|
|
24
24
|
"tw-shadow-none lg:tw-shadow tw-bg-transparent tw-mb-6": a.variant === t(e).List
|
|
25
25
|
}]),
|
|
26
26
|
"data-test": "stash-module",
|
package/dist/Module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Module.js","sources":["../src/components/Module/Module.vue"],"sourcesContent":["<script lang=\"ts\">\n import Box, { type BoxProps } from '../Box/Box.vue';\n import { ModuleVariant, type ModuleVariants } from './Module.types';\n\n export * from './Module.keys';\n export * from './Module.types';\n\n export interface ModuleProps extends BoxProps {\n /**\n * Variant applied.\n *\n * Options: `box`, `card`, `list`.\n */\n variant?: ModuleVariants;\n }\n</script>\n\n<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, onMounted, provide } from 'vue';\n\n import { MODULE_INJECTION } from './Module.keys';\n\n defineOptions({\n name: 'll-module',\n });\n\n const props = withDefaults(defineProps<ModuleProps>(), {\n variant: ModuleVariant.Box,\n });\n\n onMounted(() => {\n if (props.variant === 'card') {\n logger.warn('Card Modules are no longer a thing. You\\'re probably looking for `<RadioGroup variant=\"card\">`.');\n }\n\n if (props.variant === 'list') {\n logger.warn('Only used with deprecated ListView component. Use `table` variant with `Table` component instead.');\n }\n });\n\n provide(MODULE_INJECTION.key, { variant: computed(() => props.variant) });\n</script>\n\n<template>\n <Box\n class=\"stash-module tw-flex tw-flex-col\"\n data-test=\"stash-module\"\n :class=\"{\n 'tw-shadow-none lg:tw-shadow tw-bg-transparent': props.variant === ModuleVariant.Table,\n 'tw-border tw-border-ice': props.variant === ModuleVariant.Card,\n 'tw-shadow-none lg:tw-shadow tw-bg-transparent tw-mb-6': props.variant === ModuleVariant.List,\n }\"\n :disable-gutters=\"props.disableGutters\"\n :disable-padding=\"props.disablePadding || ['card', 'list', 'table'].includes(props.variant)\"\n :disable-elevation=\"\n props.disableElevation ||\n props.variant === ModuleVariant.Table ||\n props.variant === ModuleVariant.Card ||\n props.variant === ModuleVariant.List\n \"\n >\n <slot></slot>\n </Box>\n</template>\n"],"names":["onMounted","props","logger","provide","MODULE_INJECTION","computed"],"mappings":";;;;;;;;;;;;;;;;;AA+BE,WAAAA,EAAU,MAAM;AACV,MAAAC,EAAM,YAAY,UACpBC,EAAO,KAAK,iGAAiG,GAG3GD,EAAM,YAAY,UACpBC,EAAO,KAAK,mGAAmG;AAAA,IACjH,CACD,GAEOC,EAAAC,EAAiB,KAAK,EAAE,SAASC,EAAS,MAAMJ,EAAM,OAAO,EAAA,CAAG;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Module.js","sources":["../src/components/Module/Module.vue"],"sourcesContent":["<script lang=\"ts\">\n import Box, { type BoxProps } from '../Box/Box.vue';\n import { ModuleVariant, type ModuleVariants } from './Module.types';\n\n export * from './Module.keys';\n export * from './Module.types';\n\n export interface ModuleProps extends BoxProps {\n /**\n * Variant applied.\n *\n * Options: `box`, `card`, `list`.\n */\n variant?: ModuleVariants;\n }\n</script>\n\n<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, onMounted, provide } from 'vue';\n\n import { MODULE_INJECTION } from './Module.keys';\n\n defineOptions({\n name: 'll-module',\n });\n\n const props = withDefaults(defineProps<ModuleProps>(), {\n variant: ModuleVariant.Box,\n });\n\n onMounted(() => {\n if (props.variant === 'card') {\n logger.warn('Card Modules are no longer a thing. You\\'re probably looking for `<RadioGroup variant=\"card\">`.');\n }\n\n if (props.variant === 'list') {\n logger.warn('Only used with deprecated ListView component. Use `table` variant with `Table` component instead.');\n }\n });\n\n provide(MODULE_INJECTION.key, { variant: computed(() => props.variant) });\n</script>\n\n<template>\n <Box\n class=\"stash-module tw-flex tw-flex-col\"\n data-test=\"stash-module\"\n :class=\"{\n 'tw-shadow-none lg:tw-shadow tw-bg-transparent': props.variant === ModuleVariant.Table,\n 'tw-border tw-border-ice-500': props.variant === ModuleVariant.Card,\n 'tw-shadow-none lg:tw-shadow tw-bg-transparent tw-mb-6': props.variant === ModuleVariant.List,\n }\"\n :disable-gutters=\"props.disableGutters\"\n :disable-padding=\"props.disablePadding || ['card', 'list', 'table'].includes(props.variant)\"\n :disable-elevation=\"\n props.disableElevation ||\n props.variant === ModuleVariant.Table ||\n props.variant === ModuleVariant.Card ||\n props.variant === ModuleVariant.List\n \"\n >\n <slot></slot>\n </Box>\n</template>\n"],"names":["onMounted","props","logger","provide","MODULE_INJECTION","computed"],"mappings":";;;;;;;;;;;;;;;;;AA+BE,WAAAA,EAAU,MAAM;AACV,MAAAC,EAAM,YAAY,UACpBC,EAAO,KAAK,iGAAiG,GAG3GD,EAAM,YAAY,UACpBC,EAAO,KAAK,mGAAmG;AAAA,IACjH,CACD,GAEOC,EAAAC,EAAiB,KAAK,EAAE,SAASC,EAAS,MAAMJ,EAAM,OAAO,EAAA,CAAG;;;;;;;;;;;;;;;;;;"}
|
package/dist/ModuleFooter.js
CHANGED
|
@@ -12,7 +12,7 @@ const h = /* @__PURE__ */ n({
|
|
|
12
12
|
t.value = e.variant.value;
|
|
13
13
|
}), (e, f) => (d(), s("div", {
|
|
14
14
|
class: p(["stash-module-footer tw-flex tw-flex-wrap tw-justify-between", {
|
|
15
|
-
"tw-px-3 lg:tw-px-6 tw-pb-6 tw-pt-0 tw-border-b tw-border-ice tw-rounded-b": t.value === o(r).Card,
|
|
15
|
+
"tw-px-3 lg:tw-px-6 tw-pb-6 tw-pt-0 tw-border-b tw-border-ice-500 tw-rounded-b": t.value === o(r).Card,
|
|
16
16
|
"tw-px-3 lg:tw-px-6 tw-py-3 tw-bg-white tw-rounded lg:tw-rounded-t-none tw-shadow lg:tw-shadow-none": t.value === o(r).Table || t.value === o(r).List,
|
|
17
17
|
"tw-pt-3 lg:tw-pt-6 tw-mb-0": t.value === o(r).Box
|
|
18
18
|
}]),
|
package/dist/ModuleFooter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleFooter.js","sources":["../src/components/ModuleFooter/ModuleFooter.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, onBeforeMount, ref } from 'vue';\n\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { ModuleVariant } from '../Module/Module.types';\n\n const moduleVariant = ref();\n\n onBeforeMount(() => {\n const moduleInjectedValues = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n if (!moduleInjectedValues.variant) {\n throw new Error('ModuleContent must be used within a Module component.');\n }\n moduleVariant.value = moduleInjectedValues.variant.value;\n });\n</script>\n\n<template>\n <div\n class=\"stash-module-footer tw-flex tw-flex-wrap tw-justify-between\"\n :class=\"{\n 'tw-px-3 lg:tw-px-6 tw-pb-6 tw-pt-0 tw-border-b tw-border-ice tw-rounded-b'
|
|
1
|
+
{"version":3,"file":"ModuleFooter.js","sources":["../src/components/ModuleFooter/ModuleFooter.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, onBeforeMount, ref } from 'vue';\n\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { ModuleVariant } from '../Module/Module.types';\n\n const moduleVariant = ref();\n\n onBeforeMount(() => {\n const moduleInjectedValues = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n if (!moduleInjectedValues.variant) {\n throw new Error('ModuleContent must be used within a Module component.');\n }\n moduleVariant.value = moduleInjectedValues.variant.value;\n });\n</script>\n\n<template>\n <div\n class=\"stash-module-footer tw-flex tw-flex-wrap tw-justify-between\"\n :class=\"{\n 'tw-px-3 lg:tw-px-6 tw-pb-6 tw-pt-0 tw-border-b tw-border-ice-500 tw-rounded-b':\n moduleVariant === ModuleVariant.Card,\n 'tw-px-3 lg:tw-px-6 tw-py-3 tw-bg-white tw-rounded lg:tw-rounded-t-none tw-shadow lg:tw-shadow-none':\n moduleVariant === ModuleVariant.Table || moduleVariant === ModuleVariant.List,\n 'tw-pt-3 lg:tw-pt-6 tw-mb-0': moduleVariant === ModuleVariant.Box,\n }\"\n data-test=\"stash-module-footer\"\n >\n <slot></slot>\n </div>\n</template>\n"],"names":["moduleVariant","ref","onBeforeMount","moduleInjectedValues","inject","MODULE_INJECTION"],"mappings":";;;;;;AAME,UAAMA,IAAgBC;AAEtB,WAAAC,EAAc,MAAM;AAClB,YAAMC,IAAuBC,EAAOC,EAAiB,KAAKA,EAAiB,QAAQ;AAC/E,UAAA,CAACF,EAAqB;AAClB,cAAA,IAAI,MAAM,uDAAuD;AAE3D,MAAAH,EAAA,QAAQG,EAAqB,QAAQ;AAAA,IAAA,CACpD;;;;;;;;;;;;"}
|
package/dist/ModuleHeader.js
CHANGED
|
@@ -49,7 +49,7 @@ const T = { class: "tw-flex tw-items-center" }, $ = {
|
|
|
49
49
|
});
|
|
50
50
|
return (e, H) => (l(), r("header", {
|
|
51
51
|
class: n(["stash-module-header tw-flex tw-flex-wrap tw-justify-between", {
|
|
52
|
-
"tw-bg-ice-100 tw-px-3 lg:tw-px-6 tw-py-3 tw-border-b tw-border-ice tw-rounded-t": s.value === a(o).Card,
|
|
52
|
+
"tw-bg-ice-100 tw-px-3 lg:tw-px-6 tw-py-3 tw-border-b tw-border-ice-500 tw-rounded-t": s.value === a(o).Card,
|
|
53
53
|
"tw-px-3 lg:tw-px-6 tw-pt-3 lg:tw-pt-6 tw-bg-white tw-mb-6 lg:tw-mb-0 tw-rounded lg:tw-rounded-b-none tw-shadow lg:tw-shadow-none": s.value === a(o).Table || s.value === a(o).List,
|
|
54
54
|
"tw-border-b tw-border-ice-200 tw-mb-3 lg:tw-mb-6": t.underline
|
|
55
55
|
}]),
|
package/dist/ModuleHeader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleHeader.js","sources":["../src/components/ModuleHeader/ModuleHeader.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, ref, useCssModule, useSlots } from 'vue';\n\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { ModuleVariant } from '../Module/Module.types';\n\n defineOptions({\n name: 'll-module-header',\n });\n\n export interface ModuleHeaderProps {\n /**\n * Header title. Will get overridden by the `title` slot if provided.\n */\n title?: string;\n\n /**\n * Size of the header.\n *\n * - `small` = `h4`\n * - `medium` = `h3`\n * - `large` = `h2`\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Header description, aka subtitle. Will get overridden by the `description` slot if provided.\n */\n description?: string;\n\n /**\n * Stop the actions slot from force-wrapping on medium and smalls screens.\n */\n preventActionsWrap?: boolean;\n\n /**\n * Displays a border at the bottom\n */\n underline?: boolean;\n }\n\n const props = withDefaults(defineProps<ModuleHeaderProps>(), {\n title: '',\n size: 'medium',\n description: '',\n preventActionsWrap: false,\n underline: false,\n });\n const classes = useCssModule();\n const slots = useSlots();\n const moduleVariant = ref();\n\n onBeforeMount(() => {\n const moduleInjectedValues = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n if (!moduleInjectedValues.variant) {\n throw new Error('ModuleHeader must be used within a Module component.');\n }\n moduleVariant.value = moduleInjectedValues.variant.value;\n });\n\n const is = computed(() => {\n let component;\n\n switch (props.size) {\n case 'small':\n component = 'h4';\n break;\n\n case 'medium':\n component = 'h3';\n break;\n\n case 'large':\n component = 'h2';\n break;\n\n default:\n component = 'h3';\n break;\n }\n\n return component;\n });\n\n const marginBottomClasses = computed(() => {\n const isBoxOrTableOrList =\n moduleVariant.value === ModuleVariant.Box ||\n moduleVariant.value === ModuleVariant.Table ||\n moduleVariant.value === ModuleVariant.List;\n\n if (isBoxOrTableOrList && !props.underline) {\n return 'tw-mb-3 lg:tw-mb-6';\n } else if (isBoxOrTableOrList && props.underline) {\n return 'tw-mb-3';\n } else {\n return '';\n }\n });\n</script>\n\n<template>\n <header\n class=\"stash-module-header tw-flex tw-flex-wrap tw-justify-between\"\n :class=\"{\n 'tw-bg-ice-100 tw-px-3 lg:tw-px-6 tw-py-3 tw-border-b tw-border-ice tw-rounded-t':\n moduleVariant === ModuleVariant.Card,\n 'tw-px-3 lg:tw-px-6 tw-pt-3 lg:tw-pt-6 tw-bg-white tw-mb-6 lg:tw-mb-0 tw-rounded lg:tw-rounded-b-none tw-shadow lg:tw-shadow-none':\n moduleVariant === ModuleVariant.Table || moduleVariant === ModuleVariant.List,\n 'tw-border-b tw-border-ice-200 tw-mb-3 lg:tw-mb-6': props.underline,\n }\"\n data-test=\"stash-module-header\"\n >\n <div\n class=\"stash-module-header__content tw-mr-6\"\n :class=\"marginBottomClasses\"\n data-test=\"stash-module-header|content\"\n >\n <div class=\"tw-flex tw-items-center\">\n <div\n v-if=\"slots.media && props.size === 'large'\"\n class=\"stash-module-header__content__media tw-mr-3\"\n :class=\"classes.media\"\n data-test=\"stash-module-header|content-media\"\n >\n <slot name=\"media\"></slot>\n </div>\n\n <div class=\"stash-module-header__content__text\" data-test=\"stash-module-header|content-text\">\n <!--\n @slot Header title\n @type String\n @default HTML header element with the `title` prop as the text.\n TODO: this doesn't work...\n -->\n <slot name=\"title\">\n <component :is=\"is\" v-if=\"props.title\" class=\"tw-my-0\">{{ props.title }}</component>\n </slot>\n\n <!--\n @slot Header title\n @type String\n @default HTML <p> element with the `description` prop as the text.\n -->\n <slot name=\"description\">\n <p v-if=\"props.description\" class=\"tw-mt-3 tw-mb-0\">{{ props.description }}</p>\n </slot>\n </div>\n </div>\n </div>\n\n <!-- todo: how can we pass a prop/class to actions in order to top align vs middle align? -->\n <div\n v-if=\"slots.actions\"\n class=\"stash-module-header__actions tw-self-center\"\n :class=\"[\n marginBottomClasses,\n {\n 'tw-w-full lg:tw-w-auto': !props.preventActionsWrap,\n },\n ]\"\n data-test=\"stash-module-header|actions\"\n >\n <slot name=\"actions\"></slot>\n </div>\n </header>\n</template>\n\n<style module>\n /* max size for media/marketing illustration icons we would be passing to the slot */\n .media {\n max-height: 58px;\n max-width: 58px;\n }\n</style>\n"],"names":["classes","useCssModule","slots","useSlots","moduleVariant","ref","onBeforeMount","moduleInjectedValues","inject","MODULE_INJECTION","is","computed","component","props","marginBottomClasses","isBoxOrTableOrList","ModuleVariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAgDQA,IAAUC,KACVC,IAAQC,KACRC,IAAgBC;AAEtB,IAAAC,EAAc,MAAM;AAClB,YAAMC,IAAuBC,EAAOC,EAAiB,KAAKA,EAAiB,QAAQ;AAC/E,UAAA,CAACF,EAAqB;AAClB,cAAA,IAAI,MAAM,sDAAsD;AAE1D,MAAAH,EAAA,QAAQG,EAAqB,QAAQ;AAAA,IAAA,CACpD;AAEK,UAAAG,IAAKC,EAAS,MAAM;AACpB,UAAAC;AAEJ,cAAQC,EAAM,MAAM;AAAA,QAClB,KAAK;AACS,UAAAD,IAAA;AACZ;AAAA,QAEF,KAAK;AACS,UAAAA,IAAA;AACZ;AAAA,QAEF,KAAK;AACS,UAAAA,IAAA;AACZ;AAAA,QAEF;AACc,UAAAA,IAAA;AACZ;AAAA,MACJ;AAEO,aAAAA;AAAA,IAAA,CACR,GAEKE,IAAsBH,EAAS,MAAM;AACnC,YAAAI,IACJX,EAAc,UAAUY,EAAc,OACtCZ,EAAc,UAAUY,EAAc,SACtCZ,EAAc,UAAUY,EAAc;AAEpC,aAAAD,KAAsB,CAACF,EAAM,YACxB,uBACEE,KAAsBF,EAAM,YAC9B,YAEA;AAAA,IACT,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ModuleHeader.js","sources":["../src/components/ModuleHeader/ModuleHeader.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, ref, useCssModule, useSlots } from 'vue';\n\n import { MODULE_INJECTION } from '../Module/Module.keys';\n import { ModuleVariant } from '../Module/Module.types';\n\n defineOptions({\n name: 'll-module-header',\n });\n\n export interface ModuleHeaderProps {\n /**\n * Header title. Will get overridden by the `title` slot if provided.\n */\n title?: string;\n\n /**\n * Size of the header.\n *\n * - `small` = `h4`\n * - `medium` = `h3`\n * - `large` = `h2`\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Header description, aka subtitle. Will get overridden by the `description` slot if provided.\n */\n description?: string;\n\n /**\n * Stop the actions slot from force-wrapping on medium and smalls screens.\n */\n preventActionsWrap?: boolean;\n\n /**\n * Displays a border at the bottom\n */\n underline?: boolean;\n }\n\n const props = withDefaults(defineProps<ModuleHeaderProps>(), {\n title: '',\n size: 'medium',\n description: '',\n preventActionsWrap: false,\n underline: false,\n });\n const classes = useCssModule();\n const slots = useSlots();\n const moduleVariant = ref();\n\n onBeforeMount(() => {\n const moduleInjectedValues = inject(MODULE_INJECTION.key, MODULE_INJECTION.defaults);\n if (!moduleInjectedValues.variant) {\n throw new Error('ModuleHeader must be used within a Module component.');\n }\n moduleVariant.value = moduleInjectedValues.variant.value;\n });\n\n const is = computed(() => {\n let component;\n\n switch (props.size) {\n case 'small':\n component = 'h4';\n break;\n\n case 'medium':\n component = 'h3';\n break;\n\n case 'large':\n component = 'h2';\n break;\n\n default:\n component = 'h3';\n break;\n }\n\n return component;\n });\n\n const marginBottomClasses = computed(() => {\n const isBoxOrTableOrList =\n moduleVariant.value === ModuleVariant.Box ||\n moduleVariant.value === ModuleVariant.Table ||\n moduleVariant.value === ModuleVariant.List;\n\n if (isBoxOrTableOrList && !props.underline) {\n return 'tw-mb-3 lg:tw-mb-6';\n } else if (isBoxOrTableOrList && props.underline) {\n return 'tw-mb-3';\n } else {\n return '';\n }\n });\n</script>\n\n<template>\n <header\n class=\"stash-module-header tw-flex tw-flex-wrap tw-justify-between\"\n :class=\"{\n 'tw-bg-ice-100 tw-px-3 lg:tw-px-6 tw-py-3 tw-border-b tw-border-ice-500 tw-rounded-t':\n moduleVariant === ModuleVariant.Card,\n 'tw-px-3 lg:tw-px-6 tw-pt-3 lg:tw-pt-6 tw-bg-white tw-mb-6 lg:tw-mb-0 tw-rounded lg:tw-rounded-b-none tw-shadow lg:tw-shadow-none':\n moduleVariant === ModuleVariant.Table || moduleVariant === ModuleVariant.List,\n 'tw-border-b tw-border-ice-200 tw-mb-3 lg:tw-mb-6': props.underline,\n }\"\n data-test=\"stash-module-header\"\n >\n <div\n class=\"stash-module-header__content tw-mr-6\"\n :class=\"marginBottomClasses\"\n data-test=\"stash-module-header|content\"\n >\n <div class=\"tw-flex tw-items-center\">\n <div\n v-if=\"slots.media && props.size === 'large'\"\n class=\"stash-module-header__content__media tw-mr-3\"\n :class=\"classes.media\"\n data-test=\"stash-module-header|content-media\"\n >\n <slot name=\"media\"></slot>\n </div>\n\n <div class=\"stash-module-header__content__text\" data-test=\"stash-module-header|content-text\">\n <!--\n @slot Header title\n @type String\n @default HTML header element with the `title` prop as the text.\n TODO: this doesn't work...\n -->\n <slot name=\"title\">\n <component :is=\"is\" v-if=\"props.title\" class=\"tw-my-0\">{{ props.title }}</component>\n </slot>\n\n <!--\n @slot Header title\n @type String\n @default HTML <p> element with the `description` prop as the text.\n -->\n <slot name=\"description\">\n <p v-if=\"props.description\" class=\"tw-mt-3 tw-mb-0\">{{ props.description }}</p>\n </slot>\n </div>\n </div>\n </div>\n\n <!-- todo: how can we pass a prop/class to actions in order to top align vs middle align? -->\n <div\n v-if=\"slots.actions\"\n class=\"stash-module-header__actions tw-self-center\"\n :class=\"[\n marginBottomClasses,\n {\n 'tw-w-full lg:tw-w-auto': !props.preventActionsWrap,\n },\n ]\"\n data-test=\"stash-module-header|actions\"\n >\n <slot name=\"actions\"></slot>\n </div>\n </header>\n</template>\n\n<style module>\n /* max size for media/marketing illustration icons we would be passing to the slot */\n .media {\n max-height: 58px;\n max-width: 58px;\n }\n</style>\n"],"names":["classes","useCssModule","slots","useSlots","moduleVariant","ref","onBeforeMount","moduleInjectedValues","inject","MODULE_INJECTION","is","computed","component","props","marginBottomClasses","isBoxOrTableOrList","ModuleVariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAgDQA,IAAUC,KACVC,IAAQC,KACRC,IAAgBC;AAEtB,IAAAC,EAAc,MAAM;AAClB,YAAMC,IAAuBC,EAAOC,EAAiB,KAAKA,EAAiB,QAAQ;AAC/E,UAAA,CAACF,EAAqB;AAClB,cAAA,IAAI,MAAM,sDAAsD;AAE1D,MAAAH,EAAA,QAAQG,EAAqB,QAAQ;AAAA,IAAA,CACpD;AAEK,UAAAG,IAAKC,EAAS,MAAM;AACpB,UAAAC;AAEJ,cAAQC,EAAM,MAAM;AAAA,QAClB,KAAK;AACS,UAAAD,IAAA;AACZ;AAAA,QAEF,KAAK;AACS,UAAAA,IAAA;AACZ;AAAA,QAEF,KAAK;AACS,UAAAA,IAAA;AACZ;AAAA,QAEF;AACc,UAAAA,IAAA;AACZ;AAAA,MACJ;AAEO,aAAAA;AAAA,IAAA,CACR,GAEKE,IAAsBH,EAAS,MAAM;AACnC,YAAAI,IACJX,EAAc,UAAUY,EAAc,OACtCZ,EAAc,UAAUY,EAAc,SACtCZ,EAAc,UAAUY,EAAc;AAEpC,aAAAD,KAAsB,CAACF,EAAM,YACxB,uBACEE,KAAsBF,EAAM,YAC9B,YAEA;AAAA,IACT,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/PageNavigation.js
CHANGED
|
@@ -3,7 +3,7 @@ import O from "./Dropdown.js";
|
|
|
3
3
|
import A from "./Icon.js";
|
|
4
4
|
import D from "lodash-es/isFunction";
|
|
5
5
|
import B from "./Chip.js";
|
|
6
|
-
import { resolveComponent as _, openBlock as r, createElementBlock as
|
|
6
|
+
import { resolveComponent as _, openBlock as r, createElementBlock as h, mergeProps as y, createElementVNode as n, normalizeClass as i, toDisplayString as c, Fragment as w, createBlock as m, withCtx as v, createTextVNode as u, createCommentVNode as k, normalizeStyle as S, renderList as I, createVNode as $ } from "vue";
|
|
7
7
|
import { _ as C } from "./_plugin-vue_export-helper-dad06003.js";
|
|
8
8
|
import "lodash-es/get";
|
|
9
9
|
import "./constants.js";
|
|
@@ -16,7 +16,6 @@ import "lodash-es/isPlainObject";
|
|
|
16
16
|
import "lodash-es/uniqueId";
|
|
17
17
|
import "./index-79ce320f.js";
|
|
18
18
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
19
|
-
import "./colors-13e95ebf.js";
|
|
20
19
|
import "./utils/colorScheme.js";
|
|
21
20
|
const M = "_link_5hoi4_176", z = "_badge_5hoi4_225", E = {
|
|
22
21
|
link: M,
|
|
@@ -27,7 +26,7 @@ const M = "_link_5hoi4_176", z = "_badge_5hoi4_225", E = {
|
|
|
27
26
|
}, L = {
|
|
28
27
|
name: "nav-item",
|
|
29
28
|
components: {
|
|
30
|
-
|
|
29
|
+
Chip: B
|
|
31
30
|
},
|
|
32
31
|
inheritAttrs: !1,
|
|
33
32
|
props: {
|
|
@@ -108,15 +107,15 @@ const M = "_link_5hoi4_176", z = "_badge_5hoi4_225", E = {
|
|
|
108
107
|
if (e === this.$route.path)
|
|
109
108
|
return !0;
|
|
110
109
|
if (this.$route.path.includes(e)) {
|
|
111
|
-
const
|
|
110
|
+
const b = (this.$route.path.length - this.$route.path.lastIndexOf("/")) * -1, t = this.$route.path.slice(0, b);
|
|
112
111
|
return e === t;
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
}, V = ["data-id"], F = ["data-id", "onClick"], P = ["href"], T = ["aria-selected", "data-id"], W = ["href"];
|
|
117
|
-
function R(e,
|
|
118
|
-
const f = _("
|
|
119
|
-
return a.isDisabled ? (r(),
|
|
116
|
+
function R(e, b, t, d, l, a) {
|
|
117
|
+
const f = _("Chip"), g = _("router-link");
|
|
118
|
+
return a.isDisabled ? (r(), h("li", y({
|
|
120
119
|
key: 0,
|
|
121
120
|
"aria-disabled": "true",
|
|
122
121
|
"data-id": t.index
|
|
@@ -124,13 +123,13 @@ function R(e, h, t, d, l, a) {
|
|
|
124
123
|
n("span", {
|
|
125
124
|
class: i([e.$style.link, { [e.$style["dropdown-link"]]: t.isDropdown }, e.$style["is-disabled"]])
|
|
126
125
|
}, c(t.label), 3)
|
|
127
|
-
], 16, V)) : (r(),
|
|
128
|
-
t.to ? (r(),
|
|
126
|
+
], 16, V)) : (r(), h(w, { key: 1 }, [
|
|
127
|
+
t.to ? (r(), m(g, {
|
|
129
128
|
key: 0,
|
|
130
129
|
custom: "",
|
|
131
130
|
to: t.to
|
|
132
131
|
}, {
|
|
133
|
-
default:
|
|
132
|
+
default: v(({ route: p, navigate: s }) => {
|
|
134
133
|
var o;
|
|
135
134
|
return [
|
|
136
135
|
n("li", y({
|
|
@@ -143,25 +142,25 @@ function R(e, h, t, d, l, a) {
|
|
|
143
142
|
href: ((o = t.to) == null ? void 0 : o.name) || t.to
|
|
144
143
|
}, [
|
|
145
144
|
u(c(t.label) + " ", 1),
|
|
146
|
-
t.badge ? (r(),
|
|
145
|
+
t.badge ? (r(), m(f, {
|
|
147
146
|
key: 0,
|
|
148
147
|
radius: "pill",
|
|
149
148
|
shade: "main",
|
|
150
149
|
size: "small",
|
|
151
150
|
class: i(e.$style.badge),
|
|
152
|
-
color: t.badgeColor
|
|
151
|
+
"color-scheme": t.badgeColor
|
|
153
152
|
}, {
|
|
154
|
-
default:
|
|
153
|
+
default: v(() => [
|
|
155
154
|
u(c(t.badge), 1)
|
|
156
155
|
]),
|
|
157
156
|
_: 1
|
|
158
|
-
}, 8, ["class", "color"])) : k("", !0)
|
|
157
|
+
}, 8, ["class", "color-scheme"])) : k("", !0)
|
|
159
158
|
], 10, P)
|
|
160
159
|
], 16, F)
|
|
161
160
|
];
|
|
162
161
|
}),
|
|
163
162
|
_: 1
|
|
164
|
-
}, 8, ["to"])) : (r(),
|
|
163
|
+
}, 8, ["to"])) : (r(), h("li", y({
|
|
165
164
|
key: 1,
|
|
166
165
|
role: "tab",
|
|
167
166
|
"aria-selected": t.isActive || null,
|
|
@@ -173,19 +172,19 @@ function R(e, h, t, d, l, a) {
|
|
|
173
172
|
href: t.href
|
|
174
173
|
}, [
|
|
175
174
|
u(c(t.label) + " ", 1),
|
|
176
|
-
t.badge ? (r(),
|
|
175
|
+
t.badge ? (r(), m(f, {
|
|
177
176
|
key: 0,
|
|
178
177
|
radius: "pill",
|
|
179
178
|
shade: "main",
|
|
180
179
|
size: "small",
|
|
181
180
|
class: i(e.$style.badge),
|
|
182
|
-
color: t.badgeColor
|
|
181
|
+
"color-scheme": t.badgeColor
|
|
183
182
|
}, {
|
|
184
|
-
default:
|
|
183
|
+
default: v(() => [
|
|
185
184
|
u(c(t.badge), 1)
|
|
186
185
|
]),
|
|
187
186
|
_: 1
|
|
188
|
-
}, 8, ["class", "color"])) : k("", !0)
|
|
187
|
+
}, 8, ["class", "color-scheme"])) : k("", !0)
|
|
189
188
|
], 10, W)
|
|
190
189
|
], 16, T))
|
|
191
190
|
], 64));
|
|
@@ -263,7 +262,7 @@ const j = {
|
|
|
263
262
|
observe() {
|
|
264
263
|
var e;
|
|
265
264
|
if (this.hasIntersectionObserver) {
|
|
266
|
-
const
|
|
265
|
+
const b = Array.from(this.$refs.tabList.children), t = {
|
|
267
266
|
root: this.$refs.tabList,
|
|
268
267
|
rootMargin: "0px 0px 0px 0px",
|
|
269
268
|
threshold: Array.from({ length: 100 }).map((d, l) => (l + 1) / 100)
|
|
@@ -273,7 +272,7 @@ const j = {
|
|
|
273
272
|
const a = l.target.getAttribute("data-id");
|
|
274
273
|
l.intersectionRatio > 0.96 ? this.overflowIds.includes(a) && this.overflowIds.splice(this.overflowIds.indexOf(a), 1) : this.overflowIds.includes(a) || this.overflowIds.push(a);
|
|
275
274
|
});
|
|
276
|
-
}, t),
|
|
275
|
+
}, t), b.forEach((d) => {
|
|
277
276
|
this.observer.observe(d);
|
|
278
277
|
}), this.toggleWidth = (e = this.$refs.toggle.$el) == null ? void 0 : e.getBoundingClientRect().width;
|
|
279
278
|
}
|
|
@@ -283,9 +282,9 @@ const j = {
|
|
|
283
282
|
}
|
|
284
283
|
}
|
|
285
284
|
}, Y = { class: "container" }, Z = ["onClick"];
|
|
286
|
-
function x(e,
|
|
285
|
+
function x(e, b, t, d, l, a) {
|
|
287
286
|
const f = _("NavItem"), g = _("ll-icon"), p = _("ll-dropdown");
|
|
288
|
-
return r(),
|
|
287
|
+
return r(), h("div", Y, [
|
|
289
288
|
n("nav", {
|
|
290
289
|
class: i([e.$style.tabs, { [e.$style["is-scrollable"]]: !l.hasIntersectionObserver }])
|
|
291
290
|
}, [
|
|
@@ -296,7 +295,7 @@ function x(e, h, t, d, l, a) {
|
|
|
296
295
|
width: `calc(100% - ${l.toggleWidth}px)`
|
|
297
296
|
})
|
|
298
297
|
}, [
|
|
299
|
-
(r(!0),
|
|
298
|
+
(r(!0), h(w, null, I(t.items, (s, o) => (r(), m(f, {
|
|
300
299
|
key: o,
|
|
301
300
|
class: i([e.$style.item, { [e.$style["is-invisible"]]: l.overflowIds.includes(`${o}`) }]),
|
|
302
301
|
badge: s.badge,
|
|
@@ -315,7 +314,7 @@ function x(e, h, t, d, l, a) {
|
|
|
315
314
|
class: i([e.$style.dropdown, { [e.$style["is-visible"]]: l.overflowIds.length }]),
|
|
316
315
|
offset: { x: -1 }
|
|
317
316
|
}, {
|
|
318
|
-
toggle:
|
|
317
|
+
toggle: v(({ toggle: s }) => [
|
|
319
318
|
n("button", {
|
|
320
319
|
"aria-haspopup": "true",
|
|
321
320
|
class: i([e.$style.link, e.$style["dropdown-toggle"]]),
|
|
@@ -330,11 +329,11 @@ function x(e, h, t, d, l, a) {
|
|
|
330
329
|
}, null, 8, ["class"])
|
|
331
330
|
], 10, Z)
|
|
332
331
|
]),
|
|
333
|
-
default:
|
|
332
|
+
default: v(() => [
|
|
334
333
|
n("ul", {
|
|
335
334
|
class: i(e.$style["dropdown-list"])
|
|
336
335
|
}, [
|
|
337
|
-
(r(!0),
|
|
336
|
+
(r(!0), h(w, null, I(t.items, (s, o) => (r(), m(f, {
|
|
338
337
|
key: o,
|
|
339
338
|
class: i({ hidden: !l.overflowIds.includes(`${o}`) }),
|
|
340
339
|
href: s.href,
|
|
@@ -354,9 +353,9 @@ function x(e, h, t, d, l, a) {
|
|
|
354
353
|
}
|
|
355
354
|
const ee = {
|
|
356
355
|
$style: Q
|
|
357
|
-
},
|
|
356
|
+
}, ye = /* @__PURE__ */ C(X, [["render", x], ["__cssModules", ee]]);
|
|
358
357
|
export {
|
|
359
358
|
q as NavItem,
|
|
360
|
-
|
|
359
|
+
ye as default
|
|
361
360
|
};
|
|
362
361
|
//# sourceMappingURL=PageNavigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageNavigation.js","sources":["../src/components/PageNavigation/components/NavItem.vue","../src/components/PageNavigation/PageNavigation.vue"],"sourcesContent":["<script>\n import isFunction from 'lodash-es/isFunction';\n\n import Chip from '../../Chip/Chip.vue';\n\n export default {\n name: 'nav-item',\n\n components: {\n 'll-chip': Chip,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Used to display the bubble count, i.e. orders, messages\n */\n badge: {\n type: [Number, String],\n default: 0,\n },\n\n /**\n * The background color of the badge.\n * Currently limited to a subset of brand colors.\n */\n badgeColor: {\n type: String,\n default: 'blue',\n validator: (value) => ['blue', 'red'].includes(value),\n },\n\n /**\n * Private/inherited - Item index.\n */\n index: {\n type: Number,\n required: true,\n },\n /**\n * Private/inherited - Whether the current tab `index` matches `activeIndex`\n */\n isActive: Boolean,\n /**\n * Private/inherited - Whether the item is inside the dropdown\n */\n isDropdown: Boolean,\n /**\n * Used to render an `<a>` tag. Denotes the target href of the link.\n */\n href: {\n default: '',\n type: String,\n },\n /**\n * The nav item label\n */\n label: {\n default: '',\n type: String,\n },\n /**\n * Used to render a `<router-link>`. Denotes the target route of the link.\n * See: https://router.vuejs.org/api/#router-link\n */\n to: {\n default: '',\n type: [Object, String],\n },\n /**\n * Will render a plain text item if true.\n * Accepts a function to ensure the value is up-to-date, such as when it comes from vuex\n */\n disabled: {\n default: false,\n type: [Boolean, Function],\n },\n },\n\n computed: {\n isDisabled() {\n if (isFunction(this.disabled)) {\n return this.disabled();\n }\n\n return this.disabled;\n },\n },\n\n methods: {\n /**\n * Customer Active Class matcher.\n *\n * This attempts to match the URL ignoring the path params.\n */\n hasActiveClass(path) {\n if (path === this.$route.path) {\n return true;\n } else if (this.$route.path.includes(path)) {\n const sliceIndex = (this.$route.path.length - this.$route.path.lastIndexOf('/')) * -1;\n const parentPath = this.$route.path.slice(0, sliceIndex);\n\n return path === parentPath;\n }\n },\n },\n };\n</script>\n\n<template>\n <li v-if=\"isDisabled\" aria-disabled=\"true\" :data-id=\"index\" v-bind=\"$attrs\">\n <span :class=\"[$style.link, { [$style['dropdown-link']]: isDropdown }, $style['is-disabled']]\">{{ label }}</span>\n </li>\n <template v-else>\n <router-link v-if=\"to\" v-slot=\"{ route, navigate }\" custom :to=\"to\">\n <li\n role=\"tab\"\n :data-id=\"index\"\n :class=\"[{ [$style['is-active']]: hasActiveClass(route.path) }, 'cursor-pointer']\"\n v-bind=\"$attrs\"\n @click=\"navigate\"\n >\n <a :class=\"[$style.link, { [$style['dropdown-link']]: isDropdown }]\" :href=\"to?.name || to\">\n {{ label }}\n <ll-chip v-if=\"badge\" radius=\"pill\" shade=\"main\" size=\"small\" :class=\"$style.badge\" :color=\"badgeColor\">{{\n badge\n }}</ll-chip>\n </a>\n </li>\n </router-link>\n <li\n v-else\n role=\"tab\"\n :aria-selected=\"isActive || null\"\n :class=\"{ [$style['is-active']]: isActive }\"\n :data-id=\"index\"\n v-bind=\"$attrs\"\n >\n <a :class=\"[$style.link, { [$style['dropdown-link']]: isDropdown }]\" :href=\"href\">\n {{ label }}\n <ll-chip v-if=\"badge\" radius=\"pill\" shade=\"main\" size=\"small\" :class=\"$style.badge\" :color=\"badgeColor\">{{\n badge\n }}</ll-chip>\n </a>\n </li>\n </template>\n</template>\n\n<style lang=\"scss\" module>\n .link {\n border-bottom: border(medium, transparent);\n color: var(--color-ice-700);\n display: block;\n font-family: $font-family-primary;\n font-weight: typo('h3', 'weight');\n line-height: 1.75em;\n padding: space(1) 0;\n transition: color $primary-transition;\n white-space: nowrap;\n\n &:hover,\n &:focus {\n color: var(--color-blue);\n outline: 0;\n text-decoration: none;\n }\n\n .is-active & {\n color: var(--color-blue);\n\n &,\n &:hover,\n &:focus {\n background-color: transparent;\n border-bottom-color: var(--color-blue);\n }\n\n &:focus {\n color: var(--color-blue);\n }\n }\n\n &.is-disabled {\n pointer-events: none;\n color: var(--color-ice-500);\n }\n }\n\n .dropdown-link {\n border-bottom: 0;\n border-radius: $border-radius;\n font-size: typo('button', 'size');\n height: space(4);\n line-height: space(4);\n padding: 0 space(1);\n transition: none;\n\n &:hover,\n &:focus,\n &:active {\n background: var(--color-blue);\n color: var(--color-white);\n text-decoration: none;\n }\n\n .is-active &,\n .is-active &:hover,\n .is-active &:focus {\n color: var(--color-blue);\n }\n }\n\n .badge {\n margin-left: 2px;\n }\n</style>\n","<script>\n import { t } from '../../locale';\n import Dropdown from '../Dropdown/Dropdown.vue';\n import Icon from '../Icon/Icon.vue';\n import NavItem from './components/NavItem.vue';\n\n export { default as NavItem } from './components/NavItem.vue';\n\n export default {\n name: 'll-page-navigation',\n\n components: {\n 'll-dropdown': Dropdown,\n 'll-icon': Icon,\n NavItem,\n },\n\n props: {\n /**\n * Index of active tab (zero-based)\n */\n activeIndex: {\n type: Number,\n default: 0,\n },\n /**\n * Array of tabs. A `tab` is an object containing a `label` and either an `href` | `to`\n */\n items: {\n type: Array,\n default: () => [],\n },\n },\n\n data() {\n return {\n hasIntersectionObserver: 'IntersectionObserver' in window,\n observer: undefined,\n overflowIds: [],\n toggleWidth: 0,\n moreText: t('ll.pageNavigation.more'),\n };\n },\n\n watch: {\n items() {\n this.destroyObserver();\n this.observe();\n },\n },\n\n mounted() {\n this.observe();\n },\n\n activated() {\n this.observe();\n },\n\n deactivated() {\n this.destroyObserver();\n },\n\n beforeUnmount() {\n this.destroyObserver();\n },\n\n methods: {\n /**\n * Event emitted when a tab is clicked, with the target tab index.\n */\n observe() {\n if (this.hasIntersectionObserver) {\n const tabs = Array.from(this.$refs.tabList.children);\n\n const options = {\n root: this.$refs.tabList,\n rootMargin: '0px 0px 0px 0px',\n threshold: Array.from({ length: 100 }).map((v, i) => (i + 1) / 100),\n };\n\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const dataId = entry.target.getAttribute('data-id');\n\n /**\n * Check for partial intersection.\n * Zooming out can result in ratio of approx 0.984\n * Anything higher will result in nav items disappearing\n */\n if (entry.intersectionRatio > 0.96) {\n // show tab, hide in dropdown\n if (this.overflowIds.includes(dataId)) {\n this.overflowIds.splice(this.overflowIds.indexOf(dataId), 1);\n }\n } else {\n // hide tab, show in dropdown\n if (!this.overflowIds.includes(dataId)) {\n this.overflowIds.push(dataId);\n }\n }\n });\n }, options);\n\n tabs.forEach((element) => {\n this.observer.observe(element);\n });\n\n this.toggleWidth = this.$refs.toggle.$el?.getBoundingClientRect().width;\n }\n },\n\n destroyObserver() {\n if (this.observer) {\n this.observer.disconnect();\n this.observer = undefined;\n }\n },\n },\n };\n</script>\n\n<template>\n <div class=\"container\">\n <nav :class=\"[$style.tabs, { [$style['is-scrollable']]: !hasIntersectionObserver }]\">\n <ul\n ref=\"tabList\"\n :class=\"$style.list\"\n :style=\"{\n width: `calc(100% - ${toggleWidth}px)`,\n }\"\n >\n <NavItem\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"[$style.item, { [$style['is-invisible']]: overflowIds.includes(`${index}`) }]\"\n :badge=\"item.badge\"\n :badge-color=\"item.badgeColor\"\n :data-id=\"index\"\n :href=\"item.href\"\n :index=\"index\"\n :is-active=\"index === activeIndex\"\n :label=\"item.label\"\n :to=\"item.to\"\n :disabled=\"item.disabled\"\n />\n </ul>\n <ll-dropdown\n ref=\"toggle\"\n :class=\"[$style.dropdown, { [$style['is-visible']]: overflowIds.length }]\"\n :offset=\"{ x: -1 }\"\n >\n <template #toggle=\"{ toggle }\">\n <button\n aria-haspopup=\"true\"\n :class=\"[$style.link, $style['dropdown-toggle']]\"\n type=\"button\"\n aria-expanded=\"false\"\n @click=\"toggle\"\n >\n {{ moreText }}\n <ll-icon name=\"caret-down\" :class=\"$style['dropdown-icon']\" />\n </button>\n </template>\n\n <template #default>\n <ul :class=\"$style['dropdown-list']\">\n <NavItem\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"{ hidden: !overflowIds.includes(`${index}`) }\"\n :href=\"item.href\"\n :index=\"index\"\n :is-active=\"index === activeIndex\"\n :is-dropdown=\"true\"\n :label=\"item.label\"\n :to=\"item.to\"\n :disabled=\"item?.disabled ?? false\"\n />\n </ul>\n </template>\n </ll-dropdown>\n </nav>\n </div>\n</template>\n\n<style lang=\"scss\" module>\n .link {\n border-bottom: border(medium, transparent);\n color: var(--color-ice-700);\n display: block;\n font-family: $font-family-primary;\n font-weight: typo('h3', 'weight');\n line-height: 1.75em;\n padding: space(1) 0;\n transition: color $secondary-transition;\n white-space: nowrap;\n\n &:hover,\n &:focus {\n color: var(--color-blue);\n outline: 0;\n text-decoration: none;\n }\n\n .is-active & {\n color: var(--color-blue);\n\n &,\n &:hover,\n &:focus {\n background-color: transparent;\n border-bottom-color: var(--color-blue);\n }\n\n &:focus {\n color: var(--color-blue);\n }\n }\n }\n\n .tabs {\n position: relative;\n\n &.is-scrollable {\n margin-right: 0;\n max-width: 100%;\n overflow: auto;\n }\n }\n\n .list {\n display: inline-flex;\n list-style: none;\n overflow: hidden;\n padding: 0;\n position: relative;\n }\n\n .item {\n padding: 0 space(2) 0 0;\n\n @include breakpoint('md') {\n padding-right: space(3);\n }\n\n &.is-active {\n transition: none !important;\n }\n }\n\n .is-invisible {\n visibility: hidden;\n }\n\n .tabs .dropdown {\n display: inline-flex;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n visibility: hidden;\n\n &.is-visible {\n visibility: visible;\n }\n }\n\n .dropdown-list {\n @include elevation('high');\n\n background: var(--color-white);\n border: none;\n border-radius: $border-radius;\n display: block;\n list-style: none;\n margin-top: 0;\n min-width: 140px;\n padding: space(1);\n position: static;\n right: -(space(1));\n top: 100%;\n z-index: z-index(control);\n\n .is-open & {\n display: block;\n }\n\n &::before {\n @include corner;\n\n border-left: border(thin, var(--color-blue));\n border-top: border(thin, var(--color-blue));\n content: '';\n display: none;\n right: space(2);\n }\n }\n\n .dropdown-toggle {\n background: transparent;\n border: 0;\n border-bottom: border(medium, transparent);\n color: var(--color-blue);\n display: flex;\n padding-left: space(1);\n\n &:hover,\n &:focus {\n color: var(--color-blue-hover);\n }\n\n .has-active & {\n border-bottom-color: var(--color-blue);\n }\n }\n\n .dropdown-icon {\n height: icon('default', 'height');\n position: relative;\n top: 1px;\n vertical-align: bottom;\n width: icon('default', 'width');\n }\n</style>\n"],"names":["_sfc_main","Chip","value","isFunction","path","sliceIndex","parentPath","$options","_openBlock","_createElementBlock","_mergeProps","$props","_ctx","_createElementVNode","_normalizeClass","_Fragment","_createBlock","_component_router_link","route","navigate","_a","_createTextVNode","_toDisplayString","_component_ll_chip","Dropdown","Icon","NavItem","t","tabs","options","v","i","entries","entry","dataId","element","_hoisted_1","$data","_normalizeStyle","_renderList","item","index","_component_NavItem","_createVNode","_component_ll_dropdown","_withCtx","toggle","_component_ll_icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;GAKOA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,WAAWC;AAAA,EACZ;AAAA,EAED,cAAc;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,OAAO;AAAA,MACL,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACC,MAAU,CAAC,QAAQ,KAAK,EAAE,SAASA,CAAK;AAAA,IACrD;AAAA;AAAA;AAAA;AAAA,IAKD,OAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA;AAAA;AAAA;AAAA,IAID,UAAU;AAAA;AAAA;AAAA;AAAA,IAIV,YAAY;AAAA;AAAA;AAAA;AAAA,IAIZ,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA;AAAA;AAAA;AAAA,IAID,OAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA;AAAA;AAAA;AAAA;AAAA,IAKD,IAAI;AAAA,MACF,SAAS;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,IACtB;AAAA;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU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components/NavItem.vue","../src/components/PageNavigation/PageNavigation.vue"],"sourcesContent":["<script>\n import isFunction from 'lodash-es/isFunction';\n\n import Chip from '../../Chip/Chip.vue';\n\n export default {\n name: 'nav-item',\n\n components: {\n Chip,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Used to display the bubble count, i.e. orders, messages\n */\n badge: {\n type: [Number, String],\n default: 0,\n },\n\n /**\n * The background color of the badge.\n * Currently limited to a subset of brand colors.\n */\n badgeColor: {\n type: String,\n default: 'blue',\n validator: (value) => ['blue', 'red'].includes(value),\n },\n\n /**\n * Private/inherited - Item index.\n */\n index: {\n type: Number,\n required: true,\n },\n /**\n * Private/inherited - Whether the current tab `index` matches `activeIndex`\n */\n isActive: Boolean,\n /**\n * Private/inherited - Whether the item is inside the dropdown\n */\n isDropdown: Boolean,\n /**\n * Used to render an `<a>` tag. Denotes the target href of the link.\n */\n href: {\n default: '',\n type: String,\n },\n /**\n * The nav item label\n */\n label: {\n default: '',\n type: String,\n },\n /**\n * Used to render a `<router-link>`. Denotes the target route of the link.\n * See: https://router.vuejs.org/api/#router-link\n */\n to: {\n default: '',\n type: [Object, String],\n },\n /**\n * Will render a plain text item if true.\n * Accepts a function to ensure the value is up-to-date, such as when it comes from vuex\n */\n disabled: {\n default: false,\n type: [Boolean, Function],\n },\n },\n\n computed: {\n isDisabled() {\n if (isFunction(this.disabled)) {\n return this.disabled();\n }\n\n return this.disabled;\n },\n },\n\n methods: {\n /**\n * Customer Active Class matcher.\n *\n * This attempts to match the URL ignoring the path params.\n */\n hasActiveClass(path) {\n if (path === this.$route.path) {\n return true;\n } else if (this.$route.path.includes(path)) {\n const sliceIndex = (this.$route.path.length - this.$route.path.lastIndexOf('/')) * -1;\n const parentPath = this.$route.path.slice(0, sliceIndex);\n\n return path === parentPath;\n }\n },\n },\n };\n</script>\n\n<template>\n <li v-if=\"isDisabled\" aria-disabled=\"true\" :data-id=\"index\" v-bind=\"$attrs\">\n <span :class=\"[$style.link, { [$style['dropdown-link']]: isDropdown }, $style['is-disabled']]\">{{ label }}</span>\n </li>\n <template v-else>\n <router-link v-if=\"to\" v-slot=\"{ route, navigate }\" custom :to=\"to\">\n <li\n role=\"tab\"\n :data-id=\"index\"\n :class=\"[{ [$style['is-active']]: hasActiveClass(route.path) }, 'cursor-pointer']\"\n v-bind=\"$attrs\"\n @click=\"navigate\"\n >\n <a :class=\"[$style.link, { [$style['dropdown-link']]: isDropdown }]\" :href=\"to?.name || to\">\n {{ label }}\n <Chip v-if=\"badge\" radius=\"pill\" shade=\"main\" size=\"small\" :class=\"$style.badge\" :color-scheme=\"badgeColor\">\n {{ badge }}\n </Chip>\n </a>\n </li>\n </router-link>\n <li\n v-else\n role=\"tab\"\n :aria-selected=\"isActive || null\"\n :class=\"{ [$style['is-active']]: isActive }\"\n :data-id=\"index\"\n v-bind=\"$attrs\"\n >\n <a :class=\"[$style.link, { [$style['dropdown-link']]: isDropdown }]\" :href=\"href\">\n {{ label }}\n <Chip v-if=\"badge\" radius=\"pill\" shade=\"main\" size=\"small\" :class=\"$style.badge\" :color-scheme=\"badgeColor\">\n {{ badge }}\n </Chip>\n </a>\n </li>\n </template>\n</template>\n\n<style lang=\"scss\" module>\n .link {\n border-bottom: border(medium, transparent);\n color: var(--color-ice-700);\n display: block;\n font-family: $font-family-primary;\n font-weight: typo('h3', 'weight');\n line-height: 1.75em;\n padding: space(1) 0;\n transition: color $primary-transition;\n white-space: nowrap;\n\n &:hover,\n &:focus {\n color: var(--color-blue);\n outline: 0;\n text-decoration: none;\n }\n\n .is-active & {\n color: var(--color-blue);\n\n &,\n &:hover,\n &:focus {\n background-color: transparent;\n border-bottom-color: var(--color-blue);\n }\n\n &:focus {\n color: var(--color-blue);\n }\n }\n\n &.is-disabled {\n pointer-events: none;\n color: var(--color-ice-500);\n }\n }\n\n .dropdown-link {\n border-bottom: 0;\n border-radius: $border-radius;\n font-size: typo('button', 'size');\n height: space(4);\n line-height: space(4);\n padding: 0 space(1);\n transition: none;\n\n &:hover,\n &:focus,\n &:active {\n background: var(--color-blue);\n color: var(--color-white);\n text-decoration: none;\n }\n\n .is-active &,\n .is-active &:hover,\n .is-active &:focus {\n color: var(--color-blue);\n }\n }\n\n .badge {\n margin-left: 2px;\n }\n</style>\n","<script>\n import { t } from '../../locale';\n import Dropdown from '../Dropdown/Dropdown.vue';\n import Icon from '../Icon/Icon.vue';\n import NavItem from './components/NavItem.vue';\n\n export { default as NavItem } from './components/NavItem.vue';\n\n export default {\n name: 'll-page-navigation',\n\n components: {\n 'll-dropdown': Dropdown,\n 'll-icon': Icon,\n NavItem,\n },\n\n props: {\n /**\n * Index of active tab (zero-based)\n */\n activeIndex: {\n type: Number,\n default: 0,\n },\n /**\n * Array of tabs. A `tab` is an object containing a `label` and either an `href` | `to`\n */\n items: {\n type: Array,\n default: () => [],\n },\n },\n\n data() {\n return {\n hasIntersectionObserver: 'IntersectionObserver' in window,\n observer: undefined,\n overflowIds: [],\n toggleWidth: 0,\n moreText: t('ll.pageNavigation.more'),\n };\n },\n\n watch: {\n items() {\n this.destroyObserver();\n this.observe();\n },\n },\n\n mounted() {\n this.observe();\n },\n\n activated() {\n this.observe();\n },\n\n deactivated() {\n this.destroyObserver();\n },\n\n beforeUnmount() {\n this.destroyObserver();\n },\n\n methods: {\n /**\n * Event emitted when a tab is clicked, with the target tab index.\n */\n observe() {\n if (this.hasIntersectionObserver) {\n const tabs = Array.from(this.$refs.tabList.children);\n\n const options = {\n root: this.$refs.tabList,\n rootMargin: '0px 0px 0px 0px',\n threshold: Array.from({ length: 100 }).map((v, i) => (i + 1) / 100),\n };\n\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const dataId = entry.target.getAttribute('data-id');\n\n /**\n * Check for partial intersection.\n * Zooming out can result in ratio of approx 0.984\n * Anything higher will result in nav items disappearing\n */\n if (entry.intersectionRatio > 0.96) {\n // show tab, hide in dropdown\n if (this.overflowIds.includes(dataId)) {\n this.overflowIds.splice(this.overflowIds.indexOf(dataId), 1);\n }\n } else {\n // hide tab, show in dropdown\n if (!this.overflowIds.includes(dataId)) {\n this.overflowIds.push(dataId);\n }\n }\n });\n }, options);\n\n tabs.forEach((element) => {\n this.observer.observe(element);\n });\n\n this.toggleWidth = this.$refs.toggle.$el?.getBoundingClientRect().width;\n }\n },\n\n destroyObserver() {\n if (this.observer) {\n this.observer.disconnect();\n this.observer = undefined;\n }\n },\n },\n };\n</script>\n\n<template>\n <div class=\"container\">\n <nav :class=\"[$style.tabs, { [$style['is-scrollable']]: !hasIntersectionObserver }]\">\n <ul\n ref=\"tabList\"\n :class=\"$style.list\"\n :style=\"{\n width: `calc(100% - ${toggleWidth}px)`,\n }\"\n >\n <NavItem\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"[$style.item, { [$style['is-invisible']]: overflowIds.includes(`${index}`) }]\"\n :badge=\"item.badge\"\n :badge-color=\"item.badgeColor\"\n :data-id=\"index\"\n :href=\"item.href\"\n :index=\"index\"\n :is-active=\"index === activeIndex\"\n :label=\"item.label\"\n :to=\"item.to\"\n :disabled=\"item.disabled\"\n />\n </ul>\n <ll-dropdown\n ref=\"toggle\"\n :class=\"[$style.dropdown, { [$style['is-visible']]: overflowIds.length }]\"\n :offset=\"{ x: -1 }\"\n >\n <template #toggle=\"{ toggle }\">\n <button\n aria-haspopup=\"true\"\n :class=\"[$style.link, $style['dropdown-toggle']]\"\n type=\"button\"\n aria-expanded=\"false\"\n @click=\"toggle\"\n >\n {{ moreText }}\n <ll-icon name=\"caret-down\" :class=\"$style['dropdown-icon']\" />\n </button>\n </template>\n\n <template #default>\n <ul :class=\"$style['dropdown-list']\">\n <NavItem\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"{ hidden: !overflowIds.includes(`${index}`) }\"\n :href=\"item.href\"\n :index=\"index\"\n :is-active=\"index === activeIndex\"\n :is-dropdown=\"true\"\n :label=\"item.label\"\n :to=\"item.to\"\n :disabled=\"item?.disabled ?? false\"\n />\n </ul>\n </template>\n </ll-dropdown>\n </nav>\n </div>\n</template>\n\n<style lang=\"scss\" module>\n .link {\n border-bottom: border(medium, transparent);\n color: var(--color-ice-700);\n display: block;\n font-family: $font-family-primary;\n font-weight: typo('h3', 'weight');\n line-height: 1.75em;\n padding: space(1) 0;\n transition: color $secondary-transition;\n white-space: nowrap;\n\n &:hover,\n &:focus {\n color: var(--color-blue);\n outline: 0;\n text-decoration: none;\n }\n\n .is-active & {\n color: var(--color-blue);\n\n &,\n &:hover,\n &:focus {\n background-color: transparent;\n border-bottom-color: var(--color-blue);\n }\n\n &:focus {\n color: var(--color-blue);\n }\n }\n }\n\n .tabs {\n position: relative;\n\n &.is-scrollable {\n margin-right: 0;\n max-width: 100%;\n overflow: auto;\n }\n }\n\n .list {\n display: inline-flex;\n list-style: none;\n overflow: hidden;\n padding: 0;\n position: relative;\n }\n\n .item {\n padding: 0 space(2) 0 0;\n\n @include breakpoint('md') {\n padding-right: space(3);\n }\n\n &.is-active {\n transition: none !important;\n }\n }\n\n .is-invisible {\n visibility: hidden;\n }\n\n .tabs .dropdown {\n display: inline-flex;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n visibility: hidden;\n\n &.is-visible {\n visibility: visible;\n }\n }\n\n .dropdown-list {\n @include elevation('high');\n\n background: var(--color-white);\n border: none;\n border-radius: $border-radius;\n display: block;\n list-style: none;\n margin-top: 0;\n min-width: 140px;\n padding: space(1);\n position: static;\n right: -(space(1));\n top: 100%;\n z-index: z-index(control);\n\n .is-open & {\n display: block;\n }\n\n &::before {\n @include corner;\n\n border-left: border(thin, var(--color-blue));\n border-top: border(thin, var(--color-blue));\n content: '';\n display: none;\n right: space(2);\n }\n }\n\n .dropdown-toggle {\n background: transparent;\n border: 0;\n border-bottom: border(medium, transparent);\n color: var(--color-blue);\n display: flex;\n padding-left: space(1);\n\n &:hover,\n &:focus {\n color: var(--color-blue-hover);\n }\n\n .has-active & {\n border-bottom-color: var(--color-blue);\n }\n }\n\n .dropdown-icon {\n height: icon('default', 'height');\n position: relative;\n top: 1px;\n vertical-align: bottom;\n width: icon('default', 'width');\n }\n</style>\n"],"names":["_sfc_main","Chip","value","isFunction","path","sliceIndex","parentPath","$options","_openBlock","_createElementBlock","_mergeProps","$props","_ctx","_createElementVNode","_normalizeClass","_Fragment","_createBlock","_component_router_link","route","navigate","_a","_createTextVNode","_toDisplayString","_component_Chip","Dropdown","Icon","NavItem","t","tabs","options","v","i","entries","entry","dataId","element","_hoisted_1","$data","_normalizeStyle","_renderList","item","index","_component_NavItem","_createVNode","_component_ll_dropdown","_withCtx","toggle","_component_ll_icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;GAKOA,IAAU;AAAA,EACb,MAAM;AAAA,EAEN,YAAY;AAAA,IACV,MAAAC;AAAA,EACD;AAAA,EAED,cAAc;AAAA,EAEd,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,OAAO;AAAA,MACL,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACV;AAAA;AAAA;AAAA;AAAA;AAAA,IAMD,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW,CAACC,MAAU,CAAC,QAAQ,KAAK,EAAE,SAASA,CAAK;AAAA,IACrD;AAAA;AAAA;AAAA;AAAA,IAKD,OAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA;AAAA;AAAA;AAAA,IAID,UAAU;AAAA;AAAA;AAAA;AAAA,IAIV,YAAY;AAAA;AAAA;AAAA;AAAA,IAIZ,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA;AAAA;AAAA;AAAA,IAID,OAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA;AAAA;AAAA;AAAA;AAAA,IAKD,IAAI;AAAA,MACF,SAAS;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,IACtB;AAAA;AAAA;AAAA;AAAA;AAAA,IAKD,UAAU;AAA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1
|
import { defineComponent as w, useCssModule as y, computed as S, openBlock as r, createElementBlock as l, createElementVNode as c, normalizeClass as o, unref as i, createVNode as f, Fragment as g, renderList as x, createCommentVNode as p, toDisplayString as z } from "vue";
|
|
2
2
|
import m from "./Icon.js";
|
|
3
|
-
import { s as M } from "./Paginate.vue_used_vue_type_style_index_0_lang.module-
|
|
3
|
+
import { s as M } from "./Paginate.vue_used_vue_type_style_index_0_lang.module-bfccf992.js";
|
|
4
4
|
import { _ as E } from "./_plugin-vue_export-helper-dad06003.js";
|
|
5
5
|
import "lodash-es/uniqueId";
|
|
6
6
|
import "./index-79ce320f.js";
|
package/dist/Paginate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Paginate.js","sources":["../src/components/Paginate/Paginate.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, useCssModule } from 'vue';\n\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-paginate',\n });\n\n export interface PaginateProps {\n /**\n * Current page number\n */\n currentPage?: number;\n /**\n * Total number of items in list\n */\n listLength?: number;\n /**\n * Number of items per page\n */\n pageSize?: number;\n }\n\n const props = withDefaults(defineProps<PaginateProps>(), {\n currentPage: 1,\n listLength: 1,\n pageSize: 50,\n });\n\n const emit =\n defineEmits<{\n /**\n * Emitted when the page number changes.\n */\n (e: 'set-page', pageNumber: number): void;\n }>();\n\n const classes = useCssModule();\n\n const pages = computed(() => Math.ceil(props.listLength / props.pageSize));\n\n /**\n * Emits current page to list view.\n */\n function updatePage(currentPage: number) {\n emit('set-page', currentPage);\n }\n\n /**\n * Sets current page to next page\n */\n function next() {\n if (props.currentPage < pages.value) {\n updatePage(props.currentPage + 1);\n }\n }\n\n /**\n * Sets current page to previous page\n */\n function prev() {\n if (props.currentPage > 1) {\n updatePage(props.currentPage - 1);\n }\n }\n\n /**\n * Determines whether to show page\n * @returns {boolean} - should show page in pagination component\n */\n function shouldShowPage(page: number): boolean {\n const pageDiff = Math.abs(props.currentPage - page);\n\n if (\n pages.value < 10 ||\n page === 1 ||\n page === pages.value ||\n (props.currentPage < 6 && page < 8) ||\n (pages.value - props.currentPage < 5 && pages.value - page < 7) ||\n pageDiff < 3\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Determines whether to show the leading ellipsis\n * @returns {boolean} should show or not\n */\n function shouldShowFirstEllipsis(page: number): boolean {\n return pages.value > 9 && props.currentPage > 5 && page === 2;\n }\n\n /**\n * Determines whether to show the trailing ellipsis\n * @returns {boolean} should show or not\n */\n function shouldShowLastEllipsis(page: number): boolean {\n return pages.value > 9 && pages.value - props.currentPage > 4 && page === pages.value - 1;\n }\n</script>\n\n<template>\n <div class=\"stash-paginate tw-flex tw-justify-center\" data-test=\"stash-paginate\">\n <ul class=\"stash-paginate__list tw-flex\" :class=\"classes.pagination\" data-test=\"stash-paginate|list\">\n <button\n data-test=\"stash-paginate|prev-page\"\n :class=\"[classes.prev, { [classes['is-disabled']]: currentPage === 1 }]\"\n @click=\"prev\"\n >\n <Icon size=\"small\" name=\"chevron-left\" />\n </button>\n <template v-for=\"page in pages\">\n <button\n v-if=\"shouldShowFirstEllipsis(page)\"\n :key=\"`${page}-ellipsis`\"\n data-test=\"stash-paginate|first-ellipsis\"\n >\n …\n </button>\n <button\n v-if=\"shouldShowPage(page)\"\n :key=\"page\"\n data-test=\"stash-paginate|page-number\"\n :class=\"{ [classes['is-active']]: currentPage === page }\"\n @click=\"updatePage(page)\"\n >\n {{ page }}\n </button>\n <button v-if=\"shouldShowLastEllipsis(page)\" :key=\"`${page}-ellipsis`\" data-test=\"stash-paginate|last-ellipsis\">\n …\n </button>\n </template>\n <button\n data-test=\"stash-paginate|next-page\"\n :class=\"[classes.next, { [classes['is-disabled']]: currentPage === pages }]\"\n @click=\"next\"\n >\n <Icon size=\"small\" class=\"tw-rotate-180\" name=\"chevron-left\" />\n </button>\n </ul>\n </div>\n</template>\n\n<style module>\n .pagination {\n /* Todo: We shouldn't really be making assumptions about the outer spacing of the pagination component */\n margin-top: theme(spacing.12);\n z-index: 0;\n\n a,\n button {\n @apply tw-border tw-border-solid tw-border-ice-200;\n align-items: center;\n background-color: theme(colors.white);\n color: theme(colors.blue.
|
|
1
|
+
{"version":3,"file":"Paginate.js","sources":["../src/components/Paginate/Paginate.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, useCssModule } from 'vue';\n\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-paginate',\n });\n\n export interface PaginateProps {\n /**\n * Current page number\n */\n currentPage?: number;\n /**\n * Total number of items in list\n */\n listLength?: number;\n /**\n * Number of items per page\n */\n pageSize?: number;\n }\n\n const props = withDefaults(defineProps<PaginateProps>(), {\n currentPage: 1,\n listLength: 1,\n pageSize: 50,\n });\n\n const emit =\n defineEmits<{\n /**\n * Emitted when the page number changes.\n */\n (e: 'set-page', pageNumber: number): void;\n }>();\n\n const classes = useCssModule();\n\n const pages = computed(() => Math.ceil(props.listLength / props.pageSize));\n\n /**\n * Emits current page to list view.\n */\n function updatePage(currentPage: number) {\n emit('set-page', currentPage);\n }\n\n /**\n * Sets current page to next page\n */\n function next() {\n if (props.currentPage < pages.value) {\n updatePage(props.currentPage + 1);\n }\n }\n\n /**\n * Sets current page to previous page\n */\n function prev() {\n if (props.currentPage > 1) {\n updatePage(props.currentPage - 1);\n }\n }\n\n /**\n * Determines whether to show page\n * @returns {boolean} - should show page in pagination component\n */\n function shouldShowPage(page: number): boolean {\n const pageDiff = Math.abs(props.currentPage - page);\n\n if (\n pages.value < 10 ||\n page === 1 ||\n page === pages.value ||\n (props.currentPage < 6 && page < 8) ||\n (pages.value - props.currentPage < 5 && pages.value - page < 7) ||\n pageDiff < 3\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Determines whether to show the leading ellipsis\n * @returns {boolean} should show or not\n */\n function shouldShowFirstEllipsis(page: number): boolean {\n return pages.value > 9 && props.currentPage > 5 && page === 2;\n }\n\n /**\n * Determines whether to show the trailing ellipsis\n * @returns {boolean} should show or not\n */\n function shouldShowLastEllipsis(page: number): boolean {\n return pages.value > 9 && pages.value - props.currentPage > 4 && page === pages.value - 1;\n }\n</script>\n\n<template>\n <div class=\"stash-paginate tw-flex tw-justify-center\" data-test=\"stash-paginate\">\n <ul class=\"stash-paginate__list tw-flex\" :class=\"classes.pagination\" data-test=\"stash-paginate|list\">\n <button\n data-test=\"stash-paginate|prev-page\"\n :class=\"[classes.prev, { [classes['is-disabled']]: currentPage === 1 }]\"\n @click=\"prev\"\n >\n <Icon size=\"small\" name=\"chevron-left\" />\n </button>\n <template v-for=\"page in pages\">\n <button\n v-if=\"shouldShowFirstEllipsis(page)\"\n :key=\"`${page}-ellipsis`\"\n data-test=\"stash-paginate|first-ellipsis\"\n >\n …\n </button>\n <button\n v-if=\"shouldShowPage(page)\"\n :key=\"page\"\n data-test=\"stash-paginate|page-number\"\n :class=\"{ [classes['is-active']]: currentPage === page }\"\n @click=\"updatePage(page)\"\n >\n {{ page }}\n </button>\n <button v-if=\"shouldShowLastEllipsis(page)\" :key=\"`${page}-ellipsis`\" data-test=\"stash-paginate|last-ellipsis\">\n …\n </button>\n </template>\n <button\n data-test=\"stash-paginate|next-page\"\n :class=\"[classes.next, { [classes['is-disabled']]: currentPage === pages }]\"\n @click=\"next\"\n >\n <Icon size=\"small\" class=\"tw-rotate-180\" name=\"chevron-left\" />\n </button>\n </ul>\n </div>\n</template>\n\n<style module>\n .pagination {\n /* Todo: We shouldn't really be making assumptions about the outer spacing of the pagination component */\n margin-top: theme(spacing.12);\n z-index: 0;\n\n a,\n button {\n @apply tw-border tw-border-solid tw-border-ice-200;\n align-items: center;\n background-color: theme(colors.white);\n color: theme('colors.blue.500');\n cursor: pointer;\n display: flex;\n height: theme(height.input);\n justify-content: center;\n margin: 0 0 0 -1px;\n width: theme(height.input);\n\n &.prev {\n border-bottom-left-radius: theme(borderRadius.DEFAULT);\n border-top-left-radius: theme(borderRadius.DEFAULT);\n }\n\n &.next {\n border-bottom-right-radius: theme(borderRadius.DEFAULT);\n border-top-right-radius: theme(borderRadius.DEFAULT);\n }\n\n &:focus {\n outline: none;\n }\n\n &:hover {\n text-decoration: none;\n }\n\n &.is-active {\n background-color: theme('colors.blue.500');\n color: theme(colors.white);\n pointer-events: none;\n z-index: theme(zIndex.control);\n }\n\n &:hover,\n &.is-active {\n @apply tw-border tw-border-solid tw-border-blue-500;\n position: relative;\n }\n\n &.is-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n }\n }\n</style>\n"],"names":["classes","useCssModule","pages","computed","props","updatePage","currentPage","emit","next","prev","shouldShowPage","page","pageDiff","shouldShowFirstEllipsis","shouldShowLastEllipsis"],"mappings":";;;;;;;;;;;;;;;;;;;;iBAsCQA,IAAUC,KAEVC,IAAQC,EAAS,MAAM,KAAK,KAAKC,EAAM,aAAaA,EAAM,QAAQ,CAAC;AAKzE,aAASC,EAAWC,GAAqB;AACvC,MAAAC,EAAK,YAAYD,CAAW;AAAA,IAC9B;AAKA,aAASE,IAAO;AACV,MAAAJ,EAAM,cAAcF,EAAM,SACjBG,EAAAD,EAAM,cAAc,CAAC;AAAA,IAEpC;AAKA,aAASK,IAAO;AACV,MAAAL,EAAM,cAAc,KACXC,EAAAD,EAAM,cAAc,CAAC;AAAA,IAEpC;AAMA,aAASM,EAAeC,GAAuB;AAC7C,YAAMC,IAAW,KAAK,IAAIR,EAAM,cAAcO,CAAI;AAGhD,aAAAT,EAAM,QAAQ,MACdS,MAAS,KACTA,MAAST,EAAM,SACdE,EAAM,cAAc,KAAKO,IAAO,KAChCT,EAAM,QAAQE,EAAM,cAAc,KAAKF,EAAM,QAAQS,IAAO,KAC7DC,IAAW;AAAA,IAMf;AAMA,aAASC,EAAwBF,GAAuB;AACtD,aAAOT,EAAM,QAAQ,KAAKE,EAAM,cAAc,KAAKO,MAAS;AAAA,IAC9D;AAMA,aAASG,EAAuBH,GAAuB;AAC9C,aAAAT,EAAM,QAAQ,KAAKA,EAAM,QAAQE,EAAM,cAAc,KAAKO,MAAST,EAAM,QAAQ;AAAA,IAC1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|