@leaflink/stash 51.9.3 → 51.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/assets/icons/cloud-share.svg +1 -0
  2. package/assets/spritesheet.svg +1 -1
  3. package/dist/Accordion.js.map +1 -1
  4. package/dist/Accordion.vue.d.ts +7 -38
  5. package/dist/ActionsDropdown.js +2 -2
  6. package/dist/ActionsDropdown.js.map +1 -1
  7. package/dist/ActionsDropdown.vue.d.ts +0 -74
  8. package/dist/AddressSelect.js +56 -60
  9. package/dist/AddressSelect.js.map +1 -1
  10. package/dist/AddressSelect.vue.d.ts +8 -65
  11. package/dist/Alert.js.map +1 -1
  12. package/dist/Alert.vue.d.ts +4 -41
  13. package/dist/AppNavigationItem.js.map +1 -1
  14. package/dist/AppNavigationItem.vue.d.ts +5 -32
  15. package/dist/AppSidebar.js.map +1 -1
  16. package/dist/AppSidebar.vue.d.ts +8 -35
  17. package/dist/AppTopbar.js +1 -1
  18. package/dist/AppTopbar.js.map +1 -1
  19. package/dist/AppTopbar.vue.d.ts +4 -33
  20. package/dist/Avatar.js.map +1 -1
  21. package/dist/Avatar.vue.d.ts +5 -44
  22. package/dist/Backdrop.js.map +1 -1
  23. package/dist/Backdrop.vue.d.ts +1 -1
  24. package/dist/Badge.js.map +1 -1
  25. package/dist/Badge.vue.d.ts +6 -55
  26. package/dist/Box.vue.d.ts +3 -36
  27. package/dist/Box.vue_vue_type_script_setup_true_lang-rFnvwLVY.js.map +1 -1
  28. package/dist/Button.js.map +1 -1
  29. package/dist/Button.vue.d.ts +5 -50
  30. package/dist/ButtonGroup.js +33 -37
  31. package/dist/ButtonGroup.js.map +1 -1
  32. package/dist/ButtonGroup.vue.d.ts +6 -39
  33. package/dist/Card.js.map +1 -1
  34. package/dist/Card.vue.d.ts +5 -32
  35. package/dist/CardContent.js.map +1 -1
  36. package/dist/CardContent.vue.d.ts +1 -1
  37. package/dist/CardFooter.js.map +1 -1
  38. package/dist/CardFooter.vue.d.ts +1 -1
  39. package/dist/CardHeader.js.map +1 -1
  40. package/dist/CardHeader.vue.d.ts +2 -15
  41. package/dist/CardMedia.js.map +1 -1
  42. package/dist/CardMedia.vue.d.ts +2 -15
  43. package/dist/Carousel.js +66 -72
  44. package/dist/Carousel.js.map +1 -1
  45. package/dist/Carousel.vue.d.ts +10 -10
  46. package/dist/Checkbox.js.map +1 -1
  47. package/dist/Checkbox.vue.d.ts +8 -53
  48. package/dist/ChevronToggle.vue.d.ts +7 -34
  49. package/dist/ChevronToggle.vue_vue_type_script_setup_true_lang-Ce_qOXfR.js.map +1 -1
  50. package/dist/Chip.js.map +1 -1
  51. package/dist/Chip.vue.d.ts +10 -52
  52. package/dist/ConfirmationCodeInput.js +40 -44
  53. package/dist/ConfirmationCodeInput.js.map +1 -1
  54. package/dist/ConfirmationCodeInput.vue.d.ts +8 -43
  55. package/dist/ContextSwitcher.js.map +1 -1
  56. package/dist/ContextSwitcher.vue.d.ts +6 -41
  57. package/dist/Copy.js.map +1 -1
  58. package/dist/Copy.vue.d.ts +3 -34
  59. package/dist/CurrencyInput.js +20 -21
  60. package/dist/CurrencyInput.js.map +1 -1
  61. package/dist/CurrencyInput.vue.d.ts +125 -46
  62. package/dist/CustomRender.js.map +1 -1
  63. package/dist/DataView.js +94 -96
  64. package/dist/DataView.js.map +1 -1
  65. package/dist/DataView.keys-aSOnA4AD.js.map +1 -1
  66. package/dist/DataView.vue.d.ts +15 -57
  67. package/dist/DataViewFilters.js +127 -139
  68. package/dist/DataViewFilters.js.map +1 -1
  69. package/dist/DataViewFilters.keys-BLu07FiP.js.map +1 -1
  70. package/dist/DataViewFilters.vue.d.ts +9 -54
  71. package/dist/DataViewSortButton.js +2 -2
  72. package/dist/DataViewSortButton.js.map +1 -1
  73. package/dist/DataViewSortButton.vue.d.ts +3 -30
  74. package/dist/DataViewToolbar.js +70 -62
  75. package/dist/DataViewToolbar.js.map +1 -1
  76. package/dist/DataViewToolbar.vue.d.ts +5 -40
  77. package/dist/DatePicker.js +4524 -4636
  78. package/dist/DatePicker.js.map +1 -1
  79. package/dist/DatePicker.vue.d.ts +32 -81
  80. package/dist/DescriptionList.js.map +1 -1
  81. package/dist/DescriptionList.vue.d.ts +3 -32
  82. package/dist/DescriptionListDetail.js.map +1 -1
  83. package/dist/DescriptionListDetail.vue.d.ts +1 -1
  84. package/dist/DescriptionListGroup.js.map +1 -1
  85. package/dist/DescriptionListGroup.vue.d.ts +1 -1
  86. package/dist/DescriptionListTerm.js.map +1 -1
  87. package/dist/DescriptionListTerm.vue.d.ts +1 -1
  88. package/dist/Dialog.js.map +1 -1
  89. package/dist/Dialog.vue.d.ts +10 -53
  90. package/dist/Divider.js.map +1 -1
  91. package/dist/Dropdown.js +89 -95
  92. package/dist/Dropdown.js.map +1 -1
  93. package/dist/Dropdown.vue.d.ts +12 -48
  94. package/dist/EmptyState.js +1 -1
  95. package/dist/EmptyState.js.map +1 -1
  96. package/dist/EmptyState.vue.d.ts +5 -62
  97. package/dist/Expand.vue.d.ts +10 -40
  98. package/dist/Expand.vue_vue_type_script_setup_true_lang-CiONJfAp.js.map +1 -1
  99. package/dist/Field.vue.d.ts +4 -53
  100. package/dist/Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js.map +1 -1
  101. package/dist/FileUpload.js +72 -74
  102. package/dist/FileUpload.js.map +1 -1
  103. package/dist/FileUpload.vue.d.ts +10 -44
  104. package/dist/FilterChip.js.map +1 -1
  105. package/dist/FilterChip.vue.d.ts +6 -41
  106. package/dist/FilterDrawerItem.js +21 -21
  107. package/dist/FilterDrawerItem.js.map +1 -1
  108. package/dist/FilterDrawerItem.vue.d.ts +6 -23
  109. package/dist/FilterDropdown.js +63 -69
  110. package/dist/FilterDropdown.js.map +1 -1
  111. package/dist/FilterDropdown.vue.d.ts +122 -35
  112. package/dist/FilterSelect.js.map +1 -1
  113. package/dist/FilterSelect.vue.d.ts +4 -31
  114. package/dist/Filters.js +157 -164
  115. package/dist/Filters.js.map +1 -1
  116. package/dist/Filters.vue.d.ts +0 -2190
  117. package/dist/HttpError.js +7 -7
  118. package/dist/HttpError.js.map +1 -1
  119. package/dist/HttpError.vue.d.ts +4 -41
  120. package/dist/Icon.js +16 -15
  121. package/dist/Icon.js.map +1 -1
  122. package/dist/Icon.vue.d.ts +4 -37
  123. package/dist/IconLabel.js.map +1 -1
  124. package/dist/IconLabel.vue.d.ts +6 -41
  125. package/dist/Illustration.js +2 -2
  126. package/dist/Illustration.vue.d.ts +3 -42
  127. package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js → Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js} +11 -11
  128. package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js.map → Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js.map} +1 -1
  129. package/dist/Image.js +2 -2
  130. package/dist/Image.vue.d.ts +5 -40
  131. package/dist/{Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js → Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js} +37 -41
  132. package/dist/{Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js.map → Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js.map} +1 -1
  133. package/dist/InlineEdit.js.map +1 -1
  134. package/dist/InlineEdit.vue.d.ts +126 -47
  135. package/dist/Input.js.map +1 -1
  136. package/dist/Input.vue.d.ts +12 -45
  137. package/dist/InputOptions.js +66 -69
  138. package/dist/InputOptions.js.map +1 -1
  139. package/dist/InputOptions.vue.d.ts +10 -55
  140. package/dist/IntegrationIcon.js +7 -7
  141. package/dist/IntegrationIcon.js.map +1 -1
  142. package/dist/IntegrationIcon.vue.d.ts +3 -36
  143. package/dist/Label.vue.d.ts +3 -42
  144. package/dist/Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js.map +1 -1
  145. package/dist/LicenseChip.js.map +1 -1
  146. package/dist/LicenseChip.vue.d.ts +3 -30
  147. package/dist/ListItem.js.map +1 -1
  148. package/dist/ListItem.vue.d.ts +0 -294
  149. package/dist/ListItemCell.js.map +1 -1
  150. package/dist/ListItemCell.vue.d.ts +0 -21
  151. package/dist/ListView.js +4 -7
  152. package/dist/ListView.js.map +1 -1
  153. package/dist/ListView.types.d.ts +0 -29
  154. package/dist/ListView.vue.d.ts +0 -5496
  155. package/dist/Loading.js +2 -2
  156. package/dist/Loading.js.map +1 -1
  157. package/dist/Loading.vue.d.ts +1 -1
  158. package/dist/Logo.js +1 -1
  159. package/dist/Logo.vue.d.ts +6 -41
  160. package/dist/{Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js → Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.js} +17 -17
  161. package/dist/Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.js.map +1 -0
  162. package/dist/Menu.js.map +1 -1
  163. package/dist/Menu.vue.d.ts +1 -1
  164. package/dist/MenuItem.js.map +1 -1
  165. package/dist/MenuItem.vue.d.ts +1 -1
  166. package/dist/MenusPlugin-B4jpNe7x.js +12 -0
  167. package/dist/{MenusPlugin-Bk6UW6o9.js.map → MenusPlugin-B4jpNe7x.js.map} +1 -1
  168. package/dist/Metric.js.map +1 -1
  169. package/dist/Metric.vue.d.ts +3 -34
  170. package/dist/Modal.js +62 -64
  171. package/dist/Modal.js.map +1 -1
  172. package/dist/Modal.vue.d.ts +13 -60
  173. package/dist/Modals.js +17 -18
  174. package/dist/Modals.js.map +1 -1
  175. package/dist/ModalsPlugin.js +11 -11
  176. package/dist/ModalsPlugin.js.map +1 -1
  177. package/dist/Module.js.map +1 -1
  178. package/dist/Module.keys-CEsrW2f0.js.map +1 -1
  179. package/dist/Module.types-B1FfGGac.js.map +1 -1
  180. package/dist/Module.vue.d.ts +2 -29
  181. package/dist/ModuleContent.js.map +1 -1
  182. package/dist/ModuleContent.vue.d.ts +3 -3
  183. package/dist/ModuleFooter.js.map +1 -1
  184. package/dist/ModuleFooter.vue.d.ts +1 -1
  185. package/dist/ModuleHeader.js.map +1 -1
  186. package/dist/ModuleHeader.vue.d.ts +5 -39
  187. package/dist/ObfuscateText.js.map +1 -1
  188. package/dist/ObfuscateText.vue.d.ts +3 -40
  189. package/dist/PageContent.js.map +1 -1
  190. package/dist/PageContent.vue.d.ts +3 -30
  191. package/dist/PageHeader.js.map +1 -1
  192. package/dist/PageHeader.vue.d.ts +6 -35
  193. package/dist/PageNavigation.js +50 -50
  194. package/dist/PageNavigation.js.map +1 -1
  195. package/dist/PageNavigation.vue.d.ts +7 -36
  196. package/dist/Paginate.js.map +1 -1
  197. package/dist/Paginate.vue.d.ts +5 -40
  198. package/dist/PlaidLink.js.map +1 -1
  199. package/dist/PlaidLink.vue.d.ts +12 -49
  200. package/dist/QuickAction.js.map +1 -1
  201. package/dist/QuickAction.vue.d.ts +3 -16
  202. package/dist/Radio.js.map +1 -1
  203. package/dist/Radio.vue.d.ts +0 -93
  204. package/dist/RadioGroup.js +94 -101
  205. package/dist/RadioGroup.js.map +1 -1
  206. package/dist/RadioGroup.vue.d.ts +116 -42
  207. package/dist/RadioNew.js +96 -99
  208. package/dist/RadioNew.js.map +1 -1
  209. package/dist/RadioNew.vue.d.ts +7 -48
  210. package/dist/RangeInput.js.map +1 -1
  211. package/dist/RangeInput.vue.d.ts +1 -1
  212. package/dist/SearchBar.js +38 -39
  213. package/dist/SearchBar.js.map +1 -1
  214. package/dist/SearchBar.vue.d.ts +127 -44
  215. package/dist/SectionHeader.js.map +1 -1
  216. package/dist/SectionHeader.vue.d.ts +6 -37
  217. package/dist/Select.js +171 -183
  218. package/dist/Select.js.map +1 -1
  219. package/dist/Select.vue.d.ts +23 -102
  220. package/dist/SelectStatus.js +38 -38
  221. package/dist/SelectStatus.js.map +1 -1
  222. package/dist/SelectStatus.vue.d.ts +227 -47
  223. package/dist/Skeleton.js.map +1 -1
  224. package/dist/Skeleton.vue.d.ts +3 -34
  225. package/dist/Step.js +44 -44
  226. package/dist/Step.js.map +1 -1
  227. package/dist/Step.vue.d.ts +4 -43
  228. package/dist/Stepper.js.map +1 -1
  229. package/dist/Stepper.vue.d.ts +9 -44
  230. package/dist/Switch.js.map +1 -1
  231. package/dist/Switch.vue.d.ts +8 -47
  232. package/dist/Tab.js +1 -1
  233. package/dist/Tab.js.map +1 -1
  234. package/dist/Tab.vue.d.ts +2 -15
  235. package/dist/TabPanel.js.map +1 -1
  236. package/dist/TabPanel.vue.d.ts +3 -30
  237. package/dist/Table.js +53 -59
  238. package/dist/Table.js.map +1 -1
  239. package/dist/Table.keys-LHQf6FEH.js.map +1 -1
  240. package/dist/Table.vue.d.ts +3 -50
  241. package/dist/TableCell.js +1 -1
  242. package/dist/TableCell.js.map +1 -1
  243. package/dist/TableCell.vue.d.ts +3 -32
  244. package/dist/TableHeaderCell.js +1 -1
  245. package/dist/TableHeaderCell.js.map +1 -1
  246. package/dist/TableHeaderCell.vue.d.ts +3 -30
  247. package/dist/TableHeaderRow.js +47 -45
  248. package/dist/TableHeaderRow.js.map +1 -1
  249. package/dist/TableHeaderRow.vue.d.ts +5 -34
  250. package/dist/TableRow.js +60 -61
  251. package/dist/TableRow.js.map +1 -1
  252. package/dist/TableRow.vue.d.ts +7 -48
  253. package/dist/Tabs.js +2 -2
  254. package/dist/Tabs.vue.d.ts +122 -31
  255. package/dist/Tabs.vue_vue_type_script_setup_true_lang-Dprx064Y.js +156 -0
  256. package/dist/{Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js.map → Tabs.vue_vue_type_script_setup_true_lang-Dprx064Y.js.map} +1 -1
  257. package/dist/TextEditor.js +2414 -2420
  258. package/dist/TextEditor.js.map +1 -1
  259. package/dist/TextEditor.vue.d.ts +9 -40
  260. package/dist/Textarea.js +69 -69
  261. package/dist/Textarea.js.map +1 -1
  262. package/dist/Textarea.vue.d.ts +9 -44
  263. package/dist/Thumbnail.js +1 -1
  264. package/dist/Thumbnail.js.map +1 -1
  265. package/dist/Thumbnail.vue.d.ts +4 -4
  266. package/dist/ThumbnailEmpty.js.map +1 -1
  267. package/dist/ThumbnailEmpty.vue.d.ts +1 -1
  268. package/dist/ThumbnailGroup.js.map +1 -1
  269. package/dist/ThumbnailGroup.keys-EJ4qFNhx.js.map +1 -1
  270. package/dist/ThumbnailGroup.vue.d.ts +26 -22
  271. package/dist/Timeline.js.map +1 -1
  272. package/dist/Timeline.vue.d.ts +3 -32
  273. package/dist/TimelineItem.js.map +1 -1
  274. package/dist/TimelineItem.vue.d.ts +1 -1
  275. package/dist/Toast.js.map +1 -1
  276. package/dist/Toast.vue.d.ts +3 -30
  277. package/dist/Toasts.js.map +1 -1
  278. package/dist/ToastsPlugin.js +11 -11
  279. package/dist/ToastsPlugin.js.map +1 -1
  280. package/dist/Tooltip.js +29 -30
  281. package/dist/Tooltip.js.map +1 -1
  282. package/dist/Tooltip.vue.d.ts +11 -43
  283. package/dist/colors-DDDVvqfQ.js.map +1 -1
  284. package/dist/components.css +1 -1
  285. package/dist/constants.js.map +1 -1
  286. package/dist/directives/autofocus.js.map +1 -1
  287. package/dist/directives/clickoutside.js.map +1 -1
  288. package/dist/directives/observe.js.map +1 -1
  289. package/dist/directives/sticky.js.map +1 -1
  290. package/dist/directives/tooltip.js +3 -3
  291. package/dist/directives/tooltip.js.map +1 -1
  292. package/dist/directives/viewable.js +39 -44
  293. package/dist/directives/viewable.js.map +1 -1
  294. package/dist/{floating-ui.vue-pzUuloyX.js → floating-ui.vue-CL01Y9ER.js} +2 -2
  295. package/dist/{floating-ui.vue-pzUuloyX.js.map → floating-ui.vue-CL01Y9ER.js.map} +1 -1
  296. package/dist/formatDateTime-DG7kBc2T.js +1414 -0
  297. package/dist/{formatDateTime-Dz8bXV0R.js.map → formatDateTime-DG7kBc2T.js.map} +1 -1
  298. package/dist/index-D6bxWkZ1.js.map +1 -1
  299. package/dist/{index-ConQ3o31.js → index-GUu9zvbg.js} +3 -3
  300. package/dist/{index-ConQ3o31.js.map → index-GUu9zvbg.js.map} +1 -1
  301. package/dist/index.js +99 -104
  302. package/dist/index.js.map +1 -1
  303. package/dist/isDefined-DzVx0B6k.js.map +1 -1
  304. package/dist/keys-BEdEsanp.js.map +1 -1
  305. package/dist/keys-C8Zfr_By.js.map +1 -1
  306. package/dist/locale.js.map +1 -1
  307. package/dist/misc-CHQs-G03.js.map +1 -1
  308. package/dist/obfuscateText.d.ts +1 -1
  309. package/dist/parseISO-wlfIB_QJ.js.map +1 -1
  310. package/dist/searchFuzzy-DBDE6jkd.js +408 -0
  311. package/dist/{searchFuzzy-DRasJ33G.js.map → searchFuzzy-DBDE6jkd.js.map} +1 -1
  312. package/dist/statusLevels-D8EgtE_L.js.map +1 -1
  313. package/dist/storage.js.map +1 -1
  314. package/dist/tailwind-base.js +1 -1
  315. package/dist/tailwind-base.js.map +1 -1
  316. package/dist/toTimeZone-Coq1oPTt.js.map +1 -1
  317. package/dist/useConfirmBeforeClosing.js.map +1 -1
  318. package/dist/useDialog.d.ts +2 -2
  319. package/dist/useDialog.js +21 -25
  320. package/dist/useDialog.js.map +1 -1
  321. package/dist/useGoogleMaps.js +108 -110
  322. package/dist/useGoogleMaps.js.map +1 -1
  323. package/dist/useMediaQuery.d.ts +0 -6
  324. package/dist/useMediaQuery.js +11 -15
  325. package/dist/useMediaQuery.js.map +1 -1
  326. package/dist/useModals.d.ts +1 -1
  327. package/dist/useModals.js.map +1 -1
  328. package/dist/usePaginationStats-d_q39naC.js.map +1 -1
  329. package/dist/usePlaidLink.js +20 -27
  330. package/dist/usePlaidLink.js.map +1 -1
  331. package/dist/useScriptTag.js.map +1 -1
  332. package/dist/useSearch.js +13 -13
  333. package/dist/useSearch.js.map +1 -1
  334. package/dist/useSelection.js +56 -56
  335. package/dist/useSelection.js.map +1 -1
  336. package/dist/useSortable.js +54 -63
  337. package/dist/useSortable.js.map +1 -1
  338. package/dist/useStepper.d.ts +2 -2
  339. package/dist/useStepper.js +36 -40
  340. package/dist/useStepper.js.map +1 -1
  341. package/dist/useToasts.js +23 -23
  342. package/dist/useToasts.js.map +1 -1
  343. package/dist/useValidation.js +96 -100
  344. package/dist/useValidation.js.map +1 -1
  345. package/dist/utils/calculateElementOverflow.js +4 -4
  346. package/dist/utils/calculateElementOverflow.js.map +1 -1
  347. package/dist/utils/colorScheme.js +2 -2
  348. package/dist/utils/colorScheme.js.map +1 -1
  349. package/dist/utils/createQueryString.js.map +1 -1
  350. package/dist/utils/createValidDate.js.map +1 -1
  351. package/dist/utils/formatDateTime.js +1 -1
  352. package/dist/utils/getContrastingTextColor.js.map +1 -1
  353. package/dist/utils/helpers.js.map +1 -1
  354. package/dist/utils/i18n.js.map +1 -1
  355. package/dist/utils/normalizeDate.js.map +1 -1
  356. package/dist/utils/obfuscateText.js +6 -6
  357. package/dist/utils/obfuscateText.js.map +1 -1
  358. package/dist/utils/searchFuzzy.js +1 -1
  359. package/dist/utils/storage.js +23 -23
  360. package/dist/utils/storage.js.map +1 -1
  361. package/package.json +12 -13
  362. package/tailwind-base.ts +1 -1
  363. package/types/vite.d.ts +7 -0
  364. package/types/vitest.d.ts +7 -0
  365. package/dist/Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js.map +0 -1
  366. package/dist/MenusPlugin-Bk6UW6o9.js +0 -12
  367. package/dist/Tabs.vue_vue_type_script_setup_true_lang-CmnBP4i1.js +0 -159
  368. package/dist/formatDateTime-Dz8bXV0R.js +0 -1418
  369. package/dist/searchFuzzy-DRasJ33G.js +0 -409
@@ -1,10 +1,10 @@
1
- import { defineComponent as d, inject as u, computed as c, createBlock as h, openBlock as y, unref as k, normalizeClass as f } from "vue";
1
+ import { defineComponent as d, inject as u, computed as n, createBlock as h, openBlock as y, unref as k, normalizeClass as f } from "vue";
2
2
  import v from "lodash-es/uniqueId";
3
3
  import { I as b } from "./index-D6bxWkZ1.js";
4
- var l = /* @__PURE__ */ ((r) => (r.Approved = "approved", r.Avatar = "avatar", r.Barcode = "barcode", r.Calendar = "calendar", r.Cartridge = "cartridge", r.Celebrate = "celebrate", r.ChatBubble = "chat-bubble", r.CheckBox = "check-box", r.CheckCircle = "check-circle", r.Click = "click", r.Cocktail = "cocktail", r.Confirmation = "confirmation", r.Connnect = "connnect", r.Cookie = "cookie", r.CreditCard = "credit-card", r.Crm = "crm", r.Cultivation = "cultivation", r.Data = "data", r.DeliveryCompleted = "delivery-completed", r.Delivery = "delivery", r.DigitalPayments = "digital-payments", r.Discover = "discover", r.Diversity = "diversity", r.Drink = "drink", r.Dolly = "dolly", r.EasyReconciliations = "easy-reconciliations", r.Efficiency = "efficiency", r.Error = "error", r.ExtendDate = "extend-date", r.FinancialGrowth = "financial-growth", r.FinancialInstitution = "financial-institution", r.Focus = "focus", r.FulfillmentIssues = "fulfillment-issues", r.Growth = "growth", r.Handshake = "handshake", r.Hierarchy = "hierarchy", r.Home = "home", r.Laptop = "laptop", r.Licenses = "licenses", r.LightBulb = "light-bulb", r.LightbulbError = "lightbulb-error", r.LineChart = "line-chart", r.Link = "link", r.LocationPin = "location-pin", r.Lock = "lock", r.Messaging = "messaging", r.Messages = "messages", r.Microchip = "microchip", r.MissingData = "missing-data", r.MoneyTransfer = "money-transfer", r.Money = "money", r.NoInventoryAccess = "no-inventory-access", r.NoInventory = "no-inventory", r.NoPromote = "no-promote", r.PackageReceived = "package-received", r.Package = "package", r.PaymentProcessing = "payment-processing", r.Phone = "phone", r.PieChart = "pie-chart", r.ProductCycle = "product-cycle", r.Puzzle = "puzzle", r.Receipt = "receipt", r.Retail = "retail", r.SearchingDocument = "searching-document", r.ShoppingBasket = "shopping-basket", r.Shopping = "shopping", r.Sign = "sign", r.Smile = "smile", r.Speed = "speed", r.Time = "time", r.Tools = "tools", r.Truck = "truck", r.User = "user", r.Warehouse = "warehouse", r.Warning = "warning", r.XCircle = "x-circle", r))(l || {});
5
- const C = Object.values(l);
6
- var o = /* @__PURE__ */ ((r) => (r.Api = "api", r.Bank = "bank", r.Basket = "basket", r.BrandMenu = "brand-menu", r.Calendar = "calendar", r.Dashboard = "dashboard", r.Deals = "deals", r.DocumentSearch = "document-search", r.Edit = "edit", r.EmptyTray = "empty-tray", r.Graph = "graph", r.Integrations = "integrations", r.LightBulb = "light-bulb", r.Map = "map", r.Megaphone = "megaphone", r.Messages = "messages", r.MoneyBank = "money-bank", r.NoFiltersResult = "no-filters-result", r.Notifications = "notifications", r.OrdersEmpty = "orders-empty", r.Payments = "payments", r.PieChart = "pie-chart", r.ProductCards = "product-cards", r.ProductDetails = "product-details", r.ProductDisplay = "product-display", r.Search = "search", r.SearchStorefront = "search-storefront", r.Store = "store", r.Todo = "todo", r.Truck = "truck", r.Users = "users", r.Warehouse = "warehouse", r.WarehouseDelivery = "warehouse-delivery", r))(o || {});
7
- const g = Object.values(o);
4
+ var e = /* @__PURE__ */ ((r) => (r.Approved = "approved", r.Avatar = "avatar", r.Barcode = "barcode", r.Calendar = "calendar", r.Cartridge = "cartridge", r.Celebrate = "celebrate", r.ChatBubble = "chat-bubble", r.CheckBox = "check-box", r.CheckCircle = "check-circle", r.Click = "click", r.Cocktail = "cocktail", r.Confirmation = "confirmation", r.Connnect = "connnect", r.Cookie = "cookie", r.CreditCard = "credit-card", r.Crm = "crm", r.Cultivation = "cultivation", r.Data = "data", r.DeliveryCompleted = "delivery-completed", r.Delivery = "delivery", r.DigitalPayments = "digital-payments", r.Discover = "discover", r.Diversity = "diversity", r.Drink = "drink", r.Dolly = "dolly", r.EasyReconciliations = "easy-reconciliations", r.Efficiency = "efficiency", r.Error = "error", r.ExtendDate = "extend-date", r.FinancialGrowth = "financial-growth", r.FinancialInstitution = "financial-institution", r.Focus = "focus", r.FulfillmentIssues = "fulfillment-issues", r.Growth = "growth", r.Handshake = "handshake", r.Hierarchy = "hierarchy", r.Home = "home", r.Laptop = "laptop", r.Licenses = "licenses", r.LightBulb = "light-bulb", r.LightbulbError = "lightbulb-error", r.LineChart = "line-chart", r.Link = "link", r.LocationPin = "location-pin", r.Lock = "lock", r.Messaging = "messaging", r.Messages = "messages", r.Microchip = "microchip", r.MissingData = "missing-data", r.MoneyTransfer = "money-transfer", r.Money = "money", r.NoInventoryAccess = "no-inventory-access", r.NoInventory = "no-inventory", r.NoPromote = "no-promote", r.PackageReceived = "package-received", r.Package = "package", r.PaymentProcessing = "payment-processing", r.Phone = "phone", r.PieChart = "pie-chart", r.ProductCycle = "product-cycle", r.Puzzle = "puzzle", r.Receipt = "receipt", r.Retail = "retail", r.SearchingDocument = "searching-document", r.ShoppingBasket = "shopping-basket", r.Shopping = "shopping", r.Sign = "sign", r.Smile = "smile", r.Speed = "speed", r.Time = "time", r.Tools = "tools", r.Truck = "truck", r.User = "user", r.Warehouse = "warehouse", r.Warning = "warning", r.XCircle = "x-circle", r))(e || {});
5
+ const C = Object.values(e);
6
+ var l = /* @__PURE__ */ ((r) => (r.Api = "api", r.Bank = "bank", r.Basket = "basket", r.BrandMenu = "brand-menu", r.Calendar = "calendar", r.Dashboard = "dashboard", r.Deals = "deals", r.DocumentSearch = "document-search", r.Edit = "edit", r.EmptyTray = "empty-tray", r.Graph = "graph", r.Integrations = "integrations", r.LightBulb = "light-bulb", r.Map = "map", r.Megaphone = "megaphone", r.Messages = "messages", r.MoneyBank = "money-bank", r.NoFiltersResult = "no-filters-result", r.Notifications = "notifications", r.OrdersEmpty = "orders-empty", r.Payments = "payments", r.PieChart = "pie-chart", r.ProductCards = "product-cards", r.ProductDetails = "product-details", r.ProductDisplay = "product-display", r.Search = "search", r.SearchStorefront = "search-storefront", r.Store = "store", r.Todo = "todo", r.Truck = "truck", r.Users = "users", r.Warehouse = "warehouse", r.WarehouseDelivery = "warehouse-delivery", r))(l || {});
7
+ const g = Object.values(l);
8
8
  var i = /* @__PURE__ */ ((r) => (r.Spot = "spot", r.Vignette = "vignette", r.Scene = "scene", r))(i || {});
9
9
  const I = /* @__PURE__ */ d({
10
10
  __name: "Illustration",
@@ -28,13 +28,13 @@ const I = /* @__PURE__ */ d({
28
28
  throw new Error(
29
29
  `${s.type} illustration name ${s.name} not found. Did you check that you are using the correct type for your illustration?`
30
30
  );
31
- const n = u("stashOptions", {
31
+ const o = u("stashOptions", {
32
32
  staticPath: "/static"
33
- }), e = c(() => s.type === i.Spot), t = c(() => e.value ? "0" : !1), a = c(() => s.staticPath || (n == null ? void 0 : n.staticPath));
33
+ }), c = n(() => s.type === i.Spot), t = n(() => c.value ? "0" : !1), a = n(() => s.staticPath || o?.staticPath);
34
34
  return (w, P) => (y(), h(k(b), {
35
35
  id: s.id,
36
36
  class: f(["tw-inline-block tw-align-middle", {
37
- [`tw-text-${s.fillColor}-400 tw-stroke-${s.strokeColor}`]: e.value
37
+ [`tw-text-${s.fillColor}-400 tw-stroke-${s.strokeColor}`]: c.value
38
38
  }]),
39
39
  title: s.title,
40
40
  height: s.size,
@@ -47,10 +47,10 @@ const I = /* @__PURE__ */ d({
47
47
  });
48
48
  export {
49
49
  i as I,
50
- l as S,
51
- o as V,
50
+ e as S,
51
+ l as V,
52
52
  I as _,
53
53
  C as s,
54
54
  g as v
55
55
  };
56
- //# sourceMappingURL=Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js.map
56
+ //# sourceMappingURL=Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js","sources":["../src/components/Illustration/Illustration.models.ts","../src/components/Illustration/Illustration.vue"],"sourcesContent":["/**\n * Enum to strongly map between a friendly name and file name of the illustration\n */\nexport enum SpotName {\n Approved = 'approved',\n Avatar = 'avatar',\n Barcode = 'barcode',\n Calendar = 'calendar',\n Cartridge = 'cartridge',\n Celebrate = 'celebrate',\n ChatBubble = 'chat-bubble',\n CheckBox = 'check-box',\n CheckCircle = 'check-circle',\n Click = 'click',\n Cocktail = 'cocktail',\n Confirmation = 'confirmation',\n Connnect = 'connnect',\n Cookie = 'cookie',\n CreditCard = 'credit-card',\n Crm = 'crm',\n Cultivation = 'cultivation',\n Data = 'data',\n DeliveryCompleted = 'delivery-completed',\n Delivery = 'delivery',\n DigitalPayments = 'digital-payments',\n Discover = 'discover',\n Diversity = 'diversity',\n Drink = 'drink',\n Dolly = 'dolly',\n EasyReconciliations = 'easy-reconciliations',\n Efficiency = 'efficiency',\n Error = 'error',\n ExtendDate = 'extend-date',\n FinancialGrowth = 'financial-growth',\n FinancialInstitution = 'financial-institution',\n Focus = 'focus',\n FulfillmentIssues = 'fulfillment-issues',\n Growth = 'growth',\n Handshake = 'handshake',\n Hierarchy = 'hierarchy',\n Home = 'home',\n Laptop = 'laptop',\n Licenses = 'licenses',\n LightBulb = 'light-bulb',\n LightbulbError = 'lightbulb-error',\n LineChart = 'line-chart',\n Link = 'link',\n LocationPin = 'location-pin',\n Lock = 'lock',\n Messaging = 'messaging',\n Messages = 'messages',\n Microchip = 'microchip',\n MissingData = 'missing-data',\n MoneyTransfer = 'money-transfer',\n Money = 'money',\n NoInventoryAccess = 'no-inventory-access',\n NoInventory = 'no-inventory',\n NoPromote = 'no-promote',\n PackageReceived = 'package-received',\n Package = 'package',\n PaymentProcessing = 'payment-processing',\n Phone = 'phone',\n PieChart = 'pie-chart',\n ProductCycle = 'product-cycle',\n Puzzle = 'puzzle',\n Receipt = 'receipt',\n Retail = 'retail',\n SearchingDocument = 'searching-document',\n ShoppingBasket = 'shopping-basket',\n Shopping = 'shopping',\n Sign = 'sign',\n Smile = 'smile',\n Speed = 'speed',\n Time = 'time',\n Tools = 'tools',\n Truck = 'truck',\n User = 'user',\n Warehouse = 'warehouse',\n Warning = 'warning',\n XCircle = 'x-circle',\n}\n\nexport type SpotNames = `${SpotName}`;\n\n/**\n * String array of all illustration names\n */\nexport const spotNames = Object.values(SpotName);\n\nexport enum VignetteName {\n Api = 'api',\n Bank = 'bank',\n Basket = 'basket',\n BrandMenu = 'brand-menu',\n Calendar = 'calendar',\n Dashboard = 'dashboard',\n Deals = 'deals',\n DocumentSearch = 'document-search',\n Edit = 'edit',\n EmptyTray = 'empty-tray',\n Graph = 'graph',\n Integrations = 'integrations',\n LightBulb = 'light-bulb',\n Map = 'map',\n Megaphone = 'megaphone',\n Messages = 'messages',\n MoneyBank = 'money-bank',\n NoFiltersResult = 'no-filters-result',\n Notifications = 'notifications',\n OrdersEmpty = 'orders-empty',\n Payments = 'payments',\n PieChart = 'pie-chart',\n ProductCards = 'product-cards',\n ProductDetails = 'product-details',\n ProductDisplay = 'product-display',\n Search = 'search',\n SearchStorefront = 'search-storefront',\n Store = 'store',\n Todo = 'todo',\n Truck = 'truck',\n Users = 'users',\n Warehouse = 'warehouse',\n WarehouseDelivery = 'warehouse-delivery',\n}\n\nexport type VignetteNames = `${VignetteName}`;\n\n/**\n * String array of all vignette names\n */\nexport const vignetteNames = Object.values(VignetteName);\n\n/**\n * Types of illustrations that map to the subfolder under ./assets/illustrations/<type>\n */\nexport enum IllustrationType {\n Spot = 'spot',\n Vignette = 'vignette',\n // Scene is not implemented, but adding it for future work mentioned in STASH-61.\n Scene = 'scene',\n}\n\nexport type IllustrationTypes = `${IllustrationType}`;\n","<script lang=\"ts\">\n export * from './Illustration.models';\n</script>\n\n<script lang=\"ts\" setup>\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, inject } from 'vue';\n import InlineSvg from 'vue-inline-svg';\n\n import { StashPrimaryColor, StashPrimaryColorGroup } from '../../../types/colors';\n import { StashProvideState } from '../../../types/misc';\n import {\n IllustrationType,\n IllustrationTypes,\n SpotName,\n SpotNames,\n spotNames,\n VignetteName,\n VignetteNames,\n vignetteNames,\n } from './Illustration.models';\n\n export interface IllustrationProps {\n id?: string;\n\n /**\n * The filename of the icon that should be displayed\n */\n name: SpotNames | VignetteNames;\n\n /**\n * Accessible, short-text description for the icon. Not rendered as part of the graphic, but\n * browsers usually display it as a tooltip and screen readers use this.\n */\n title?: string;\n\n /**\n * The size in pixels of the illustration. This number will be used for width and height\n */\n size?: number;\n\n /**\n * Type of the illustration\n */\n type?: IllustrationTypes;\n\n /**\n * The fill color for the illustration. This component will use the 400 shade of the color\n * per design's request. Defaults to teal.\n */\n fillColor?: StashPrimaryColorGroup;\n\n /**\n * The color theme for the illustration. This component will use the standard 500 shade of the color.\n * Defaults to purple\n */\n strokeColor?: StashPrimaryColor;\n\n /**\n * Illustration's custom static path. It'll default to either the staticPath defined on the library installation or '/static' if none are provided.\n */\n staticPath?: string;\n }\n\n const props = withDefaults(defineProps<IllustrationProps>(), {\n id: uniqueId('ll-illustration-'),\n title: '',\n size: 48,\n type: IllustrationType.Spot,\n fillColor: 'blue',\n strokeColor: 'purple-500',\n staticPath: '',\n });\n\n if (props.type === IllustrationType.Scene) {\n throw new Error(\n 'Scene illustration types are not supported. Illustrations will need to be uploaded under ./assets/illustrations/scene. Illustrations to be provided by design.',\n );\n }\n\n if (\n (props.type === IllustrationType.Spot && !spotNames.includes(props.name as SpotName)) ||\n (props.type === IllustrationType.Vignette && !vignetteNames.includes(props.name as VignetteName))\n ) {\n throw new Error(\n `${props.type} illustration name ${props.name} not found. Did you check that you are using the correct type for your illustration?`,\n );\n }\n\n const stashOptions = inject<Partial<StashProvideState>>('stashOptions', {\n staticPath: '/static',\n });\n\n const isSpotIllustration = computed(() => props.type === IllustrationType.Spot);\n\n /**\n * Browsers won't add the `stroke-width` attribute if it is set to false.\n * However, setting it to specific number value affects vignettes\n */\n const strokeWidth = computed<boolean | string>(() => {\n return isSpotIllustration.value ? '0' : false;\n });\n\n const computedStaticPath = computed(() => {\n return props.staticPath || stashOptions?.staticPath;\n });\n</script>\n\n<template>\n <!-- InlineSvg package (https://github.com/shrpne/vue-inline-svg) swaps external svgs and puts\n them inline so we can style them with CSS -->\n <!-- Having to override fill to be none and stroke to be zero so the exported svgs from Figma\n that do not have those attributes specified do not get a default one applied -->\n <InlineSvg\n :id=\"props.id\"\n class=\"tw-inline-block tw-align-middle\"\n :class=\"{\n [`tw-text-${props.fillColor}-400 tw-stroke-${props.strokeColor}`]: isSpotIllustration,\n }\"\n :title=\"props.title\"\n :height=\"props.size\"\n :width=\"props.size\"\n :stroke-width=\"strokeWidth\"\n fill=\"none\"\n :src=\"`${computedStaticPath}/illustrations/${props.type}/${props.name}.svg`\"\n />\n</template>\n"],"names":["SpotName","spotNames","VignetteName","vignetteNames","IllustrationType","props","__props","stashOptions","inject","isSpotIllustration","computed","strokeWidth","computedStaticPath"],"mappings":";;;AAGY,IAAAA,sBAAAA,OACVA,EAAA,WAAW,YACXA,EAAA,SAAS,UACTA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,YAAY,aACZA,EAAA,aAAa,eACbA,EAAA,WAAW,aACXA,EAAA,cAAc,gBACdA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,eAAe,gBACfA,EAAA,WAAW,YACXA,EAAA,SAAS,UACTA,EAAA,aAAa,eACbA,EAAA,MAAM,OACNA,EAAA,cAAc,eACdA,EAAA,OAAO,QACPA,EAAA,oBAAoB,sBACpBA,EAAA,WAAW,YACXA,EAAA,kBAAkB,oBAClBA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SACRA,EAAA,sBAAsB,wBACtBA,EAAA,aAAa,cACbA,EAAA,QAAQ,SACRA,EAAA,aAAa,eACbA,EAAA,kBAAkB,oBAClBA,EAAA,uBAAuB,yBACvBA,EAAA,QAAQ,SACRA,EAAA,oBAAoB,sBACpBA,EAAA,SAAS,UACTA,EAAA,YAAY,aACZA,EAAA,YAAY,aACZA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,WAAW,YACXA,EAAA,YAAY,cACZA,EAAA,iBAAiB,mBACjBA,EAAA,YAAY,cACZA,EAAA,OAAO,QACPA,EAAA,cAAc,gBACdA,EAAA,OAAO,QACPA,EAAA,YAAY,aACZA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,cAAc,gBACdA,EAAA,gBAAgB,kBAChBA,EAAA,QAAQ,SACRA,EAAA,oBAAoB,uBACpBA,EAAA,cAAc,gBACdA,EAAA,YAAY,cACZA,EAAA,kBAAkB,oBAClBA,EA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AAA,OAAO,QACPA,EAAA,WAAW,YAEXA,EAAA,QAAQ,SAJEA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;ACvEV,UAAMC,IAAQC;AAUV,QAAAD,EAAM,SAASD,EAAiB;AAClC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAGF,QACGC,EAAM,SAASD,EAAiB,QAAQ,CAACH,EAAU,SAASI,EAAM,IAAgB,KAClFA,EAAM,SAASD,EAAiB,YAAY,CAACD,EAAc,SAASE,EAAM,IAAoB;AAE/F,YAAM,IAAI;AAAA,QACR,GAAGA,EAAM,IAAI,sBAAsBA,EAAM,IAAI;AAAA,MAC/C;AAGI,UAAAE,IAAeC,EAAmC,gBAAgB;AAAA,MACtE,YAAY;AAAA,IAAA,CACb,GAEKC,IAAqBC,EAAS,MAAML,EAAM,SAASD,EAAiB,IAAI,GAMxEO,IAAcD,EAA2B,MACtCD,EAAmB,QAAQ,MAAM,EACzC,GAEKG,IAAqBF,EAAS,MAC3BL,EAAM,eAAcE,KAAA,gBAAAA,EAAc,WAC1C;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js","sources":["../src/components/Illustration/Illustration.models.ts","../src/components/Illustration/Illustration.vue"],"sourcesContent":["/**\n * Enum to strongly map between a friendly name and file name of the illustration\n */\nexport enum SpotName {\n Approved = 'approved',\n Avatar = 'avatar',\n Barcode = 'barcode',\n Calendar = 'calendar',\n Cartridge = 'cartridge',\n Celebrate = 'celebrate',\n ChatBubble = 'chat-bubble',\n CheckBox = 'check-box',\n CheckCircle = 'check-circle',\n Click = 'click',\n Cocktail = 'cocktail',\n Confirmation = 'confirmation',\n Connnect = 'connnect',\n Cookie = 'cookie',\n CreditCard = 'credit-card',\n Crm = 'crm',\n Cultivation = 'cultivation',\n Data = 'data',\n DeliveryCompleted = 'delivery-completed',\n Delivery = 'delivery',\n DigitalPayments = 'digital-payments',\n Discover = 'discover',\n Diversity = 'diversity',\n Drink = 'drink',\n Dolly = 'dolly',\n EasyReconciliations = 'easy-reconciliations',\n Efficiency = 'efficiency',\n Error = 'error',\n ExtendDate = 'extend-date',\n FinancialGrowth = 'financial-growth',\n FinancialInstitution = 'financial-institution',\n Focus = 'focus',\n FulfillmentIssues = 'fulfillment-issues',\n Growth = 'growth',\n Handshake = 'handshake',\n Hierarchy = 'hierarchy',\n Home = 'home',\n Laptop = 'laptop',\n Licenses = 'licenses',\n LightBulb = 'light-bulb',\n LightbulbError = 'lightbulb-error',\n LineChart = 'line-chart',\n Link = 'link',\n LocationPin = 'location-pin',\n Lock = 'lock',\n Messaging = 'messaging',\n Messages = 'messages',\n Microchip = 'microchip',\n MissingData = 'missing-data',\n MoneyTransfer = 'money-transfer',\n Money = 'money',\n NoInventoryAccess = 'no-inventory-access',\n NoInventory = 'no-inventory',\n NoPromote = 'no-promote',\n PackageReceived = 'package-received',\n Package = 'package',\n PaymentProcessing = 'payment-processing',\n Phone = 'phone',\n PieChart = 'pie-chart',\n ProductCycle = 'product-cycle',\n Puzzle = 'puzzle',\n Receipt = 'receipt',\n Retail = 'retail',\n SearchingDocument = 'searching-document',\n ShoppingBasket = 'shopping-basket',\n Shopping = 'shopping',\n Sign = 'sign',\n Smile = 'smile',\n Speed = 'speed',\n Time = 'time',\n Tools = 'tools',\n Truck = 'truck',\n User = 'user',\n Warehouse = 'warehouse',\n Warning = 'warning',\n XCircle = 'x-circle',\n}\n\nexport type SpotNames = `${SpotName}`;\n\n/**\n * String array of all illustration names\n */\nexport const spotNames = Object.values(SpotName);\n\nexport enum VignetteName {\n Api = 'api',\n Bank = 'bank',\n Basket = 'basket',\n BrandMenu = 'brand-menu',\n Calendar = 'calendar',\n Dashboard = 'dashboard',\n Deals = 'deals',\n DocumentSearch = 'document-search',\n Edit = 'edit',\n EmptyTray = 'empty-tray',\n Graph = 'graph',\n Integrations = 'integrations',\n LightBulb = 'light-bulb',\n Map = 'map',\n Megaphone = 'megaphone',\n Messages = 'messages',\n MoneyBank = 'money-bank',\n NoFiltersResult = 'no-filters-result',\n Notifications = 'notifications',\n OrdersEmpty = 'orders-empty',\n Payments = 'payments',\n PieChart = 'pie-chart',\n ProductCards = 'product-cards',\n ProductDetails = 'product-details',\n ProductDisplay = 'product-display',\n Search = 'search',\n SearchStorefront = 'search-storefront',\n Store = 'store',\n Todo = 'todo',\n Truck = 'truck',\n Users = 'users',\n Warehouse = 'warehouse',\n WarehouseDelivery = 'warehouse-delivery',\n}\n\nexport type VignetteNames = `${VignetteName}`;\n\n/**\n * String array of all vignette names\n */\nexport const vignetteNames = Object.values(VignetteName);\n\n/**\n * Types of illustrations that map to the subfolder under ./assets/illustrations/<type>\n */\nexport enum IllustrationType {\n Spot = 'spot',\n Vignette = 'vignette',\n // Scene is not implemented, but adding it for future work mentioned in STASH-61.\n Scene = 'scene',\n}\n\nexport type IllustrationTypes = `${IllustrationType}`;\n","<script lang=\"ts\">\n export * from './Illustration.models';\n</script>\n\n<script lang=\"ts\" setup>\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, inject } from 'vue';\n import InlineSvg from 'vue-inline-svg';\n\n import { StashPrimaryColor, StashPrimaryColorGroup } from '../../../types/colors';\n import { StashProvideState } from '../../../types/misc';\n import {\n IllustrationType,\n IllustrationTypes,\n SpotName,\n SpotNames,\n spotNames,\n VignetteName,\n VignetteNames,\n vignetteNames,\n } from './Illustration.models';\n\n export interface IllustrationProps {\n id?: string;\n\n /**\n * The filename of the icon that should be displayed\n */\n name: SpotNames | VignetteNames;\n\n /**\n * Accessible, short-text description for the icon. Not rendered as part of the graphic, but\n * browsers usually display it as a tooltip and screen readers use this.\n */\n title?: string;\n\n /**\n * The size in pixels of the illustration. This number will be used for width and height\n */\n size?: number;\n\n /**\n * Type of the illustration\n */\n type?: IllustrationTypes;\n\n /**\n * The fill color for the illustration. This component will use the 400 shade of the color\n * per design's request. Defaults to teal.\n */\n fillColor?: StashPrimaryColorGroup;\n\n /**\n * The color theme for the illustration. This component will use the standard 500 shade of the color.\n * Defaults to purple\n */\n strokeColor?: StashPrimaryColor;\n\n /**\n * Illustration's custom static path. It'll default to either the staticPath defined on the library installation or '/static' if none are provided.\n */\n staticPath?: string;\n }\n\n const props = withDefaults(defineProps<IllustrationProps>(), {\n id: uniqueId('ll-illustration-'),\n title: '',\n size: 48,\n type: IllustrationType.Spot,\n fillColor: 'blue',\n strokeColor: 'purple-500',\n staticPath: '',\n });\n\n if (props.type === IllustrationType.Scene) {\n throw new Error(\n 'Scene illustration types are not supported. Illustrations will need to be uploaded under ./assets/illustrations/scene. Illustrations to be provided by design.',\n );\n }\n\n if (\n (props.type === IllustrationType.Spot && !spotNames.includes(props.name as SpotName)) ||\n (props.type === IllustrationType.Vignette && !vignetteNames.includes(props.name as VignetteName))\n ) {\n throw new Error(\n `${props.type} illustration name ${props.name} not found. Did you check that you are using the correct type for your illustration?`,\n );\n }\n\n const stashOptions = inject<Partial<StashProvideState>>('stashOptions', {\n staticPath: '/static',\n });\n\n const isSpotIllustration = computed(() => props.type === IllustrationType.Spot);\n\n /**\n * Browsers won't add the `stroke-width` attribute if it is set to false.\n * However, setting it to specific number value affects vignettes\n */\n const strokeWidth = computed<boolean | string>(() => {\n return isSpotIllustration.value ? '0' : false;\n });\n\n const computedStaticPath = computed(() => {\n return props.staticPath || stashOptions?.staticPath;\n });\n</script>\n\n<template>\n <!-- InlineSvg package (https://github.com/shrpne/vue-inline-svg) swaps external svgs and puts\n them inline so we can style them with CSS -->\n <!-- Having to override fill to be none and stroke to be zero so the exported svgs from Figma\n that do not have those attributes specified do not get a default one applied -->\n <InlineSvg\n :id=\"props.id\"\n class=\"tw-inline-block tw-align-middle\"\n :class=\"{\n [`tw-text-${props.fillColor}-400 tw-stroke-${props.strokeColor}`]: isSpotIllustration,\n }\"\n :title=\"props.title\"\n :height=\"props.size\"\n :width=\"props.size\"\n :stroke-width=\"strokeWidth\"\n fill=\"none\"\n :src=\"`${computedStaticPath}/illustrations/${props.type}/${props.name}.svg`\"\n />\n</template>\n"],"names":["SpotName","spotNames","VignetteName","vignetteNames","IllustrationType","props","__props","stashOptions","inject","isSpotIllustration","computed","strokeWidth","computedStaticPath","_createBlock","_unref","InlineSvg"],"mappings":";;;AAGO,IAAKA,sBAAAA,OACVA,EAAA,WAAW,YACXA,EAAA,SAAS,UACTA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,YAAY,aACZA,EAAA,aAAa,eACbA,EAAA,WAAW,aACXA,EAAA,cAAc,gBACdA,EAAA,QAAQ,SACRA,EAAA,WAAW,YACXA,EAAA,eAAe,gBACfA,EAAA,WAAW,YACXA,EAAA,SAAS,UACTA,EAAA,aAAa,eACbA,EAAA,MAAM,OACNA,EAAA,cAAc,eACdA,EAAA,OAAO,QACPA,EAAA,oBAAoB,sBACpBA,EAAA,WAAW,YACXA,EAAA,kBAAkB,oBAClBA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,QAAQ,SACRA,EAAA,QAAQ,SACRA,EAAA,sBAAsB,wBACtBA,EAAA,aAAa,cACbA,EAAA,QAAQ,SACRA,EAAA,aAAa,eACbA,EAAA,kBAAkB,oBAClBA,EAAA,uBAAuB,yBACvBA,EAAA,QAAQ,SACRA,EAAA,oBAAoB,sBACpBA,EAAA,SAAS,UACTA,EAAA,YAAY,aACZA,EAAA,YAAY,aACZA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,WAAW,YACXA,EAAA,YAAY,cACZA,EAAA,iBAAiB,mBACjBA,EAAA,YAAY,cACZA,EAAA,OAAO,QACPA,EAAA,cAAc,gBACdA,EAAA,OAAO,QACPA,EAAA,YAAY,aACZA,EAAA,WAAW,YACXA,EAAA,YAAY,aACZA,EAAA,cAAc,gBACdA,EAAA,gBAAgB,kBAChBA,EAAA,QAAQ,SACRA,EAAA,oBAAoB,uBACpBA,EAAA,cAAc,gBACdA,EAAA,YAAY,cACZA,EAAA,kBAAkB,oBAClBA,EAAA,UAAU,WACV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A,EAAA,WAAW,YAEXA,EAAA,QAAQ,SAJEA,IAAAA,KAAA,CAAA,CAAA;;;;;;;;;;;;;;ACvEV,UAAMC,IAAQC;AAUd,QAAID,EAAM,SAASD,EAAiB;AAClC,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAIJ,QACGC,EAAM,SAASD,EAAiB,QAAQ,CAACH,EAAU,SAASI,EAAM,IAAgB,KAClFA,EAAM,SAASD,EAAiB,YAAY,CAACD,EAAc,SAASE,EAAM,IAAoB;AAE/F,YAAM,IAAI;AAAA,QACR,GAAGA,EAAM,IAAI,sBAAsBA,EAAM,IAAI;AAAA,MAAA;AAIjD,UAAME,IAAeC,EAAmC,gBAAgB;AAAA,MACtE,YAAY;AAAA,IAAA,CACb,GAEKC,IAAqBC,EAAS,MAAML,EAAM,SAASD,EAAiB,IAAI,GAMxEO,IAAcD,EAA2B,MACtCD,EAAmB,QAAQ,MAAM,EACzC,GAEKG,IAAqBF,EAAS,MAC3BL,EAAM,cAAcE,GAAc,UAC1C;2BAQDM,EAYEC,EAAAC,CAAA,GAAA;AAAA,MAXC,IAAIV,EAAM;AAAA,MACX,UAAM,mCAAiC;AAAA,QACX,CAAA,WAAAA,EAAM,SAAS,kBAAkBA,EAAM,WAAW,KAAKI,EAAA;AAAA,MAAA;MAGlF,OAAOJ,EAAM;AAAA,MACb,QAAQA,EAAM;AAAA,MACd,OAAOA,EAAM;AAAA,MACb,gBAAcM,EAAA;AAAA,MACf,MAAK;AAAA,MACJ,KAAG,GAAKC,OAAkB,kBAAkBP,EAAM,IAAI,IAAIA,EAAM,IAAI;AAAA,IAAA;;;"}
package/dist/Image.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as s } from "./Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js";
2
- import { a as m, I as o, S as f } from "./Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js";
1
+ import { _ as s } from "./Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js";
2
+ import { a as m, I as o, S as f } from "./Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js";
3
3
  export {
4
4
  m as ImageProviders,
5
5
  o as ImageRadius,
@@ -1,53 +1,18 @@
1
1
  import { ComponentOptionsMixin } from 'vue';
2
2
  import { ComponentProvideOptions } from 'vue';
3
3
  import { DefineComponent } from 'vue';
4
- import { ExtractPropTypes } from 'vue';
5
- import { PropType } from 'vue';
6
4
  import { PublicProps } from 'vue';
7
5
 
8
- declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
9
-
10
- declare type __VLS_Prettify<T> = {
11
- [K in keyof T]: T[K];
12
- } & {};
13
-
14
- declare type __VLS_TypePropsToRuntimeProps<T> = {
15
- [K in keyof T]-?: {} extends Pick<T, K> ? {
16
- type: PropType<__VLS_NonUndefinedable<T[K]>>;
17
- } : {
18
- type: PropType<T[K]>;
19
- required: true;
20
- };
21
- };
22
-
23
- declare type __VLS_WithDefaults<P, D> = {
24
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
25
- default: D[K];
26
- }> : P[K];
27
- };
28
-
29
- declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ImageProps>, {
30
- src: string;
31
- srcset: undefined;
32
- sizes: undefined;
33
- staticPath: undefined;
34
- provider: undefined;
35
- radius: string;
36
- }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ImageProps>, {
37
- src: string;
38
- srcset: undefined;
39
- sizes: undefined;
40
- staticPath: undefined;
41
- provider: undefined;
42
- radius: string;
43
- }>>> & Readonly<{}>, {
6
+ declare const _default: DefineComponent<ImageProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ImageProps> & Readonly<{}>, {
44
7
  staticPath: string;
45
8
  src: string;
9
+ provider: "static" | "cloudinary";
46
10
  radius: "circle" | "none" | "rounded";
47
11
  srcset: string;
48
12
  sizes: string;
49
- provider: "static" | "cloudinary";
50
- }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
13
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {
14
+ img: HTMLImageElement;
15
+ }, any>;
51
16
  export default _default;
52
17
 
53
18
  export declare interface ImageProps {
@@ -1,4 +1,4 @@
1
- import { defineComponent as W, inject as C, computed as a, useAttrs as M, createElementBlock as B, openBlock as k, mergeProps as L, unref as $ } from "vue";
1
+ import { defineComponent as W, inject as C, computed as c, useAttrs as M, createElementBlock as B, openBlock as k, mergeProps as L, unref as $ } from "vue";
2
2
  import { IMAGE_PROVIDER_URLS as N, SCREEN_SIZES as w } from "./constants.js";
3
3
  import q from "lodash-es/merge";
4
4
  const j = {
@@ -13,21 +13,21 @@ function P(t) {
13
13
  return (s) => t[s] || s;
14
14
  }
15
15
  function G({
16
- formatter: t = (m, c) => `${m}=${c}`,
16
+ formatter: t = (p, i) => `${p}=${i}`,
17
17
  keyMap: s,
18
- joinWith: i = "/",
18
+ joinWith: u = "/",
19
19
  valueMap: e = {}
20
20
  } = {}) {
21
- const m = typeof s == "function" ? s : P(s || {});
22
- return Object.keys(e).forEach((c) => {
23
- typeof e[c] != "function" && (e[c] = P(e[c]));
24
- }), (c = {}) => Object.entries(c).map(([l, d]) => {
25
- const p = e[l], g = m(l);
26
- let v = d;
27
- return typeof p == "function" && (v = p(c[l])), t(g, v);
28
- }).join(i);
21
+ const p = typeof s == "function" ? s : P(s || {});
22
+ return Object.keys(e).forEach((i) => {
23
+ typeof e[i] != "function" && (e[i] = P(e[i]));
24
+ }), (i = {}) => Object.entries(i).map(([l, d]) => {
25
+ const m = e[l], g = p(l);
26
+ let h = d;
27
+ return typeof m == "function" && (h = m(i[l])), t(g, h);
28
+ }).join(u);
29
29
  }
30
- const Q = N.CLOUDINARY, T = (t) => t.startsWith("#") ? t.replace("#", "rgb_") : t, E = G({
30
+ const Q = N.CLOUDINARY, T = (t) => t.startsWith("#") ? t.replace("#", "rgb_") : t, O = G({
31
31
  keyMap: {
32
32
  fit: "c",
33
33
  width: "w",
@@ -59,13 +59,13 @@ const Q = N.CLOUDINARY, T = (t) => t.startsWith("#") ? t.replace("#", "rgb_") :
59
59
  quality: "auto:best"
60
60
  };
61
61
  function F(t, s = {}) {
62
- const i = q(D, s), e = E(i);
62
+ const u = q(D, s), e = O(u);
63
63
  return `${Q}/${e}/${t}`;
64
64
  }
65
65
  const V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
66
66
  __proto__: null,
67
67
  getImageUrl: F,
68
- operationsGenerator: E
68
+ operationsGenerator: O
69
69
  }, Symbol.toStringTag, { value: "Module" }));
70
70
  function H(t = "") {
71
71
  return t;
@@ -91,62 +91,58 @@ const Y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
91
91
  const s = {
92
92
  md: w.md,
93
93
  lg: w.lg
94
- }, i = C("stashOptions"), e = t, m = a(() => {
94
+ }, u = C("stashOptions"), e = t, p = c(() => {
95
95
  const { src: r, ...n } = M();
96
- return n.sizes = v.value, n.srcset = I.value, n;
97
- }), c = a(() => {
96
+ return n.sizes = h.value, n.srcset = E.value, n;
97
+ }), i = c(() => {
98
98
  try {
99
99
  return new URL(e.src), !0;
100
100
  } catch {
101
101
  return !1;
102
102
  }
103
- }), S = a(() => {
104
- var r;
105
- return e.provider || ((r = i == null ? void 0 : i.images) == null ? void 0 : r.provider) || b.Static;
106
- }), l = a(() => e.staticPath ?? (i == null ? void 0 : i.staticPath)), d = a(() => S.value === b.Static), p = a(() => Z[S.value]), g = a(() => d.value ? _() : _({ width: j.md })), v = a(() => e.sizes ? O() : e.sizes), I = a(() => e.sizes && !e.srcset && !d.value ? R() : e.srcset), U = a(() => e.sizes ? x(e.sizes) : []);
103
+ }), S = c(() => e.provider || u?.images?.provider || b.Static), l = c(() => e.staticPath ?? u?.staticPath), d = c(() => S.value === b.Static), m = c(() => Z[S.value]), g = c(() => d.value ? _() : _({ width: j.md })), h = c(() => e.sizes ? R() : e.sizes), E = c(() => e.sizes && !e.srcset && !d.value ? U() : e.srcset), I = c(() => e.sizes ? x(e.sizes) : []);
107
104
  function _(r = {}) {
108
- if (d.value && c.value)
105
+ if (d.value && i.value)
109
106
  return e.src;
110
107
  const n = d.value && l.value ? `${l.value}/${e.src}` : e.src;
111
- return p.value.getImageUrl(n, r);
108
+ return m.value.getImageUrl(n, r);
112
109
  }
113
- function R() {
110
+ function U() {
114
111
  return Object.values(j).map((r) => `${_({ width: r })} ${r}w`).join(", ");
115
112
  }
116
- function O() {
117
- var r;
118
- return (r = e.sizes) != null && r.includes("(") ? e.sizes : U.value.map((n) => `${n.mediaQuery ? n.mediaQuery + " " : ""}${n.size}`).join(", ");
113
+ function R() {
114
+ return e.sizes?.includes("(") ? e.sizes : I.value.map((r) => `${r.mediaQuery ? r.mediaQuery + " " : ""}${r.size}`).join(", ");
119
115
  }
120
116
  function x(r = "") {
121
- const n = [], h = {
117
+ const n = [], v = {
122
118
  default: "100vw"
123
119
  };
124
120
  if (typeof r == "string") {
125
- const f = r.split(/[\s]+/).filter((u) => u);
126
- for (const u of f) {
127
- const o = u.split(":");
121
+ const f = r.split(/[\s]+/).filter((a) => a);
122
+ for (const a of f) {
123
+ const o = a.split(":");
128
124
  if (o.length !== 2) {
129
- h.default = o[0].trim();
125
+ v.default = o[0].trim();
130
126
  continue;
131
127
  }
132
- h[o[0].trim()] = o[1].trim();
128
+ v[o[0].trim()] = o[1].trim();
133
129
  }
134
130
  } else
135
131
  throw new Error("`sizes` needs to be a string");
136
- for (const f in h) {
137
- const u = parseInt(s[f] || 0);
138
- let o = String(h[f]);
132
+ for (const f in v) {
133
+ const a = parseInt(s[f] || 0);
134
+ let o = String(v[f]);
139
135
  const y = o.endsWith("vw");
140
136
  if (!y && /^\d+$/.test(o) && (o = `${o}px`), !y && o.endsWith("%"))
141
137
  throw new Error("Image: `sizes` does not support percentage values");
142
138
  const A = {
143
- mediaQuery: u ? `(min-width: ${u}px)` : "",
144
- screenMinWidth: u,
139
+ mediaQuery: a ? `(min-width: ${a}px)` : "",
140
+ screenMinWidth: a,
145
141
  size: o
146
142
  };
147
143
  n.push(A);
148
144
  }
149
- return n.sort((f, u) => f.screenMinWidth > u.screenMinWidth ? -1 : 1), n;
145
+ return n.sort((f, a) => f.screenMinWidth > a.screenMinWidth ? -1 : 1), n;
150
146
  }
151
147
  return (r, n) => (k(), B("img", L({
152
148
  ref: "img",
@@ -157,7 +153,7 @@ const Y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
157
153
  "tw-rounded-full": e.radius === $(z).Circle
158
154
  }],
159
155
  src: g.value
160
- }, m.value), null, 16, J));
156
+ }, p.value), null, 16, J));
161
157
  }
162
158
  });
163
159
  export {
@@ -166,4 +162,4 @@ export {
166
162
  et as _,
167
163
  b as a
168
164
  };
169
- //# sourceMappingURL=Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js.map
165
+ //# sourceMappingURL=Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js","sources":["../src/components/Image/Image.types.ts","../src/components/Image/providers/utils.ts","../src/components/Image/providers/cloudinary.ts","../src/components/Image/providers/static.ts","../src/components/Image/providers/index.ts","../src/components/Image/Image.vue"],"sourcesContent":["// Sizes used to generate resized and optimized versions of an image.\n// Generated in `srcset`, and informed by `sizes`.\nexport const Screens = {\n xs: 160,\n sm: 338,\n md: 676,\n lg: 1352,\n xl: 2704,\n} as const;\n\nexport interface ImageSizeCondition {\n mediaQuery: string;\n screenMinWidth: number;\n size: string;\n}\n\nexport enum ImageRadius {\n None = 'none',\n Rounded = 'rounded',\n Circle = 'circle',\n}\n\nexport type ImageRadii = `${ImageRadius}`;\n\nexport enum ImageProviders {\n Cloudinary = 'cloudinary',\n Static = 'static',\n}\n","export interface ImageModifiers {\n format?: string;\n height?: number;\n width?: number;\n [key: string]: any /* eslint-disable-line @typescript-eslint/no-explicit-any */;\n}\n\nexport type ParamFormatter = (key: string, value: string) => string;\n\nexport type ParamMapper = { [key: string]: string } | ((key: string) => string);\n\nexport interface ProviderUrlBuilder {\n keyMap?: ParamMapper;\n formatter?: ParamFormatter;\n joinWith?: string;\n valueMap?: {\n [key: string]: ParamMapper;\n };\n}\n\nfunction createMapper(map: ParamMapper) {\n return (key: string) => {\n return map[key] || key;\n };\n}\n\n/**\n * Builds the parameterized Cloudinary url\n */\nexport function buildProviderUrl({\n formatter = (key, value) => `${key}=${value}`,\n keyMap,\n joinWith = '/',\n valueMap = {},\n}: ProviderUrlBuilder = {}) {\n const keyMapper = typeof keyMap === 'function' ? keyMap : createMapper(keyMap || {});\n\n Object.keys(valueMap).forEach((valueKey) => {\n if (typeof valueMap[valueKey] !== 'function') {\n valueMap[valueKey] = createMapper(valueMap[valueKey]);\n }\n });\n\n return (modifiers: { [key: string]: string } = {}) => {\n const operations = Object.entries(modifiers).map(([key, value]) => {\n const mapper = valueMap[key];\n const newKey = keyMapper(key);\n let newVal = value;\n\n if (typeof mapper === 'function') {\n newVal = mapper(modifiers[key]);\n }\n\n return formatter(newKey, newVal);\n });\n\n return operations.join(joinWith);\n };\n}\n\n/**\n * Checks if a (sub)domain is included in a list of acceptable domains\n * @param str the (sub)domain to check\n * @param domains an array of valid domains\n */\nexport function isDomainValid(str = '', domains: string[] = []): boolean {\n const url = new URL(str);\n const host = url.host;\n\n return domains.some((domain) => {\n if (domain === host) {\n return true;\n }\n\n return domain.endsWith(`.${host}`);\n });\n}\n","import merge from 'lodash-es/merge';\n\nimport { IMAGE_PROVIDER_URLS } from '../../../constants';\nimport { buildProviderUrl, ImageModifiers } from './utils';\n\nconst BASE_URL = IMAGE_PROVIDER_URLS.CLOUDINARY;\n\nconst convertHextoRGBFormat = (value: string) => (value.startsWith('#') ? value.replace('#', 'rgb_') : value);\n\n/**\n * Parameters (option and value pairs) that can be used in the <transformations> segment of the Cloudinary transformation URL.\n * Options and their respective values are connected by an underscore (eg `w_250` for width of 250px.).\n * Multiple parameters are comma separated (eg. `w_250,h_250`).\n *\n * `keyMap` maps the option to its option prefix.\n * `valueMap` is used for grouping options using the same `keyMap` value under a 'category', allowing for easier usage and custom labelling in the component context.\n *\n * Transformation URL structure:\n * https://cloudinary.com/documentation/transformation_reference\n *\n * Transformation URL parameters (options and values):\n * https://cloudinary.com/documentation/image_transformations#transformation_url_syntax\n *\n */\nexport const operationsGenerator = buildProviderUrl({\n keyMap: {\n fit: 'c',\n width: 'w',\n height: 'h',\n format: 'f',\n quality: 'q',\n background: 'b',\n dpr: 'dpr',\n },\n valueMap: {\n fit: {\n fill: 'fill',\n inside: 'pad',\n outside: 'lpad',\n cover: 'fit',\n contain: 'scale',\n },\n format: {\n jpeg: 'jpg',\n },\n background(value: string) {\n return convertHextoRGBFormat(value);\n },\n },\n joinWith: ',',\n formatter: (key, value) => `${key}_${value}`,\n});\n\n// Note: Not configurable via Image props (for now).\nconst defaultModifiers = {\n format: 'auto',\n quality: 'auto:best',\n};\n\nexport function getImageUrl(src: string, modifiers: Partial<ImageModifiers> = {}): string {\n const mergeModifiers = merge(defaultModifiers, modifiers);\n const operations = operationsGenerator(mergeModifiers);\n\n return `${BASE_URL}/${operations}/${src}`;\n}\n","export function getImageUrl(src = ''): string {\n return src;\n}\n","import * as cloudinary from './cloudinary';\nimport * as staticProvider from './static';\n\nexport default {\n cloudinary,\n static: staticProvider,\n};\n","<script lang=\"ts\">\n export * from './Image.types';\n</script>\n\n<script setup lang=\"ts\">\n import { computed, inject, useAttrs } from 'vue';\n\n import { StashImageProviders, StashProvideState } from '../../../types/misc';\n import { SCREEN_SIZES } from '../../constants';\n import { ImageProviders, ImageRadii, ImageRadius, ImageSizeCondition, Screens } from './Image.types';\n import providers from './providers';\n import { ImageModifiers } from './providers/utils';\n\n export interface ImageProps {\n /**\n * The path to the image you want to embed.\n */\n src: string;\n\n /**\n * Native srcset attribute.\n * One or more strings separated by commas, indicating possible image sources\n * Can only be used with provider=static, otherwise it's ignored and auto-generated with `sizes` usage\n */\n srcset?: string;\n\n /**\n * For specifying responsive sizes\n */\n sizes?: string;\n\n /**\n * Where the image is served from.\n * If not provided, the provider will inherit from the Stash config `stashOptions.images.provider` (default: `static`).\n * - `static` for relative or absolute paths\n * - `cloudinary` for images served via Cloudinary\n */\n provider?: StashImageProviders;\n\n /**\n * For applying border radius\n */\n radius?: ImageRadii;\n\n /**\n * A custom static path the image src will be appended onto when provider=static.\n * Can be used to override the library-level default.\n */\n staticPath?: string;\n\n /**\n * TODO - https://leaflink.atlassian.net/browse/GRO-204\n * A custom function used to resolve a URL string for the image\n */\n // loader?: () => string;\n }\n\n defineOptions({\n inheritAttrs: false,\n });\n\n const BREAKPOINTS = {\n md: SCREEN_SIZES.md,\n lg: SCREEN_SIZES.lg,\n };\n const stashOptions = inject<StashProvideState>('stashOptions');\n const props = withDefaults(defineProps<ImageProps>(), {\n src: '',\n srcset: undefined,\n sizes: undefined,\n staticPath: undefined,\n provider: undefined,\n radius: 'none',\n // loader: undefined, // TODO - https://leaflink.atlassian.net/browse/GRO-204\n });\n\n const attrs = computed(() => {\n const { src, ...attrs } = useAttrs();\n\n attrs.sizes = imgSizes.value;\n attrs.srcset = imgSrcset.value;\n\n return attrs;\n });\n\n const isAbsoluteUrl = computed(() => {\n // return true if not an absolute url\n try {\n new URL(props.src);\n return true;\n } catch (e) {\n return false;\n }\n });\n\n const computedProvider = computed(() => props.provider || stashOptions?.images?.provider || ImageProviders.Static);\n\n const computedStaticPath = computed(() => props.staticPath ?? stashOptions?.staticPath);\n\n const isStatic = computed(() => computedProvider.value === ImageProviders.Static);\n\n const imgProvider = computed(() => providers[computedProvider.value]);\n\n const imgSrc = computed(() => (isStatic.value ? getProviderImage() : getProviderImage({ width: Screens.md })));\n\n const imgSizes = computed(() => (props.sizes ? getSizes() : props.sizes));\n\n const imgSrcset = computed(() => (props.sizes && !props.srcset && !isStatic.value ? getSources() : props.srcset));\n\n const parsedSizes = computed(() => {\n return props.sizes ? parseSizes(props.sizes) : [];\n });\n\n function getProviderImage(modifiers: ImageModifiers = {}) {\n if (isStatic.value && isAbsoluteUrl.value) {\n return props.src;\n }\n\n const src = isStatic.value && computedStaticPath.value ? `${computedStaticPath.value}/${props.src}` : props.src;\n\n return imgProvider.value.getImageUrl(src, modifiers);\n }\n\n function getSources() {\n return Object.values(Screens)\n .map((width) => {\n const src = getProviderImage({ width });\n\n return `${src} ${width}w`;\n })\n .join(', ');\n }\n\n function getSizes() {\n // return if using native media conditions\n if (props.sizes?.includes('(')) {\n return props.sizes;\n }\n\n return parsedSizes.value.map((v) => `${v.mediaQuery ? v.mediaQuery + ' ' : ''}${v.size}`).join(', ');\n }\n\n function parseSizes(providedSizes = '') {\n const conditions: ImageSizeCondition[] = [];\n const sizes = {\n default: '100vw',\n };\n\n // parse sizes and convert to object\n if (typeof providedSizes === 'string') {\n const definitions = providedSizes.split(/[\\s]+/).filter((size) => size);\n\n for (const entry of definitions) {\n const size = entry.split(':');\n\n if (size.length !== 2) {\n sizes['default'] = size[0].trim();\n continue;\n }\n\n sizes[size[0].trim()] = size[1].trim();\n }\n } else {\n throw new Error('`sizes` needs to be a string');\n }\n\n for (const key in sizes) {\n const screenMinWidth = parseInt(BREAKPOINTS[key] || 0);\n let size = String(sizes[key]);\n const isFluidSize = size.endsWith('vw');\n\n // convert integer to pixels\n if (!isFluidSize && /^\\d+$/.test(size)) {\n size = `${size}px`;\n }\n\n if (!isFluidSize && size.endsWith('%')) {\n throw new Error('Image: `sizes` does not support percentage values');\n }\n\n const condition = {\n mediaQuery: screenMinWidth ? `(min-width: ${screenMinWidth}px)` : '',\n screenMinWidth,\n size,\n };\n\n conditions.push(condition);\n }\n\n conditions.sort((v1, v2) => (v1.screenMinWidth > v2.screenMinWidth ? -1 : 1));\n\n return conditions;\n }\n</script>\n\n<template>\n <img\n ref=\"img\"\n :key=\"imgSrc\"\n data-test=\"stash-image\"\n class=\"stash-image\"\n :class=\"{\n 'tw-rounded': props.radius === ImageRadius.Rounded,\n 'tw-rounded-full': props.radius === ImageRadius.Circle,\n }\"\n :src=\"imgSrc\"\n v-bind=\"attrs\"\n />\n</template>\n"],"names":["Screens","ImageRadius","ImageProviders","createMapper","map","key","buildProviderUrl","formatter","value","keyMap","joinWith","valueMap","keyMapper","valueKey","modifiers","mapper","newKey","newVal","BASE_URL","IMAGE_PROVIDER_URLS","convertHextoRGBFormat","operationsGenerator","defaultModifiers","getImageUrl","src","mergeModifiers","merge","operations","providers","cloudinary","staticProvider","BREAKPOINTS","SCREEN_SIZES","stashOptions","inject","props","__props","attrs","computed","useAttrs","imgSizes","imgSrcset","isAbsoluteUrl","computedProvider","_a","computedStaticPath","isStatic","imgProvider","imgSrc","getProviderImage","getSizes","getSources","parsedSizes","parseSizes","width","v","providedSizes","conditions","sizes","definitions","size","entry","screenMinWidth","isFluidSize","condition","v1","v2"],"mappings":";;;AAEO,MAAMA,IAAU;AAAA,EACrB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAQY,IAAAC,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,UAAU,WACVA,EAAA,SAAS,UAHCA,IAAAA,KAAA,CAAA,CAAA,GAQAC,sBAAAA,OACVA,EAAA,aAAa,cACbA,EAAA,SAAS,UAFCA,IAAAA,KAAA,CAAA,CAAA;ACJZ,SAASC,EAAaC,GAAkB;AACtC,SAAO,CAACC,MACCD,EAAIC,CAAG,KAAKA;AAEvB;AAKO,SAASC,EAAiB;AAAA,EAC/B,WAAAC,IAAY,CAACF,GAAKG,MAAU,GAAGH,CAAG,IAAIG,CAAK;AAAA,EAC3C,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW,CAAA;AACb,IAAwB,IAAI;AACpB,QAAAC,IAAY,OAAOH,KAAW,aAAaA,IAASN,EAAa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AAA,MACvC;AAEM,cAAA,IAAI,MAAM,8BAA8B;AAGhD,iBAAWvD,KAAOqD,GAAO;AACvB,cAAMI,IAAiB,SAAS/B,EAAY1B,CAAG,KAAK,CAAC;AACrD,YAAIuD,IAAO,OAAOF,EAAMrD,CAAG,CAAC;AACtB,cAAA0D,IAAcH,EAAK,SAAS,IAAI;AAOtC,YAJI,CAACG,KAAe,QAAQ,KAAKH,CAAI,MACnCA,IAAO,GAAGA,CAAI,OAGZ,CAACG,KAAeH,EAAK,SAAS,GAAG;AAC7B,gBAAA,IAAI,MAAM,mDAAmD;AAGrE,cAAMI,IAAY;AAAA,UAChB,YAAYF,IAAiB,eAAeA,CAAc,QAAQ;AAAA,UAClE,gBAAAA;AAAA,UACA,MAAAF;AAAA,QACF;AAEA,QAAAH,EAAW,KAAKO,CAAS;AAAA,MAAA;AAGhB,aAAAP,EAAA,KAAK,CAACQ,GAAIC,MAAQD,EAAG,iBAAiBC,EAAG,iBAAiB,KAAK,CAAE,GAErET;AAAA,IAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js","sources":["../src/components/Image/Image.types.ts","../src/components/Image/providers/utils.ts","../src/components/Image/providers/cloudinary.ts","../src/components/Image/providers/static.ts","../src/components/Image/providers/index.ts","../src/components/Image/Image.vue"],"sourcesContent":["// Sizes used to generate resized and optimized versions of an image.\n// Generated in `srcset`, and informed by `sizes`.\nexport const Screens = {\n xs: 160,\n sm: 338,\n md: 676,\n lg: 1352,\n xl: 2704,\n} as const;\n\nexport interface ImageSizeCondition {\n mediaQuery: string;\n screenMinWidth: number;\n size: string;\n}\n\nexport enum ImageRadius {\n None = 'none',\n Rounded = 'rounded',\n Circle = 'circle',\n}\n\nexport type ImageRadii = `${ImageRadius}`;\n\nexport enum ImageProviders {\n Cloudinary = 'cloudinary',\n Static = 'static',\n}\n","export interface ImageModifiers {\n format?: string;\n height?: number;\n width?: number;\n [key: string]: any /* eslint-disable-line @typescript-eslint/no-explicit-any */;\n}\n\nexport type ParamFormatter = (key: string, value: string) => string;\n\nexport type ParamMapper = { [key: string]: string } | ((key: string) => string);\n\nexport interface ProviderUrlBuilder {\n keyMap?: ParamMapper;\n formatter?: ParamFormatter;\n joinWith?: string;\n valueMap?: {\n [key: string]: ParamMapper;\n };\n}\n\nfunction createMapper(map: ParamMapper) {\n return (key: string) => {\n return map[key] || key;\n };\n}\n\n/**\n * Builds the parameterized Cloudinary url\n */\nexport function buildProviderUrl({\n formatter = (key, value) => `${key}=${value}`,\n keyMap,\n joinWith = '/',\n valueMap = {},\n}: ProviderUrlBuilder = {}) {\n const keyMapper = typeof keyMap === 'function' ? keyMap : createMapper(keyMap || {});\n\n Object.keys(valueMap).forEach((valueKey) => {\n if (typeof valueMap[valueKey] !== 'function') {\n valueMap[valueKey] = createMapper(valueMap[valueKey]);\n }\n });\n\n return (modifiers: { [key: string]: string } = {}) => {\n const operations = Object.entries(modifiers).map(([key, value]) => {\n const mapper = valueMap[key];\n const newKey = keyMapper(key);\n let newVal = value;\n\n if (typeof mapper === 'function') {\n newVal = mapper(modifiers[key]);\n }\n\n return formatter(newKey, newVal);\n });\n\n return operations.join(joinWith);\n };\n}\n\n/**\n * Checks if a (sub)domain is included in a list of acceptable domains\n * @param str the (sub)domain to check\n * @param domains an array of valid domains\n */\nexport function isDomainValid(str = '', domains: string[] = []): boolean {\n const url = new URL(str);\n const host = url.host;\n\n return domains.some((domain) => {\n if (domain === host) {\n return true;\n }\n\n return domain.endsWith(`.${host}`);\n });\n}\n","import merge from 'lodash-es/merge';\n\nimport { IMAGE_PROVIDER_URLS } from '../../../constants';\nimport { buildProviderUrl, ImageModifiers } from './utils';\n\nconst BASE_URL = IMAGE_PROVIDER_URLS.CLOUDINARY;\n\nconst convertHextoRGBFormat = (value: string) => (value.startsWith('#') ? value.replace('#', 'rgb_') : value);\n\n/**\n * Parameters (option and value pairs) that can be used in the <transformations> segment of the Cloudinary transformation URL.\n * Options and their respective values are connected by an underscore (eg `w_250` for width of 250px.).\n * Multiple parameters are comma separated (eg. `w_250,h_250`).\n *\n * `keyMap` maps the option to its option prefix.\n * `valueMap` is used for grouping options using the same `keyMap` value under a 'category', allowing for easier usage and custom labelling in the component context.\n *\n * Transformation URL structure:\n * https://cloudinary.com/documentation/transformation_reference\n *\n * Transformation URL parameters (options and values):\n * https://cloudinary.com/documentation/image_transformations#transformation_url_syntax\n *\n */\nexport const operationsGenerator = buildProviderUrl({\n keyMap: {\n fit: 'c',\n width: 'w',\n height: 'h',\n format: 'f',\n quality: 'q',\n background: 'b',\n dpr: 'dpr',\n },\n valueMap: {\n fit: {\n fill: 'fill',\n inside: 'pad',\n outside: 'lpad',\n cover: 'fit',\n contain: 'scale',\n },\n format: {\n jpeg: 'jpg',\n },\n background(value: string) {\n return convertHextoRGBFormat(value);\n },\n },\n joinWith: ',',\n formatter: (key, value) => `${key}_${value}`,\n});\n\n// Note: Not configurable via Image props (for now).\nconst defaultModifiers = {\n format: 'auto',\n quality: 'auto:best',\n};\n\nexport function getImageUrl(src: string, modifiers: Partial<ImageModifiers> = {}): string {\n const mergeModifiers = merge(defaultModifiers, modifiers);\n const operations = operationsGenerator(mergeModifiers);\n\n return `${BASE_URL}/${operations}/${src}`;\n}\n","export function getImageUrl(src = ''): string {\n return src;\n}\n","import * as cloudinary from './cloudinary';\nimport * as staticProvider from './static';\n\nexport default {\n cloudinary,\n static: staticProvider,\n};\n","<script lang=\"ts\">\n export * from './Image.types';\n</script>\n\n<script setup lang=\"ts\">\n import { computed, inject, useAttrs } from 'vue';\n\n import { StashImageProviders, StashProvideState } from '../../../types/misc';\n import { SCREEN_SIZES } from '../../constants';\n import { ImageProviders, ImageRadii, ImageRadius, ImageSizeCondition, Screens } from './Image.types';\n import providers from './providers';\n import { ImageModifiers } from './providers/utils';\n\n export interface ImageProps {\n /**\n * The path to the image you want to embed.\n */\n src: string;\n\n /**\n * Native srcset attribute.\n * One or more strings separated by commas, indicating possible image sources\n * Can only be used with provider=static, otherwise it's ignored and auto-generated with `sizes` usage\n */\n srcset?: string;\n\n /**\n * For specifying responsive sizes\n */\n sizes?: string;\n\n /**\n * Where the image is served from.\n * If not provided, the provider will inherit from the Stash config `stashOptions.images.provider` (default: `static`).\n * - `static` for relative or absolute paths\n * - `cloudinary` for images served via Cloudinary\n */\n provider?: StashImageProviders;\n\n /**\n * For applying border radius\n */\n radius?: ImageRadii;\n\n /**\n * A custom static path the image src will be appended onto when provider=static.\n * Can be used to override the library-level default.\n */\n staticPath?: string;\n\n /**\n * TODO - https://leaflink.atlassian.net/browse/GRO-204\n * A custom function used to resolve a URL string for the image\n */\n // loader?: () => string;\n }\n\n defineOptions({\n inheritAttrs: false,\n });\n\n const BREAKPOINTS = {\n md: SCREEN_SIZES.md,\n lg: SCREEN_SIZES.lg,\n };\n const stashOptions = inject<StashProvideState>('stashOptions');\n const props = withDefaults(defineProps<ImageProps>(), {\n src: '',\n srcset: undefined,\n sizes: undefined,\n staticPath: undefined,\n provider: undefined,\n radius: 'none',\n // loader: undefined, // TODO - https://leaflink.atlassian.net/browse/GRO-204\n });\n\n const attrs = computed(() => {\n const { src, ...attrs } = useAttrs();\n\n attrs.sizes = imgSizes.value;\n attrs.srcset = imgSrcset.value;\n\n return attrs;\n });\n\n const isAbsoluteUrl = computed(() => {\n // return true if not an absolute url\n try {\n new URL(props.src);\n return true;\n } catch (e) {\n return false;\n }\n });\n\n const computedProvider = computed(() => props.provider || stashOptions?.images?.provider || ImageProviders.Static);\n\n const computedStaticPath = computed(() => props.staticPath ?? stashOptions?.staticPath);\n\n const isStatic = computed(() => computedProvider.value === ImageProviders.Static);\n\n const imgProvider = computed(() => providers[computedProvider.value]);\n\n const imgSrc = computed(() => (isStatic.value ? getProviderImage() : getProviderImage({ width: Screens.md })));\n\n const imgSizes = computed(() => (props.sizes ? getSizes() : props.sizes));\n\n const imgSrcset = computed(() => (props.sizes && !props.srcset && !isStatic.value ? getSources() : props.srcset));\n\n const parsedSizes = computed(() => {\n return props.sizes ? parseSizes(props.sizes) : [];\n });\n\n function getProviderImage(modifiers: ImageModifiers = {}) {\n if (isStatic.value && isAbsoluteUrl.value) {\n return props.src;\n }\n\n const src = isStatic.value && computedStaticPath.value ? `${computedStaticPath.value}/${props.src}` : props.src;\n\n return imgProvider.value.getImageUrl(src, modifiers);\n }\n\n function getSources() {\n return Object.values(Screens)\n .map((width) => {\n const src = getProviderImage({ width });\n\n return `${src} ${width}w`;\n })\n .join(', ');\n }\n\n function getSizes() {\n // return if using native media conditions\n if (props.sizes?.includes('(')) {\n return props.sizes;\n }\n\n return parsedSizes.value.map((v) => `${v.mediaQuery ? v.mediaQuery + ' ' : ''}${v.size}`).join(', ');\n }\n\n function parseSizes(providedSizes = '') {\n const conditions: ImageSizeCondition[] = [];\n const sizes = {\n default: '100vw',\n };\n\n // parse sizes and convert to object\n if (typeof providedSizes === 'string') {\n const definitions = providedSizes.split(/[\\s]+/).filter((size) => size);\n\n for (const entry of definitions) {\n const size = entry.split(':');\n\n if (size.length !== 2) {\n sizes['default'] = size[0].trim();\n continue;\n }\n\n sizes[size[0].trim()] = size[1].trim();\n }\n } else {\n throw new Error('`sizes` needs to be a string');\n }\n\n for (const key in sizes) {\n const screenMinWidth = parseInt(BREAKPOINTS[key] || 0);\n let size = String(sizes[key]);\n const isFluidSize = size.endsWith('vw');\n\n // convert integer to pixels\n if (!isFluidSize && /^\\d+$/.test(size)) {\n size = `${size}px`;\n }\n\n if (!isFluidSize && size.endsWith('%')) {\n throw new Error('Image: `sizes` does not support percentage values');\n }\n\n const condition = {\n mediaQuery: screenMinWidth ? `(min-width: ${screenMinWidth}px)` : '',\n screenMinWidth,\n size,\n };\n\n conditions.push(condition);\n }\n\n conditions.sort((v1, v2) => (v1.screenMinWidth > v2.screenMinWidth ? -1 : 1));\n\n return conditions;\n }\n</script>\n\n<template>\n <img\n ref=\"img\"\n :key=\"imgSrc\"\n data-test=\"stash-image\"\n class=\"stash-image\"\n :class=\"{\n 'tw-rounded': props.radius === ImageRadius.Rounded,\n 'tw-rounded-full': props.radius === ImageRadius.Circle,\n }\"\n :src=\"imgSrc\"\n v-bind=\"attrs\"\n />\n</template>\n"],"names":["Screens","ImageRadius","ImageProviders","createMapper","map","key","buildProviderUrl","formatter","value","keyMap","joinWith","valueMap","keyMapper","valueKey","modifiers","mapper","newKey","newVal","BASE_URL","IMAGE_PROVIDER_URLS","convertHextoRGBFormat","operationsGenerator","defaultModifiers","getImageUrl","src","mergeModifiers","merge","operations","providers","cloudinary","staticProvider","BREAKPOINTS","SCREEN_SIZES","stashOptions","inject","props","__props","attrs","computed","useAttrs","imgSizes","imgSrcset","isAbsoluteUrl","computedProvider","computedStaticPath","isStatic","imgProvider","imgSrc","getProviderImage","getSizes","getSources","parsedSizes","parseSizes","width","v","providedSizes","conditions","sizes","definitions","size","entry","screenMinWidth","isFluidSize","condition","v1","v2","_openBlock","_createElementBlock","_mergeProps","_unref","_hoisted_1"],"mappings":";;;AAEO,MAAMA,IAAU;AAAA,EACrB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAQO,IAAKC,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,UAAU,WACVA,EAAA,SAAS,UAHCA,IAAAA,KAAA,CAAA,CAAA,GAQAC,sBAAAA,OACVA,EAAA,aAAa,cACbA,EAAA,SAAS,UAFCA,IAAAA,KAAA,CAAA,CAAA;ACJZ,SAASC,EAAaC,GAAkB;AACtC,SAAO,CAACC,MACCD,EAAIC,CAAG,KAAKA;AAEvB;AAKO,SAASC,EAAiB;AAAA,EAC/B,WAAAC,IAAY,CAACF,GAAKG,MAAU,GAAGH,CAAG,IAAIG,CAAK;AAAA,EAC3C,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW,CAAA;AACb,IAAwB,IAAI;AAC1B,QAAMC,IAAY,OAAOH,KAAW,aAAaA,IAASN,EAAaM,KAAU,E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9B,EAAY1B,CAAG,KAAK,CAAC;AACrD,YAAIsD,IAAO,OAAOF,EAAMpD,CAAG,CAAC;AAC5B,cAAMyD,IAAcH,EAAK,SAAS,IAAI;AAOtC,YAJI,CAACG,KAAe,QAAQ,KAAKH,CAAI,MACnCA,IAAO,GAAGA,CAAI,OAGZ,CAACG,KAAeH,EAAK,SAAS,GAAG;AACnC,gBAAM,IAAI,MAAM,mDAAmD;AAGrE,cAAMI,IAAY;AAAA,UAChB,YAAYF,IAAiB,eAAeA,CAAc,QAAQ;AAAA,UAClE,gBAAAA;AAAA,UACA,MAAAF;AAAA,QAAA;AAGF,QAAAH,EAAW,KAAKO,CAAS;AAAA,MAC3B;AAEA,aAAAP,EAAW,KAAK,CAACQ,GAAIC,MAAQD,EAAG,iBAAiBC,EAAG,iBAAiB,KAAK,CAAE,GAErET;AAAA,IACT;sBAIAU,EAAA,GAAAC,EAWE,OAXFC,EAWE;AAAA,MAVA,KAAI;AAAA,MACH,KAAKrB,EAAA;AAAA,MACN,aAAU;AAAA,MACV,QAAM,eAAa;AAAA,QACW,cAAAZ,EAAM,WAAWkC,EAAApE,CAAA,EAAY;AAAA,QAAkC,mBAAAkC,EAAM,WAAWkC,EAAApE,CAAA,EAAY;AAAA,MAAA;MAIzH,KAAK8C,EAAA;AAAA,IAAA,GACEV,EAAA,KAAK,GAAA,MAAA,IAAAiC,CAAA;AAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"InlineEdit.js","sources":["../src/components/InlineEdit/InlineEdit.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, useAttrs, useSlots, watch } from 'vue';\n\n import { money, percent } from '../../utils/i18n';\n import Input from '../Input/Input.vue';\n\n defineOptions({\n name: 'll-inline-edit',\n inheritAttrs: false,\n });\n\n export interface InlineEditProps {\n /**\n * Formats the value displayed.\n * Options: currency, percent\n */\n format?: 'currency' | 'percent' | '';\n\n /**\n * DOM `type` property to be passed to `ll-input`.\n * Use type=\"number\" for localized numbers\n */\n type?: string;\n\n /**\n * The current value for the component.\n */\n modelValue?: string | number;\n\n /**\n * Used to display a crossed out value below the component\n * if the current `modelValue` does not match `oldValue`.\n */\n oldValue?: string | number;\n\n /**\n * Label to render for the input\n */\n label?: string;\n\n /**\n * Placeholder for the input\n */\n placeholder?: string;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) & adds error styling.\n */\n errorText?: string;\n\n /**\n * Hint text to display below the input\n */\n hintText?: string;\n }\n\n const slots = useSlots();\n const attrs = useAttrs();\n\n const props = withDefaults(defineProps<InlineEditProps>(), {\n format: '',\n type: 'text',\n modelValue: undefined,\n oldValue: undefined,\n label: ' ',\n placeholder: '',\n errorText: '',\n hintText: '',\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the value is updated\n */\n (e: 'update:model-value', value: string | number | undefined): void;\n }>();\n\n const editing = ref(false);\n\n // this value gets set once and never changes\n const originalValue = ref<InlineEditProps['oldValue']>(props.oldValue || props.modelValue);\n\n // the _current_ value. This is a temporary value, used while editing\n const internalValue = ref<InlineEditProps['modelValue']>(props.modelValue);\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs.class;\n return tempAttrs;\n });\n\n const formattedOriginalValue = computed(() => formatValue(originalValue.value || ''));\n\n const showOldValue = computed(() => {\n return (props.oldValue || props.oldValue === 0) && props.oldValue !== internalValue.value;\n });\n\n const isAppended = computed(() => {\n return !!slots.append;\n });\n\n const isPrepended = computed(() => {\n return !!slots.prepend;\n });\n\n watch(\n () => props.modelValue,\n (newVal?: string | number, oldVal?: string | number) => {\n if (newVal !== oldVal) {\n internalValue.value = newVal;\n }\n },\n );\n\n function dismiss() {\n internalValue.value = props.modelValue || props.oldValue;\n editing.value = false;\n blurInput();\n }\n\n /**\n * Toggles edit state on\n */\n function edit() {\n editing.value = true;\n focusInput();\n }\n\n /**\n * Formats the value based on `format`\n */\n function formatValue(value: string | number) {\n switch (props.format) {\n case 'currency':\n return money({\n amount: value as number,\n });\n case 'percent':\n return percent((value as number) / 100);\n default:\n return value;\n }\n }\n\n /**\n * This method saves the current value of the input field by `$emit`ing.\n * If the new value is empty, it reverts `internalValue` to the original value.\n */\n function save() {\n internalValue.value = !(internalValue.value === '') ? internalValue.value : originalValue.value;\n\n emit('update:model-value', internalValue.value);\n editing.value = false;\n blurInput();\n }\n\n const llInput = ref();\n\n function focusInput() {\n if (llInput.value) {\n llInput.value.inputEl.focus();\n }\n }\n\n function blurInput() {\n if (llInput.value) {\n llInput.value.inputEl.blur();\n }\n }\n</script>\n\n<template>\n <div class=\"stash-inline-edit\" :class=\"attrs.class\" data-test=\"stash-inline-edit\">\n <div class=\"stash-inline-edit__input-wrapper\">\n <Input\n ref=\"llInput\"\n v-model=\"internalValue\"\n :error-text=\"props.errorText\"\n :hint-text=\"props.hintText\"\n :label=\"props.label\"\n :placeholder=\"`${props.placeholder || originalValue}`\"\n :type=\"props.type\"\n v-bind=\"inputAttrs\"\n @blur=\"save\"\n @focus=\"edit\"\n @keydown.esc=\"dismiss\"\n @keyup.enter=\"blurInput\"\n >\n <template v-if=\"isPrepended\" #prepend>\n <!-- @slot renders content on the left side of the input -->\n <slot name=\"prepend\"> </slot>\n </template>\n\n <template v-if=\"isAppended\" #append>\n <!-- @slot renders content on the right side of the input -->\n <slot name=\"append\"> </slot>\n </template>\n </Input>\n </div>\n\n <span v-if=\"showOldValue\" class=\"tw-mt-1 tw-inline-block tw-pl-3 tw-text-ice-700 tw-line-through\">\n {{ formattedOriginalValue }}\n </span>\n </div>\n</template>\n"],"names":["slots","useSlots","attrs","useAttrs","props","__props","emit","__emit","editing","ref","originalValue","internalValue","inputAttrs","computed","tempAttrs","formattedOriginalValue","formatValue","showOldValue","isAppended","isPrepended","watch","newVal","oldVal","dismiss","blurInput","edit","focusInput","value","money","percent","save","llInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwDE,UAAMA,IAAQC,EAAS,GACjBC,IAAQC,EAAS,GAEjBC,IAAQC,GAWRC,IAAOC,G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B,IAAa;AACpB,MAAIK,EAAQ,SACFA,EAAA,MAAM,QAAQ,MAAM;AAAA,IAC9B;AAGF,aAASP,IAAY;AACnB,MAAIO,EAAQ,SACFA,EAAA,MAAM,QAAQ,KAAK;AAAA,IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"InlineEdit.js","sources":["../src/components/InlineEdit/InlineEdit.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, useAttrs, useSlots, watch } from 'vue';\n\n import { money, percent } from '../../utils/i18n';\n import Input from '../Input/Input.vue';\n\n defineOptions({\n name: 'll-inline-edit',\n inheritAttrs: false,\n });\n\n export interface InlineEditProps {\n /**\n * Formats the value displayed.\n * Options: currency, percent\n */\n format?: 'currency' | 'percent' | '';\n\n /**\n * DOM `type` property to be passed to `ll-input`.\n * Use type=\"number\" for localized numbers\n */\n type?: string;\n\n /**\n * The current value for the component.\n */\n modelValue?: string | number;\n\n /**\n * Used to display a crossed out value below the component\n * if the current `modelValue` does not match `oldValue`.\n */\n oldValue?: string | number;\n\n /**\n * Label to render for the input\n */\n label?: string;\n\n /**\n * Placeholder for the input\n */\n placeholder?: string;\n\n /**\n * Error text to display. Replaces `hintText` (if provided) & adds error styling.\n */\n errorText?: string;\n\n /**\n * Hint text to display below the input\n */\n hintText?: string;\n }\n\n const slots = useSlots();\n const attrs = useAttrs();\n\n const props = withDefaults(defineProps<InlineEditProps>(), {\n format: '',\n type: 'text',\n modelValue: undefined,\n oldValue: undefined,\n label: ' ',\n placeholder: '',\n errorText: '',\n hintText: '',\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the value is updated\n */\n (e: 'update:model-value', value: string | number | undefined): void;\n }>();\n\n const editing = ref(false);\n\n // this value gets set once and never changes\n const originalValue = ref<InlineEditProps['oldValue']>(props.oldValue || props.modelValue);\n\n // the _current_ value. This is a temporary value, used while editing\n const internalValue = ref<InlineEditProps['modelValue']>(props.modelValue);\n\n const inputAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs.class;\n return tempAttrs;\n });\n\n const formattedOriginalValue = computed(() => formatValue(originalValue.value || ''));\n\n const showOldValue = computed(() => {\n return (props.oldValue || props.oldValue === 0) && props.oldValue !== internalValue.value;\n });\n\n const isAppended = computed(() => {\n return !!slots.append;\n });\n\n const isPrepended = computed(() => {\n return !!slots.prepend;\n });\n\n watch(\n () => props.modelValue,\n (newVal?: string | number, oldVal?: string | number) => {\n if (newVal !== oldVal) {\n internalValue.value = newVal;\n }\n },\n );\n\n function dismiss() {\n internalValue.value = props.modelValue || props.oldValue;\n editing.value = false;\n blurInput();\n }\n\n /**\n * Toggles edit state on\n */\n function edit() {\n editing.value = true;\n focusInput();\n }\n\n /**\n * Formats the value based on `format`\n */\n function formatValue(value: string | number) {\n switch (props.format) {\n case 'currency':\n return money({\n amount: value as number,\n });\n case 'percent':\n return percent((value as number) / 100);\n default:\n return value;\n }\n }\n\n /**\n * This method saves the current value of the input field by `$emit`ing.\n * If the new value is empty, it reverts `internalValue` to the original value.\n */\n function save() {\n internalValue.value = !(internalValue.value === '') ? internalValue.value : originalValue.value;\n\n emit('update:model-value', internalValue.value);\n editing.value = false;\n blurInput();\n }\n\n const llInput = ref();\n\n function focusInput() {\n if (llInput.value) {\n llInput.value.inputEl.focus();\n }\n }\n\n function blurInput() {\n if (llInput.value) {\n llInput.value.inputEl.blur();\n }\n }\n</script>\n\n<template>\n <div class=\"stash-inline-edit\" :class=\"attrs.class\" data-test=\"stash-inline-edit\">\n <div class=\"stash-inline-edit__input-wrapper\">\n <Input\n ref=\"llInput\"\n v-model=\"internalValue\"\n :error-text=\"props.errorText\"\n :hint-text=\"props.hintText\"\n :label=\"props.label\"\n :placeholder=\"`${props.placeholder || originalValue}`\"\n :type=\"props.type\"\n v-bind=\"inputAttrs\"\n @blur=\"save\"\n @focus=\"edit\"\n @keydown.esc=\"dismiss\"\n @keyup.enter=\"blurInput\"\n >\n <template v-if=\"isPrepended\" #prepend>\n <!-- @slot renders content on the left side of the input -->\n <slot name=\"prepend\"> </slot>\n </template>\n\n <template v-if=\"isAppended\" #append>\n <!-- @slot renders content on the right side of the input -->\n <slot name=\"append\"> </slot>\n </template>\n </Input>\n </div>\n\n <span v-if=\"showOldValue\" class=\"tw-mt-1 tw-inline-block tw-pl-3 tw-text-ice-700 tw-line-through\">\n {{ formattedOriginalValue }}\n </span>\n </div>\n</template>\n"],"names":["slots","useSlots","attrs","useAttrs","props","__props","emit","__emit","editing","ref","originalValue","internalValue","inputAttrs","computed","tempAttrs","formattedOriginalValue","formatValue","showOldValue","isAppended","isPrepended","watch","newVal","oldVal","dismiss","blurInput","edit","focusInput","value","money","percent","save","llInput","_createElementBlock","_normalizeClass","_unref","_createElementVNode","_hoisted_1","_createVNode","Input","_mergeProps","$event","_renderSlot","_ctx","_hoisted_2","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwDE,UAAMA,IAAQC,EAAA,GACRC,IAAQC,EAAA,GAERC,IAAQC,GAWRC,IAAOC,GAOPC,IAAUC,EAAI,EAAK,GAGnBC,IAAgBD,EAAiCL,EAAM,YAAYA,EAAM,UAAU,GAGnFO,IAAgBF,EAAmCL,EAAM,UAAU,GAEnEQ,IAAaC,EAAS,MAAM;AAChC,YAAMC,IAAY,EAAE,GAAGZ,EAAA;AAEvB,oBAAOY,EAAU,OACVA;AAAA,IACT,CAAC,GAEKC,IAAyBF,EAAS,MAAMG,EAAYN,EAAc,SAAS,EAAE,CAAC,GAE9EO,IAAeJ,EAAS,OACpBT,EAAM,YAAYA,EAAM,aAAa,MAAMA,EAAM,aAAaO,EAAc,KACrF,GAEKO,IAAaL,EAAS,MACnB,CAAC,CAACb,EAAM,MAChB,GAEKmB,IAAcN,EAAS,MACpB,CAAC,CAACb,EAAM,OAChB;AAED,IAAAoB;AAAA,MACE,MAAMhB,EAAM;AAAA,MACZ,CAACiB,GAA0BC,MAA6B;AACtD,QAAID,MAAWC,MACbX,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