@leaflink/stash 53.4.6 → 53.4.8
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/dist/AppSidebar.js +56 -52
- package/dist/AppSidebar.js.map +1 -1
- package/dist/AppTopbar.js +1 -1
- package/dist/Copy.js +1 -1
- package/dist/DataViewFilters.js +1 -1
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/DataViewToolbar.js +139 -125
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DatePicker.js +1114 -1113
- package/dist/DatePicker.js.map +1 -1
- package/dist/Modal.js +105 -89
- package/dist/Modal.js.map +1 -1
- package/dist/Modals.js +30 -26
- package/dist/Modals.js.map +1 -1
- package/dist/MoreActions.js +294 -288
- package/dist/MoreActions.js.map +1 -1
- package/dist/PageNavigation.js +1 -1
- package/dist/RadioGroup.js +69 -62
- package/dist/RadioGroup.js.map +1 -1
- package/dist/SearchBar.js +27 -25
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +103 -101
- package/dist/Select.js.map +1 -1
- package/dist/Stepper.js +1 -1
- package/dist/Tab.js +1 -1
- package/dist/Table.js +1 -1
- package/dist/Tabs.js +2 -2
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-DEopbeSY.js +131 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-DEopbeSY.js.map +1 -0
- package/dist/Thumbnail.js +42 -42
- package/dist/Thumbnail.js.map +1 -1
- package/dist/ThumbnailGroup.js +24 -22
- package/dist/ThumbnailGroup.js.map +1 -1
- package/dist/Timeline.js +15 -13
- package/dist/Timeline.js.map +1 -1
- package/dist/Toast.vue.d.ts +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-CFpM7Ldj.js → Tooltip.vue_vue_type_script_setup_true_lang-UUjw5O1x.js} +2 -2
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-CFpM7Ldj.js.map → Tooltip.vue_vue_type_script_setup_true_lang-UUjw5O1x.js.map} +1 -1
- package/dist/components.css +1 -1
- package/dist/getContrastingTextColor.d.ts +8 -0
- package/dist/index-t9tXBnql.js +469 -0
- package/dist/{index-DA70nQCT.js.map → index-t9tXBnql.js.map} +1 -1
- package/dist/templateRefNarrowing-CeANDylX.js +22 -0
- package/dist/templateRefNarrowing-CeANDylX.js.map +1 -0
- package/dist/useMediaQuery.d.ts +12 -10
- package/dist/useMediaQuery.js +7 -29
- package/dist/useMediaQuery.js.map +1 -1
- package/dist/useSortable.js +1 -1
- package/dist/useValidation.d.ts +11 -1
- package/dist/useValidation.js +240 -198
- package/dist/useValidation.js.map +1 -1
- package/dist/utils/getContrastingTextColor.js +36 -24
- package/dist/utils/getContrastingTextColor.js.map +1 -1
- package/package.json +1 -2
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3FBaVP5.js +0 -130
- package/dist/Tabs.vue_vue_type_script_setup_true_lang-B3FBaVP5.js.map +0 -1
- package/dist/index-DA70nQCT.js +0 -424
package/dist/RadioGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sources":["../src/components/RadioGroup/components/VariantButton.vue","../src/components/RadioGroup/components/VariantChip.vue","../src/components/RadioGroup/components/VariantRadio.vue","../src/components/RadioGroup/components/VariantTile.vue","../src/components/RadioGroup/RadioGroup.types.ts","../src/components/RadioGroup/RadioGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantButton must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"flex\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n @layer utilities {\n .root label {\n padding: 8px 30px;\n border: 1px solid var(--color-ice-500);\n font-weight: var(--font-weight-semibold);\n color: var(--color-ice-700);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n display: block;\n text-align: center;\n }\n\n .root > div:first-child label {\n border-top-left-radius: var(--radius-sm);\n border-bottom-left-radius: var(--radius-sm);\n }\n\n .root > div:last-child label {\n border-top-right-radius: var(--radius-sm);\n border-bottom-right-radius: var(--radius-sm);\n }\n\n .root > div:not(:first-child) label {\n margin-left: -1px;\n }\n\n .root > div:not(:last-child) label {\n border-right-color: transparent;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n z-index: 1;\n position: relative;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n background-color: var(--color-blue-100);\n z-index: 1;\n position: relative;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantChip must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"my-1.5 flex flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n @reference \"../../../../styles/main.css\";\n\n @layer utilities {\n .root {\n gap: --spacing(6);\n }\n\n .root label {\n padding: --spacing(1.5) --spacing(3);\n border: 1px solid var(--color-ice-500);\n font-weight: var(--font-weight-normal);\n color: var(--color-ice-900);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n border-radius: 9999px;\n white-space: nowrap;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-white);\n background-color: var(--color-blue-500);\n font-weight: var(--font-weight-bold);\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantRadio must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"flex flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n @reference \"../../../../styles/main.css\";\n\n @layer utilities {\n .root {\n gap: --spacing(6);\n }\n\n .root label {\n font-weight: var(--font-weight-medium);\n user-select: none;\n cursor: pointer;\n padding: 0 --spacing(3);\n }\n\n .root input {\n appearance: none;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 5px;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n .root input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantTile must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"flex flex-wrap\" :class=\"classes.root\">\n <label\n v-for=\"option in options\"\n :key=\"`${name}-${option.id}`\"\n :class=\"[classes['tile-container'], { 'w-full': fullWidth }]\"\n :for=\"`${name}-${option.id}`\"\n >\n <div\n class=\"flex border\"\n :class=\"[\n classes['tile-header'],\n {\n 'border-blue-500 bg-blue-100 text-ice-900': modelValue === option.value,\n 'border-ice-500 bg-ice-100 text-ice-700': modelValue !== option.value,\n },\n ]\"\n >\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <div>\n <span>\n {{ option.text }}\n </span>\n </div>\n </div>\n <div\n class=\"border-x border-b\"\n :class=\"[\n classes['tile-body'],\n {\n 'border-ice-500': modelValue !== option.value,\n 'border-blue-500': modelValue === option.value,\n },\n ]\"\n >\n <p class=\"m-0 text-ice-900\">{{ option.subTitle }}</p>\n <p class=\"m-0 text-ice-700\">{{ option.subText }}</p>\n </div>\n </label>\n </div>\n</template>\n\n<style module>\n @reference \"../../../../styles/main.css\";\n\n @layer utilities {\n .root {\n gap: --spacing(6);\n }\n\n .root label {\n cursor: pointer;\n user-select: none;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n\n .root label.tile-container {\n border-radius: var(--radius-sm);\n display: flex;\n flex: 1;\n flex-direction: column;\n }\n\n .tile-header,\n .tile-body {\n transition: all 0.2s;\n }\n\n .tile-header {\n border-radius: var(--radius-sm) var(--radius-sm) 0 0;\n padding: --spacing(3) 0;\n }\n\n .root label.tile-container:hover .tile-header {\n background-color: var(--color-blue-100) !important;\n border-color: var(--color-blue-500) !important;\n color: var(--color-ice-900) !important;\n transition: all 0.2s;\n }\n\n .tile-body {\n border-radius: 0 0 var(--radius-sm) var(--radius-sm);\n background-color: var(--color-white);\n padding: --spacing(6);\n display: flex;\n flex-direction: column;\n }\n\n .root label.tile-container:hover .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n\n .root input {\n appearance: none;\n background-color: var(--color-white);\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 2px;\n }\n\n .root input ~ div {\n font-weight: var(--font-weight-medium);\n user-select: none;\n cursor: pointer;\n padding: 0 --spacing(3);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root label.tile-container input {\n margin-left: --spacing(3);\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n @media screen and (width <= 640px) {\n .root {\n flex-direction: column;\n }\n }\n }\n</style>\n","import { ComputedRef } from 'vue';\n\nexport enum RadioGroupVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioGroupVariants = `${RadioGroupVariant}`;\n\n/**\n * An individual radio `<input>` within a RadioGroup instance\n */\nexport interface RadioGroupOption {\n /**\n * Disables the RadioGroupOption if truthy\n */\n disabled?: boolean;\n\n /**\n * The unique identifier for the option\n */\n id: number | string;\n\n /**\n * The text to be displayed for the option\n */\n text: string;\n\n /**\n * The value of the option. Used for the modelValue of the RadioGroup.\n */\n value: string;\n\n /**\n * The subtitle for tile variant\n */\n subTitle?: string;\n\n /**\n * The subtext for tile variant\n */\n subText?: string;\n}\n\n/**\n * Properties and utilities provided to children of a RadioGroup instance\n */\nexport interface RadioGroupInjection {\n /**\n * This type should match RadioGroupProps['disabled']\n */\n disabled: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['fullWidth']\n */\n fullWidth: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['modelValue']\n */\n modelValue: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['name']\n */\n name: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['options']\n */\n options: ComputedRef<RadioGroupOption[] | undefined>;\n\n /**\n * Triggered when the user changes their selection; updates the v-model.\n */\n update: (e: Event) => void;\n\n /**\n * This type should match RadioGroupProps['variant']\n * @default 'radio'\n */\n variant: ComputedRef<RadioGroupVariants | undefined>;\n\n /**\n * Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.\n *\n * Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.\n */\n orientation?: ComputedRef<'horizontal' | 'vertical'>;\n}\n","<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n import { RadioGroupOption, RadioGroupVariant, RadioGroupVariants } from './RadioGroup.types';\n\n export * from './RadioGroup.keys';\n export * from './RadioGroup.types';\n\n export interface RadioGroupProps extends FieldProps {\n /**\n * Passed to the \"name\" attribute of the `<input>` elements within the RadioGroup.\n */\n name?: string;\n\n /**\n * Deprecated - Compose your radio group with the `Radio` component instead\n * @deprecated\n */\n options?: RadioGroupOption[];\n\n /**\n * The value of the selected radio option. Use this prop with the `update:modelValue` event to create a controlled component.\n */\n modelValue?: RadioGroupOption['value'];\n\n /**\n * @defaultValue 'radio'\n */\n variant?: RadioGroupVariants;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.\n *\n * Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.\n *\n * @defaultValue 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, onMounted, onUnmounted, provide, ref, useCssModule, useTemplateRef, watchEffect } from 'vue';\n\n import VariantButton from './components/VariantButton.vue';\n import VariantChip from './components/VariantChip.vue';\n import VariantRadio from './components/VariantRadio.vue';\n import VariantTile from './components/VariantTile.vue';\n import { RADIO_GROUP_INJECTION } from './RadioGroup.keys';\n\n const variantComponentsMap = {\n [RadioGroupVariant.Button]: VariantButton,\n [RadioGroupVariant.Chip]: VariantChip,\n [RadioGroupVariant.Radio]: VariantRadio,\n [RadioGroupVariant.Tile]: VariantTile,\n };\n\n const props = withDefaults(defineProps<RadioGroupProps>(), {\n variant: 'radio',\n fullWidth: false,\n modelValue: undefined,\n name: undefined,\n options: undefined,\n orientation: 'horizontal',\n });\n\n const emit = defineEmits<{\n /**\n * Occurs when the user selects a radio option. Also, it enables v-model usage on the component.\n */\n (e: 'update:modelValue', value: RadioGroupOption['value']): void;\n }>();\n\n const classes = useCssModule();\n\n function update(e: Event) {\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n\n const errorId = uniqueId('radio-group-field-error-');\n\n provide(RADIO_GROUP_INJECTION.key, {\n name: computed(() => props.name),\n disabled: computed(() => props.isDisabled || props.disabled),\n fullWidth: computed(() => props.fullWidth),\n modelValue: computed(() => props.modelValue),\n options: computed(() => props.options),\n variant: computed(() => props.variant),\n orientation: computed(() => internalOrientation.value),\n update,\n });\n\n const internalOrientation = ref(props.orientation);\n\n const defaultSlotClasses = computed(() => {\n return {\n 'flex-wrap': props.variant !== 'button',\n 'gap-x-1.5 gap-y-3': props.variant === 'chip' && internalOrientation.value === 'horizontal',\n 'gap-6':\n props.variant === 'radio' ||\n props.variant === 'tile' ||\n (props.variant === 'chip' && internalOrientation.value === 'vertical'),\n 'flex-col': internalOrientation.value === 'vertical',\n };\n });\n\n const resizeObserver = ref<ResizeObserver | null>(null);\n const radioGroupRef = useTemplateRef('radioGroup');\n const radioGroupParent = computed(() => radioGroupRef.value?.$el.parentElement);\n const radioGroupButtons = computed(() => {\n if (props.variant !== 'button') {\n return [];\n }\n\n return Array.from<HTMLElement>(radioGroupRef.value?.$el.querySelectorAll('[data-variant-button]')) || [];\n });\n\n function getButtonsWidth() {\n return radioGroupButtons.value.reduce((acc, button) => {\n const buttonWidth = button.getBoundingClientRect().width;\n return acc + buttonWidth;\n }, 0);\n }\n\n const initialTotalButtonsWidth = ref(0);\n\n const handleResize = (entry: ResizeObserverEntry) => {\n internalOrientation.value =\n initialTotalButtonsWidth.value > entry.contentBoxSize[0].inlineSize ? 'vertical' : props.orientation;\n };\n\n onMounted(() => {\n // If the width of the buttons is greater than the parent element,\n // set orientation to vertical\n if (props.variant === 'button' && !props.fullWidth) {\n initialTotalButtonsWidth.value = getButtonsWidth();\n resizeObserver.value = new ResizeObserver((entries) => handleResize(entries[0]));\n\n resizeObserver.value.observe(radioGroupParent.value);\n }\n });\n\n onUnmounted(() => {\n if (props.variant === 'button' && resizeObserver.value) {\n resizeObserver.value?.disconnect();\n }\n });\n\n watchEffect(() => {\n internalOrientation.value = props.orientation;\n });\n</script>\n\n<template>\n <Field\n v-bind=\"props\"\n ref=\"radioGroup\"\n class=\"stash-radio-group\"\n :class=\"classes['stash-radio-group']\"\n data-test=\"stash-radio-group\"\n :aria-errormessage=\"errorId\"\n :error-id=\"errorId\"\n :aria-invalid=\"!!props.errorText\"\n role=\"radiogroup\"\n fieldset\n >\n <slot v-if=\"props.options\">\n <component :is=\"variantComponentsMap[props.variant]\" />\n </slot>\n <div v-else class=\"flex\" data-test=\"stash-radio-group|default-slot\" :class=\"defaultSlotClasses\">\n <slot></slot>\n </div>\n </Field>\n</template>\n\n<style module>\n @layer utilities {\n .stash-radio-group :global(.stash-field-hint),\n .stash-radio-group :global(.stash-field-error) {\n display: block;\n width: 100%;\n }\n\n .stash-radio-group > :global(.stash-label) {\n margin-bottom: 4px;\n }\n }\n</style>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","classes","useCssModule","_createElementBlock","_normalizeClass","_unref","_Fragment","_renderList","option","_createElementVNode","_cache","args","_toDisplayString","_hoisted_2","_hoisted_3","_hoisted_4","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","props","__props","emit","__emit","e","errorId","uniqueId","provide","computed","internalOrientation","ref","defaultSlotClasses","resizeObserver","radioGroupRef","useTemplateRef","radioGroupParent","_a","radioGroupButtons","getButtonsWidth","acc","button","buttonWidth","initialTotalButtonsWidth","handleResize","entry","onMounted","entries","onUnmounted","watchEffect","_createBlock","Field","_mergeProps","_renderSlot","_ctx","_openBlock","_resolveDynamicComponent"],"mappings":";;;;;;;;AAKE,UAA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jB,EAAAJ,CAAA,EAAO,mBAAA,CAAA;AAAA,MACf,aAAU;AAAA,MACT,qBAAmBI,EAAAsB,CAAA;AAAA,MACnB,YAAUtB,EAAAsB,CAAA;AAAA,MACV,gBAAY,CAAA,CAAIL,EAAM;AAAA,MACvB,MAAK;AAAA,MACL,UAAA;AAAA,IAAA;iBAEA,MAEO;AAAA,QAFKA,EAAM,UAAlBgC,EAEOC,iCAFP,MAEO;AAAA,WADLC,EAAA,GAAAL,EAAuDM,EAAvCxC,EAAqBK,EAAM,OAAO,CAAA,CAAA;AAAA,QAAA,WAEpDnB,EAEM,OAAA;AAAA;UAFM,OAAKC,EAAA,CAAC,QAA0D6B,EAAA,KAAkB,CAAA;AAAA,UAArE,aAAU;AAAA,QAAA;UACjCqB,EAAaC,EAAA,QAAA,SAAA;AAAA,QAAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sources":["../src/components/RadioGroup/components/VariantButton.vue","../src/components/RadioGroup/components/VariantChip.vue","../src/components/RadioGroup/components/VariantRadio.vue","../src/components/RadioGroup/components/VariantTile.vue","../src/components/RadioGroup/RadioGroup.types.ts","../src/components/RadioGroup/RadioGroup.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantButton must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"flex\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n @layer utilities {\n .root label {\n padding: 8px 30px;\n border: 1px solid var(--color-ice-500);\n font-weight: var(--font-weight-semibold);\n color: var(--color-ice-700);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n display: block;\n text-align: center;\n }\n\n .root > div:first-child label {\n border-top-left-radius: var(--radius-sm);\n border-bottom-left-radius: var(--radius-sm);\n }\n\n .root > div:last-child label {\n border-top-right-radius: var(--radius-sm);\n border-bottom-right-radius: var(--radius-sm);\n }\n\n .root > div:not(:first-child) label {\n margin-left: -1px;\n }\n\n .root > div:not(:last-child) label {\n border-right-color: transparent;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n z-index: 1;\n position: relative;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-blue-500);\n background-color: var(--color-blue-100);\n z-index: 1;\n position: relative;\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantChip must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"my-1.5 flex flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n @reference \"../../../../styles/main.css\";\n\n @layer utilities {\n .root {\n gap: --spacing(6);\n }\n\n .root label {\n padding: --spacing(1.5) --spacing(3);\n border: 1px solid var(--color-ice-500);\n font-weight: var(--font-weight-normal);\n color: var(--color-ice-900);\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n border-radius: 9999px;\n white-space: nowrap;\n }\n\n .root input:disabled ~ label {\n background-color: var(--color-ice-200);\n color: var(--color-ice-500);\n cursor: auto;\n }\n\n .root input:checked:not(:disabled) ~ label {\n border-color: var(--color-blue-500);\n color: var(--color-white);\n background-color: var(--color-blue-500);\n font-weight: var(--font-weight-bold);\n }\n\n .root input:not(:checked, :disabled) ~ label:hover {\n border-color: var(--color-blue-500);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantRadio must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"flex flex-wrap\" :class=\"classes.root\">\n <div v-for=\"option in options\" :key=\"`${name}-${option.id}`\" :class=\"[{ 'w-full': fullWidth }]\">\n <input\n :id=\"`${name}-${option.id}`\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <label :for=\"`${name}-${option.id}`\">\n {{ option.text }}\n </label>\n </div>\n </div>\n</template>\n\n<style module>\n @reference \"../../../../styles/main.css\";\n\n @layer utilities {\n .root {\n gap: --spacing(6);\n }\n\n .root label {\n font-weight: var(--font-weight-medium);\n user-select: none;\n cursor: pointer;\n padding: 0 --spacing(3);\n }\n\n .root input {\n appearance: none;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 5px;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n .root input:hover:not(:disabled) {\n border-color: var(--color-blue-500);\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { inject, useCssModule } from 'vue';\n\n import { RADIO_GROUP_INJECTION } from '../RadioGroup.keys';\n\n const radioGroupInjection = inject(RADIO_GROUP_INJECTION.key);\n\n if (!radioGroupInjection) {\n throw new Error('VariantTile must be used with a RadioGroup instance.');\n }\n\n const { name, disabled, fullWidth, modelValue, options, update } = radioGroupInjection;\n const classes = useCssModule();\n</script>\n\n<template>\n <div class=\"flex flex-wrap\" :class=\"classes.root\">\n <label\n v-for=\"option in options\"\n :key=\"`${name}-${option.id}`\"\n :class=\"[classes['tile-container'], { 'w-full': fullWidth }]\"\n :for=\"`${name}-${option.id}`\"\n >\n <div\n class=\"flex border\"\n :class=\"[\n classes['tile-header'],\n {\n 'border-blue-500 bg-blue-100 text-ice-900': modelValue === option.value,\n 'border-ice-500 bg-ice-100 text-ice-700': modelValue !== option.value,\n },\n ]\"\n >\n <input\n :id=\"`${name}-${option.id}`\"\n class=\"sr-only\"\n type=\"radio\"\n :name=\"name\"\n :value=\"option.value\"\n :checked=\"modelValue === option.value\"\n :disabled=\"disabled || option.disabled\"\n @input=\"update\"\n />\n <div>\n <span>\n {{ option.text }}\n </span>\n </div>\n </div>\n <div\n class=\"border-x border-b\"\n :class=\"[\n classes['tile-body'],\n {\n 'border-ice-500': modelValue !== option.value,\n 'border-blue-500': modelValue === option.value,\n },\n ]\"\n >\n <p class=\"m-0 text-ice-900\">{{ option.subTitle }}</p>\n <p class=\"m-0 text-ice-700\">{{ option.subText }}</p>\n </div>\n </label>\n </div>\n</template>\n\n<style module>\n @reference \"../../../../styles/main.css\";\n\n @layer utilities {\n .root {\n gap: --spacing(6);\n }\n\n .root label {\n cursor: pointer;\n user-select: none;\n }\n\n .root input:disabled ~ label {\n cursor: auto;\n }\n\n .root input:hover:not(:disabled) ~ label {\n color: var(--color-ice-900);\n }\n\n .root input:not(:disabled) ~ label:hover {\n color: var(--color-ice-900);\n }\n\n .root label.tile-container {\n border-radius: var(--radius-sm);\n display: flex;\n flex: 1;\n flex-direction: column;\n }\n\n .tile-header,\n .tile-body {\n transition: all 0.2s;\n }\n\n .tile-header {\n border-radius: var(--radius-sm) var(--radius-sm) 0 0;\n padding: --spacing(3) 0;\n }\n\n .root label.tile-container:hover .tile-header {\n background-color: var(--color-blue-100) !important;\n border-color: var(--color-blue-500) !important;\n color: var(--color-ice-900) !important;\n transition: all 0.2s;\n }\n\n .tile-body {\n border-radius: 0 0 var(--radius-sm) var(--radius-sm);\n background-color: var(--color-white);\n padding: --spacing(6);\n display: flex;\n flex-direction: column;\n }\n\n .root label.tile-container:hover .tile-body {\n border-color: var(--color-blue-500) !important;\n transition: all 0.2s;\n }\n\n .root input {\n appearance: none;\n background-color: var(--color-white);\n border-radius: 50%;\n width: 20px;\n height: 20px;\n border: 1px solid var(--color-ice-500);\n transition: all 0.2s;\n position: relative;\n cursor: pointer;\n top: 2px;\n }\n\n .root input ~ div {\n font-weight: var(--font-weight-medium);\n user-select: none;\n cursor: pointer;\n padding: 0 --spacing(3);\n }\n\n .root input:disabled {\n background: #eef2f4;\n }\n\n .root input:checked {\n background-image: radial-gradient(var(--color-blue-500) 50%, transparent 54%);\n }\n\n .root label.tile-container input {\n margin-left: --spacing(3);\n }\n\n .root input:disabled:checked {\n background-image: radial-gradient(var(--color-ice-500) 50%, transparent 54%);\n }\n\n @media screen and (width <= 640px) {\n .root {\n flex-direction: column;\n }\n }\n }\n</style>\n","import { ComputedRef } from 'vue';\n\nexport enum RadioGroupVariant {\n Radio = 'radio',\n Button = 'button',\n Chip = 'chip',\n Tile = 'tile',\n}\n\nexport type RadioGroupVariants = `${RadioGroupVariant}`;\n\n/**\n * An individual radio `<input>` within a RadioGroup instance\n */\nexport interface RadioGroupOption {\n /**\n * Disables the RadioGroupOption if truthy\n */\n disabled?: boolean;\n\n /**\n * The unique identifier for the option\n */\n id: number | string;\n\n /**\n * The text to be displayed for the option\n */\n text: string;\n\n /**\n * The value of the option. Used for the modelValue of the RadioGroup.\n */\n value: string;\n\n /**\n * The subtitle for tile variant\n */\n subTitle?: string;\n\n /**\n * The subtext for tile variant\n */\n subText?: string;\n}\n\n/**\n * Properties and utilities provided to children of a RadioGroup instance\n */\nexport interface RadioGroupInjection {\n /**\n * This type should match RadioGroupProps['disabled']\n */\n disabled: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['fullWidth']\n */\n fullWidth: ComputedRef<boolean | undefined>;\n\n /**\n * This type should match RadioGroupProps['modelValue']\n */\n modelValue: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['name']\n */\n name: ComputedRef<string | undefined>;\n\n /**\n * This type should match RadioGroupProps['options']\n */\n options: ComputedRef<RadioGroupOption[] | undefined>;\n\n /**\n * Triggered when the user changes their selection; updates the v-model.\n */\n update: (e: Event) => void;\n\n /**\n * This type should match RadioGroupProps['variant']\n * @default 'radio'\n */\n variant: ComputedRef<RadioGroupVariants | undefined>;\n\n /**\n * Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.\n *\n * Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.\n */\n orientation?: ComputedRef<'horizontal' | 'vertical'>;\n}\n","<script lang=\"ts\">\n import { FieldProps } from '../Field/Field.types';\n import Field from '../Field/Field.vue';\n import { RadioGroupOption, RadioGroupVariant, RadioGroupVariants } from './RadioGroup.types';\n\n export * from './RadioGroup.keys';\n export * from './RadioGroup.types';\n\n export interface RadioGroupProps extends FieldProps {\n /**\n * Passed to the \"name\" attribute of the `<input>` elements within the RadioGroup.\n */\n name?: string;\n\n /**\n * Deprecated - Compose your radio group with the `Radio` component instead\n * @deprecated\n */\n options?: RadioGroupOption[];\n\n /**\n * The value of the selected radio option. Use this prop with the `update:modelValue` event to create a controlled component.\n */\n modelValue?: RadioGroupOption['value'];\n\n /**\n * @defaultValue 'radio'\n */\n variant?: RadioGroupVariants;\n\n /**\n * Whether the group should expand to the parent's width\n */\n fullWidth?: boolean;\n\n /**\n * Default orientation. If the variant is `button` and the group is wider than its parent it will be displayed in a column, and this prop will be ignored.\n *\n * Note: This does not work with the deprecated `options` prop. Update those instances to use the `RadioNew` component and default slot.\n *\n * @defaultValue 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n }\n</script>\n\n<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, onMounted, onUnmounted, provide, ref, useCssModule, useTemplateRef, watchEffect } from 'vue';\n\n import { isComponentWithEl, toComponentEl } from '../../utils/templateRefNarrowing';\n import VariantButton from './components/VariantButton.vue';\n import VariantChip from './components/VariantChip.vue';\n import VariantRadio from './components/VariantRadio.vue';\n import VariantTile from './components/VariantTile.vue';\n import { RADIO_GROUP_INJECTION } from './RadioGroup.keys';\n\n const variantComponentsMap = {\n [RadioGroupVariant.Button]: VariantButton,\n [RadioGroupVariant.Chip]: VariantChip,\n [RadioGroupVariant.Radio]: VariantRadio,\n [RadioGroupVariant.Tile]: VariantTile,\n };\n\n const props = withDefaults(defineProps<RadioGroupProps>(), {\n variant: 'radio',\n fullWidth: false,\n modelValue: undefined,\n name: undefined,\n options: undefined,\n orientation: 'horizontal',\n });\n\n const emit = defineEmits<{\n /**\n * Occurs when the user selects a radio option. Also, it enables v-model usage on the component.\n */\n (e: 'update:modelValue', value: RadioGroupOption['value']): void;\n }>();\n\n const classes = useCssModule();\n\n function update(e: Event) {\n emit('update:modelValue', (e.target as HTMLInputElement).value);\n }\n\n const errorId = uniqueId('radio-group-field-error-');\n\n provide(RADIO_GROUP_INJECTION.key, {\n name: computed(() => props.name),\n disabled: computed(() => props.isDisabled || props.disabled),\n fullWidth: computed(() => props.fullWidth),\n modelValue: computed(() => props.modelValue),\n options: computed(() => props.options),\n variant: computed(() => props.variant),\n orientation: computed(() => internalOrientation.value),\n update,\n });\n\n const internalOrientation = ref(props.orientation);\n\n const defaultSlotClasses = computed(() => {\n return {\n 'flex-wrap': props.variant !== 'button',\n 'gap-x-1.5 gap-y-3': props.variant === 'chip' && internalOrientation.value === 'horizontal',\n 'gap-6':\n props.variant === 'radio' ||\n props.variant === 'tile' ||\n (props.variant === 'chip' && internalOrientation.value === 'vertical'),\n 'flex-col': internalOrientation.value === 'vertical',\n };\n });\n\n const resizeObserver = ref<ResizeObserver | null>(null);\n const radioGroupRef = useTemplateRef('radioGroup');\n const radioGroupParent = computed(() => {\n const comp = radioGroupRef.value;\n return isComponentWithEl(comp) ? comp.$el.parentElement : null;\n });\n const radioGroupButtons = computed(() => {\n if (props.variant !== 'button') {\n return [];\n }\n\n const el = toComponentEl(radioGroupRef.value);\n return el ? Array.from(el.querySelectorAll<HTMLElement>('[data-variant-button]')) : [];\n });\n\n function getButtonsWidth() {\n return radioGroupButtons.value.reduce((acc, button) => {\n const buttonWidth = button.getBoundingClientRect().width;\n return acc + buttonWidth;\n }, 0);\n }\n\n const initialTotalButtonsWidth = ref(0);\n\n const handleResize = (entry: ResizeObserverEntry) => {\n internalOrientation.value =\n initialTotalButtonsWidth.value > entry.contentBoxSize[0].inlineSize ? 'vertical' : props.orientation;\n };\n\n onMounted(() => {\n // If the width of the buttons is greater than the parent element,\n // set orientation to vertical\n if (props.variant === 'button' && !props.fullWidth) {\n initialTotalButtonsWidth.value = getButtonsWidth();\n resizeObserver.value = new ResizeObserver((entries) => handleResize(entries[0]));\n\n const parent = radioGroupParent.value;\n if (parent) resizeObserver.value.observe(parent);\n }\n });\n\n onUnmounted(() => {\n if (props.variant === 'button' && resizeObserver.value) {\n resizeObserver.value?.disconnect();\n }\n });\n\n watchEffect(() => {\n internalOrientation.value = props.orientation;\n });\n</script>\n\n<template>\n <Field\n v-bind=\"props\"\n ref=\"radioGroup\"\n class=\"stash-radio-group\"\n :class=\"classes['stash-radio-group']\"\n data-test=\"stash-radio-group\"\n :aria-errormessage=\"errorId\"\n :error-id=\"errorId\"\n :aria-invalid=\"!!props.errorText\"\n role=\"radiogroup\"\n fieldset\n >\n <slot v-if=\"props.options\">\n <component :is=\"variantComponentsMap[props.variant]\" />\n </slot>\n <div v-else class=\"flex\" data-test=\"stash-radio-group|default-slot\" :class=\"defaultSlotClasses\">\n <slot></slot>\n </div>\n </Field>\n</template>\n\n<style module>\n @layer utilities {\n .stash-radio-group :global(.stash-field-hint),\n .stash-radio-group :global(.stash-field-error) {\n display: block;\n width: 100%;\n }\n\n .stash-radio-group > :global(.stash-label) {\n margin-bottom: 4px;\n }\n }\n</style>\n"],"names":["radioGroupInjection","inject","RADIO_GROUP_INJECTION","name","disabled","fullWidth","modelValue","options","update","classes","useCssModule","_createElementBlock","_normalizeClass","_unref","_Fragment","_renderList","option","_createElementVNode","_cache","args","_toDisplayString","_hoisted_2","_hoisted_3","_hoisted_4","RadioGroupVariant","variantComponentsMap","VariantButton","VariantChip","VariantRadio","VariantTile","props","__props","emit","__emit","e","errorId","uniqueId","provide","computed","internalOrientation","ref","defaultSlotClasses","resizeObserver","radioGroupRef","useTemplateRef","radioGroupParent","comp","isComponentWithEl","radioGroupButtons","el","toComponentEl","getButtonsWidth","acc","button","buttonWidth","initialTotalButtonsWidth","handleResize","entry","onMounted","entries","parent","onUnmounted","_a","watchEffect","_createBlock","Field","_mergeProps","_renderSlot","_ctx","_openBlock","_resolveDynamicComponent"],"mappings":";;;;;;;;;AAKE,U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EAAoB,QAAQT,EAAM;AAAA,IACpC,CAAC,mBAIDkC,EAkBQC,GAlBRC,EAkBQpC,GAjBO;AAAA,MACb,KAAI;AAAA,MACJ,OAAK,CAAC,qBACEjB,EAAAJ,CAAA,EAAO,mBAAA,CAAA;AAAA,MACf,aAAU;AAAA,MACT,qBAAmBI,EAAAsB,CAAA;AAAA,MACnB,YAAUtB,EAAAsB,CAAA;AAAA,MACV,gBAAY,CAAA,CAAIL,EAAM;AAAA,MACvB,MAAK;AAAA,MACL,UAAA;AAAA,IAAA;iBAEA,MAEO;AAAA,QAFKA,EAAM,UAAlBqC,EAEOC,iCAFP,MAEO;AAAA,WADLC,EAAA,GAAAL,EAAuDM,EAAvC7C,EAAqBK,EAAM,OAAO,CAAA,CAAA;AAAA,QAAA,WAEpDnB,EAEM,OAAA;AAAA;UAFM,OAAKC,EAAA,CAAC,QAA0D6B,EAAA,KAAkB,CAAA;AAAA,UAArE,aAAU;AAAA,QAAA;UACjC0B,EAAaC,EAAA,QAAA,SAAA;AAAA,QAAA;;;;;;;;;;"}
|
package/dist/SearchBar.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as C, useSlots as S, ref as i, computed as V, createBlock as h, openBlock as
|
|
1
|
+
import { defineComponent as C, useSlots as S, ref as i, computed as V, createBlock as h, openBlock as m, withKeys as s, normalizeClass as p, createSlots as I, withCtx as r, createCommentVNode as T, createVNode as u, unref as K, renderSlot as L } from "vue";
|
|
2
2
|
import { t as f } from "./locale.js";
|
|
3
3
|
import b from "./Button.js";
|
|
4
4
|
import v from "./Icon.js";
|
|
5
5
|
import W from "./Input.js";
|
|
6
6
|
import { _ as w } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
-
const
|
|
7
|
+
const M = /* @__PURE__ */ C({
|
|
8
8
|
name: "ll-search-bar",
|
|
9
9
|
__name: "SearchBar",
|
|
10
10
|
props: {
|
|
@@ -16,35 +16,35 @@ const N = /* @__PURE__ */ C({
|
|
|
16
16
|
hintText: { default: void 0 }
|
|
17
17
|
},
|
|
18
18
|
emits: ["search", "update:model-value"],
|
|
19
|
-
setup(_, { emit:
|
|
20
|
-
const e = _, l =
|
|
19
|
+
setup(_, { emit: y }) {
|
|
20
|
+
const e = _, l = y, k = S(), a = i(e.modelValue), d = i(), g = V(() => a.value ? 0 : -1);
|
|
21
21
|
function o() {
|
|
22
22
|
e.isLoading || e.isWorking || l("search", a.value);
|
|
23
23
|
}
|
|
24
24
|
function c() {
|
|
25
|
-
var
|
|
26
|
-
a.value = "", l("search", ""), l("update:model-value", ""), (t = (
|
|
25
|
+
var n, t;
|
|
26
|
+
a.value = "", l("search", ""), l("update:model-value", ""), (t = (n = d.value) == null ? void 0 : n.inputEl) == null || t.focus();
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function x() {
|
|
29
29
|
l("update:model-value", a.value);
|
|
30
30
|
}
|
|
31
|
-
return (
|
|
31
|
+
return (n, t) => (m(), h(W, {
|
|
32
32
|
ref_key: "stashInputRef",
|
|
33
|
-
ref:
|
|
33
|
+
ref: d,
|
|
34
34
|
modelValue: a.value,
|
|
35
35
|
"onUpdate:modelValue": [
|
|
36
36
|
t[0] || (t[0] = (B) => a.value = B),
|
|
37
|
-
|
|
37
|
+
x
|
|
38
38
|
],
|
|
39
|
-
class:
|
|
39
|
+
class: p(["stash-search-bar", [{ "stash-search-bar--value": !!a.value }]]),
|
|
40
40
|
label: e.label,
|
|
41
41
|
placeholder: e.placeholder,
|
|
42
42
|
"hint-text": e.hintText,
|
|
43
43
|
"data-test": "stash-search-bar",
|
|
44
44
|
onKeyup: s(o, ["enter"])
|
|
45
45
|
}, I({
|
|
46
|
-
append:
|
|
47
|
-
a.value ? (
|
|
46
|
+
append: r(() => [
|
|
47
|
+
a.value ? (m(), h(b, {
|
|
48
48
|
key: 0,
|
|
49
49
|
class: "stash-search-bar__clear-button",
|
|
50
50
|
disabled: e.isLoading,
|
|
@@ -55,13 +55,13 @@ const N = /* @__PURE__ */ C({
|
|
|
55
55
|
s(c, ["space"])
|
|
56
56
|
]
|
|
57
57
|
}, {
|
|
58
|
-
default:
|
|
59
|
-
|
|
58
|
+
default: r(() => [
|
|
59
|
+
u(v, { name: "close" })
|
|
60
60
|
]),
|
|
61
61
|
_: 1
|
|
62
62
|
}, 8, ["disabled"])) : T("", !0),
|
|
63
|
-
|
|
64
|
-
tabindex:
|
|
63
|
+
u(b, {
|
|
64
|
+
tabindex: g.value,
|
|
65
65
|
"data-test": "stash-search-bar|search-button",
|
|
66
66
|
disabled: e.isLoading,
|
|
67
67
|
class: "stash-search-bar__search-button",
|
|
@@ -71,9 +71,9 @@ const N = /* @__PURE__ */ C({
|
|
|
71
71
|
s(o, ["space"])
|
|
72
72
|
]
|
|
73
73
|
}, {
|
|
74
|
-
default:
|
|
75
|
-
|
|
76
|
-
class:
|
|
74
|
+
default: r(() => [
|
|
75
|
+
u(v, {
|
|
76
|
+
class: p({ "animate-spin": e.isWorking }),
|
|
77
77
|
name: e.isWorking ? "loading-empty" : "search"
|
|
78
78
|
}, null, 8, ["class", "name"])
|
|
79
79
|
]),
|
|
@@ -82,17 +82,19 @@ const N = /* @__PURE__ */ C({
|
|
|
82
82
|
]),
|
|
83
83
|
_: 2
|
|
84
84
|
}, [
|
|
85
|
-
K(
|
|
85
|
+
K(k).hint ? {
|
|
86
86
|
name: "hint",
|
|
87
|
-
fn:
|
|
88
|
-
L(
|
|
87
|
+
fn: r(() => [
|
|
88
|
+
L(n.$slots, "hint")
|
|
89
89
|
]),
|
|
90
90
|
key: "0"
|
|
91
91
|
} : void 0
|
|
92
92
|
]), 1032, ["modelValue", "class", "label", "placeholder", "hint-text"]));
|
|
93
93
|
}
|
|
94
|
-
}),
|
|
94
|
+
}), N = {}, R = {
|
|
95
|
+
$style: N
|
|
96
|
+
}, A = /* @__PURE__ */ w(M, [["__cssModules", R]]);
|
|
95
97
|
export {
|
|
96
|
-
|
|
98
|
+
A as default
|
|
97
99
|
};
|
|
98
100
|
//# sourceMappingURL=SearchBar.js.map
|
package/dist/SearchBar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sources":["../src/components/SearchBar/SearchBar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, useSlots } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import Input from '../Input/Input.vue';\n\n export interface SearchBarProps {\n /**\n * Indicates loading activity (for example async request) that should prevent search\n */\n isLoading?: boolean;\n\n /**\n * Sets a visual indicator that the search is active\n */\n isWorking?: boolean;\n\n /**\n * The search term\n */\n modelValue?: string;\n\n /**\n * Placeholder text for the input\n */\n placeholder?: string;\n\n /**\n * Label for search bar\n */\n label?: string;\n\n /**\n * Text below the input\n */\n hintText?: string;\n }\n\n defineOptions({\n name: 'll-search-bar',\n });\n\n const props = withDefaults(defineProps<SearchBarProps>(), {\n isLoading: false,\n isWorking: false,\n modelValue: '',\n placeholder: t('ll.search'),\n label: t('ll.search'),\n hintText: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when searching or clearing the search input\n */\n (e: 'search', searchTerm: string): void;\n\n /**\n * Emitted when the search term changes\n */\n (e: 'update:model-value', searchTerm: string): void;\n }>();\n\n const slots = useSlots();\n const searchTerm = ref(props.modelValue);\n const stashInputRef = ref<InstanceType<typeof Input>>();\n\n const searchTabIndex = computed(() => (searchTerm.value ? 0 : -1));\n\n function onSearch() {\n if (props.isLoading || props.isWorking) {\n return;\n }\n emit('search', searchTerm.value);\n }\n\n function clearSearchTerm() {\n searchTerm.value = '';\n emit('search', '');\n emit('update:model-value', '');\n\n stashInputRef.value?.inputEl?.focus();\n }\n\n function handleChange() {\n emit('update:model-value', searchTerm.value);\n }\n</script>\n\n<template>\n <Input\n ref=\"stashInputRef\"\n v-model=\"searchTerm\"\n class=\"stash-search-bar\"\n :class=\"[{ 'stash-search-bar--value': !!searchTerm }]\"\n :label=\"props.label\"\n :placeholder=\"props.placeholder\"\n :hint-text=\"props.hintText\"\n data-test=\"stash-search-bar\"\n @update:model-value=\"handleChange\"\n @keyup.enter=\"onSearch\"\n >\n <template #append>\n <Button\n v-if=\"searchTerm\"\n class=\"stash-search-bar__clear-button\"\n :disabled=\"props.isLoading\"\n data-test=\"stash-search-bar|clear-button\"\n @click=\"clearSearchTerm\"\n @keyup.enter=\"clearSearchTerm\"\n @keyup.space=\"clearSearchTerm\"\n >\n <Icon name=\"close\" />\n </Button>\n <Button\n :tabindex=\"searchTabIndex\"\n data-test=\"stash-search-bar|search-button\"\n :disabled=\"props.isLoading\"\n class=\"stash-search-bar__search-button\"\n @click=\"onSearch\"\n @keyup.enter=\"onSearch\"\n @keyup.space=\"onSearch\"\n >\n <Icon :class=\"{ 'animate-spin': props.isWorking }\" :name=\"props.isWorking ? 'loading-empty' : 'search'\" />\n </Button>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <!-- @slot Overrides the Input hint-text prop -->\n <slot name=\"hint\"></slot>\n </template>\n </Input>\n</template>\n\n<style
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sources":["../src/components/SearchBar/SearchBar.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, useSlots } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Icon from '../Icon/Icon.vue';\n import Input from '../Input/Input.vue';\n\n export interface SearchBarProps {\n /**\n * Indicates loading activity (for example async request) that should prevent search\n */\n isLoading?: boolean;\n\n /**\n * Sets a visual indicator that the search is active\n */\n isWorking?: boolean;\n\n /**\n * The search term\n */\n modelValue?: string;\n\n /**\n * Placeholder text for the input\n */\n placeholder?: string;\n\n /**\n * Label for search bar\n */\n label?: string;\n\n /**\n * Text below the input\n */\n hintText?: string;\n }\n\n defineOptions({\n name: 'll-search-bar',\n });\n\n const props = withDefaults(defineProps<SearchBarProps>(), {\n isLoading: false,\n isWorking: false,\n modelValue: '',\n placeholder: t('ll.search'),\n label: t('ll.search'),\n hintText: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when searching or clearing the search input\n */\n (e: 'search', searchTerm: string): void;\n\n /**\n * Emitted when the search term changes\n */\n (e: 'update:model-value', searchTerm: string): void;\n }>();\n\n const slots = useSlots();\n const searchTerm = ref(props.modelValue);\n const stashInputRef = ref<InstanceType<typeof Input>>();\n\n const searchTabIndex = computed(() => (searchTerm.value ? 0 : -1));\n\n function onSearch() {\n if (props.isLoading || props.isWorking) {\n return;\n }\n emit('search', searchTerm.value);\n }\n\n function clearSearchTerm() {\n searchTerm.value = '';\n emit('search', '');\n emit('update:model-value', '');\n\n stashInputRef.value?.inputEl?.focus();\n }\n\n function handleChange() {\n emit('update:model-value', searchTerm.value);\n }\n</script>\n\n<template>\n <Input\n ref=\"stashInputRef\"\n v-model=\"searchTerm\"\n class=\"stash-search-bar\"\n :class=\"[{ 'stash-search-bar--value': !!searchTerm }]\"\n :label=\"props.label\"\n :placeholder=\"props.placeholder\"\n :hint-text=\"props.hintText\"\n data-test=\"stash-search-bar\"\n @update:model-value=\"handleChange\"\n @keyup.enter=\"onSearch\"\n >\n <template #append>\n <Button\n v-if=\"searchTerm\"\n class=\"stash-search-bar__clear-button\"\n :disabled=\"props.isLoading\"\n data-test=\"stash-search-bar|clear-button\"\n @click=\"clearSearchTerm\"\n @keyup.enter=\"clearSearchTerm\"\n @keyup.space=\"clearSearchTerm\"\n >\n <Icon name=\"close\" />\n </Button>\n <Button\n :tabindex=\"searchTabIndex\"\n data-test=\"stash-search-bar|search-button\"\n :disabled=\"props.isLoading\"\n class=\"stash-search-bar__search-button\"\n @click=\"onSearch\"\n @keyup.enter=\"onSearch\"\n @keyup.space=\"onSearch\"\n >\n <Icon :class=\"{ 'animate-spin': props.isWorking }\" :name=\"props.isWorking ? 'loading-empty' : 'search'\" />\n </Button>\n </template>\n <template v-if=\"slots.hint\" #hint>\n <!-- @slot Overrides the Input hint-text prop -->\n <slot name=\"hint\"></slot>\n </template>\n </Input>\n</template>\n\n<style module>\n @reference \"../../../styles/main.css\";\n\n @layer utilities {\n :global(:where(.stash-search-bar) input) {\n text-overflow: ellipsis;\n }\n\n :global(:where(.stash-search-bar).stash-search-bar--value input) {\n padding-right: 72px;\n }\n\n :global(:where(.stash-search-bar) input:hover) {\n border: 1px solid var(--color-blue-500);\n }\n\n :global(:where(.stash-search-bar) .stash-input-append) {\n display: flex;\n justify-content: flex-end;\n width: 72px; /* double the the default width of 36px */\n overflow: visible;\n }\n\n :global(:where(.stash-search-bar) .stash-search-bar__clear-button) {\n color: var(--color-ice-700);\n height: --spacing(9);\n min-width: --spacing(9);\n width: --spacing(9);\n background: none;\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:focus-visible {\n outline: none;\n box-shadow: none;\n\n & svg {\n border-radius: var(--radius-sm);\n\n @apply ring-4 ring-blue-500/15;\n }\n }\n }\n\n :global(:where(.stash-search-bar) .stash-search-bar__clear-button:disabled) {\n color: var(--color-ice-500);\n cursor: default;\n }\n\n :global(:where(.stash-search-bar) .stash-search-bar__search-button) {\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n height: --spacing(9);\n min-width: --spacing(9);\n width: --spacing(9);\n display: flex;\n align-items: center;\n justify-content: center;\n\n &:focus {\n box-shadow: none;\n }\n\n &:disabled {\n border-color: var(--color-ice-500);\n }\n\n &:hover {\n background-color: var(--color-blue-600);\n }\n\n &:active {\n background-color: var(--color-blue-700);\n }\n\n &:focus-visible {\n outline: none;\n border: 1px solid var(--color-blue-900);\n /* Simulating a bigger border so the design does not break */\n box-shadow:\n inset 0 0 0 1px var(--color-blue-900),\n 0 0 0 4px rgb(0 114 240 / 15%); /* Unfortunatelly, we have to use RGBA to make the shadow transparent, this is blue-500 */\n }\n }\n }\n</style>\n"],"names":["props","__props","emit","__emit","slots","useSlots","searchTerm","ref","stashInputRef","searchTabIndex","computed","onSearch","clearSearchTerm","_b","_a","handleChange","_createBlock","Input","$event","_normalizeClass","Button","_createVNode","Icon","_unref","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