@vuetify/nightly 3.7.5-dev.2024-12-03 → 3.7.5-dev.2024-12-16

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.
Files changed (77) hide show
  1. package/dist/json/attributes.json +3779 -3779
  2. package/dist/json/importMap-labs.json +20 -20
  3. package/dist/json/importMap.json +136 -136
  4. package/dist/json/web-types.json +7026 -7026
  5. package/dist/vuetify-labs.css +4372 -4372
  6. package/dist/vuetify-labs.d.ts +40 -40
  7. package/dist/vuetify-labs.esm.js +21 -38
  8. package/dist/vuetify-labs.esm.js.map +1 -1
  9. package/dist/vuetify-labs.js +20 -37
  10. package/dist/vuetify-labs.min.css +2 -2
  11. package/dist/vuetify.css +4189 -4189
  12. package/dist/vuetify.d.ts +92 -92
  13. package/dist/vuetify.esm.js +21 -38
  14. package/dist/vuetify.esm.js.map +1 -1
  15. package/dist/vuetify.js +20 -37
  16. package/dist/vuetify.js.map +1 -1
  17. package/dist/vuetify.min.css +2 -2
  18. package/dist/vuetify.min.js +876 -881
  19. package/dist/vuetify.min.js.map +1 -1
  20. package/lib/components/VAppBar/index.d.mts +6 -6
  21. package/lib/components/VAutocomplete/index.d.mts +6 -6
  22. package/lib/components/VBtn/index.d.mts +7 -7
  23. package/lib/components/VBtnToggle/index.d.mts +9 -9
  24. package/lib/components/VCarousel/VCarousel.mjs.map +1 -1
  25. package/lib/components/VCarousel/index.d.mts +9 -9
  26. package/lib/components/VCheckbox/VCheckbox.mjs +3 -3
  27. package/lib/components/VCheckbox/VCheckbox.mjs.map +1 -1
  28. package/lib/components/VChipGroup/VChipGroup.mjs.map +1 -1
  29. package/lib/components/VChipGroup/index.d.mts +15 -15
  30. package/lib/components/VCombobox/index.d.mts +6 -6
  31. package/lib/components/VExpansionPanel/index.d.mts +7 -7
  32. package/lib/components/VFab/index.d.mts +6 -6
  33. package/lib/components/VField/VField.mjs +3 -3
  34. package/lib/components/VField/VField.mjs.map +1 -1
  35. package/lib/components/VInput/VInput.mjs +3 -3
  36. package/lib/components/VInput/VInput.mjs.map +1 -1
  37. package/lib/components/VItemGroup/VItemGroup.mjs.map +1 -1
  38. package/lib/components/VItemGroup/index.d.mts +9 -9
  39. package/lib/components/VMenu/VMenu.mjs +3 -3
  40. package/lib/components/VMenu/VMenu.mjs.map +1 -1
  41. package/lib/components/VMenu/index.d.mts +6 -6
  42. package/lib/components/VRadioGroup/VRadioGroup.mjs +3 -3
  43. package/lib/components/VRadioGroup/VRadioGroup.mjs.map +1 -1
  44. package/lib/components/VRating/VRating.mjs +4 -3
  45. package/lib/components/VRating/VRating.mjs.map +1 -1
  46. package/lib/components/VSelect/index.d.mts +6 -6
  47. package/lib/components/VSelectionControl/VSelectionControl.mjs +3 -3
  48. package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
  49. package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs +3 -3
  50. package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs.map +1 -1
  51. package/lib/components/VSlideGroup/index.d.mts +10 -10
  52. package/lib/components/VSparkline/VBarline.mjs +3 -3
  53. package/lib/components/VSparkline/VBarline.mjs.map +1 -1
  54. package/lib/components/VSparkline/VTrendline.mjs +3 -3
  55. package/lib/components/VSparkline/VTrendline.mjs.map +1 -1
  56. package/lib/components/VSwitch/VSwitch.mjs +3 -3
  57. package/lib/components/VSwitch/VSwitch.mjs.map +1 -1
  58. package/lib/components/VTabs/index.d.mts +7 -7
  59. package/lib/components/VTooltip/VTooltip.mjs +3 -3
  60. package/lib/components/VTooltip/VTooltip.mjs.map +1 -1
  61. package/lib/components/VWindow/index.d.mts +7 -7
  62. package/lib/components/index.d.mts +40 -40
  63. package/lib/composables/group.mjs +3 -3
  64. package/lib/composables/group.mjs.map +1 -1
  65. package/lib/composables/layout.mjs +3 -3
  66. package/lib/composables/layout.mjs.map +1 -1
  67. package/lib/composables/nested/nested.mjs +2 -2
  68. package/lib/composables/nested/nested.mjs.map +1 -1
  69. package/lib/composables/validation.mjs +3 -3
  70. package/lib/composables/validation.mjs.map +1 -1
  71. package/lib/entry-bundler.mjs +1 -1
  72. package/lib/framework.mjs +2 -3
  73. package/lib/framework.mjs.map +1 -1
  74. package/lib/index.d.mts +52 -52
  75. package/lib/util/getCurrentInstance.mjs +1 -15
  76. package/lib/util/getCurrentInstance.mjs.map +1 -1
  77. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"VRating.mjs","names":["VBtn","makeComponentProps","makeDensityProps","IconValue","useLocale","useProxiedModel","makeSizeProps","makeTagProps","makeThemeProps","provideTheme","computed","shallowRef","clamp","createRange","genericComponent","getUid","propsFactory","useRender","makeVRatingProps","name","String","itemAriaLabel","type","default","activeColor","color","clearable","Boolean","disabled","emptyIcon","fullIcon","halfIncrements","hover","length","Number","readonly","modelValue","itemLabels","Array","itemLabelPosition","validator","v","includes","ripple","VRating","props","emits","value","setup","_ref","slots","t","themeClasses","rating","normalizedValue","parseFloat","range","increments","flatMap","hoverIndex","itemState","map","isHovering","isFilled","isHovered","isFullIcon","icon","eventState","onMouseenter","onMouseleave","onClick","undefined","VRatingItem","_ref2","index","showStar","id","replace","btnProps","density","size","variant","_createVNode","_Fragment","item","_mergeProps","createLabel","labelProps","label","_createTextVNode","hasLabels","tag","class","style","i"],"sources":["../../../src/components/VRating/VRating.tsx"],"sourcesContent":["// Styles\nimport './VRating.sass'\n\n// Components\nimport { VBtn } from '@/components/VBtn'\n\n// Composables\nimport { makeComponentProps } from '@/composables/component'\nimport { makeDensityProps } from '@/composables/density'\nimport { IconValue } from '@/composables/icons'\nimport { useLocale } from '@/composables/locale'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { makeSizeProps } from '@/composables/size'\nimport { makeTagProps } from '@/composables/tag'\nimport { makeThemeProps, provideTheme } from '@/composables/theme'\n\n// Utilities\nimport { computed, shallowRef } from 'vue'\nimport { clamp, createRange, genericComponent, getUid, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { Prop } from 'vue'\nimport type { Variant } from '@/composables/variant'\n\ntype VRatingItemSlot = {\n value: number\n index: number\n isFilled: boolean\n isHovered: boolean\n icon: IconValue\n color?: string\n props: Record<string, unknown>\n rating: number\n}\n\ntype VRatingItemLabelSlot = {\n value: number\n index: number\n label?: string\n}\n\ntype VRatingSlots = {\n item: VRatingItemSlot\n 'item-label': VRatingItemLabelSlot\n}\n\nexport const makeVRatingProps = propsFactory({\n name: String,\n itemAriaLabel: {\n type: String,\n default: '$vuetify.rating.ariaLabel.item',\n },\n activeColor: String,\n color: String,\n clearable: Boolean,\n disabled: Boolean,\n emptyIcon: {\n type: IconValue,\n default: '$ratingEmpty',\n },\n fullIcon: {\n type: IconValue,\n default: '$ratingFull',\n },\n halfIncrements: Boolean,\n hover: Boolean,\n length: {\n type: [Number, String],\n default: 5,\n },\n readonly: Boolean,\n modelValue: {\n type: [Number, String],\n default: 0,\n },\n itemLabels: Array as Prop<string[]>,\n itemLabelPosition: {\n type: String,\n default: 'top',\n validator: (v: any) => ['top', 'bottom'].includes(v),\n },\n ripple: Boolean,\n\n ...makeComponentProps(),\n ...makeDensityProps(),\n ...makeSizeProps(),\n ...makeTagProps(),\n ...makeThemeProps(),\n}, 'VRating')\n\nexport const VRating = genericComponent<VRatingSlots>()({\n name: 'VRating',\n\n props: makeVRatingProps(),\n\n emits: {\n 'update:modelValue': (value: number | string) => true,\n },\n\n setup (props, { slots }) {\n const { t } = useLocale()\n const { themeClasses } = provideTheme(props)\n const rating = useProxiedModel(props, 'modelValue')\n const normalizedValue = computed(() => clamp(parseFloat(rating.value), 0, +props.length))\n\n const range = computed(() => createRange(Number(props.length), 1))\n const increments = computed(() => range.value.flatMap(v => props.halfIncrements ? [v - 0.5, v] : [v]))\n const hoverIndex = shallowRef(-1)\n\n const itemState = computed(() => increments.value.map(value => {\n const isHovering = props.hover && hoverIndex.value > -1\n const isFilled = normalizedValue.value >= value\n const isHovered = hoverIndex.value >= value\n const isFullIcon = isHovering ? isHovered : isFilled\n const icon = isFullIcon ? props.fullIcon : props.emptyIcon\n const activeColor = props.activeColor ?? props.color\n const color = (isFilled || isHovered) ? activeColor : props.color\n\n return { isFilled, isHovered, icon, color }\n }))\n\n const eventState = computed(() => [0, ...increments.value].map(value => {\n function onMouseenter () {\n hoverIndex.value = value\n }\n\n function onMouseleave () {\n hoverIndex.value = -1\n }\n\n function onClick () {\n if (props.disabled || props.readonly) return\n rating.value = normalizedValue.value === value && props.clearable ? 0 : value\n }\n\n return {\n onMouseenter: props.hover ? onMouseenter : undefined,\n onMouseleave: props.hover ? onMouseleave : undefined,\n onClick,\n }\n }))\n\n const name = computed(() => props.name ?? `v-rating-${getUid()}`)\n\n function VRatingItem ({ value, index, showStar = true }: { value: number, index: number, showStar?: boolean }) {\n const { onMouseenter, onMouseleave, onClick } = eventState.value[index + 1]\n const id = `${name.value}-${String(value).replace('.', '-')}`\n const btnProps = {\n color: itemState.value[index]?.color,\n density: props.density,\n disabled: props.disabled,\n icon: itemState.value[index]?.icon,\n ripple: props.ripple,\n size: props.size,\n variant: 'plain' as Variant,\n }\n\n return (\n <>\n <label\n for={ id }\n class={{\n 'v-rating__item--half': props.halfIncrements && value % 1 > 0,\n 'v-rating__item--full': props.halfIncrements && value % 1 === 0,\n }}\n onMouseenter={ onMouseenter }\n onMouseleave={ onMouseleave }\n onClick={ onClick }\n >\n <span class=\"v-rating__hidden\">{ t(props.itemAriaLabel, value, props.length) }</span>\n {\n !showStar ? undefined\n : slots.item ? slots.item({\n ...itemState.value[index],\n props: btnProps,\n value,\n index,\n rating: normalizedValue.value,\n })\n : (\n <VBtn\n aria-label={ t(props.itemAriaLabel, value, props.length) }\n { ...btnProps }\n />\n )\n }\n </label>\n\n <input\n class=\"v-rating__hidden\"\n name={ name.value }\n id={ id }\n type=\"radio\"\n value={ value }\n checked={ normalizedValue.value === value }\n tabindex={ -1 }\n readonly={ props.readonly }\n disabled={ props.disabled }\n />\n </>\n )\n }\n\n function createLabel (labelProps: { value: number, index: number, label?: string }) {\n if (slots['item-label']) return slots['item-label'](labelProps)\n\n if (labelProps.label) return <span>{ labelProps.label }</span>\n\n return <span>&nbsp;</span>\n }\n\n useRender(() => {\n const hasLabels = !!props.itemLabels?.length || slots['item-label']\n\n return (\n <props.tag\n class={[\n 'v-rating',\n {\n 'v-rating--hover': props.hover,\n 'v-rating--readonly': props.readonly,\n },\n themeClasses.value,\n props.class,\n ]}\n style={ props.style }\n >\n <VRatingItem value={ 0 } index={ -1 } showStar={ false } />\n\n { range.value.map((value, i) => (\n <div class=\"v-rating__wrapper\">\n {\n hasLabels && props.itemLabelPosition === 'top'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n <div class=\"v-rating__item\">\n { props.halfIncrements ? (\n <>\n <VRatingItem value={ value - 0.5 } index={ i * 2 } />\n <VRatingItem value={ value } index={ (i * 2) + 1 } />\n </>\n ) : (\n <VRatingItem value={ value } index={ i } />\n )}\n </div>\n {\n hasLabels && props.itemLabelPosition === 'bottom'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n </div>\n ))}\n </props.tag>\n )\n })\n\n return {}\n },\n})\n\nexport type VRating = InstanceType<typeof VRating>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,IAAI,6BAEb;AAAA,SACSC,kBAAkB;AAAA,SAClBC,gBAAgB;AAAA,SAChBC,SAAS;AAAA,SACTC,SAAS;AAAA,SACTC,eAAe;AAAA,SACfC,aAAa;AAAA,SACbC,YAAY;AAAA,SACZC,cAAc,EAAEC,YAAY,uCAErC;AACA,SAASC,QAAQ,EAAEC,UAAU,QAAQ,KAAK;AAAA,SACjCC,KAAK,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,SAAS,gCAE9E;AA0BA,OAAO,MAAMC,gBAAgB,GAAGF,YAAY,CAAC;EAC3CG,IAAI,EAAEC,MAAM;EACZC,aAAa,EAAE;IACbC,IAAI,EAAEF,MAAM;IACZG,OA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,CAAC,CAACd,KAAK,EAAE+C,CAAC,KAAAZ,YAAA;UAAA;QAAA,IAGrBQ,SAAS,IAAI7C,KAAK,CAACN,iBAAiB,KAAK,KAAK,GAC1C+C,WAAW,CAAC;UAAEvC,KAAK;UAAE2B,KAAK,EAAEoB,CAAC;UAAEN,KAAK,EAAE3C,KAAK,CAACR,UAAU,GAAGyD,CAAC;QAAE,CAAC,CAAC,GAC9DvB,SAAS,EAAAW,YAAA;UAAA;QAAA,IAGXrC,KAAK,CAACd,cAAc,GAAAmD,YAAA,CAAAC,SAAA,SAAAD,YAAA,CAAAV,WAAA;UAAA,SAEGzB,KAAK,GAAG,GAAG;UAAA,SAAW+C,CAAC,GAAG;QAAC,UAAAZ,YAAA,CAAAV,WAAA;UAAA,SAC3BzB,KAAK;UAAA,SAAY+C,CAAC,GAAG,CAAC,GAAI;QAAC,aAAAZ,YAAA,CAAAV,WAAA;UAAA,SAG7BzB,KAAK;UAAA,SAAW+C;QAAC,QACvC,IAGDJ,SAAS,IAAI7C,KAAK,CAACN,iBAAiB,KAAK,QAAQ,GAC7C+C,WAAW,CAAC;UAAEvC,KAAK;UAAE2B,KAAK,EAAEoB,CAAC;UAAEN,KAAK,EAAE3C,KAAK,CAACR,UAAU,GAAGyD,CAAC;QAAE,CAAC,CAAC,GAC9DvB,SAAS,EAGlB,CAAC;MAAA;IAGR,CAAC,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"VRating.mjs","names":["VBtn","makeComponentProps","makeDensityProps","IconValue","useLocale","useProxiedModel","makeSizeProps","makeTagProps","makeThemeProps","provideTheme","computed","shallowRef","useId","clamp","createRange","genericComponent","propsFactory","useRender","makeVRatingProps","name","String","itemAriaLabel","type","default","activeColor","color","clearable","Boolean","disabled","emptyIcon","fullIcon","halfIncrements","hover","length","Number","readonly","modelValue","itemLabels","Array","itemLabelPosition","validator","v","includes","ripple","VRating","props","emits","value","setup","_ref","slots","t","themeClasses","rating","normalizedValue","parseFloat","range","increments","flatMap","hoverIndex","itemState","map","isHovering","isFilled","isHovered","isFullIcon","icon","eventState","onMouseenter","onMouseleave","onClick","undefined","uid","VRatingItem","_ref2","index","showStar","id","replace","btnProps","density","size","variant","_createVNode","_Fragment","item","_mergeProps","createLabel","labelProps","label","_createTextVNode","hasLabels","tag","class","style","i"],"sources":["../../../src/components/VRating/VRating.tsx"],"sourcesContent":["// Styles\nimport './VRating.sass'\n\n// Components\nimport { VBtn } from '@/components/VBtn'\n\n// Composables\nimport { makeComponentProps } from '@/composables/component'\nimport { makeDensityProps } from '@/composables/density'\nimport { IconValue } from '@/composables/icons'\nimport { useLocale } from '@/composables/locale'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { makeSizeProps } from '@/composables/size'\nimport { makeTagProps } from '@/composables/tag'\nimport { makeThemeProps, provideTheme } from '@/composables/theme'\n\n// Utilities\nimport { computed, shallowRef, useId } from 'vue'\nimport { clamp, createRange, genericComponent, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { Prop } from 'vue'\nimport type { Variant } from '@/composables/variant'\n\ntype VRatingItemSlot = {\n value: number\n index: number\n isFilled: boolean\n isHovered: boolean\n icon: IconValue\n color?: string\n props: Record<string, unknown>\n rating: number\n}\n\ntype VRatingItemLabelSlot = {\n value: number\n index: number\n label?: string\n}\n\ntype VRatingSlots = {\n item: VRatingItemSlot\n 'item-label': VRatingItemLabelSlot\n}\n\nexport const makeVRatingProps = propsFactory({\n name: String,\n itemAriaLabel: {\n type: String,\n default: '$vuetify.rating.ariaLabel.item',\n },\n activeColor: String,\n color: String,\n clearable: Boolean,\n disabled: Boolean,\n emptyIcon: {\n type: IconValue,\n default: '$ratingEmpty',\n },\n fullIcon: {\n type: IconValue,\n default: '$ratingFull',\n },\n halfIncrements: Boolean,\n hover: Boolean,\n length: {\n type: [Number, String],\n default: 5,\n },\n readonly: Boolean,\n modelValue: {\n type: [Number, String],\n default: 0,\n },\n itemLabels: Array as Prop<string[]>,\n itemLabelPosition: {\n type: String,\n default: 'top',\n validator: (v: any) => ['top', 'bottom'].includes(v),\n },\n ripple: Boolean,\n\n ...makeComponentProps(),\n ...makeDensityProps(),\n ...makeSizeProps(),\n ...makeTagProps(),\n ...makeThemeProps(),\n}, 'VRating')\n\nexport const VRating = genericComponent<VRatingSlots>()({\n name: 'VRating',\n\n props: makeVRatingProps(),\n\n emits: {\n 'update:modelValue': (value: number | string) => true,\n },\n\n setup (props, { slots }) {\n const { t } = useLocale()\n const { themeClasses } = provideTheme(props)\n const rating = useProxiedModel(props, 'modelValue')\n const normalizedValue = computed(() => clamp(parseFloat(rating.value), 0, +props.length))\n\n const range = computed(() => createRange(Number(props.length), 1))\n const increments = computed(() => range.value.flatMap(v => props.halfIncrements ? [v - 0.5, v] : [v]))\n const hoverIndex = shallowRef(-1)\n\n const itemState = computed(() => increments.value.map(value => {\n const isHovering = props.hover && hoverIndex.value > -1\n const isFilled = normalizedValue.value >= value\n const isHovered = hoverIndex.value >= value\n const isFullIcon = isHovering ? isHovered : isFilled\n const icon = isFullIcon ? props.fullIcon : props.emptyIcon\n const activeColor = props.activeColor ?? props.color\n const color = (isFilled || isHovered) ? activeColor : props.color\n\n return { isFilled, isHovered, icon, color }\n }))\n\n const eventState = computed(() => [0, ...increments.value].map(value => {\n function onMouseenter () {\n hoverIndex.value = value\n }\n\n function onMouseleave () {\n hoverIndex.value = -1\n }\n\n function onClick () {\n if (props.disabled || props.readonly) return\n rating.value = normalizedValue.value === value && props.clearable ? 0 : value\n }\n\n return {\n onMouseenter: props.hover ? onMouseenter : undefined,\n onMouseleave: props.hover ? onMouseleave : undefined,\n onClick,\n }\n }))\n\n const uid = useId()\n const name = computed(() => props.name ?? `v-rating-${uid}`)\n\n function VRatingItem ({ value, index, showStar = true }: { value: number, index: number, showStar?: boolean }) {\n const { onMouseenter, onMouseleave, onClick } = eventState.value[index + 1]\n const id = `${name.value}-${String(value).replace('.', '-')}`\n const btnProps = {\n color: itemState.value[index]?.color,\n density: props.density,\n disabled: props.disabled,\n icon: itemState.value[index]?.icon,\n ripple: props.ripple,\n size: props.size,\n variant: 'plain' as Variant,\n }\n\n return (\n <>\n <label\n for={ id }\n class={{\n 'v-rating__item--half': props.halfIncrements && value % 1 > 0,\n 'v-rating__item--full': props.halfIncrements && value % 1 === 0,\n }}\n onMouseenter={ onMouseenter }\n onMouseleave={ onMouseleave }\n onClick={ onClick }\n >\n <span class=\"v-rating__hidden\">{ t(props.itemAriaLabel, value, props.length) }</span>\n {\n !showStar ? undefined\n : slots.item ? slots.item({\n ...itemState.value[index],\n props: btnProps,\n value,\n index,\n rating: normalizedValue.value,\n })\n : (\n <VBtn\n aria-label={ t(props.itemAriaLabel, value, props.length) }\n { ...btnProps }\n />\n )\n }\n </label>\n\n <input\n class=\"v-rating__hidden\"\n name={ name.value }\n id={ id }\n type=\"radio\"\n value={ value }\n checked={ normalizedValue.value === value }\n tabindex={ -1 }\n readonly={ props.readonly }\n disabled={ props.disabled }\n />\n </>\n )\n }\n\n function createLabel (labelProps: { value: number, index: number, label?: string }) {\n if (slots['item-label']) return slots['item-label'](labelProps)\n\n if (labelProps.label) return <span>{ labelProps.label }</span>\n\n return <span>&nbsp;</span>\n }\n\n useRender(() => {\n const hasLabels = !!props.itemLabels?.length || slots['item-label']\n\n return (\n <props.tag\n class={[\n 'v-rating',\n {\n 'v-rating--hover': props.hover,\n 'v-rating--readonly': props.readonly,\n },\n themeClasses.value,\n props.class,\n ]}\n style={ props.style }\n >\n <VRatingItem value={ 0 } index={ -1 } showStar={ false } />\n\n { range.value.map((value, i) => (\n <div class=\"v-rating__wrapper\">\n {\n hasLabels && props.itemLabelPosition === 'top'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n <div class=\"v-rating__item\">\n { props.halfIncrements ? (\n <>\n <VRatingItem value={ value - 0.5 } index={ i * 2 } />\n <VRatingItem value={ value } index={ (i * 2) + 1 } />\n </>\n ) : (\n <VRatingItem value={ value } index={ i } />\n )}\n </div>\n {\n hasLabels && props.itemLabelPosition === 'bottom'\n ? createLabel({ value, index: i, label: props.itemLabels?.[i] })\n : undefined\n }\n </div>\n ))}\n </props.tag>\n )\n })\n\n return {}\n },\n})\n\nexport type VRating = InstanceType<typeof VRating>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,IAAI,6BAEb;AAAA,SACSC,kBAAkB;AAAA,SAClBC,gBAAgB;AAAA,SAChBC,SAAS;AAAA,SACTC,SAAS;AAAA,SACTC,eAAe;AAAA,SACfC,aAAa;AAAA,SACbC,YAAY;AAAA,SACZC,cAAc,EAAEC,YAAY,uCAErC;AACA,SAASC,QAAQ,EAAEC,UAAU,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACxCC,KAAK,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,gCAEtE;AA0BA,OAAO,MAAMC,gBAAgB,GAAGF,YAAY,CAAC;EAC3CG,IAAI,EAAEC,MAAM;EACZC,aAAa,EAAE;IACbC,IAAI,EAAEF,MAAM;IACZG,OAAO,EAAE;EACX,CAAC;EACDC,WAAW,EAAEJ,MAAM;EACnBK,KAAK,EAAEL,MAAM;EACbM,SAAS,EAAEC,OAAO;EAClBC,QAAQ,EAAED,OAAO;EACjBE,SAAS,EAAE;IACTP,IAAI,EAAEnB,SAAS;IACfoB,OAAO,EAAE;EACX,CAAC;EACDO,QAAQ,EAAE;IACRR,IAAI,EAAEnB,SAAS;IACfoB,OAAO,EAAE;EACX,CAAC;EACDQ,cAAc,EAAEJ,OAAO;EACvBK,KAAK,EAAEL,OAAO;EACdM,MAAM,EAAE;IACNX,IAAI,EAAE,CAACY,MAAM,EAAEd,MAAM,CAAC;IACtBG,OAAO,EAAE;EACX,CAAC;EACDY,QAAQ,EAAER,OAAO;EACjBS,UAAU,EAAE;IACVd,IAAI,EAAE,CAACY,MAAM,EAAEd,MAAM,CAAC;IACtBG,OAAO,EAAE;EACX,CAAC;EACDc,UAA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AAAZ,YAAA,CAAAV,WAAA;UAAA,SAG7B1B,KAAK;UAAA,SAAWgD;QAAC,QACvC,IAGDJ,SAAS,IAAI9C,KAAK,CAACN,iBAAiB,KAAK,QAAQ,GAC7CgD,WAAW,CAAC;UAAExC,KAAK;UAAE4B,KAAK,EAAEoB,CAAC;UAAEN,KAAK,EAAE5C,KAAK,CAACR,UAAU,GAAG0D,CAAC;QAAE,CAAC,CAAC,GAC9DxB,SAAS,EAGlB,CAAC;MAAA;IAGR,CAAC,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC","ignoreList":[]}
@@ -977,7 +977,7 @@ declare const VMenu: {
977
977
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
978
978
  }, {
979
979
  id: vue.ComputedRef<string>;
980
- ΨopenChildren: vue.ShallowRef<Set<number>, Set<number>>;
980
+ ΨopenChildren: vue.ShallowRef<Set<string>, Set<string>>;
981
981
  } & Omit<Omit<{
982
982
  $: vue.ComponentInternalInstance;
983
983
  $data: {};
@@ -1390,7 +1390,7 @@ declare const VMenu: {
1390
1390
  updateLocation: vue.Ref<((e: Event) => void) | undefined, ((e: Event) => void) | undefined>;
1391
1391
  } | {
1392
1392
  id: vue.ComputedRef<string>;
1393
- ΨopenChildren: vue.ShallowRef<Set<number>, Set<number>>;
1393
+ ΨopenChildren: vue.ShallowRef<Set<string>, Set<string>>;
1394
1394
  };
1395
1395
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1396
1396
  'update:modelValue': (value: boolean) => true;
@@ -1523,7 +1523,7 @@ declare const VMenu: {
1523
1523
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
1524
1524
  }, {
1525
1525
  id: vue.ComputedRef<string>;
1526
- ΨopenChildren: vue.ShallowRef<Set<number>, Set<number>>;
1526
+ ΨopenChildren: vue.ShallowRef<Set<string>, Set<string>>;
1527
1527
  } & Omit<Omit<{
1528
1528
  $: vue.ComponentInternalInstance;
1529
1529
  $data: {};
@@ -1936,7 +1936,7 @@ declare const VMenu: {
1936
1936
  updateLocation: vue.Ref<((e: Event) => void) | undefined, ((e: Event) => void) | undefined>;
1937
1937
  } | {
1938
1938
  id: vue.ComputedRef<string>;
1939
- ΨopenChildren: vue.ShallowRef<Set<number>, Set<number>>;
1939
+ ΨopenChildren: vue.ShallowRef<Set<string>, Set<string>>;
1940
1940
  };
1941
1941
  }, {}, {}, {}, {
1942
1942
  location: Anchor | undefined;
@@ -2055,7 +2055,7 @@ declare const VMenu: {
2055
2055
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
2056
2056
  }, {
2057
2057
  id: vue.ComputedRef<string>;
2058
- ΨopenChildren: vue.ShallowRef<Set<number>, Set<number>>;
2058
+ ΨopenChildren: vue.ShallowRef<Set<string>, Set<string>>;
2059
2059
  } & Omit<Omit<{
2060
2060
  $: vue.ComponentInternalInstance;
2061
2061
  $data: {};
@@ -2468,7 +2468,7 @@ declare const VMenu: {
2468
2468
  updateLocation: vue.Ref<((e: Event) => void) | undefined, ((e: Event) => void) | undefined>;
2469
2469
  } | {
2470
2470
  id: vue.ComputedRef<string>;
2471
- ΨopenChildren: vue.ShallowRef<Set<number>, Set<number>>;
2471
+ ΨopenChildren: vue.ShallowRef<Set<string>, Set<string>>;
2472
2472
  };
2473
2473
  }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
2474
2474
  'update:modelValue': (value: boolean) => true;
@@ -11,8 +11,8 @@ import { makeComponentProps } from "../../composables/component.mjs";
11
11
  import { useDensity } from "../../composables/density.mjs";
12
12
  import { useProxiedModel } from "../../composables/proxiedModel.mjs"; // Directives
13
13
  import { Ripple } from "../../directives/ripple/index.mjs"; // Utilities
14
- import { computed, inject, nextTick, ref, shallowRef } from 'vue';
15
- import { filterInputAttrs, genericComponent, getUid, matchesSelector, propsFactory, useRender, wrapInArray } from "../../util/index.mjs"; // Types
14
+ import { computed, inject, nextTick, ref, shallowRef, useId } from 'vue';
15
+ import { filterInputAttrs, genericComponent, matchesSelector, propsFactory, useRender, wrapInArray } from "../../util/index.mjs"; // Types
16
16
  export const makeVSelectionControlProps = propsFactory({
17
17
  label: String,
18
18
  baseColor: String,
@@ -103,7 +103,7 @@ export const VSelectionControl = genericComponent()({
103
103
  backgroundColorStyles,
104
104
  trueValue
105
105
  } = useSelectionControl(props);
106
- const uid = getUid();
106
+ const uid = useId();
107
107
  const isFocused = shallowRef(false);
108
108
  const isFocusVisible = shallowRef(false);
109
109
  const input = ref();
@@ -1 +1 @@
1
- {"version":3,"file":"VSelectionControl.mjs","names":["VIcon","VLabel","makeSelectionControlGroupProps","VSelectionControlGroupSymbol","useBackgroundColor","useTextColor","makeComponentProps","useDensity","useProxiedModel","Ripple","computed","inject","nextTick","ref","shallowRef","filterInputAttrs","genericComponent","getUid","matchesSelector","propsFactory","useRender","wrapInArray","makeVSelectionControlProps","label","String","baseColor","trueValue","falseValue","value","useSelectionControl","props","group","undefined","densityClasses","modelValue","isMultiple","multiple","Array","isArray","model","get","val","some","v","valueComparator","set","readonly","currentValue","newVal","filter","item","textColorClasses","textColorStyles","error","disabled","color","backgroundColorClasses","backgroundColorStyles","icon","trueIcon","falseIcon","VSelectionControl","name","directives","inheritAttrs","emits","setup","_ref","attrs","slots","uid","isFocused","isFocusVisible","input","id","isInteractive","onForceUpdate","checked","onFocus","e","target","onBlur","onClickLabel","stopPropagation","onInput","forceUpdate","for","rootAttrs","inputAttrs","inputNode","_createVNode","_mergeProps","type","inline","class","style","default","_withDirectives","_Fragment","_resolveDirective","ripple"],"sources":["../../../src/components/VSelectionControl/VSelectionControl.tsx"],"sourcesContent":["// Styles\nimport './VSelectionControl.sass'\n\n// Components\nimport { VIcon } from '@/components/VIcon'\nimport { VLabel } from '@/components/VLabel'\nimport { makeSelectionControlGroupProps, VSelectionControlGroupSymbol } from '@/components/VSelectionControlGroup/VSelectionControlGroup'\n\n// Composables\nimport { useBackgroundColor, useTextColor } from '@/composables/color'\nimport { makeComponentProps } from '@/composables/component'\nimport { useDensity } from '@/composables/density'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Directives\nimport { Ripple } from '@/directives/ripple'\n\n// Utilities\nimport { computed, inject, nextTick, ref, shallowRef } from 'vue'\nimport {\n filterInputAttrs,\n genericComponent,\n getUid,\n matchesSelector,\n propsFactory,\n useRender,\n wrapInArray,\n} from '@/util'\n\n// Types\nimport type { CSSProperties, ExtractPropTypes, Ref, VNode, WritableComputedRef } from 'vue'\nimport type { IconValue } from '@/composables/icons'\nimport type { EventProp, GenericProps } from '@/util'\n\nexport type SelectionControlSlot = {\n model: WritableComputedRef<boolean>\n textColorClasses: Ref<string[]>\n textColorStyles: Ref<CSSProperties>\n backgroundColorClasses: Ref<string[]>\n backgroundColorStyles: Ref<CSSProperties>\n inputNode: VNode\n icon: IconValue | undefined\n props: {\n onBlur: (e: Event) => void\n onFocus: (e: FocusEvent) => void\n id: string\n }\n}\n\nexport type VSelectionControlSlots = {\n default: {\n backgroundColorClasses: Ref<string[]>\n backgroundColorStyles: Ref<CSSProperties>\n }\n label: { label: string | undefined, props: Record<string, unknown> }\n input: SelectionControlSlot\n}\n\nexport const makeVSelectionControlProps = propsFactory({\n label: String,\n baseColor: String,\n trueValue: null,\n falseValue: null,\n value: null,\n\n ...makeComponentProps(),\n ...makeSelectionControlGroupProps(),\n}, 'VSelectionControl')\n\nexport function useSelectionControl (\n props: ExtractPropTypes<ReturnType<typeof makeVSelectionControlProps>> & {\n 'onUpdate:modelValue': EventProp | undefined\n }\n) {\n const group = inject(VSelectionControlGroupSymbol, undefined)\n const { densityClasses } = useDensity(props)\n const modelValue = useProxiedModel(props, 'modelValue')\n const trueValue = computed(() => (\n props.trueValue !== undefined ? props.trueValue\n : props.value !== undefined ? props.value\n : true\n ))\n const falseValue = computed(() => props.falseValue !== undefined ? props.falseValue : false)\n const isMultiple = computed(() => (\n !!props.multiple ||\n (props.multiple == null && Array.isArray(modelValue.value))\n ))\n const model = computed({\n get () {\n const val = group ? group.modelValue.value : modelValue.value\n\n return isMultiple.value\n ? wrapInArray(val).some((v: any) => props.valueComparator(v, trueValue.value))\n : props.valueComparator(val, trueValue.value)\n },\n set (val: boolean) {\n if (props.readonly) return\n\n const currentValue = val ? trueValue.value : falseValue.value\n\n let newVal = currentValue\n\n if (isMultiple.value) {\n newVal = val\n ? [...wrapInArray(modelValue.value), currentValue]\n : wrapInArray(modelValue.value).filter((item: any) => !props.valueComparator(item, trueValue.value))\n }\n\n if (group) {\n group.modelValue.value = newVal\n } else {\n modelValue.value = newVal\n }\n },\n })\n const { textColorClasses, textColorStyles } = useTextColor(computed(() => {\n if (props.error || props.disabled) return undefined\n\n return model.value ? props.color : props.baseColor\n }))\n const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(computed(() => {\n return (\n model.value &&\n !props.error &&\n !props.disabled\n ) ? props.color : props.baseColor\n }))\n const icon = computed(() => model.value ? props.trueIcon : props.falseIcon)\n\n return {\n group,\n densityClasses,\n trueValue,\n falseValue,\n model,\n textColorClasses,\n textColorStyles,\n backgroundColorClasses,\n backgroundColorStyles,\n icon,\n }\n}\n\nexport const VSelectionControl = genericComponent<new <T>(\n props: {\n modelValue?: T\n 'onUpdate:modelValue'?: (value: T) => void\n },\n slots: VSelectionControlSlots,\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VSelectionControl',\n\n directives: { Ripple },\n\n inheritAttrs: false,\n\n props: makeVSelectionControlProps(),\n\n emits: {\n 'update:modelValue': (value: any) => true,\n },\n\n setup (props, { attrs, slots }) {\n const {\n group,\n densityClasses,\n icon,\n model,\n textColorClasses,\n textColorStyles,\n backgroundColorClasses,\n backgroundColorStyles,\n trueValue,\n } = useSelectionControl(props)\n const uid = getUid()\n const isFocused = shallowRef(false)\n const isFocusVisible = shallowRef(false)\n const input = ref<HTMLInputElement>()\n const id = computed(() => props.id || `input-${uid}`)\n const isInteractive = computed(() => !props.disabled && !props.readonly)\n\n group?.onForceUpdate(() => {\n if (input.value) {\n input.value.checked = model.value\n }\n })\n\n function onFocus (e: FocusEvent) {\n if (!isInteractive.value) return\n\n isFocused.value = true\n if (matchesSelector(e.target as HTMLElement, ':focus-visible') !== false) {\n isFocusVisible.value = true\n }\n }\n\n function onBlur () {\n isFocused.value = false\n isFocusVisible.value = false\n }\n\n function onClickLabel (e: Event) {\n e.stopPropagation()\n }\n\n function onInput (e: Event) {\n if (!isInteractive.value) {\n if (input.value) {\n // model value is not updated when input is not interactive\n // but the internal checked state of the input is still updated,\n // so here it's value is restored\n input.value.checked = model.value\n }\n\n return\n }\n\n if (props.readonly && group) {\n nextTick(() => group.forceUpdate())\n }\n model.value = (e.target as HTMLInputElement).checked\n }\n\n useRender(() => {\n const label = slots.label\n ? slots.label({\n label: props.label,\n props: { for: id.value },\n })\n : props.label\n const [rootAttrs, inputAttrs] = filterInputAttrs(attrs)\n\n const inputNode = (\n <input\n ref={ input }\n checked={ model.value }\n disabled={ !!props.disabled }\n id={ id.value }\n onBlur={ onBlur }\n onFocus={ onFocus }\n onInput={ onInput }\n aria-disabled={ !!props.disabled }\n aria-label={ props.label }\n type={ props.type }\n value={ trueValue.value }\n name={ props.name }\n aria-checked={ props.type === 'checkbox' ? model.value : undefined }\n { ...inputAttrs }\n />\n )\n\n return (\n <div\n class={[\n 'v-selection-control',\n {\n 'v-selection-control--dirty': model.value,\n 'v-selection-control--disabled': props.disabled,\n 'v-selection-control--error': props.error,\n 'v-selection-control--focused': isFocused.value,\n 'v-selection-control--focus-visible': isFocusVisible.value,\n 'v-selection-control--inline': props.inline,\n },\n densityClasses.value,\n props.class,\n ]}\n { ...rootAttrs }\n style={ props.style }\n >\n <div\n class={[\n 'v-selection-control__wrapper',\n textColorClasses.value,\n ]}\n style={ textColorStyles.value }\n >\n { slots.default?.({\n backgroundColorClasses,\n backgroundColorStyles,\n })}\n\n <div\n class={[\n 'v-selection-control__input',\n ]}\n v-ripple={ props.ripple && [\n !props.disabled && !props.readonly,\n null,\n ['center', 'circle'],\n ]}\n >\n { slots.input?.({\n model,\n textColorClasses,\n textColorStyles,\n backgroundColorClasses,\n backgroundColorStyles,\n inputNode,\n icon: icon.value,\n props: {\n onFocus,\n onBlur,\n id: id.value,\n },\n } satisfies SelectionControlSlot) ?? (\n <>\n { icon.value && <VIcon key=\"icon\" icon={ icon.value } /> }\n\n { inputNode }\n </>\n )}\n </div>\n </div>\n\n { label && (\n <VLabel for={ id.value } onClick={ onClickLabel }>\n { label }\n </VLabel>\n )}\n </div>\n )\n })\n\n return {\n isFocused,\n input,\n }\n },\n})\n\nexport type VSelectionControl = InstanceType<typeof VSelectionControl>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,KAAK;AAAA,SACLC,MAAM;AAAA,SACNC,8BAA8B,EAAEC,4BAA4B,gEAErE;AAAA,SACSC,kBAAkB,EAAEC,YAAY;AAAA,SAChCC,kBAAkB;AAAA,SAClBC,UAAU;AAAA,SACVC,eAAe,8CAExB;AAAA,SACSC,MAAM,6CAEf;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,UAAU,QAAQ,KAAK;AAAA,SAE/DC,gBAAgB,EAChBC,gBAAgB,EAChBC,MAAM,EACNC,eAAe,EACfC,YAAY,EACZC,SAAS,EACTC,WAAW,gCAGb;AA6BA,OAAO,MAAMC,0BAA0B,GAAGH,YAAY,CAAC;EACrDI,KAAK,EAAEC,MAAM;EACbC,SAAS,EAAED,MAAM;EACjBE,SAAS,EAAE,IAAI;EACfC,UAAU,EAAE,IAAI;EAChBC,KAAK,EAAE,IAAI;EAEX,GAAGtB,kBAAkB,CAAC,CAAC;EACvB,GAAGJ,8BAA8B,CAAC;AACpC,CAAC,EAAE,mBAAmB,CAAC;AAEvB,OAAO,SAAS2B,mBAAmBA,CACjCC,KAEC,EACD;EACA,MAAMC,KAAK,GAAGpB,MAAM,CAACR,4BAA4B,EAAE6B,SAAS,CAAC;EAC7D,MAAM;IAAEC;EAAe,CAAC,GAAG1B,U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T/B,IAAI,EAAEA,IAAI,CAAC9B,KAAK;QAChBE,KAAK,EAAE;UACLgD,OAAO;UACPG,MAAM;UACNP,EAAE,EAAEA,EAAE,CAAC9C;QACT;MACF,CAAgC,CAAC,IAAA8D,YAAA,CAAAQ,SAAA,SAE3BxC,IAAI,CAAC9B,KAAK,IAAA8D,YAAA,CAAA1F,KAAA;QAAA;QAAA,QAA6B0D,IAAI,CAAC9B;MAAK,QAAK,EAEtD6D,SAAS,EAEd,MAAAU,iBAAA,YAzBUrE,KAAK,CAACsE,MAAM,IAAI,CACzB,CAACtE,KAAK,CAACwB,QAAQ,IAAI,CAACxB,KAAK,CAACgB,QAAQ,EAClC,IAAI,EACJ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACrB,OAyBHvB,KAAK,IAAAmE,YAAA,CAAAzF,MAAA;QAAA,OACSyE,EAAE,CAAC9C,KAAK;QAAA,WAAasD;MAAY;QAAAc,OAAA,EAAAA,CAAA,MAC3CzE,KAAK;MAAA,EAEV;IAGP,CAAC,CAAC;IAEF,OAAO;MACLgD,SAAS;MACTE;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"VSelectionControl.mjs","names":["VIcon","VLabel","makeSelectionControlGroupProps","VSelectionControlGroupSymbol","useBackgroundColor","useTextColor","makeComponentProps","useDensity","useProxiedModel","Ripple","computed","inject","nextTick","ref","shallowRef","useId","filterInputAttrs","genericComponent","matchesSelector","propsFactory","useRender","wrapInArray","makeVSelectionControlProps","label","String","baseColor","trueValue","falseValue","value","useSelectionControl","props","group","undefined","densityClasses","modelValue","isMultiple","multiple","Array","isArray","model","get","val","some","v","valueComparator","set","readonly","currentValue","newVal","filter","item","textColorClasses","textColorStyles","error","disabled","color","backgroundColorClasses","backgroundColorStyles","icon","trueIcon","falseIcon","VSelectionControl","name","directives","inheritAttrs","emits","setup","_ref","attrs","slots","uid","isFocused","isFocusVisible","input","id","isInteractive","onForceUpdate","checked","onFocus","e","target","onBlur","onClickLabel","stopPropagation","onInput","forceUpdate","for","rootAttrs","inputAttrs","inputNode","_createVNode","_mergeProps","type","inline","class","style","default","_withDirectives","_Fragment","_resolveDirective","ripple"],"sources":["../../../src/components/VSelectionControl/VSelectionControl.tsx"],"sourcesContent":["// Styles\nimport './VSelectionControl.sass'\n\n// Components\nimport { VIcon } from '@/components/VIcon'\nimport { VLabel } from '@/components/VLabel'\nimport { makeSelectionControlGroupProps, VSelectionControlGroupSymbol } from '@/components/VSelectionControlGroup/VSelectionControlGroup'\n\n// Composables\nimport { useBackgroundColor, useTextColor } from '@/composables/color'\nimport { makeComponentProps } from '@/composables/component'\nimport { useDensity } from '@/composables/density'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Directives\nimport { Ripple } from '@/directives/ripple'\n\n// Utilities\nimport { computed, inject, nextTick, ref, shallowRef, useId } from 'vue'\nimport {\n filterInputAttrs,\n genericComponent,\n matchesSelector,\n propsFactory,\n useRender,\n wrapInArray,\n} from '@/util'\n\n// Types\nimport type { CSSProperties, ExtractPropTypes, Ref, VNode, WritableComputedRef } from 'vue'\nimport type { IconValue } from '@/composables/icons'\nimport type { EventProp, GenericProps } from '@/util'\n\nexport type SelectionControlSlot = {\n model: WritableComputedRef<boolean>\n textColorClasses: Ref<string[]>\n textColorStyles: Ref<CSSProperties>\n backgroundColorClasses: Ref<string[]>\n backgroundColorStyles: Ref<CSSProperties>\n inputNode: VNode\n icon: IconValue | undefined\n props: {\n onBlur: (e: Event) => void\n onFocus: (e: FocusEvent) => void\n id: string\n }\n}\n\nexport type VSelectionControlSlots = {\n default: {\n backgroundColorClasses: Ref<string[]>\n backgroundColorStyles: Ref<CSSProperties>\n }\n label: { label: string | undefined, props: Record<string, unknown> }\n input: SelectionControlSlot\n}\n\nexport const makeVSelectionControlProps = propsFactory({\n label: String,\n baseColor: String,\n trueValue: null,\n falseValue: null,\n value: null,\n\n ...makeComponentProps(),\n ...makeSelectionControlGroupProps(),\n}, 'VSelectionControl')\n\nexport function useSelectionControl (\n props: ExtractPropTypes<ReturnType<typeof makeVSelectionControlProps>> & {\n 'onUpdate:modelValue': EventProp | undefined\n }\n) {\n const group = inject(VSelectionControlGroupSymbol, undefined)\n const { densityClasses } = useDensity(props)\n const modelValue = useProxiedModel(props, 'modelValue')\n const trueValue = computed(() => (\n props.trueValue !== undefined ? props.trueValue\n : props.value !== undefined ? props.value\n : true\n ))\n const falseValue = computed(() => props.falseValue !== undefined ? props.falseValue : false)\n const isMultiple = computed(() => (\n !!props.multiple ||\n (props.multiple == null && Array.isArray(modelValue.value))\n ))\n const model = computed({\n get () {\n const val = group ? group.modelValue.value : modelValue.value\n\n return isMultiple.value\n ? wrapInArray(val).some((v: any) => props.valueComparator(v, trueValue.value))\n : props.valueComparator(val, trueValue.value)\n },\n set (val: boolean) {\n if (props.readonly) return\n\n const currentValue = val ? trueValue.value : falseValue.value\n\n let newVal = currentValue\n\n if (isMultiple.value) {\n newVal = val\n ? [...wrapInArray(modelValue.value), currentValue]\n : wrapInArray(modelValue.value).filter((item: any) => !props.valueComparator(item, trueValue.value))\n }\n\n if (group) {\n group.modelValue.value = newVal\n } else {\n modelValue.value = newVal\n }\n },\n })\n const { textColorClasses, textColorStyles } = useTextColor(computed(() => {\n if (props.error || props.disabled) return undefined\n\n return model.value ? props.color : props.baseColor\n }))\n const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(computed(() => {\n return (\n model.value &&\n !props.error &&\n !props.disabled\n ) ? props.color : props.baseColor\n }))\n const icon = computed(() => model.value ? props.trueIcon : props.falseIcon)\n\n return {\n group,\n densityClasses,\n trueValue,\n falseValue,\n model,\n textColorClasses,\n textColorStyles,\n backgroundColorClasses,\n backgroundColorStyles,\n icon,\n }\n}\n\nexport const VSelectionControl = genericComponent<new <T>(\n props: {\n modelValue?: T\n 'onUpdate:modelValue'?: (value: T) => void\n },\n slots: VSelectionControlSlots,\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VSelectionControl',\n\n directives: { Ripple },\n\n inheritAttrs: false,\n\n props: makeVSelectionControlProps(),\n\n emits: {\n 'update:modelValue': (value: any) => true,\n },\n\n setup (props, { attrs, slots }) {\n const {\n group,\n densityClasses,\n icon,\n model,\n textColorClasses,\n textColorStyles,\n backgroundColorClasses,\n backgroundColorStyles,\n trueValue,\n } = useSelectionControl(props)\n const uid = useId()\n const isFocused = shallowRef(false)\n const isFocusVisible = shallowRef(false)\n const input = ref<HTMLInputElement>()\n const id = computed(() => props.id || `input-${uid}`)\n const isInteractive = computed(() => !props.disabled && !props.readonly)\n\n group?.onForceUpdate(() => {\n if (input.value) {\n input.value.checked = model.value\n }\n })\n\n function onFocus (e: FocusEvent) {\n if (!isInteractive.value) return\n\n isFocused.value = true\n if (matchesSelector(e.target as HTMLElement, ':focus-visible') !== false) {\n isFocusVisible.value = true\n }\n }\n\n function onBlur () {\n isFocused.value = false\n isFocusVisible.value = false\n }\n\n function onClickLabel (e: Event) {\n e.stopPropagation()\n }\n\n function onInput (e: Event) {\n if (!isInteractive.value) {\n if (input.value) {\n // model value is not updated when input is not interactive\n // but the internal checked state of the input is still updated,\n // so here it's value is restored\n input.value.checked = model.value\n }\n\n return\n }\n\n if (props.readonly && group) {\n nextTick(() => group.forceUpdate())\n }\n model.value = (e.target as HTMLInputElement).checked\n }\n\n useRender(() => {\n const label = slots.label\n ? slots.label({\n label: props.label,\n props: { for: id.value },\n })\n : props.label\n const [rootAttrs, inputAttrs] = filterInputAttrs(attrs)\n\n const inputNode = (\n <input\n ref={ input }\n checked={ model.value }\n disabled={ !!props.disabled }\n id={ id.value }\n onBlur={ onBlur }\n onFocus={ onFocus }\n onInput={ onInput }\n aria-disabled={ !!props.disabled }\n aria-label={ props.label }\n type={ props.type }\n value={ trueValue.value }\n name={ props.name }\n aria-checked={ props.type === 'checkbox' ? model.value : undefined }\n { ...inputAttrs }\n />\n )\n\n return (\n <div\n class={[\n 'v-selection-control',\n {\n 'v-selection-control--dirty': model.value,\n 'v-selection-control--disabled': props.disabled,\n 'v-selection-control--error': props.error,\n 'v-selection-control--focused': isFocused.value,\n 'v-selection-control--focus-visible': isFocusVisible.value,\n 'v-selection-control--inline': props.inline,\n },\n densityClasses.value,\n props.class,\n ]}\n { ...rootAttrs }\n style={ props.style }\n >\n <div\n class={[\n 'v-selection-control__wrapper',\n textColorClasses.value,\n ]}\n style={ textColorStyles.value }\n >\n { slots.default?.({\n backgroundColorClasses,\n backgroundColorStyles,\n })}\n\n <div\n class={[\n 'v-selection-control__input',\n ]}\n v-ripple={ props.ripple && [\n !props.disabled && !props.readonly,\n null,\n ['center', 'circle'],\n ]}\n >\n { slots.input?.({\n model,\n textColorClasses,\n textColorStyles,\n backgroundColorClasses,\n backgroundColorStyles,\n inputNode,\n icon: icon.value,\n props: {\n onFocus,\n onBlur,\n id: id.value,\n },\n } satisfies SelectionControlSlot) ?? (\n <>\n { icon.value && <VIcon key=\"icon\" icon={ icon.value } /> }\n\n { inputNode }\n </>\n )}\n </div>\n </div>\n\n { label && (\n <VLabel for={ id.value } onClick={ onClickLabel }>\n { label }\n </VLabel>\n )}\n </div>\n )\n })\n\n return {\n isFocused,\n input,\n }\n },\n})\n\nexport type VSelectionControl = InstanceType<typeof VSelectionControl>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,KAAK;AAAA,SACLC,MAAM;AAAA,SACNC,8BAA8B,EAAEC,4BAA4B,gEAErE;AAAA,SACSC,kBAAkB,EAAEC,YAAY;AAAA,SAChCC,kBAAkB;AAAA,SAClBC,UAAU;AAAA,SACVC,eAAe,8CAExB;AAAA,SACSC,MAAM,6CAEf;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAEtEC,gBAAgB,EAChBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,SAAS,EACTC,WAAW,gCAGb;AA6BA,OAAO,MAAMC,0BAA0B,GAAGH,YAAY,CAAC;EACrDI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E;MAAK,KAAAL,YAAA;QAAA,SAGV,CACL,8BAA8B,EAC9BvC,gBAAgB,CAACvB,KAAK,CACvB;QAAA,SACOwB,eAAe,CAACxB;MAAK,IAE3ByC,KAAK,CAAC2B,OAAO,GAAG;QAChBxC,sBAAsB;QACtBC;MACF,CAAC,CAAC,EAAAwC,eAAA,CAAAP,YAAA;QAAA,SAGO,CACL,4BAA4B;MAC7B,IAOCrB,KAAK,CAACI,KAAK,GAAG;QACdlC,KAAK;QACLY,gBAAgB;QAChBC,eAAe;QACfI,sBAAsB;QACtBC,qBAAqB;QACrBgC,SAAS;QACT/B,IAAI,EAAEA,IAAI,CAAC9B,KAAK;QAChBE,KAAK,EAAE;UACLgD,OAAO;UACPG,MAAM;UACNP,EAAE,EAAEA,EAAE,CAAC9C;QACT;MACF,CAAgC,CAAC,IAAA8D,YAAA,CAAAQ,SAAA,SAE3BxC,IAAI,CAAC9B,KAAK,IAAA8D,YAAA,CAAA1F,KAAA;QAAA;QAAA,QAA6B0D,IAAI,CAAC9B;MAAK,QAAK,EAEtD6D,SAAS,EAEd,MAAAU,iBAAA,YAzBUrE,KAAK,CAACsE,MAAM,IAAI,CACzB,CAACtE,KAAK,CAACwB,QAAQ,IAAI,CAACxB,KAAK,CAACgB,QAAQ,EAClC,IAAI,EACJ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACrB,OAyBHvB,KAAK,IAAAmE,YAAA,CAAAzF,MAAA;QAAA,OACSyE,EAAE,CAAC9C,KAAK;QAAA,WAAasD;MAAY;QAAAc,OAAA,EAAAA,CAAA,MAC3CzE,KAAK;MAAA,EAEV;IAGP,CAAC,CAAC;IAEF,OAAO;MACLgD,SAAS;MACTE;IACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
@@ -9,8 +9,8 @@ import { makeDensityProps } from "../../composables/density.mjs";
9
9
  import { IconValue } from "../../composables/icons.mjs";
10
10
  import { useProxiedModel } from "../../composables/proxiedModel.mjs";
11
11
  import { makeThemeProps } from "../../composables/theme.mjs"; // Utilities
12
- import { computed, onScopeDispose, provide, toRef } from 'vue';
13
- import { deepEqual, genericComponent, getUid, propsFactory, useRender } from "../../util/index.mjs"; // Types
12
+ import { computed, onScopeDispose, provide, toRef, useId } from 'vue';
13
+ import { deepEqual, genericComponent, propsFactory, useRender } from "../../util/index.mjs"; // Types
14
14
  export const VSelectionControlGroupSymbol = Symbol.for('vuetify:selection-control-group');
15
15
  export const makeSelectionControlGroupProps = propsFactory({
16
16
  color: String,
@@ -63,7 +63,7 @@ export const VSelectionControlGroup = genericComponent()({
63
63
  slots
64
64
  } = _ref;
65
65
  const modelValue = useProxiedModel(props, 'modelValue');
66
- const uid = getUid();
66
+ const uid = useId();
67
67
  const id = computed(() => props.id || `v-selection-control-group-${uid}`);
68
68
  const name = computed(() => props.name || id.value);
69
69
  const updateHandlers = new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"VSelectionControlGroup.mjs","names":["makeComponentProps","provideDefaults","makeDensityProps","IconValue","useProxiedModel","makeThemeProps","computed","onScopeDispose","provide","toRef","deepEqual","genericComponent","getUid","propsFactory","useRender","VSelectionControlGroupSymbol","Symbol","for","makeSelectionControlGroupProps","color","String","disabled","type","Boolean","default","defaultsTarget","error","id","inline","falseIcon","trueIcon","ripple","Object","multiple","name","readonly","modelValue","valueComparator","Function","makeVSelectionControlGroupProps","VSelectionControlGroup","props","emits","value","setup","_ref","slots","uid","updateHandlers","Set","forceUpdate","forEach","fn","onForceUpdate","cb","add","delete","density","Array","isArray","_createVNode","class","style","undefined"],"sources":["../../../src/components/VSelectionControlGroup/VSelectionControlGroup.tsx"],"sourcesContent":["// Styles\nimport './VSelectionControlGroup.sass'\n\n// Composables\nimport { makeComponentProps } from '@/composables/component'\nimport { provideDefaults } from '@/composables/defaults'\nimport { makeDensityProps } from '@/composables/density'\nimport { IconValue } from '@/composables/icons'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { makeThemeProps } from '@/composables/theme'\n\n// Utilities\nimport { computed, onScopeDispose, provide, toRef } from 'vue'\nimport { deepEqual, genericComponent, getUid, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { RippleDirectiveBinding } from '@/directives/ripple'\nimport type { GenericProps } from '@/util'\n\nexport interface VSelectionGroupContext {\n modelValue: Ref<any>\n forceUpdate: () => void\n onForceUpdate: (fn: () => void) => void\n}\n\nexport const VSelectionControlGroupSymbol: InjectionKey<VSelectionGroupContext> = Symbol.for('vuetify:selection-control-group')\n\nexport const makeSelectionControlGroupProps = propsFactory({\n color: String,\n disabled: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n defaultsTarget: String,\n error: Boolean,\n id: String,\n inline: Boolean,\n falseIcon: IconValue,\n trueIcon: IconValue,\n ripple: {\n type: [Boolean, Object] as PropType<RippleDirectiveBinding['value']>,\n default: true,\n },\n multiple: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n name: String,\n readonly: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n modelValue: null,\n type: String,\n valueComparator: {\n type: Function as PropType<typeof deepEqual>,\n default: deepEqual,\n },\n\n ...makeComponentProps(),\n ...makeDensityProps(),\n ...makeThemeProps(),\n}, 'SelectionControlGroup')\n\nexport const makeVSelectionControlGroupProps = propsFactory({\n ...makeSelectionControlGroupProps({\n defaultsTarget: 'VSelectionControl',\n }),\n}, 'VSelectionControlGroup')\n\nexport const VSelectionControlGroup = genericComponent<new <T>(\n props: {\n modelValue?: T\n 'onUpdate:modelValue'?: (value: T) => void\n },\n slots: { default: never },\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VSelectionControlGroup',\n\n props: makeVSelectionControlGroupProps(),\n\n emits: {\n 'update:modelValue': (value: any) => true,\n },\n\n setup (props, { slots }) {\n const modelValue = useProxiedModel(props, 'modelValue')\n const uid = getUid()\n const id = computed(() => props.id || `v-selection-control-group-${uid}`)\n const name = computed(() => props.name || id.value)\n\n const updateHandlers = new Set<() => void>()\n provide(VSelectionControlGroupSymbol, {\n modelValue,\n forceUpdate: () => {\n updateHandlers.forEach(fn => fn())\n },\n onForceUpdate: cb => {\n updateHandlers.add(cb)\n onScopeDispose(() => {\n updateHandlers.delete(cb)\n })\n },\n })\n\n provideDefaults({\n [props.defaultsTarget]: {\n color: toRef(props, 'color'),\n disabled: toRef(props, 'disabled'),\n density: toRef(props, 'density'),\n error: toRef(props, 'error'),\n inline: toRef(props, 'inline'),\n modelValue,\n multiple: computed(() => !!props.multiple || (props.multiple == null && Array.isArray(modelValue.value))),\n name,\n falseIcon: toRef(props, 'falseIcon'),\n trueIcon: toRef(props, 'trueIcon'),\n readonly: toRef(props, 'readonly'),\n ripple: toRef(props, 'ripple'),\n type: toRef(props, 'type'),\n valueComparator: toRef(props, 'valueComparator'),\n },\n })\n\n useRender(() => (\n <div\n class={[\n 'v-selection-control-group',\n { 'v-selection-control-group--inline': props.inline },\n props.class,\n ]}\n style={ props.style }\n role={ props.type === 'radio' ? 'radiogroup' : undefined }\n >\n { slots.default?.() }\n </div>\n ))\n\n return {}\n },\n})\n\nexport type VSelectionControlGroup = InstanceType<typeof VSelectionControlGroup>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,kBAAkB;AAAA,SAClBC,eAAe;AAAA,SACfC,gBAAgB;AAAA,SAChBC,SAAS;AAAA,SACTC,eAAe;AAAA,SACfC,cAAc,uCAEvB;AACA,SAASC,QAAQ,EAAEC,cAAc,EAAEC,OAAO,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACrDC,SAAS,EAAEC,gBAAgB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,SAAS,gCAErE;AAWA,OAAO,MAAMC,4BAAkE,GAAGC,MAAM,CAACC,GAAG,CAAC,iCAAiC,CAAC;AAE/H,OAAO,MAAMC,8BAA8B,GAAGL,YAAY,CAAC;EACzDM,KAAK,EAAEC,MAAM;EACbC,QAAQ,EAAE;IACRC,IAAI,EAAEC,OAAmC;IACzCC,OAAO,EAAE;E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AAC;QACpCX,QAAQ,EAAErB,KAAK,CAACgC,KAAK,EAAE,UAAU,CAAC;QAClCN,QAAQ,EAAE1B,KAAK,CAACgC,KAAK,EAAE,UAAU,CAAC;QAClCV,MAAM,EAAEtB,KAAK,CAACgC,KAAK,EAAE,QAAQ,CAAC;QAC9BnB,IAAI,EAAEb,KAAK,CAACgC,KAAK,EAAE,MAAM,CAAC;QAC1BJ,eAAe,EAAE5B,KAAK,CAACgC,KAAK,EAAE,iBAAiB;MACjD;IACF,CAAC,CAAC;IAEF3B,SAAS,CAAC,MAAA8C,YAAA;MAAA,SAEC,CACL,2BAA2B,EAC3B;QAAE,mCAAmC,EAAEnB,KAAK,CAACb;MAAO,CAAC,EACrDa,KAAK,CAACoB,KAAK,CACZ;MAAA,SACOpB,KAAK,CAACqB,KAAK;MAAA,QACZrB,KAAK,CAACnB,IAAI,KAAK,OAAO,GAAG,YAAY,GAAGyC;IAAS,IAEtDjB,KAAK,CAACtB,OAAO,GAAG,CAAC,EAEtB,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"VSelectionControlGroup.mjs","names":["makeComponentProps","provideDefaults","makeDensityProps","IconValue","useProxiedModel","makeThemeProps","computed","onScopeDispose","provide","toRef","useId","deepEqual","genericComponent","propsFactory","useRender","VSelectionControlGroupSymbol","Symbol","for","makeSelectionControlGroupProps","color","String","disabled","type","Boolean","default","defaultsTarget","error","id","inline","falseIcon","trueIcon","ripple","Object","multiple","name","readonly","modelValue","valueComparator","Function","makeVSelectionControlGroupProps","VSelectionControlGroup","props","emits","value","setup","_ref","slots","uid","updateHandlers","Set","forceUpdate","forEach","fn","onForceUpdate","cb","add","delete","density","Array","isArray","_createVNode","class","style","undefined"],"sources":["../../../src/components/VSelectionControlGroup/VSelectionControlGroup.tsx"],"sourcesContent":["// Styles\nimport './VSelectionControlGroup.sass'\n\n// Composables\nimport { makeComponentProps } from '@/composables/component'\nimport { provideDefaults } from '@/composables/defaults'\nimport { makeDensityProps } from '@/composables/density'\nimport { IconValue } from '@/composables/icons'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { makeThemeProps } from '@/composables/theme'\n\n// Utilities\nimport { computed, onScopeDispose, provide, toRef, useId } from 'vue'\nimport { deepEqual, genericComponent, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { RippleDirectiveBinding } from '@/directives/ripple'\nimport type { GenericProps } from '@/util'\n\nexport interface VSelectionGroupContext {\n modelValue: Ref<any>\n forceUpdate: () => void\n onForceUpdate: (fn: () => void) => void\n}\n\nexport const VSelectionControlGroupSymbol: InjectionKey<VSelectionGroupContext> = Symbol.for('vuetify:selection-control-group')\n\nexport const makeSelectionControlGroupProps = propsFactory({\n color: String,\n disabled: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n defaultsTarget: String,\n error: Boolean,\n id: String,\n inline: Boolean,\n falseIcon: IconValue,\n trueIcon: IconValue,\n ripple: {\n type: [Boolean, Object] as PropType<RippleDirectiveBinding['value']>,\n default: true,\n },\n multiple: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n name: String,\n readonly: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n modelValue: null,\n type: String,\n valueComparator: {\n type: Function as PropType<typeof deepEqual>,\n default: deepEqual,\n },\n\n ...makeComponentProps(),\n ...makeDensityProps(),\n ...makeThemeProps(),\n}, 'SelectionControlGroup')\n\nexport const makeVSelectionControlGroupProps = propsFactory({\n ...makeSelectionControlGroupProps({\n defaultsTarget: 'VSelectionControl',\n }),\n}, 'VSelectionControlGroup')\n\nexport const VSelectionControlGroup = genericComponent<new <T>(\n props: {\n modelValue?: T\n 'onUpdate:modelValue'?: (value: T) => void\n },\n slots: { default: never },\n) => GenericProps<typeof props, typeof slots>>()({\n name: 'VSelectionControlGroup',\n\n props: makeVSelectionControlGroupProps(),\n\n emits: {\n 'update:modelValue': (value: any) => true,\n },\n\n setup (props, { slots }) {\n const modelValue = useProxiedModel(props, 'modelValue')\n const uid = useId()\n const id = computed(() => props.id || `v-selection-control-group-${uid}`)\n const name = computed(() => props.name || id.value)\n\n const updateHandlers = new Set<() => void>()\n provide(VSelectionControlGroupSymbol, {\n modelValue,\n forceUpdate: () => {\n updateHandlers.forEach(fn => fn())\n },\n onForceUpdate: cb => {\n updateHandlers.add(cb)\n onScopeDispose(() => {\n updateHandlers.delete(cb)\n })\n },\n })\n\n provideDefaults({\n [props.defaultsTarget]: {\n color: toRef(props, 'color'),\n disabled: toRef(props, 'disabled'),\n density: toRef(props, 'density'),\n error: toRef(props, 'error'),\n inline: toRef(props, 'inline'),\n modelValue,\n multiple: computed(() => !!props.multiple || (props.multiple == null && Array.isArray(modelValue.value))),\n name,\n falseIcon: toRef(props, 'falseIcon'),\n trueIcon: toRef(props, 'trueIcon'),\n readonly: toRef(props, 'readonly'),\n ripple: toRef(props, 'ripple'),\n type: toRef(props, 'type'),\n valueComparator: toRef(props, 'valueComparator'),\n },\n })\n\n useRender(() => (\n <div\n class={[\n 'v-selection-control-group',\n { 'v-selection-control-group--inline': props.inline },\n props.class,\n ]}\n style={ props.style }\n role={ props.type === 'radio' ? 'radiogroup' : undefined }\n >\n { slots.default?.() }\n </div>\n ))\n\n return {}\n },\n})\n\nexport type VSelectionControlGroup = InstanceType<typeof VSelectionControlGroup>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,kBAAkB;AAAA,SAClBC,eAAe;AAAA,SACfC,gBAAgB;AAAA,SAChBC,SAAS;AAAA,SACTC,eAAe;AAAA,SACfC,cAAc,uCAEvB;AACA,SAASC,QAAQ,EAAEC,cAAc,EAAEC,OAAO,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC5DC,SAAS,EAAEC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,gCAE7D;AAWA,OAAO,MAAMC,4BAAkE,GAAGC,MAAM,CAACC,GAAG,CAAC,iCAAiC,CAA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,IAAI,IAAI,IAAIyB,KAAK,CAACC,OAAO,CAACvB,UAAU,CAACO,KAAK,CAAE,CAAC;QACzGT,IAAI;QACJL,SAAS,EAAEpB,KAAK,CAACgC,KAAK,EAAE,WAAW,CAAC;QACpCX,QAAQ,EAAErB,KAAK,CAACgC,KAAK,EAAE,UAAU,CAAC;QAClCN,QAAQ,EAAE1B,KAAK,CAACgC,KAAK,EAAE,UAAU,CAAC;QAClCV,MAAM,EAAEtB,KAAK,CAACgC,KAAK,EAAE,QAAQ,CAAC;QAC9BnB,IAAI,EAAEb,KAAK,CAACgC,KAAK,EAAE,MAAM,CAAC;QAC1BJ,eAAe,EAAE5B,KAAK,CAACgC,KAAK,EAAE,iBAAiB;MACjD;IACF,CAAC,CAAC;IAEF3B,SAAS,CAAC,MAAA8C,YAAA;MAAA,SAEC,CACL,2BAA2B,EAC3B;QAAE,mCAAmC,EAAEnB,KAAK,CAACb;MAAO,CAAC,EACrDa,KAAK,CAACoB,KAAK,CACZ;MAAA,SACOpB,KAAK,CAACqB,KAAK;MAAA,QACZrB,KAAK,CAACnB,IAAI,KAAK,OAAO,GAAG,YAAY,GAAGyC;IAAS,IAEtDjB,KAAK,CAACtB,OAAO,GAAG,CAAC,EAEtB,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC","ignoreList":[]}
@@ -43,22 +43,22 @@ type IconValue = string | (string | [path: string, opacity: number])[] | JSXComp
43
43
  declare const IconValue: PropType<IconValue>;
44
44
 
45
45
  interface GroupItem {
46
- id: number;
46
+ id: string;
47
47
  value: Ref<unknown>;
48
48
  disabled: Ref<boolean | undefined>;
49
49
  useIndexAsValue?: boolean;
50
50
  }
51
51
  interface GroupProvide {
52
52
  register: (item: GroupItem, cmp: ComponentInternalInstance) => void;
53
- unregister: (id: number) => void;
54
- select: (id: number, value: boolean) => void;
55
- selected: Ref<Readonly<number[]>>;
56
- isSelected: (id: number) => boolean;
53
+ unregister: (id: string) => void;
54
+ select: (id: string, value: boolean) => void;
55
+ selected: Ref<Readonly<string[]>>;
56
+ isSelected: (id: string) => boolean;
57
57
  prev: () => void;
58
58
  next: () => void;
59
59
  selectedClass: Ref<string | undefined>;
60
60
  items: ComputedRef<{
61
- id: number;
61
+ id: string;
62
62
  value: unknown;
63
63
  disabled: boolean | undefined;
64
64
  }[]>;
@@ -66,7 +66,7 @@ interface GroupProvide {
66
66
  getItemIndex: (value: unknown) => number;
67
67
  }
68
68
  interface GroupItemProvide {
69
- id: number;
69
+ id: string;
70
70
  isSelected: Ref<boolean>;
71
71
  isFirst: Ref<boolean>;
72
72
  isLast: Ref<boolean>;
@@ -109,7 +109,7 @@ declare const VSlideGroup: {
109
109
  mobileBreakpoint?: number | DisplayBreakpoint | undefined;
110
110
  showArrows?: string | boolean | undefined;
111
111
  } & {}, {
112
- selected: vue.Ref<readonly number[], readonly number[]>;
112
+ selected: vue.Ref<readonly string[], readonly string[]>;
113
113
  scrollTo: (location: "prev" | "next") => void;
114
114
  scrollOffset: vue.ShallowRef<number, number>;
115
115
  focus: (location?: "next" | "prev" | "first" | "last") => void;
@@ -159,7 +159,7 @@ declare const VSlideGroup: {
159
159
  mobileBreakpoint?: number | DisplayBreakpoint | undefined;
160
160
  showArrows?: string | boolean | undefined;
161
161
  } & {}, {
162
- selected: vue.Ref<readonly number[], readonly number[]>;
162
+ selected: vue.Ref<readonly string[], readonly string[]>;
163
163
  scrollTo: (location: "prev" | "next") => void;
164
164
  scrollOffset: vue.ShallowRef<number, number>;
165
165
  focus: (location?: "next" | "prev" | "first" | "last") => void;
@@ -200,7 +200,7 @@ declare const VSlideGroup: {
200
200
  mobileBreakpoint?: number | DisplayBreakpoint | undefined;
201
201
  showArrows?: string | boolean | undefined;
202
202
  } & {}, {
203
- selected: vue.Ref<readonly number[], readonly number[]>;
203
+ selected: vue.Ref<readonly string[], readonly string[]>;
204
204
  scrollTo: (location: "prev" | "next") => void;
205
205
  scrollOffset: vue.ShallowRef<number, number>;
206
206
  focus: (location?: "next" | "prev" | "first" | "last") => void;
@@ -1,7 +1,7 @@
1
1
  // Utilities
2
- import { computed, createVNode as _createVNode, Fragment as _Fragment } from 'vue';
2
+ import { computed, useId, createVNode as _createVNode, Fragment as _Fragment } from 'vue';
3
3
  import { makeLineProps } from "./util/line.mjs";
4
- import { genericComponent, getPropertyFromItem, getUid, propsFactory, useRender } from "../../util/index.mjs"; // Types
4
+ import { genericComponent, getPropertyFromItem, propsFactory, useRender } from "../../util/index.mjs"; // Types
5
5
  export const makeVBarlineProps = propsFactory({
6
6
  autoLineWidth: Boolean,
7
7
  ...makeLineProps()
@@ -13,7 +13,7 @@ export const VBarline = genericComponent()({
13
13
  let {
14
14
  slots
15
15
  } = _ref;
16
- const uid = getUid();
16
+ const uid = useId();
17
17
  const id = computed(() => props.id || `barline-${uid}`);
18
18
  const autoDrawDuration = computed(() => Number(props.autoDrawDuration) || 500);
19
19
  const hasLabels = computed(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"VBarline.mjs","names":["computed","createVNode","_createVNode","Fragment","_Fragment","makeLineProps","genericComponent","getPropertyFromItem","getUid","propsFactory","useRender","makeVBarlineProps","autoLineWidth","Boolean","VBarline","name","props","setup","_ref","slots","uid","id","autoDrawDuration","Number","hasLabels","showLabels","labels","length","label","lineWidth","parseFloat","totalWidth","Math","max","modelValue","value","width","boundary","minX","maxX","minY","maxY","parseInt","height","items","map","item","itemValue","genBars","values","totalValues","maxValue","minValue","min","gridX","gridY","horizonY","abs","index","x","y","parsedLabels","points","len","i","push","String","bars","offsetX","gradientData","gradient","slice","reverse","gradientDirection","color","smooth","autoDraw","textAnchor","dominantBaseline","fill","labelSize"],"sources":["../../../src/components/VSparkline/VBarline.tsx"],"sourcesContent":["// Utilities\nimport { computed } from 'vue'\nimport { makeLineProps } from './util/line'\nimport { genericComponent, getPropertyFromItem, getUid, propsFactory, useRender } from '@/util'\n\n// Types\nexport type VBarlineSlots = {\n default: void\n label: { index: number, value: string }\n}\n\nexport type SparklineItem = number | { value: number }\n\nexport type SparklineText = {\n x: number\n value: string\n}\n\nexport interface Boundary {\n minX: number\n minY: number\n maxX: number\n maxY: number\n}\n\nexport interface Bar {\n x: number\n y: number\n height: number\n value: number\n}\n\nexport const makeVBarlineProps = propsFactory({\n autoLineWidth: Boolean,\n\n ...makeLineProps(),\n}, 'VBarline')\n\nexport const VBarline = genericComponent<VBarlineSlots>()({\n name: 'VBarline',\n\n props: makeVBarlineProps(),\n\n setup (props, { slots }) {\n const uid = getUid()\n const id = computed(() => props.id || `barline-${uid}`)\n const autoDrawDuration = computed(() => Number(props.autoDrawDuration) || 500)\n\n const hasLabels = computed(() => {\n return Boolean(\n props.showLabels ||\n props.labels.length > 0 ||\n !!slots?.label\n )\n })\n\n const lineWidth = computed(() => parseFloat(props.lineWidth) || 4)\n\n const totalWidth = computed(() => Math.max(props.modelValue.length * lineWidth.value, Number(props.width)))\n\n const boundary = computed<Boundary>(() => {\n return {\n minX: 0,\n maxX: totalWidth.value,\n minY: 0,\n maxY: parseInt(props.height, 10),\n }\n })\n const items = computed(() => props.modelValue.map(item => getPropertyFromItem(item, props.itemValue, item)))\n\n function genBars (\n values: number[],\n boundary: Boundary\n ): Bar[] {\n const { minX, maxX, minY, maxY } = boundary\n const totalValues = values.length\n let maxValue = props.max != null ? Number(props.max) : Math.max(...values)\n let minValue = props.min != null ? Number(props.min) : Math.min(...values)\n\n if (minValue > 0 && props.min == null) minValue = 0\n if (maxValue < 0 && props.max == null) maxValue = 0\n\n const gridX = maxX / totalValues\n const gridY = (maxY - minY) / ((maxValue - minValue) || 1)\n const horizonY = maxY - Math.abs(minValue * gridY)\n\n return values.map((value, index) => {\n const height = Math.abs(gridY * value)\n\n return {\n x: minX + index * gridX,\n y: horizonY - height +\n +(value < 0) * height,\n height,\n value,\n }\n })\n }\n\n const parsedLabels = computed(() => {\n const labels = []\n const points = genBars(items.value, boundary.value)\n const len = points.length\n\n for (let i = 0; labels.length < len; i++) {\n const item = points[i]\n let value = props.labels[i]\n\n if (!value) {\n value = typeof item === 'object'\n ? item.value\n : item\n }\n\n labels.push({\n x: item.x,\n value: String(value),\n })\n }\n\n return labels\n })\n\n const bars = computed(() => genBars(items.value, boundary.value))\n const offsetX = computed(() => (Math.abs(bars.value[0].x - bars.value[1].x) - lineWidth.value) / 2)\n\n useRender(() => {\n const gradientData = !props.gradient.slice().length ? [''] : props.gradient.slice().reverse()\n return (\n <svg\n display=\"block\"\n >\n <defs>\n <linearGradient\n id={ id.value }\n gradientUnits=\"userSpaceOnUse\"\n x1={ props.gradientDirection === 'left' ? '100%' : '0' }\n y1={ props.gradientDirection === 'top' ? '100%' : '0' }\n x2={ props.gradientDirection === 'right' ? '100%' : '0' }\n y2={ props.gradientDirection === 'bottom' ? '100%' : '0' }\n >\n {\n gradientData.map((color, index) => (\n <stop offset={ index / (Math.max(gradientData.length - 1, 1)) } stop-color={ color || 'currentColor' } />\n ))\n }\n </linearGradient>\n </defs>\n\n <clipPath id={ `${id.value}-clip` }>\n {\n bars.value.map(item => (\n <rect\n x={ item.x + offsetX.value }\n y={ item.y }\n width={ lineWidth.value }\n height={ item.height }\n rx={ typeof props.smooth === 'number' ? props.smooth : props.smooth ? 2 : 0 }\n ry={ typeof props.smooth === 'number' ? props.smooth : props.smooth ? 2 : 0 }\n >\n { props.autoDraw && (\n <>\n <animate\n attributeName=\"y\"\n from={ item.y + item.height }\n to={ item.y }\n dur={ `${autoDrawDuration.value}ms` }\n fill=\"freeze\"\n />\n <animate\n attributeName=\"height\"\n from=\"0\"\n to={ item.height }\n dur={ `${autoDrawDuration.value}ms` }\n fill=\"freeze\"\n />\n </>\n )}\n </rect>\n ))\n }\n </clipPath>\n\n { hasLabels.value && (\n <g\n key=\"labels\"\n style={{\n textAnchor: 'middle',\n dominantBaseline: 'mathematical',\n fill: 'currentColor',\n }}\n >\n {\n parsedLabels.value.map((item, i) => (\n <text\n x={ item.x + offsetX.value + lineWidth.value / 2 }\n y={ (parseInt(props.height, 10) - 2) + (parseInt(props.labelSize, 10) || 7 * 0.75) }\n font-size={ Number(props.labelSize) || 7 }\n >\n { slots.label?.({ index: i, value: item.value }) ?? item.value }\n </text>\n ))\n }\n </g>\n )}\n\n <g\n clip-path={ `url(#${id.value}-clip)` }\n fill={ `url(#${id.value})` }\n >\n <rect\n x={ 0 }\n y={ 0 }\n width={ Math.max(props.modelValue.length * lineWidth.value, Number(props.width)) }\n height={ props.height }\n ></rect>\n </g>\n </svg>\n )\n })\n },\n})\n\nexport type VBarline = InstanceType<typeof VBarline>\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAAC,WAAA,IAAAC,YAAA,EAAAC,QAAA,IAAAC,SAAA,QAAQ,KAAK;AAAA,SACrBC,aAAa;AAAA,SACbC,gBAAgB,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,SAAS,gCAE/E;AA2BA,OAAO,MAAMC,iBAAiB,GAAGF,YAAY,CAAC;EAC5CG,aAAa,EAAEC,OAAO;EAEtB,GAAGR,aAAa,CAAC;AACnB,CAAC,EAAE,UAAU,CAAC;AAEd,OAAO,MAAMS,QAAQ,GAAGR,gBAAgB,CAAgB,CAAC,CAAC;EACxDS,IAAI,EAAE,UAAU;EAEhBC,KAAK,EAAEL,iBAAiB,CAAC,CAAC;EAE1BM,KAAKA,CAAED,KAAK,EAAAE,IAAA,EAAa;IAAA,IAAX;MAAEC;IAAM,CAAC,GAAAD,IAAA;IACrB,MAAME,GAAG,GAAGZ,MAAM,CAAC,CAAC;IACpB,MAAMa,EAAE,GAAGrB,QAAQ,CAAC,MAAMgB,KAAK,CAACK,EAAE,IAAI,WAAWD,GAAG,EAAE,CAAC;IACvD,MAAME,gBAAgB,GAAGtB,QAAQ,CAAC,MAAMuB,MAAM,CAACP,KAAK,CAACM,gBAAgB,CAAC,IAAI,GAAG,CAAC;IAE9E,MAAME,SAAS,GAAGxB,QAAQ,CAAC,MAAM;MAC/B,OAAOa,OAAO,CACZG,KAAK,CAACS,UAAU,IAChBT,KAAK,CA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AA,UAIxC,EAEJ,CAAC,IAIJX,SAAS,CAACW,KAAK,IAAAjC,YAAA;QAAA;QAAA,SAGN;UACL2E,UAAU,EAAE,QAAQ;UACpBC,gBAAgB,EAAE,cAAc;UAChCC,IAAI,EAAE;QACR;MAAC,IAGClB,YAAY,CAAC1B,KAAK,CAACU,GAAG,CAAC,CAACC,IAAI,EAAEkB,CAAC,KAAA9D,YAAA;QAAA,KAEvB4C,IAAI,CAACa,CAAC,GAAGS,OAAO,CAACjC,KAAK,GAAGN,SAAS,CAACM,KAAK,GAAG,CAAC;QAAA,KAC3CO,QAAQ,CAAC1B,KAAK,CAAC2B,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,IAAKD,QAAQ,CAAC1B,KAAK,CAACgE,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAAA,aACtEzD,MAAM,CAACP,KAAK,CAACgE,SAAS,CAAC,IAAI;MAAC,IAEtC7D,KAAK,CAACS,KAAK,GAAG;QAAE8B,KAAK,EAAEM,CAAC;QAAE7B,KAAK,EAAEW,IAAI,CAACX;MAAM,CAAC,CAAC,IAAIW,IAAI,CAACX,KAAK,EAEjE,CAAC,EAGP,EAAAjC,YAAA;QAAA,aAGa,QAAQmB,EAAE,CAACc,KAAK,QAAQ;QAAA,QAC7B,QAAQd,EAAE,CAACc,KAAK;MAAG,IAAAjC,YAAA;QAAA,KAGpB,CAAC;QAAA,KACD,CAAC;QAAA,SACG8B,IAAI,CAACC,GAAG,CAACjB,KAAK,CAACkB,UAAU,CAACP,MAAM,GAAGE,SAAS,CAACM,KAAK,EAAEZ,MAAM,CAACP,KAAK,CAACoB,KAAK,CAAC,CAAC;QAAA,UACvEpB,KAAK,CAAC2B;MAAM;IAK/B,CAAC,CAAC;EACJ;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"VBarline.mjs","names":["computed","useId","createVNode","_createVNode","Fragment","_Fragment","makeLineProps","genericComponent","getPropertyFromItem","propsFactory","useRender","makeVBarlineProps","autoLineWidth","Boolean","VBarline","name","props","setup","_ref","slots","uid","id","autoDrawDuration","Number","hasLabels","showLabels","labels","length","label","lineWidth","parseFloat","totalWidth","Math","max","modelValue","value","width","boundary","minX","maxX","minY","maxY","parseInt","height","items","map","item","itemValue","genBars","values","totalValues","maxValue","minValue","min","gridX","gridY","horizonY","abs","index","x","y","parsedLabels","points","len","i","push","String","bars","offsetX","gradientData","gradient","slice","reverse","gradientDirection","color","smooth","autoDraw","textAnchor","dominantBaseline","fill","labelSize"],"sources":["../../../src/components/VSparkline/VBarline.tsx"],"sourcesContent":["// Utilities\nimport { computed, useId } from 'vue'\nimport { makeLineProps } from './util/line'\nimport { genericComponent, getPropertyFromItem, propsFactory, useRender } from '@/util'\n\n// Types\nexport type VBarlineSlots = {\n default: void\n label: { index: number, value: string }\n}\n\nexport type SparklineItem = number | { value: number }\n\nexport type SparklineText = {\n x: number\n value: string\n}\n\nexport interface Boundary {\n minX: number\n minY: number\n maxX: number\n maxY: number\n}\n\nexport interface Bar {\n x: number\n y: number\n height: number\n value: number\n}\n\nexport const makeVBarlineProps = propsFactory({\n autoLineWidth: Boolean,\n\n ...makeLineProps(),\n}, 'VBarline')\n\nexport const VBarline = genericComponent<VBarlineSlots>()({\n name: 'VBarline',\n\n props: makeVBarlineProps(),\n\n setup (props, { slots }) {\n const uid = useId()\n const id = computed(() => props.id || `barline-${uid}`)\n const autoDrawDuration = computed(() => Number(props.autoDrawDuration) || 500)\n\n const hasLabels = computed(() => {\n return Boolean(\n props.showLabels ||\n props.labels.length > 0 ||\n !!slots?.label\n )\n })\n\n const lineWidth = computed(() => parseFloat(props.lineWidth) || 4)\n\n const totalWidth = computed(() => Math.max(props.modelValue.length * lineWidth.value, Number(props.width)))\n\n const boundary = computed<Boundary>(() => {\n return {\n minX: 0,\n maxX: totalWidth.value,\n minY: 0,\n maxY: parseInt(props.height, 10),\n }\n })\n const items = computed(() => props.modelValue.map(item => getPropertyFromItem(item, props.itemValue, item)))\n\n function genBars (\n values: number[],\n boundary: Boundary\n ): Bar[] {\n const { minX, maxX, minY, maxY } = boundary\n const totalValues = values.length\n let maxValue = props.max != null ? Number(props.max) : Math.max(...values)\n let minValue = props.min != null ? Number(props.min) : Math.min(...values)\n\n if (minValue > 0 && props.min == null) minValue = 0\n if (maxValue < 0 && props.max == null) maxValue = 0\n\n const gridX = maxX / totalValues\n const gridY = (maxY - minY) / ((maxValue - minValue) || 1)\n const horizonY = maxY - Math.abs(minValue * gridY)\n\n return values.map((value, index) => {\n const height = Math.abs(gridY * value)\n\n return {\n x: minX + index * gridX,\n y: horizonY - height +\n +(value < 0) * height,\n height,\n value,\n }\n })\n }\n\n const parsedLabels = computed(() => {\n const labels = []\n const points = genBars(items.value, boundary.value)\n const len = points.length\n\n for (let i = 0; labels.length < len; i++) {\n const item = points[i]\n let value = props.labels[i]\n\n if (!value) {\n value = typeof item === 'object'\n ? item.value\n : item\n }\n\n labels.push({\n x: item.x,\n value: String(value),\n })\n }\n\n return labels\n })\n\n const bars = computed(() => genBars(items.value, boundary.value))\n const offsetX = computed(() => (Math.abs(bars.value[0].x - bars.value[1].x) - lineWidth.value) / 2)\n\n useRender(() => {\n const gradientData = !props.gradient.slice().length ? [''] : props.gradient.slice().reverse()\n return (\n <svg\n display=\"block\"\n >\n <defs>\n <linearGradient\n id={ id.value }\n gradientUnits=\"userSpaceOnUse\"\n x1={ props.gradientDirection === 'left' ? '100%' : '0' }\n y1={ props.gradientDirection === 'top' ? '100%' : '0' }\n x2={ props.gradientDirection === 'right' ? '100%' : '0' }\n y2={ props.gradientDirection === 'bottom' ? '100%' : '0' }\n >\n {\n gradientData.map((color, index) => (\n <stop offset={ index / (Math.max(gradientData.length - 1, 1)) } stop-color={ color || 'currentColor' } />\n ))\n }\n </linearGradient>\n </defs>\n\n <clipPath id={ `${id.value}-clip` }>\n {\n bars.value.map(item => (\n <rect\n x={ item.x + offsetX.value }\n y={ item.y }\n width={ lineWidth.value }\n height={ item.height }\n rx={ typeof props.smooth === 'number' ? props.smooth : props.smooth ? 2 : 0 }\n ry={ typeof props.smooth === 'number' ? props.smooth : props.smooth ? 2 : 0 }\n >\n { props.autoDraw && (\n <>\n <animate\n attributeName=\"y\"\n from={ item.y + item.height }\n to={ item.y }\n dur={ `${autoDrawDuration.value}ms` }\n fill=\"freeze\"\n />\n <animate\n attributeName=\"height\"\n from=\"0\"\n to={ item.height }\n dur={ `${autoDrawDuration.value}ms` }\n fill=\"freeze\"\n />\n </>\n )}\n </rect>\n ))\n }\n </clipPath>\n\n { hasLabels.value && (\n <g\n key=\"labels\"\n style={{\n textAnchor: 'middle',\n dominantBaseline: 'mathematical',\n fill: 'currentColor',\n }}\n >\n {\n parsedLabels.value.map((item, i) => (\n <text\n x={ item.x + offsetX.value + lineWidth.value / 2 }\n y={ (parseInt(props.height, 10) - 2) + (parseInt(props.labelSize, 10) || 7 * 0.75) }\n font-size={ Number(props.labelSize) || 7 }\n >\n { slots.label?.({ index: i, value: item.value }) ?? item.value }\n </text>\n ))\n }\n </g>\n )}\n\n <g\n clip-path={ `url(#${id.value}-clip)` }\n fill={ `url(#${id.value})` }\n >\n <rect\n x={ 0 }\n y={ 0 }\n width={ Math.max(props.modelValue.length * lineWidth.value, Number(props.width)) }\n height={ props.height }\n ></rect>\n </g>\n </svg>\n )\n })\n },\n})\n\nexport type VBarline = InstanceType<typeof VBarline>\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAAC,WAAA,IAAAC,YAAA,EAAAC,QAAA,IAAAC,SAAA,QAAQ,KAAK;AAAA,SAC5BC,aAAa;AAAA,SACbC,gBAAgB,EAAEC,mBAAmB,EAAEC,YAAY,EAAEC,SAAS,gCAEvE;AA2BA,OAAO,MAAMC,iBAAiB,GAAGF,YAAY,CAAC;EAC5CG,aAAa,EAAEC,OAAO;EAEtB,GAAGP,aAAa,CAAC;AACnB,CAAC,EAAE,UAAU,CAAC;AAEd,OAAO,MAAMQ,QAAQ,GAAG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CAAC,CAAC,IAAIW,IAAI,CAACX,KAAK,EAEjE,CAAC,EAGP,EAAAhC,YAAA;QAAA,aAGa,QAAQkB,EAAE,CAACc,KAAK,QAAQ;QAAA,QAC7B,QAAQd,EAAE,CAACc,KAAK;MAAG,IAAAhC,YAAA;QAAA,KAGpB,CAAC;QAAA,KACD,CAAC;QAAA,SACG6B,IAAI,CAACC,GAAG,CAACjB,KAAK,CAACkB,UAAU,CAACP,MAAM,GAAGE,SAAS,CAACM,KAAK,EAAEZ,MAAM,CAACP,KAAK,CAACoB,KAAK,CAAC,CAAC;QAAA,UACvEpB,KAAK,CAAC2B;MAAM;IAK/B,CAAC,CAAC;EACJ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  // Utilities
2
- import { computed, nextTick, ref, watch, createVNode as _createVNode } from 'vue';
2
+ import { computed, nextTick, ref, useId, watch, createVNode as _createVNode } from 'vue';
3
3
  import { makeLineProps } from "./util/line.mjs";
4
4
  import { genPath as _genPath } from "./util/path.mjs";
5
- import { genericComponent, getPropertyFromItem, getUid, propsFactory, useRender } from "../../util/index.mjs"; // Types
5
+ import { genericComponent, getPropertyFromItem, propsFactory, useRender } from "../../util/index.mjs"; // Types
6
6
  export const makeVTrendlineProps = propsFactory({
7
7
  fill: Boolean,
8
8
  ...makeLineProps()
@@ -14,7 +14,7 @@ export const VTrendline = genericComponent()({
14
14
  let {
15
15
  slots
16
16
  } = _ref;
17
- const uid = getUid();
17
+ const uid = useId();
18
18
  const id = computed(() => props.id || `trendline-${uid}`);
19
19
  const autoDrawDuration = computed(() => Number(props.autoDrawDuration) || (props.fill ? 500 : 2000));
20
20
  const lastLength = ref(0);
@@ -1 +1 @@
1
- {"version":3,"file":"VTrendline.mjs","names":["computed","nextTick","ref","watch","createVNode","_createVNode","makeLineProps","genPath","_genPath","genericComponent","getPropertyFromItem","getUid","propsFactory","useRender","makeVTrendlineProps","fill","Boolean","VTrendline","name","props","setup","_ref","slots","uid","id","autoDrawDuration","Number","lastLength","path","genPoints","values","boundary","minX","maxX","minY","maxY","totalValues","length","maxValue","max","Math","minValue","min","gridX","gridY","map","value","index","x","y","hasLabels","showLabels","labels","label","lineWidth","parseFloat","totalWidth","width","padding","parseInt","height","items","modelValue","item","itemValue","parsedLabels","points","len","i","push","String","autoDraw","pathRef","getTotalLength","style","strokeDasharray","strokeDashoffset","getBoundingClientRect","transition","autoDrawEasing","transformOrigin","transform","immediate","smooth","gradientData","gradient","slice","reverse","gradientDirection","color","textAnchor","dominantBaseline","labelSize"],"sources":["../../../src/components/VSparkline/VTrendline.tsx"],"sourcesContent":["// Utilities\nimport { computed, nextTick, ref, watch } from 'vue'\nimport { makeLineProps } from './util/line'\nimport { genPath as _genPath } from './util/path'\nimport { genericComponent, getPropertyFromItem, getUid, propsFactory, useRender } from '@/util'\n\n// Types\nexport type VTrendlineSlots = {\n default: void\n label: { index: number, value: string }\n}\n\nexport type SparklineItem = number | { value: number }\n\nexport type SparklineText = {\n x: number\n value: string\n}\n\nexport interface Boundary {\n minX: number\n minY: number\n maxX: number\n maxY: number\n}\n\nexport interface Point {\n x: number\n y: number\n value: number\n}\n\nexport const makeVTrendlineProps = propsFactory({\n fill: Boolean,\n\n ...makeLineProps(),\n}, 'VTrendline')\n\nexport const VTrendline = genericComponent<VTrendlineSlots>()({\n name: 'VTrendline',\n\n props: makeVTrendlineProps(),\n\n setup (props, { slots }) {\n const uid = getUid()\n const id = computed(() => props.id || `trendline-${uid}`)\n const autoDrawDuration = computed(() => Number(props.autoDrawDuration) || (props.fill ? 500 : 2000))\n\n const lastLength = ref(0)\n const path = ref<SVGPathElement | null>(null)\n\n function genPoints (\n values: number[],\n boundary: Boundary\n ): Point[] {\n const { minX, maxX, minY, maxY } = boundary\n const totalValues = values.length\n const maxValue = props.max != null ? Number(props.max) : Math.max(...values)\n const minValue = props.min != null ? Number(props.min) : Math.min(...values)\n\n const gridX = (maxX - minX) / (totalValues - 1)\n const gridY = (maxY - minY) / ((maxValue - minValue) || 1)\n\n return values.map((value, index) => {\n return {\n x: minX + index * gridX,\n y: maxY - (value - minValue) * gridY,\n value,\n }\n })\n }\n const hasLabels = computed(() => {\n return Boolean(\n props.showLabels ||\n props.labels.length > 0 ||\n !!slots?.label\n )\n })\n const lineWidth = computed(() => {\n return parseFloat(props.lineWidth) || 4\n })\n const totalWidth = computed(() => Number(props.width))\n\n const boundary = computed<Boundary>(() => {\n const padding = Number(props.padding)\n\n return {\n minX: padding,\n maxX: totalWidth.value - padding,\n minY: padding,\n maxY: parseInt(props.height, 10) - padding,\n }\n })\n const items = computed(() => props.modelValue.map(item => getPropertyFromItem(item, props.itemValue, item)))\n const parsedLabels = computed(() => {\n const labels = []\n const points = genPoints(items.value, boundary.value)\n const len = points.length\n\n for (let i = 0; labels.length < len; i++) {\n const item = points[i]\n let value = props.labels[i]\n\n if (!value) {\n value = typeof item === 'object'\n ? item.value\n : item\n }\n\n labels.push({\n x: item.x,\n value: String(value),\n })\n }\n\n return labels\n })\n\n watch(() => props.modelValue, async () => {\n await nextTick()\n\n if (!props.autoDraw || !path.value) return\n\n const pathRef = path.value\n const length = pathRef.getTotalLength()\n\n if (!props.fill) {\n // Initial setup to \"hide\" the line by using the stroke dash array\n pathRef.style.strokeDasharray = `${length}`\n pathRef.style.strokeDashoffset = `${length}`\n\n // Force reflow to ensure the transition starts from this state\n pathRef.getBoundingClientRect()\n\n // Animate the stroke dash offset to \"draw\" the line\n pathRef.style.transition = `stroke-dashoffset ${autoDrawDuration.value}ms ${props.autoDrawEasing}`\n pathRef.style.strokeDashoffset = '0'\n } else {\n // Your existing logic for filled paths remains the same\n pathRef.style.transformOrigin = 'bottom center'\n pathRef.style.transition = 'none'\n pathRef.style.transform = `scaleY(0)`\n pathRef.getBoundingClientRect()\n pathRef.style.transition = `transform ${autoDrawDuration.value}ms ${props.autoDrawEasing}`\n pathRef.style.transform = `scaleY(1)`\n }\n\n lastLength.value = length\n }, { immediate: true })\n\n function genPath (fill: boolean) {\n return _genPath(\n genPoints(items.value, boundary.value),\n props.smooth ? 8 : Number(props.smooth),\n fill,\n parseInt(props.height, 10)\n )\n }\n\n useRender(() => {\n const gradientData = !props.gradient.slice().length ? [''] : props.gradient.slice().reverse()\n\n return (\n <svg\n display=\"block\"\n stroke-width={ parseFloat(props.lineWidth) ?? 4 }\n >\n <defs>\n <linearGradient\n id={ id.value }\n gradientUnits=\"userSpaceOnUse\"\n x1={ props.gradientDirection === 'left' ? '100%' : '0' }\n y1={ props.gradientDirection === 'top' ? '100%' : '0' }\n x2={ props.gradientDirection === 'right' ? '100%' : '0' }\n y2={ props.gradientDirection === 'bottom' ? '100%' : '0' }\n >\n {\n gradientData.map((color, index) => (\n <stop offset={ index / (Math.max(gradientData.length - 1, 1)) } stop-color={ color || 'currentColor' } />\n ))\n }\n </linearGradient>\n </defs>\n\n { hasLabels.value && (\n <g\n key=\"labels\"\n style={{\n textAnchor: 'middle',\n dominantBaseline: 'mathematical',\n fill: 'currentColor',\n }}\n >\n {\n parsedLabels.value.map((item, i) => (\n <text\n x={ item.x + (lineWidth.value / 2) + lineWidth.value / 2 }\n y={ (parseInt(props.height, 10) - 4) + (parseInt(props.labelSize, 10) || 7 * 0.75) }\n font-size={ Number(props.labelSize) || 7 }\n >\n { slots.label?.({ index: i, value: item.value }) ?? item.value }\n </text>\n ))\n }\n </g>\n )}\n\n <path\n ref={ path }\n d={ genPath(props.fill) }\n fill={ props.fill ? `url(#${id.value})` : 'none' }\n stroke={ props.fill ? 'none' : `url(#${id.value})` }\n />\n\n { props.fill && (\n <path\n d={ genPath(false) }\n fill=\"none\"\n stroke={ props.color ?? props.gradient?.[0] }\n />\n )}\n </svg>\n )\n })\n },\n})\n\nexport type VTrendline = InstanceType<typeof VTrendline>\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,KAAK,EAAAC,WAAA,IAAAC,YAAA,QAAQ,KAAK;AAAA,SAC3CC,aAAa;AAAA,SACbC,OA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S,CAACR,KAAK,GAAG,CAAC;QAAA,KACnDa,QAAQ,CAACxC,KAAK,CAACyC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,IAAKD,QAAQ,CAACxC,KAAK,CAACyE,SAAS,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAAA,aACtElE,MAAM,CAACP,KAAK,CAACyE,SAAS,CAAC,IAAI;MAAC,IAEtCtE,KAAK,CAAC+B,KAAK,GAAG;QAAEN,KAAK,EAAEqB,CAAC;QAAEtB,KAAK,EAAEiB,IAAI,CAACjB;MAAM,CAAC,CAAC,IAAIiB,IAAI,CAACjB,KAAK,EAEjE,CAAC,EAGP,EAAAzC,YAAA;QAAA,OAGOuB,IAAI;QAAA,KACNrB,OAAO,CAACY,KAAK,CAACJ,IAAI,CAAC;QAAA,QAChBI,KAAK,CAACJ,IAAI,GAAG,QAAQS,EAAE,CAACsB,KAAK,GAAG,GAAG,MAAM;QAAA,UACvC3B,KAAK,CAACJ,IAAI,GAAG,MAAM,GAAG,QAAQS,EAAE,CAACsB,KAAK;MAAG,UAGlD3B,KAAK,CAACJ,IAAI,IAAAV,YAAA;QAAA,KAEJE,OAAO,CAAC,KAAK,CAAC;QAAA;QAAA,UAETY,KAAK,CAACsE,KAAK,IAAItE,KAAK,CAACkE,QAAQ,GAAG,CAAC;MAAC,QAE9C;IAGP,CAAC,CAAC;EACJ;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"VTrendline.mjs","names":["computed","nextTick","ref","useId","watch","createVNode","_createVNode","makeLineProps","genPath","_genPath","genericComponent","getPropertyFromItem","propsFactory","useRender","makeVTrendlineProps","fill","Boolean","VTrendline","name","props","setup","_ref","slots","uid","id","autoDrawDuration","Number","lastLength","path","genPoints","values","boundary","minX","maxX","minY","maxY","totalValues","length","maxValue","max","Math","minValue","min","gridX","gridY","map","value","index","x","y","hasLabels","showLabels","labels","label","lineWidth","parseFloat","totalWidth","width","padding","parseInt","height","items","modelValue","item","itemValue","parsedLabels","points","len","i","push","String","autoDraw","pathRef","getTotalLength","style","strokeDasharray","strokeDashoffset","getBoundingClientRect","transition","autoDrawEasing","transformOrigin","transform","immediate","smooth","gradientData","gradient","slice","reverse","gradientDirection","color","textAnchor","dominantBaseline","labelSize"],"sources":["../../../src/components/VSparkline/VTrendline.tsx"],"sourcesContent":["// Utilities\nimport { computed, nextTick, ref, useId, watch } from 'vue'\nimport { makeLineProps } from './util/line'\nimport { genPath as _genPath } from './util/path'\nimport { genericComponent, getPropertyFromItem, propsFactory, useRender } from '@/util'\n\n// Types\nexport type VTrendlineSlots = {\n default: void\n label: { index: number, value: string }\n}\n\nexport type SparklineItem = number | { value: number }\n\nexport type SparklineText = {\n x: number\n value: string\n}\n\nexport interface Boundary {\n minX: number\n minY: number\n maxX: number\n maxY: number\n}\n\nexport interface Point {\n x: number\n y: number\n value: number\n}\n\nexport const makeVTrendlineProps = propsFactory({\n fill: Boolean,\n\n ...makeLineProps(),\n}, 'VTrendline')\n\nexport const VTrendline = genericComponent<VTrendlineSlots>()({\n name: 'VTrendline',\n\n props: makeVTrendlineProps(),\n\n setup (props, { slots }) {\n const uid = useId()\n const id = computed(() => props.id || `trendline-${uid}`)\n const autoDrawDuration = computed(() => Number(props.autoDrawDuration) || (props.fill ? 500 : 2000))\n\n const lastLength = ref(0)\n const path = ref<SVGPathElement | null>(null)\n\n function genPoints (\n values: number[],\n boundary: Boundary\n ): Point[] {\n const { minX, maxX, minY, maxY } = boundary\n const totalValues = values.length\n const maxValue = props.max != null ? Number(props.max) : Math.max(...values)\n const minValue = props.min != null ? Number(props.min) : Math.min(...values)\n\n const gridX = (maxX - minX) / (totalValues - 1)\n const gridY = (maxY - minY) / ((maxValue - minValue) || 1)\n\n return values.map((value, index) => {\n return {\n x: minX + index * gridX,\n y: maxY - (value - minValue) * gridY,\n value,\n }\n })\n }\n const hasLabels = computed(() => {\n return Boolean(\n props.showLabels ||\n props.labels.length > 0 ||\n !!slots?.label\n )\n })\n const lineWidth = computed(() => {\n return parseFloat(props.lineWidth) || 4\n })\n const totalWidth = computed(() => Number(props.width))\n\n const boundary = computed<Boundary>(() => {\n const padding = Number(props.padding)\n\n return {\n minX: padding,\n maxX: totalWidth.value - padding,\n minY: padding,\n maxY: parseInt(props.height, 10) - padding,\n }\n })\n const items = computed(() => props.modelValue.map(item => getPropertyFromItem(item, props.itemValue, item)))\n const parsedLabels = computed(() => {\n const labels = []\n const points = genPoints(items.value, boundary.value)\n const len = points.length\n\n for (let i = 0; labels.length < len; i++) {\n const item = points[i]\n let value = props.labels[i]\n\n if (!value) {\n value = typeof item === 'object'\n ? item.value\n : item\n }\n\n labels.push({\n x: item.x,\n value: String(value),\n })\n }\n\n return labels\n })\n\n watch(() => props.modelValue, async () => {\n await nextTick()\n\n if (!props.autoDraw || !path.value) return\n\n const pathRef = path.value\n const length = pathRef.getTotalLength()\n\n if (!props.fill) {\n // Initial setup to \"hide\" the line by using the stroke dash array\n pathRef.style.strokeDasharray = `${length}`\n pathRef.style.strokeDashoffset = `${length}`\n\n // Force reflow to ensure the transition starts from this state\n pathRef.getBoundingClientRect()\n\n // Animate the stroke dash offset to \"draw\" the line\n pathRef.style.transition = `stroke-dashoffset ${autoDrawDuration.value}ms ${props.autoDrawEasing}`\n pathRef.style.strokeDashoffset = '0'\n } else {\n // Your existing logic for filled paths remains the same\n pathRef.style.transformOrigin = 'bottom center'\n pathRef.style.transition = 'none'\n pathRef.style.transform = `scaleY(0)`\n pathRef.getBoundingClientRect()\n pathRef.style.transition = `transform ${autoDrawDuration.value}ms ${props.autoDrawEasing}`\n pathRef.style.transform = `scaleY(1)`\n }\n\n lastLength.value = length\n }, { immediate: true })\n\n function genPath (fill: boolean) {\n return _genPath(\n genPoints(items.value, boundary.value),\n props.smooth ? 8 : Number(props.smooth),\n fill,\n parseInt(props.height, 10)\n )\n }\n\n useRender(() => {\n const gradientData = !props.gradient.slice().length ? [''] : props.gradient.slice().reverse()\n\n return (\n <svg\n display=\"block\"\n stroke-width={ parseFloat(props.lineWidth) ?? 4 }\n >\n <defs>\n <linearGradient\n id={ id.value }\n gradientUnits=\"userSpaceOnUse\"\n x1={ props.gradientDirection === 'left' ? '100%' : '0' }\n y1={ props.gradientDirection === 'top' ? '100%' : '0' }\n x2={ props.gradientDirection === 'right' ? '100%' : '0' }\n y2={ props.gradientDirection === 'bottom' ? '100%' : '0' }\n >\n {\n gradientData.map((color, index) => (\n <stop offset={ index / (Math.max(gradientData.length - 1, 1)) } stop-color={ color || 'currentColor' } />\n ))\n }\n </linearGradient>\n </defs>\n\n { hasLabels.value && (\n <g\n key=\"labels\"\n style={{\n textAnchor: 'middle',\n dominantBaseline: 'mathematical',\n fill: 'currentColor',\n }}\n >\n {\n parsedLabels.value.map((item, i) => (\n <text\n x={ item.x + (lineWidth.value / 2) + lineWidth.value / 2 }\n y={ (parseInt(props.height, 10) - 4) + (parseInt(props.labelSize, 10) || 7 * 0.75) }\n font-size={ Number(props.labelSize) || 7 }\n >\n { slots.label?.({ index: i, value: item.value }) ?? item.value }\n </text>\n ))\n }\n </g>\n )}\n\n <path\n ref={ path }\n d={ genPath(props.fill) }\n fill={ props.fill ? `url(#${id.value})` : 'none' }\n stroke={ props.fill ? 'none' : `url(#${id.value})` }\n />\n\n { props.fill && (\n <path\n d={ genPath(false) }\n fill=\"none\"\n stroke={ props.color ?? props.gradient?.[0] }\n />\n )}\n </svg>\n )\n })\n },\n})\n\nexport type VTrendline = InstanceType<typeof VTrendline>\n"],"mappings":"AAAA;AACA,SAASA,QAAQ,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,EAAAC,WAAA,IAAAC,YAAA,QAAQ,KAAK;AAAA,SAClDC,aAAa;AAAA,SACbC,OAAO,IAAIC,QAAQ;AAAA,SACnBC,gBAAgB,EAAEC,mBAAmB,EAAEC,YAAY,EAAEC,SAAS,gCAEvE;AA0BA,OAAO,MAAMC,mBAAmB,GAAGF,YAAY,CAAC;EAC9CG,IAAI,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AAC,GAAG,IAAI,CAAC;QAAA,aACtElE,MAAM,CAACP,KAAK,CAACyE,SAAS,CAAC,IAAI;MAAC,IAEtCtE,KAAK,CAAC+B,KAAK,GAAG;QAAEN,KAAK,EAAEqB,CAAC;QAAEtB,KAAK,EAAEiB,IAAI,CAACjB;MAAM,CAAC,CAAC,IAAIiB,IAAI,CAACjB,KAAK,EAEjE,CAAC,EAGP,EAAAxC,YAAA;QAAA,OAGOsB,IAAI;QAAA,KACNpB,OAAO,CAACW,KAAK,CAACJ,IAAI,CAAC;QAAA,QAChBI,KAAK,CAACJ,IAAI,GAAG,QAAQS,EAAE,CAACsB,KAAK,GAAG,GAAG,MAAM;QAAA,UACvC3B,KAAK,CAACJ,IAAI,GAAG,MAAM,GAAG,QAAQS,EAAE,CAACsB,KAAK;MAAG,UAGlD3B,KAAK,CAACJ,IAAI,IAAAT,YAAA;QAAA,KAEJE,OAAO,CAAC,KAAK,CAAC;QAAA;QAAA,UAETW,KAAK,CAACsE,KAAK,IAAItE,KAAK,CAACkE,QAAQ,GAAG,CAAC;MAAC,QAE9C;IAGP,CAAC,CAAC;EACJ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -12,8 +12,8 @@ import { makeVSelectionControlProps, VSelectionControl } from "../VSelectionCont
12
12
  import { useFocus } from "../../composables/focus.mjs";
13
13
  import { LoaderSlot, useLoader } from "../../composables/loader.mjs";
14
14
  import { useProxiedModel } from "../../composables/proxiedModel.mjs"; // Utilities
15
- import { computed, ref } from 'vue';
16
- import { filterInputAttrs, genericComponent, getUid, IN_BROWSER, propsFactory, useRender } from "../../util/index.mjs"; // Types
15
+ import { computed, ref, useId } from 'vue';
16
+ import { filterInputAttrs, genericComponent, IN_BROWSER, propsFactory, useRender } from "../../util/index.mjs"; // Types
17
17
  export const makeVSwitchProps = propsFactory({
18
18
  indeterminate: Boolean,
19
19
  inset: Boolean,
@@ -54,7 +54,7 @@ export const VSwitch = genericComponent()({
54
54
  const loaderColor = computed(() => {
55
55
  return typeof props.loading === 'string' && props.loading !== '' ? props.loading : props.color;
56
56
  });
57
- const uid = getUid();
57
+ const uid = useId();
58
58
  const id = computed(() => props.id || `switch-${uid}`);
59
59
  function onChange() {
60
60
  if (indeterminate.value) {