@leaflink/stash 52.0.3 → 53.1.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 +51 -52
- package/dist/Accordion.js +16 -16
- package/dist/Accordion.js.map +1 -1
- package/dist/AccordionGroup.js +7 -7
- package/dist/AccordionGroup.js.map +1 -1
- package/dist/ActionsDropdown.js +16 -16
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/AddressSelect.js.map +1 -1
- package/dist/AddressSelect.vue.d.ts +1 -1
- package/dist/Alert.js +34 -34
- package/dist/Alert.js.map +1 -1
- package/dist/AppNavigationItem.js +31 -31
- package/dist/AppNavigationItem.js.map +1 -1
- package/dist/AppSidebar.js +19 -19
- package/dist/AppSidebar.js.map +1 -1
- package/dist/AppTopbar.js +32 -32
- package/dist/AppTopbar.js.map +1 -1
- package/dist/Avatar.js +18 -18
- package/dist/Avatar.js.map +1 -1
- package/dist/Backdrop.js +5 -5
- package/dist/Backdrop.js.map +1 -1
- package/dist/Badge.js +38 -38
- package/dist/Badge.js.map +1 -1
- package/dist/Box.js +1 -1
- package/dist/{Box.vue_vue_type_script_setup_true_lang-rFnvwLVY.js → Box.vue_vue_type_script_setup_true_lang-dFFZN40_.js} +6 -6
- package/dist/{Box.vue_vue_type_script_setup_true_lang-rFnvwLVY.js.map → Box.vue_vue_type_script_setup_true_lang-dFFZN40_.js.map} +1 -1
- package/dist/Button.js +21 -21
- package/dist/Button.js.map +1 -1
- package/dist/ButtonGroup.js +26 -26
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/Card.js +14 -14
- package/dist/Card.js.map +1 -1
- package/dist/CardContent.js +1 -1
- package/dist/CardContent.js.map +1 -1
- package/dist/CardFooter.js +1 -1
- package/dist/CardFooter.js.map +1 -1
- package/dist/CardHeader.js +4 -4
- package/dist/CardHeader.js.map +1 -1
- package/dist/CardMedia.js +20 -20
- package/dist/CardMedia.js.map +1 -1
- package/dist/Carousel.js +60 -60
- package/dist/Carousel.js.map +1 -1
- package/dist/Checkbox.js +30 -30
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox.vue.d.ts +0 -3
- package/dist/Chip.js +33 -33
- package/dist/Chip.js.map +1 -1
- package/dist/ConfirmationCodeInput.js +72 -72
- package/dist/ConfirmationCodeInput.js.map +1 -1
- package/dist/ContextSwitcher.js +27 -27
- package/dist/ContextSwitcher.js.map +1 -1
- package/dist/Copy.js +47 -48
- package/dist/Copy.js.map +1 -1
- package/dist/CurrencyInput.js +1 -1
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/CurrencyInput.vue.d.ts +5 -5
- package/dist/DataView.js +23 -23
- package/dist/DataView.js.map +1 -1
- package/dist/DataViewFilters.js +26 -26
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/DataViewSortButton.js +22 -22
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewToolbar.js +52 -52
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DatePicker.js +10 -10
- package/dist/DatePicker.js.map +1 -1
- package/dist/DescriptionList.js +2 -2
- package/dist/DescriptionList.js.map +1 -1
- package/dist/DescriptionListDetail.js +2 -2
- package/dist/DescriptionListDetail.js.map +1 -1
- package/dist/DescriptionListGroup.js +9 -9
- package/dist/DescriptionListGroup.js.map +1 -1
- package/dist/DescriptionListTerm.js +8 -8
- package/dist/DescriptionListTerm.js.map +1 -1
- package/dist/Dialog.js +47 -47
- package/dist/Dialog.js.map +1 -1
- package/dist/Divider.js +6 -6
- package/dist/Divider.js.map +1 -1
- package/dist/Dropdown.js +20 -20
- package/dist/Dropdown.js.map +1 -1
- package/dist/EmptyState.js +26 -26
- package/dist/EmptyState.js.map +1 -1
- package/dist/Field.js +1 -1
- package/dist/{Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js → Field.vue_vue_type_script_setup_true_lang-dAGKfjf5.js} +17 -17
- package/dist/Field.vue_vue_type_script_setup_true_lang-dAGKfjf5.js.map +1 -0
- package/dist/FileUpload.js +47 -49
- package/dist/FileUpload.js.map +1 -1
- package/dist/FilterChip.js +20 -20
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterDrawerItem.js +13 -13
- package/dist/FilterDrawerItem.js.map +1 -1
- package/dist/FilterDropdown.js +27 -27
- package/dist/FilterDropdown.js.map +1 -1
- package/dist/FilterSelect.js +33 -33
- package/dist/FilterSelect.js.map +1 -1
- package/dist/Filters.js +29 -29
- package/dist/Filters.js.map +1 -1
- package/dist/Filters.vue.d.ts +2 -8
- package/dist/HttpError.js +29 -29
- package/dist/HttpError.js.map +1 -1
- package/dist/HttpError.vue.d.ts +0 -3
- package/dist/Icon.js +12 -12
- package/dist/Icon.js.map +1 -1
- package/dist/IconLabel.js +19 -19
- package/dist/IconLabel.js.map +1 -1
- package/dist/IconLabel.vue.d.ts +1 -1
- package/dist/Illustration.js +2 -2
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js → Illustration.vue_vue_type_script_setup_true_lang-C1bPkWZZ.js} +4 -4
- package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js.map → Illustration.vue_vue_type_script_setup_true_lang-C1bPkWZZ.js.map} +1 -1
- package/dist/Image.js +2 -2
- package/dist/Image.vue.d.ts +0 -3
- package/dist/{Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js → Image.vue_vue_type_script_setup_true_lang-CAj0FH9h.js} +11 -11
- package/dist/Image.vue_vue_type_script_setup_true_lang-CAj0FH9h.js.map +1 -0
- package/dist/InlineEdit.js +8 -8
- package/dist/InlineEdit.js.map +1 -1
- package/dist/Input.js +29 -29
- package/dist/Input.js.map +1 -1
- package/dist/InputOptions.js +87 -84
- package/dist/InputOptions.js.map +1 -1
- package/dist/InputOptions.vue.d.ts +2 -2
- package/dist/IntegrationIcon.js +11 -11
- package/dist/IntegrationIcon.js.map +1 -1
- package/dist/Label.js +1 -1
- package/dist/{Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js → Label.vue_vue_type_script_setup_true_lang-xwY3X-iV.js} +16 -16
- package/dist/{Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js.map → Label.vue_vue_type_script_setup_true_lang-xwY3X-iV.js.map} +1 -1
- package/dist/ListItem.js +14 -14
- package/dist/ListItem.js.map +1 -1
- package/dist/ListItem.vue.d.ts +0 -6
- package/dist/ListItemCell.js +9 -9
- package/dist/ListItemCell.js.map +1 -1
- package/dist/ListView.js +138 -141
- package/dist/ListView.js.map +1 -1
- package/dist/ListView.vue.d.ts +6 -40
- package/dist/Loading.js +8 -8
- package/dist/Loading.js.map +1 -1
- package/dist/Logo.js +1 -1
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js → Logo.vue_vue_type_script_setup_true_lang-DghNC_k6.js} +3 -3
- package/dist/{Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js.map → Logo.vue_vue_type_script_setup_true_lang-DghNC_k6.js.map} +1 -1
- package/dist/Menu.js +5 -5
- package/dist/Menu.js.map +1 -1
- package/dist/MenuItem.js +12 -12
- package/dist/MenuItem.js.map +1 -1
- package/dist/Metric.js +24 -24
- package/dist/Metric.js.map +1 -1
- package/dist/Modal.js +60 -60
- package/dist/Modal.js.map +1 -1
- package/dist/Modals.js +1 -1
- package/dist/Modals.js.map +1 -1
- package/dist/Module.js +6 -6
- package/dist/Module.js.map +1 -1
- package/dist/ModuleContent.js +16 -16
- package/dist/ModuleContent.js.map +1 -1
- package/dist/ModuleFooter.js +13 -13
- package/dist/ModuleFooter.js.map +1 -1
- package/dist/ModuleHeader.js +29 -29
- package/dist/ModuleHeader.js.map +1 -1
- package/dist/MoreActions.js +81 -84
- package/dist/MoreActions.js.map +1 -1
- package/dist/ObfuscateText.js +4 -4
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/PageContent.js +13 -13
- package/dist/PageContent.js.map +1 -1
- package/dist/PageHeader.js +28 -28
- package/dist/PageHeader.js.map +1 -1
- package/dist/PageNavigation.js +1 -1
- package/dist/Paginate.js +45 -45
- package/dist/Paginate.js.map +1 -1
- package/dist/QuickAction.js +18 -18
- package/dist/QuickAction.js.map +1 -1
- package/dist/Radio.js +17 -17
- package/dist/Radio.js.map +1 -1
- package/dist/RadioGroup.js +121 -121
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RadioNew.js +80 -80
- package/dist/RadioNew.js.map +1 -1
- package/dist/RadioNew.vue.d.ts +0 -3
- package/dist/RangeInput.js +2 -2
- package/dist/RangeInput.js.map +1 -1
- package/dist/SearchBar.js +9 -9
- package/dist/SearchBar.js.map +1 -1
- package/dist/SectionHeader.js +14 -14
- package/dist/SectionHeader.js.map +1 -1
- package/dist/Select.js +369 -366
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +26 -26
- package/dist/SelectStatus.js.map +1 -1
- package/dist/Skeleton.js +20 -20
- package/dist/Skeleton.js.map +1 -1
- package/dist/Step.js +37 -40
- package/dist/Step.js.map +1 -1
- package/dist/Stepper.js +17 -17
- package/dist/Stepper.js.map +1 -1
- package/dist/Switch.js +57 -57
- package/dist/Switch.js.map +1 -1
- package/dist/Tab.js +17 -19
- package/dist/Tab.js.map +1 -1
- package/dist/TabPanel.js +1 -1
- package/dist/TabPanel.js.map +1 -1
- package/dist/Table.js +22 -22
- package/dist/Table.js.map +1 -1
- package/dist/TableCell.js +32 -32
- package/dist/TableCell.js.map +1 -1
- package/dist/TableHeaderCell.js +35 -35
- package/dist/TableHeaderCell.js.map +1 -1
- package/dist/TableHeaderRow.js +10 -10
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableRow.js +51 -51
- package/dist/TableRow.js.map +1 -1
- package/dist/Tabs.js +2 -2
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-B3Irnlcd.js → Tabs.vue_vue_type_script_setup_true_lang-BVTCcK6M.js} +33 -33
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-BVTCcK6M.js.map +1 -0
- package/dist/TextEditor.js +8 -8
- package/dist/TextEditor.js.map +1 -1
- package/dist/Textarea.js +15 -15
- package/dist/Textarea.js.map +1 -1
- package/dist/Thumbnail.js +41 -41
- package/dist/Thumbnail.js.map +1 -1
- package/dist/ThumbnailEmpty.js +3 -3
- package/dist/ThumbnailEmpty.js.map +1 -1
- package/dist/ThumbnailGroup.js +22 -22
- package/dist/ThumbnailGroup.js.map +1 -1
- package/dist/Timeline.js +6 -6
- package/dist/Timeline.js.map +1 -1
- package/dist/Timeline.vue.d.ts +2 -2
- package/dist/TimelineItem.js +22 -22
- package/dist/TimelineItem.js.map +1 -1
- package/dist/Toast.js +29 -29
- package/dist/Toast.js.map +1 -1
- package/dist/Toast.vue.d.ts +3 -0
- package/dist/Toasts.js +11 -11
- package/dist/Toasts.js.map +1 -1
- package/dist/Tooltip.js +2 -81
- package/dist/Tooltip.js.map +1 -1
- package/dist/Tooltip.vue.d.ts +1 -1
- package/dist/Tooltip.vue_vue_type_script_setup_true_lang-mzBLSXy3.js +84 -0
- package/dist/Tooltip.vue_vue_type_script_setup_true_lang-mzBLSXy3.js.map +1 -0
- package/dist/components.css +2 -2
- package/dist/constants.d.ts +9 -9
- package/dist/constants.js +17 -17
- package/dist/constants.js.map +1 -1
- package/dist/directives/tooltip.js +2 -2
- package/dist/directives/tooltip.js.map +1 -1
- package/dist/floating-ui.vue-CuGrC-z8.js.map +1 -1
- package/dist/formatDateTime-Dz8bXV0R.js.map +1 -1
- package/dist/index-D6bxWkZ1.js.map +1 -1
- package/dist/{index-C14LhAwV.js → index-DBV9Uz0C.js} +3 -3
- package/dist/index-DBV9Uz0C.js.map +1 -0
- package/dist/index.js.map +1 -1
- package/dist/isValid-DN-HkCoi.js.map +1 -1
- package/dist/parseISO-wlfIB_QJ.js.map +1 -1
- package/dist/searchFuzzy-B3TsUO-V.js.map +1 -1
- package/dist/tailwind-base.js +4 -4
- package/dist/tailwind-base.js.d.ts +12 -0
- package/dist/tailwind-base.js.map +1 -1
- package/dist/toTimeZone-Coq1oPTt.js.map +1 -1
- package/dist/useGoogleMaps.js.map +1 -1
- package/dist/useSortable.js +1 -1
- package/dist/useValidation.js.map +1 -1
- package/dist/utils/helpers.js +15 -15
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +12 -82
- package/styles/backwards-compat.css +375 -2854
- package/styles/main.css +8 -0
- package/styles/sofia-font.css +23 -27
- package/styles/theme.css +1033 -0
- package/LICENSE +0 -21
- package/dist/Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js.map +0 -1
- package/dist/Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js.map +0 -1
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3Irnlcd.js.map +0 -1
- package/dist/index-C14LhAwV.js.map +0 -1
- package/dist/tailwind-base.d.ts +0 -333
- package/styles/base.css +0 -902
- package/tailwind-base.ts +0 -455
package/dist/Chip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.js","sources":["../src/components/Chip/Chip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n import { StashCommonColor, StashPrimaryColorGroup } from '../../../types/colors';\n import colorSchemeUtil from '../../utils/colorScheme';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-chip',\n });\n\n export interface ChipProps {\n /**\n * The color for the chip that determines both the text and bg color. Needs to\n * be one of the brand colors in our design system (not a shade).\n */\n colorScheme?: StashPrimaryColorGroup;\n\n /**\n * The shade of the provided color to use for the background color. This effects the inferred\n * text color unless a specific text color is provided. Currently only `light` and `main`\n * shades are supported. `dark` may be added in the future.\n */\n shade?: 'light' | 'main';\n\n /**\n * The size of the chip.\n */\n size?: 'small' | 'medium';\n\n /**\n * The type of border radius to use.\n */\n radius?: 'none' | 'standard' | 'pill';\n\n /**\n * The background color of the chip. Needs to be one of our design system colors.\n */\n bgColor?: StashCommonColor;\n\n /**\n * The color of the chip text. Needs to be one of our design system colors.\n */\n textColor?: StashCommonColor;\n\n /**\n * Determines if a close icon is surfaced.\n */\n isRemovable?: boolean;\n\n /**\n * Determines if background and text color in Chip should be overidden.\n */\n shouldOverrideColors?: boolean;\n\n /**\n * Determines if the chip is disabled.\n */\n disabled?: boolean;\n }\n\n const props = withDefaults(defineProps<ChipProps>(), {\n size: 'medium',\n radius: 'standard',\n colorScheme: 'ice',\n shade: 'light',\n bgColor: undefined,\n textColor: undefined,\n isRemovable: false,\n shouldOverrideColors: false,\n disabled: false,\n });\n\n const emit = defineEmits<{\n /**\n * Fires on click of the chip.\n */\n (e: 'click'): void;\n /**\n * If `is-removable` is true, fires on click of the close button.\n */\n (e: 'remove'): void;\n }>();\n\n const classes = useCssModule();\n\n function determineConditionalStyles() {\n const { computedBgColor, computedTextColor } = colorSchemeUtil({\n shade: props.shade,\n color: props.colorScheme,\n });\n\n const colorStyles = `
|
|
1
|
+
{"version":3,"file":"Chip.js","sources":["../src/components/Chip/Chip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n import { StashCommonColor, StashPrimaryColorGroup } from '../../../types/colors';\n import colorSchemeUtil from '../../utils/colorScheme';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-chip',\n });\n\n export interface ChipProps {\n /**\n * The color for the chip that determines both the text and bg color. Needs to\n * be one of the brand colors in our design system (not a shade).\n */\n colorScheme?: StashPrimaryColorGroup;\n\n /**\n * The shade of the provided color to use for the background color. This effects the inferred\n * text color unless a specific text color is provided. Currently only `light` and `main`\n * shades are supported. `dark` may be added in the future.\n */\n shade?: 'light' | 'main';\n\n /**\n * The size of the chip.\n */\n size?: 'small' | 'medium';\n\n /**\n * The type of border radius to use.\n */\n radius?: 'none' | 'standard' | 'pill';\n\n /**\n * The background color of the chip. Needs to be one of our design system colors.\n */\n bgColor?: StashCommonColor;\n\n /**\n * The color of the chip text. Needs to be one of our design system colors.\n */\n textColor?: StashCommonColor;\n\n /**\n * Determines if a close icon is surfaced.\n */\n isRemovable?: boolean;\n\n /**\n * Determines if background and text color in Chip should be overidden.\n */\n shouldOverrideColors?: boolean;\n\n /**\n * Determines if the chip is disabled.\n */\n disabled?: boolean;\n }\n\n const props = withDefaults(defineProps<ChipProps>(), {\n size: 'medium',\n radius: 'standard',\n colorScheme: 'ice',\n shade: 'light',\n bgColor: undefined,\n textColor: undefined,\n isRemovable: false,\n shouldOverrideColors: false,\n disabled: false,\n });\n\n const emit = defineEmits<{\n /**\n * Fires on click of the chip.\n */\n (e: 'click'): void;\n /**\n * If `is-removable` is true, fires on click of the close button.\n */\n (e: 'remove'): void;\n }>();\n\n const classes = useCssModule();\n\n function determineConditionalStyles() {\n const { computedBgColor, computedTextColor } = colorSchemeUtil({\n shade: props.shade,\n color: props.colorScheme,\n });\n\n const colorStyles = `text-${props.textColor || computedTextColor} bg-${props.bgColor || computedBgColor}`;\n\n return {\n 'rounded-none': props.radius === 'none',\n 'rounded-xs': props.radius === 'standard',\n 'rounded-full': props.radius === 'pill',\n [colorStyles]: !props.shouldOverrideColors && !props.disabled,\n 'bg-ice-500 text-white': props.disabled,\n };\n }\n</script>\n\n<template>\n <span\n class=\"stash-chip relative inline-flex items-center\"\n :class=\"[\n `stash-chip--radius-${props.radius}`,\n `stash-chip--size-${props.size}`,\n `stash-chip--shade-${props.shade}`,\n classes.root,\n classes.removableChip,\n classes[`size-${props.size}`],\n determineConditionalStyles(),\n ]\"\n data-test=\"stash-chip\"\n @click=\"emit('click')\"\n >\n <span v-if=\"isRemovable\" :class=\"[{ 'mr-6 truncate': props.isRemovable }]\">\n <!-- @slot Chip text -->\n <slot></slot>\n </span>\n\n <!-- Allows easier testing and DOM quering when the chip text isn't nested in an inner span -->\n <!-- @slot Chip text -->\n <slot v-else></slot>\n\n <button\n v-if=\"props.isRemovable\"\n tabindex=\"-1\"\n class=\"stash-chip__remove-button\"\n :class=\"['absolute', classes['remove-button']]\"\n data-test=\"stash-chip|remove-button\"\n :disabled=\"props.disabled\"\n @keypress.enter.prevent=\"emit('remove')\"\n @mousedown.prevent.stop=\"emit('remove')\"\n >\n <Icon data-test=\"icon|close\" name=\"close\" size=\"small\" />\n </button>\n </span>\n</template>\n\n<style module>\n @reference \"../../../styles/main.css\";\n\n @layer utilities {\n .root {\n /**\n * Applying these styles this way because the rule of thumb is that tailwind classes should\n * always end up taking precedence, so we're converted these specific styles to be generated\n * in a custom class instead, giving `FilterChip` (which wraps `Chip`) the ability to easily\n * override them.\n */\n @apply leading-none font-semibold uppercase text-[10px];\n }\n\n .size-medium {\n height: 20px;\n padding: 2px 8px 0 8px;\n }\n\n .size-small {\n height: 16px;\n padding: 2px 8px 0 8px;\n }\n\n .remove-button {\n border-radius: inherit;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n height: inherit;\n margin-top: -2px; /* used to offset 2px top padding from .size-medium and size-small */\n padding: 0 4px;\n right: 0;\n }\n\n .remove-button:not(:disabled):hover {\n background: rgb(0 0 0 / 10%);\n }\n }\n</style>\n"],"names":["props","__props","emit","__emit","classes","useCssModule","determineConditionalStyles","computedBgColor","computedTextColor","colorSchemeUtil","colorStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6DE,UAAMA,IAAQC,GAYRC,IAAOC,GAWPC,IAAUC,EAAA;AAEhB,aAASC,IAA6B;AACpC,YAAM,EAAE,iBAAAC,GAAiB,mBAAAC,EAAA,IAAsBC,EAAgB;AAAA,QAC7D,OAAOT,EAAM;AAAA,QACb,OAAOA,EAAM;AAAA,MAAA,CACd,GAEKU,IAAc,QAAQV,EAAM,aAAaQ,CAAiB,OAAOR,EAAM,WAAWO,CAAe;AAEvG,aAAO;AAAA,QACL,gBAAgBP,EAAM,WAAW;AAAA,QACjC,cAAcA,EAAM,WAAW;AAAA,QAC/B,gBAAgBA,EAAM,WAAW;AAAA,QACjC,CAACU,CAAW,GAAG,CAACV,EAAM,wBAAwB,CAACA,EAAM;AAAA,QACrD,yBAAyBA,EAAM;AAAA,MAAA;AAAA,IAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as I, useCssVars as v, useCssModule as E, ref as V, onMounted as B, watch as P, createElementBlock as a, openBlock as r, normalizeClass as
|
|
2
|
-
import { _ as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as I, useCssVars as v, useCssModule as E, ref as V, onMounted as B, watch as P, createElementBlock as a, openBlock as r, normalizeClass as g, unref as l, createElementVNode as A, createCommentVNode as p, Fragment as M, renderList as F, toDisplayString as f } from "vue";
|
|
2
|
+
import { _ as K } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
3
|
+
const S = { class: "mb-3 flex gap-6" }, U = ["value", "onInput"], j = {
|
|
4
4
|
key: 0,
|
|
5
|
-
class: "
|
|
5
|
+
class: "mt-1 block whitespace-pre-line pr-6 text-center text-red-500",
|
|
6
6
|
"data-test": "field-error"
|
|
7
|
-
},
|
|
7
|
+
}, L = {
|
|
8
8
|
key: 1,
|
|
9
|
-
class: "
|
|
9
|
+
class: "mt-1 block whitespace-pre-line pr-6 text-center text-green-500",
|
|
10
10
|
"data-test": "field-success"
|
|
11
|
-
},
|
|
11
|
+
}, z = {
|
|
12
12
|
key: 2,
|
|
13
|
-
class: "
|
|
13
|
+
class: "mt-1 block whitespace-pre-line pr-6 text-center text-ice-700",
|
|
14
14
|
"data-test": "field-hint"
|
|
15
15
|
}, R = /* @__PURE__ */ I({
|
|
16
16
|
__name: "ConfirmationCodeInput",
|
|
@@ -22,96 +22,96 @@ const K = { class: "tw-mb-3 tw-flex tw-gap-6" }, S = ["value", "onInput"], U = {
|
|
|
22
22
|
modelValue: { default: void 0 }
|
|
23
23
|
},
|
|
24
24
|
emits: ["update:model-value", "change", "focus", "blur"],
|
|
25
|
-
setup(
|
|
26
|
-
v((
|
|
27
|
-
|
|
25
|
+
setup(b, { emit: k }) {
|
|
26
|
+
v((e) => ({
|
|
27
|
+
"18a4a680": e.digitCount
|
|
28
28
|
}));
|
|
29
|
-
const c = E(), o =
|
|
29
|
+
const c = E(), o = b, i = k, s = V([]);
|
|
30
30
|
B(() => {
|
|
31
|
-
var
|
|
32
|
-
o.modelValue && (s.value = (
|
|
31
|
+
var e;
|
|
32
|
+
o.modelValue && (s.value = (e = o.modelValue) == null ? void 0 : e.split(""));
|
|
33
33
|
});
|
|
34
|
-
function
|
|
34
|
+
function T(e, t) {
|
|
35
35
|
var n;
|
|
36
|
-
s.value[
|
|
36
|
+
s.value[t] = (n = e.target) == null ? void 0 : n.value, m(e), e.inputType === "deleteContentBackward" ? d(e) : (e.inputType === "insertText" || e.inputType === "deleteContentForward") && h(e);
|
|
37
37
|
}
|
|
38
|
-
function m(
|
|
39
|
-
const
|
|
40
|
-
i("update:model-value",
|
|
38
|
+
function m(e) {
|
|
39
|
+
const t = s.value.join("");
|
|
40
|
+
i("update:model-value", t), i("change", { originalEvent: e, value: t });
|
|
41
41
|
}
|
|
42
|
-
function d(
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
function d(e) {
|
|
43
|
+
const t = _(e.target);
|
|
44
|
+
t && (t.focus(), t.select());
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
|
|
46
|
+
function h(e) {
|
|
47
|
+
const t = x(e.target);
|
|
48
|
+
t && (t.focus(), t.select());
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
return
|
|
50
|
+
function _(e) {
|
|
51
|
+
const t = e.previousElementSibling;
|
|
52
|
+
if (t)
|
|
53
|
+
return t.nodeName === "INPUT" ? t : _(t);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
55
|
+
function x(e) {
|
|
56
|
+
const t = e.nextElementSibling;
|
|
57
|
+
if (t)
|
|
58
|
+
return t.nodeName === "INPUT" ? t : x(t);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
60
|
+
function y(e) {
|
|
61
|
+
e.target.select(), i("focus", e);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
i("blur",
|
|
63
|
+
function C(e) {
|
|
64
|
+
i("blur", e);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
var
|
|
68
|
-
if (!(
|
|
69
|
-
switch (
|
|
66
|
+
function w(e) {
|
|
67
|
+
var t;
|
|
68
|
+
if (!(e.ctrlKey || e.metaKey))
|
|
69
|
+
switch (e.code) {
|
|
70
70
|
case "ArrowLeft":
|
|
71
|
-
d(
|
|
71
|
+
d(e), e.preventDefault();
|
|
72
72
|
break;
|
|
73
73
|
case "ArrowUp":
|
|
74
74
|
case "ArrowDown":
|
|
75
|
-
|
|
75
|
+
e.preventDefault();
|
|
76
76
|
break;
|
|
77
77
|
case "Backspace":
|
|
78
|
-
((
|
|
78
|
+
((t = e.target) == null ? void 0 : t.value.length) === 0 && (d(e), e.preventDefault());
|
|
79
79
|
break;
|
|
80
80
|
case "ArrowRight":
|
|
81
|
-
|
|
81
|
+
h(e), e.preventDefault();
|
|
82
82
|
break;
|
|
83
83
|
case "Enter":
|
|
84
84
|
case "NumpadEnter":
|
|
85
85
|
case "Tab":
|
|
86
86
|
break;
|
|
87
87
|
default:
|
|
88
|
-
(!(
|
|
88
|
+
(!(e.code !== "Space" && Number(e.key) >= 0 && Number(e.key) <= 9) || s.value.join("").length >= o.digitCount && e.code !== "Delete") && e.preventDefault();
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function N(
|
|
92
|
+
function N(e) {
|
|
93
93
|
var n;
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
const u =
|
|
97
|
-
isNaN(D) || (s.value = u.split(""), m(
|
|
94
|
+
const t = (n = e.clipboardData) == null ? void 0 : n.getData("text");
|
|
95
|
+
if (t != null && t.length) {
|
|
96
|
+
const u = t == null ? void 0 : t.substring(0, o.digitCount), D = parseInt(u);
|
|
97
|
+
isNaN(D) || (s.value = u.split(""), m(e));
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
e.preventDefault();
|
|
100
100
|
}
|
|
101
101
|
return P(
|
|
102
102
|
() => o.modelValue,
|
|
103
|
-
(
|
|
104
|
-
s.value =
|
|
103
|
+
(e) => {
|
|
104
|
+
s.value = e ? e.split("") : new Array(o.digitCount);
|
|
105
105
|
}
|
|
106
|
-
), (
|
|
107
|
-
class:
|
|
106
|
+
), (e, t) => (r(), a("div", {
|
|
107
|
+
class: g(["stash-confirmation-code-input inline-block", [l(c)["stash-confirmation-code-input-container"]]]),
|
|
108
108
|
"data-test": "stash-confirmation-code-input"
|
|
109
109
|
}, [
|
|
110
|
-
|
|
111
|
-
(r(!0), a(
|
|
110
|
+
A("div", S, [
|
|
111
|
+
(r(!0), a(M, null, F(o.digitCount, (n) => (r(), a("input", {
|
|
112
112
|
key: n,
|
|
113
113
|
"data-test": "stash-confirmation-code-input__otp",
|
|
114
|
-
class:
|
|
114
|
+
class: g(["border bg-white p-2 text-center text-base font-medium text-ice-900 focus:border-blue-500", [
|
|
115
115
|
l(c)["otp-code-input"],
|
|
116
116
|
{ [l(c)["has-error"]]: !!o.errorText },
|
|
117
117
|
{ [l(c)["has-success"]]: !!o.successText }
|
|
@@ -122,26 +122,26 @@ const K = { class: "tw-mb-3 tw-flex tw-gap-6" }, S = ["value", "onInput"], U = {
|
|
|
122
122
|
value: s.value[n - 1],
|
|
123
123
|
pattern: "[0-9]",
|
|
124
124
|
autocomplete: "one-time-code",
|
|
125
|
-
onInput: (u) =>
|
|
126
|
-
onKeydown:
|
|
125
|
+
onInput: (u) => T(u, n - 1),
|
|
126
|
+
onKeydown: w,
|
|
127
127
|
onPaste: N,
|
|
128
|
-
onFocus:
|
|
129
|
-
onBlur:
|
|
130
|
-
}, null, 42,
|
|
128
|
+
onFocus: y,
|
|
129
|
+
onBlur: C
|
|
130
|
+
}, null, 42, U))), 128))
|
|
131
131
|
]),
|
|
132
|
-
o.errorText ? (r(), a("small",
|
|
133
|
-
o.successText ? (r(), a("small",
|
|
134
|
-
o.hintText ? (r(), a("small",
|
|
132
|
+
o.errorText ? (r(), a("small", j, f(o.errorText), 1)) : p("", !0),
|
|
133
|
+
o.successText ? (r(), a("small", L, f(o.successText), 1)) : p("", !0),
|
|
134
|
+
o.hintText ? (r(), a("small", z, f(o.hintText), 1)) : p("", !0)
|
|
135
135
|
], 2));
|
|
136
136
|
}
|
|
137
137
|
}), $ = {
|
|
138
|
-
"stash-confirmation-code-input-container": "_stash-confirmation-code-input-
|
|
139
|
-
"otp-code-input": "_otp-code-
|
|
140
|
-
"has-error": "_has-
|
|
141
|
-
"has-success": "_has-
|
|
138
|
+
"stash-confirmation-code-input-container": "_stash-confirmation-code-input-container_r8c1g_3",
|
|
139
|
+
"otp-code-input": "_otp-code-input_r8c1g_10",
|
|
140
|
+
"has-error": "_has-error_r8c1g_17",
|
|
141
|
+
"has-success": "_has-success_r8c1g_21"
|
|
142
142
|
}, q = {
|
|
143
143
|
$style: $
|
|
144
|
-
}, J = /* @__PURE__ */
|
|
144
|
+
}, J = /* @__PURE__ */ K(R, [["__cssModules", q]]);
|
|
145
145
|
export {
|
|
146
146
|
J as default
|
|
147
147
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationCodeInput.js","sources":["../src/components/ConfirmationCodeInput/ConfirmationCodeInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { onMounted, Ref, ref, useCssModule, watch } from 'vue';\n\n const classes = useCssModule();\n\n export interface VerificationCodeInputProps {\n digitCount?: number;\n /**\n * Error text to display.\n */\n errorText?: string;\n /**\n * Success text to display.\n */\n successText?: string;\n /**\n * Hint text to display.\n */\n hintText?: string;\n /**\n * One time password/code\n */\n modelValue?: string;\n }\n\n const props = withDefaults(defineProps<VerificationCodeInputProps>(), {\n digitCount: 6,\n errorText: undefined,\n successText: undefined,\n hintText: undefined,\n modelValue: undefined,\n });\n\n const emit = defineEmits<{\n (e: 'update:model-value', value: string | null): void;\n (e: 'change', params: { originalEvent: Event; value: string | null }): void;\n (e: 'focus', params: Event): void;\n (e: 'blur', params: Event): void;\n }>();\n\n const data: Ref<Array<string>> = ref([]);\n\n onMounted(() => {\n if (props.modelValue) {\n data.value = props.modelValue?.split('');\n }\n });\n\n function handleInput(event: InputEvent, index) {\n data.value[index] = event.target?.['value'];\n updateModel(event);\n\n if (event.inputType === 'deleteContentBackward') {\n moveToPrev(event);\n } else if (event.inputType === 'insertText' || event.inputType === 'deleteContentForward') {\n moveToNext(event);\n }\n }\n\n function updateModel(event: Event) {\n const newValue = data.value.join('');\n emit('update:model-value', newValue);\n emit('change', { originalEvent: event, value: newValue });\n }\n\n function moveToPrev(event: InputEvent | KeyboardEvent) {\n const prevInput: HTMLInputElement = findPrevInput(event.target as HTMLInputElement);\n\n if (prevInput) {\n prevInput.focus();\n prevInput.select();\n }\n }\n\n function moveToNext(event: InputEvent | KeyboardEvent) {\n const nextInput: HTMLInputElement = findNextInput(event.target as HTMLInputElement);\n\n if (nextInput) {\n nextInput.focus();\n nextInput.select();\n }\n }\n\n function findPrevInput(element: HTMLInputElement) {\n const prevElement = element.previousElementSibling;\n\n if (!prevElement) return;\n\n return prevElement.nodeName === 'INPUT' ? prevElement : findPrevInput(prevElement as HTMLInputElement);\n }\n\n function findNextInput(element: HTMLInputElement) {\n const nextElement = element.nextElementSibling;\n\n if (!nextElement) return;\n\n return nextElement.nodeName === 'INPUT' ? nextElement : findNextInput(nextElement as HTMLInputElement);\n }\n\n function handleFocus(event) {\n event.target.select();\n emit('focus', event);\n }\n\n function handleBlur(event: Event) {\n emit('blur', event);\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (event.ctrlKey || event.metaKey) {\n return;\n }\n\n switch (event.code) {\n case 'ArrowLeft':\n moveToPrev(event);\n event.preventDefault();\n break;\n\n case 'ArrowUp':\n case 'ArrowDown':\n event.preventDefault();\n break;\n\n case 'Backspace':\n if (event.target?.['value'].length === 0) {\n moveToPrev(event);\n event.preventDefault();\n }\n break;\n\n case 'ArrowRight':\n moveToNext(event);\n event.preventDefault();\n\n break;\n\n case 'Enter':\n case 'NumpadEnter':\n case 'Tab':\n break;\n\n default:\n if (\n !(event.code !== 'Space' && Number(event.key) >= 0 && Number(event.key) <= 9) ||\n (data.value.join('').length >= props.digitCount && event.code !== 'Delete')\n ) {\n event.preventDefault();\n }\n\n break;\n }\n }\n\n function handlePaste(event: ClipboardEvent) {\n const paste = event.clipboardData?.getData('text');\n\n if (paste?.length) {\n const pastedCode = paste?.substring(0, props.digitCount);\n\n const parsed = parseInt(pastedCode);\n\n if (!isNaN(parsed)) {\n data.value = pastedCode.split('');\n updateModel(event);\n }\n }\n\n event.preventDefault();\n }\n\n watch(\n () => props.modelValue,\n (newValue) => {\n data.value = newValue ? newValue.split('') : new Array(props.digitCount);\n },\n );\n</script>\n\n<template>\n <div\n class=\"stash-confirmation-code-input
|
|
1
|
+
{"version":3,"file":"ConfirmationCodeInput.js","sources":["../src/components/ConfirmationCodeInput/ConfirmationCodeInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { onMounted, Ref, ref, useCssModule, watch } from 'vue';\n\n const classes = useCssModule();\n\n export interface VerificationCodeInputProps {\n digitCount?: number;\n /**\n * Error text to display.\n */\n errorText?: string;\n /**\n * Success text to display.\n */\n successText?: string;\n /**\n * Hint text to display.\n */\n hintText?: string;\n /**\n * One time password/code\n */\n modelValue?: string;\n }\n\n const props = withDefaults(defineProps<VerificationCodeInputProps>(), {\n digitCount: 6,\n errorText: undefined,\n successText: undefined,\n hintText: undefined,\n modelValue: undefined,\n });\n\n const emit = defineEmits<{\n (e: 'update:model-value', value: string | null): void;\n (e: 'change', params: { originalEvent: Event; value: string | null }): void;\n (e: 'focus', params: Event): void;\n (e: 'blur', params: Event): void;\n }>();\n\n const data: Ref<Array<string>> = ref([]);\n\n onMounted(() => {\n if (props.modelValue) {\n data.value = props.modelValue?.split('');\n }\n });\n\n function handleInput(event: InputEvent, index) {\n data.value[index] = event.target?.['value'];\n updateModel(event);\n\n if (event.inputType === 'deleteContentBackward') {\n moveToPrev(event);\n } else if (event.inputType === 'insertText' || event.inputType === 'deleteContentForward') {\n moveToNext(event);\n }\n }\n\n function updateModel(event: Event) {\n const newValue = data.value.join('');\n emit('update:model-value', newValue);\n emit('change', { originalEvent: event, value: newValue });\n }\n\n function moveToPrev(event: InputEvent | KeyboardEvent) {\n const prevInput: HTMLInputElement = findPrevInput(event.target as HTMLInputElement);\n\n if (prevInput) {\n prevInput.focus();\n prevInput.select();\n }\n }\n\n function moveToNext(event: InputEvent | KeyboardEvent) {\n const nextInput: HTMLInputElement = findNextInput(event.target as HTMLInputElement);\n\n if (nextInput) {\n nextInput.focus();\n nextInput.select();\n }\n }\n\n function findPrevInput(element: HTMLInputElement) {\n const prevElement = element.previousElementSibling;\n\n if (!prevElement) return;\n\n return prevElement.nodeName === 'INPUT' ? prevElement : findPrevInput(prevElement as HTMLInputElement);\n }\n\n function findNextInput(element: HTMLInputElement) {\n const nextElement = element.nextElementSibling;\n\n if (!nextElement) return;\n\n return nextElement.nodeName === 'INPUT' ? nextElement : findNextInput(nextElement as HTMLInputElement);\n }\n\n function handleFocus(event) {\n event.target.select();\n emit('focus', event);\n }\n\n function handleBlur(event: Event) {\n emit('blur', event);\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (event.ctrlKey || event.metaKey) {\n return;\n }\n\n switch (event.code) {\n case 'ArrowLeft':\n moveToPrev(event);\n event.preventDefault();\n break;\n\n case 'ArrowUp':\n case 'ArrowDown':\n event.preventDefault();\n break;\n\n case 'Backspace':\n if (event.target?.['value'].length === 0) {\n moveToPrev(event);\n event.preventDefault();\n }\n break;\n\n case 'ArrowRight':\n moveToNext(event);\n event.preventDefault();\n\n break;\n\n case 'Enter':\n case 'NumpadEnter':\n case 'Tab':\n break;\n\n default:\n if (\n !(event.code !== 'Space' && Number(event.key) >= 0 && Number(event.key) <= 9) ||\n (data.value.join('').length >= props.digitCount && event.code !== 'Delete')\n ) {\n event.preventDefault();\n }\n\n break;\n }\n }\n\n function handlePaste(event: ClipboardEvent) {\n const paste = event.clipboardData?.getData('text');\n\n if (paste?.length) {\n const pastedCode = paste?.substring(0, props.digitCount);\n\n const parsed = parseInt(pastedCode);\n\n if (!isNaN(parsed)) {\n data.value = pastedCode.split('');\n updateModel(event);\n }\n }\n\n event.preventDefault();\n }\n\n watch(\n () => props.modelValue,\n (newValue) => {\n data.value = newValue ? newValue.split('') : new Array(props.digitCount);\n },\n );\n</script>\n\n<template>\n <div\n class=\"stash-confirmation-code-input inline-block\"\n data-test=\"stash-confirmation-code-input\"\n :class=\"[classes['stash-confirmation-code-input-container']]\"\n >\n <div class=\"mb-3 flex gap-6\">\n <template v-for=\"field in props.digitCount\" :key=\"field\">\n <input\n data-test=\"stash-confirmation-code-input__otp\"\n class=\"border bg-white p-2 text-center text-base font-medium text-ice-900 focus:border-blue-500\"\n :class=\"[\n classes['otp-code-input'],\n { [classes['has-error']]: !!props.errorText },\n { [classes['has-success']]: !!props.successText },\n ]\"\n type=\"text\"\n inputmode=\"numeric\"\n maxlength=\"1\"\n :value=\"data[field - 1]\"\n pattern=\"[0-9]\"\n autocomplete=\"one-time-code\"\n @input=\"handleInput($event as InputEvent, field - 1)\"\n @keydown=\"handleKeyDown\"\n @paste=\"handlePaste\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n />\n </template>\n </div>\n <small\n v-if=\"props.errorText\"\n class=\"mt-1 block whitespace-pre-line pr-6 text-center text-red-500\"\n data-test=\"field-error\"\n >\n {{ props.errorText }}\n </small>\n <small\n v-if=\"props.successText\"\n class=\"mt-1 block whitespace-pre-line pr-6 text-center text-green-500\"\n data-test=\"field-success\"\n >\n {{ props.successText }}\n </small>\n <small\n v-if=\"props.hintText\"\n class=\"mt-1 block whitespace-pre-line pr-6 text-center text-ice-700\"\n data-test=\"field-hint\"\n >\n {{ props.hintText }}\n </small>\n </div>\n</template>\n\n<style module>\n @layer utilities {\n .stash-confirmation-code-input-container {\n --otp-digits: v-bind(digitCount);\n --otp-container-width: calc(var(--otp-digits) * 60px);\n\n width: var(--otp-container-width);\n }\n\n .otp-code-input {\n border-radius: 4px;\n caret-color: transparent;\n height: 36px;\n width: 36px;\n }\n\n .otp-code-input.has-error:not(:focus) {\n border-color: var(--color-red-500);\n }\n\n .otp-code-input.has-success:not(:focus) {\n border-color: var(--color-green-500);\n }\n\n .otp-code-input:focus {\n box-shadow: 0 0 0 3px rgb(0 114 240 / 15%);\n outline: none;\n }\n }\n</style>\n"],"names":["classes","useCssModule","props","__props","emit","__emit","data","ref","onMounted","_a","handleInput","event","index","updateModel","moveToPrev","moveToNext","newValue","prevInput","findPrevInput","nextInput","findNextInput","element","prevElement","nextElement","handleFocus","handleBlur","handleKeyDown","handlePaste","paste","pastedCode","parsed","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGE,UAAMA,IAAUC,EAAA,GAsBVC,IAAQC,GAQRC,IAAOC,GAOPC,IAA2BC,EAAI,EAAE;AAEvC,IAAAC,EAAU,MAAM;;AACd,MAAIN,EAAM,eACRI,EAAK,SAAQG,IAAAP,EAAM,eAAN,gBAAAO,EAAkB,MAAM;AAAA,IAEzC,CAAC;AAED,aAASC,EAAYC,GAAmBC,GAAO;;AAC7C,MAAAN,EAAK,MAAMM,CAAK,KAAIH,IAAAE,EAAM,WAAN,gBAAAF,EAAe,OACnCI,EAAYF,CAAK,GAEbA,EAAM,cAAc,0BACtBG,EAAWH,CAAK,KACPA,EAAM,cAAc,gBAAgBA,EAAM,cAAc,2BACjEI,EAAWJ,CAAK;AAAA,IAEpB;AAEA,aAASE,EAAYF,GAAc;AACjC,YAAMK,IAAWV,EAAK,MAAM,KAAK,EAAE;AACnC,MAAAF,EAAK,sBAAsBY,CAAQ,GACnCZ,EAAK,UAAU,EAAE,eAAeO,GAAO,OAAOK,GAAU;AAAA,IAC1D;AAEA,aAASF,EAAWH,GAAmC;AACrD,YAAMM,IAA8BC,EAAcP,EAAM,MAA0B;AAElF,MAAIM,MACFA,EAAU,MAAA,GACVA,EAAU,OAAA;AAAA,IAEd;AAEA,aAASF,EAAWJ,GAAmC;AACrD,YAAMQ,IAA8BC,EAAcT,EAAM,MAA0B;AAElF,MAAIQ,MACFA,EAAU,MAAA,GACVA,EAAU,OAAA;AAAA,IAEd;AAEA,aAASD,EAAcG,GAA2B;AAChD,YAAMC,IAAcD,EAAQ;AAE5B,UAAKC;AAEL,eAAOA,EAAY,aAAa,UAAUA,IAAcJ,EAAcI,CAA+B;AAAA,IACvG;AAEA,aAASF,EAAcC,GAA2B;AAChD,YAAME,IAAcF,EAAQ;AAE5B,UAAKE;AAEL,eAAOA,EAAY,aAAa,UAAUA,IAAcH,EAAcG,CAA+B;AAAA,IACvG;AAEA,aAASC,EAAYb,GAAO;AAC1B,MAAAA,EAAM,OAAO,OAAA,GACbP,EAAK,SAASO,CAAK;AAAA,IACrB;AAEA,aAASc,EAAWd,GAAc;AAChC,MAAAP,EAAK,QAAQO,CAAK;AAAA,IACpB;AAEA,aAASe,EAAcf,GAAsB;;AAC3C,UAAI,EAAAA,EAAM,WAAWA,EAAM;AAI3B,gBAAQA,EAAM,MAAA;AAAA,UACZ,KAAK;AACH,YAAAG,EAAWH,CAAK,GAChBA,EAAM,eAAA;AACN;AAAA,UAEF,KAAK;AAAA,UACL,KAAK;AACH,YAAAA,EAAM,eAAA;AACN;AAAA,UAEF,KAAK;AACH,cAAIF,IAAAE,EAAM,WAAN,gBAAAF,EAAe,MAAS,YAAW,MACrCK,EAAWH,CAAK,GAChBA,EAAM,eAAA;AAER;AAAA,UAEF,KAAK;AACH,YAAAI,EAAWJ,CAAK,GAChBA,EAAM,eAAA;AAEN;AAAA,UAEF,KAAK;AAAA,UACL,KAAK;AAAA,UACL,KAAK;AACH;AAAA,UAEF;AACE,aACE,EAAEA,EAAM,SAAS,WAAW,OAAOA,EAAM,GAAG,KAAK,KAAK,OAAOA,EAAM,GAAG,KAAK,MAC1EL,EAAK,MAAM,KAAK,EAAE,EAAE,UAAUJ,EAAM,cAAcS,EAAM,SAAS,aAElEA,EAAM,eAAA;AAGR;AAAA,QAAA;AAAA,IAEN;AAEA,aAASgB,EAAYhB,GAAuB;;AAC1C,YAAMiB,KAAQnB,IAAAE,EAAM,kBAAN,gBAAAF,EAAqB,QAAQ;AAE3C,UAAImB,KAAA,QAAAA,EAAO,QAAQ;AACjB,cAAMC,IAAaD,KAAA,gBAAAA,EAAO,UAAU,GAAG1B,EAAM,aAEvC4B,IAAS,SAASD,CAAU;AAElC,QAAK,MAAMC,CAAM,MACfxB,EAAK,QAAQuB,EAAW,MAAM,EAAE,GAChChB,EAAYF,CAAK;AAAA,MAErB;AAEA,MAAAA,EAAM,eAAA;AAAA,IACR;AAEA,WAAAoB;AAAA,MACE,MAAM7B,EAAM;AAAA,MACZ,CAACc,MAAa;AACZ,QAAAV,EAAK,QAAQU,IAAWA,EAAS,MAAM,EAAE,IAAI,IAAI,MAAMd,EAAM,UAAU;AAAA,MACzE;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/ContextSwitcher.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as _, computed as C, resolveComponent as g, createElementBlock as l, openBlock as s, Fragment as
|
|
1
|
+
import { defineComponent as _, computed as C, resolveComponent as g, createElementBlock as l, openBlock as s, Fragment as d, renderList as x, createBlock as E, normalizeClass as f, toDisplayString as h, withCtx as S, createTextVNode as b } from "vue";
|
|
2
2
|
import { APPS as a } from "./constants.js";
|
|
3
3
|
import { setPersistentItem as T, getPersistentItem as v, removePersistentItem as R } from "./utils/storage.js";
|
|
4
4
|
const N = {
|
|
5
|
-
class: "stash-context-switcher
|
|
5
|
+
class: "stash-context-switcher mx-auto flex w-64 rounded-full border border-white/10 bg-purple-700 p-1.5 text-center",
|
|
6
6
|
"data-test": "stash-context-switcher"
|
|
7
|
-
}, B = ["href", "onClick"],
|
|
7
|
+
}, B = ["href", "onClick"], A = "-last-session", L = /* @__PURE__ */ _({
|
|
8
8
|
name: "ll-context-switcher",
|
|
9
9
|
__name: "ContextSwitcher",
|
|
10
10
|
props: {
|
|
@@ -17,52 +17,52 @@ const N = {
|
|
|
17
17
|
routeQuery: { default: () => ({}) }
|
|
18
18
|
},
|
|
19
19
|
emits: ["click", "switch"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
20
|
+
setup(y, { emit: w }) {
|
|
21
|
+
const t = y, p = w, P = C(() => [
|
|
22
22
|
{
|
|
23
23
|
app: a.MARKETPLACE,
|
|
24
|
-
name:
|
|
25
|
-
hasBaseRoute:
|
|
24
|
+
name: t.portalAccess.commercePortal ? "dashboard" : t.limitedAccessUrl,
|
|
25
|
+
hasBaseRoute: t.portalAccess.commercePortal
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
app: a.PAYMENTS,
|
|
29
|
-
name:
|
|
29
|
+
name: t.portalAccess.paymentsPortal ? "payments" : t.limitedAccessUrl,
|
|
30
30
|
hasBaseRoute: !1
|
|
31
31
|
}
|
|
32
32
|
]);
|
|
33
33
|
function m(o, n) {
|
|
34
|
-
if (n ===
|
|
34
|
+
if (n === t.activeApp)
|
|
35
35
|
return;
|
|
36
36
|
const r = window.location.href;
|
|
37
|
-
let
|
|
38
|
-
if (
|
|
39
|
-
const k = `${n === a.PAYMENTS ? a.MARKETPLACE : a.PAYMENTS}${
|
|
37
|
+
let e = o.target.href;
|
|
38
|
+
if (t.portalAccess.paymentsPortal && t.portalAccess.commercePortal) {
|
|
39
|
+
const k = `${n === a.PAYMENTS ? a.MARKETPLACE : a.PAYMENTS}${A}`, u = `${n}${A}`;
|
|
40
40
|
T(k, r, { global: !0 });
|
|
41
|
-
const i = v(
|
|
42
|
-
i && (o.preventDefault(),
|
|
41
|
+
const i = v(u, { global: !0 });
|
|
42
|
+
i && (o.preventDefault(), e = i, window.location.href = i, R(u, { global: !0 }));
|
|
43
43
|
}
|
|
44
|
-
p("click", { from: r, to:
|
|
44
|
+
p("click", { from: r, to: e }), p("switch", o, { from: r, to: e });
|
|
45
45
|
}
|
|
46
46
|
return (o, n) => {
|
|
47
47
|
const r = g("router-link");
|
|
48
48
|
return s(), l("div", N, [
|
|
49
|
-
(s(!0), l(
|
|
50
|
-
key:
|
|
49
|
+
(s(!0), l(d, null, x(P.value, (e) => (s(), l(d, {
|
|
50
|
+
key: e.app
|
|
51
51
|
}, [
|
|
52
|
-
|
|
52
|
+
e.hasBaseRoute ? (s(), l("a", {
|
|
53
53
|
key: 0,
|
|
54
|
-
class:
|
|
55
|
-
href: `/${
|
|
56
|
-
onClick: (c) => m(c,
|
|
57
|
-
},
|
|
54
|
+
class: f(["w-1/2 cursor-pointer rounded-full py-2.5 font-semibold !capitalize leading-none !no-underline", t.activeApp === e.app ? "text-white bg-royal-500" : "text-ice-500"]),
|
|
55
|
+
href: `/${e.name}`,
|
|
56
|
+
onClick: (c) => m(c, e.app)
|
|
57
|
+
}, h(e.app), 11, B)) : (s(), E(r, {
|
|
58
58
|
key: 1,
|
|
59
|
-
class:
|
|
60
|
-
to: { name:
|
|
61
|
-
"data-test-route": JSON.stringify({ name:
|
|
62
|
-
onClick: (c) => m(c,
|
|
59
|
+
class: f(["w-1/2 cursor-pointer rounded-full py-2.5 font-semibold !capitalize leading-none !no-underline", t.activeApp === e.app ? "text-white bg-royal-500" : "text-ice-500"]),
|
|
60
|
+
to: { name: e.name, query: o.routeQuery },
|
|
61
|
+
"data-test-route": JSON.stringify({ name: e.name, query: o.routeQuery }),
|
|
62
|
+
onClick: (c) => m(c, e.app)
|
|
63
63
|
}, {
|
|
64
64
|
default: S(() => [
|
|
65
|
-
b(
|
|
65
|
+
b(h(e.app), 1)
|
|
66
66
|
]),
|
|
67
67
|
_: 2
|
|
68
68
|
}, 1032, ["class", "to", "data-test-route", "onClick"]))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextSwitcher.js","sources":["../src/components/ContextSwitcher/ContextSwitcher.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue';\n import type { LocationQuery } from 'vue-router';\n\n import { APPS } from '../../constants';\n import { getPersistentItem, removePersistentItem, setPersistentItem } from '../../utils/storage';\n\n defineOptions({\n name: 'll-context-switcher',\n });\n\n type AppValues = (typeof APPS)[keyof typeof APPS];\n\n export interface ContextSwitcherProps {\n /**\n * The current app that is active. Choices are 'marketplace' | 'payments'.\n */\n activeApp: AppValues;\n\n /**\n * Portal access to both marketplace and payments.\n */\n portalAccess?: {\n commercePortal: boolean;\n paymentsPortal: boolean;\n };\n\n /**\n * Url to replace the other app if current user does not have portal access.\n */\n limitedAccessUrl: string;\n\n routeQuery?: LocationQuery;\n }\n\n const props = withDefaults(defineProps<ContextSwitcherProps>(), {\n portalAccess: () => ({\n commercePortal: false,\n paymentsPortal: false,\n }),\n routeQuery: () => ({}),\n });\n\n const emit = defineEmits<{\n /**\n * Fires on click of the context switcher.\n * @deprecated Use `switch` instead.\n */\n (e: 'click', urlInfo: { from: string; to: string }): void;\n /**\n * Fires on click of the context switcher.\n */\n (e: 'switch', evt: MouseEvent, urlInfo: { from: string; to: string }): void;\n }>();\n\n interface ContextItem {\n app: AppValues;\n name: string;\n hasBaseRoute: boolean;\n }\n\n const CONTEXT_SWITCHER_STORAGE_KEY = '-last-session';\n\n const routes = computed<ContextItem[]>(() => {\n return [\n {\n app: APPS.MARKETPLACE,\n name: props.portalAccess.commercePortal ? 'dashboard' : props.limitedAccessUrl,\n hasBaseRoute: props.portalAccess.commercePortal,\n },\n {\n app: APPS.PAYMENTS,\n name: props.portalAccess.paymentsPortal ? 'payments' : props.limitedAccessUrl,\n hasBaseRoute: false,\n },\n ];\n });\n\n /**\n * Saves the current url in local storage before leaving the current app, if user has access to both apps\n * If a previous session url exists, redirect users there instead then remove the local storage item afterward.\n *\n * @param event - Event from user click.\n * @param app - App name of the clicked link, is a key of `APPS`.\n */\n function handleClick(event: MouseEvent, app: AppValues) {\n if (app === props.activeApp) {\n return;\n }\n\n const currentLocation = window.location.href;\n let destination = (event.target as HTMLAnchorElement).href;\n\n if (props.portalAccess.paymentsPortal && props.portalAccess.commercePortal) {\n const appRoute = app === APPS.PAYMENTS ? APPS.MARKETPLACE : APPS.PAYMENTS;\n const currentSessionName = `${appRoute}${CONTEXT_SWITCHER_STORAGE_KEY}`;\n const prevSessionName = `${app}${CONTEXT_SWITCHER_STORAGE_KEY}`;\n\n // save the current url in local storage\n setPersistentItem(currentSessionName, currentLocation, { global: true });\n\n // get the other app's url from local storage\n const prevSessionUrl = getPersistentItem(prevSessionName, { global: true });\n\n // if it exists, redirect users to such location and remove the item from local storage\n if (prevSessionUrl) {\n event.preventDefault();\n destination = prevSessionUrl;\n window.location.href = prevSessionUrl;\n removePersistentItem(prevSessionName, { global: true });\n }\n }\n\n emit('click', { from: currentLocation, to: destination });\n emit('switch', event, { from: currentLocation, to: destination });\n }\n</script>\n\n<template>\n <div\n class=\"stash-context-switcher
|
|
1
|
+
{"version":3,"file":"ContextSwitcher.js","sources":["../src/components/ContextSwitcher/ContextSwitcher.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue';\n import type { LocationQuery } from 'vue-router';\n\n import { APPS } from '../../constants';\n import { getPersistentItem, removePersistentItem, setPersistentItem } from '../../utils/storage';\n\n defineOptions({\n name: 'll-context-switcher',\n });\n\n type AppValues = (typeof APPS)[keyof typeof APPS];\n\n export interface ContextSwitcherProps {\n /**\n * The current app that is active. Choices are 'marketplace' | 'payments'.\n */\n activeApp: AppValues;\n\n /**\n * Portal access to both marketplace and payments.\n */\n portalAccess?: {\n commercePortal: boolean;\n paymentsPortal: boolean;\n };\n\n /**\n * Url to replace the other app if current user does not have portal access.\n */\n limitedAccessUrl: string;\n\n routeQuery?: LocationQuery;\n }\n\n const props = withDefaults(defineProps<ContextSwitcherProps>(), {\n portalAccess: () => ({\n commercePortal: false,\n paymentsPortal: false,\n }),\n routeQuery: () => ({}),\n });\n\n const emit = defineEmits<{\n /**\n * Fires on click of the context switcher.\n * @deprecated Use `switch` instead.\n */\n (e: 'click', urlInfo: { from: string; to: string }): void;\n /**\n * Fires on click of the context switcher.\n */\n (e: 'switch', evt: MouseEvent, urlInfo: { from: string; to: string }): void;\n }>();\n\n interface ContextItem {\n app: AppValues;\n name: string;\n hasBaseRoute: boolean;\n }\n\n const CONTEXT_SWITCHER_STORAGE_KEY = '-last-session';\n\n const routes = computed<ContextItem[]>(() => {\n return [\n {\n app: APPS.MARKETPLACE,\n name: props.portalAccess.commercePortal ? 'dashboard' : props.limitedAccessUrl,\n hasBaseRoute: props.portalAccess.commercePortal,\n },\n {\n app: APPS.PAYMENTS,\n name: props.portalAccess.paymentsPortal ? 'payments' : props.limitedAccessUrl,\n hasBaseRoute: false,\n },\n ];\n });\n\n /**\n * Saves the current url in local storage before leaving the current app, if user has access to both apps\n * If a previous session url exists, redirect users there instead then remove the local storage item afterward.\n *\n * @param event - Event from user click.\n * @param app - App name of the clicked link, is a key of `APPS`.\n */\n function handleClick(event: MouseEvent, app: AppValues) {\n if (app === props.activeApp) {\n return;\n }\n\n const currentLocation = window.location.href;\n let destination = (event.target as HTMLAnchorElement).href;\n\n if (props.portalAccess.paymentsPortal && props.portalAccess.commercePortal) {\n const appRoute = app === APPS.PAYMENTS ? APPS.MARKETPLACE : APPS.PAYMENTS;\n const currentSessionName = `${appRoute}${CONTEXT_SWITCHER_STORAGE_KEY}`;\n const prevSessionName = `${app}${CONTEXT_SWITCHER_STORAGE_KEY}`;\n\n // save the current url in local storage\n setPersistentItem(currentSessionName, currentLocation, { global: true });\n\n // get the other app's url from local storage\n const prevSessionUrl = getPersistentItem(prevSessionName, { global: true });\n\n // if it exists, redirect users to such location and remove the item from local storage\n if (prevSessionUrl) {\n event.preventDefault();\n destination = prevSessionUrl;\n window.location.href = prevSessionUrl;\n removePersistentItem(prevSessionName, { global: true });\n }\n }\n\n emit('click', { from: currentLocation, to: destination });\n emit('switch', event, { from: currentLocation, to: destination });\n }\n</script>\n\n<template>\n <div\n class=\"stash-context-switcher mx-auto flex w-64 rounded-full border border-white/10 bg-purple-700 p-1.5 text-center\"\n data-test=\"stash-context-switcher\"\n >\n <template v-for=\"route in routes\" :key=\"route.app\">\n <!-- render anchor tag to override base route in Payments -->\n <a\n v-if=\"route.hasBaseRoute\"\n class=\"w-1/2 cursor-pointer rounded-full py-2.5 font-semibold !capitalize leading-none !no-underline\"\n :class=\"props.activeApp === route.app ? 'text-white bg-royal-500' : 'text-ice-500'\"\n :href=\"`/${route.name}`\"\n @click=\"(evt) => handleClick(evt, route.app)\"\n >\n {{ route.app }}\n </a>\n\n <router-link\n v-else\n class=\"w-1/2 cursor-pointer rounded-full py-2.5 font-semibold !capitalize leading-none !no-underline\"\n :class=\"props.activeApp === route.app ? 'text-white bg-royal-500' : 'text-ice-500'\"\n :to=\"{ name: route.name, query: routeQuery }\"\n :data-test-route=\"JSON.stringify({ name: route.name, query: routeQuery })\"\n @click=\"(evt) => handleClick(evt, route.app)\"\n >\n {{ route.app }}\n </router-link>\n </template>\n </div>\n</template>\n"],"names":["CONTEXT_SWITCHER_STORAGE_KEY","props","__props","emit","__emit","routes","computed","APPS","handleClick","event","app","currentLocation","destination","currentSessionName","prevSessionName","setPersistentItem","prevSessionUrl","getPersistentItem","removePersistentItem"],"mappings":";;;;;;4BA6DQA,IAA+B;;;;;;;;;;;;;;AA1BrC,UAAMC,IAAQC,GAQRC,IAAOC,GAoBPC,IAASC,EAAwB,MAC9B;AAAA,MACL;AAAA,QACE,KAAKC,EAAK;AAAA,QACV,MAAMN,EAAM,aAAa,iBAAiB,cAAcA,EAAM;AAAA,QAC9D,cAAcA,EAAM,aAAa;AAAA,MAAA;AAAA,MAEnC;AAAA,QACE,KAAKM,EAAK;AAAA,QACV,MAAMN,EAAM,aAAa,iBAAiB,aAAaA,EAAM;AAAA,QAC7D,cAAc;AAAA,MAAA;AAAA,IAChB,CAEH;AASD,aAASO,EAAYC,GAAmBC,GAAgB;AACtD,UAAIA,MAAQT,EAAM;AAChB;AAGF,YAAMU,IAAkB,OAAO,SAAS;AACxC,UAAIC,IAAeH,EAAM,OAA6B;AAEtD,UAAIR,EAAM,aAAa,kBAAkBA,EAAM,aAAa,gBAAgB;AAE1E,cAAMY,IAAqB,GADVH,MAAQH,EAAK,WAAWA,EAAK,cAAcA,EAAK,QAC3B,GAAGP,CAA4B,IAC/Dc,IAAkB,GAAGJ,CAAG,GAAGV,CAA4B;AAG7D,QAAAe,EAAkBF,GAAoBF,GAAiB,EAAE,QAAQ,IAAM;AAGvE,cAAMK,IAAiBC,EAAkBH,GAAiB,EAAE,QAAQ,IAAM;AAG1E,QAAIE,MACFP,EAAM,eAAA,GACNG,IAAcI,GACd,OAAO,SAAS,OAAOA,GACvBE,EAAqBJ,GAAiB,EAAE,QAAQ,GAAA,CAAM;AAAA,MAE1D;AAEA,MAAAX,EAAK,SAAS,EAAE,MAAMQ,GAAiB,IAAIC,GAAa,GACxDT,EAAK,UAAUM,GAAO,EAAE,MAAME,GAAiB,IAAIC,GAAa;AAAA,IAClE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Copy.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as _, useCssModule as m, ref as f, computed as h, createElementBlock as x, openBlock as o, normalizeClass as l, unref as p, renderSlot as v, createVNode as C, withCtx as i, createBlock as s, createTextVNode as k, toDisplayString as b } from "vue";
|
|
2
2
|
import { UI_TIMEOUT as T } from "./constants.js";
|
|
3
|
-
import b from "./directives/tooltip.js";
|
|
4
3
|
import { t as n } from "./locale.js";
|
|
5
4
|
import g from "./Button.js";
|
|
6
5
|
import r from "./Icon.js";
|
|
6
|
+
import { _ as z } from "./Tooltip.vue_vue_type_script_setup_true_lang-mzBLSXy3.js";
|
|
7
7
|
import { _ as B } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
|
-
const M = /* @__PURE__ */
|
|
8
|
+
const M = /* @__PURE__ */ _({
|
|
9
9
|
__name: "Copy",
|
|
10
10
|
props: {
|
|
11
11
|
text: { default: void 0 },
|
|
@@ -13,60 +13,59 @@ const M = /* @__PURE__ */ m({
|
|
|
13
13
|
visible: { type: Boolean, default: !1 }
|
|
14
14
|
},
|
|
15
15
|
setup(d) {
|
|
16
|
-
const t = d,
|
|
17
|
-
function
|
|
18
|
-
navigator.clipboard.writeText(t.value),
|
|
19
|
-
|
|
16
|
+
const t = d, c = m(), e = f(!1), y = h(() => e.value ? n("ll.copy.copied") : t.text ? null : n("ll.copy.copyToClipboard"));
|
|
17
|
+
function a() {
|
|
18
|
+
navigator.clipboard.writeText(t.value), e.value = !0, setTimeout(() => {
|
|
19
|
+
e.value = !1;
|
|
20
20
|
}, T);
|
|
21
21
|
}
|
|
22
|
-
return (u,
|
|
23
|
-
class:
|
|
22
|
+
return (u, N) => (o(), x("div", {
|
|
23
|
+
class: l(["stash-copy flex items-center", { [p(c).hidden]: !t.visible }]),
|
|
24
24
|
"data-test": "stash-copy"
|
|
25
25
|
}, [
|
|
26
26
|
v(u.$slots, "default"),
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
C(z, {
|
|
28
|
+
side: "top",
|
|
29
|
+
text: y.value,
|
|
30
|
+
"is-disabled": !!t.text,
|
|
31
|
+
class: l(["stash-copy__copy-zone ml-3 cursor-pointer", p(c).copy]),
|
|
29
32
|
"data-test": "stash-copy|copy-zone"
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
void 0,
|
|
60
|
-
{ top: !0 }
|
|
61
|
-
]
|
|
62
|
-
])
|
|
33
|
+
}, {
|
|
34
|
+
default: i(() => [
|
|
35
|
+
e.value ? (o(), s(r, {
|
|
36
|
+
key: 0,
|
|
37
|
+
class: "stash-copy__success-icon text-green-500",
|
|
38
|
+
name: "circle-check",
|
|
39
|
+
"data-test": "stash-copy|success-icon"
|
|
40
|
+
})) : t.text ? (o(), s(g, {
|
|
41
|
+
key: 1,
|
|
42
|
+
class: "stash-copy__copy-text",
|
|
43
|
+
inline: "",
|
|
44
|
+
"data-test": "stash-copy|copy-target",
|
|
45
|
+
onClick: a
|
|
46
|
+
}, {
|
|
47
|
+
default: i(() => [
|
|
48
|
+
k(b(t.text), 1)
|
|
49
|
+
]),
|
|
50
|
+
_: 1
|
|
51
|
+
})) : (o(), s(r, {
|
|
52
|
+
key: 2,
|
|
53
|
+
class: "stash-copy__copy-icon",
|
|
54
|
+
name: "copy",
|
|
55
|
+
title: "Copy to clipboard",
|
|
56
|
+
"data-test": "stash-copy|copy-target",
|
|
57
|
+
onClick: a
|
|
58
|
+
}))
|
|
59
|
+
]),
|
|
60
|
+
_: 1
|
|
61
|
+
}, 8, ["text", "is-disabled", "class"])
|
|
63
62
|
], 2));
|
|
64
63
|
}
|
|
65
|
-
}),
|
|
66
|
-
hidden:
|
|
67
|
-
copy:
|
|
64
|
+
}), I = "_hidden_z4re6_3", $ = "_copy_z4re6_4", w = {
|
|
65
|
+
hidden: I,
|
|
66
|
+
copy: $
|
|
68
67
|
}, E = {
|
|
69
|
-
$style:
|
|
68
|
+
$style: w
|
|
70
69
|
}, A = /* @__PURE__ */ B(M, [["__cssModules", E]]);
|
|
71
70
|
export {
|
|
72
71
|
A as default
|
package/dist/Copy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Copy.js","sources":["../src/components/Copy/Copy.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, useCssModule } from 'vue';\n\n import { UI_TIMEOUT } from '../../constants';\n import
|
|
1
|
+
{"version":3,"file":"Copy.js","sources":["../src/components/Copy/Copy.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, useCssModule } from 'vue';\n\n import { UI_TIMEOUT } from '../../constants';\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import Tooltip from '../Tooltip/Tooltip.vue';\n\n export interface CopyProps {\n /**\n * Optional text to display instead of icon.\n */\n text?: string;\n\n /**\n * The value to copy to clipboard.\n */\n value?: string;\n\n /**\n * Sets the copy icon or text to always be visible. By default, icon/text only appears when hovering over slot content.\n */\n visible?: boolean;\n }\n\n const props = withDefaults(defineProps<CopyProps>(), {\n text: undefined,\n value: '', // Todo - We should default this to the content of the default slot so you can do <Copy>631f67a</Copy>.\n visible: false,\n });\n const classes = useCssModule();\n\n // Flag to indicate whether a user successfully copied the text to their clipboard.\n // Note: We reset this flag after a timeout to allow the user to copy the text multiple times.\n const isCopied = ref(false);\n\n const tooltip = computed(() => {\n return isCopied.value ? t('ll.copy.copied') : !props.text ? t('ll.copy.copyToClipboard') : null;\n });\n\n function handleCopy() {\n navigator.clipboard.writeText(props.value);\n isCopied.value = true;\n\n setTimeout(() => {\n isCopied.value = false;\n }, UI_TIMEOUT);\n }\n</script>\n\n<template>\n <div class=\"stash-copy flex items-center\" :class=\"{ [classes.hidden]: !props.visible }\" data-test=\"stash-copy\">\n <!-- @slot Anything you want to render. This is not what will be copied to the clipboard. -->\n <slot></slot>\n <Tooltip\n side=\"top\"\n :text=\"tooltip\"\n :is-disabled=\"!!props.text\"\n class=\"stash-copy__copy-zone ml-3 cursor-pointer\"\n :class=\"classes.copy\"\n data-test=\"stash-copy|copy-zone\"\n >\n <Icon\n v-if=\"isCopied\"\n class=\"stash-copy__success-icon text-green-500\"\n name=\"circle-check\"\n data-test=\"stash-copy|success-icon\"\n />\n <Button\n v-else-if=\"props.text\"\n class=\"stash-copy__copy-text\"\n inline\n data-test=\"stash-copy|copy-target\"\n @click=\"handleCopy\"\n >\n {{ props.text }}\n </Button>\n <Icon\n v-else\n class=\"stash-copy__copy-icon\"\n name=\"copy\"\n title=\"Copy to clipboard\"\n data-test=\"stash-copy|copy-target\"\n @click=\"handleCopy\"\n />\n </Tooltip>\n </div>\n</template>\n\n<style module>\n @layer utilities {\n .hidden {\n .copy {\n visibility: hidden;\n }\n\n &:hover {\n .copy {\n visibility: visible;\n }\n }\n }\n }\n</style>\n"],"names":["props","__props","classes","useCssModule","isCopied","ref","tooltip","computed","t","handleCopy","UI_TIMEOUT"],"mappings":";;;;;;;;;;;;;;;AA0BE,UAAMA,IAAQC,GAKRC,IAAUC,EAAA,GAIVC,IAAWC,EAAI,EAAK,GAEpBC,IAAUC,EAAS,MAChBH,EAAS,QAAQI,EAAE,gBAAgB,IAAKR,EAAM,OAAsC,OAA/BQ,EAAE,yBAAyB,CACxF;AAED,aAASC,IAAa;AACpB,gBAAU,UAAU,UAAUT,EAAM,KAAK,GACzCI,EAAS,QAAQ,IAEjB,WAAW,MAAM;AACf,QAAAA,EAAS,QAAQ;AAAA,MACnB,GAAGM,CAAU;AAAA,IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/CurrencyInput.js
CHANGED
|
@@ -317,7 +317,7 @@ const ti = /* @__PURE__ */ C({
|
|
|
317
317
|
__name: "CurrencyInput",
|
|
318
318
|
props: {
|
|
319
319
|
inputOptions: { default: void 0 },
|
|
320
|
-
modelValue: { default:
|
|
320
|
+
modelValue: { default: null },
|
|
321
321
|
hidePrepend: { type: Boolean, default: !1 },
|
|
322
322
|
autocomplete: {},
|
|
323
323
|
value: {},
|