@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/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../src/components/Badge/Badge.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, useCssModule, watch } from 'vue';\n\n defineOptions({\n name: 'll-badge',\n });\n\n const classes = useCssModule();\n\n export interface BadgeProps {\n /**\n * If true, the badge will animate when the content changes\n */\n animate?: boolean;\n\n /**\n * Color of the badge\n * Options: 'red' or 'blue'\n */\n color?: 'red' | 'blue';\n\n /**\n * The badge's content\n */\n content?: number | string;\n\n /**\n * Shows a gray badge with content\n */\n isDisabled?: boolean;\n\n /**\n * The max value of the `content` prop. If the value is greater than this, the badge will show the max value and a `+` sign.\n */\n max?: number | string;\n\n /**\n * Offset to adjust the badge's position. It does not apply to inline position badges.\n */\n offset?: {\n top?: number;\n right?: number;\n };\n\n /**\n * Badge position. Options:\n *\n * - inline: shows the badge directly next to the content (on the right), with a left margin of 6px\n * - top-right: will overlap the badge over whatever is passed in the default slot\n */\n position?: 'top-right' | 'inline';\n\n /**\n * The badge will be hidden if the content is `0` unless this prop is set to true.\n */\n showZero?: boolean;\n\n /**\n * Badge variant\n */\n variant?: 'dot' | 'standard';\n }\n\n const props = withDefaults(defineProps<BadgeProps>(), {\n animate: false,\n color: 'red',\n content: undefined,\n isDisabled: false,\n max: 99,\n position: 'top-right',\n offset: () => ({\n top: undefined,\n right: undefined,\n }),\n showZero: false,\n variant: 'standard',\n });\n\n const computedContent = computed(() => {\n const numericContent = parseInt(props.content as string, 10);\n const numericMax = parseInt(props.max as string, 10);\n // We want to compare the values, not the types, so it's okay to use `!=` here. i.e. if '23' = 23, then we know\n // the props are numbers, and we can compare the values. If you pass '23foobar' parseInt will return still return 23\n // but this check will fail like we want it to.\n // eslint-disable-next-line eqeqeq\n if (numericContent != props.content || numericMax != props.max) {\n return props.content;\n }\n\n return numericContent > numericMax ? `${numericMax}+` : numericContent;\n });\n\n const formatOffsetStyleValue = (value: number) => (value === 0 ? '0' : `${value}px`);\n\n const computedOffsetStyle = computed(() => ({\n top: props.offset.top !== undefined ? formatOffsetStyleValue(props.offset.top) : undefined,\n right: props.offset.right !== undefined ? formatOffsetStyleValue(props.offset.right) : undefined,\n }));\n\n const playAnimation = ref(false);\n\n watch(\n () => props.content,\n (value, oldValue) => {\n if (!props.animate) {\n return;\n }\n\n if (oldValue !== value) {\n playAnimation.value = true;\n\n setTimeout(() => {\n playAnimation.value = false;\n }, 1000);\n }\n },\n );\n</script>\n\n<template>\n <span class=\"stash-badge tw-relative tw-inline-block\" data-test=\"stash-badge\">\n <slot />\n <span\n v-show=\"props.variant === 'dot' || computedContent || (computedContent === 0 && props.showZero)\"\n data-test=\"stash-badge|content-wrapper\"\n :class=\"[\n {\n [classes['top-right']]: props.position === 'top-right' && props.variant !== 'dot',\n 'tw-absolute': props.variant === 'dot' || props.position === 'top-right',\n 'tw-ml-1.5': props.position === 'inline',\n },\n ]\"\n :style=\"props.variant === 'dot' || props.position === 'top-right' ? computedOffsetStyle : ''\"\n >\n <span\n data-test=\"stash-badge|content\"\n class=\"\n tw-text-white\n tw-font-semibold\n tw-rounded-full\n tw-text-[10px]\n tw-text-center\n tw-whitespace-nowrap\n tw-leading-[0.875rem]\n tw-inline-block\n \"\n :class=\"[\n {\n 'tw-animate-grow': playAnimation,\n 'tw-bg-red': props.color === 'red' && !props.isDisabled,\n 'tw-bg-blue': props.color === 'blue' && !props.isDisabled,\n 'tw-absolute': props.variant === 'dot',\n 'tw-bg-ice-200 tw-text-white': props.isDisabled,\n [classes['badge-dot']]: props.variant === 'dot',\n [classes['badge-standard']]: props.variant === 'standard',\n 'tw-px-1.5': props.variant !== 'dot',\n },\n ]\"\n >\n {{ props.variant === 'dot' ? null : computedContent }}\n </span>\n </span>\n </span>\n</template>\n\n<style module>\n .badge-standard {\n height: 15px;\n line-height: 1.05rem;\n vertical-align: middle;\n }\n\n .badge-dot {\n border: 2px solid theme('colors.ice.100');\n height: 10px;\n right: 0;\n width: 10px;\n }\n\n .top-right {\n top: 0;\n right: 0;\n transform: translateX(50%) translateY(-48%);\n }\n</style>\n"],"names":["classes","useCssModule","computedContent","computed","numericContent","props","numericMax","formatOffsetStyleValue","value","computedOffsetStyle","playAnimation","ref","watch","oldValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAOQA,IAAUC,KAuEVC,IAAkBC,EAAS,MAAM;AACrC,YAAMC,IAAiB,SAASC,EAAM,SAAmB,EAAE,GACrDC,IAAa,SAASD,EAAM,KAAe,EAAE;AAKnD,aAAID,KAAkBC,EAAM,WAAWC,KAAcD,EAAM,MAClDA,EAAM,UAGRD,IAAiBE,IAAa,GAAGA,CAAU,MAAMF;AAAA,IAAA,CACzD,GAEKG,IAAyB,CAACC,MAAmBA,MAAU,IAAI,MAAM,GAAGA,CAAK,MAEzEC,IAAsBN,EAAS,OAAO;AAAA,MAC1C,KAAKE,EAAM,OAAO,QAAQ,SAAYE,EAAuBF,EAAM,OAAO,GAAG,IAAI;AAAA,MACjF,OAAOA,EAAM,OAAO,UAAU,SAAYE,EAAuBF,EAAM,OAAO,KAAK,IAAI;AAAA,IACvF,EAAA,GAEIK,IAAgBC,EAAI,EAAK;AAE/B,WAAAC;AAAA,MACE,MAAMP,EAAM;AAAA,MACZ,CAACG,GAAOK,MAAa;AACf,QAACR,EAAM,WAIPQ,MAAaL,MACfE,EAAc,QAAQ,IAEtB,WAAW,MAAM;AACf,UAAAA,EAAc,QAAQ;AAAA,WACrB,GAAI;AAAA,MAEX;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../src/components/Badge/Badge.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, useCssModule, watch } from 'vue';\n\n defineOptions({\n name: 'll-badge',\n });\n\n const classes = useCssModule();\n\n export interface BadgeProps {\n /**\n * If true, the badge will animate when the content changes\n */\n animate?: boolean;\n\n /**\n * Color of the badge\n * Options: 'red' or 'blue'\n */\n color?: 'red' | 'blue';\n\n /**\n * The badge's content\n */\n content?: number | string;\n\n /**\n * Shows a gray badge with content\n */\n isDisabled?: boolean;\n\n /**\n * The max value of the `content` prop. If the value is greater than this, the badge will show the max value and a `+` sign.\n */\n max?: number | string;\n\n /**\n * Offset to adjust the badge's position. It does not apply to inline position badges.\n */\n offset?: {\n top?: number;\n right?: number;\n };\n\n /**\n * Badge position. Options:\n *\n * - inline: shows the badge directly next to the content (on the right), with a left margin of 6px\n * - top-right: will overlap the badge over whatever is passed in the default slot\n */\n position?: 'top-right' | 'inline';\n\n /**\n * The badge will be hidden if the content is `0` unless this prop is set to true.\n */\n showZero?: boolean;\n\n /**\n * Badge variant\n */\n variant?: 'dot' | 'standard';\n }\n\n const props = withDefaults(defineProps<BadgeProps>(), {\n animate: false,\n color: 'red',\n content: undefined,\n isDisabled: false,\n max: 99,\n position: 'top-right',\n offset: () => ({\n top: undefined,\n right: undefined,\n }),\n showZero: false,\n variant: 'standard',\n });\n\n const computedContent = computed(() => {\n const numericContent = parseInt(props.content as string, 10);\n const numericMax = parseInt(props.max as string, 10);\n // We want to compare the values, not the types, so it's okay to use `!=` here. i.e. if '23' = 23, then we know\n // the props are numbers, and we can compare the values. If you pass '23foobar' parseInt will return still return 23\n // but this check will fail like we want it to.\n // eslint-disable-next-line eqeqeq\n if (numericContent != props.content || numericMax != props.max) {\n return props.content;\n }\n\n return numericContent > numericMax ? `${numericMax}+` : numericContent;\n });\n\n const formatOffsetStyleValue = (value: number) => (value === 0 ? '0' : `${value}px`);\n\n const computedOffsetStyle = computed(() => ({\n top: props.offset.top !== undefined ? formatOffsetStyleValue(props.offset.top) : undefined,\n right: props.offset.right !== undefined ? formatOffsetStyleValue(props.offset.right) : undefined,\n }));\n\n const playAnimation = ref(false);\n\n watch(\n () => props.content,\n (value, oldValue) => {\n if (!props.animate) {\n return;\n }\n\n if (oldValue !== value) {\n playAnimation.value = true;\n\n setTimeout(() => {\n playAnimation.value = false;\n }, 1000);\n }\n },\n );\n</script>\n\n<template>\n <span class=\"stash-badge tw-relative tw-inline-block\" data-test=\"stash-badge\">\n <slot />\n <span\n v-show=\"props.variant === 'dot' || computedContent || (computedContent === 0 && props.showZero)\"\n data-test=\"stash-badge|content-wrapper\"\n :class=\"[\n {\n [classes['top-right']]: props.position === 'top-right' && props.variant !== 'dot',\n 'tw-absolute': props.variant === 'dot' || props.position === 'top-right',\n 'tw-ml-1.5': props.position === 'inline',\n },\n ]\"\n :style=\"props.variant === 'dot' || props.position === 'top-right' ? computedOffsetStyle : ''\"\n >\n <span\n data-test=\"stash-badge|content\"\n class=\"\n tw-text-white\n tw-font-semibold\n tw-rounded-full\n tw-text-[10px]\n tw-text-center\n tw-whitespace-nowrap\n tw-leading-[0.875rem]\n tw-inline-block\n \"\n :class=\"[\n {\n 'tw-animate-grow': playAnimation,\n 'tw-bg-red-500': props.color === 'red' && !props.isDisabled,\n 'tw-bg-blue-500': props.color === 'blue' && !props.isDisabled,\n 'tw-absolute': props.variant === 'dot',\n 'tw-bg-ice-200 tw-text-white': props.isDisabled,\n [classes['badge-dot']]: props.variant === 'dot',\n [classes['badge-standard']]: props.variant === 'standard',\n 'tw-px-1.5': props.variant !== 'dot',\n },\n ]\"\n >\n {{ props.variant === 'dot' ? null : computedContent }}\n </span>\n </span>\n </span>\n</template>\n\n<style module>\n .badge-standard {\n height: 15px;\n line-height: 1.05rem;\n vertical-align: middle;\n }\n\n .badge-dot {\n border: 2px solid theme('colors.ice.100');\n height: 10px;\n right: 0;\n width: 10px;\n }\n\n .top-right {\n top: 0;\n right: 0;\n transform: translateX(50%) translateY(-48%);\n }\n</style>\n"],"names":["classes","useCssModule","computedContent","computed","numericContent","props","numericMax","formatOffsetStyleValue","value","computedOffsetStyle","playAnimation","ref","watch","oldValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAOQA,IAAUC,KAuEVC,IAAkBC,EAAS,MAAM;AACrC,YAAMC,IAAiB,SAASC,EAAM,SAAmB,EAAE,GACrDC,IAAa,SAASD,EAAM,KAAe,EAAE;AAKnD,aAAID,KAAkBC,EAAM,WAAWC,KAAcD,EAAM,MAClDA,EAAM,UAGRD,IAAiBE,IAAa,GAAGA,CAAU,MAAMF;AAAA,IAAA,CACzD,GAEKG,IAAyB,CAACC,MAAmBA,MAAU,IAAI,MAAM,GAAGA,CAAK,MAEzEC,IAAsBN,EAAS,OAAO;AAAA,MAC1C,KAAKE,EAAM,OAAO,QAAQ,SAAYE,EAAuBF,EAAM,OAAO,GAAG,IAAI;AAAA,MACjF,OAAOA,EAAM,OAAO,UAAU,SAAYE,EAAuBF,EAAM,OAAO,KAAK,IAAI;AAAA,IACvF,EAAA,GAEIK,IAAgBC,EAAI,EAAK;AAE/B,WAAAC;AAAA,MACE,MAAMP,EAAM;AAAA,MACZ,CAACG,GAAOK,MAAa;AACf,QAACR,EAAM,WAIPQ,MAAaL,MACfE,EAAc,QAAQ,IAEtB,WAAW,MAAM;AACf,UAAAA,EAAc,QAAQ;AAAA,WACrB,GAAI;AAAA,MAEX;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Checkbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as _, useAttrs as g, useSlots as T, computed as a, openBlock as r, createElementBlock as s, normalizeClass as d, unref as c, withDirectives as E, createElementVNode as i, mergeProps as C, vModelCheckbox as V, renderSlot as v, toDisplayString as n, createTextVNode as A, createCommentVNode as B } from "vue";
|
|
2
2
|
import x from "lodash-es/uniqueId";
|
|
3
|
-
import "./Checkbox.
|
|
3
|
+
import "./Checkbox.vue_vue_type_style_index_0_scoped_0d7e7fd0_lang-4ed993c7.js";
|
|
4
4
|
import { _ as I } from "./_plugin-vue_export-helper-dad06003.js";
|
|
5
5
|
const N = ["data-test"], S = ["id", "aria-invalid", "aria-errormessage", "disabled", "value"], D = ["for"], $ = ["id"], q = /* @__PURE__ */ _({
|
|
6
6
|
name: "ll-checkbox",
|
|
@@ -55,7 +55,7 @@ const N = ["data-test"], S = ["id", "aria-invalid", "aria-errormessage", "disabl
|
|
|
55
55
|
"data-test": "stash-checkbox|label",
|
|
56
56
|
class: d(["tw-cursor-pointer tw-inline-block tw-text-sm tw-font-normal tw-leading-6 tw-min-h-9 tw-overflow-visible tw-py-1.5 tw-pl-8 tw-relative tw-align-top", {
|
|
57
57
|
"tw-text-ice-900": !l.value && !e.disabled,
|
|
58
|
-
"tw-text-red": l.value,
|
|
58
|
+
"tw-text-red-500": l.value,
|
|
59
59
|
"tw-text-ice-500": e.disabled
|
|
60
60
|
}]),
|
|
61
61
|
for: h.value
|
|
@@ -67,7 +67,7 @@ const N = ["data-test"], S = ["id", "aria-invalid", "aria-errormessage", "disabl
|
|
|
67
67
|
e.errorText ? (r(), s("span", {
|
|
68
68
|
key: 0,
|
|
69
69
|
id: p.value,
|
|
70
|
-
class: "tw-block tw-text-xs tw-text-red tw-ml-8 tw-whitespace-pre-line",
|
|
70
|
+
class: "tw-block tw-text-xs tw-text-red-500 tw-ml-8 tw-whitespace-pre-line",
|
|
71
71
|
"data-test": "stash-checkbox|error"
|
|
72
72
|
}, n(e.errorText), 9, $)) : e.hintText || c(f).hint ? (r(), s("span", {
|
|
73
73
|
key: 1,
|
|
@@ -80,7 +80,7 @@ const N = ["data-test"], S = ["id", "aria-invalid", "aria-errormessage", "disabl
|
|
|
80
80
|
], 2)) : B("", !0)
|
|
81
81
|
], 10, N));
|
|
82
82
|
}
|
|
83
|
-
}), U = /* @__PURE__ */ I(q, [["__scopeId", "data-v-
|
|
83
|
+
}), U = /* @__PURE__ */ I(q, [["__scopeId", "data-v-0d7e7fd0"]]);
|
|
84
84
|
export {
|
|
85
85
|
U as default
|
|
86
86
|
};
|
package/dist/Checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../src/components/Checkbox/Checkbox.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n export interface CheckboxProps {\n /**\n * Whether the checkbox is currently checked based on the current value.\n * Either defined by a boolean, or whether `checked` as an array includes `value`.\n */\n checked: boolean | Array<string | number>;\n\n /**\n * Whether the checkbox is in an error state (optional). For error styling without error text.\n */\n hasError?: boolean;\n\n /**\n * Unique ID for the checkbox, required for accessibility purposes\n */\n id?: string;\n\n /**\n * Label text to display with checkbox\n */\n label?: string;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) and adds error styling (overrides `hasError`).\n */\n errorText?: string;\n\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n\n /**\n * @deprecated use the `checked` prop instead\n */\n modelValue?: boolean | Array<string | number>;\n\n /**\n * The value of the checkbox.\n */\n value?: string | number;\n\n /**\n * Whether the checkbox is disabled.\n */\n disabled?: boolean;\n }\n\n defineOptions({\n name: 'll-checkbox',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<CheckboxProps>(), {\n checked: false,\n errorId: undefined,\n errorText: '',\n hasError: false,\n hintText: '',\n id: undefined,\n label: undefined,\n modelValue: undefined,\n value: undefined,\n disabled: false,\n });\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const emit =\n defineEmits<{\n (e: 'update:checked', value: CheckboxProps['checked']): void;\n }>();\n\n if (props.modelValue !== undefined) {\n throw new Error('ll-checkbox: use :checked or v-model:checked instead of :model-value and v-model.');\n }\n\n if (typeof props.value === 'boolean') {\n console.warn('ll-checkbox: use `checked` to toggle the state; `value` is what will be set if `checked` is true');\n }\n\n if (attrs.onChange) {\n throw new Error('ll-checkbox: use the @update:checked event instead of @change.');\n }\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs['data-test'];\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const internalValue = computed({\n get() {\n return props.checked;\n },\n set(value) {\n emit('update:checked', value);\n },\n });\n\n const internalHasError = computed(() => !!props.errorText || props.hasError);\n const checkboxId = computed(() => props.id || uniqueId('checkbox-'));\n const checkboxErrorId = computed(() => (props.errorText ? uniqueId('checkbox-error-') : undefined));\n</script>\n\n<template>\n <div\n class=\"tw-relative tw-m-0 stash-checkbox\"\n :data-test=\"attrs['data-test'] || 'stash-checkbox'\"\n :class=\"[{ 'has-error': internalHasError }, attrs.class]\"\n >\n <input\n :id=\"checkboxId\"\n v-model=\"internalValue\"\n :aria-invalid=\"!!props.errorText\"\n :aria-errormessage=\"checkboxErrorId\"\n :disabled=\"props.disabled\"\n class=\"tw-sr-only lg:tw-m-0\"\n type=\"checkbox\"\n :value=\"value\"\n v-bind=\"inputAttrs\"\n />\n\n <label\n data-test=\"stash-checkbox|label\"\n class=\"\n tw-cursor-pointer\n tw-inline-block\n tw-text-sm\n tw-font-normal\n tw-leading-6\n tw-min-h-9\n tw-overflow-visible\n tw-py-1.5\n tw-pl-8\n tw-relative\n tw-align-top\n \"\n :class=\"{\n 'tw-text-ice-900': !internalHasError && !props.disabled,\n 'tw-text-red': internalHasError,\n 'tw-text-ice-500': props.disabled,\n }\"\n :for=\"checkboxId\"\n >\n <slot>\n <span>{{ label }}</span>\n </slot>\n </label>\n\n <span\n v-if=\"props.errorText\"\n :id=\"checkboxErrorId\"\n class=\"tw-block tw-text-xs tw-text-red tw-ml-8 tw-whitespace-pre-line\"\n data-test=\"stash-checkbox|error\"\n >\n {{ props.errorText }}\n </span>\n <span\n v-else-if=\"props.hintText || slots.hint\"\n class=\"tw-block tw-text-xs tw-ml-8 tw-whitespace-pre-line\"\n :class=\"{ 'tw-text-ice-500': props.disabled }\"\n data-test=\"stash-checkbox|hint\"\n >\n <!-- @slot for displaying hint text -->\n <slot name=\"hint\">{{ props.hintText }}</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n input:disabled + label {\n cursor: auto;\n }\n\n label::before {\n content: '';\n border: 1px solid theme('colors.ice.500');\n display: inline-block;\n vertical-align: top;\n }\n\n label::before,\n label::after {\n border-radius: theme('borderRadius.DEFAULT');\n height: 20px;\n left: 0;\n position: absolute;\n top: theme('spacing[1.5]');\n width: 20px;\n }\n\n .has-error label::before,\n .has-error input {\n border-color: theme('colors.red.500');\n }\n\n input:indeterminate + label::after {\n content: url('data:image/svg+xml; utf8, <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6 10.4C6 10.1791 6.17909 10 6.4 10H17.6C17.8209 10 18 10.1791 18 10.4V12.6C18 12.8209 17.8209 13 17.6 13H6.4C6.17909 13 6 12.8209 6 12.6V10.4Z\" fill=\"white\"/></svg>');\n }\n\n input:checked + label::after {\n content: url('data:image/svg+xml; utf8, <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.89 8.281a.723.723 0 0 1 .22.531.723.723 0 0 1-.22.532l-6.718 6.719a.723.723 0 0 1-.531.218.723.723 0 0 1-.532-.218l-3.89-3.891A.723.723 0 0 1 6 11.64c0-.209.073-.386.219-.532l1.062-1.062a.723.723 0 0 1 .532-.219.72.72 0 0 1 .53.219l2.298 2.305 5.125-5.133a.723.723 0 0 1 .53-.219c.21 0 .386.073.532.219l1.063 1.062z\" fill=\"white\"/></svg>');\n background: theme('colors.blue.500');\n height: 20px;\n width: 20px;\n top: theme('spacing[1.5]');\n }\n\n input:checked + label::before,\n input:indeterminate + label::before {\n background: theme('colors.blue.500');\n border-color: theme('colors.blue.500');\n }\n\n input:disabled + label::before,\n input:disabled + label::after {\n background: theme('colors.ice.100');\n border: 1px solid theme('colors.ice.500');\n }\n\n input:disabled:is(:checked, :indeterminate) + label::after {\n background: theme('colors.ice.500');\n }\n\n input:not(:disabled, :checked, :indeterminate) + label:hover::before {\n border-color: theme('colors.blue.500');\n }\n</style>\n"],"names":["attrs","useAttrs","slots","useSlots","props","inputAttrs","computed","tempAttrs","internalValue","value","emit","internalHasError","checkboxId","uniqueId","checkboxErrorId"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAsEQA,IAAQC,KACRC,IAAQC;AAOV,QAAAC,EAAM,eAAe;AACjB,YAAA,IAAI,MAAM,mFAAmF;AAOrG,QAJI,OAAOA,EAAM,SAAU,aACzB,QAAQ,KAAK,kGAAkG,GAG7GJ,EAAM;AACF,YAAA,IAAI,MAAM,gEAAgE;AAG5E,UAAAK,IAAaC,EAAS,MAAM;AAC1B,YAAAC,IAAY,EAAE,GAAGP;AAEvB,oBAAOO,EAAU,WAAW,GAC5B,OAAOA,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAgBF,EAAS;AAAA,MAC7B,MAAM;AACJ,eAAOF,EAAM;AAAA,MACf;AAAA,MACA,IAAIK,GAAO;AACT,QAAAC,EAAK,kBAAkBD,CAAK;AAAA,MAC9B;AAAA,IAAA,CACD,GAEKE,IAAmBL,EAAS,MAAM,CAAC,CAACF,EAAM,aAAaA,EAAM,QAAQ,GACrEQ,IAAaN,EAAS,MAAMF,EAAM,MAAMS,EAAS,WAAW,CAAC,GAC7DC,IAAkBR,EAAS,MAAOF,EAAM,YAAYS,EAAS,iBAAiB,IAAI,MAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../src/components/Checkbox/Checkbox.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n export interface CheckboxProps {\n /**\n * Whether the checkbox is currently checked based on the current value.\n * Either defined by a boolean, or whether `checked` as an array includes `value`.\n */\n checked: boolean | Array<string | number>;\n\n /**\n * Whether the checkbox is in an error state (optional). For error styling without error text.\n */\n hasError?: boolean;\n\n /**\n * Unique ID for the checkbox, required for accessibility purposes\n */\n id?: string;\n\n /**\n * Label text to display with checkbox\n */\n label?: string;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) and adds error styling (overrides `hasError`).\n */\n errorText?: string;\n\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n\n /**\n * @deprecated use the `checked` prop instead\n */\n modelValue?: boolean | Array<string | number>;\n\n /**\n * The value of the checkbox.\n */\n value?: string | number;\n\n /**\n * Whether the checkbox is disabled.\n */\n disabled?: boolean;\n }\n\n defineOptions({\n name: 'll-checkbox',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<CheckboxProps>(), {\n checked: false,\n errorId: undefined,\n errorText: '',\n hasError: false,\n hintText: '',\n id: undefined,\n label: undefined,\n modelValue: undefined,\n value: undefined,\n disabled: false,\n });\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const emit =\n defineEmits<{\n (e: 'update:checked', value: CheckboxProps['checked']): void;\n }>();\n\n if (props.modelValue !== undefined) {\n throw new Error('ll-checkbox: use :checked or v-model:checked instead of :model-value and v-model.');\n }\n\n if (typeof props.value === 'boolean') {\n console.warn('ll-checkbox: use `checked` to toggle the state; `value` is what will be set if `checked` is true');\n }\n\n if (attrs.onChange) {\n throw new Error('ll-checkbox: use the @update:checked event instead of @change.');\n }\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs['data-test'];\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const internalValue = computed({\n get() {\n return props.checked;\n },\n set(value) {\n emit('update:checked', value);\n },\n });\n\n const internalHasError = computed(() => !!props.errorText || props.hasError);\n const checkboxId = computed(() => props.id || uniqueId('checkbox-'));\n const checkboxErrorId = computed(() => (props.errorText ? uniqueId('checkbox-error-') : undefined));\n</script>\n\n<template>\n <div\n class=\"tw-relative tw-m-0 stash-checkbox\"\n :data-test=\"attrs['data-test'] || 'stash-checkbox'\"\n :class=\"[{ 'has-error': internalHasError }, attrs.class]\"\n >\n <input\n :id=\"checkboxId\"\n v-model=\"internalValue\"\n :aria-invalid=\"!!props.errorText\"\n :aria-errormessage=\"checkboxErrorId\"\n :disabled=\"props.disabled\"\n class=\"tw-sr-only lg:tw-m-0\"\n type=\"checkbox\"\n :value=\"value\"\n v-bind=\"inputAttrs\"\n />\n\n <label\n data-test=\"stash-checkbox|label\"\n class=\"\n tw-cursor-pointer\n tw-inline-block\n tw-text-sm\n tw-font-normal\n tw-leading-6\n tw-min-h-9\n tw-overflow-visible\n tw-py-1.5\n tw-pl-8\n tw-relative\n tw-align-top\n \"\n :class=\"{\n 'tw-text-ice-900': !internalHasError && !props.disabled,\n 'tw-text-red-500': internalHasError,\n 'tw-text-ice-500': props.disabled,\n }\"\n :for=\"checkboxId\"\n >\n <slot>\n <span>{{ label }}</span>\n </slot>\n </label>\n\n <span\n v-if=\"props.errorText\"\n :id=\"checkboxErrorId\"\n class=\"tw-block tw-text-xs tw-text-red-500 tw-ml-8 tw-whitespace-pre-line\"\n data-test=\"stash-checkbox|error\"\n >\n {{ props.errorText }}\n </span>\n <span\n v-else-if=\"props.hintText || slots.hint\"\n class=\"tw-block tw-text-xs tw-ml-8 tw-whitespace-pre-line\"\n :class=\"{ 'tw-text-ice-500': props.disabled }\"\n data-test=\"stash-checkbox|hint\"\n >\n <!-- @slot for displaying hint text -->\n <slot name=\"hint\">{{ props.hintText }}</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n input:disabled + label {\n cursor: auto;\n }\n\n label::before {\n content: '';\n border: 1px solid theme('colors.ice.500');\n display: inline-block;\n vertical-align: top;\n }\n\n label::before,\n label::after {\n border-radius: theme('borderRadius.DEFAULT');\n height: 20px;\n left: 0;\n position: absolute;\n top: theme('spacing[1.5]');\n width: 20px;\n }\n\n .has-error label::before,\n .has-error input {\n border-color: theme('colors.red.500');\n }\n\n input:indeterminate + label::after {\n content: url('data:image/svg+xml; utf8, <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M6 10.4C6 10.1791 6.17909 10 6.4 10H17.6C17.8209 10 18 10.1791 18 10.4V12.6C18 12.8209 17.8209 13 17.6 13H6.4C6.17909 13 6 12.8209 6 12.6V10.4Z\" fill=\"white\"/></svg>');\n }\n\n input:checked + label::after {\n content: url('data:image/svg+xml; utf8, <svg viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M17.89 8.281a.723.723 0 0 1 .22.531.723.723 0 0 1-.22.532l-6.718 6.719a.723.723 0 0 1-.531.218.723.723 0 0 1-.532-.218l-3.89-3.891A.723.723 0 0 1 6 11.64c0-.209.073-.386.219-.532l1.062-1.062a.723.723 0 0 1 .532-.219.72.72 0 0 1 .53.219l2.298 2.305 5.125-5.133a.723.723 0 0 1 .53-.219c.21 0 .386.073.532.219l1.063 1.062z\" fill=\"white\"/></svg>');\n background: theme('colors.blue.500');\n height: 20px;\n width: 20px;\n top: theme('spacing[1.5]');\n }\n\n input:checked + label::before,\n input:indeterminate + label::before {\n background: theme('colors.blue.500');\n border-color: theme('colors.blue.500');\n }\n\n input:disabled + label::before,\n input:disabled + label::after {\n background: theme('colors.ice.100');\n border: 1px solid theme('colors.ice.500');\n }\n\n input:disabled:is(:checked, :indeterminate) + label::after {\n background: theme('colors.ice.500');\n }\n\n input:not(:disabled, :checked, :indeterminate) + label:hover::before {\n border-color: theme('colors.blue.500');\n }\n</style>\n"],"names":["attrs","useAttrs","slots","useSlots","props","inputAttrs","computed","tempAttrs","internalValue","value","emit","internalHasError","checkboxId","uniqueId","checkboxErrorId"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAsEQA,IAAQC,KACRC,IAAQC;AAOV,QAAAC,EAAM,eAAe;AACjB,YAAA,IAAI,MAAM,mFAAmF;AAOrG,QAJI,OAAOA,EAAM,SAAU,aACzB,QAAQ,KAAK,kGAAkG,GAG7GJ,EAAM;AACF,YAAA,IAAI,MAAM,gEAAgE;AAG5E,UAAAK,IAAaC,EAAS,MAAM;AAC1B,YAAAC,IAAY,EAAE,GAAGP;AAEvB,oBAAOO,EAAU,WAAW,GAC5B,OAAOA,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAgBF,EAAS;AAAA,MAC7B,MAAM;AACJ,eAAOF,EAAM;AAAA,MACf;AAAA,MACA,IAAIK,GAAO;AACT,QAAAC,EAAK,kBAAkBD,CAAK;AAAA,MAC9B;AAAA,IAAA,CACD,GAEKE,IAAmBL,EAAS,MAAM,CAAC,CAACF,EAAM,aAAaA,EAAM,QAAQ,GACrEQ,IAAaN,EAAS,MAAMF,EAAM,MAAMS,EAAS,WAAW,CAAC,GAC7DC,IAAkBR,EAAS,MAAOF,EAAM,YAAYS,EAAS,iBAAiB,IAAI,MAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
//# sourceMappingURL=Checkbox.
|
|
2
|
+
//# sourceMappingURL=Checkbox.vue_vue_type_style_index_0_scoped_0d7e7fd0_lang-4ed993c7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.vue_vue_type_style_index_0_scoped_0d7e7fd0_lang-4ed993c7.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/Chip.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import z from "./Icon.js";
|
|
1
|
+
import { defineComponent as h, useCssModule as f, openBlock as a, createElementBlock as i, normalizeClass as d, unref as l, renderSlot as u, withKeys as v, withModifiers as m, createVNode as C, createCommentVNode as b } from "vue";
|
|
2
|
+
import _ from "./utils/colorScheme.js";
|
|
3
|
+
import w from "./Icon.js";
|
|
5
4
|
import { _ as $ } from "./_plugin-vue_export-helper-dad06003.js";
|
|
6
5
|
import "lodash-es/uniqueId";
|
|
7
6
|
import "./index-79ce320f.js";
|
|
8
7
|
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
9
|
-
const
|
|
8
|
+
const y = /* @__PURE__ */ h({
|
|
10
9
|
name: "ll-chip",
|
|
11
10
|
__name: "Chip",
|
|
12
11
|
props: {
|
|
13
|
-
|
|
12
|
+
colorScheme: { default: "ice" },
|
|
14
13
|
shade: { default: "light" },
|
|
15
14
|
size: { default: "medium" },
|
|
16
15
|
radius: { default: "standard" },
|
|
@@ -20,12 +19,12 @@ const x = /* @__PURE__ */ c({
|
|
|
20
19
|
shouldOverrideColors: { type: Boolean, default: !1 }
|
|
21
20
|
},
|
|
22
21
|
emits: ["click", "remove"],
|
|
23
|
-
setup(
|
|
24
|
-
const e =
|
|
22
|
+
setup(c, { emit: n }) {
|
|
23
|
+
const e = c, s = f();
|
|
25
24
|
function p() {
|
|
26
|
-
const { computedBgColor: t, computedTextColor: o } =
|
|
25
|
+
const { computedBgColor: t, computedTextColor: o } = _({
|
|
27
26
|
shade: e.shade,
|
|
28
|
-
color: e.
|
|
27
|
+
color: e.colorScheme
|
|
29
28
|
}), r = `tw-text-${e.textColor || o} tw-bg-${e.bgColor || t}`;
|
|
30
29
|
return {
|
|
31
30
|
"tw-rounded-none": e.radius === "none",
|
|
@@ -34,47 +33,50 @@ const x = /* @__PURE__ */ c({
|
|
|
34
33
|
[r]: !e.shouldOverrideColors
|
|
35
34
|
};
|
|
36
35
|
}
|
|
37
|
-
return (t, o) => (
|
|
38
|
-
class:
|
|
39
|
-
`stash-chip--radius-${
|
|
36
|
+
return (t, o) => (a(), i("span", {
|
|
37
|
+
class: d(["stash-chip tw-inline-flex tw-items-center tw-relative", [
|
|
38
|
+
`stash-chip--radius-${e.radius}`,
|
|
39
|
+
`stash-chip--size-${e.size}`,
|
|
40
|
+
`stash-chip--shade-${e.shade}`,
|
|
40
41
|
l(s).root,
|
|
41
42
|
l(s).removableChip,
|
|
42
|
-
l(s)[`size-${
|
|
43
|
+
l(s)[`size-${e.size}`],
|
|
43
44
|
p()
|
|
44
45
|
]]),
|
|
45
46
|
"data-test": "stash-chip",
|
|
46
47
|
onClick: o[2] || (o[2] = (r) => n("click"))
|
|
47
48
|
}, [
|
|
48
|
-
|
|
49
|
-
class: a([{ "tw-mr-6 tw-truncate": t.isRemovable }])
|
|
50
|
-
}, [
|
|
51
|
-
h(t.$slots, "default")
|
|
52
|
-
], 2),
|
|
53
|
-
t.isRemovable ? (i(), d("button", {
|
|
49
|
+
t.isRemovable ? (a(), i("span", {
|
|
54
50
|
key: 0,
|
|
51
|
+
class: d([{ "tw-mr-6 tw-truncate": e.isRemovable }])
|
|
52
|
+
}, [
|
|
53
|
+
u(t.$slots, "default")
|
|
54
|
+
], 2)) : u(t.$slots, "default", { key: 1 }),
|
|
55
|
+
e.isRemovable ? (a(), i("button", {
|
|
56
|
+
key: 2,
|
|
55
57
|
tabindex: "-1",
|
|
56
|
-
class:
|
|
58
|
+
class: d(["stash-chip__remove-button", ["tw-absolute", l(s)["remove-button"]]]),
|
|
57
59
|
"data-test": "stash-chip|remove-button",
|
|
58
|
-
onKeypress: o[0] || (o[0] =
|
|
60
|
+
onKeypress: o[0] || (o[0] = v(m((r) => n("remove"), ["prevent"]), ["enter"])),
|
|
59
61
|
onMousedown: o[1] || (o[1] = m((r) => n("remove"), ["prevent", "stop"]))
|
|
60
62
|
}, [
|
|
61
|
-
|
|
63
|
+
C(w, {
|
|
62
64
|
"data-test": "icon|close",
|
|
63
65
|
name: "close",
|
|
64
66
|
size: "small"
|
|
65
67
|
})
|
|
66
|
-
], 34)) :
|
|
68
|
+
], 34)) : b("", !0)
|
|
67
69
|
], 2));
|
|
68
70
|
}
|
|
69
|
-
}),
|
|
70
|
-
root:
|
|
71
|
+
}), z = "_root_jxnu3_2", x = {
|
|
72
|
+
root: z,
|
|
71
73
|
"size-medium": "_size-medium_jxnu3_12",
|
|
72
74
|
"size-small": "_size-small_jxnu3_17",
|
|
73
75
|
"remove-button": "_remove-button_jxnu3_22"
|
|
74
|
-
},
|
|
75
|
-
$style:
|
|
76
|
-
},
|
|
76
|
+
}, k = {
|
|
77
|
+
$style: x
|
|
78
|
+
}, N = /* @__PURE__ */ $(y, [["__cssModules", k]]);
|
|
77
79
|
export {
|
|
78
|
-
|
|
80
|
+
N as default
|
|
79
81
|
};
|
|
80
82
|
//# sourceMappingURL=Chip.js.map
|
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 {
|
|
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 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 });\n\n const emit =\n 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 = `tw-text-${props.textColor || computedTextColor} tw-bg-${props.bgColor || computedBgColor}`;\n\n return {\n 'tw-rounded-none': props.radius === 'none',\n 'tw-rounded-sm': props.radius === 'standard',\n 'tw-rounded-full': props.radius === 'pill',\n [colorStyles]: !props.shouldOverrideColors,\n };\n }\n</script>\n\n<template>\n <span\n class=\"stash-chip tw-inline-flex tw-items-center tw-relative\"\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=\"[{ 'tw-mr-6 tw-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=\"['tw-absolute', classes['remove-button']]\"\n data-test=\"stash-chip|remove-button\"\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 .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 tw-leading-none tw-font-semibold tw-uppercase tw-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:hover {\n background: rgb(0 0 0 / 10%);\n }\n</style>\n"],"names":["classes","useCssModule","determineConditionalStyles","computedBgColor","computedTextColor","colorSchemeUtil","props","colorStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBA+EQA,IAAUC;AAEhB,aAASC,IAA6B;AACpC,YAAM,EAAE,iBAAAC,GAAiB,mBAAAC,EAAkB,IAAIC,EAAgB;AAAA,QAC7D,OAAOC,EAAM;AAAA,QACb,OAAOA,EAAM;AAAA,MAAA,CACd,GAEKC,IAAc,WAAWD,EAAM,aAAaF,CAAiB,UAAUE,EAAM,WAAWH,CAAe;AAEtG,aAAA;AAAA,QACL,mBAAmBG,EAAM,WAAW;AAAA,QACpC,iBAAiBA,EAAM,WAAW;AAAA,QAClC,mBAAmBA,EAAM,WAAW;AAAA,QACpC,CAACC,CAAW,GAAG,CAACD,EAAM;AAAA,MAAA;AAAA,IAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Chip.vue.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export declare interface ChipProps {
|
|
|
38
38
|
* The color for the chip that determines both the text and bg color. Needs to
|
|
39
39
|
* be one of the brand colors in our design system (not a shade).
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
colorScheme?: StashPrimaryColorGroup;
|
|
42
42
|
/**
|
|
43
43
|
* The shade of the provided color to use for the background color. This effects the inferred
|
|
44
44
|
* text color unless a specific text color is provided. Currently only `light` and `main`
|
|
@@ -56,11 +56,11 @@ export declare interface ChipProps {
|
|
|
56
56
|
/**
|
|
57
57
|
* The background color of the chip. Needs to be one of our design system colors.
|
|
58
58
|
*/
|
|
59
|
-
bgColor?:
|
|
59
|
+
bgColor?: StashCommonColor;
|
|
60
60
|
/**
|
|
61
61
|
* The color of the chip text. Needs to be one of our design system colors.
|
|
62
62
|
*/
|
|
63
|
-
textColor?:
|
|
63
|
+
textColor?: StashCommonColor;
|
|
64
64
|
/**
|
|
65
65
|
* Determines if a close icon is surfaced.
|
|
66
66
|
*/
|
|
@@ -74,7 +74,7 @@ export declare interface ChipProps {
|
|
|
74
74
|
declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChipProps>, {
|
|
75
75
|
size: string;
|
|
76
76
|
radius: string;
|
|
77
|
-
|
|
77
|
+
colorScheme: string;
|
|
78
78
|
shade: string;
|
|
79
79
|
bgColor: undefined;
|
|
80
80
|
textColor: undefined;
|
|
@@ -86,7 +86,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
86
86
|
}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChipProps>, {
|
|
87
87
|
size: string;
|
|
88
88
|
radius: string;
|
|
89
|
-
|
|
89
|
+
colorScheme: string;
|
|
90
90
|
shade: string;
|
|
91
91
|
bgColor: undefined;
|
|
92
92
|
textColor: undefined;
|
|
@@ -96,12 +96,12 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
96
96
|
onClick?: (() => any) | undefined;
|
|
97
97
|
onRemove?: (() => any) | undefined;
|
|
98
98
|
}, {
|
|
99
|
-
color: "blue" | "red" | "green" | "royal" | "purple" | "ice" | "orange" | "seafoam" | "teal" | "yellow";
|
|
100
99
|
size: "small" | "medium";
|
|
101
100
|
shade: "main" | "light";
|
|
101
|
+
colorScheme: StashPrimaryColorGroup;
|
|
102
102
|
radius: "standard" | "none" | "pill";
|
|
103
|
-
bgColor: "
|
|
104
|
-
textColor: "
|
|
103
|
+
bgColor: "ice-700" | "purple-700" | "purple-500" | "purple-100" | "royal-700" | "royal-500" | "royal-100" | "blue-700" | "blue-500" | "blue-100" | "teal-700" | "teal-500" | "teal-100" | "green-700" | "green-500" | "green-100" | "seafoam-700" | "seafoam-500" | "seafoam-100" | "yellow-700" | "yellow-500" | "yellow-100" | "orange-700" | "orange-500" | "orange-100" | "red-700" | "red-500" | "red-100" | "ice-500" | "ice-200" | "ice-100" | "white" | "black";
|
|
104
|
+
textColor: "ice-700" | "purple-700" | "purple-500" | "purple-100" | "royal-700" | "royal-500" | "royal-100" | "blue-700" | "blue-500" | "blue-100" | "teal-700" | "teal-500" | "teal-100" | "green-700" | "green-500" | "green-100" | "seafoam-700" | "seafoam-500" | "seafoam-100" | "yellow-700" | "yellow-500" | "yellow-100" | "orange-700" | "orange-500" | "orange-100" | "red-700" | "red-500" | "red-100" | "ice-500" | "ice-200" | "ice-100" | "white" | "black";
|
|
105
105
|
isRemovable: boolean;
|
|
106
106
|
shouldOverrideColors: boolean;
|
|
107
107
|
}, {}>, {
|
|
@@ -109,129 +109,50 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
|
|
|
109
109
|
}>;
|
|
110
110
|
export default _default;
|
|
111
111
|
|
|
112
|
-
declare type
|
|
112
|
+
declare type StashCommonColor = `${StashCommonColors}`;
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
/**
|
|
115
|
+
* A limited list of stash brand colors, only including their 100, 500, and 700 shades.
|
|
116
|
+
*/
|
|
117
|
+
declare enum StashCommonColors {
|
|
118
118
|
Purple700 = "purple-700",
|
|
119
|
-
Purple600 = "purple-600",
|
|
120
119
|
Purple500 = "purple-500",
|
|
121
|
-
Purple400 = "purple-400",
|
|
122
|
-
Purple300 = "purple-300",
|
|
123
|
-
Purple200 = "purple-200",
|
|
124
120
|
Purple100 = "purple-100",
|
|
125
|
-
Royal = "royal",
|
|
126
|
-
Royal900 = "royal-900",
|
|
127
|
-
Royal800 = "royal-800",
|
|
128
121
|
Royal700 = "royal-700",
|
|
129
|
-
Royal600 = "royal-600",
|
|
130
122
|
Royal500 = "royal-500",
|
|
131
|
-
Royal400 = "royal-400",
|
|
132
|
-
Royal300 = "royal-300",
|
|
133
|
-
Royal200 = "royal-200",
|
|
134
123
|
Royal100 = "royal-100",
|
|
135
|
-
Blue = "blue",
|
|
136
|
-
Blue900 = "blue-900",
|
|
137
|
-
Blue800 = "blue-800",
|
|
138
124
|
Blue700 = "blue-700",
|
|
139
|
-
Blue600 = "blue-600",
|
|
140
125
|
Blue500 = "blue-500",
|
|
141
|
-
Blue400 = "blue-400",
|
|
142
|
-
Blue300 = "blue-300",
|
|
143
|
-
Blue200 = "blue-200",
|
|
144
126
|
Blue100 = "blue-100",
|
|
145
|
-
Teal = "teal",
|
|
146
|
-
Teal900 = "teal-900",
|
|
147
|
-
Teal800 = "teal-800",
|
|
148
127
|
Teal700 = "teal-700",
|
|
149
|
-
Teal600 = "teal-600",
|
|
150
128
|
Teal500 = "teal-500",
|
|
151
|
-
Teal400 = "teal-400",
|
|
152
|
-
Teal300 = "teal-300",
|
|
153
|
-
Teal200 = "teal-200",
|
|
154
129
|
Teal100 = "teal-100",
|
|
155
|
-
Green = "green",
|
|
156
|
-
Green900 = "green-900",
|
|
157
|
-
Green800 = "green-800",
|
|
158
130
|
Green700 = "green-700",
|
|
159
|
-
Green600 = "green-600",
|
|
160
131
|
Green500 = "green-500",
|
|
161
|
-
Green400 = "green-400",
|
|
162
|
-
Green300 = "green-300",
|
|
163
|
-
Green200 = "green-200",
|
|
164
132
|
Green100 = "green-100",
|
|
165
|
-
Seafoam = "seafoam",
|
|
166
|
-
Seafoam900 = "seafoam-900",
|
|
167
|
-
Seafoam800 = "seafoam-800",
|
|
168
133
|
Seafoam700 = "seafoam-700",
|
|
169
|
-
Seafoam600 = "seafoam-600",
|
|
170
134
|
Seafoam500 = "seafoam-500",
|
|
171
|
-
Seafoam400 = "seafoam-400",
|
|
172
|
-
Seafoam300 = "seafoam-300",
|
|
173
|
-
Seafoam200 = "seafoam-200",
|
|
174
135
|
Seafoam100 = "seafoam-100",
|
|
175
|
-
Yellow = "yellow",
|
|
176
|
-
Yellow900 = "yellow-900",
|
|
177
|
-
Yellow800 = "yellow-800",
|
|
178
136
|
Yellow700 = "yellow-700",
|
|
179
|
-
Yellow600 = "yellow-600",
|
|
180
137
|
Yellow500 = "yellow-500",
|
|
181
|
-
Yellow400 = "yellow-400",
|
|
182
|
-
Yellow300 = "yellow-300",
|
|
183
|
-
Yellow200 = "yellow-200",
|
|
184
138
|
Yellow100 = "yellow-100",
|
|
185
|
-
Orange = "orange",
|
|
186
|
-
Orange900 = "orange-900",
|
|
187
|
-
Orange800 = "orange-800",
|
|
188
139
|
Orange700 = "orange-700",
|
|
189
|
-
Orange600 = "orange-600",
|
|
190
140
|
Orange500 = "orange-500",
|
|
191
|
-
Orange400 = "orange-400",
|
|
192
|
-
Orange300 = "orange-300",
|
|
193
|
-
Orange200 = "orange-200",
|
|
194
141
|
Orange100 = "orange-100",
|
|
195
|
-
Red = "red",
|
|
196
|
-
Red900 = "red-900",
|
|
197
|
-
Red800 = "red-800",
|
|
198
142
|
Red700 = "red-700",
|
|
199
|
-
Red600 = "red-600",
|
|
200
143
|
Red500 = "red-500",
|
|
201
|
-
Red400 = "red-400",
|
|
202
|
-
Red300 = "red-300",
|
|
203
|
-
Red200 = "red-200",
|
|
204
144
|
Red100 = "red-100",
|
|
205
|
-
Ice = "ice",
|
|
206
|
-
Ice900 = "ice-900",
|
|
207
|
-
Ice800 = "ice-800",
|
|
208
145
|
Ice700 = "ice-700",
|
|
209
|
-
Ice600 = "ice-600",
|
|
210
146
|
Ice500 = "ice-500",
|
|
211
|
-
|
|
212
|
-
Ice300 = "ice-300",
|
|
213
|
-
Ice200 = "ice-200",
|
|
147
|
+
Ice200 = "ice-200",// This is the one outlier, but it's used purposefully in a few places
|
|
214
148
|
Ice100 = "ice-100",
|
|
215
149
|
White = "white",
|
|
216
150
|
Black = "black"
|
|
217
151
|
}
|
|
218
152
|
|
|
219
|
-
declare type StashPrimaryColor = `${StashPrimaryColors}`;
|
|
220
|
-
|
|
221
153
|
/**
|
|
222
|
-
*
|
|
154
|
+
* The names of the color groups.
|
|
223
155
|
*/
|
|
224
|
-
declare
|
|
225
|
-
Blue = "blue",
|
|
226
|
-
Green = "green",
|
|
227
|
-
Ice = "ice",
|
|
228
|
-
Orange = "orange",
|
|
229
|
-
Purple = "purple",
|
|
230
|
-
Red = "red",
|
|
231
|
-
Royal = "royal",
|
|
232
|
-
Seafoam = "seafoam",
|
|
233
|
-
Teal = "teal",
|
|
234
|
-
Yellow = "yellow"
|
|
235
|
-
}
|
|
156
|
+
declare type StashPrimaryColorGroup = 'blue' | 'green' | 'ice' | 'orange' | 'purple' | 'red' | 'royal' | 'seafoam' | 'teal' | 'yellow';
|
|
236
157
|
|
|
237
158
|
export { }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as k, useCssModule as C, ref as m, watch as y, openBlock as c, createElementBlock as i, createElementVNode as E, Fragment as I, renderList as N, withDirectives as T, normalizeClass as p, unref as f, vModelText as D, toDisplayString as v, createCommentVNode as _ } from "vue";
|
|
2
2
|
import { _ as S } from "./_plugin-vue_export-helper-dad06003.js";
|
|
3
|
-
const
|
|
3
|
+
const B = { class: "tw-flex tw-gap-6 tw-mb-3" }, M = ["onUpdate:modelValue", "onPaste", "onKeyup", "onClick"], K = /* @__PURE__ */ k({
|
|
4
4
|
__name: "ConfirmationCodeInput",
|
|
5
5
|
props: {
|
|
6
6
|
digitCount: { default: 6 },
|
|
@@ -8,9 +8,9 @@ const j = { class: "tw-flex tw-gap-6 tw-mb-3" }, B = ["onUpdate:modelValue", "on
|
|
|
8
8
|
successText: { default: void 0 }
|
|
9
9
|
},
|
|
10
10
|
emits: ["update:model-value"],
|
|
11
|
-
setup(
|
|
12
|
-
const a =
|
|
13
|
-
function
|
|
11
|
+
setup(x, { emit: d }) {
|
|
12
|
+
const a = x, l = C(), s = m([]), n = m();
|
|
13
|
+
function w(e) {
|
|
14
14
|
e.data && e.target.nextElementSibling ? e.target.nextElementSibling.focus() : e.data == null && e.target.previousElementSibling && e.target.previousElementSibling.focus();
|
|
15
15
|
}
|
|
16
16
|
function g(e, o) {
|
|
@@ -23,7 +23,7 @@ const j = { class: "tw-flex tw-gap-6 tw-mb-3" }, B = ["onUpdate:modelValue", "on
|
|
|
23
23
|
u && (t = r + 1);
|
|
24
24
|
}), n.value[t].focus();
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function h(e, o) {
|
|
27
27
|
if (e.key !== "Backspace" && !new RegExp("^([0-9])$").test(e.key)) {
|
|
28
28
|
e.preventDefault();
|
|
29
29
|
return;
|
|
@@ -44,7 +44,7 @@ const j = { class: "tw-flex tw-gap-6 tw-mb-3" }, B = ["onUpdate:modelValue", "on
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function b(e) {
|
|
48
48
|
var u;
|
|
49
49
|
const o = (u = e.clipboardData) == null ? void 0 : u.getData("text");
|
|
50
50
|
if (isNaN(Number(o))) {
|
|
@@ -56,7 +56,7 @@ const j = { class: "tw-flex tw-gap-6 tw-mb-3" }, B = ["onUpdate:modelValue", "on
|
|
|
56
56
|
for (let r = 1; r < o.length; r++)
|
|
57
57
|
t && (s.value[r] = o[r], t = t.nextElementSibling);
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return y(
|
|
60
60
|
() => s,
|
|
61
61
|
(e) => {
|
|
62
62
|
if (e.value.join("") === "")
|
|
@@ -74,9 +74,9 @@ const j = { class: "tw-flex tw-gap-6 tw-mb-3" }, B = ["onUpdate:modelValue", "on
|
|
|
74
74
|
ref: "otpCont",
|
|
75
75
|
class: "stash-confirmation-code-input tw-inline-block",
|
|
76
76
|
"data-test": "stash-confirmation-code-input",
|
|
77
|
-
onInput:
|
|
77
|
+
onInput: w
|
|
78
78
|
}, [
|
|
79
|
-
E("div",
|
|
79
|
+
E("div", B, [
|
|
80
80
|
(c(!0), i(I, null, N(a.digitCount, (t, u) => T((c(), i("input", {
|
|
81
81
|
key: t,
|
|
82
82
|
ref_for: !0,
|
|
@@ -92,33 +92,33 @@ const j = { class: "tw-flex tw-gap-6 tw-mb-3" }, B = ["onUpdate:modelValue", "on
|
|
|
92
92
|
{ [f(l)["has-success"]]: !!a.successText }
|
|
93
93
|
]]),
|
|
94
94
|
inputmode: "numeric",
|
|
95
|
-
onPaste: (r) => t === 1 &&
|
|
96
|
-
onKeyup: (r) =>
|
|
95
|
+
onPaste: (r) => t === 1 && b(r),
|
|
96
|
+
onKeyup: (r) => h(r, u),
|
|
97
97
|
onClick: (r) => g(r, u)
|
|
98
|
-
}, null, 42,
|
|
98
|
+
}, null, 42, M)), [
|
|
99
99
|
[D, s.value[t - 1]]
|
|
100
100
|
])), 128))
|
|
101
101
|
]),
|
|
102
102
|
a.errorText ? (c(), i("small", {
|
|
103
103
|
key: 0,
|
|
104
|
-
class: p(["tw-block tw-text-red tw-text-center", f(l).error]),
|
|
104
|
+
class: p(["tw-block tw-text-red-500 tw-text-center", f(l).error]),
|
|
105
105
|
"data-test": "field-error"
|
|
106
106
|
}, v(a.errorText), 3)) : _("", !0),
|
|
107
107
|
a.successText ? (c(), i("small", {
|
|
108
108
|
key: 1,
|
|
109
|
-
class: p(["tw-block tw-text-green tw-text-center", f(l).error]),
|
|
109
|
+
class: p(["tw-block tw-text-green-500 tw-text-center", f(l).error]),
|
|
110
110
|
"data-test": "field-error"
|
|
111
111
|
}, v(a.successText), 3)) : _("", !0)
|
|
112
112
|
], 544));
|
|
113
113
|
}
|
|
114
|
-
}),
|
|
115
|
-
otpCodeInput:
|
|
116
|
-
"has-error": "_has-
|
|
117
|
-
"has-success": "_has-
|
|
118
|
-
error:
|
|
119
|
-
},
|
|
120
|
-
$style:
|
|
121
|
-
}, V = /* @__PURE__ */ S(
|
|
114
|
+
}), P = "_otpCodeInput_1wm2s_2", U = "_error_1wm2s_21", $ = {
|
|
115
|
+
otpCodeInput: P,
|
|
116
|
+
"has-error": "_has-error_1wm2s_9",
|
|
117
|
+
"has-success": "_has-success_1wm2s_13",
|
|
118
|
+
error: U
|
|
119
|
+
}, j = {
|
|
120
|
+
$style: $
|
|
121
|
+
}, V = /* @__PURE__ */ S(K, [["__cssModules", j]]);
|
|
122
122
|
export {
|
|
123
123
|
V as default
|
|
124
124
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationCodeInput.js","sources":["../src/components/ConfirmationCodeInput/ConfirmationCodeInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { 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\n const props = withDefaults(defineProps<VerificationCodeInputProps>(), {\n digitCount: 6,\n errorText: undefined,\n successText: undefined,\n });\n\n const emit =\n defineEmits<{\n (e: 'update:model-value', value: number | null): void;\n }>();\n\n const data: Ref<Array<string>> = ref([]);\n const inputEl = ref();\n\n function handleOtpInput(e) {\n if (e.data && e.target.nextElementSibling) {\n e.target.nextElementSibling.focus();\n } else if (e.data == null && e.target.previousElementSibling) {\n e.target.previousElementSibling.focus();\n }\n }\n\n function handleFocus(event, elementIndex: number) {\n event.preventDefault();\n\n if (data.value[elementIndex]) {\n inputEl.value[elementIndex].focus();\n\n return;\n }\n\n let focusedIndex = 0;\n\n data.value.forEach((value, index) => {\n if (value) {\n focusedIndex = index + 1;\n }\n });\n\n inputEl.value[focusedIndex].focus();\n }\n\n function handleKeyUp(e: KeyboardEvent, index: number) {\n if (e.key !== 'Backspace' && !new RegExp('^([0-9])$').test(e.key)) {\n e.preventDefault();\n return;\n }\n\n let focusedIndex = 0;\n\n if (index !== 0) {\n focusedIndex = index - 1;\n } else {\n focusedIndex = 0;\n }\n\n if (e.key === 'Backspace') {\n if (index + 1 === data.value.length - 1 && data.value[index]) {\n inputEl.value[index + 1].focus();\n return;\n }\n\n if (data.value[index]) {\n return;\n }\n\n data.value[focusedIndex] = '';\n inputEl.value[focusedIndex].focus();\n\n return;\n }\n\n if (!new RegExp('^([0-9])$').test(e.key) && !data.value[index]) {\n data.value[focusedIndex] = '';\n inputEl.value[focusedIndex].focus();\n return;\n }\n }\n\n function handlePaste(e: ClipboardEvent) {\n const pasteData = e.clipboardData?.getData('text');\n\n if (isNaN(Number(pasteData))) {\n inputEl.value[0].focus();\n return;\n }\n\n let nextEl = inputEl.value[0].nextElementSibling;\n if (pasteData) {\n for (let i = 1; i < pasteData.length; i++) {\n if (nextEl) {\n data.value[i] = pasteData[i];\n nextEl = nextEl.nextElementSibling;\n }\n }\n }\n }\n\n watch(\n () => data,\n (newVal) => {\n if (newVal.value.join('') === '') {\n emit('update:model-value', null);\n } else {\n if (isNaN(Number(newVal.value[0]))) {\n data.value[0] = '';\n return;\n }\n emit('update:model-value', Number(newVal.value.join('')));\n }\n },\n { deep: true },\n );\n</script>\n\n<template>\n <form\n ref=\"otpCont\"\n class=\"stash-confirmation-code-input tw-inline-block\"\n data-test=\"stash-confirmation-code-input\"\n @input=\"handleOtpInput\"\n >\n <div class=\"tw-flex tw-gap-6 tw-mb-3\">\n <template v-for=\"(field, index) in props.digitCount\" :key=\"field\">\n <input\n ref=\"inputEl\"\n v-model=\"data[field - 1]\"\n data-test=\"stash-confirmation-code-input__otp\"\n type=\"text\"\n maxlength=\"1\"\n class=\"tw-p-2 tw-border focus:tw-border-blue-500 tw-text-center tw-text-ice-900 tw-font-medium tw-text-base\"\n :class=\"[\n classes.otpCodeInput,\n { [classes['has-error']]: !!props.errorText },\n { [classes['has-success']]: !!props.successText },\n ]\"\n inputmode=\"numeric\"\n @paste=\"field === 1 && handlePaste($event)\"\n @keyup=\"handleKeyUp($event, index)\"\n @click=\"(evt) => handleFocus(evt, index)\"\n />\n </template>\n </div>\n <small\n v-if=\"props.errorText\"\n class=\"tw-block tw-text-red tw-text-center\"\n :class=\"classes.error\"\n data-test=\"field-error\"\n >\n {{ props.errorText }}\n </small>\n <small\n v-if=\"props.successText\"\n class=\"tw-block tw-text-green tw-text-center\"\n :class=\"classes.error\"\n data-test=\"field-error\"\n >\n {{ props.successText }}\n </small>\n </form>\n</template>\n\n<style module>\n .otpCodeInput {\n border-radius: 4px;\n caret-color: transparent;\n height: 36px;\n width: 36px;\n }\n\n .otpCodeInput.has-error:not(:focus) {\n border-color: theme(colors.red.
|
|
1
|
+
{"version":3,"file":"ConfirmationCodeInput.js","sources":["../src/components/ConfirmationCodeInput/ConfirmationCodeInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { 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\n const props = withDefaults(defineProps<VerificationCodeInputProps>(), {\n digitCount: 6,\n errorText: undefined,\n successText: undefined,\n });\n\n const emit =\n defineEmits<{\n (e: 'update:model-value', value: number | null): void;\n }>();\n\n const data: Ref<Array<string>> = ref([]);\n const inputEl = ref();\n\n function handleOtpInput(e) {\n if (e.data && e.target.nextElementSibling) {\n e.target.nextElementSibling.focus();\n } else if (e.data == null && e.target.previousElementSibling) {\n e.target.previousElementSibling.focus();\n }\n }\n\n function handleFocus(event, elementIndex: number) {\n event.preventDefault();\n\n if (data.value[elementIndex]) {\n inputEl.value[elementIndex].focus();\n\n return;\n }\n\n let focusedIndex = 0;\n\n data.value.forEach((value, index) => {\n if (value) {\n focusedIndex = index + 1;\n }\n });\n\n inputEl.value[focusedIndex].focus();\n }\n\n function handleKeyUp(e: KeyboardEvent, index: number) {\n if (e.key !== 'Backspace' && !new RegExp('^([0-9])$').test(e.key)) {\n e.preventDefault();\n return;\n }\n\n let focusedIndex = 0;\n\n if (index !== 0) {\n focusedIndex = index - 1;\n } else {\n focusedIndex = 0;\n }\n\n if (e.key === 'Backspace') {\n if (index + 1 === data.value.length - 1 && data.value[index]) {\n inputEl.value[index + 1].focus();\n return;\n }\n\n if (data.value[index]) {\n return;\n }\n\n data.value[focusedIndex] = '';\n inputEl.value[focusedIndex].focus();\n\n return;\n }\n\n if (!new RegExp('^([0-9])$').test(e.key) && !data.value[index]) {\n data.value[focusedIndex] = '';\n inputEl.value[focusedIndex].focus();\n return;\n }\n }\n\n function handlePaste(e: ClipboardEvent) {\n const pasteData = e.clipboardData?.getData('text');\n\n if (isNaN(Number(pasteData))) {\n inputEl.value[0].focus();\n return;\n }\n\n let nextEl = inputEl.value[0].nextElementSibling;\n if (pasteData) {\n for (let i = 1; i < pasteData.length; i++) {\n if (nextEl) {\n data.value[i] = pasteData[i];\n nextEl = nextEl.nextElementSibling;\n }\n }\n }\n }\n\n watch(\n () => data,\n (newVal) => {\n if (newVal.value.join('') === '') {\n emit('update:model-value', null);\n } else {\n if (isNaN(Number(newVal.value[0]))) {\n data.value[0] = '';\n return;\n }\n emit('update:model-value', Number(newVal.value.join('')));\n }\n },\n { deep: true },\n );\n</script>\n\n<template>\n <form\n ref=\"otpCont\"\n class=\"stash-confirmation-code-input tw-inline-block\"\n data-test=\"stash-confirmation-code-input\"\n @input=\"handleOtpInput\"\n >\n <div class=\"tw-flex tw-gap-6 tw-mb-3\">\n <template v-for=\"(field, index) in props.digitCount\" :key=\"field\">\n <input\n ref=\"inputEl\"\n v-model=\"data[field - 1]\"\n data-test=\"stash-confirmation-code-input__otp\"\n type=\"text\"\n maxlength=\"1\"\n class=\"tw-p-2 tw-border focus:tw-border-blue-500 tw-text-center tw-text-ice-900 tw-font-medium tw-text-base\"\n :class=\"[\n classes.otpCodeInput,\n { [classes['has-error']]: !!props.errorText },\n { [classes['has-success']]: !!props.successText },\n ]\"\n inputmode=\"numeric\"\n @paste=\"field === 1 && handlePaste($event)\"\n @keyup=\"handleKeyUp($event, index)\"\n @click=\"(evt) => handleFocus(evt, index)\"\n />\n </template>\n </div>\n <small\n v-if=\"props.errorText\"\n class=\"tw-block tw-text-red-500 tw-text-center\"\n :class=\"classes.error\"\n data-test=\"field-error\"\n >\n {{ props.errorText }}\n </small>\n <small\n v-if=\"props.successText\"\n class=\"tw-block tw-text-green-500 tw-text-center\"\n :class=\"classes.error\"\n data-test=\"field-error\"\n >\n {{ props.successText }}\n </small>\n </form>\n</template>\n\n<style module>\n .otpCodeInput {\n border-radius: 4px;\n caret-color: transparent;\n height: 36px;\n width: 36px;\n }\n\n .otpCodeInput.has-error:not(:focus) {\n border-color: theme('colors.red.500');\n }\n\n .otpCodeInput.has-success:not(:focus) {\n border-color: theme('colors.green.500');\n }\n\n .otpCodeInput:focus {\n outline: none;\n }\n\n .error {\n margin-top: 4px;\n white-space: pre-line;\n }\n</style>\n"],"names":["classes","useCssModule","data","ref","inputEl","handleOtpInput","handleFocus","event","elementIndex","focusedIndex","value","index","handleKeyUp","handlePaste","pasteData","_a","nextEl","i","watch","newVal","emit"],"mappings":";;;;;;;;;;;iBAGQA,IAAUC,KAyBVC,IAA2BC,EAAI,CAAA,CAAE,GACjCC,IAAUD;AAEhB,aAASE,EAAe,GAAG;AACzB,MAAI,EAAE,QAAQ,EAAE,OAAO,qBACnB,EAAA,OAAO,mBAAmB,UACnB,EAAE,QAAQ,QAAQ,EAAE,OAAO,0BAClC,EAAA,OAAO,uBAAuB;IAEpC;AAES,aAAAC,EAAYC,GAAOC,GAAsB;AAG5C,UAFJD,EAAM,eAAe,GAEjBL,EAAK,MAAMM,CAAY,GAAG;AACpB,QAAAJ,EAAA,MAAMI,CAAY,EAAE,MAAM;AAElC;AAAA,MACF;AAEA,UAAIC,IAAe;AAEnB,MAAAP,EAAK,MAAM,QAAQ,CAACQ,GAAOC,MAAU;AACnC,QAAID,MACFD,IAAeE,IAAQ;AAAA,MACzB,CACD,GAEOP,EAAA,MAAMK,CAAY,EAAE,MAAM;AAAA,IACpC;AAES,aAAAG,EAAY,GAAkBD,GAAe;AAChD,UAAA,EAAE,QAAQ,eAAe,CAAC,IAAI,OAAO,WAAW,EAAE,KAAK,EAAE,GAAG,GAAG;AACjE,UAAE,eAAe;AACjB;AAAA,MACF;AAEA,UAAIF,IAAe;AAQf,UANAE,MAAU,IACZF,IAAeE,IAAQ,IAERF,IAAA,GAGb,EAAE,QAAQ,aAAa;AACrB,YAAAE,IAAQ,MAAMT,EAAK,MAAM,SAAS,KAAKA,EAAK,MAAMS,CAAK,GAAG;AAC5D,UAAAP,EAAQ,MAAMO,IAAQ,CAAC,EAAE,MAAM;AAC/B;AAAA,QACF;AAEI,YAAAT,EAAK,MAAMS,CAAK;AAClB;AAGG,QAAAT,EAAA,MAAMO,CAAY,IAAI,IACnBL,EAAA,MAAMK,CAAY,EAAE,MAAM;AAElC;AAAA,MACF;AAEA,UAAI,CAAC,IAAI,OAAO,WAAW,EAAE,KAAK,EAAE,GAAG,KAAK,CAACP,EAAK,MAAMS,CAAK,GAAG;AACzD,QAAAT,EAAA,MAAMO,CAAY,IAAI,IACnBL,EAAA,MAAMK,CAAY,EAAE,MAAM;AAClC;AAAA,MACF;AAAA,IACF;AAEA,aAASI,EAAY,GAAmB;;AACtC,YAAMC,KAAYC,IAAA,EAAE,kBAAF,gBAAAA,EAAiB,QAAQ;AAE3C,UAAI,MAAM,OAAOD,CAAS,CAAC,GAAG;AACpB,QAAAV,EAAA,MAAM,CAAC,EAAE,MAAM;AACvB;AAAA,MACF;AAEA,UAAIY,IAASZ,EAAQ,MAAM,CAAC,EAAE;AAC9B,UAAIU;AACF,iBAASG,IAAI,GAAGA,IAAIH,EAAU,QAAQG;AACpC,UAAID,MACFd,EAAK,MAAMe,CAAC,IAAIH,EAAUG,CAAC,GAC3BD,IAASA,EAAO;AAAA,IAIxB;AAEA,WAAAE;AAAA,MACE,MAAMhB;AAAA,MACN,CAACiB,MAAW;AACV,YAAIA,EAAO,MAAM,KAAK,EAAE,MAAM;AAC5B,UAAAC,EAAK,sBAAsB,IAAI;AAAA,aAC1B;AACL,cAAI,MAAM,OAAOD,EAAO,MAAM,CAAC,CAAC,CAAC,GAAG;AAC7B,YAAAjB,EAAA,MAAM,CAAC,IAAI;AAChB;AAAA,UACF;AACA,UAAAkB,EAAK,sBAAsB,OAAOD,EAAO,MAAM,KAAK,EAAE,CAAC,CAAC;AAAA,QAC1D;AAAA,MACF;AAAA,MACA,EAAE,MAAM,GAAK;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|