@davincihealthcare/elty-design-system-vue 1.72.0 → 1.72.1

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 (197) hide show
  1. package/dist/ElAccordion.vue.cjs2.js.map +1 -1
  2. package/dist/ElAccordion.vue.esm2.js.map +1 -1
  3. package/dist/ElActionButton.vue.cjs2.js +1 -1
  4. package/dist/ElActionButton.vue.cjs2.js.map +1 -1
  5. package/dist/ElActionButton.vue.esm2.js +1 -1
  6. package/dist/ElActionButton.vue.esm2.js.map +1 -1
  7. package/dist/ElAvatar.vue.cjs2.js.map +1 -1
  8. package/dist/ElAvatar.vue.esm2.js.map +1 -1
  9. package/dist/ElBadge.vue.cjs2.js.map +1 -1
  10. package/dist/ElBadge.vue.esm2.js.map +1 -1
  11. package/dist/ElBubbleChat.vue.cjs2.js +1 -1
  12. package/dist/ElBubbleChat.vue.cjs2.js.map +1 -1
  13. package/dist/ElBubbleChat.vue.esm2.js +1 -1
  14. package/dist/ElBubbleChat.vue.esm2.js.map +1 -1
  15. package/dist/ElButton.vue.cjs2.js.map +1 -1
  16. package/dist/ElButton.vue.esm2.js.map +1 -1
  17. package/dist/ElCalendarCard.vue.cjs2.js.map +1 -1
  18. package/dist/ElCalendarCard.vue.esm2.js.map +1 -1
  19. package/dist/ElCalendarCell.vue.cjs2.js.map +1 -1
  20. package/dist/ElCalendarCell.vue.esm2.js.map +1 -1
  21. package/dist/ElCarousel.vue.cjs2.js +1 -1
  22. package/dist/ElCarousel.vue.cjs2.js.map +1 -1
  23. package/dist/ElCarousel.vue.esm2.js +1 -1
  24. package/dist/ElCarousel.vue.esm2.js.map +1 -1
  25. package/dist/ElClipToAnchor.vue.cjs2.js +1 -1
  26. package/dist/ElClipToAnchor.vue.cjs2.js.map +1 -1
  27. package/dist/ElClipToAnchor.vue.esm2.js +1 -1
  28. package/dist/ElClipToAnchor.vue.esm2.js.map +1 -1
  29. package/dist/ElContainerTemplate.vue.cjs2.js +1 -1
  30. package/dist/ElContainerTemplate.vue.cjs2.js.map +1 -1
  31. package/dist/ElContainerTemplate.vue.esm2.js +1 -1
  32. package/dist/ElContainerTemplate.vue.esm2.js.map +1 -1
  33. package/dist/ElDivider.vue.cjs2.js.map +1 -1
  34. package/dist/ElDivider.vue.esm2.js.map +1 -1
  35. package/dist/ElDrawer.vue.cjs2.js.map +1 -1
  36. package/dist/ElDrawer.vue.esm2.js.map +1 -1
  37. package/dist/ElDropdown.vue.cjs2.js +1 -1
  38. package/dist/ElDropdown.vue.cjs2.js.map +1 -1
  39. package/dist/ElDropdown.vue.esm2.js +1 -1
  40. package/dist/ElDropdown.vue.esm2.js.map +1 -1
  41. package/dist/ElFile.vue.cjs2.js.map +1 -1
  42. package/dist/ElFile.vue.esm2.js.map +1 -1
  43. package/dist/ElIcon.vue.cjs2.js +1 -1
  44. package/dist/ElIcon.vue.cjs2.js.map +1 -1
  45. package/dist/ElIcon.vue.esm2.js +1 -1
  46. package/dist/ElIcon.vue.esm2.js.map +1 -1
  47. package/dist/ElIconButton.vue.cjs2.js.map +1 -1
  48. package/dist/ElIconButton.vue.esm2.js.map +1 -1
  49. package/dist/ElInlineBanner.vue.cjs2.js.map +1 -1
  50. package/dist/ElInlineBanner.vue.esm2.js.map +1 -1
  51. package/dist/ElInputChat.vue.cjs2.js.map +1 -1
  52. package/dist/ElInputChat.vue.esm2.js.map +1 -1
  53. package/dist/ElListItem.vue.cjs2.js.map +1 -1
  54. package/dist/ElListItem.vue.esm2.js.map +1 -1
  55. package/dist/ElLogo.vue.cjs2.js.map +1 -1
  56. package/dist/ElLogo.vue.esm2.js.map +1 -1
  57. package/dist/ElModal.vue.cjs2.js +1 -1
  58. package/dist/ElModal.vue.cjs2.js.map +1 -1
  59. package/dist/ElModal.vue.esm2.js +1 -1
  60. package/dist/ElModal.vue.esm2.js.map +1 -1
  61. package/dist/ElSortingHeader.vue.cjs2.js.map +1 -1
  62. package/dist/ElSortingHeader.vue.esm2.js.map +1 -1
  63. package/dist/ElSpinner.vue.cjs2.js.map +1 -1
  64. package/dist/ElSpinner.vue.esm2.js.map +1 -1
  65. package/dist/ElTab.vue.cjs2.js.map +1 -1
  66. package/dist/ElTab.vue.esm2.js.map +1 -1
  67. package/dist/ElTabGroup.vue.cjs2.js.map +1 -1
  68. package/dist/ElTabGroup.vue.esm2.js.map +1 -1
  69. package/dist/ElTabs.vue.cjs2.js.map +1 -1
  70. package/dist/ElTabs.vue.esm2.js.map +1 -1
  71. package/dist/ElTag.vue.cjs2.js.map +1 -1
  72. package/dist/ElTag.vue.esm2.js.map +1 -1
  73. package/dist/ElTextCell.vue.cjs2.js.map +1 -1
  74. package/dist/ElTextCell.vue.esm2.js.map +1 -1
  75. package/dist/ElToast.vue.cjs2.js +1 -1
  76. package/dist/ElToast.vue.cjs2.js.map +1 -1
  77. package/dist/ElToast.vue.esm2.js +1 -1
  78. package/dist/ElToast.vue.esm2.js.map +1 -1
  79. package/dist/ElTooltip.vue.cjs2.js.map +1 -1
  80. package/dist/ElTooltip.vue.esm2.js.map +1 -1
  81. package/dist/ElVerticalTab.vue.cjs2.js.map +1 -1
  82. package/dist/ElVerticalTab.vue.esm2.js.map +1 -1
  83. package/dist/_CustomTransition.vue.cjs2.js.map +1 -1
  84. package/dist/_CustomTransition.vue.esm2.js.map +1 -1
  85. package/dist/assets/logo/davinci-dark.svg.cjs.js.map +1 -1
  86. package/dist/assets/logo/davinci-dark.svg.esm.js.map +1 -1
  87. package/dist/assets/logo/davinci-white.svg.cjs.js.map +1 -1
  88. package/dist/assets/logo/davinci-white.svg.esm.js.map +1 -1
  89. package/dist/assets/logo/elty-dark.svg.cjs.js.map +1 -1
  90. package/dist/assets/logo/elty-dark.svg.esm.js.map +1 -1
  91. package/dist/assets/logo/elty-two-tone.svg.cjs.js.map +1 -1
  92. package/dist/assets/logo/elty-two-tone.svg.esm.js.map +1 -1
  93. package/dist/assets/logo/elty-white.svg.cjs.js.map +1 -1
  94. package/dist/assets/logo/elty-white.svg.esm.js.map +1 -1
  95. package/dist/assets/logo/heart-dark.svg.cjs.js.map +1 -1
  96. package/dist/assets/logo/heart-dark.svg.esm.js.map +1 -1
  97. package/dist/assets/logo/heart-two-tone.svg.cjs.js.map +1 -1
  98. package/dist/assets/logo/heart-two-tone.svg.esm.js.map +1 -1
  99. package/dist/assets/logo/heart-white.svg.cjs.js.map +1 -1
  100. package/dist/assets/logo/heart-white.svg.esm.js.map +1 -1
  101. package/dist/composable/mobileComposable.cjs.js +1 -1
  102. package/dist/composable/mobileComposable.cjs.js.map +1 -1
  103. package/dist/composable/mobileComposable.esm.js +1 -1
  104. package/dist/composable/mobileComposable.esm.js.map +1 -1
  105. package/dist/forms/ElInputCheckbox.vue.cjs2.js.map +1 -1
  106. package/dist/forms/ElInputCheckbox.vue.esm2.js.map +1 -1
  107. package/dist/forms/ElInputDate.vue.cjs2.js +1 -1
  108. package/dist/forms/ElInputDate.vue.cjs2.js.map +1 -1
  109. package/dist/forms/ElInputDate.vue.esm2.js +1 -1
  110. package/dist/forms/ElInputDate.vue.esm2.js.map +1 -1
  111. package/dist/forms/ElInputFile.vue.cjs2.js.map +1 -1
  112. package/dist/forms/ElInputFile.vue.esm2.js.map +1 -1
  113. package/dist/forms/ElInputMeasureUnit.vue.cjs2.js.map +1 -1
  114. package/dist/forms/ElInputMeasureUnit.vue.esm2.js.map +1 -1
  115. package/dist/forms/ElInputNumber.vue.cjs2.js.map +1 -1
  116. package/dist/forms/ElInputNumber.vue.esm2.js.map +1 -1
  117. package/dist/forms/ElInputPhone.vue.cjs2.js.map +1 -1
  118. package/dist/forms/ElInputPhone.vue.esm2.js.map +1 -1
  119. package/dist/forms/ElInputRadioButton.vue.cjs2.js.map +1 -1
  120. package/dist/forms/ElInputRadioButton.vue.esm2.js.map +1 -1
  121. package/dist/forms/ElInputRichText/Editor.vue.cjs2.js +1 -1
  122. package/dist/forms/ElInputRichText/Editor.vue.cjs2.js.map +1 -1
  123. package/dist/forms/ElInputRichText/Editor.vue.esm2.js +1 -1
  124. package/dist/forms/ElInputRichText/Editor.vue.esm2.js.map +1 -1
  125. package/dist/forms/ElInputRichText/translations/it.cjs.js +1 -1
  126. package/dist/forms/ElInputRichText/translations/it.cjs.js.map +1 -1
  127. package/dist/forms/ElInputRichText/translations/it.esm.js +1 -1
  128. package/dist/forms/ElInputRichText/translations/it.esm.js.map +1 -1
  129. package/dist/forms/ElInputRichText.vue.cjs2.js +1 -1
  130. package/dist/forms/ElInputRichText.vue.cjs2.js.map +1 -1
  131. package/dist/forms/ElInputRichText.vue.esm2.js +2 -2
  132. package/dist/forms/ElInputRichText.vue.esm2.js.map +1 -1
  133. package/dist/forms/ElInputSearch.vue.cjs2.js +1 -1
  134. package/dist/forms/ElInputSearch.vue.cjs2.js.map +1 -1
  135. package/dist/forms/ElInputSearch.vue.esm2.js +1 -1
  136. package/dist/forms/ElInputSearch.vue.esm2.js.map +1 -1
  137. package/dist/forms/ElInputSelect.vue.cjs2.js +1 -1
  138. package/dist/forms/ElInputSelect.vue.cjs2.js.map +1 -1
  139. package/dist/forms/ElInputSelect.vue.esm2.js +1 -1
  140. package/dist/forms/ElInputSelect.vue.esm2.js.map +1 -1
  141. package/dist/forms/ElInputSwitch.vue.cjs2.js.map +1 -1
  142. package/dist/forms/ElInputSwitch.vue.esm2.js.map +1 -1
  143. package/dist/forms/ElInputText.vue.cjs2.js.map +1 -1
  144. package/dist/forms/ElInputText.vue.esm2.js.map +1 -1
  145. package/dist/forms/ElInputTextarea.vue.cjs2.js.map +1 -1
  146. package/dist/forms/ElInputTextarea.vue.esm2.js.map +1 -1
  147. package/dist/forms/input.cjs.js.map +1 -1
  148. package/dist/forms/input.esm.js.map +1 -1
  149. package/dist/forms/unicodeCharsRule.cjs.js +1 -1
  150. package/dist/forms/unicodeCharsRule.cjs.js.map +1 -1
  151. package/dist/forms/unicodeCharsRule.esm.js +1 -1
  152. package/dist/forms/unicodeCharsRule.esm.js.map +1 -1
  153. package/dist/forms/utils.cjs.js +1 -1
  154. package/dist/forms/utils.cjs.js.map +1 -1
  155. package/dist/forms/utils.esm.js +1 -1
  156. package/dist/forms/utils.esm.js.map +1 -1
  157. package/dist/forms/validation-rules.cjs.js +1 -1
  158. package/dist/forms/validation-rules.cjs.js.map +1 -1
  159. package/dist/forms/validation-rules.esm.js +1 -1
  160. package/dist/forms/validation-rules.esm.js.map +1 -1
  161. package/dist/index.cjs.js +1 -1
  162. package/dist/index.esm.js +1 -1
  163. package/dist/polyfills.cjs.js.map +1 -1
  164. package/dist/polyfills.esm.js.map +1 -1
  165. package/dist/preset.cjs.js +1 -1
  166. package/dist/preset.esm.js +1 -1
  167. package/dist/table/ElMobileTable.vue.cjs2.js.map +1 -1
  168. package/dist/table/ElMobileTable.vue.esm2.js.map +1 -1
  169. package/dist/table/ElResponsiveTable.vue.cjs2.js.map +1 -1
  170. package/dist/table/ElResponsiveTable.vue.esm2.js.map +1 -1
  171. package/dist/table/ElServerSideMobileTable.vue.cjs2.js.map +1 -1
  172. package/dist/table/ElServerSideMobileTable.vue.esm2.js.map +1 -1
  173. package/dist/table/ElServerSideResponsiveTable.vue.cjs2.js.map +1 -1
  174. package/dist/table/ElServerSideResponsiveTable.vue.esm2.js.map +1 -1
  175. package/dist/table/ElServerSideTable.vue.cjs2.js +1 -1
  176. package/dist/table/ElServerSideTable.vue.cjs2.js.map +1 -1
  177. package/dist/table/ElServerSideTable.vue.esm2.js +1 -1
  178. package/dist/table/ElServerSideTable.vue.esm2.js.map +1 -1
  179. package/dist/table/ElServerSideTablePagination.vue.cjs2.js.map +1 -1
  180. package/dist/table/ElServerSideTablePagination.vue.esm2.js.map +1 -1
  181. package/dist/table/ElTable.vue.cjs2.js.map +1 -1
  182. package/dist/table/ElTable.vue.esm2.js.map +1 -1
  183. package/dist/table/ElTableCell.vue.cjs2.js.map +1 -1
  184. package/dist/table/ElTableCell.vue.esm2.js.map +1 -1
  185. package/dist/table/ElTablePagination.vue.cjs2.js.map +1 -1
  186. package/dist/table/ElTablePagination.vue.esm2.js.map +1 -1
  187. package/dist/tailwind.plugin.cjs.js +1 -1
  188. package/dist/tailwind.plugin.cjs.js.map +1 -1
  189. package/dist/tailwind.plugin.esm.js +1 -1
  190. package/dist/tailwind.plugin.esm.js.map +1 -1
  191. package/dist/types.cjs.js.map +1 -1
  192. package/dist/types.esm.js.map +1 -1
  193. package/dist/utils.cjs.js.map +1 -1
  194. package/dist/utils.esm.js.map +1 -1
  195. package/dist/vue.plugin.cjs.js.map +1 -1
  196. package/dist/vue.plugin.esm.js.map +1 -1
  197. package/package.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputSelect.vue.cjs2.js","sources":["../../../src/forms/ElInputSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, withCommonElInputProps } from '@/forms/input';\nimport { computed, PropType, ref } from 'vue';\nimport { OptionType, Role } from '@/types';\nimport { ElClipToAnchorPosition } from '@/ElClipToAnchor.vue';\nimport { AutocompleteOptionType, isAutocompleteOptionType } from '@/forms/utils';\nimport ElDropdown from '@/ElDropdown.vue';\nimport ElAvatar from '@/ElAvatar.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport _ from 'lodash';\n\nexport type OptionValueType = string | string[] | null | undefined;\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n // TODO: it should differ between the single input select and the multiselect\n type: [Array, String] as PropType<OptionValueType>,\n required: false,\n default: undefined,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n options: {\n type: Array as PropType<(OptionType | AutocompleteOptionType)[]>,\n required: true,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n noRemoveValue: {\n type: Boolean,\n default: false,\n },\n positionToAnchor: {\n type: String as PropType<ElClipToAnchorPosition>,\n required: false,\n default: 'bottom',\n },\n});\n\nconst allOptions = computed<InstanceType<typeof ElDropdown>['$props']['items']>(() => {\n const options = props.options.map(o => {\n const option: InstanceType<typeof ElDropdown>['$props']['items'][number] = {\n text: o.label,\n semiboldText: 'semiboldText' in o ? o.semiboldText : undefined,\n avatar: o.imageUrl ? { avatarUrl: o.imageUrl, role: Role.Patient } : undefined,\n onClick: () => setValue(props.multiple ? _.xor(value.value, [o.value]) : o.value),\n check: props.multiple ? props.modelValue?.includes(o.value) : o.value == props.modelValue,\n };\n\n if (isAutocompleteOptionType(o) && o.prefixIcon?.name) {\n option.leadingIcon = o.prefixIcon?.name ? { name: o.prefixIcon.name, solid: o.prefixIcon.isSolid } : undefined;\n }\n\n return option;\n });\n\n if (!props.noRemoveValue && !props.multiple) {\n options.unshift({\n text: '-',\n onClick: () => setValue(undefined),\n });\n }\n\n if (props.multiple) {\n options.unshift({\n text: value.value?.length === props.options.length ? 'Deseleziona tutto' : 'Seleziona tutto',\n onClick: () => {\n if (value.value?.length === props.options.length) setValue(undefined);\n else setValue(props.options.map(opt => opt.value).slice(0));\n dropdown.value?.hide();\n },\n });\n }\n\n return options;\n});\n\nconst emit = defineEmits<{\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelValue', newValue: OptionValueType): void;\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelLabel', newValue: OptionValueType): void;\n}>();\n\nconst button = ref<HTMLElement>();\nconst dropdown = ref<InstanceType<typeof ElDropdown>>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { errorMessage, value, setValue } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue);\n emit('update:modelLabel', getLabelForOptionValue(newValue));\n});\n\nconst valueIsEmpty = computed<boolean>(() => {\n return !value.value || !getLabelForOptionValue(value.value);\n});\n\nconst getLabelForOptionValue = (value: OptionValueType): OptionValueType => {\n if (!value) return;\n if (typeof value === 'string') {\n return props.options?.find(o => o.value === value)?.label || '';\n } else {\n // return list of labels\n return value\n .map(v => {\n const option = props.options.find(o => o.value === v);\n return option ? option.label : '';\n })\n .filter(entry => !!entry);\n }\n};\n\nconst valueLabel = computed<OptionValueType>(() => {\n return getLabelForOptionValue(value.value);\n});\n\nconst valueAvatar = computed(() => {\n if (!value.value || props.multiple) return;\n if (typeof value.value === 'string') {\n return props.options?.find(o => o.value === value.value)?.imageUrl;\n }\n return '';\n});\n\nconst toggleDropdownAndGrabFocus = (toggle: () => void) => {\n toggle();\n button.value?.focus();\n};\n\nconst closeDropdownOnBlur = (e: FocusEvent, hide: () => void) => {\n // options dropdown must have an option role, so if it ain't that, close the dropdown\n if ((e.relatedTarget as HTMLElement)?.role !== 'option') {\n hide();\n }\n};\n\nconst showDropdownIfClosed = (e: Event, isOpen: boolean, show: () => void) => {\n if (!isOpen) {\n show();\n\n e.preventDefault();\n e.stopPropagation();\n }\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"label\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([props.validation])\"\n >\n <template #default=\"{ error }\">\n <ElDropdown ref=\"dropdown\" :items=\"allOptions\" :multiple=\"multiple\">\n <template #anchor=\"{ show, hide, toggle, isOpen }\">\n <button\n ref=\"button\"\n type=\"button\"\n :name=\"props.name\"\n :disabled=\"disabled\"\n class=\"el-input !pr-8 px-3\"\n :class=\"{ error, empty: valueIsEmpty, 'focus:ring-1': !error }\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-labelledby=\"listbox-label\"\n :data-cy=\"`${label.trim().replaceAll(' ', '').replaceAll('.', '')}-select`\"\n @mousedown.prevent=\"toggleDropdownAndGrabFocus(toggle)\"\n @focus.prevent=\"show\"\n @blur.prevent=\"closeDropdownOnBlur($event, hide)\"\n @keydown.enter=\"showDropdownIfClosed($event, isOpen, show)\"\n >\n <span v-if=\"placeholder && valueIsEmpty\" class=\"text-neutral-inactive truncate w-full block\">\n {{ placeholder }}\n </span>\n <span v-else class=\"flex h-full w-full items-center justify-start truncate\">\n <ElAvatar v-if=\"valueAvatar\" :picture=\"valueAvatar\" size=\"xxs\" />\n <span class=\"truncate\">{{ Array.isArray(valueLabel) ? valueLabel.join(', ') : valueLabel }}</span>\n </span>\n <span v-if=\"!error\" class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2\">\n <ElIcon\n name=\"ChevronDownIcon\"\n solid\n class=\"h-5 w-5 transition-transform duration-200\"\n :class=\"{ 'rotate-180': isOpen, 'text-neutral-inactive': valueIsEmpty, 'text-neutral-darker': !valueIsEmpty }\"\n />\n </span>\n </button>\n </template>\n </ElDropdown>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["props","__props","allOptions","computed","options","o","option","Role","setValue","_","value","_a","isAutocompleteOptionType","_b","_c","opt","dropdown","emit","__emit","button","ref","computedModelValue","computedValidation","errorMessage","useInput","newValue","getLabelForOptionValue","valueIsEmpty","v","entry","valueLabel","valueAvatar","toggleDropdownAndGrabFocus","toggle","closeDropdownOnBlur","e","hide","showDropdownIfClosed","isOpen","show"],"mappings":"kpCAcA,MAAMA,EAAQC,EAgCRC,EAAaC,EAAAA,SAA6D,IAAM,OACpF,MAAMC,EAAUJ,EAAM,QAAQ,IAASK,GAAA,WACrC,MAAMC,EAAqE,CACzE,KAAMD,EAAE,MACR,aAAc,iBAAkBA,EAAIA,EAAE,aAAe,OACrD,OAAQA,EAAE,SAAW,CAAE,UAAWA,EAAE,SAAU,KAAME,EAAAA,KAAK,OAAA,EAAY,OACrE,QAAS,IAAMC,EAASR,EAAM,SAAWS,EAAE,QAAA,IAAIC,EAAM,MAAO,CAACL,EAAE,KAAK,CAAC,EAAIA,EAAE,KAAK,EAChF,MAAOL,EAAM,UAAWW,EAAAX,EAAM,aAAN,YAAAW,EAAkB,SAASN,EAAE,OAASA,EAAE,OAASL,EAAM,UAAA,EAGjF,OAAIY,EAAyB,yBAAAP,CAAC,KAAKQ,EAAAR,EAAE,aAAF,MAAAQ,EAAc,QAC/CP,EAAO,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,EACJ,IAASkB,GAAA,CACR,MAAMtB,EAASN,EAAM,QAAQ,KAAUK,GAAAA,EAAE,QAAUuB,CAAC,EAC7C,OAAAtB,EAASA,EAAO,MAAQ,EAChC,CAAA,EACA,OAAgBuB,GAAA,CAAC,CAACA,CAAK,CAC5B,EAGIC,EAAa3B,EAAAA,SAA0B,IACpCuB,EAAuBhB,EAAM,KAAK,CAC1C,EAEKqB,EAAc5B,EAAAA,SAAS,IAAM,SAC7B,GAAA,GAACO,EAAM,OAASV,EAAM,UACtB,OAAA,OAAOU,EAAM,OAAU,UAClBG,GAAAF,EAAAX,EAAM,UAAN,YAAAW,EAAe,KAAKN,GAAKA,EAAE,QAAUK,EAAM,SAA3C,YAAAG,EAAmD,SAErD,EAAA,CACR,EAEKmB,EAA8BC,GAAuB,OAClDA,KACPtB,EAAAQ,EAAO,QAAP,MAAAR,EAAc,OAAM,EAGhBuB,EAAsB,CAACC,EAAeC,IAAqB,SAE1DzB,EAAAwB,EAAE,gBAAF,YAAAxB,EAAiC,QAAS,UACxCyB,GACP,EAGIC,EAAuB,CAACF,EAAUG,EAAiBC,IAAqB,CACvED,IACEC,IAELJ,EAAE,eAAe,EACjBA,EAAE,gBAAgB,EACpB"}
1
+ {"version":3,"file":"ElInputSelect.vue.cjs2.js","sources":["../../src/forms/ElInputSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, withCommonElInputProps } from '@/forms/input';\nimport { computed, PropType, ref } from 'vue';\nimport { OptionType, Role } from '@/types';\nimport { ElClipToAnchorPosition } from '@/ElClipToAnchor.vue';\nimport { AutocompleteOptionType, isAutocompleteOptionType } from '@/forms/utils';\nimport ElDropdown from '@/ElDropdown.vue';\nimport ElAvatar from '@/ElAvatar.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport _ from 'lodash';\n\nexport type OptionValueType = string | string[] | null | undefined;\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n // TODO: it should differ between the single input select and the multiselect\n type: [Array, String] as PropType<OptionValueType>,\n required: false,\n default: undefined,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n options: {\n type: Array as PropType<(OptionType | AutocompleteOptionType)[]>,\n required: true,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n noRemoveValue: {\n type: Boolean,\n default: false,\n },\n positionToAnchor: {\n type: String as PropType<ElClipToAnchorPosition>,\n required: false,\n default: 'bottom',\n },\n});\n\nconst allOptions = computed<InstanceType<typeof ElDropdown>['$props']['items']>(() => {\n const options = props.options.map(o => {\n const option: InstanceType<typeof ElDropdown>['$props']['items'][number] = {\n text: o.label,\n semiboldText: 'semiboldText' in o ? o.semiboldText : undefined,\n avatar: o.imageUrl ? { avatarUrl: o.imageUrl, role: Role.Patient } : undefined,\n onClick: () => setValue(props.multiple ? _.xor(value.value, [o.value]) : o.value),\n check: props.multiple ? props.modelValue?.includes(o.value) : o.value == props.modelValue,\n };\n\n if (isAutocompleteOptionType(o) && o.prefixIcon?.name) {\n option.leadingIcon = o.prefixIcon?.name ? { name: o.prefixIcon.name, solid: o.prefixIcon.isSolid } : undefined;\n }\n\n return option;\n });\n\n if (!props.noRemoveValue && !props.multiple) {\n options.unshift({\n text: '-',\n onClick: () => setValue(undefined),\n });\n }\n\n if (props.multiple) {\n options.unshift({\n text: value.value?.length === props.options.length ? 'Deseleziona tutto' : 'Seleziona tutto',\n onClick: () => {\n if (value.value?.length === props.options.length) setValue(undefined);\n else setValue(props.options.map(opt => opt.value).slice(0));\n dropdown.value?.hide();\n },\n });\n }\n\n return options;\n});\n\nconst emit = defineEmits<{\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelValue', newValue: OptionValueType): void;\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelLabel', newValue: OptionValueType): void;\n}>();\n\nconst button = ref<HTMLElement>();\nconst dropdown = ref<InstanceType<typeof ElDropdown>>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { errorMessage, value, setValue } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue);\n emit('update:modelLabel', getLabelForOptionValue(newValue));\n});\n\nconst valueIsEmpty = computed<boolean>(() => {\n return !value.value || !getLabelForOptionValue(value.value);\n});\n\nconst getLabelForOptionValue = (value: OptionValueType): OptionValueType => {\n if (!value) return;\n if (typeof value === 'string') {\n return props.options?.find(o => o.value === value)?.label || '';\n } else {\n // return list of labels\n return value\n .map(v => {\n const option = props.options.find(o => o.value === v);\n return option ? option.label : '';\n })\n .filter(entry => !!entry);\n }\n};\n\nconst valueLabel = computed<OptionValueType>(() => {\n return getLabelForOptionValue(value.value);\n});\n\nconst valueAvatar = computed(() => {\n if (!value.value || props.multiple) return;\n if (typeof value.value === 'string') {\n return props.options?.find(o => o.value === value.value)?.imageUrl;\n }\n return '';\n});\n\nconst toggleDropdownAndGrabFocus = (toggle: () => void) => {\n toggle();\n button.value?.focus();\n};\n\nconst closeDropdownOnBlur = (e: FocusEvent, hide: () => void) => {\n // options dropdown must have an option role, so if it ain't that, close the dropdown\n if ((e.relatedTarget as HTMLElement)?.role !== 'option') {\n hide();\n }\n};\n\nconst showDropdownIfClosed = (e: Event, isOpen: boolean, show: () => void) => {\n if (!isOpen) {\n show();\n\n e.preventDefault();\n e.stopPropagation();\n }\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"label\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([props.validation])\"\n >\n <template #default=\"{ error }\">\n <ElDropdown ref=\"dropdown\" :items=\"allOptions\" :multiple=\"multiple\">\n <template #anchor=\"{ show, hide, toggle, isOpen }\">\n <button\n ref=\"button\"\n type=\"button\"\n :name=\"props.name\"\n :disabled=\"disabled\"\n class=\"el-input !pr-8 px-3\"\n :class=\"{ error, empty: valueIsEmpty, 'focus:ring-1': !error }\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-labelledby=\"listbox-label\"\n :data-cy=\"`${label.trim().replaceAll(' ', '').replaceAll('.', '')}-select`\"\n @mousedown.prevent=\"toggleDropdownAndGrabFocus(toggle)\"\n @focus.prevent=\"show\"\n @blur.prevent=\"closeDropdownOnBlur($event, hide)\"\n @keydown.enter=\"showDropdownIfClosed($event, isOpen, show)\"\n >\n <span v-if=\"placeholder && valueIsEmpty\" class=\"text-neutral-inactive truncate w-full block\">\n {{ placeholder }}\n </span>\n <span v-else class=\"flex h-full w-full items-center justify-start truncate\">\n <ElAvatar v-if=\"valueAvatar\" :picture=\"valueAvatar\" size=\"xxs\" />\n <span class=\"truncate\">{{ Array.isArray(valueLabel) ? valueLabel.join(', ') : valueLabel }}</span>\n </span>\n <span v-if=\"!error\" class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2\">\n <ElIcon\n name=\"ChevronDownIcon\"\n solid\n class=\"h-5 w-5 transition-transform duration-200\"\n :class=\"{ 'rotate-180': isOpen, 'text-neutral-inactive': valueIsEmpty, 'text-neutral-darker': !valueIsEmpty }\"\n />\n </span>\n </button>\n </template>\n </ElDropdown>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["props","__props","allOptions","computed","options","o","option","Role","setValue","_","value","_a","isAutocompleteOptionType","_b","_c","opt","dropdown","emit","__emit","button","ref","computedModelValue","computedValidation","errorMessage","useInput","newValue","getLabelForOptionValue","valueIsEmpty","v","entry","valueLabel","valueAvatar","toggleDropdownAndGrabFocus","toggle","closeDropdownOnBlur","e","hide","showDropdownIfClosed","isOpen","show"],"mappings":"+oCAcA,MAAMA,EAAQC,EAgCRC,EAAaC,EAAAA,SAA6D,IAAM,OACpF,MAAMC,EAAUJ,EAAM,QAAQ,IAASK,GAAA,WACrC,MAAMC,EAAqE,CACzE,KAAMD,EAAE,MACR,aAAc,iBAAkBA,EAAIA,EAAE,aAAe,OACrD,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Node as C,createElementVNode as M,normalizeClass as B,withModifiers as b,withKeys as K,createElementBlock as y,toDisplayString as q,createCommentVNode as D}from"vue";import{withCommonElInputProps as N,useInput as O,showRequiredMark as j}from"./input.esm.js";import{Role as G}from"../types.esm.js";import{isAutocompleteOptionType as H}from"./utils.esm.js";import J from"../ElDropdown.vue.esm2.js";import Q from"../ElAvatar.vue.esm2.js";import W from"../ElIcon.vue.esm2.js";import X from"./ElInputContainer.vue.esm2.js";import Y from"../../node_modules/lodash/lodash.esm.js";const Z=["name","disabled","data-cy","onMousedown","onFocus","onBlur","onKeydown"],ee={key:0,class:"text-neutral-inactive truncate w-full block"},te={key:1,class:"flex h-full w-full items-center justify-start truncate"},oe={class:"truncate"},le={key:2,class:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"},ce=R({__name:"ElInputSelect",props:{...N(),modelValue:{type:[Array,String],required:!1,default:void 0},placeholder:{type:String,default:"",required:!1},options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},noRemoveValue:{type:Boolean,default:!1},positionToAnchor:{type:String,required:!1,default:"bottom"}},emits:["update:modelValue","update:modelLabel"],setup(d,{emit:S}){const o=d,$=s(()=>{var l;const t=o.options.map(e=>{var r,i,u;const a={text:e.label,semiboldText:"semiboldText"in e?e.semiboldText:void 0,avatar:e.imageUrl?{avatarUrl:e.imageUrl,role:G.Patient}:void 0,onClick:()=>m(o.multiple?Y.xor(n.value,[e.value]):e.value),check:o.multiple?(r=o.modelValue)==null?void 0:r.includes(e.value):e.value==o.modelValue};return H(e)&&((i=e.prefixIcon)!=null&&i.name)&&(a.leadingIcon=(u=e.prefixIcon)!=null&&u.name?{name:e.prefixIcon.name,solid:e.prefixIcon.isSolid}:void 0),a});return!o.noRemoveValue&&!o.multiple&&t.unshift({text:"-",onClick:()=>m(void 0)}),o.multiple&&t.unshift({text:((l=n.value)==null?void 0:l.length)===o.options.length?"Deseleziona tutto":"Seleziona tutto",onClick:()=>{var e,a;((e=n.value)==null?void 0:e.length)===o.options.length?m(void 0):m(o.options.map(r=>r.value).slice(0)),(a=k.value)==null||a.hide()}}),t}),g=S,x=_(),k=_(),E=s(()=>o.modelValue),T=s(()=>[o.validation]),{errorMessage:z,value:n,setValue:m}=O(E,T,o.name,t=>{g("update:modelValue",t),g("update:modelLabel",v(t))}),c=s(()=>!n.value||!v(n.value)),v=t=>{var l,e;if(t)return typeof t=="string"?((e=(l=o.options)==null?void 0:l.find(a=>a.value===t))==null?void 0:e.label)||"":t.map(a=>{const r=o.options.find(i=>i.value===a);return r?r.label:""}).filter(a=>!!a)},h=s(()=>v(n.value)),w=s(()=>{var t,l;if(!(!n.value||o.multiple))return typeof n.value=="string"?(l=(t=o.options)==null?void 0:t.find(e=>e.value===n.value))==null?void 0:l.imageUrl:""}),F=t=>{var l;t(),(l=x.value)==null||l.focus()},L=(t,l)=>{var e;((e=t.relatedTarget)==null?void 0:e.role)!=="option"&&l()},P=(t,l,e)=>{l||(e(),t.preventDefault(),t.stopPropagation())};return(t,l)=>(p(),V(X,U(t.$attrs,{name:t.label,label:t.label,"error-message":o.errorMessage===!1?!1:o.errorMessage||I(z),"hidden-error-message":t.hiddenErrorMessage,"set-required-mark":I(j)([o.validation])}),{default:A(({error:e})=>[C(J,{ref_key:"dropdown",ref:k,items:$.value,multiple:d.multiple},{anchor:A(({show:a,hide:r,toggle:i,isOpen:u})=>[M("button",{ref_key:"button",ref:x,type:"button",name:o.name,disabled:t.disabled,class:B(["el-input !pr-8 px-3",{error:e,empty:c.value,"focus:ring-1":!e}]),"aria-haspopup":"listbox","aria-expanded":"true","aria-labelledby":"listbox-label","data-cy":`${t.label.trim().replaceAll(" ","").replaceAll(".","")}-select`,onMousedown:b(f=>F(i),["prevent"]),onFocus:b(a,["prevent"]),onBlur:b(f=>L(f,r),["prevent"]),onKeydown:K(f=>P(f,u,a),["enter"])},[d.placeholder&&c.value?(p(),y("span",ee,q(d.placeholder),1)):(p(),y("span",te,[w.value?(p(),V(Q,{key:0,picture:w.value,size:"xxs"},null,8,["picture"])):D("",!0),M("span",oe,q(Array.isArray(h.value)?h.value.join(", "):h.value),1)])),e?D("",!0):(p(),y("span",le,[C(W,{name:"ChevronDownIcon",solid:"",class:B(["h-5 w-5 transition-transform duration-200",{"rotate-180":u,"text-neutral-inactive":c.value,"text-neutral-darker":!c.value}])},null,8,["class"])]))],42,Z)]),_:2},1032,["items","multiple"])]),_:1},16,["name","label","error-message","hidden-error-message","set-required-mark"]))}});export{ce as default};
1
+ import{defineComponent as R,computed as s,ref as _,openBlock as p,createBlock as V,mergeProps as U,unref as I,withCtx as A,createVNode as C,createElementVNode as M,normalizeClass as B,withModifiers as b,withKeys as K,createElementBlock as y,toDisplayString as q,createCommentVNode as D}from"vue";import{withCommonElInputProps as N,useInput as O,showRequiredMark as j}from"./input.esm.js";import{Role as G}from"../types.esm.js";import{isAutocompleteOptionType as H}from"./utils.esm.js";import J from"../ElDropdown.vue.esm2.js";import Q from"../ElAvatar.vue.esm2.js";import W from"../ElIcon.vue.esm2.js";import X from"./ElInputContainer.vue.esm2.js";import Y from"../node_modules/lodash/lodash.esm.js";const Z=["name","disabled","data-cy","onMousedown","onFocus","onBlur","onKeydown"],ee={key:0,class:"text-neutral-inactive truncate w-full block"},te={key:1,class:"flex h-full w-full items-center justify-start truncate"},oe={class:"truncate"},le={key:2,class:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2"},ce=R({__name:"ElInputSelect",props:{...N(),modelValue:{type:[Array,String],required:!1,default:void 0},placeholder:{type:String,default:"",required:!1},options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},noRemoveValue:{type:Boolean,default:!1},positionToAnchor:{type:String,required:!1,default:"bottom"}},emits:["update:modelValue","update:modelLabel"],setup(d,{emit:S}){const o=d,$=s(()=>{var l;const t=o.options.map(e=>{var r,i,u;const a={text:e.label,semiboldText:"semiboldText"in e?e.semiboldText:void 0,avatar:e.imageUrl?{avatarUrl:e.imageUrl,role:G.Patient}:void 0,onClick:()=>m(o.multiple?Y.xor(n.value,[e.value]):e.value),check:o.multiple?(r=o.modelValue)==null?void 0:r.includes(e.value):e.value==o.modelValue};return H(e)&&((i=e.prefixIcon)!=null&&i.name)&&(a.leadingIcon=(u=e.prefixIcon)!=null&&u.name?{name:e.prefixIcon.name,solid:e.prefixIcon.isSolid}:void 0),a});return!o.noRemoveValue&&!o.multiple&&t.unshift({text:"-",onClick:()=>m(void 0)}),o.multiple&&t.unshift({text:((l=n.value)==null?void 0:l.length)===o.options.length?"Deseleziona tutto":"Seleziona tutto",onClick:()=>{var e,a;((e=n.value)==null?void 0:e.length)===o.options.length?m(void 0):m(o.options.map(r=>r.value).slice(0)),(a=k.value)==null||a.hide()}}),t}),g=S,x=_(),k=_(),E=s(()=>o.modelValue),T=s(()=>[o.validation]),{errorMessage:z,value:n,setValue:m}=O(E,T,o.name,t=>{g("update:modelValue",t),g("update:modelLabel",v(t))}),c=s(()=>!n.value||!v(n.value)),v=t=>{var l,e;if(t)return typeof t=="string"?((e=(l=o.options)==null?void 0:l.find(a=>a.value===t))==null?void 0:e.label)||"":t.map(a=>{const r=o.options.find(i=>i.value===a);return r?r.label:""}).filter(a=>!!a)},h=s(()=>v(n.value)),w=s(()=>{var t,l;if(!(!n.value||o.multiple))return typeof n.value=="string"?(l=(t=o.options)==null?void 0:t.find(e=>e.value===n.value))==null?void 0:l.imageUrl:""}),F=t=>{var l;t(),(l=x.value)==null||l.focus()},L=(t,l)=>{var e;((e=t.relatedTarget)==null?void 0:e.role)!=="option"&&l()},P=(t,l,e)=>{l||(e(),t.preventDefault(),t.stopPropagation())};return(t,l)=>(p(),V(X,U(t.$attrs,{name:t.label,label:t.label,"error-message":o.errorMessage===!1?!1:o.errorMessage||I(z),"hidden-error-message":t.hiddenErrorMessage,"set-required-mark":I(j)([o.validation])}),{default:A(({error:e})=>[C(J,{ref_key:"dropdown",ref:k,items:$.value,multiple:d.multiple},{anchor:A(({show:a,hide:r,toggle:i,isOpen:u})=>[M("button",{ref_key:"button",ref:x,type:"button",name:o.name,disabled:t.disabled,class:B(["el-input !pr-8 px-3",{error:e,empty:c.value,"focus:ring-1":!e}]),"aria-haspopup":"listbox","aria-expanded":"true","aria-labelledby":"listbox-label","data-cy":`${t.label.trim().replaceAll(" ","").replaceAll(".","")}-select`,onMousedown:b(f=>F(i),["prevent"]),onFocus:b(a,["prevent"]),onBlur:b(f=>L(f,r),["prevent"]),onKeydown:K(f=>P(f,u,a),["enter"])},[d.placeholder&&c.value?(p(),y("span",ee,q(d.placeholder),1)):(p(),y("span",te,[w.value?(p(),V(Q,{key:0,picture:w.value,size:"xxs"},null,8,["picture"])):D("",!0),M("span",oe,q(Array.isArray(h.value)?h.value.join(", "):h.value),1)])),e?D("",!0):(p(),y("span",le,[C(W,{name:"ChevronDownIcon",solid:"",class:B(["h-5 w-5 transition-transform duration-200",{"rotate-180":u,"text-neutral-inactive":c.value,"text-neutral-darker":!c.value}])},null,8,["class"])]))],42,Z)]),_:2},1032,["items","multiple"])]),_:1},16,["name","label","error-message","hidden-error-message","set-required-mark"]))}});export{ce as default};
2
2
  //# sourceMappingURL=ElInputSelect.vue.esm2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputSelect.vue.esm2.js","sources":["../../../src/forms/ElInputSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, withCommonElInputProps } from '@/forms/input';\nimport { computed, PropType, ref } from 'vue';\nimport { OptionType, Role } from '@/types';\nimport { ElClipToAnchorPosition } from '@/ElClipToAnchor.vue';\nimport { AutocompleteOptionType, isAutocompleteOptionType } from '@/forms/utils';\nimport ElDropdown from '@/ElDropdown.vue';\nimport ElAvatar from '@/ElAvatar.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport _ from 'lodash';\n\nexport type OptionValueType = string | string[] | null | undefined;\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n // TODO: it should differ between the single input select and the multiselect\n type: [Array, String] as PropType<OptionValueType>,\n required: false,\n default: undefined,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n options: {\n type: Array as PropType<(OptionType | AutocompleteOptionType)[]>,\n required: true,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n noRemoveValue: {\n type: Boolean,\n default: false,\n },\n positionToAnchor: {\n type: String as PropType<ElClipToAnchorPosition>,\n required: false,\n default: 'bottom',\n },\n});\n\nconst allOptions = computed<InstanceType<typeof ElDropdown>['$props']['items']>(() => {\n const options = props.options.map(o => {\n const option: InstanceType<typeof ElDropdown>['$props']['items'][number] = {\n text: o.label,\n semiboldText: 'semiboldText' in o ? o.semiboldText : undefined,\n avatar: o.imageUrl ? { avatarUrl: o.imageUrl, role: Role.Patient } : undefined,\n onClick: () => setValue(props.multiple ? _.xor(value.value, [o.value]) : o.value),\n check: props.multiple ? props.modelValue?.includes(o.value) : o.value == props.modelValue,\n };\n\n if (isAutocompleteOptionType(o) && o.prefixIcon?.name) {\n option.leadingIcon = o.prefixIcon?.name ? { name: o.prefixIcon.name, solid: o.prefixIcon.isSolid } : undefined;\n }\n\n return option;\n });\n\n if (!props.noRemoveValue && !props.multiple) {\n options.unshift({\n text: '-',\n onClick: () => setValue(undefined),\n });\n }\n\n if (props.multiple) {\n options.unshift({\n text: value.value?.length === props.options.length ? 'Deseleziona tutto' : 'Seleziona tutto',\n onClick: () => {\n if (value.value?.length === props.options.length) setValue(undefined);\n else setValue(props.options.map(opt => opt.value).slice(0));\n dropdown.value?.hide();\n },\n });\n }\n\n return options;\n});\n\nconst emit = defineEmits<{\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelValue', newValue: OptionValueType): void;\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelLabel', newValue: OptionValueType): void;\n}>();\n\nconst button = ref<HTMLElement>();\nconst dropdown = ref<InstanceType<typeof ElDropdown>>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { errorMessage, value, setValue } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue);\n emit('update:modelLabel', getLabelForOptionValue(newValue));\n});\n\nconst valueIsEmpty = computed<boolean>(() => {\n return !value.value || !getLabelForOptionValue(value.value);\n});\n\nconst getLabelForOptionValue = (value: OptionValueType): OptionValueType => {\n if (!value) return;\n if (typeof value === 'string') {\n return props.options?.find(o => o.value === value)?.label || '';\n } else {\n // return list of labels\n return value\n .map(v => {\n const option = props.options.find(o => o.value === v);\n return option ? option.label : '';\n })\n .filter(entry => !!entry);\n }\n};\n\nconst valueLabel = computed<OptionValueType>(() => {\n return getLabelForOptionValue(value.value);\n});\n\nconst valueAvatar = computed(() => {\n if (!value.value || props.multiple) return;\n if (typeof value.value === 'string') {\n return props.options?.find(o => o.value === value.value)?.imageUrl;\n }\n return '';\n});\n\nconst toggleDropdownAndGrabFocus = (toggle: () => void) => {\n toggle();\n button.value?.focus();\n};\n\nconst closeDropdownOnBlur = (e: FocusEvent, hide: () => void) => {\n // options dropdown must have an option role, so if it ain't that, close the dropdown\n if ((e.relatedTarget as HTMLElement)?.role !== 'option') {\n hide();\n }\n};\n\nconst showDropdownIfClosed = (e: Event, isOpen: boolean, show: () => void) => {\n if (!isOpen) {\n show();\n\n e.preventDefault();\n e.stopPropagation();\n }\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"label\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([props.validation])\"\n >\n <template #default=\"{ error }\">\n <ElDropdown ref=\"dropdown\" :items=\"allOptions\" :multiple=\"multiple\">\n <template #anchor=\"{ show, hide, toggle, isOpen }\">\n <button\n ref=\"button\"\n type=\"button\"\n :name=\"props.name\"\n :disabled=\"disabled\"\n class=\"el-input !pr-8 px-3\"\n :class=\"{ error, empty: valueIsEmpty, 'focus:ring-1': !error }\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-labelledby=\"listbox-label\"\n :data-cy=\"`${label.trim().replaceAll(' ', '').replaceAll('.', '')}-select`\"\n @mousedown.prevent=\"toggleDropdownAndGrabFocus(toggle)\"\n @focus.prevent=\"show\"\n @blur.prevent=\"closeDropdownOnBlur($event, hide)\"\n @keydown.enter=\"showDropdownIfClosed($event, isOpen, show)\"\n >\n <span v-if=\"placeholder && valueIsEmpty\" class=\"text-neutral-inactive truncate w-full block\">\n {{ placeholder }}\n </span>\n <span v-else class=\"flex h-full w-full items-center justify-start truncate\">\n <ElAvatar v-if=\"valueAvatar\" :picture=\"valueAvatar\" size=\"xxs\" />\n <span class=\"truncate\">{{ Array.isArray(valueLabel) ? valueLabel.join(', ') : valueLabel }}</span>\n </span>\n <span v-if=\"!error\" class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2\">\n <ElIcon\n name=\"ChevronDownIcon\"\n solid\n class=\"h-5 w-5 transition-transform duration-200\"\n :class=\"{ 'rotate-180': isOpen, 'text-neutral-inactive': valueIsEmpty, 'text-neutral-darker': !valueIsEmpty }\"\n />\n </span>\n </button>\n </template>\n </ElDropdown>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["props","__props","allOptions","computed","options","o","option","Role","setValue","_","value","_a","isAutocompleteOptionType","_b","_c","opt","dropdown","emit","__emit","button","ref","computedModelValue","computedValidation","errorMessage","useInput","newValue","getLabelForOptionValue","valueIsEmpty","v","entry","valueLabel","valueAvatar","toggleDropdownAndGrabFocus","toggle","closeDropdownOnBlur","e","hide","showDropdownIfClosed","isOpen","show"],"mappings":"64CAcA,MAAMA,EAAQC,EAgCRC,EAAaC,EAA6D,IAAM,OACpF,MAAMC,EAAUJ,EAAM,QAAQ,IAASK,GAAA,WACrC,MAAMC,EAAqE,CACzE,KAAMD,EAAE,MACR,aAAc,iBAAkBA,EAAIA,EAAE,aAAe,OACrD,OAAQA,EAAE,SAAW,CAAE,UAAWA,EAAE,SAAU,KAAME,EAAK,O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A,CAC3D,EAEKE,EAAexB,EAAkB,IAC9B,CAACO,EAAM,OAAS,CAACgB,EAAuBhB,EAAM,KAAK,CAC3D,EAEKgB,EAA0BhB,GAA4C,SAC1E,GAAKA,EACD,OAAA,OAAOA,GAAU,WACZG,GAAAF,EAAAX,EAAM,UAAN,YAAAW,EAAe,KAAKN,GAAKA,EAAE,QAAUK,KAArC,YAAAG,EAA6C,QAAS,GAGtDH,EACJ,IAASkB,GAAA,CACR,MAAMtB,EAASN,EAAM,QAAQ,KAAUK,GAAAA,EAAE,QAAUuB,CAAC,EAC7C,OAAAtB,EAASA,EAAO,MAAQ,EAChC,CAAA,EACA,OAAgBuB,GAAA,CAAC,CAACA,CAAK,CAC5B,EAGIC,EAAa3B,EAA0B,IACpCuB,EAAuBhB,EAAM,KAAK,CAC1C,EAEKqB,EAAc5B,EAAS,IAAM,SAC7B,GAAA,GAACO,EAAM,OAASV,EAAM,UACtB,OAAA,OAAOU,EAAM,OAAU,UAClBG,GAAAF,EAAAX,EAAM,UAAN,YAAAW,EAAe,KAAKN,GAAKA,EAAE,QAAUK,EAAM,SAA3C,YAAAG,EAAmD,SAErD,EAAA,CACR,EAEKmB,EAA8BC,GAAuB,OAClDA,KACPtB,EAAAQ,EAAO,QAAP,MAAAR,EAAc,OAAM,EAGhBuB,EAAsB,CAACC,EAAeC,IAAqB,SAE1DzB,EAAAwB,EAAE,gBAAF,YAAAxB,EAAiC,QAAS,UACxCyB,GACP,EAGIC,EAAuB,CAACF,EAAUG,EAAiBC,IAAqB,CACvED,IACEC,IAELJ,EAAE,eAAe,EACjBA,EAAE,gBAAgB,EACpB"}
1
+ {"version":3,"file":"ElInputSelect.vue.esm2.js","sources":["../../src/forms/ElInputSelect.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, withCommonElInputProps } from '@/forms/input';\nimport { computed, PropType, ref } from 'vue';\nimport { OptionType, Role } from '@/types';\nimport { ElClipToAnchorPosition } from '@/ElClipToAnchor.vue';\nimport { AutocompleteOptionType, isAutocompleteOptionType } from '@/forms/utils';\nimport ElDropdown from '@/ElDropdown.vue';\nimport ElAvatar from '@/ElAvatar.vue';\nimport ElIcon from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport _ from 'lodash';\n\nexport type OptionValueType = string | string[] | null | undefined;\n\nconst props = defineProps({\n ...withCommonElInputProps(),\n modelValue: {\n // TODO: it should differ between the single input select and the multiselect\n type: [Array, String] as PropType<OptionValueType>,\n required: false,\n default: undefined,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n options: {\n type: Array as PropType<(OptionType | AutocompleteOptionType)[]>,\n required: true,\n },\n multiple: {\n type: Boolean,\n default: false,\n },\n noRemoveValue: {\n type: Boolean,\n default: false,\n },\n positionToAnchor: {\n type: String as PropType<ElClipToAnchorPosition>,\n required: false,\n default: 'bottom',\n },\n});\n\nconst allOptions = computed<InstanceType<typeof ElDropdown>['$props']['items']>(() => {\n const options = props.options.map(o => {\n const option: InstanceType<typeof ElDropdown>['$props']['items'][number] = {\n text: o.label,\n semiboldText: 'semiboldText' in o ? o.semiboldText : undefined,\n avatar: o.imageUrl ? { avatarUrl: o.imageUrl, role: Role.Patient } : undefined,\n onClick: () => setValue(props.multiple ? _.xor(value.value, [o.value]) : o.value),\n check: props.multiple ? props.modelValue?.includes(o.value) : o.value == props.modelValue,\n };\n\n if (isAutocompleteOptionType(o) && o.prefixIcon?.name) {\n option.leadingIcon = o.prefixIcon?.name ? { name: o.prefixIcon.name, solid: o.prefixIcon.isSolid } : undefined;\n }\n\n return option;\n });\n\n if (!props.noRemoveValue && !props.multiple) {\n options.unshift({\n text: '-',\n onClick: () => setValue(undefined),\n });\n }\n\n if (props.multiple) {\n options.unshift({\n text: value.value?.length === props.options.length ? 'Deseleziona tutto' : 'Seleziona tutto',\n onClick: () => {\n if (value.value?.length === props.options.length) setValue(undefined);\n else setValue(props.options.map(opt => opt.value).slice(0));\n dropdown.value?.hide();\n },\n });\n }\n\n return options;\n});\n\nconst emit = defineEmits<{\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelValue', newValue: OptionValueType): void;\n // eslint-disable-next-line no-unused-vars\n (event: 'update:modelLabel', newValue: OptionValueType): void;\n}>();\n\nconst button = ref<HTMLElement>();\nconst dropdown = ref<InstanceType<typeof ElDropdown>>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { errorMessage, value, setValue } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue);\n emit('update:modelLabel', getLabelForOptionValue(newValue));\n});\n\nconst valueIsEmpty = computed<boolean>(() => {\n return !value.value || !getLabelForOptionValue(value.value);\n});\n\nconst getLabelForOptionValue = (value: OptionValueType): OptionValueType => {\n if (!value) return;\n if (typeof value === 'string') {\n return props.options?.find(o => o.value === value)?.label || '';\n } else {\n // return list of labels\n return value\n .map(v => {\n const option = props.options.find(o => o.value === v);\n return option ? option.label : '';\n })\n .filter(entry => !!entry);\n }\n};\n\nconst valueLabel = computed<OptionValueType>(() => {\n return getLabelForOptionValue(value.value);\n});\n\nconst valueAvatar = computed(() => {\n if (!value.value || props.multiple) return;\n if (typeof value.value === 'string') {\n return props.options?.find(o => o.value === value.value)?.imageUrl;\n }\n return '';\n});\n\nconst toggleDropdownAndGrabFocus = (toggle: () => void) => {\n toggle();\n button.value?.focus();\n};\n\nconst closeDropdownOnBlur = (e: FocusEvent, hide: () => void) => {\n // options dropdown must have an option role, so if it ain't that, close the dropdown\n if ((e.relatedTarget as HTMLElement)?.role !== 'option') {\n hide();\n }\n};\n\nconst showDropdownIfClosed = (e: Event, isOpen: boolean, show: () => void) => {\n if (!isOpen) {\n show();\n\n e.preventDefault();\n e.stopPropagation();\n }\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"label\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([props.validation])\"\n >\n <template #default=\"{ error }\">\n <ElDropdown ref=\"dropdown\" :items=\"allOptions\" :multiple=\"multiple\">\n <template #anchor=\"{ show, hide, toggle, isOpen }\">\n <button\n ref=\"button\"\n type=\"button\"\n :name=\"props.name\"\n :disabled=\"disabled\"\n class=\"el-input !pr-8 px-3\"\n :class=\"{ error, empty: valueIsEmpty, 'focus:ring-1': !error }\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"true\"\n aria-labelledby=\"listbox-label\"\n :data-cy=\"`${label.trim().replaceAll(' ', '').replaceAll('.', '')}-select`\"\n @mousedown.prevent=\"toggleDropdownAndGrabFocus(toggle)\"\n @focus.prevent=\"show\"\n @blur.prevent=\"closeDropdownOnBlur($event, hide)\"\n @keydown.enter=\"showDropdownIfClosed($event, isOpen, show)\"\n >\n <span v-if=\"placeholder && valueIsEmpty\" class=\"text-neutral-inactive truncate w-full block\">\n {{ placeholder }}\n </span>\n <span v-else class=\"flex h-full w-full items-center justify-start truncate\">\n <ElAvatar v-if=\"valueAvatar\" :picture=\"valueAvatar\" size=\"xxs\" />\n <span class=\"truncate\">{{ Array.isArray(valueLabel) ? valueLabel.join(', ') : valueLabel }}</span>\n </span>\n <span v-if=\"!error\" class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2\">\n <ElIcon\n name=\"ChevronDownIcon\"\n solid\n class=\"h-5 w-5 transition-transform duration-200\"\n :class=\"{ 'rotate-180': isOpen, 'text-neutral-inactive': valueIsEmpty, 'text-neutral-darker': !valueIsEmpty }\"\n />\n </span>\n </button>\n </template>\n </ElDropdown>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["props","__props","allOptions","computed","options","o","option","Role","setValue","_","value","_a","isAutocompleteOptionType","_b","_c","opt","dropdown","emit","__emit","button","ref","computedModelValue","computedValidation","errorMessage","useInput","newValue","getLabelForOptionValue","valueIsEmpty","v","entry","valueLabel","valueAvatar","toggleDropdownAndGrabFocus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BC,IAAqB,CACvED,IACEC,IAELJ,EAAE,eAAe,EACjBA,EAAE,gBAAgB,EACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputSwitch.vue.cjs2.js","sources":["../../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button class=\"flex items-center justify-center gap-2 cursor-pointer\" @click=\"toggleSwitch\">\n <div\n class=\"flex items-center shrink-0\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'order-1': align === 'left',\n 'order-2': align === 'right',\n }\"\n >\n <div\n class=\"relative w-full rounded-full duration-200\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'bg-neutral-300': !modelValue,\n 'bg-primary-active': color === 'primary' && modelValue,\n 'bg-secondary-active': color === 'secondary' && modelValue,\n }\"\n >\n <div\n class=\"absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow\"\n :class=\"{\n 'w-[1.125rem] h-[1.125rem]': size === 'xs',\n 'w-3 h-3': size === 'xxs',\n 'left-[0.125rem]': !modelValue,\n 'left-4': size === 'xs' && modelValue,\n 'left-3': size === 'xxs' && modelValue,\n }\"\n ></div>\n </div>\n </div>\n\n <label\n v-if=\"label\"\n :for=\"uuid\"\n class=\"text-neutral-darker cursor-pointer\"\n :class=\"{\n 'text-base': size === 'xs',\n 'text-sm': size === 'xxs',\n 'order-2': align === 'left',\n 'order-1': align === 'right',\n }\"\n >\n {{ label }}\n </label>\n </button>\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elSwitchSizes","elSwitchColors","elSwitchAligns","props","__props","emit","__emit","modelValue","toRefs","uuid","UniqueID","value","ref","watch","toggleSwitch"],"mappings":"kPACaA,EAAgB,CAAC,KAAM,KAAK,EAG5BC,EAAiB,CAAC,UAAW,WAAW,EAGxCC,EAAiB,CAAC,OAAQ,OAAO,4MAS9C,MAAMC,EAAQC,EAeRC,EAAOC,EAIP,CAAE,WAAAC,CAAA,EAAeC,EAAA,OAAOL,CAAK,EAC7BM,EAAOC,EAAAA,WAAW,QAClBC,EAAQC,EAAAA,IAAaL,EAAW,KAAK,EAE3CM,EAAA,MAAMN,EAAY,IAAM,CACtBI,EAAM,MAAQJ,EAAW,MACpBF,EAAA,oBAAqBM,EAAM,KAAK,CAAA,CACtC,EAED,MAAMG,EAAe,IAAM,CACnBH,EAAA,MAAQ,CAACA,EAAM,MAChBN,EAAA,oBAAqBM,EAAM,KAAK,CAAA"}
1
+ {"version":3,"file":"ElInputSwitch.vue.cjs2.js","sources":["../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button class=\"flex items-center justify-center gap-2 cursor-pointer\" @click=\"toggleSwitch\">\n <div\n class=\"flex items-center shrink-0\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'order-1': align === 'left',\n 'order-2': align === 'right',\n }\"\n >\n <div\n class=\"relative w-full rounded-full duration-200\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'bg-neutral-300': !modelValue,\n 'bg-primary-active': color === 'primary' && modelValue,\n 'bg-secondary-active': color === 'secondary' && modelValue,\n }\"\n >\n <div\n class=\"absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow\"\n :class=\"{\n 'w-[1.125rem] h-[1.125rem]': size === 'xs',\n 'w-3 h-3': size === 'xxs',\n 'left-[0.125rem]': !modelValue,\n 'left-4': size === 'xs' && modelValue,\n 'left-3': size === 'xxs' && modelValue,\n }\"\n ></div>\n </div>\n </div>\n\n <label\n v-if=\"label\"\n :for=\"uuid\"\n class=\"text-neutral-darker cursor-pointer\"\n :class=\"{\n 'text-base': size === 'xs',\n 'text-sm': size === 'xxs',\n 'order-2': align === 'left',\n 'order-1': align === 'right',\n }\"\n >\n {{ label }}\n </label>\n </button>\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elSwitchSizes","elSwitchColors","elSwitchAligns","props","__props","emit","__emit","modelValue","toRefs","uuid","UniqueID","value","ref","watch","toggleSwitch"],"mappings":"kPACaA,EAAgB,CAAC,KAAM,KAAK,EAG5BC,EAAiB,CAAC,UAAW,WAAW,EAGxCC,EAAiB,CAAC,OAAQ,OAAO,4MAS9C,MAAMC,EAAQC,EAeRC,EAAOC,EAIP,CAAE,WAAAC,CAAA,EAAeC,EAAA,OAAOL,CAAK,EAC7BM,EAAOC,EAAAA,WAAW,QAClBC,EAAQC,EAAAA,IAAaL,EAAW,KAAK,EAE3CM,EAAA,MAAMN,EAAY,IAAM,CACtBI,EAAM,MAAQJ,EAAW,MACpBF,EAAA,oBAAqBM,EAAM,KAAK,CAAA,CACtC,EAED,MAAMG,EAAe,IAAM,CACnBH,EAAA,MAAQ,CAACA,EAAM,MAChBN,EAAA,oBAAqBM,EAAM,KAAK,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputSwitch.vue.esm2.js","sources":["../../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button class=\"flex items-center justify-center gap-2 cursor-pointer\" @click=\"toggleSwitch\">\n <div\n class=\"flex items-center shrink-0\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'order-1': align === 'left',\n 'order-2': align === 'right',\n }\"\n >\n <div\n class=\"relative w-full rounded-full duration-200\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'bg-neutral-300': !modelValue,\n 'bg-primary-active': color === 'primary' && modelValue,\n 'bg-secondary-active': color === 'secondary' && modelValue,\n }\"\n >\n <div\n class=\"absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow\"\n :class=\"{\n 'w-[1.125rem] h-[1.125rem]': size === 'xs',\n 'w-3 h-3': size === 'xxs',\n 'left-[0.125rem]': !modelValue,\n 'left-4': size === 'xs' && modelValue,\n 'left-3': size === 'xxs' && modelValue,\n }\"\n ></div>\n </div>\n </div>\n\n <label\n v-if=\"label\"\n :for=\"uuid\"\n class=\"text-neutral-darker cursor-pointer\"\n :class=\"{\n 'text-base': size === 'xs',\n 'text-sm': size === 'xxs',\n 'order-2': align === 'left',\n 'order-1': align === 'right',\n }\"\n >\n {{ label }}\n </label>\n </button>\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elSwitchSizes","elSwitchColors","elSwitchAligns","props","__props","emit","__emit","modelValue","toRefs","uuid","UniqueID","value","ref","watch","toggleSwitch"],"mappings":"oYACaA,EAAgB,CAAC,KAAM,KAAK,EAG5BC,EAAiB,CAAC,UAAW,WAAW,EAGxCC,EAAiB,CAAC,OAAQ,OAAO,4LAS9C,MAAMC,EAAQC,EAeRC,EAAOC,EAIP,CAAE,WAAAC,CAAA,EAAeC,EAAOL,CAAK,EAC7BM,EAAOC,IAAW,QAClBC,EAAQC,EAAaL,EAAW,KAAK,EAE3CM,EAAMN,EAAY,IAAM,CACtBI,EAAM,MAAQJ,EAAW,MACpBF,EAAA,oBAAqBM,EAAM,KAAK,CAAA,CACtC,EAED,MAAMG,EAAe,IAAM,CACnBH,EAAA,MAAQ,CAACA,EAAM,MAChBN,EAAA,oBAAqBM,EAAM,KAAK,CAAA"}
1
+ {"version":3,"file":"ElInputSwitch.vue.esm2.js","sources":["../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button class=\"flex items-center justify-center gap-2 cursor-pointer\" @click=\"toggleSwitch\">\n <div\n class=\"flex items-center shrink-0\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'order-1': align === 'left',\n 'order-2': align === 'right',\n }\"\n >\n <div\n class=\"relative w-full rounded-full duration-200\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'bg-neutral-300': !modelValue,\n 'bg-primary-active': color === 'primary' && modelValue,\n 'bg-secondary-active': color === 'secondary' && modelValue,\n }\"\n >\n <div\n class=\"absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow\"\n :class=\"{\n 'w-[1.125rem] h-[1.125rem]': size === 'xs',\n 'w-3 h-3': size === 'xxs',\n 'left-[0.125rem]': !modelValue,\n 'left-4': size === 'xs' && modelValue,\n 'left-3': size === 'xxs' && modelValue,\n }\"\n ></div>\n </div>\n </div>\n\n <label\n v-if=\"label\"\n :for=\"uuid\"\n class=\"text-neutral-darker cursor-pointer\"\n :class=\"{\n 'text-base': size === 'xs',\n 'text-sm': size === 'xxs',\n 'order-2': align === 'left',\n 'order-1': align === 'right',\n }\"\n >\n {{ label }}\n </label>\n </button>\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elSwitchSizes","elSwitchColors","elSwitchAligns","props","__props","emit","__emit","modelValue","toRefs","uuid","UniqueID","value","ref","watch","toggleSwitch"],"mappings":"oYACaA,EAAgB,CAAC,KAAM,KAAK,EAG5BC,EAAiB,CAAC,UAAW,WAAW,EAGxCC,EAAiB,CAAC,OAAQ,OAAO,4LAS9C,MAAMC,EAAQC,EAeRC,EAAOC,EAIP,CAAE,WAAAC,CAAA,EAAeC,EAAOL,CAAK,EAC7BM,EAAOC,IAAW,QAClBC,EAAQC,EAAaL,EAAW,KAAK,EAE3CM,EAAMN,EAAY,IAAM,CACtBI,EAAM,MAAQJ,EAAW,MACpBF,EAAA,oBAAqBM,EAAM,KAAK,CAAA,CACtC,EAED,MAAMG,EAAe,IAAM,CACnBH,EAAA,MAAQ,CAACA,EAAM,MAChBN,EAAA,oBAAqBM,EAAM,KAAK,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputText.vue.cjs2.js","sources":["../../../src/forms/ElInputText.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInputTextTypes = ['text', 'password'] as const;\nexport type ElInputTextType = (typeof elInputTextTypes)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, TextualValueType, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, PropType, ref } from 'vue';\nimport ElIcon, { ElIconProps } from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElIconButton from '@/ElIconButton.vue';\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n type: {\n type: String as PropType<ElInputTextType>,\n default: 'text',\n },\n leadingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n trailingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n autocomplete: {\n type: String,\n default: 'off',\n },\n});\n\nconst inputType = ref<ElInputTextType>(props.type);\nconst inputRef = ref<HTMLInputElement | null>(null);\n\nonMounted(() => {\n if (props.focusOnMount) {\n inputRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue?.trim());\n});\n\nconst defaultId = computed(() => (props.label ? props.label.trim().replaceAll(' ', '') : props.type));\n\nconst handleEyesPasswordClick = () => {\n inputType.value = inputType.value === 'text' ? 'password' : 'text';\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"id || `${uuid}-${defaultId}`\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n class=\"relative\"\n >\n <template #leading=\"{ error }\">\n <div class=\"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\">\n <div v-if=\"leadingIcon\">\n <ElIcon\n :name=\"leadingIcon.name\"\n :solid=\"leadingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </div>\n </div>\n\n <slot name=\"leading\" v-bind=\"{ error }\" />\n\n <input\n :id=\"id || `${uuid}-${defaultId}`\"\n ref=\"inputRef\"\n v-model=\"value\"\n :name=\"props.name || id || `${uuid}-${defaultId}`\"\n :type=\"inputType\"\n class=\"el-input\"\n :class=\"{\n error,\n '!pl-10': leadingIcon?.name,\n '!pl-3': !leadingIcon?.name,\n '!pr-10': trailingIcon?.name,\n }\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :autocomplete=\"autocomplete\"\n :data-cy=\"`${defaultId}-input`\"\n @blur=\"fieldContext.validate()\"\n />\n </template>\n\n <template #trailing=\"{ error }\">\n <span v-if=\"trailingIcon\">\n <ElIcon\n :name=\"trailingIcon.name\"\n :solid=\"trailingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </span>\n\n <span v-if=\"type === 'password'\">\n <ElIconButton\n :error=\"error\"\n :icon=\"{\n name: inputType === 'text' ? 'EyeSlashIcon' : 'EyeIcon',\n }\"\n type=\"button\"\n :tooltip=\"inputType === 'text' ? 'Nascondi' : 'Mostra'\"\n @click=\"handleEyesPasswordClick\"\n />\n </span>\n\n <slot name=\"trailing\" v-bind=\"{ error }\" />\n </template>\n </ElInputContainer>\n</template>\n"],"names":["elInputTextTypes","props","__props","inputType","ref","inputRef","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","defaultId","handleEyesPasswordClick"],"mappings":"+cACaA,EAAmB,CAAC,OAAQ,UAAU,8VAWnD,MAAMC,EAAQC,EA0BRC,EAAYC,EAAAA,IAAqBH,EAAM,IAAI,EAC3CI,EAAWD,MAA6B,IAAI,EAElDE,EAAAA,UAAU,IAAM,OACVL,EAAM,gBACRM,EAAAF,EAAS,QAAT,MAAAE,EAAgB,QAClB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAA,SAAS,IAAMV,EAAM,UAAU,EACpDW,EAAqBD,EAAAA,SAAS,IAAM,CAACV,EAAM,UAAU,CAAC,EAEtD,CAAE,MAAAY,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,WAASP,EAAoBE,EAAoBX,EAAM,KAAkBiB,GAAA,CACtHV,EAAA,oBAAqBU,GAAA,YAAAA,EAAU,MAAM,CAAA,CAC3C,EAEKC,EAAYR,EAAAA,SAAS,IAAOV,EAAM,MAAQA,EAAM,MAAM,KAAK,EAAE,WAAW,IAAK,EAAE,EAAIA,EAAM,IAAK,EAE9FmB,EAA0B,IAAM,CACpCjB,EAAU,MAAQA,EAAU,QAAU,OAAS,WAAa,MAAA"}
1
+ {"version":3,"file":"ElInputText.vue.cjs2.js","sources":["../../src/forms/ElInputText.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInputTextTypes = ['text', 'password'] as const;\nexport type ElInputTextType = (typeof elInputTextTypes)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, TextualValueType, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, PropType, ref } from 'vue';\nimport ElIcon, { ElIconProps } from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElIconButton from '@/ElIconButton.vue';\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n type: {\n type: String as PropType<ElInputTextType>,\n default: 'text',\n },\n leadingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n trailingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n autocomplete: {\n type: String,\n default: 'off',\n },\n});\n\nconst inputType = ref<ElInputTextType>(props.type);\nconst inputRef = ref<HTMLInputElement | null>(null);\n\nonMounted(() => {\n if (props.focusOnMount) {\n inputRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue?.trim());\n});\n\nconst defaultId = computed(() => (props.label ? props.label.trim().replaceAll(' ', '') : props.type));\n\nconst handleEyesPasswordClick = () => {\n inputType.value = inputType.value === 'text' ? 'password' : 'text';\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"id || `${uuid}-${defaultId}`\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n class=\"relative\"\n >\n <template #leading=\"{ error }\">\n <div class=\"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\">\n <div v-if=\"leadingIcon\">\n <ElIcon\n :name=\"leadingIcon.name\"\n :solid=\"leadingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </div>\n </div>\n\n <slot name=\"leading\" v-bind=\"{ error }\" />\n\n <input\n :id=\"id || `${uuid}-${defaultId}`\"\n ref=\"inputRef\"\n v-model=\"value\"\n :name=\"props.name || id || `${uuid}-${defaultId}`\"\n :type=\"inputType\"\n class=\"el-input\"\n :class=\"{\n error,\n '!pl-10': leadingIcon?.name,\n '!pl-3': !leadingIcon?.name,\n '!pr-10': trailingIcon?.name,\n }\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :autocomplete=\"autocomplete\"\n :data-cy=\"`${defaultId}-input`\"\n @blur=\"fieldContext.validate()\"\n />\n </template>\n\n <template #trailing=\"{ error }\">\n <span v-if=\"trailingIcon\">\n <ElIcon\n :name=\"trailingIcon.name\"\n :solid=\"trailingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </span>\n\n <span v-if=\"type === 'password'\">\n <ElIconButton\n :error=\"error\"\n :icon=\"{\n name: inputType === 'text' ? 'EyeSlashIcon' : 'EyeIcon',\n }\"\n type=\"button\"\n :tooltip=\"inputType === 'text' ? 'Nascondi' : 'Mostra'\"\n @click=\"handleEyesPasswordClick\"\n />\n </span>\n\n <slot name=\"trailing\" v-bind=\"{ error }\" />\n </template>\n </ElInputContainer>\n</template>\n"],"names":["elInputTextTypes","props","__props","inputType","ref","inputRef","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","defaultId","handleEyesPasswordClick"],"mappings":"+cACaA,EAAmB,CAAC,OAAQ,UAAU,8VAWnD,MAAMC,EAAQC,EA0BRC,EAAYC,EAAAA,IAAqBH,EAAM,IAAI,EAC3CI,EAAWD,MAA6B,IAAI,EAElDE,EAAAA,UAAU,IAAM,OACVL,EAAM,gBACRM,EAAAF,EAAS,QAAT,MAAAE,EAAgB,QAClB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAA,SAAS,IAAMV,EAAM,UAAU,EACpDW,EAAqBD,EAAAA,SAAS,IAAM,CAACV,EAAM,UAAU,CAAC,EAEtD,CAAE,MAAAY,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,WAASP,EAAoBE,EAAoBX,EAAM,KAAkBiB,GAAA,CACtHV,EAAA,oBAAqBU,GAAA,YAAAA,EAAU,MAAM,CAAA,CAC3C,EAEKC,EAAYR,EAAAA,SAAS,IAAOV,EAAM,MAAQA,EAAM,MAAM,KAAK,EAAE,WAAW,IAAK,EAAE,EAAIA,EAAM,IAAK,EAE9FmB,EAA0B,IAAM,CACpCjB,EAAU,MAAQA,EAAU,QAAU,OAAS,WAAa,MAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputText.vue.esm2.js","sources":["../../../src/forms/ElInputText.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInputTextTypes = ['text', 'password'] as const;\nexport type ElInputTextType = (typeof elInputTextTypes)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, TextualValueType, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, PropType, ref } from 'vue';\nimport ElIcon, { ElIconProps } from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElIconButton from '@/ElIconButton.vue';\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n type: {\n type: String as PropType<ElInputTextType>,\n default: 'text',\n },\n leadingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n trailingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n autocomplete: {\n type: String,\n default: 'off',\n },\n});\n\nconst inputType = ref<ElInputTextType>(props.type);\nconst inputRef = ref<HTMLInputElement | null>(null);\n\nonMounted(() => {\n if (props.focusOnMount) {\n inputRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue?.trim());\n});\n\nconst defaultId = computed(() => (props.label ? props.label.trim().replaceAll(' ', '') : props.type));\n\nconst handleEyesPasswordClick = () => {\n inputType.value = inputType.value === 'text' ? 'password' : 'text';\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"id || `${uuid}-${defaultId}`\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n class=\"relative\"\n >\n <template #leading=\"{ error }\">\n <div class=\"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\">\n <div v-if=\"leadingIcon\">\n <ElIcon\n :name=\"leadingIcon.name\"\n :solid=\"leadingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </div>\n </div>\n\n <slot name=\"leading\" v-bind=\"{ error }\" />\n\n <input\n :id=\"id || `${uuid}-${defaultId}`\"\n ref=\"inputRef\"\n v-model=\"value\"\n :name=\"props.name || id || `${uuid}-${defaultId}`\"\n :type=\"inputType\"\n class=\"el-input\"\n :class=\"{\n error,\n '!pl-10': leadingIcon?.name,\n '!pl-3': !leadingIcon?.name,\n '!pr-10': trailingIcon?.name,\n }\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :autocomplete=\"autocomplete\"\n :data-cy=\"`${defaultId}-input`\"\n @blur=\"fieldContext.validate()\"\n />\n </template>\n\n <template #trailing=\"{ error }\">\n <span v-if=\"trailingIcon\">\n <ElIcon\n :name=\"trailingIcon.name\"\n :solid=\"trailingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </span>\n\n <span v-if=\"type === 'password'\">\n <ElIconButton\n :error=\"error\"\n :icon=\"{\n name: inputType === 'text' ? 'EyeSlashIcon' : 'EyeIcon',\n }\"\n type=\"button\"\n :tooltip=\"inputType === 'text' ? 'Nascondi' : 'Mostra'\"\n @click=\"handleEyesPasswordClick\"\n />\n </span>\n\n <slot name=\"trailing\" v-bind=\"{ error }\" />\n </template>\n </ElInputContainer>\n</template>\n"],"names":["elInputTextTypes","props","__props","inputType","ref","inputRef","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","defaultId","handleEyesPasswordClick"],"mappings":"wwBACaA,GAAmB,CAAC,OAAQ,UAAU,uTAWnD,MAAMC,EAAQC,EA0BRC,EAAYC,EAAqBH,EAAM,IAAI,EAC3CI,EAAWD,EAA6B,IAAI,EAElDE,EAAU,IAAM,OACVL,EAAM,gBACRM,EAAAF,EAAS,QAAT,MAAAE,EAAgB,QAClB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAS,IAAMV,EAAM,UAAU,EACpDW,EAAqBD,EAAS,IAAM,CAACV,EAAM,UAAU,CAAC,EAEtD,CAAE,MAAAY,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,EAASP,EAAoBE,EAAoBX,EAAM,KAAkBiB,GAAA,CACtHV,EAAA,oBAAqBU,GAAA,YAAAA,EAAU,MAAM,CAAA,CAC3C,EAEKC,EAAYR,EAAS,IAAOV,EAAM,MAAQA,EAAM,MAAM,KAAK,EAAE,WAAW,IAAK,EAAE,EAAIA,EAAM,IAAK,EAE9FmB,EAA0B,IAAM,CACpCjB,EAAU,MAAQA,EAAU,QAAU,OAAS,WAAa,MAAA"}
1
+ {"version":3,"file":"ElInputText.vue.esm2.js","sources":["../../src/forms/ElInputText.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elInputTextTypes = ['text', 'password'] as const;\nexport type ElInputTextType = (typeof elInputTextTypes)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { useInput, showRequiredMark, TextualValueType, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, PropType, ref } from 'vue';\nimport ElIcon, { ElIconProps } from '@/ElIcon.vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport ElIconButton from '@/ElIconButton.vue';\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n type: {\n type: String as PropType<ElInputTextType>,\n default: 'text',\n },\n leadingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n trailingIcon: {\n type: Object as PropType<ElIconProps>,\n default: undefined,\n required: false,\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n autocomplete: {\n type: String,\n default: 'off',\n },\n});\n\nconst inputType = ref<ElInputTextType>(props.type);\nconst inputRef = ref<HTMLInputElement | null>(null);\n\nonMounted(() => {\n if (props.focusOnMount) {\n inputRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue => {\n emit('update:modelValue', newValue?.trim());\n});\n\nconst defaultId = computed(() => (props.label ? props.label.trim().replaceAll(' ', '') : props.type));\n\nconst handleEyesPasswordClick = () => {\n inputType.value = inputType.value === 'text' ? 'password' : 'text';\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n :name=\"id || `${uuid}-${defaultId}`\"\n :label=\"label\"\n :error-message=\"props.errorMessage === false ? false : props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n class=\"relative\"\n >\n <template #leading=\"{ error }\">\n <div class=\"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3\">\n <div v-if=\"leadingIcon\">\n <ElIcon\n :name=\"leadingIcon.name\"\n :solid=\"leadingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </div>\n </div>\n\n <slot name=\"leading\" v-bind=\"{ error }\" />\n\n <input\n :id=\"id || `${uuid}-${defaultId}`\"\n ref=\"inputRef\"\n v-model=\"value\"\n :name=\"props.name || id || `${uuid}-${defaultId}`\"\n :type=\"inputType\"\n class=\"el-input\"\n :class=\"{\n error,\n '!pl-10': leadingIcon?.name,\n '!pl-3': !leadingIcon?.name,\n '!pr-10': trailingIcon?.name,\n }\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :autocomplete=\"autocomplete\"\n :data-cy=\"`${defaultId}-input`\"\n @blur=\"fieldContext.validate()\"\n />\n </template>\n\n <template #trailing=\"{ error }\">\n <span v-if=\"trailingIcon\">\n <ElIcon\n :name=\"trailingIcon.name\"\n :solid=\"trailingIcon.solid\"\n class=\"h-5 w-5\"\n aria-hidden=\"true\"\n :class=\"{\n 'text-neutral-lighter': !error,\n 'text-error': error,\n }\"\n />\n </span>\n\n <span v-if=\"type === 'password'\">\n <ElIconButton\n :error=\"error\"\n :icon=\"{\n name: inputType === 'text' ? 'EyeSlashIcon' : 'EyeIcon',\n }\"\n type=\"button\"\n :tooltip=\"inputType === 'text' ? 'Nascondi' : 'Mostra'\"\n @click=\"handleEyesPasswordClick\"\n />\n </span>\n\n <slot name=\"trailing\" v-bind=\"{ error }\" />\n </template>\n </ElInputContainer>\n</template>\n"],"names":["elInputTextTypes","props","__props","inputType","ref","inputRef","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","defaultId","handleEyesPasswordClick"],"mappings":"wwBACaA,GAAmB,CAAC,OAAQ,UAAU,uTAWnD,MAAMC,EAAQC,EA0BRC,EAAYC,EAAqBH,EAAM,IAAI,EAC3CI,EAAWD,EAA6B,IAAI,EAElDE,EAAU,IAAM,OACVL,EAAM,gBACRM,EAAAF,EAAS,QAAT,MAAAE,EAAgB,QAClB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAS,IAAMV,EAAM,UAAU,EACpDW,EAAqBD,EAAS,IAAM,CAACV,EAAM,UAAU,CAAC,EAEtD,CAAE,MAAAY,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,EAASP,EAAoBE,EAAoBX,EAAM,KAAkBiB,GAAA,CACtHV,EAAA,oBAAqBU,GAAA,YAAAA,EAAU,MAAM,CAAA,CAC3C,EAEKC,EAAYR,EAAS,IAAOV,EAAM,MAAQA,EAAM,MAAM,KAAK,EAAE,WAAW,IAAK,EAAE,EAAIA,EAAM,IAAK,EAE9FmB,EAA0B,IAAM,CACpCjB,EAAU,MAAQA,EAAU,QAAU,OAAS,WAAa,MAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputTextarea.vue.cjs2.js","sources":["../../../src/forms/ElInputTextarea.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { useInput, TextualValueType, showRequiredMark, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, ref } from 'vue';\n\nconst textareaRef = ref<HTMLElement>();\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n resizable: {\n type: Boolean,\n default: true,\n },\n maxCharacters: {\n type: Number,\n default: -1,\n },\n textareaClass: {\n type: String,\n default: 'min-h-20',\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n});\n\nonMounted(() => {\n if (props.focusOnMount) {\n textareaRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [`max:${props.maxCharacters > 0 ? props.maxCharacters : 1000}`, props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue =>\n emit('update:modelValue', newValue),\n);\n\nconst currentInsertedCharNumber = computed(() => value.value?.length);\n\nconst handleEnter = (event: KeyboardEvent) => {\n event.stopPropagation();\n};\n\nconst handleInput = () => {\n if (textareaRef.value) textareaRef.value.scrollTop = textareaRef.value.scrollHeight;\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n class=\"relative\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n >\n <template #default=\"{ error }\">\n <textarea\n :id=\"uuid\"\n ref=\"textareaRef\"\n v-model=\"value\"\n :name=\"props.name\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n class=\"el-input\"\n :class=\"[\n {\n error,\n 'resize-none': !resizable,\n },\n textareaClass,\n ]\"\n :data-cy=\"`${label.trim().replaceAll(' ', '')}-textarea`\"\n @blur=\"fieldContext.validate()\"\n @input=\"handleInput\"\n @keydown.enter=\"handleEnter\"\n ></textarea>\n <span\n v-if=\"maxCharacters > 0\"\n class=\"flex justify-end text-sm font-semibold\"\n :class=\"currentInsertedCharNumber && currentInsertedCharNumber > maxCharacters ? 'text-red-500' : 'text-neutral-darker'\"\n >\n {{ currentInsertedCharNumber }}/{{ maxCharacters }}\n </span>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["textareaRef","ref","props","__props","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","currentInsertedCharNumber","handleEnter","event","handleInput"],"mappings":"kiBAKA,MAAMA,EAAcC,EAAAA,MAEdC,EAAQC,EAoBdC,EAAAA,UAAU,IAAM,OACVF,EAAM,gBACRG,EAAAL,EAAY,QAAZ,MAAAK,EAAmB,QACrB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAA,SAAS,IAAMP,EAAM,UAAU,EACpDQ,EAAqBD,EAAAA,SAAS,IAAM,CAAC,OAAOP,EAAM,cAAgB,EAAIA,EAAM,cAAgB,GAAI,GAAIA,EAAM,UAAU,CAAC,EAErH,CAAE,MAAAS,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,EAAA,SAASP,EAAoBE,EAAoBR,EAAM,KAAMc,GAC/GV,EAAK,oBAAqBU,CAAQ,CAAA,EAG9BC,EAA4BR,EAAAA,SAAS,IAAA,OAAM,OAAAJ,EAAAM,EAAM,QAAN,YAAAN,EAAa,OAAM,EAE9Da,EAAeC,GAAyB,CAC5CA,EAAM,gBAAgB,CAAA,EAGlBC,EAAc,IAAM,CACpBpB,EAAY,QAAmBA,EAAA,MAAM,UAAYA,EAAY,MAAM,aAAA"}
1
+ {"version":3,"file":"ElInputTextarea.vue.cjs2.js","sources":["../../src/forms/ElInputTextarea.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { useInput, TextualValueType, showRequiredMark, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, ref } from 'vue';\n\nconst textareaRef = ref<HTMLElement>();\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n resizable: {\n type: Boolean,\n default: true,\n },\n maxCharacters: {\n type: Number,\n default: -1,\n },\n textareaClass: {\n type: String,\n default: 'min-h-20',\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n});\n\nonMounted(() => {\n if (props.focusOnMount) {\n textareaRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [`max:${props.maxCharacters > 0 ? props.maxCharacters : 1000}`, props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue =>\n emit('update:modelValue', newValue),\n);\n\nconst currentInsertedCharNumber = computed(() => value.value?.length);\n\nconst handleEnter = (event: KeyboardEvent) => {\n event.stopPropagation();\n};\n\nconst handleInput = () => {\n if (textareaRef.value) textareaRef.value.scrollTop = textareaRef.value.scrollHeight;\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n class=\"relative\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n >\n <template #default=\"{ error }\">\n <textarea\n :id=\"uuid\"\n ref=\"textareaRef\"\n v-model=\"value\"\n :name=\"props.name\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n class=\"el-input\"\n :class=\"[\n {\n error,\n 'resize-none': !resizable,\n },\n textareaClass,\n ]\"\n :data-cy=\"`${label.trim().replaceAll(' ', '')}-textarea`\"\n @blur=\"fieldContext.validate()\"\n @input=\"handleInput\"\n @keydown.enter=\"handleEnter\"\n ></textarea>\n <span\n v-if=\"maxCharacters > 0\"\n class=\"flex justify-end text-sm font-semibold\"\n :class=\"currentInsertedCharNumber && currentInsertedCharNumber > maxCharacters ? 'text-red-500' : 'text-neutral-darker'\"\n >\n {{ currentInsertedCharNumber }}/{{ maxCharacters }}\n </span>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["textareaRef","ref","props","__props","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","currentInsertedCharNumber","handleEnter","event","handleInput"],"mappings":"kiBAKA,MAAMA,EAAcC,EAAAA,MAEdC,EAAQC,EAoBdC,EAAAA,UAAU,IAAM,OACVF,EAAM,gBACRG,EAAAL,EAAY,QAAZ,MAAAK,EAAmB,QACrB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAA,SAAS,IAAMP,EAAM,UAAU,EACpDQ,EAAqBD,EAAAA,SAAS,IAAM,CAAC,OAAOP,EAAM,cAAgB,EAAIA,EAAM,cAAgB,GAAI,GAAIA,EAAM,UAAU,CAAC,EAErH,CAAE,MAAAS,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,EAAA,SAASP,EAAoBE,EAAoBR,EAAM,KAAMc,GAC/GV,EAAK,oBAAqBU,CAAQ,CAAA,EAG9BC,EAA4BR,EAAAA,SAAS,IAAA,OAAM,OAAAJ,EAAAM,EAAM,QAAN,YAAAN,EAAa,OAAM,EAE9Da,EAAeC,GAAyB,CAC5CA,EAAM,gBAAgB,CAAA,EAGlBC,EAAc,IAAM,CACpBpB,EAAY,QAAmBA,EAAA,MAAM,UAAYA,EAAY,MAAM,aAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElInputTextarea.vue.esm2.js","sources":["../../../src/forms/ElInputTextarea.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { useInput, TextualValueType, showRequiredMark, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, ref } from 'vue';\n\nconst textareaRef = ref<HTMLElement>();\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n resizable: {\n type: Boolean,\n default: true,\n },\n maxCharacters: {\n type: Number,\n default: -1,\n },\n textareaClass: {\n type: String,\n default: 'min-h-20',\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n});\n\nonMounted(() => {\n if (props.focusOnMount) {\n textareaRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [`max:${props.maxCharacters > 0 ? props.maxCharacters : 1000}`, props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue =>\n emit('update:modelValue', newValue),\n);\n\nconst currentInsertedCharNumber = computed(() => value.value?.length);\n\nconst handleEnter = (event: KeyboardEvent) => {\n event.stopPropagation();\n};\n\nconst handleInput = () => {\n if (textareaRef.value) textareaRef.value.scrollTop = textareaRef.value.scrollHeight;\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n class=\"relative\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n >\n <template #default=\"{ error }\">\n <textarea\n :id=\"uuid\"\n ref=\"textareaRef\"\n v-model=\"value\"\n :name=\"props.name\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n class=\"el-input\"\n :class=\"[\n {\n error,\n 'resize-none': !resizable,\n },\n textareaClass,\n ]\"\n :data-cy=\"`${label.trim().replaceAll(' ', '')}-textarea`\"\n @blur=\"fieldContext.validate()\"\n @input=\"handleInput\"\n @keydown.enter=\"handleEnter\"\n ></textarea>\n <span\n v-if=\"maxCharacters > 0\"\n class=\"flex justify-end text-sm font-semibold\"\n :class=\"currentInsertedCharNumber && currentInsertedCharNumber > maxCharacters ? 'text-red-500' : 'text-neutral-darker'\"\n >\n {{ currentInsertedCharNumber }}/{{ maxCharacters }}\n </span>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["textareaRef","ref","props","__props","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","currentInsertedCharNumber","handleEnter","event","handleInput"],"mappings":"kwBAKA,MAAMA,EAAcC,IAEdC,EAAQC,EAoBdC,EAAU,IAAM,OACVF,EAAM,gBACRG,EAAAL,EAAY,QAAZ,MAAAK,EAAmB,QACrB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAS,IAAMP,EAAM,UAAU,EACpDQ,EAAqBD,EAAS,IAAM,CAAC,OAAOP,EAAM,cAAgB,EAAIA,EAAM,cAAgB,GAAI,GAAIA,EAAM,UAAU,CAAC,EAErH,CAAE,MAAAS,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,EAASP,EAAoBE,EAAoBR,EAAM,KAAMc,GAC/GV,EAAK,oBAAqBU,CAAQ,CAAA,EAG9BC,EAA4BR,EAAS,IAAA,OAAM,OAAAJ,EAAAM,EAAM,QAAN,YAAAN,EAAa,OAAM,EAE9Da,EAAeC,GAAyB,CAC5CA,EAAM,gBAAgB,CAAA,EAGlBC,EAAc,IAAM,CACpBpB,EAAY,QAAmBA,EAAA,MAAM,UAAYA,EAAY,MAAM,aAAA"}
1
+ {"version":3,"file":"ElInputTextarea.vue.esm2.js","sources":["../../src/forms/ElInputTextarea.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { useInput, TextualValueType, showRequiredMark, withTextualElInputProps } from '@/forms/input';\nimport { computed, onMounted, ref } from 'vue';\n\nconst textareaRef = ref<HTMLElement>();\n\nconst props = defineProps({\n ...withTextualElInputProps(),\n resizable: {\n type: Boolean,\n default: true,\n },\n maxCharacters: {\n type: Number,\n default: -1,\n },\n textareaClass: {\n type: String,\n default: 'min-h-20',\n },\n focusOnMount: {\n type: Boolean,\n default: false,\n },\n});\n\nonMounted(() => {\n if (props.focusOnMount) {\n textareaRef.value?.focus();\n }\n});\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: TextualValueType): void;\n}>();\n\nconst computedModelValue = computed(() => props.modelValue);\nconst computedValidation = computed(() => [`max:${props.maxCharacters > 0 ? props.maxCharacters : 1000}`, props.validation]);\n\nconst { value, errorMessage, uuid, fieldContext } = useInput(computedModelValue, computedValidation, props.name, newValue =>\n emit('update:modelValue', newValue),\n);\n\nconst currentInsertedCharNumber = computed(() => value.value?.length);\n\nconst handleEnter = (event: KeyboardEvent) => {\n event.stopPropagation();\n};\n\nconst handleInput = () => {\n if (textareaRef.value) textareaRef.value.scrollTop = textareaRef.value.scrollHeight;\n};\n</script>\n\n<template>\n <ElInputContainer\n v-bind=\"$attrs\"\n class=\"relative\"\n :name=\"uuid\"\n :label=\"label\"\n :error-message=\"props.errorMessage || errorMessage\"\n :hidden-error-message=\"hiddenErrorMessage\"\n :set-required-mark=\"showRequiredMark([validation])\"\n >\n <template #default=\"{ error }\">\n <textarea\n :id=\"uuid\"\n ref=\"textareaRef\"\n v-model=\"value\"\n :name=\"props.name\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n class=\"el-input\"\n :class=\"[\n {\n error,\n 'resize-none': !resizable,\n },\n textareaClass,\n ]\"\n :data-cy=\"`${label.trim().replaceAll(' ', '')}-textarea`\"\n @blur=\"fieldContext.validate()\"\n @input=\"handleInput\"\n @keydown.enter=\"handleEnter\"\n ></textarea>\n <span\n v-if=\"maxCharacters > 0\"\n class=\"flex justify-end text-sm font-semibold\"\n :class=\"currentInsertedCharNumber && currentInsertedCharNumber > maxCharacters ? 'text-red-500' : 'text-neutral-darker'\"\n >\n {{ currentInsertedCharNumber }}/{{ maxCharacters }}\n </span>\n </template>\n </ElInputContainer>\n</template>\n"],"names":["textareaRef","ref","props","__props","onMounted","_a","emit","__emit","computedModelValue","computed","computedValidation","value","errorMessage","uuid","fieldContext","useInput","newValue","currentInsertedCharNumber","handleEnter","event","handleInput"],"mappings":"kwBAKA,MAAMA,EAAcC,IAEdC,EAAQC,EAoBdC,EAAU,IAAM,OACVF,EAAM,gBACRG,EAAAL,EAAY,QAAZ,MAAAK,EAAmB,QACrB,CACD,EAED,MAAMC,EAAOC,EAIPC,EAAqBC,EAAS,IAAMP,EAAM,UAAU,EACpDQ,EAAqBD,EAAS,IAAM,CAAC,OAAOP,EAAM,cAAgB,EAAIA,EAAM,cAAgB,GAAI,GAAIA,EAAM,UAAU,CAAC,EAErH,CAAE,MAAAS,EAAO,aAAAC,EAAc,KAAAC,EAAM,aAAAC,CAAiB,EAAAC,EAASP,EAAoBE,EAAoBR,EAAM,KAAMc,GAC/GV,EAAK,oBAAqBU,CAAQ,CAAA,EAG9BC,EAA4BR,EAAS,IAAA,OAAM,OAAAJ,EAAAM,EAAM,QAAN,YAAAN,EAAa,OAAM,EAE9Da,EAAeC,GAAyB,CAC5CA,EAAM,gBAAgB,CAAA,EAGlBC,EAAc,IAAM,CACpBpB,EAAY,QAAmBA,EAAA,MAAM,UAAYA,EAAY,MAAM,aAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"input.cjs.js","sources":["../../../src/forms/input.ts"],"sourcesContent":["import { InputValidation } from '@/forms/validation-rules';\nimport { useField } from 'vee-validate';\n\nlet UUID = 0;\n\nexport const UniqueID = () => {\n const getID = () => {\n UUID++;\n return `elty-input-${UUID.toString()}`;\n };\n return {\n getID,\n };\n};\n\nimport { computed, ComputedRef, PropType, Ref, watch } from 'vue';\n\nexport type TextualValueType = string | null | undefined;\nexport type NumberValueType = number | null | undefined;\n\nexport const withCommonInputProps = () => ({\n label: {\n type: String,\n required: false,\n default: '',\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n hideRequiredMark: {\n type: Boolean,\n required: false,\n default: false,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n helpTooltip: {\n type: Object as PropType<{\n title: string;\n text: string;\n }>,\n required: false,\n default: undefined,\n },\n});\n\nexport const withTextualInputProps = () => ({\n ...withCommonInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withCommonElInputProps = () => ({\n name: {\n type: String,\n required: false,\n default: '',\n },\n id: {\n type: String,\n required: false,\n default: '',\n },\n label: {\n type: String,\n required: false,\n default: '',\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n errorMessage: {\n type: [String, Boolean],\n required: false,\n default: undefined,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n});\n\nexport const withTextualElInputProps = () => ({\n ...withCommonElInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withNumberInputProps = () => ({\n ...withCommonInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport const withNumberElInputProps = () => ({\n ...withCommonElInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport function useInput<T = string>(\n initialValue: Ref<T>,\n validations: Ref<string[]> | ComputedRef<string[]>,\n inputName: string = '',\n onChange?: (value: T) => void,\n) {\n const uuid = UniqueID().getID();\n const validationsString = computed(() => validations.value && validations.value.join('|'));\n\n // if a name is not provided it generates a random one\n const field = useField<T>(inputName || uuid, validationsString, {\n // empty string counts as a forced blank value\n initialValue,\n // validation is performed manually on value change, only if there are errors\n validateOnValueUpdate: false,\n });\n\n watch(initialValue, newValue => {\n field.setValue(newValue);\n });\n\n watch(field.value, val => {\n if (onChange) {\n onChange(val);\n }\n if (field.errorMessage.value) {\n field.validate();\n }\n });\n\n return {\n fieldContext: field,\n errorMessage: field.errorMessage,\n value: field.value,\n uuid,\n meta: field.meta,\n setValue: field.setValue,\n };\n}\n\nexport function showRequiredMark(validations: string[], forceHideMark?: boolean | undefined): boolean {\n if (forceHideMark) return false;\n\n for (const v of validations) {\n if (v.match(/(?:^required)|required\\||(?:\\|required$)/)) {\n return true;\n }\n }\n return false;\n}\n"],"names":["UUID","UniqueID","withCommonInputProps","withTextualInputProps","withCommonElInputProps","withTextualElInputProps","withNumberInputProps","withNumberElInputProps","useInput","initialValue","validations","inputName","onChange","uuid","validationsString","computed","field","useField","watch","newValue","val","showRequiredMark","forceHideMark","v"],"mappings":"iIAGA,IAAIA,EAAO,EAEJ,MAAMC,EAAW,KAKf,CACL,MALY,KACZD,IACO,cAAcA,EAAK,SAAA,CAAU,GAGpC,GASSE,EAAuB,KAAO,CACzC,MAAO,CACL,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,SAAU,CACR,KAAM,QACN,SAAU,GACV,QAAS,EACX,EACA,WAAY,CACV,KAAM,OACN,QAAS,GACT,SAAU,EACZ,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EAAOZ,IAAW,QAClBa,EAAoBC,WAAS,IAAML,EAAY,OAASA,EAAY,MAAM,KAAK,GAAG,CAAC,EAGnFM,EAAQC,EAAA,SAAYN,GAAaE,EAAMC,EAAmB,CAE9D,aAAAL,EAEA,sBAAuB,EAAA,CACxB,EAEDS,OAAAA,QAAMT,EAA0BU,GAAA,CAC9BH,EAAM,SAASG,CAAQ,CAAA,CACxB,EAEKD,EAAAA,MAAAF,EAAM,MAAcI,GAAA,CACpBR,GACFA,EAASQ,CAAG,EAEVJ,EAAM,aAAa,OACrBA,EAAM,SAAS,CACjB,CACD,EAEM,CACL,aAAcA,EACd,aAAcA,EAAM,aACpB,MAAOA,EAAM,MACb,KAAAH,EACA,KAAMG,EAAM,KACZ,SAAUA,EAAM,QAAA,CAEpB,CAEgB,SAAAK,EAAiBX,EAAuBY,EAA8C,CAChG,GAAAA,EAAsB,MAAA,GAE1B,UAAWC,KAAKb,EACV,GAAAa,EAAE,MAAM,0CAA0C,EAC7C,MAAA,GAGJ,MAAA,EACT"}
1
+ {"version":3,"file":"input.cjs.js","sources":["../../src/forms/input.ts"],"sourcesContent":["import { InputValidation } from '@/forms/validation-rules';\nimport { useField } from 'vee-validate';\n\nlet UUID = 0;\n\nexport const UniqueID = () => {\n const getID = () => {\n UUID++;\n return `elty-input-${UUID.toString()}`;\n };\n return {\n getID,\n };\n};\n\nimport { computed, ComputedRef, PropType, Ref, watch } from 'vue';\n\nexport type TextualValueType = string | null | undefined;\nexport type NumberValueType = number | null | undefined;\n\nexport const withCommonInputProps = () => ({\n label: {\n type: String,\n required: false,\n default: '',\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n hideRequiredMark: {\n type: Boolean,\n required: false,\n default: false,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n helpTooltip: {\n type: Object as PropType<{\n title: string;\n text: string;\n }>,\n required: false,\n default: undefined,\n },\n});\n\nexport const withTextualInputProps = () => ({\n ...withCommonInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withCommonElInputProps = () => ({\n name: {\n type: String,\n required: false,\n default: '',\n },\n id: {\n type: String,\n required: false,\n default: '',\n },\n label: {\n type: String,\n required: false,\n default: '',\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n errorMessage: {\n type: [String, Boolean],\n required: false,\n default: undefined,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n});\n\nexport const withTextualElInputProps = () => ({\n ...withCommonElInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withNumberInputProps = () => ({\n ...withCommonInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport const withNumberElInputProps = () => ({\n ...withCommonElInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport function useInput<T = string>(\n initialValue: Ref<T>,\n validations: Ref<string[]> | ComputedRef<string[]>,\n inputName: string = '',\n onChange?: (value: T) => void,\n) {\n const uuid = UniqueID().getID();\n const validationsString = computed(() => validations.value && validations.value.join('|'));\n\n // if a name is not provided it generates a random one\n const field = useField<T>(inputName || uuid, validationsString, {\n // empty string counts as a forced blank value\n initialValue,\n // validation is performed manually on value change, only if there are errors\n validateOnValueUpdate: false,\n });\n\n watch(initialValue, newValue => {\n field.setValue(newValue);\n });\n\n watch(field.value, val => {\n if (onChange) {\n onChange(val);\n }\n if (field.errorMessage.value) {\n field.validate();\n }\n });\n\n return {\n fieldContext: field,\n errorMessage: field.errorMessage,\n value: field.value,\n uuid,\n meta: field.meta,\n setValue: field.setValue,\n };\n}\n\nexport function showRequiredMark(validations: string[], forceHideMark?: boolean | undefined): boolean {\n if (forceHideMark) return false;\n\n for (const v of validations) {\n if (v.match(/(?:^required)|required\\||(?:\\|required$)/)) {\n return true;\n }\n }\n return false;\n}\n"],"names":["UUID","UniqueID","withCommonInputProps","withTextualInputProps","withCommonElInputProps","withTextualElInputProps","withNumberInputProps","withNumberElInputProps","useInput","initialValue","validations","inputName","onChange","uuid","validationsString","computed","field","useField","watch","newValue","val","showRequiredMark","forceHideMark","v"],"mappings":"iIAGA,IAAIA,EAAO,EAEJ,MAAMC,EAAW,KAKf,CACL,MALY,KACZD,IACO,cAAcA,EAAK,SAAA,CAAU,GAGpC,GASSE,EAAuB,KAAO,CACzC,MAAO,CACL,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,SAAU,CACR,KAAM,QACN,SAAU,GACV,QAAS,EACX,EACA,WAAY,CACV,KAAM,OACN,QAAS,GACT,SAAU,EACZ,EACA,iBAAkB,CAChB,KAAM,QACN,SAAU,GACV,QAAS,EACX,EACA,mBAAoB,CAClB,KAAM,QACN,SAAU,GACV,QAAS,EACX,EACA,YAAa,CACX,KAAM,OAIN,SAAU,GACV,QAAS,MACX,CACF,GAEaC,EAAwB,KAAO,CAC1C,GAAGD,EAAqB,EAExB,WAAY,CACV,KAAM,OACN,QAAS,EACX,EACA,YAAa,CACX,KAAM,OACN,QAAS,GACT,SAAU,EACZ,CACF,GAEaE,EAAyB,KAAO,CAC3C,KAAM,CACJ,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,GAAI,CACF,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,MAAO,CACL,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,WAAY,CACV,KAAM,O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pB,CAEgB,SAAAK,EAAiBX,EAAuBY,EAA8C,CAChG,GAAAA,EAAsB,MAAA,GAE1B,UAAWC,KAAKb,EACV,GAAAa,EAAE,MAAM,0CAA0C,EAC7C,MAAA,GAGJ,MAAA,EACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"input.esm.js","sources":["../../../src/forms/input.ts"],"sourcesContent":["import { InputValidation } from '@/forms/validation-rules';\nimport { useField } from 'vee-validate';\n\nlet UUID = 0;\n\nexport const UniqueID = () => {\n const getID = () => {\n UUID++;\n return `elty-input-${UUID.toString()}`;\n };\n return {\n getID,\n };\n};\n\nimport { computed, ComputedRef, PropType, Ref, watch } from 'vue';\n\nexport type TextualValueType = string | null | undefined;\nexport type NumberValueType = number | null | undefined;\n\nexport const withCommonInputProps = () => ({\n label: {\n type: String,\n required: false,\n default: '',\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n hideRequiredMark: {\n type: Boolean,\n required: false,\n default: false,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n helpTooltip: {\n type: Object as PropType<{\n title: string;\n text: string;\n }>,\n required: false,\n default: undefined,\n },\n});\n\nexport const withTextualInputProps = () => ({\n ...withCommonInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withCommonElInputProps = () => ({\n name: {\n type: String,\n required: false,\n default: '',\n },\n id: {\n type: String,\n required: false,\n default: '',\n },\n label: {\n type: String,\n required: false,\n default: '',\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n errorMessage: {\n type: [String, Boolean],\n required: false,\n default: undefined,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n});\n\nexport const withTextualElInputProps = () => ({\n ...withCommonElInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withNumberInputProps = () => ({\n ...withCommonInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport const withNumberElInputProps = () => ({\n ...withCommonElInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport function useInput<T = string>(\n initialValue: Ref<T>,\n validations: Ref<string[]> | ComputedRef<string[]>,\n inputName: string = '',\n onChange?: (value: T) => void,\n) {\n const uuid = UniqueID().getID();\n const validationsString = computed(() => validations.value && validations.value.join('|'));\n\n // if a name is not provided it generates a random one\n const field = useField<T>(inputName || uuid, validationsString, {\n // empty string counts as a forced blank value\n initialValue,\n // validation is performed manually on value change, only if there are errors\n validateOnValueUpdate: false,\n });\n\n watch(initialValue, newValue => {\n field.setValue(newValue);\n });\n\n watch(field.value, val => {\n if (onChange) {\n onChange(val);\n }\n if (field.errorMessage.value) {\n field.validate();\n }\n });\n\n return {\n fieldContext: field,\n errorMessage: field.errorMessage,\n value: field.value,\n uuid,\n meta: field.meta,\n setValue: field.setValue,\n };\n}\n\nexport function showRequiredMark(validations: string[], forceHideMark?: boolean | undefined): boolean {\n if (forceHideMark) return false;\n\n for (const v of validations) {\n if (v.match(/(?:^required)|required\\||(?:\\|required$)/)) {\n return true;\n }\n }\n return false;\n}\n"],"names":["UUID","UniqueID","withCommonInputProps","withTextualInputProps","withCommonElInputProps","withTextualElInputProps","withNumberInputProps","withNumberElInputProps","useInput","initialValue","validations","inputName","onChange","uuid","validationsString","computed","field","useField","watch","newValue","val","showRequiredMark","forceHideMark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,KAAM,OACN,QAAS,EACT,SAAU,EACZ,CACF,GAEaK,EAAyB,KAAO,CAC3C,GAAGH,EAAuB,EAC1B,WAAY,CACV,KAAM,MACR,EACA,YAAa,CACX,KAAM,OACN,QAAS,GACT,SAAU,EACZ,EACA,KAAM,CACJ,KAAM,OACN,QAAS,EACT,SAAU,EACZ,CACF,GAEO,SAASI,EACdC,EACAC,EACAC,EAAoB,GACpBC,EACA,CACM,MAAAC,EAAOZ,IAAW,QAClBa,EAAoBC,EAAS,IAAML,EAAY,OAASA,EAAY,MAAM,KAAK,GAAG,CAAC,EAGnFM,EAAQC,EAAYN,GAAaE,EAAMC,EAAmB,CAE9D,aAAAL,EAEA,sBAAuB,EAAA,CACxB,EAED,OAAAS,EAAMT,EAA0BU,GAAA,CAC9BH,EAAM,SAASG,CAAQ,CAAA,CACxB,EAEKD,EAAAF,EAAM,MAAcI,GAAA,CACpBR,GACFA,EAASQ,CAAG,EAEVJ,EAAM,aAAa,OACrBA,EAAM,SAAS,CACjB,CACD,EAEM,CACL,aAAcA,EACd,aAAcA,EAAM,aACpB,MAAOA,EAAM,MACb,KAAAH,EACA,KAAMG,EAAM,KACZ,SAAUA,EAAM,QAAA,CAEpB,CAEgB,SAAAK,EAAiBX,EAAuBY,EAA8C,CAChG,GAAAA,EAAsB,MAAA,GAE1B,UAAWC,KAAKb,EACV,GAAAa,EAAE,MAAM,0CAA0C,EAC7C,MAAA,GAGJ,MAAA,EACT"}
1
+ {"version":3,"file":"input.esm.js","sources":["../../src/forms/input.ts"],"sourcesContent":["import { InputValidation } from '@/forms/validation-rules';\nimport { useField } from 'vee-validate';\n\nlet UUID = 0;\n\nexport const UniqueID = () => {\n const getID = () => {\n UUID++;\n return `elty-input-${UUID.toString()}`;\n };\n return {\n getID,\n };\n};\n\nimport { computed, ComputedRef, PropType, Ref, watch } from 'vue';\n\nexport type TextualValueType = string | null | undefined;\nexport type NumberValueType = number | null | undefined;\n\nexport const withCommonInputProps = () => ({\n label: {\n type: String,\n required: false,\n default: '',\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n hideRequiredMark: {\n type: Boolean,\n required: false,\n default: false,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n helpTooltip: {\n type: Object as PropType<{\n title: string;\n text: string;\n }>,\n required: false,\n default: undefined,\n },\n});\n\nexport const withTextualInputProps = () => ({\n ...withCommonInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withCommonElInputProps = () => ({\n name: {\n type: String,\n required: false,\n default: '',\n },\n id: {\n type: String,\n required: false,\n default: '',\n },\n label: {\n type: String,\n required: false,\n default: '',\n },\n validation: {\n type: String as PropType<InputValidation>,\n default: '',\n required: false,\n },\n disabled: {\n type: Boolean,\n required: false,\n default: false,\n },\n errorMessage: {\n type: [String, Boolean],\n required: false,\n default: undefined,\n },\n hiddenErrorMessage: {\n type: Boolean,\n required: false,\n default: false,\n },\n});\n\nexport const withTextualElInputProps = () => ({\n ...withCommonElInputProps(),\n // v-model binding will always be done to a single string. every component will treat the string as he wishes\n modelValue: {\n type: String as PropType<TextualValueType>,\n default: '',\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n});\n\nexport const withNumberInputProps = () => ({\n ...withCommonInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport const withNumberElInputProps = () => ({\n ...withCommonElInputProps(),\n modelValue: {\n type: Number as PropType<NumberValueType>,\n },\n placeholder: {\n type: String,\n default: '',\n required: false,\n },\n step: {\n type: Number,\n default: 1,\n required: false,\n },\n});\n\nexport function useInput<T = string>(\n initialValue: Ref<T>,\n validations: Ref<string[]> | ComputedRef<string[]>,\n inputName: string = '',\n onChange?: (value: T) => void,\n) {\n const uuid = UniqueID().getID();\n const validationsString = computed(() => validations.value && validations.value.join('|'));\n\n // if a name is not provided it generates a random one\n const field = useField<T>(inputName || uuid, validationsString, {\n // empty string counts as a forced blank value\n initialValue,\n // validation is performed manually on value change, only if there are errors\n validateOnValueUpdate: false,\n });\n\n watch(initialValue, newValue => {\n field.setValue(newValue);\n });\n\n watch(field.value, val => {\n if (onChange) {\n onChange(val);\n }\n if (field.errorMessage.value) {\n field.validate();\n }\n });\n\n return {\n fieldContext: field,\n errorMessage: field.errorMessage,\n value: field.value,\n uuid,\n meta: field.meta,\n setValue: field.setValue,\n };\n}\n\nexport function showRequiredMark(validations: string[], forceHideMark?: boolean | undefined): boolean {\n if (forceHideMark) return false;\n\n for (const v of validations) {\n if (v.match(/(?:^required)|required\\||(?:\\|required$)/)) {\n return true;\n }\n }\n return false;\n}\n"],"names":["UUID","UniqueID","withCommonInputProps","withTextualInputProps","withCommonElInputProps","withTextualElInputProps","withNumberInputProps","withNumberElInputProps","useInput","initialValue","validations","inputName","onChange","uuid","validationsString","computed","field","useField","watch","newValue","val","showRequiredMark","forceHideMark","v"],"mappings":"kFAGA,IAAIA,EAAO,EAEJ,MAAMC,EAAW,KAKf,CACL,MALY,KACZD,IACO,cAAcA,EAAK,SAAA,CAAU,GAGpC,GASSE,EAAuB,KAAO,CACzC,MAAO,CACL,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,SAAU,CACR,KAAM,QACN,SAAU,GACV,QAAS,EACX,EACA,WAAY,CACV,KAAM,OACN,QAAS,GACT,SAAU,EACZ,EACA,iBAAkB,CAChB,KAAM,QACN,SAAU,GACV,QAAS,EACX,EACA,mBAAoB,CAClB,KAAM,QACN,SAAU,GACV,QAAS,EACX,EACA,YAAa,CACX,KAAM,OAIN,SAAU,GACV,QAAS,MACX,CACF,GAEaC,EAAwB,KAAO,CAC1C,GAAGD,EAAqB,EAExB,WAAY,CACV,KAAM,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,CAAQ,CAAA,CACxB,EAEKD,EAAAF,EAAM,MAAcI,GAAA,CACpBR,GACFA,EAASQ,CAAG,EAEVJ,EAAM,aAAa,OACrBA,EAAM,SAAS,CACjB,CACD,EAEM,CACL,aAAcA,EACd,aAAcA,EAAM,aACpB,MAAOA,EAAM,MACb,KAAAH,EACA,KAAMG,EAAM,KACZ,SAAUA,EAAM,QAAA,CAEpB,CAEgB,SAAAK,EAAiBX,EAAuBY,EAA8C,CAChG,GAAAA,EAAsB,MAAA,GAE1B,UAAWC,KAAKb,EACV,GAAAa,EAAE,MAAM,0CAA0C,EAC7C,MAAA,GAGJ,MAAA,EACT"}
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../node_modules/lodash/lodash.cjs.js"),o=["@","0","¡","P","¿","p","£","_","!","1","A","Q","a","q","$",'"',"2","B","R","b","r","¥","?","#","3","C","S","c","s","è","?","4","D","T","d","t","é","?","%","5","E","U","e","u","ù","6","F","V","f","v","ì","?","'","7","G","W","g","w","ò","(","8","H","X","h","x","Ç",")","9","I","Y","i","y","*",":","J","Z","j","z","Ø","+",";","K","Ä","k","ä","Æ",",","<","L","l","ö","æ","-","=","M","Ñ","m","ñ","Å","ß",".",">","N","Ü","n","ü","å","É","/","O","§","o","à","Δ","Φ","Γ","Λ","Ω","Π","Ψ","Σ","Θ","Ξ","Ö","Ä","Ü","ø"," ","\r",`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../node_modules/lodash/lodash.cjs.js"),o=["@","0","¡","P","¿","p","£","_","!","1","A","Q","a","q","$",'"',"2","B","R","b","r","¥","?","#","3","C","S","c","s","è","?","4","D","T","d","t","é","?","%","5","E","U","e","u","ù","6","F","V","f","v","ì","?","'","7","G","W","g","w","ò","(","8","H","X","h","x","Ç",")","9","I","Y","i","y","*",":","J","Z","j","z","Ø","+",";","K","Ä","k","ä","Æ",",","<","L","l","ö","æ","-","=","M","Ñ","m","ñ","Å","ß",".",">","N","Ü","n","ü","å","É","/","O","§","o","à","Δ","Φ","Γ","Λ","Ω","Π","Ψ","Σ","Θ","Ξ","Ö","Ä","Ü","ø"," ","\r",`
2
2
  `,"¤","&"],r=["|","^","€","{","}","[","]","~","\\"],d=new RegExp(/ʻ|ʼ|ʽ|ˊ|ˋ|’/g),a=e=>t(e).length===0,t=e=>{const n=new Set;return c.lodashExports.difference([...e.replace(d,"'")],[...o,...r]).forEach(s=>n.add(s)),Array.from(n)};exports.GSM_EXTENDED_CHARS=r;exports.GSM_STANDARD_CHARS=o;exports.doesNotContainUnicodeChars=a;exports.findUnicodeChars=t;
3
3
  //# sourceMappingURL=unicodeCharsRule.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unicodeCharsRule.cjs.js","sources":["../../../src/forms/unicodeCharsRule.ts"],"sourcesContent":["import { difference } from 'lodash';\n\nexport const GSM_STANDARD_CHARS = [\n '@',\n '0',\n '¡',\n 'P',\n '¿',\n 'p',\n '£',\n '_',\n '!',\n '1',\n 'A',\n 'Q',\n 'a',\n 'q',\n '$',\n '\"',\n '2',\n 'B',\n 'R',\n 'b',\n 'r',\n '¥',\n '?',\n '#',\n '3',\n 'C',\n 'S',\n 'c',\n 's',\n 'è',\n '?',\n '4',\n 'D',\n 'T',\n 'd',\n 't',\n 'é',\n '?',\n '%',\n '5',\n 'E',\n 'U',\n 'e',\n 'u',\n 'ù',\n '6',\n 'F',\n 'V',\n 'f',\n 'v',\n 'ì',\n '?',\n \"'\",\n '7',\n 'G',\n 'W',\n 'g',\n 'w',\n 'ò',\n '(',\n '8',\n 'H',\n 'X',\n 'h',\n 'x',\n 'Ç',\n ')',\n '9',\n 'I',\n 'Y',\n 'i',\n 'y',\n '*',\n ':',\n 'J',\n 'Z',\n 'j',\n 'z',\n 'Ø',\n '+',\n ';',\n 'K',\n 'Ä',\n 'k',\n 'ä',\n 'Æ',\n ',',\n '<',\n 'L',\n 'l',\n 'ö',\n 'æ',\n '-',\n '=',\n 'M',\n 'Ñ',\n 'm',\n 'ñ',\n 'Å',\n 'ß',\n '.',\n '>',\n 'N',\n 'Ü',\n 'n',\n 'ü',\n 'å',\n 'É',\n '/',\n 'O',\n '§',\n 'o',\n 'à',\n 'Δ',\n 'Φ',\n 'Γ',\n 'Λ',\n 'Ω',\n 'Π',\n 'Ψ',\n 'Σ',\n 'Θ',\n 'Ξ',\n 'Ö',\n 'Ä',\n 'Ü',\n 'ø',\n ' ',\n '\\r',\n '\\n',\n '¤',\n '&',\n];\n\nexport const GSM_EXTENDED_CHARS = ['|', '^', '€', '{', '}', '[', ']', '~', '\\\\'];\n\nconst APOSTROPHES_TO_REPLACE = new RegExp(/ʻ|ʼ|ʽ|ˊ|ˋ|’/g);\n\nexport const doesNotContainUnicodeChars = (text: string) => {\n return findUnicodeChars(text).length === 0;\n};\n\nexport const findUnicodeChars = (text: string): string[] => {\n const remainder = new Set<string>();\n difference([...text.replace(APOSTROPHES_TO_REPLACE, \"'\")], [...GSM_STANDARD_CHARS, ...GSM_EXTENDED_CHARS]).forEach(unicodeChar =>\n remainder.add(unicodeChar),\n );\n return Array.from(remainder);\n};\n"],"names":["GSM_STANDARD_CHARS","GSM_EXTENDED_CHARS","APOSTROPHES_TO_REPLACE","doesNotContainUnicodeChars","text","findUnicodeChars","remainder","difference","unicodeChar"],"mappings":"2IAEaA,EAAqB,CAChC,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KACA;AAAA,EACA,IACA,GACF,EAEaC,EAAqB,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAI,EAEzEC,EAAyB,IAAI,OAAO,cAAc,EAE3CC,EAA8BC,GAClCC,EAAiBD,CAAI,EAAE,SAAW,EAG9BC,EAAoBD,GAA2B,CACpD,MAAAE,MAAgB,IACtBC,OAAAA,EAAAA,cAAAA,WAAW,CAAC,GAAGH,EAAK,QAAQF,EAAwB,GAAG,CAAC,EAAG,CAAC,GAAGF,EAAoB,GAAGC,CAAkB,CAAC,EAAE,QAAQO,GACjHF,EAAU,IAAIE,CAAW,CAAA,EAEpB,MAAM,KAAKF,CAAS,CAC7B"}
1
+ {"version":3,"file":"unicodeCharsRule.cjs.js","sources":["../../src/forms/unicodeCharsRule.ts"],"sourcesContent":["import { difference } from 'lodash';\n\nexport const GSM_STANDARD_CHARS = [\n '@',\n '0',\n '¡',\n 'P',\n '¿',\n 'p',\n '£',\n '_',\n '!',\n '1',\n 'A',\n 'Q',\n 'a',\n 'q',\n '$',\n '\"',\n '2',\n 'B',\n 'R',\n 'b',\n 'r',\n '¥',\n '?',\n '#',\n '3',\n 'C',\n 'S',\n 'c',\n 's',\n 'è',\n '?',\n '4',\n 'D',\n 'T',\n 'd',\n 't',\n 'é',\n '?',\n '%',\n '5',\n 'E',\n 'U',\n 'e',\n 'u',\n 'ù',\n '6',\n 'F',\n 'V',\n 'f',\n 'v',\n 'ì',\n '?',\n \"'\",\n '7',\n 'G',\n 'W',\n 'g',\n 'w',\n 'ò',\n '(',\n '8',\n 'H',\n 'X',\n 'h',\n 'x',\n 'Ç',\n ')',\n '9',\n 'I',\n 'Y',\n 'i',\n 'y',\n '*',\n ':',\n 'J',\n 'Z',\n 'j',\n 'z',\n 'Ø',\n '+',\n ';',\n 'K',\n 'Ä',\n 'k',\n 'ä',\n 'Æ',\n ',',\n '<',\n 'L',\n 'l',\n 'ö',\n 'æ',\n '-',\n '=',\n 'M',\n 'Ñ',\n 'm',\n 'ñ',\n 'Å',\n 'ß',\n '.',\n '>',\n 'N',\n 'Ü',\n 'n',\n 'ü',\n 'å',\n 'É',\n '/',\n 'O',\n '§',\n 'o',\n 'à',\n 'Δ',\n 'Φ',\n 'Γ',\n 'Λ',\n 'Ω',\n 'Π',\n 'Ψ',\n 'Σ',\n 'Θ',\n 'Ξ',\n 'Ö',\n 'Ä',\n 'Ü',\n 'ø',\n ' ',\n '\\r',\n '\\n',\n '¤',\n '&',\n];\n\nexport const GSM_EXTENDED_CHARS = ['|', '^', '€', '{', '}', '[', ']', '~', '\\\\'];\n\nconst APOSTROPHES_TO_REPLACE = new RegExp(/ʻ|ʼ|ʽ|ˊ|ˋ|’/g);\n\nexport const doesNotContainUnicodeChars = (text: string) => {\n return findUnicodeChars(text).length === 0;\n};\n\nexport const findUnicodeChars = (text: string): string[] => {\n const remainder = new Set<string>();\n difference([...text.replace(APOSTROPHES_TO_REPLACE, \"'\")], [...GSM_STANDARD_CHARS, ...GSM_EXTENDED_CHARS]).forEach(unicodeChar =>\n remainder.add(unicodeChar),\n );\n return Array.from(remainder);\n};\n"],"names":["GSM_STANDARD_CHARS","GSM_EXTENDED_CHARS","APOSTROPHES_TO_REPLACE","doesNotContainUnicodeChars","text","findUnicodeChars","remainder","difference","unicodeChar"],"mappings":"wIAEaA,EAAqB,CAChC,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KACA;AAAA,EACA,IACA,GACF,EAEaC,EAAqB,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAI,EAEzEC,EAAyB,IAAI,OAAO,cAAc,EAE3CC,EAA8BC,GAClCC,EAAiBD,CAAI,EAAE,SAAW,EAG9BC,EAAoBD,GAA2B,CACpD,MAAAE,MAAgB,IACtBC,OAAAA,EAAAA,cAAAA,WAAW,CAAC,GAAGH,EAAK,QAAQF,EAAwB,GAAG,CAAC,EAAG,CAAC,GAAGF,EAAoB,GAAGC,CAAkB,CAAC,EAAE,QAAQO,GACjHF,EAAU,IAAIE,CAAW,CAAA,EAEpB,MAAM,KAAKF,CAAS,CAC7B"}
@@ -1,3 +1,3 @@
1
- import{l as o}from"../../node_modules/lodash/lodash.esm.js";const t=["@","0","¡","P","¿","p","£","_","!","1","A","Q","a","q","$",'"',"2","B","R","b","r","¥","?","#","3","C","S","c","s","è","?","4","D","T","d","t","é","?","%","5","E","U","e","u","ù","6","F","V","f","v","ì","?","'","7","G","W","g","w","ò","(","8","H","X","h","x","Ç",")","9","I","Y","i","y","*",":","J","Z","j","z","Ø","+",";","K","Ä","k","ä","Æ",",","<","L","l","ö","æ","-","=","M","Ñ","m","ñ","Å","ß",".",">","N","Ü","n","ü","å","É","/","O","§","o","à","Δ","Φ","Γ","Λ","Ω","Π","Ψ","Σ","Θ","Ξ","Ö","Ä","Ü","ø"," ","\r",`
1
+ import{l as o}from"../node_modules/lodash/lodash.esm.js";const t=["@","0","¡","P","¿","p","£","_","!","1","A","Q","a","q","$",'"',"2","B","R","b","r","¥","?","#","3","C","S","c","s","è","?","4","D","T","d","t","é","?","%","5","E","U","e","u","ù","6","F","V","f","v","ì","?","'","7","G","W","g","w","ò","(","8","H","X","h","x","Ç",")","9","I","Y","i","y","*",":","J","Z","j","z","Ø","+",";","K","Ä","k","ä","Æ",",","<","L","l","ö","æ","-","=","M","Ñ","m","ñ","Å","ß",".",">","N","Ü","n","ü","å","É","/","O","§","o","à","Δ","Φ","Γ","Λ","Ω","Π","Ψ","Σ","Θ","Ξ","Ö","Ä","Ü","ø"," ","\r",`
2
2
  `,"¤","&"],s=["|","^","€","{","}","[","]","~","\\"],c=new RegExp(/ʻ|ʼ|ʽ|ˊ|ˋ|’/g),E=n=>a(n).length===0,a=n=>{const r=new Set;return o.difference([...n.replace(c,"'")],[...t,...s]).forEach(e=>r.add(e)),Array.from(r)};export{s as GSM_EXTENDED_CHARS,t as GSM_STANDARD_CHARS,E as doesNotContainUnicodeChars,a as findUnicodeChars};
3
3
  //# sourceMappingURL=unicodeCharsRule.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unicodeCharsRule.esm.js","sources":["../../../src/forms/unicodeCharsRule.ts"],"sourcesContent":["import { difference } from 'lodash';\n\nexport const GSM_STANDARD_CHARS = [\n '@',\n '0',\n '¡',\n 'P',\n '¿',\n 'p',\n '£',\n '_',\n '!',\n '1',\n 'A',\n 'Q',\n 'a',\n 'q',\n '$',\n '\"',\n '2',\n 'B',\n 'R',\n 'b',\n 'r',\n '¥',\n '?',\n '#',\n '3',\n 'C',\n 'S',\n 'c',\n 's',\n 'è',\n '?',\n '4',\n 'D',\n 'T',\n 'd',\n 't',\n 'é',\n '?',\n '%',\n '5',\n 'E',\n 'U',\n 'e',\n 'u',\n 'ù',\n '6',\n 'F',\n 'V',\n 'f',\n 'v',\n 'ì',\n '?',\n \"'\",\n '7',\n 'G',\n 'W',\n 'g',\n 'w',\n 'ò',\n '(',\n '8',\n 'H',\n 'X',\n 'h',\n 'x',\n 'Ç',\n ')',\n '9',\n 'I',\n 'Y',\n 'i',\n 'y',\n '*',\n ':',\n 'J',\n 'Z',\n 'j',\n 'z',\n 'Ø',\n '+',\n ';',\n 'K',\n 'Ä',\n 'k',\n 'ä',\n 'Æ',\n ',',\n '<',\n 'L',\n 'l',\n 'ö',\n 'æ',\n '-',\n '=',\n 'M',\n 'Ñ',\n 'm',\n 'ñ',\n 'Å',\n 'ß',\n '.',\n '>',\n 'N',\n 'Ü',\n 'n',\n 'ü',\n 'å',\n 'É',\n '/',\n 'O',\n '§',\n 'o',\n 'à',\n 'Δ',\n 'Φ',\n 'Γ',\n 'Λ',\n 'Ω',\n 'Π',\n 'Ψ',\n 'Σ',\n 'Θ',\n 'Ξ',\n 'Ö',\n 'Ä',\n 'Ü',\n 'ø',\n ' ',\n '\\r',\n '\\n',\n '¤',\n '&',\n];\n\nexport const GSM_EXTENDED_CHARS = ['|', '^', '€', '{', '}', '[', ']', '~', '\\\\'];\n\nconst APOSTROPHES_TO_REPLACE = new RegExp(/ʻ|ʼ|ʽ|ˊ|ˋ|’/g);\n\nexport const doesNotContainUnicodeChars = (text: string) => {\n return findUnicodeChars(text).length === 0;\n};\n\nexport const findUnicodeChars = (text: string): string[] => {\n const remainder = new Set<string>();\n difference([...text.replace(APOSTROPHES_TO_REPLACE, \"'\")], [...GSM_STANDARD_CHARS, ...GSM_EXTENDED_CHARS]).forEach(unicodeChar =>\n remainder.add(unicodeChar),\n );\n return Array.from(remainder);\n};\n"],"names":["GSM_STANDARD_CHARS","GSM_EXTENDED_CHARS","APOSTROPHES_TO_REPLACE","doesNotContainUnicodeChars","text","findUnicodeChars","remainder","difference","unicodeChar"],"mappings":"4DAEO,MAAMA,EAAqB,CAChC,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KACA;AAAA,EACA,IACA,GACF,EAEaC,EAAqB,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAI,EAEzEC,EAAyB,IAAI,OAAO,cAAc,EAE3CC,EAA8BC,GAClCC,EAAiBD,CAAI,EAAE,SAAW,EAG9BC,EAAoBD,GAA2B,CACpD,MAAAE,MAAgB,IACtBC,OAAAA,EAAAA,WAAW,CAAC,GAAGH,EAAK,QAAQF,EAAwB,GAAG,CAAC,EAAG,CAAC,GAAGF,EAAoB,GAAGC,CAAkB,CAAC,EAAE,QAAQO,GACjHF,EAAU,IAAIE,CAAW,CAAA,EAEpB,MAAM,KAAKF,CAAS,CAC7B"}
1
+ {"version":3,"file":"unicodeCharsRule.esm.js","sources":["../../src/forms/unicodeCharsRule.ts"],"sourcesContent":["import { difference } from 'lodash';\n\nexport const GSM_STANDARD_CHARS = [\n '@',\n '0',\n '¡',\n 'P',\n '¿',\n 'p',\n '£',\n '_',\n '!',\n '1',\n 'A',\n 'Q',\n 'a',\n 'q',\n '$',\n '\"',\n '2',\n 'B',\n 'R',\n 'b',\n 'r',\n '¥',\n '?',\n '#',\n '3',\n 'C',\n 'S',\n 'c',\n 's',\n 'è',\n '?',\n '4',\n 'D',\n 'T',\n 'd',\n 't',\n 'é',\n '?',\n '%',\n '5',\n 'E',\n 'U',\n 'e',\n 'u',\n 'ù',\n '6',\n 'F',\n 'V',\n 'f',\n 'v',\n 'ì',\n '?',\n \"'\",\n '7',\n 'G',\n 'W',\n 'g',\n 'w',\n 'ò',\n '(',\n '8',\n 'H',\n 'X',\n 'h',\n 'x',\n 'Ç',\n ')',\n '9',\n 'I',\n 'Y',\n 'i',\n 'y',\n '*',\n ':',\n 'J',\n 'Z',\n 'j',\n 'z',\n 'Ø',\n '+',\n ';',\n 'K',\n 'Ä',\n 'k',\n 'ä',\n 'Æ',\n ',',\n '<',\n 'L',\n 'l',\n 'ö',\n 'æ',\n '-',\n '=',\n 'M',\n 'Ñ',\n 'm',\n 'ñ',\n 'Å',\n 'ß',\n '.',\n '>',\n 'N',\n 'Ü',\n 'n',\n 'ü',\n 'å',\n 'É',\n '/',\n 'O',\n '§',\n 'o',\n 'à',\n 'Δ',\n 'Φ',\n 'Γ',\n 'Λ',\n 'Ω',\n 'Π',\n 'Ψ',\n 'Σ',\n 'Θ',\n 'Ξ',\n 'Ö',\n 'Ä',\n 'Ü',\n 'ø',\n ' ',\n '\\r',\n '\\n',\n '¤',\n '&',\n];\n\nexport const GSM_EXTENDED_CHARS = ['|', '^', '€', '{', '}', '[', ']', '~', '\\\\'];\n\nconst APOSTROPHES_TO_REPLACE = new RegExp(/ʻ|ʼ|ʽ|ˊ|ˋ|’/g);\n\nexport const doesNotContainUnicodeChars = (text: string) => {\n return findUnicodeChars(text).length === 0;\n};\n\nexport const findUnicodeChars = (text: string): string[] => {\n const remainder = new Set<string>();\n difference([...text.replace(APOSTROPHES_TO_REPLACE, \"'\")], [...GSM_STANDARD_CHARS, ...GSM_EXTENDED_CHARS]).forEach(unicodeChar =>\n remainder.add(unicodeChar),\n );\n return Array.from(remainder);\n};\n"],"names":["GSM_STANDARD_CHARS","GSM_EXTENDED_CHARS","APOSTROPHES_TO_REPLACE","doesNotContainUnicodeChars","text","findUnicodeChars","remainder","difference","unicodeChar"],"mappings":"yDAEO,MAAMA,EAAqB,CAChC,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KACA;AAAA,EACA,IACA,GACF,EAEaC,EAAqB,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAI,EAEzEC,EAAyB,IAAI,OAAO,cAAc,EAE3CC,EAA8BC,GAClCC,EAAiBD,CAAI,EAAE,SAAW,EAG9BC,EAAoBD,GAA2B,CACpD,MAAAE,MAAgB,IACtBC,OAAAA,EAAAA,WAAW,CAAC,GAAGH,EAAK,QAAQF,EAAwB,GAAG,CAAC,EAAG,CAAC,GAAGF,EAAoB,GAAGC,CAAkB,CAAC,EAAE,QAAQO,GACjHF,EAAU,IAAIE,CAAW,CAAA,EAEpB,MAAM,KAAKF,CAAS,CAC7B"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../node_modules/luxon/src/datetime.cjs.js");require("../../node_modules/luxon/src/duration.cjs.js");const s=require("../../node_modules/codice-fiscale-js/dist/codice.fiscale.commonjs2.cjs.js"),a="imported-notes",c=e=>!!e.prefixIcon||!!e.semiboldText,l=(e,t)=>{if(!t)return null;const n=t.split("_");let r="";return n.forEach(o=>{r+=o[0]+o.substring(1).toLowerCase()}),e[r]},u=e=>{const t=e.toString();return t.length>2?t.substring(0,t.length-2)+","+t.substring(t.length-2,t.length):e===0?"0":"0,"+t},f=e=>(e??[]).filter(t=>t!=null&&!(t instanceof Error)),g=(e,t)=>{fetch(e).then(n=>n.blob()).then(n=>{const r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,r.click()}).catch(n=>{console.error(n)})},d=e=>{if(typeof e=="string"&&(e=parseInt(e)),!e)return"/";const t=i.default.fromSeconds(e).toLocal();switch(t.diffNow("days").days){case-1:return"Ieri";case 0:return"Oggi";case 1:return"Domani";default:return t.toLocaleString(i.default.DATE_MED)}},m=(e,t)=>(t||(t=i.default.DATETIME_MED),typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),i.default.fromSeconds(e).toLocaleString(t)),E=(e,t)=>{if(typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),!e)return"/";const n=i.default.fromSeconds(e);if(t){if(n.minute===0)return String(n.hour);{const r=String(n.minute);return n.hour+":"+(r.length===1?"0"+r:r)}}return t&&n.minute===0?String(n.hour):n.toLocaleString(i.default.TIME_24_SIMPLE)},S=e=>new RegExp(/^\+[1-9]\d{1,14}$/).test(e),T=/^\d{11}$/,b=/^3\d{15}$/,R=/^STP\d{13}$/,h=/^ENI\d{13}$/,p=e=>e?s.default.check(e)||T.test(e)||b.test(e)||R.test(e)||h.test(e):!0,D=e=>/^\d{6}\.\d{9}\.\d{4}\.\d+$/.test(e),_=e=>e?/^[0-9]+([.,][0-9]+)?$/.test(e):!0;exports.IMPORTED_NOTES_BUS=a;exports.cleanArray=f;exports.currencyToReadableString=u;exports.downloadFileViaUrl=g;exports.getEnumFromString=l;exports.getReadableDate=d;exports.getReadableDateTime=m;exports.getReadableTime=E;exports.isAutocompleteOptionType=c;exports.isValidDecimal=_;exports.isValidPaiCode=D;exports.isValidPhoneNumber=S;exports.isValidTaxCode=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../node_modules/luxon/src/datetime.cjs.js");require("../node_modules/luxon/src/duration.cjs.js");const s=require("../node_modules/codice-fiscale-js/dist/codice.fiscale.commonjs2.cjs.js"),a="imported-notes",c=e=>!!e.prefixIcon||!!e.semiboldText,l=(e,t)=>{if(!t)return null;const n=t.split("_");let r="";return n.forEach(o=>{r+=o[0]+o.substring(1).toLowerCase()}),e[r]},u=e=>{const t=e.toString();return t.length>2?t.substring(0,t.length-2)+","+t.substring(t.length-2,t.length):e===0?"0":"0,"+t},f=e=>(e??[]).filter(t=>t!=null&&!(t instanceof Error)),g=(e,t)=>{fetch(e).then(n=>n.blob()).then(n=>{const r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,r.click()}).catch(n=>{console.error(n)})},d=e=>{if(typeof e=="string"&&(e=parseInt(e)),!e)return"/";const t=i.default.fromSeconds(e).toLocal();switch(t.diffNow("days").days){case-1:return"Ieri";case 0:return"Oggi";case 1:return"Domani";default:return t.toLocaleString(i.default.DATE_MED)}},m=(e,t)=>(t||(t=i.default.DATETIME_MED),typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),i.default.fromSeconds(e).toLocaleString(t)),E=(e,t)=>{if(typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),!e)return"/";const n=i.default.fromSeconds(e);if(t){if(n.minute===0)return String(n.hour);{const r=String(n.minute);return n.hour+":"+(r.length===1?"0"+r:r)}}return t&&n.minute===0?String(n.hour):n.toLocaleString(i.default.TIME_24_SIMPLE)},S=e=>new RegExp(/^\+[1-9]\d{1,14}$/).test(e),T=/^\d{11}$/,b=/^3\d{15}$/,R=/^STP\d{13}$/,h=/^ENI\d{13}$/,p=e=>e?s.default.check(e)||T.test(e)||b.test(e)||R.test(e)||h.test(e):!0,D=e=>/^\d{6}\.\d{9}\.\d{4}\.\d+$/.test(e),_=e=>e?/^[0-9]+([.,][0-9]+)?$/.test(e):!0;exports.IMPORTED_NOTES_BUS=a;exports.cleanArray=f;exports.currencyToReadableString=u;exports.downloadFileViaUrl=g;exports.getEnumFromString=l;exports.getReadableDate=d;exports.getReadableDateTime=m;exports.getReadableTime=E;exports.isAutocompleteOptionType=c;exports.isValidDecimal=_;exports.isValidPaiCode=D;exports.isValidPhoneNumber=S;exports.isValidTaxCode=p;
2
2
  //# sourceMappingURL=utils.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs.js","sources":["../../../src/forms/utils.ts"],"sourcesContent":["import * as outlineIcons from '@heroicons/vue/24/outline';\nimport { OptionType } from '@/types';\nimport { DateTime } from 'luxon';\nimport CodiceFiscale from 'codice-fiscale-js';\n\nexport type IconNames = keyof typeof outlineIcons;\nexport type BadgeColor =\n | 'blue'\n | 'yellow'\n | 'red'\n | 'green'\n | 'gray'\n | 'pink'\n | 'lightPurple'\n | 'lightBlue'\n | 'grayBgWhiteText'\n | 'redBgWhiteText'\n | 'primaryBgWhiteText'\n | 'redBorder'\n | 'purpleBorder'\n | 'blueBorder'\n | 'greenBorder'\n | 'yellowBorder'\n | 'lightBlueBgPrimaryText'\n | 'lightGrayBgWhiteText';\n\nexport type BannerColor = 'yellow' | 'red' | 'primary' | 'gray';\nexport type BadgeLabel = 'Rossa Dem' | 'Rossa' | 'Bianca' | 'Bianca Dem' | 'Cronica' | 'Ordinaria' | 'RMR';\nexport const IMPORTED_NOTES_BUS = 'imported-notes';\n\nexport type AutocompleteOptionType = OptionType & {\n prefixIcon?: {\n name?: IconNames;\n isSolid?: boolean;\n };\n semiboldText?: string;\n};\n\nexport const isAutocompleteOptionType = (o: any): o is AutocompleteOptionType => {\n return !!o.prefixIcon || !!o.semiboldText;\n};\n\nexport const getEnumFromString = <T>(type: any, str: string | null): T[keyof T] | null => {\n if (!str) return null;\n const strings = str.split('_');\n let casted = '';\n strings.forEach(element => {\n casted += element[0] + element.substring(1).toLowerCase();\n });\n return type[casted];\n};\n\nexport const currencyToReadableString = (n: number) => {\n const curr = n.toString();\n if (curr.length > 2) {\n return curr.substring(0, curr.length - 2) + ',' + curr.substring(curr.length - 2, curr.length);\n } else if (n === 0) {\n return '0';\n } else {\n return '0,' + curr;\n }\n};\nexport const cleanArray = <T>(arrayObj: (T | null | undefined | Error)[] | undefined | null): T[] =>\n (arrayObj ?? []).filter((x): x is T => x !== null && x !== undefined && !(x instanceof Error));\n\nexport const downloadFileViaUrl = (url: string, filename: string) => {\n fetch(url)\n .then(response => response.blob())\n .then(blob => {\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n link.download = filename;\n link.click();\n })\n .catch(err => {\n console.error(err);\n });\n};\n\nexport const getReadableDate = (d: number) => {\n if (typeof d === 'string') {\n d = parseInt(d);\n }\n if (!d) return '/';\n const inputDate = DateTime.fromSeconds(d).toLocal();\n switch (inputDate.diffNow('days').days) {\n case -1:\n return 'Ieri';\n case 0:\n return 'Oggi';\n case 1:\n return 'Domani';\n default:\n return inputDate.toLocaleString(DateTime.DATE_MED);\n }\n};\n\nexport const getReadableDateTime = (d: number | string | Date, dateTimeFormatOptions?: Intl.DateTimeFormatOptions) => {\n if (!dateTimeFormatOptions) {\n dateTimeFormatOptions = DateTime.DATETIME_MED;\n }\n if (typeof d === 'string') {\n d = parseInt(d);\n } else if (d instanceof Date) {\n d = d.getTime() / 1000;\n }\n return DateTime.fromSeconds(d).toLocaleString(dateTimeFormatOptions);\n};\n\nexport const getReadableTime = (\n d: number | string | Date,\n shortify?: boolean, // if true, hour like 11:00 becomes simply 11, and 09:30 becomes 9:30\n): string => {\n if (typeof d === 'string') {\n d = parseInt(d);\n } else if (d instanceof Date) {\n d = d.getTime() / 1000;\n }\n if (!d) return '/';\n\n const dateTime = DateTime.fromSeconds(d);\n if (shortify) {\n if (dateTime.minute === 0) {\n return String(dateTime.hour);\n } else {\n const minute = String(dateTime.minute);\n return dateTime.hour + ':' + (minute.length === 1 ? '0' + minute : minute);\n }\n }\n if (shortify && dateTime.minute === 0) {\n return String(dateTime.hour);\n } else {\n return dateTime.toLocaleString(DateTime.TIME_24_SIMPLE);\n }\n};\n\nexport const isValidPhoneNumber = (phoneNumber: string) => {\n const PHONE_NUMBER_REGEX = new RegExp(/^\\+[1-9]\\d{1,14}$/);\n return PHONE_NUMBER_REGEX.test(phoneNumber);\n};\n\nconst MEF_11 = /^\\d{11}$/;\nconst NAR = /^3\\d{15}$/;\nconst STP = /^STP\\d{13}$/;\nconst ENI = /^ENI\\d{13}$/;\n\n/* taxCode has to take into account other formats used by temporary IDs or similar scenarios. Specifically:\nMEF16: AAAAAANNANNANNNA (normal taxCode)\nMEF11: NNNNNNNNNNN\nNAR: 3NNNNNNNNNNNNNNN\nSTP: STPNNNNNNNNNNNNN\nENI: ENINNNNNNNNNNNNN\n*/\n\nexport const isValidTaxCode = (taxCode: string): boolean => {\n if (!taxCode) return true;\n return CodiceFiscale.check(taxCode) || MEF_11.test(taxCode) || NAR.test(taxCode) || STP.test(taxCode) || ENI.test(taxCode);\n};\n\nexport const isValidPaiCode = (paiCode: string): boolean => {\n return /^\\d{6}\\.\\d{9}\\.\\d{4}\\.\\d+$/.test(paiCode);\n};\n\nexport const isValidDecimal = (value: string) => {\n if (!value) return true;\n return /^[0-9]+([.,][0-9]+)?$/.test(value);\n};\n"],"names":["IMPORTED_NOTES_BUS","isAutocompleteOptionType","o","getEnumFromString","type","str","strings","casted","element","currencyToReadableString","n","curr","cleanArray","arrayObj","x","downloadFileViaUrl","url","filename","response","blob","link","err","getReadableDate","d","inputDate","DateTime","getReadableDateTime","dateTimeFormatOptions","getReadableTime","shortify","dateTime","minute","isValidPhoneNumber","phoneNumber","MEF_11","NAR","STP","ENI","isValidTaxCode","taxCode","CodiceFiscale","isValidPaiCode","paiCode","isValidDecimal","value"],"mappings":"qSA4BaA,EAAqB,iBAUrBC,EAA4BC,GAChC,CAAC,CAACA,EAAE,YAAc,CAAC,CAACA,EAAE,aAGlBC,EAAoB,CAAIC,EAAWC,IAA0C,CACxF,GAAI,CAACA,EAAY,OAAA,KACX,MAAAC,EAAUD,EAAI,MAAM,GAAG,EAC7B,IAAIE,EAAS,GACb,OAAAD,EAAQ,QAAmBE,GAAA,CACzBD,GAAUC,EAAQ,CAAC,EAAIA,EAAQ,UAAU,CAAC,EAAE,aAAY,CACzD,EACMJ,EAAKG,CAAM,CACpB,EAEaE,EAA4BC,GAAc,CAC/C,MAAAC,EAAOD,EAAE,WACX,OAAAC,EAAK,OAAS,EACTA,EAAK,UAAU,EAAGA,EAAK,OAAS,CAAC,EAAI,IAAMA,EAAK,UAAUA,EAAK,OAAS,EAAGA,EAAK,MAAM,EACpFD,IAAM,EACR,IAEA,KAAOC,CAElB,EACaC,EAAiBC,IAC3BA,GAAY,CAAI,GAAA,OAAQC,GAAcA,GAAM,MAA2B,EAAEA,aAAa,MAAM,EAElFC,EAAqB,CAACC,EAAaC,IAAqB,CAC7D,MAAAD,CAAG,EACN,KAAKE,GAAYA,EAAS,MAAM,EAChC,KAAaC,GAAA,CACN,MAAAC,EAAO,SAAS,cAAc,GAAG,EAClCA,EAAA,KAAO,IAAI,gBAAgBD,CAAI,EACpCC,EAAK,SAAWH,EAChBG,EAAK,MAAM,CAAA,CACZ,EACA,MAAaC,GAAA,CACZ,QAAQ,MAAMA,CAAG,CAAA,CAClB,CACL,EAEaC,EAAmBC,GAAc,CAI5C,GAHI,OAAOA,GAAM,WACfA,EAAI,SAASA,CAAC,GAEZ,CAACA,EAAU,MA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B,6BAA6B,KAAKA,CAAO,EAGrCC,EAAkBC,GACxBA,EACE,wBAAwB,KAAKA,CAAK,EADtB"}
1
+ {"version":3,"file":"utils.cjs.js","sources":["../../src/forms/utils.ts"],"sourcesContent":["import * as outlineIcons from '@heroicons/vue/24/outline';\nimport { OptionType } from '@/types';\nimport { DateTime } from 'luxon';\nimport CodiceFiscale from 'codice-fiscale-js';\n\nexport type IconNames = keyof typeof outlineIcons;\nexport type BadgeColor =\n | 'blue'\n | 'yellow'\n | 'red'\n | 'green'\n | 'gray'\n | 'pink'\n | 'lightPurple'\n | 'lightBlue'\n | 'grayBgWhiteText'\n | 'redBgWhiteText'\n | 'primaryBgWhiteText'\n | 'redBorder'\n | 'purpleBorder'\n | 'blueBorder'\n | 'greenBorder'\n | 'yellowBorder'\n | 'lightBlueBgPrimaryText'\n | 'lightGrayBgWhiteText';\n\nexport type BannerColor = 'yellow' | 'red' | 'primary' | 'gray';\nexport type BadgeLabel = 'Rossa Dem' | 'Rossa' | 'Bianca' | 'Bianca Dem' | 'Cronica' | 'Ordinaria' | 'RMR';\nexport const IMPORTED_NOTES_BUS = 'imported-notes';\n\nexport type AutocompleteOptionType = OptionType & {\n prefixIcon?: {\n name?: IconNames;\n isSolid?: boolean;\n };\n semiboldText?: string;\n};\n\nexport const isAutocompleteOptionType = (o: any): o is AutocompleteOptionType => {\n return !!o.prefixIcon || !!o.semiboldText;\n};\n\nexport const getEnumFromString = <T>(type: any, str: string | null): T[keyof T] | null => {\n if (!str) return null;\n const strings = str.split('_');\n let casted = '';\n strings.forEach(element => {\n casted += element[0] + element.substring(1).toLowerCase();\n });\n return type[casted];\n};\n\nexport const currencyToReadableString = (n: number) => {\n const curr = n.toString();\n if (curr.length > 2) {\n return curr.substring(0, curr.length - 2) + ',' + curr.substring(curr.length - 2, curr.length);\n } else if (n === 0) {\n return '0';\n } else {\n return '0,' + curr;\n }\n};\nexport const cleanArray = <T>(arrayObj: (T | null | undefined | Error)[] | undefined | null): T[] =>\n (arrayObj ?? []).filter((x): x is T => x !== null && x !== undefined && !(x instanceof Error));\n\nexport const downloadFileViaUrl = (url: string, filename: string) => {\n fetch(url)\n .then(response => response.blob())\n .then(blob => {\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n link.download = filename;\n link.click();\n })\n .catch(err => {\n console.error(err);\n });\n};\n\nexport const getReadableDate = (d: number) => {\n if (typeof d === 'string') {\n d = parseInt(d);\n }\n if (!d) return '/';\n const inputDate = DateTime.fromSeconds(d).toLocal();\n switch (inputDate.diffNow('days').days) {\n case -1:\n return 'Ieri';\n case 0:\n return 'Oggi';\n case 1:\n return 'Domani';\n default:\n return inputDate.toLocaleString(DateTime.DATE_MED);\n }\n};\n\nexport const getReadableDateTime = (d: number | string | Date, dateTimeFormatOptions?: Intl.DateTimeFormatOptions) => {\n if (!dateTimeFormatOptions) {\n dateTimeFormatOptions = DateTime.DATETIME_MED;\n }\n if (typeof d === 'string') {\n d = parseInt(d);\n } else if (d instanceof Date) {\n d = d.getTime() / 1000;\n }\n return DateTime.fromSeconds(d).toLocaleString(dateTimeFormatOptions);\n};\n\nexport const getReadableTime = (\n d: number | string | Date,\n shortify?: boolean, // if true, hour like 11:00 becomes simply 11, and 09:30 becomes 9:30\n): string => {\n if (typeof d === 'string') {\n d = parseInt(d);\n } else if (d instanceof Date) {\n d = d.getTime() / 1000;\n }\n if (!d) return '/';\n\n const dateTime = DateTime.fromSeconds(d);\n if (shortify) {\n if (dateTime.minute === 0) {\n return String(dateTime.hour);\n } else {\n const minute = String(dateTime.minute);\n return dateTime.hour + ':' + (minute.length === 1 ? '0' + minute : minute);\n }\n }\n if (shortify && dateTime.minute === 0) {\n return String(dateTime.hour);\n } else {\n return dateTime.toLocaleString(DateTime.TIME_24_SIMPLE);\n }\n};\n\nexport const isValidPhoneNumber = (phoneNumber: string) => {\n const PHONE_NUMBER_REGEX = new RegExp(/^\\+[1-9]\\d{1,14}$/);\n return PHONE_NUMBER_REGEX.test(phoneNumber);\n};\n\nconst MEF_11 = /^\\d{11}$/;\nconst NAR = /^3\\d{15}$/;\nconst STP = /^STP\\d{13}$/;\nconst ENI = /^ENI\\d{13}$/;\n\n/* taxCode has to take into account other formats used by temporary IDs or similar scenarios. Specifically:\nMEF16: AAAAAANNANNANNNA (normal taxCode)\nMEF11: NNNNNNNNNNN\nNAR: 3NNNNNNNNNNNNNNN\nSTP: STPNNNNNNNNNNNNN\nENI: ENINNNNNNNNNNNNN\n*/\n\nexport const isValidTaxCode = (taxCode: string): boolean => {\n if (!taxCode) return true;\n return CodiceFiscale.check(taxCode) || MEF_11.test(taxCode) || NAR.test(taxCode) || STP.test(taxCode) || ENI.test(taxCode);\n};\n\nexport const isValidPaiCode = (paiCode: string): boolean => {\n return /^\\d{6}\\.\\d{9}\\.\\d{4}\\.\\d+$/.test(paiCode);\n};\n\nexport const isValidDecimal = (value: string) => {\n if (!value) return true;\n return /^[0-9]+([.,][0-9]+)?$/.test(value);\n};\n"],"names":["IMPORTED_NOTES_BUS","isAutocompleteOptionType","o","getEnumFromString","type","str","strings","casted","element","currencyToReadableString","n","curr","cleanArray","arrayObj","x","downloadFileViaUrl","url","filename","response","blob","link","err","getReadableDate","d","inputDate","DateTime","getReadableDateTime","dateTimeFormatOptions","getReadableTime","shortify","dateTime","minute","isValidPhoneNumber","phoneNumber","MEF_11","NAR","STP","ENI","isValidTaxCode","taxCode","CodiceFiscale","isValidPaiCode","paiCode","isValidDecimal","value"],"mappings":"4RA4BaA,EAAqB,iBAUrBC,EAA4BC,GAChC,CAAC,CAACA,EAAE,YAAc,CAAC,CAACA,EAAE,aAGlBC,EAAoB,CAAIC,EAAWC,IAA0C,CACxF,GAAI,CAACA,EAAY,OAAA,KACX,MAAAC,EAAUD,EAAI,MAAM,GAAG,EAC7B,IAAIE,EAAS,GACb,OAAAD,EAAQ,QAAmBE,GAAA,CACzBD,GAAUC,EAAQ,CAAC,EAAIA,EAAQ,UAAU,CAAC,EAAE,aAAY,CACzD,EACMJ,EAAKG,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a,OAClBA,EAAAA,EAAE,QAAY,EAAA,KAEhB,CAACA,EAAU,MAAA,IAET,MAAAO,EAAWL,EAAAA,QAAS,YAAYF,CAAC,EACvC,GAAIM,EAAU,CACR,GAAAC,EAAS,SAAW,EACf,OAAA,OAAOA,EAAS,IAAI,EACtB,CACC,MAAAC,EAAS,OAAOD,EAAS,MAAM,EACrC,OAAOA,EAAS,KAAO,KAAOC,EAAO,SAAW,EAAI,IAAMA,EAASA,EACrE,CACF,CACI,OAAAF,GAAYC,EAAS,SAAW,EAC3B,OAAOA,EAAS,IAAI,EAEpBA,EAAS,eAAeL,EAAA,QAAS,cAAc,CAE1D,EAEaO,EAAsBC,GACN,IAAI,OAAO,mBAAmB,EAC/B,KAAKA,CAAW,EAGtCC,EAAS,WACTC,EAAM,YACNC,EAAM,cACNC,EAAM,cAUCC,EAAkBC,GACxBA,EACEC,EAAAA,QAAc,MAAMD,CAAO,GAAKL,EAAO,KAAKK,CAAO,GAAKJ,EAAI,KAAKI,CAAO,GAAKH,EAAI,KAAKG,CAAO,GAAKF,EAAI,KAAKE,CAAO,EADpG,GAIVE,EAAkBC,GACtB,6BAA6B,KAAKA,CAAO,EAGrCC,EAAkBC,GACxBA,EACE,wBAAwB,KAAKA,CAAK,EADtB"}
@@ -1,2 +1,2 @@
1
- import i from"../../node_modules/luxon/src/datetime.esm.js";import"../../node_modules/luxon/src/duration.esm.js";import s from"../../node_modules/codice-fiscale-js/dist/codice.fiscale.commonjs2.esm.js";const m="imported-notes",S=e=>!!e.prefixIcon||!!e.semiboldText,h=(e,t)=>{if(!t)return null;const n=t.split("_");let r="";return n.forEach(o=>{r+=o[0]+o.substring(1).toLowerCase()}),e[r]},p=e=>{const t=e.toString();return t.length>2?t.substring(0,t.length-2)+","+t.substring(t.length-2,t.length):e===0?"0":"0,"+t},T=e=>(e??[]).filter(t=>t!=null&&!(t instanceof Error)),d=(e,t)=>{fetch(e).then(n=>n.blob()).then(n=>{const r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,r.click()}).catch(n=>{console.error(n)})},D=e=>{if(typeof e=="string"&&(e=parseInt(e)),!e)return"/";const t=i.fromSeconds(e).toLocal();switch(t.diffNow("days").days){case-1:return"Ieri";case 0:return"Oggi";case 1:return"Domani";default:return t.toLocaleString(i.DATE_MED)}},R=(e,t)=>(t||(t=i.DATETIME_MED),typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),i.fromSeconds(e).toLocaleString(t)),b=(e,t)=>{if(typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),!e)return"/";const n=i.fromSeconds(e);if(t){if(n.minute===0)return String(n.hour);{const r=String(n.minute);return n.hour+":"+(r.length===1?"0"+r:r)}}return t&&n.minute===0?String(n.hour):n.toLocaleString(i.TIME_24_SIMPLE)},_=e=>new RegExp(/^\+[1-9]\d{1,14}$/).test(e),c=/^\d{11}$/,u=/^3\d{15}$/,l=/^STP\d{13}$/,a=/^ENI\d{13}$/,I=e=>e?s.check(e)||c.test(e)||u.test(e)||l.test(e)||a.test(e):!0,N=e=>/^\d{6}\.\d{9}\.\d{4}\.\d+$/.test(e),M=e=>e?/^[0-9]+([.,][0-9]+)?$/.test(e):!0;export{m as IMPORTED_NOTES_BUS,T as cleanArray,p as currencyToReadableString,d as downloadFileViaUrl,h as getEnumFromString,D as getReadableDate,R as getReadableDateTime,b as getReadableTime,S as isAutocompleteOptionType,M as isValidDecimal,N as isValidPaiCode,_ as isValidPhoneNumber,I as isValidTaxCode};
1
+ import i from"../node_modules/luxon/src/datetime.esm.js";import"../node_modules/luxon/src/duration.esm.js";import s from"../node_modules/codice-fiscale-js/dist/codice.fiscale.commonjs2.esm.js";const m="imported-notes",S=e=>!!e.prefixIcon||!!e.semiboldText,h=(e,t)=>{if(!t)return null;const n=t.split("_");let r="";return n.forEach(o=>{r+=o[0]+o.substring(1).toLowerCase()}),e[r]},p=e=>{const t=e.toString();return t.length>2?t.substring(0,t.length-2)+","+t.substring(t.length-2,t.length):e===0?"0":"0,"+t},T=e=>(e??[]).filter(t=>t!=null&&!(t instanceof Error)),d=(e,t)=>{fetch(e).then(n=>n.blob()).then(n=>{const r=document.createElement("a");r.href=URL.createObjectURL(n),r.download=t,r.click()}).catch(n=>{console.error(n)})},D=e=>{if(typeof e=="string"&&(e=parseInt(e)),!e)return"/";const t=i.fromSeconds(e).toLocal();switch(t.diffNow("days").days){case-1:return"Ieri";case 0:return"Oggi";case 1:return"Domani";default:return t.toLocaleString(i.DATE_MED)}},R=(e,t)=>(t||(t=i.DATETIME_MED),typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),i.fromSeconds(e).toLocaleString(t)),b=(e,t)=>{if(typeof e=="string"?e=parseInt(e):e instanceof Date&&(e=e.getTime()/1e3),!e)return"/";const n=i.fromSeconds(e);if(t){if(n.minute===0)return String(n.hour);{const r=String(n.minute);return n.hour+":"+(r.length===1?"0"+r:r)}}return t&&n.minute===0?String(n.hour):n.toLocaleString(i.TIME_24_SIMPLE)},_=e=>new RegExp(/^\+[1-9]\d{1,14}$/).test(e),c=/^\d{11}$/,u=/^3\d{15}$/,l=/^STP\d{13}$/,a=/^ENI\d{13}$/,I=e=>e?s.check(e)||c.test(e)||u.test(e)||l.test(e)||a.test(e):!0,N=e=>/^\d{6}\.\d{9}\.\d{4}\.\d+$/.test(e),M=e=>e?/^[0-9]+([.,][0-9]+)?$/.test(e):!0;export{m as IMPORTED_NOTES_BUS,T as cleanArray,p as currencyToReadableString,d as downloadFileViaUrl,h as getEnumFromString,D as getReadableDate,R as getReadableDateTime,b as getReadableTime,S as isAutocompleteOptionType,M as isValidDecimal,N as isValidPaiCode,_ as isValidPhoneNumber,I as isValidTaxCode};
2
2
  //# sourceMappingURL=utils.esm.js.map