@getmicdrop/svelte-components 5.17.3 → 5.18.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 (340) hide show
  1. package/dist/calendar/AboutShow/AboutShow.svelte +187 -187
  2. package/dist/calendar/Calendar/MiniMonthCalendar.svelte +780 -782
  3. package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts.map +1 -1
  4. package/dist/calendar/FAQs/FAQs.svelte +77 -77
  5. package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte +125 -126
  6. package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte.d.ts.map +1 -1
  7. package/dist/calendar/OrderSummary/OrderSummary.svelte +457 -457
  8. package/dist/calendar/PublicCard/PublicCard.svelte +155 -146
  9. package/dist/calendar/PublicCard/PublicCard.svelte.d.ts.map +1 -1
  10. package/dist/calendar/ShowCard/ShowCard.spec.js +1 -7
  11. package/dist/calendar/ShowCard/ShowCard.svelte +166 -157
  12. package/dist/calendar/ShowCard/ShowCard.svelte.d.ts.map +1 -1
  13. package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +72 -61
  14. package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts +2 -0
  15. package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts.map +1 -1
  16. package/dist/components/Heading.svelte +60 -60
  17. package/dist/components/Layout/AppShell.svelte +104 -104
  18. package/dist/components/Layout/ContentSection.svelte +80 -80
  19. package/dist/components/Layout/Grid.svelte +4 -4
  20. package/dist/components/Layout/Heading.svelte +81 -81
  21. package/dist/components/Layout/PageContainer.svelte +69 -69
  22. package/dist/components/Layout/Responsive.svelte +75 -75
  23. package/dist/components/Layout/Section.svelte +80 -80
  24. package/dist/components/Layout/ShowOnDesktop.svelte +37 -37
  25. package/dist/components/Layout/ShowOnMobile.svelte +37 -37
  26. package/dist/components/Layout/Sidebar.svelte +108 -108
  27. package/dist/components/Layout/Stack.spec.js +1 -1
  28. package/dist/components/Layout/Stack.svelte +6 -6
  29. package/dist/components/Layout/Text.svelte +87 -87
  30. package/dist/components/Layout/TwoColumn.svelte +108 -108
  31. package/dist/components/Text.svelte +53 -53
  32. package/dist/config.d.ts +102 -0
  33. package/dist/config.js +147 -1
  34. package/dist/constants/validation.js +91 -91
  35. package/dist/constants/validation.spec.js +64 -64
  36. package/dist/datetime/README.md +323 -0
  37. package/dist/datetime/__tests__/format.test.js +1 -1
  38. package/dist/datetime/__tests__/parse.test.js +1 -1
  39. package/dist/datetime/__tests__/timezone.test.js +1 -1
  40. package/dist/datetime/parse.js +1 -1
  41. package/dist/forms/createFormStore.svelte.js +0 -1
  42. package/dist/forms/createFormStore.svelte.spec.js +0 -1
  43. package/dist/index.js +57 -57
  44. package/dist/index.spec.js +369 -369
  45. package/dist/messages.d.ts +43 -0
  46. package/dist/messages.d.ts.map +1 -0
  47. package/dist/messages.js +57 -0
  48. package/dist/patterns/chat/ChatActivityNotice.svelte +41 -41
  49. package/dist/patterns/chat/ChatBubble.svelte +95 -95
  50. package/dist/patterns/chat/ChatContainer.svelte +46 -46
  51. package/dist/patterns/chat/ChatDateDivider.svelte +27 -27
  52. package/dist/patterns/chat/ChatInvitationBubble.svelte +37 -37
  53. package/dist/patterns/chat/ChatInvitationNotice.svelte +27 -27
  54. package/dist/patterns/chat/ChatMessageGroup.svelte +57 -57
  55. package/dist/patterns/chat/ChatSlotUpdate.svelte +46 -46
  56. package/dist/patterns/chat/ChatStatusBadge.svelte +91 -91
  57. package/dist/patterns/chat/ChatStatusTransition.svelte +64 -64
  58. package/dist/patterns/chat/ChatTextBubble.svelte +41 -41
  59. package/dist/patterns/chat/index.js +22 -22
  60. package/dist/patterns/data/DataGrid.svelte +45 -45
  61. package/dist/patterns/data/DataList.svelte +24 -24
  62. package/dist/patterns/data/DataTable.svelte +36 -36
  63. package/dist/patterns/forms/FormActions.spec.js +95 -95
  64. package/dist/patterns/forms/FormActions.stories.svelte +97 -97
  65. package/dist/patterns/forms/FormActions.svelte +46 -46
  66. package/dist/patterns/forms/FormGrid.svelte +33 -33
  67. package/dist/patterns/forms/FormSection.svelte +32 -32
  68. package/dist/patterns/forms/FormValidationSummary.stories.svelte +83 -83
  69. package/dist/patterns/forms/FormValidationSummary.svelte +74 -74
  70. package/dist/patterns/index.js +21 -21
  71. package/dist/patterns/layout/Sidebar.svelte +39 -39
  72. package/dist/patterns/layout/index.js +29 -29
  73. package/dist/patterns/navigation/BottomNav.stories.svelte +117 -117
  74. package/dist/patterns/navigation/BottomNav.svelte +74 -74
  75. package/dist/patterns/navigation/Header.stories.svelte +77 -77
  76. package/dist/patterns/navigation/Header.svelte +251 -251
  77. package/dist/patterns/page/PageHeader.svelte +18 -18
  78. package/dist/patterns/page/PageLayout.svelte +40 -40
  79. package/dist/patterns/page/PageLoader.spec.js +57 -57
  80. package/dist/patterns/page/PageLoader.stories.svelte +137 -137
  81. package/dist/patterns/page/PageLoader.svelte +24 -24
  82. package/dist/patterns/page/SectionHeader.svelte +29 -29
  83. package/dist/presets/badges.js +112 -112
  84. package/dist/presets/buttons.js +76 -76
  85. package/dist/presets/index.js +9 -9
  86. package/dist/primitives/Accordion/Accordion.stories.svelte +75 -75
  87. package/dist/primitives/Accordion/Accordion.svelte +42 -42
  88. package/dist/primitives/Accordion/AccordionItem.svelte +95 -95
  89. package/dist/primitives/Alert/Alert.spec.js +173 -173
  90. package/dist/primitives/Alert/Alert.stories.svelte +88 -88
  91. package/dist/primitives/Alert/Alert.svelte +27 -27
  92. package/dist/primitives/Avatar/Avatar.stories.svelte +94 -94
  93. package/dist/primitives/Avatar/Avatar.svelte +66 -66
  94. package/dist/primitives/AvatarButton/AvatarButton.svelte +57 -57
  95. package/dist/primitives/Badges/Badge.spec.js +144 -144
  96. package/dist/primitives/Badges/Badge.stories.svelte +86 -86
  97. package/dist/primitives/Badges/Badge.svelte +99 -99
  98. package/dist/primitives/BottomSheet/BottomSheet.spec.js +238 -238
  99. package/dist/primitives/BottomSheet/BottomSheet.stories.svelte +83 -83
  100. package/dist/primitives/BottomSheet/BottomSheet.svelte +115 -115
  101. package/dist/primitives/Breadcrumb/Breadcrumb.spec.js +123 -123
  102. package/dist/primitives/Breadcrumb/Breadcrumb.stories.svelte +23 -23
  103. package/dist/primitives/Breadcrumb/Breadcrumb.svelte +99 -99
  104. package/dist/primitives/Button/Button.spec.js +225 -225
  105. package/dist/primitives/Button/Button.stories.svelte +76 -76
  106. package/dist/primitives/Button/Button.svelte +278 -278
  107. package/dist/primitives/Button/ButtonGroup.svelte +50 -50
  108. package/dist/primitives/Button/ButtonSaveDemo.spec.js +146 -146
  109. package/dist/primitives/Button/ButtonSaveDemo.svelte +25 -25
  110. package/dist/primitives/Button/ButtonVariantShowcase.svelte +129 -129
  111. package/dist/primitives/Card.spec.js +49 -49
  112. package/dist/primitives/Card.stories.svelte +22 -22
  113. package/dist/primitives/Card.svelte +28 -28
  114. package/dist/primitives/CardAction/CardAction.svelte +68 -68
  115. package/dist/primitives/Checkbox/Checkbox.stories.svelte +84 -84
  116. package/dist/primitives/Checkbox/Checkbox.svelte +88 -88
  117. package/dist/primitives/DarkModeToggle.spec.js +390 -390
  118. package/dist/primitives/DarkModeToggle.stories.svelte +57 -57
  119. package/dist/primitives/DarkModeToggle.svelte +136 -136
  120. package/dist/primitives/Drawer/Drawer.stories.svelte +80 -80
  121. package/dist/primitives/Drawer/Drawer.svelte +224 -224
  122. package/dist/primitives/Dropdown/Dropdown.stories.svelte +137 -137
  123. package/dist/primitives/Dropdown/Dropdown.svelte +170 -170
  124. package/dist/primitives/Dropdown/DropdownDivider.svelte +9 -9
  125. package/dist/primitives/Dropdown/DropdownItem.svelte +80 -80
  126. package/dist/primitives/Helper/Helper.svelte +33 -33
  127. package/dist/primitives/Icons/ArrowLeft.svelte +8 -8
  128. package/dist/primitives/Icons/ArrowRight.svelte +8 -8
  129. package/dist/primitives/Icons/Availability.svelte +14 -14
  130. package/dist/primitives/Icons/Back.svelte +14 -14
  131. package/dist/primitives/Icons/CheckCircle.svelte +6 -6
  132. package/dist/primitives/Icons/CheckCircleOutline.svelte +15 -15
  133. package/dist/primitives/Icons/ChevronLeft.svelte +4 -4
  134. package/dist/primitives/Icons/ChevronRight.svelte +4 -4
  135. package/dist/primitives/Icons/Copy.svelte +15 -15
  136. package/dist/primitives/Icons/Cross.svelte +5 -5
  137. package/dist/primitives/Icons/DownArrow.svelte +8 -8
  138. package/dist/primitives/Icons/ErrorCircle.svelte +6 -6
  139. package/dist/primitives/Icons/FacebookIcon.svelte +2 -2
  140. package/dist/primitives/Icons/Home.svelte +15 -15
  141. package/dist/primitives/Icons/Icon.spec.js +169 -169
  142. package/dist/primitives/Icons/Icon.stories.svelte +100 -100
  143. package/dist/primitives/Icons/Icon.svelte +52 -52
  144. package/dist/primitives/Icons/IconGallery.stories.svelte +235 -235
  145. package/dist/primitives/Icons/Info.svelte +7 -7
  146. package/dist/primitives/Icons/InstagramIcon.svelte +4 -4
  147. package/dist/primitives/Icons/LogoInstagram.svelte +2 -2
  148. package/dist/primitives/Icons/Message.svelte +15 -15
  149. package/dist/primitives/Icons/MoonIcon.svelte +5 -5
  150. package/dist/primitives/Icons/More.svelte +21 -21
  151. package/dist/primitives/Icons/MoreHori.spec.js +61 -61
  152. package/dist/primitives/Icons/MoreHori.svelte +22 -22
  153. package/dist/primitives/Icons/Notification.svelte +14 -14
  154. package/dist/primitives/Icons/Payment.svelte +14 -14
  155. package/dist/primitives/Icons/Profile.svelte +21 -21
  156. package/dist/primitives/Icons/Reload.svelte +29 -29
  157. package/dist/primitives/Icons/Shows.svelte +21 -21
  158. package/dist/primitives/Icons/Signout.svelte +21 -21
  159. package/dist/primitives/Icons/SunIcon.svelte +8 -8
  160. package/dist/primitives/Icons/TiktokIcon.svelte +2 -2
  161. package/dist/primitives/Icons/TwitterIcon.svelte +2 -2
  162. package/dist/primitives/Icons/WarningIcon.spec.js +18 -18
  163. package/dist/primitives/Icons/WarningIcon.svelte +5 -5
  164. package/dist/primitives/Input/Input.spec.js +1237 -1235
  165. package/dist/primitives/Input/Input.stories.svelte +139 -139
  166. package/dist/primitives/Input/Input.svelte +431 -423
  167. package/dist/primitives/Input/Input.svelte.d.ts.map +1 -1
  168. package/dist/primitives/Input/Select.spec.js +632 -632
  169. package/dist/primitives/Input/Select.stories.svelte +112 -112
  170. package/dist/primitives/Input/Select.svelte +252 -252
  171. package/dist/primitives/Input/Textarea.stories.svelte +137 -137
  172. package/dist/primitives/Input/Textarea.svelte +105 -105
  173. package/dist/primitives/Label/Label.svelte +37 -37
  174. package/dist/primitives/LandingButton/LandingButton.svelte +92 -92
  175. package/dist/primitives/MenuItem/MenuItem.svelte +85 -85
  176. package/dist/primitives/Modal/Modal.spec.js +314 -314
  177. package/dist/primitives/Modal/Modal.stories.svelte +86 -86
  178. package/dist/primitives/Modal/Modal.svelte +181 -181
  179. package/dist/primitives/NavItem/NavItem.svelte +75 -75
  180. package/dist/primitives/Pagination/Pagination.stories.svelte +76 -76
  181. package/dist/primitives/Pagination/Pagination.svelte +261 -261
  182. package/dist/primitives/Radio/Radio.stories.svelte +80 -80
  183. package/dist/primitives/Radio/Radio.svelte +67 -67
  184. package/dist/primitives/SearchResultItem/SearchResultItem.svelte +109 -109
  185. package/dist/primitives/SidebarToggle/SidebarToggle.svelte +55 -55
  186. package/dist/primitives/Skeleton/CardPlaceholder.svelte +87 -87
  187. package/dist/primitives/Skeleton/ImagePlaceholder.svelte +59 -59
  188. package/dist/primitives/Skeleton/ListPlaceholder.svelte +76 -76
  189. package/dist/primitives/Skeleton/Skeleton.stories.svelte +151 -151
  190. package/dist/primitives/Skeleton/Skeleton.svelte +26 -26
  191. package/dist/primitives/Spinner/Spinner.spec.js +84 -84
  192. package/dist/primitives/Spinner/Spinner.stories.svelte +29 -29
  193. package/dist/primitives/Spinner/Spinner.svelte +20 -20
  194. package/dist/primitives/Tabs/TabItem.svelte +49 -49
  195. package/dist/primitives/Tabs/Tabs.stories.svelte +112 -112
  196. package/dist/primitives/Tabs/Tabs.svelte +137 -137
  197. package/dist/primitives/Toggle.spec.js +221 -221
  198. package/dist/primitives/Toggle.stories.svelte +92 -92
  199. package/dist/primitives/Toggle.svelte +141 -141
  200. package/dist/primitives/Tooltip/Tooltip.svelte +83 -83
  201. package/dist/primitives/Typography/Typography.svelte +53 -53
  202. package/dist/primitives/ValidationError.spec.js +103 -103
  203. package/dist/primitives/ValidationError.stories.svelte +69 -69
  204. package/dist/primitives/ValidationError.svelte +29 -29
  205. package/dist/primitives/index.js +113 -113
  206. package/dist/recipes/CropImage/CropImage.spec.js +208 -208
  207. package/dist/recipes/CropImage/CropImage.stories.svelte +104 -104
  208. package/dist/recipes/CropImage/CropImage.svelte +241 -241
  209. package/dist/recipes/ImageUploader/ImageUploader.stories.svelte +125 -125
  210. package/dist/recipes/ImageUploader/ImageUploader.svelte +992 -992
  211. package/dist/recipes/SuperLogin/SuperLogin.spec.js +2 -2
  212. package/dist/recipes/SuperLogin/SuperLogin.svelte +1 -1
  213. package/dist/recipes/Toaster/Toaster.stories.svelte +62 -62
  214. package/dist/recipes/feedback/EmptyState/EmptyState.svelte +1 -1
  215. package/dist/recipes/feedback/ErrorDisplay.spec.js +69 -69
  216. package/dist/recipes/feedback/ErrorDisplay.stories.svelte +101 -101
  217. package/dist/recipes/feedback/ErrorDisplay.svelte +1 -1
  218. package/dist/recipes/feedback/StatusIndicator/StatusIndicator.spec.js +133 -133
  219. package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte +157 -157
  220. package/dist/recipes/fields/CheckboxField.svelte +85 -85
  221. package/dist/recipes/fields/FormField.svelte +58 -58
  222. package/dist/recipes/fields/RadioGroup.svelte +95 -95
  223. package/dist/recipes/fields/SelectField.svelte +82 -82
  224. package/dist/recipes/fields/TextareaField.svelte +97 -97
  225. package/dist/recipes/fields/ToggleField.svelte +60 -60
  226. package/dist/recipes/fields/index.js +7 -7
  227. package/dist/recipes/inputs/MultiSelect.spec.js +263 -263
  228. package/dist/recipes/inputs/MultiSelect.stories.svelte +133 -133
  229. package/dist/recipes/inputs/MultiSelect.svelte +283 -283
  230. package/dist/recipes/inputs/OTPInput.spec.js +251 -251
  231. package/dist/recipes/inputs/OTPInput.stories.svelte +162 -162
  232. package/dist/recipes/inputs/OTPInput.svelte +117 -117
  233. package/dist/recipes/inputs/PasswordInput.svelte +22 -22
  234. package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte +131 -131
  235. package/dist/recipes/inputs/PhoneInput.svelte +258 -0
  236. package/dist/recipes/inputs/PhoneInput.svelte.d.ts +42 -0
  237. package/dist/recipes/inputs/PhoneInput.svelte.d.ts.map +1 -0
  238. package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.stories.svelte +123 -123
  239. package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +336 -336
  240. package/dist/recipes/inputs/Search.svelte +102 -102
  241. package/dist/recipes/inputs/index.d.ts +1 -0
  242. package/dist/recipes/inputs/index.js +8 -7
  243. package/dist/recipes/inputs/phoneInput/CountrySelector.svelte +297 -0
  244. package/dist/recipes/inputs/phoneInput/CountrySelector.svelte.d.ts +17 -0
  245. package/dist/recipes/inputs/phoneInput/CountrySelector.svelte.d.ts.map +1 -0
  246. package/dist/recipes/inputs/phoneInput/countryData.d.ts +20 -0
  247. package/dist/recipes/inputs/phoneInput/countryData.d.ts.map +1 -0
  248. package/dist/recipes/inputs/phoneInput/countryData.js +211 -0
  249. package/dist/recipes/modals/AlertModal.svelte +130 -130
  250. package/dist/recipes/modals/ConfirmationModal.spec.js +396 -396
  251. package/dist/recipes/modals/ConfirmationModal.stories.svelte +119 -119
  252. package/dist/recipes/modals/ConfirmationModal.svelte +162 -162
  253. package/dist/recipes/modals/InputModal.svelte +182 -182
  254. package/dist/recipes/modals/ModalStateManager.spec.js +100 -100
  255. package/dist/recipes/modals/ModalStateManager.svelte +77 -77
  256. package/dist/recipes/modals/ModalTestWrapper.svelte +65 -65
  257. package/dist/recipes/modals/StatusModal.svelte +206 -206
  258. package/dist/schemas/__tests__/auth.test.d.ts +2 -0
  259. package/dist/schemas/__tests__/auth.test.d.ts.map +1 -0
  260. package/dist/schemas/__tests__/auth.test.js +210 -0
  261. package/dist/schemas/__tests__/common.test.d.ts +2 -0
  262. package/dist/schemas/__tests__/common.test.d.ts.map +1 -0
  263. package/dist/schemas/__tests__/common.test.js +340 -0
  264. package/dist/schemas/__tests__/domain.test.d.ts +2 -0
  265. package/dist/schemas/__tests__/domain.test.d.ts.map +1 -0
  266. package/dist/schemas/__tests__/domain.test.js +293 -0
  267. package/dist/schemas/__tests__/order.test.d.ts +2 -0
  268. package/dist/schemas/__tests__/order.test.d.ts.map +1 -0
  269. package/dist/schemas/__tests__/order.test.js +349 -0
  270. package/dist/schemas/__tests__/user.test.d.ts +2 -0
  271. package/dist/schemas/__tests__/user.test.d.ts.map +1 -0
  272. package/dist/schemas/__tests__/user.test.js +325 -0
  273. package/dist/schemas/auth.d.ts +41 -0
  274. package/dist/schemas/auth.d.ts.map +1 -0
  275. package/dist/schemas/auth.js +69 -0
  276. package/dist/schemas/common.d.ts +43 -0
  277. package/dist/schemas/common.d.ts.map +1 -0
  278. package/dist/schemas/common.js +157 -0
  279. package/dist/schemas/event.d.ts +82 -0
  280. package/dist/schemas/event.d.ts.map +1 -0
  281. package/dist/schemas/event.js +58 -0
  282. package/dist/schemas/index.d.ts +10 -0
  283. package/dist/schemas/index.d.ts.map +1 -0
  284. package/dist/schemas/index.js +9 -0
  285. package/dist/schemas/order.d.ts +111 -0
  286. package/dist/schemas/order.d.ts.map +1 -0
  287. package/dist/schemas/order.js +73 -0
  288. package/dist/schemas/performer.d.ts +133 -0
  289. package/dist/schemas/performer.d.ts.map +1 -0
  290. package/dist/schemas/performer.js +73 -0
  291. package/dist/schemas/promo.d.ts +87 -0
  292. package/dist/schemas/promo.d.ts.map +1 -0
  293. package/dist/schemas/promo.js +98 -0
  294. package/dist/schemas/ticket.d.ts +104 -0
  295. package/dist/schemas/ticket.d.ts.map +1 -0
  296. package/dist/schemas/ticket.js +82 -0
  297. package/dist/schemas/user.d.ts +92 -0
  298. package/dist/schemas/user.d.ts.map +1 -0
  299. package/dist/schemas/user.js +53 -0
  300. package/dist/schemas/venue.d.ts +95 -0
  301. package/dist/schemas/venue.d.ts.map +1 -0
  302. package/dist/schemas/venue.js +52 -0
  303. package/dist/services/EventService.js +79 -79
  304. package/dist/services/EventService.spec.js +217 -217
  305. package/dist/services/ShowService.js +144 -144
  306. package/dist/services/ShowService.spec.js +345 -345
  307. package/dist/stores/auth.svelte.spec.js +1 -1
  308. package/dist/stores/toaster.js +13 -13
  309. package/dist/stories/ButtonAuditReview.stories.svelte +14 -14
  310. package/dist/stories/ButtonAuditReview.svelte +427 -427
  311. package/dist/stories/PatternsGallery.stories.svelte +19 -19
  312. package/dist/stories/PatternsGallery.svelte +206 -206
  313. package/dist/stories/PrimitivesGallery.stories.svelte +19 -19
  314. package/dist/stories/PrimitivesGallery.svelte +756 -756
  315. package/dist/stories/RecipesGallery.stories.svelte +19 -19
  316. package/dist/stories/RecipesGallery.svelte +454 -454
  317. package/dist/stories/button-audit-manifest.json +11186 -11186
  318. package/dist/tailwind/preset.cjs +82 -82
  319. package/dist/telemetry.js +402 -402
  320. package/dist/telemetry.server.js +212 -212
  321. package/dist/telemetry.server.spec.js +437 -437
  322. package/dist/telemetry.spec.js +1173 -1168
  323. package/dist/tokens/__tests__/sizing.test.js +2 -2
  324. package/dist/tokens/sizing.d.ts +5 -0
  325. package/dist/tokens/sizing.d.ts.map +1 -1
  326. package/dist/tokens/sizing.js +6 -0
  327. package/dist/tokens/tokens.css +87 -87
  328. package/dist/tokens/typography-base.css +163 -163
  329. package/dist/tokens/utilities.css +353 -353
  330. package/dist/utils/apiConfig.js +117 -117
  331. package/dist/utils/apiConfig.spec.js +219 -219
  332. package/dist/utils/greetings.js +187 -187
  333. package/dist/utils/haptic.spec.js +1 -1
  334. package/dist/utils/imageValidation.js +121 -121
  335. package/dist/utils/phoneUtils.d.ts +35 -0
  336. package/dist/utils/phoneUtils.d.ts.map +1 -0
  337. package/dist/utils/phoneUtils.js +104 -0
  338. package/dist/utils/transitions.js +4 -4
  339. package/dist/utils/utils.js +693 -693
  340. package/package.json +297 -292
@@ -1,131 +1,131 @@
1
- <script lang="ts">
2
- import type { Snippet } from 'svelte';
3
- import { passwordStrength } from "check-password-strength";
4
- import { safeSlide } from "../../../utils/transitions.js";
5
- import { cubicOut } from "svelte/easing";
6
- import { untrack } from "svelte";
7
-
8
- interface Props {
9
- password?: string;
10
- strengthText?: string;
11
- score?: number;
12
- textColor?: string;
13
- children?: Snippet;
14
- }
15
-
16
- let {
17
- password = "",
18
- strengthText = $bindable(""),
19
- score = $bindable(-1),
20
- textColor = $bindable(""),
21
- children,
22
- }: Props = $props();
23
-
24
- let debouncedPassword = $state("");
25
- // Use a plain variable for timer to avoid reactive dependency
26
- let timer: ReturnType<typeof setTimeout> | undefined;
27
-
28
- const customOptions = [
29
- {
30
- id: 0,
31
- value: "Too weak",
32
- minDiversity: 0,
33
- minLength: 0,
34
- },
35
- {
36
- id: 1,
37
- value: "Weak",
38
- minDiversity: 1,
39
- minLength: 6,
40
- },
41
- {
42
- id: 2,
43
- value: "Good",
44
- minDiversity: 2,
45
- minLength: 8,
46
- },
47
- {
48
- id: 3,
49
- value: "Strong",
50
- minDiversity: 3,
51
- minLength: 10,
52
- },
53
- ] as const;
54
-
55
- // Debounce password updates - timer is not reactive to avoid dependency cycle
56
- $effect(() => {
57
- clearTimeout(timer);
58
- if (password.length === 0) {
59
- debouncedPassword = "";
60
- } else {
61
- timer = setTimeout(() => {
62
- debouncedPassword = password;
63
- }, 400); // 400ms delay as requested
64
- }
65
- return () => clearTimeout(timer);
66
- });
67
-
68
- let strength = $derived(debouncedPassword
69
- ? passwordStrength(debouncedPassword, customOptions as any)
70
- : null);
71
-
72
- // Derive score based on password length and strength
73
- let computedScore = $derived(debouncedPassword.length > 12 ? 3 : (strength?.id ?? -1));
74
-
75
- // Sync computed values to bindable props using effects with untrack
76
- $effect(() => {
77
- const newScore = computedScore;
78
- if (untrack(() => score) !== newScore) {
79
- score = newScore;
80
- }
81
- });
82
-
83
- // Derive text and color from computedScore (not from bindable score)
84
- let computedStrengthText = $derived(
85
- computedScore === 0 ? "Too weak" :
86
- computedScore === 1 ? "Weak" :
87
- computedScore === 2 ? "Good" :
88
- computedScore === 3 ? "Strong" : ""
89
- );
90
-
91
- let computedTextColor = $derived(computedScore <= 1 ? "text-red-600" : "text-green-600");
92
-
93
- $effect(() => {
94
- const newText = computedStrengthText;
95
- if (untrack(() => strengthText) !== newText) {
96
- strengthText = newText;
97
- }
98
- });
99
-
100
- let strengthColor = $derived(computedScore <= 1 ? "bg-red-600" : "bg-green-600");
101
-
102
- $effect(() => {
103
- const newColor = computedTextColor;
104
- if (untrack(() => textColor) !== newColor) {
105
- textColor = newColor;
106
- }
107
- });
108
-
109
- // Calculate how many bars to fill (1-3)
110
- let filledBars = $derived(computedScore === 0 ? 1 : computedScore === 1 ? 2 : computedScore >= 2 ? 3 : 0);
111
- </script>
112
-
113
- {#if debouncedPassword.length > 0}
114
- <div
115
- transition:safeSlide={{ duration: 600, easing: cubicOut }}
116
- class="pt-2 space-y-2"
117
- >
118
- <!-- 3 segment bars -->
119
- <div class="flex gap-1.5">
120
- {#each [0, 1, 2] as barIndex}
121
- <div
122
- class="h-1 flex-1 rounded-full transition-colors duration-300 {barIndex <
123
- filledBars
124
- ? strengthColor
125
- : 'bg-gray-200 dark:bg-gray-700'}"
126
- ></div>
127
- {/each}
128
- </div>
129
- {@render children?.()}
130
- </div>
131
- {/if}
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { passwordStrength } from "check-password-strength";
4
+ import { safeSlide } from "../../../utils/transitions.js";
5
+ import { cubicOut } from "svelte/easing";
6
+ import { untrack } from "svelte";
7
+
8
+ interface Props {
9
+ password?: string;
10
+ strengthText?: string;
11
+ score?: number;
12
+ textColor?: string;
13
+ children?: Snippet;
14
+ }
15
+
16
+ let {
17
+ password = "",
18
+ strengthText = $bindable(""),
19
+ score = $bindable(-1),
20
+ textColor = $bindable(""),
21
+ children,
22
+ }: Props = $props();
23
+
24
+ let debouncedPassword = $state("");
25
+ // Use a plain variable for timer to avoid reactive dependency
26
+ let timer: ReturnType<typeof setTimeout> | undefined;
27
+
28
+ const customOptions = [
29
+ {
30
+ id: 0,
31
+ value: "Too weak",
32
+ minDiversity: 0,
33
+ minLength: 0,
34
+ },
35
+ {
36
+ id: 1,
37
+ value: "Weak",
38
+ minDiversity: 1,
39
+ minLength: 6,
40
+ },
41
+ {
42
+ id: 2,
43
+ value: "Good",
44
+ minDiversity: 2,
45
+ minLength: 8,
46
+ },
47
+ {
48
+ id: 3,
49
+ value: "Strong",
50
+ minDiversity: 3,
51
+ minLength: 10,
52
+ },
53
+ ] as const;
54
+
55
+ // Debounce password updates - timer is not reactive to avoid dependency cycle
56
+ $effect(() => {
57
+ clearTimeout(timer);
58
+ if (password.length === 0) {
59
+ debouncedPassword = "";
60
+ } else {
61
+ timer = setTimeout(() => {
62
+ debouncedPassword = password;
63
+ }, 400); // 400ms delay as requested
64
+ }
65
+ return () => clearTimeout(timer);
66
+ });
67
+
68
+ let strength = $derived(debouncedPassword
69
+ ? passwordStrength(debouncedPassword, customOptions as any)
70
+ : null);
71
+
72
+ // Derive score based on password length and strength
73
+ let computedScore = $derived(debouncedPassword.length > 12 ? 3 : (strength?.id ?? -1));
74
+
75
+ // Sync computed values to bindable props using effects with untrack
76
+ $effect(() => {
77
+ const newScore = computedScore;
78
+ if (untrack(() => score) !== newScore) {
79
+ score = newScore;
80
+ }
81
+ });
82
+
83
+ // Derive text and color from computedScore (not from bindable score)
84
+ let computedStrengthText = $derived(
85
+ computedScore === 0 ? "Too weak" :
86
+ computedScore === 1 ? "Weak" :
87
+ computedScore === 2 ? "Good" :
88
+ computedScore === 3 ? "Strong" : ""
89
+ );
90
+
91
+ let computedTextColor = $derived(computedScore <= 1 ? "text-red-600" : "text-green-600");
92
+
93
+ $effect(() => {
94
+ const newText = computedStrengthText;
95
+ if (untrack(() => strengthText) !== newText) {
96
+ strengthText = newText;
97
+ }
98
+ });
99
+
100
+ let strengthColor = $derived(computedScore <= 1 ? "bg-red-600" : "bg-green-600");
101
+
102
+ $effect(() => {
103
+ const newColor = computedTextColor;
104
+ if (untrack(() => textColor) !== newColor) {
105
+ textColor = newColor;
106
+ }
107
+ });
108
+
109
+ // Calculate how many bars to fill (1-3)
110
+ let filledBars = $derived(computedScore === 0 ? 1 : computedScore === 1 ? 2 : computedScore >= 2 ? 3 : 0);
111
+ </script>
112
+
113
+ {#if debouncedPassword.length > 0}
114
+ <div
115
+ transition:safeSlide={{ duration: 600, easing: cubicOut }}
116
+ class="pt-2 space-y-2"
117
+ >
118
+ <!-- 3 segment bars -->
119
+ <div class="flex gap-1.5">
120
+ {#each [0, 1, 2] as barIndex}
121
+ <div
122
+ class="h-1 flex-1 rounded-full transition-colors duration-300 {barIndex <
123
+ filledBars
124
+ ? strengthColor
125
+ : 'bg-gray-200 dark:bg-gray-700'}"
126
+ ></div>
127
+ {/each}
128
+ </div>
129
+ {@render children?.()}
130
+ </div>
131
+ {/if}
@@ -0,0 +1,258 @@
1
+ <script lang="ts">
2
+ import { onMount } from "svelte";
3
+ import { safeSlide } from "../../utils/transitions.js";
4
+ import { cubicOut } from "svelte/easing";
5
+ import { ExclamationCircleOutline } from "../../primitives/Icons";
6
+ import { typography } from "../../tokens/typography";
7
+ import { formInputSizes } from "../../tokens/sizing";
8
+ import CountrySelector from "./phoneInput/CountrySelector.svelte";
9
+ import { COUNTRIES, getCountry, type Country } from "./phoneInput/countryData";
10
+ import {
11
+ parseStoredPhone,
12
+ formatAsYouType,
13
+ toE164,
14
+ isValidE164,
15
+ } from "../../utils/phoneUtils";
16
+ import type { CountryCode } from "libphonenumber-js/min";
17
+
18
+ const defaultLabels = {
19
+ searchPlaceholder: 'Search countries...',
20
+ noResults: 'No countries found',
21
+ countrySelector: 'Select country',
22
+ suggested: 'Suggested',
23
+ allCountries: 'All countries',
24
+ optional: '(optional)',
25
+ };
26
+
27
+ interface Props {
28
+ value?: string;
29
+ label?: string;
30
+ id?: string;
31
+ name?: string;
32
+ placeholder?: string;
33
+ required?: boolean;
34
+ disabled?: boolean;
35
+ optional?: boolean;
36
+ size?: 'sm' | 'md' | 'lg';
37
+ errorText?: string;
38
+ helperText?: string;
39
+ color?: 'base' | 'red';
40
+ controlled?: boolean;
41
+ buttonText?: string | null;
42
+ buttonDisabled?: boolean;
43
+ onButtonClick?: ((value: string) => void) | null;
44
+ defaultCountry?: string;
45
+ labels?: Partial<typeof defaultLabels>;
46
+ onchange?: (detail: { value: string; country: string; isValid: boolean }) => void;
47
+ animateFocus?: boolean;
48
+ statusText?: string;
49
+ statusType?: string;
50
+ [key: string]: unknown;
51
+ }
52
+
53
+ let {
54
+ value = $bindable(''),
55
+ label = '',
56
+ id = '',
57
+ name = '',
58
+ placeholder = '',
59
+ required = false,
60
+ disabled = false,
61
+ optional = false,
62
+ size = 'md',
63
+ errorText = '',
64
+ helperText = '',
65
+ color = 'base',
66
+ controlled = false,
67
+ buttonText = null,
68
+ buttonDisabled = false,
69
+ onButtonClick = null,
70
+ defaultCountry = 'US',
71
+ labels: userLabels = {},
72
+ onchange,
73
+ animateFocus = true,
74
+ statusText = '',
75
+ statusType = '',
76
+ ...restProps
77
+ }: Props = $props();
78
+
79
+ let labels = $derived({ ...defaultLabels, ...userLabels });
80
+
81
+ // Internal state
82
+ let selectedCountry = $state<Country>(getCountry(defaultCountry) || COUNTRIES.find((c) => c.code === 'US')!);
83
+ let nationalDigits = $state('');
84
+ let displayValue = $state('');
85
+ let inputElement = $state<HTMLInputElement | null>(null);
86
+ let hasInitialized = $state(false);
87
+
88
+ let hasError = $derived(color === 'red' || Boolean(errorText));
89
+ let sizeClass = $derived(formInputSizes[size] || formInputSizes.md);
90
+ let shouldAnimate = $derived(animateFocus && !disabled);
91
+
92
+ // Parse incoming value on mount or when value changes externally
93
+ $effect(() => {
94
+ const currentValue = value;
95
+ if (!hasInitialized || currentValue !== lastEmittedValue) {
96
+ parseIncomingValue(currentValue);
97
+ hasInitialized = true;
98
+ }
99
+ });
100
+
101
+ let lastEmittedValue = '';
102
+
103
+ function parseIncomingValue(incoming: string) {
104
+ if (!incoming) {
105
+ nationalDigits = '';
106
+ displayValue = '';
107
+ return;
108
+ }
109
+
110
+ const parsed = parseStoredPhone(incoming);
111
+ if (parsed) {
112
+ const country = getCountry(parsed.countryCode);
113
+ if (country) {
114
+ selectedCountry = country;
115
+ }
116
+ nationalDigits = parsed.nationalNumber;
117
+ displayValue = formatAsYouType(parsed.countryCode as CountryCode, parsed.nationalNumber);
118
+ } else {
119
+ // Can't parse — treat as raw digits
120
+ nationalDigits = incoming.replace(/\D/g, '');
121
+ displayValue = nationalDigits;
122
+ }
123
+ }
124
+
125
+ function handleInput(event: Event) {
126
+ const target = event.target as HTMLInputElement;
127
+ const raw = target.value.replace(/\D/g, '');
128
+ nationalDigits = raw;
129
+
130
+ // Format as-you-type
131
+ const formatted = formatAsYouType(selectedCountry.code as CountryCode, raw);
132
+ displayValue = formatted;
133
+ target.value = formatted;
134
+
135
+ // Compute E.164 and emit
136
+ const e164 = toE164(selectedCountry.code as CountryCode, raw);
137
+ lastEmittedValue = e164;
138
+ value = e164;
139
+
140
+ const valid = e164 ? isValidE164(e164) : false;
141
+ onchange?.({ value: e164, country: selectedCountry.code, isValid: valid });
142
+ }
143
+
144
+ function handleCountryChange() {
145
+ // Re-format existing digits for new country
146
+ displayValue = formatAsYouType(selectedCountry.code as CountryCode, nationalDigits);
147
+
148
+ // Recalculate E.164
149
+ const e164 = toE164(selectedCountry.code as CountryCode, nationalDigits);
150
+ lastEmittedValue = e164;
151
+ value = e164;
152
+
153
+ const valid = e164 ? isValidE164(e164) : false;
154
+ onchange?.({ value: e164, country: selectedCountry.code, isValid: valid });
155
+
156
+ // Focus the input after country change
157
+ inputElement?.focus();
158
+ }
159
+
160
+ // Watch for country changes from the selector
161
+ $effect(() => {
162
+ // Trigger on selectedCountry change (read it to create dependency)
163
+ const _code = selectedCountry.code;
164
+ if (hasInitialized && nationalDigits) {
165
+ handleCountryChange();
166
+ }
167
+ });
168
+
169
+ function handleButtonClick() {
170
+ if (typeof onButtonClick === 'function') {
171
+ onButtonClick(value);
172
+ }
173
+ }
174
+
175
+ export function focus() {
176
+ inputElement?.focus();
177
+ }
178
+
179
+ export function clear() {
180
+ nationalDigits = '';
181
+ displayValue = '';
182
+ value = '';
183
+ lastEmittedValue = '';
184
+ }
185
+ </script>
186
+
187
+ <div class="flex flex-col gap-2" {...restProps}>
188
+ {#if label}
189
+ <div class="flex justify-start items-center gap-1">
190
+ <label for={id} class={`${typography.label} leading-tight sm:leading-none`}>
191
+ {label}{#if required}<span class="text-red-500 font-medium text-sm ml-0.5">*</span>{/if}
192
+ </label>
193
+ {#if statusText}
194
+ <span class="text-sm font-medium {statusType === 'success' ? 'text-green-600' : statusType === 'error' ? 'text-red-500' : ''}">({statusText})</span>
195
+ {/if}
196
+ {#if optional}
197
+ <span class={typography.smMuted}>{labels.optional}</span>
198
+ {/if}
199
+ </div>
200
+ {/if}
201
+
202
+ <div class="relative w-full">
203
+ <div class="flex items-stretch w-full">
204
+ <CountrySelector
205
+ bind:country={selectedCountry}
206
+ {disabled}
207
+ {size}
208
+ labels={{
209
+ searchPlaceholder: labels.searchPlaceholder,
210
+ noResults: labels.noResults,
211
+ countrySelector: labels.countrySelector,
212
+ suggested: labels.suggested,
213
+ allCountries: labels.allCountries,
214
+ }}
215
+ />
216
+
217
+ <div class="relative flex-1 flex items-center">
218
+ <input
219
+ bind:this={inputElement}
220
+ {id}
221
+ type="tel"
222
+ {name}
223
+ {placeholder}
224
+ value={displayValue}
225
+ oninput={handleInput}
226
+ inputmode="tel"
227
+ autocomplete="tel"
228
+ class="{typography.body} w-full {sizeClass} bg-gray-50 dark:bg-gray-800 border border-l-0 rounded-r-lg font-medium placeholder-gray-500 dark:placeholder-gray-400 transition-all focus:outline-hidden focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-300 {hasError ? 'border-red-500' : 'border-gray-300 dark:border-gray-600 hover:border-blue-500 focus:border-blue-500'} {controlled && (buttonText) ? 'pr-20' : ''} {shouldAnimate ? 'focus:scale-[1.01]' : ''} {disabled ? 'opacity-50 cursor-not-allowed' : ''}"
229
+ required={false}
230
+ {disabled}
231
+ aria-required={required}
232
+ />
233
+
234
+ {#if controlled && buttonText}
235
+ <button
236
+ type="button"
237
+ onclick={handleButtonClick}
238
+ disabled={buttonDisabled}
239
+ class="absolute inset-y-0 right-0 gap-1 flex items-center justify-center px-4 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 disabled:opacity-50 disabled:cursor-not-allowed {helperText || errorText ? 'mb-7' : ''}"
240
+ >
241
+ <span class="text-sm font-medium">{buttonText}</span>
242
+ </button>
243
+ {/if}
244
+ </div>
245
+ </div>
246
+
247
+ {#if errorText}
248
+ <div transition:safeSlide={{ duration: 300, easing: cubicOut }} class="flex items-start gap-1.5 mt-2" role="alert" aria-live="assertive">
249
+ <ExclamationCircleOutline class="w-4 h-4 shrink-0 text-red-500 mt-0.5" />
250
+ <p class={typography.error}>{errorText}</p>
251
+ </div>
252
+ {:else if helperText}
253
+ <div class={`mt-2 flex items-center ${typography.xsMuted} opacity-65`}>
254
+ <span>{helperText}</span>
255
+ </div>
256
+ {/if}
257
+ </div>
258
+ </div>
@@ -0,0 +1,42 @@
1
+ declare const PhoneInput: import("svelte").Component<{
2
+ [key: string]: unknown;
3
+ value?: string;
4
+ label?: string;
5
+ id?: string;
6
+ name?: string;
7
+ placeholder?: string;
8
+ required?: boolean;
9
+ disabled?: boolean;
10
+ optional?: boolean;
11
+ size?: "sm" | "md" | "lg";
12
+ errorText?: string;
13
+ helperText?: string;
14
+ color?: "base" | "red";
15
+ controlled?: boolean;
16
+ buttonText?: string | null;
17
+ buttonDisabled?: boolean;
18
+ onButtonClick?: ((value: string) => void) | null;
19
+ defaultCountry?: string;
20
+ labels?: Partial<{
21
+ searchPlaceholder: string;
22
+ noResults: string;
23
+ countrySelector: string;
24
+ suggested: string;
25
+ allCountries: string;
26
+ optional: string;
27
+ }>;
28
+ onchange?: (detail: {
29
+ value: string;
30
+ country: string;
31
+ isValid: boolean;
32
+ }) => void;
33
+ animateFocus?: boolean;
34
+ statusText?: string;
35
+ statusType?: string;
36
+ }, {
37
+ focus: () => void;
38
+ clear: () => void;
39
+ }, "value">;
40
+ type PhoneInput = ReturnType<typeof PhoneInput>;
41
+ export default PhoneInput;
42
+ //# sourceMappingURL=PhoneInput.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneInput.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/recipes/inputs/PhoneInput.svelte.ts"],"names":[],"mappings":"AA2PA,QAAA,MAAM,UAAU;;YAlNJ,MAAM;YACN,MAAM;SACT,MAAM;WACJ,MAAM;kBACC,MAAM;eACT,OAAO;eACP,OAAO;eACP,OAAO;WACX,IAAI,GAAG,IAAI,GAAG,IAAI;gBACb,MAAM;iBACL,MAAM;YACX,MAAM,GAAG,KAAK;iBACT,OAAO;iBACP,MAAM,GAAG,IAAI;qBACT,OAAO;oBACR,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI;qBAC/B,MAAM;aACd,OAAO;;;;;;;MAAsB;eAC3B,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI;mBAClE,OAAO;iBACT,MAAM;iBACN,MAAM;;;;WA6LiC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}