@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.
- package/dist/calendar/AboutShow/AboutShow.svelte +187 -187
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte +780 -782
- package/dist/calendar/Calendar/MiniMonthCalendar.svelte.d.ts.map +1 -1
- package/dist/calendar/FAQs/FAQs.svelte +77 -77
- package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte +125 -126
- package/dist/calendar/MonthSwitcher/MonthSwitcher.svelte.d.ts.map +1 -1
- package/dist/calendar/OrderSummary/OrderSummary.svelte +457 -457
- package/dist/calendar/PublicCard/PublicCard.svelte +155 -146
- package/dist/calendar/PublicCard/PublicCard.svelte.d.ts.map +1 -1
- package/dist/calendar/ShowCard/ShowCard.spec.js +1 -7
- package/dist/calendar/ShowCard/ShowCard.svelte +166 -157
- package/dist/calendar/ShowCard/ShowCard.svelte.d.ts.map +1 -1
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte +72 -61
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts +2 -0
- package/dist/calendar/ShowTimeCard/ShowTimeCard.svelte.d.ts.map +1 -1
- package/dist/components/Heading.svelte +60 -60
- package/dist/components/Layout/AppShell.svelte +104 -104
- package/dist/components/Layout/ContentSection.svelte +80 -80
- package/dist/components/Layout/Grid.svelte +4 -4
- package/dist/components/Layout/Heading.svelte +81 -81
- package/dist/components/Layout/PageContainer.svelte +69 -69
- package/dist/components/Layout/Responsive.svelte +75 -75
- package/dist/components/Layout/Section.svelte +80 -80
- package/dist/components/Layout/ShowOnDesktop.svelte +37 -37
- package/dist/components/Layout/ShowOnMobile.svelte +37 -37
- package/dist/components/Layout/Sidebar.svelte +108 -108
- package/dist/components/Layout/Stack.spec.js +1 -1
- package/dist/components/Layout/Stack.svelte +6 -6
- package/dist/components/Layout/Text.svelte +87 -87
- package/dist/components/Layout/TwoColumn.svelte +108 -108
- package/dist/components/Text.svelte +53 -53
- package/dist/config.d.ts +102 -0
- package/dist/config.js +147 -1
- package/dist/constants/validation.js +91 -91
- package/dist/constants/validation.spec.js +64 -64
- package/dist/datetime/README.md +323 -0
- package/dist/datetime/__tests__/format.test.js +1 -1
- package/dist/datetime/__tests__/parse.test.js +1 -1
- package/dist/datetime/__tests__/timezone.test.js +1 -1
- package/dist/datetime/parse.js +1 -1
- package/dist/forms/createFormStore.svelte.js +0 -1
- package/dist/forms/createFormStore.svelte.spec.js +0 -1
- package/dist/index.js +57 -57
- package/dist/index.spec.js +369 -369
- package/dist/messages.d.ts +43 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +57 -0
- package/dist/patterns/chat/ChatActivityNotice.svelte +41 -41
- package/dist/patterns/chat/ChatBubble.svelte +95 -95
- package/dist/patterns/chat/ChatContainer.svelte +46 -46
- package/dist/patterns/chat/ChatDateDivider.svelte +27 -27
- package/dist/patterns/chat/ChatInvitationBubble.svelte +37 -37
- package/dist/patterns/chat/ChatInvitationNotice.svelte +27 -27
- package/dist/patterns/chat/ChatMessageGroup.svelte +57 -57
- package/dist/patterns/chat/ChatSlotUpdate.svelte +46 -46
- package/dist/patterns/chat/ChatStatusBadge.svelte +91 -91
- package/dist/patterns/chat/ChatStatusTransition.svelte +64 -64
- package/dist/patterns/chat/ChatTextBubble.svelte +41 -41
- package/dist/patterns/chat/index.js +22 -22
- package/dist/patterns/data/DataGrid.svelte +45 -45
- package/dist/patterns/data/DataList.svelte +24 -24
- package/dist/patterns/data/DataTable.svelte +36 -36
- package/dist/patterns/forms/FormActions.spec.js +95 -95
- package/dist/patterns/forms/FormActions.stories.svelte +97 -97
- package/dist/patterns/forms/FormActions.svelte +46 -46
- package/dist/patterns/forms/FormGrid.svelte +33 -33
- package/dist/patterns/forms/FormSection.svelte +32 -32
- package/dist/patterns/forms/FormValidationSummary.stories.svelte +83 -83
- package/dist/patterns/forms/FormValidationSummary.svelte +74 -74
- package/dist/patterns/index.js +21 -21
- package/dist/patterns/layout/Sidebar.svelte +39 -39
- package/dist/patterns/layout/index.js +29 -29
- package/dist/patterns/navigation/BottomNav.stories.svelte +117 -117
- package/dist/patterns/navigation/BottomNav.svelte +74 -74
- package/dist/patterns/navigation/Header.stories.svelte +77 -77
- package/dist/patterns/navigation/Header.svelte +251 -251
- package/dist/patterns/page/PageHeader.svelte +18 -18
- package/dist/patterns/page/PageLayout.svelte +40 -40
- package/dist/patterns/page/PageLoader.spec.js +57 -57
- package/dist/patterns/page/PageLoader.stories.svelte +137 -137
- package/dist/patterns/page/PageLoader.svelte +24 -24
- package/dist/patterns/page/SectionHeader.svelte +29 -29
- package/dist/presets/badges.js +112 -112
- package/dist/presets/buttons.js +76 -76
- package/dist/presets/index.js +9 -9
- package/dist/primitives/Accordion/Accordion.stories.svelte +75 -75
- package/dist/primitives/Accordion/Accordion.svelte +42 -42
- package/dist/primitives/Accordion/AccordionItem.svelte +95 -95
- package/dist/primitives/Alert/Alert.spec.js +173 -173
- package/dist/primitives/Alert/Alert.stories.svelte +88 -88
- package/dist/primitives/Alert/Alert.svelte +27 -27
- package/dist/primitives/Avatar/Avatar.stories.svelte +94 -94
- package/dist/primitives/Avatar/Avatar.svelte +66 -66
- package/dist/primitives/AvatarButton/AvatarButton.svelte +57 -57
- package/dist/primitives/Badges/Badge.spec.js +144 -144
- package/dist/primitives/Badges/Badge.stories.svelte +86 -86
- package/dist/primitives/Badges/Badge.svelte +99 -99
- package/dist/primitives/BottomSheet/BottomSheet.spec.js +238 -238
- package/dist/primitives/BottomSheet/BottomSheet.stories.svelte +83 -83
- package/dist/primitives/BottomSheet/BottomSheet.svelte +115 -115
- package/dist/primitives/Breadcrumb/Breadcrumb.spec.js +123 -123
- package/dist/primitives/Breadcrumb/Breadcrumb.stories.svelte +23 -23
- package/dist/primitives/Breadcrumb/Breadcrumb.svelte +99 -99
- package/dist/primitives/Button/Button.spec.js +225 -225
- package/dist/primitives/Button/Button.stories.svelte +76 -76
- package/dist/primitives/Button/Button.svelte +278 -278
- package/dist/primitives/Button/ButtonGroup.svelte +50 -50
- package/dist/primitives/Button/ButtonSaveDemo.spec.js +146 -146
- package/dist/primitives/Button/ButtonSaveDemo.svelte +25 -25
- package/dist/primitives/Button/ButtonVariantShowcase.svelte +129 -129
- package/dist/primitives/Card.spec.js +49 -49
- package/dist/primitives/Card.stories.svelte +22 -22
- package/dist/primitives/Card.svelte +28 -28
- package/dist/primitives/CardAction/CardAction.svelte +68 -68
- package/dist/primitives/Checkbox/Checkbox.stories.svelte +84 -84
- package/dist/primitives/Checkbox/Checkbox.svelte +88 -88
- package/dist/primitives/DarkModeToggle.spec.js +390 -390
- package/dist/primitives/DarkModeToggle.stories.svelte +57 -57
- package/dist/primitives/DarkModeToggle.svelte +136 -136
- package/dist/primitives/Drawer/Drawer.stories.svelte +80 -80
- package/dist/primitives/Drawer/Drawer.svelte +224 -224
- package/dist/primitives/Dropdown/Dropdown.stories.svelte +137 -137
- package/dist/primitives/Dropdown/Dropdown.svelte +170 -170
- package/dist/primitives/Dropdown/DropdownDivider.svelte +9 -9
- package/dist/primitives/Dropdown/DropdownItem.svelte +80 -80
- package/dist/primitives/Helper/Helper.svelte +33 -33
- package/dist/primitives/Icons/ArrowLeft.svelte +8 -8
- package/dist/primitives/Icons/ArrowRight.svelte +8 -8
- package/dist/primitives/Icons/Availability.svelte +14 -14
- package/dist/primitives/Icons/Back.svelte +14 -14
- package/dist/primitives/Icons/CheckCircle.svelte +6 -6
- package/dist/primitives/Icons/CheckCircleOutline.svelte +15 -15
- package/dist/primitives/Icons/ChevronLeft.svelte +4 -4
- package/dist/primitives/Icons/ChevronRight.svelte +4 -4
- package/dist/primitives/Icons/Copy.svelte +15 -15
- package/dist/primitives/Icons/Cross.svelte +5 -5
- package/dist/primitives/Icons/DownArrow.svelte +8 -8
- package/dist/primitives/Icons/ErrorCircle.svelte +6 -6
- package/dist/primitives/Icons/FacebookIcon.svelte +2 -2
- package/dist/primitives/Icons/Home.svelte +15 -15
- package/dist/primitives/Icons/Icon.spec.js +169 -169
- package/dist/primitives/Icons/Icon.stories.svelte +100 -100
- package/dist/primitives/Icons/Icon.svelte +52 -52
- package/dist/primitives/Icons/IconGallery.stories.svelte +235 -235
- package/dist/primitives/Icons/Info.svelte +7 -7
- package/dist/primitives/Icons/InstagramIcon.svelte +4 -4
- package/dist/primitives/Icons/LogoInstagram.svelte +2 -2
- package/dist/primitives/Icons/Message.svelte +15 -15
- package/dist/primitives/Icons/MoonIcon.svelte +5 -5
- package/dist/primitives/Icons/More.svelte +21 -21
- package/dist/primitives/Icons/MoreHori.spec.js +61 -61
- package/dist/primitives/Icons/MoreHori.svelte +22 -22
- package/dist/primitives/Icons/Notification.svelte +14 -14
- package/dist/primitives/Icons/Payment.svelte +14 -14
- package/dist/primitives/Icons/Profile.svelte +21 -21
- package/dist/primitives/Icons/Reload.svelte +29 -29
- package/dist/primitives/Icons/Shows.svelte +21 -21
- package/dist/primitives/Icons/Signout.svelte +21 -21
- package/dist/primitives/Icons/SunIcon.svelte +8 -8
- package/dist/primitives/Icons/TiktokIcon.svelte +2 -2
- package/dist/primitives/Icons/TwitterIcon.svelte +2 -2
- package/dist/primitives/Icons/WarningIcon.spec.js +18 -18
- package/dist/primitives/Icons/WarningIcon.svelte +5 -5
- package/dist/primitives/Input/Input.spec.js +1237 -1235
- package/dist/primitives/Input/Input.stories.svelte +139 -139
- package/dist/primitives/Input/Input.svelte +431 -423
- package/dist/primitives/Input/Input.svelte.d.ts.map +1 -1
- package/dist/primitives/Input/Select.spec.js +632 -632
- package/dist/primitives/Input/Select.stories.svelte +112 -112
- package/dist/primitives/Input/Select.svelte +252 -252
- package/dist/primitives/Input/Textarea.stories.svelte +137 -137
- package/dist/primitives/Input/Textarea.svelte +105 -105
- package/dist/primitives/Label/Label.svelte +37 -37
- package/dist/primitives/LandingButton/LandingButton.svelte +92 -92
- package/dist/primitives/MenuItem/MenuItem.svelte +85 -85
- package/dist/primitives/Modal/Modal.spec.js +314 -314
- package/dist/primitives/Modal/Modal.stories.svelte +86 -86
- package/dist/primitives/Modal/Modal.svelte +181 -181
- package/dist/primitives/NavItem/NavItem.svelte +75 -75
- package/dist/primitives/Pagination/Pagination.stories.svelte +76 -76
- package/dist/primitives/Pagination/Pagination.svelte +261 -261
- package/dist/primitives/Radio/Radio.stories.svelte +80 -80
- package/dist/primitives/Radio/Radio.svelte +67 -67
- package/dist/primitives/SearchResultItem/SearchResultItem.svelte +109 -109
- package/dist/primitives/SidebarToggle/SidebarToggle.svelte +55 -55
- package/dist/primitives/Skeleton/CardPlaceholder.svelte +87 -87
- package/dist/primitives/Skeleton/ImagePlaceholder.svelte +59 -59
- package/dist/primitives/Skeleton/ListPlaceholder.svelte +76 -76
- package/dist/primitives/Skeleton/Skeleton.stories.svelte +151 -151
- package/dist/primitives/Skeleton/Skeleton.svelte +26 -26
- package/dist/primitives/Spinner/Spinner.spec.js +84 -84
- package/dist/primitives/Spinner/Spinner.stories.svelte +29 -29
- package/dist/primitives/Spinner/Spinner.svelte +20 -20
- package/dist/primitives/Tabs/TabItem.svelte +49 -49
- package/dist/primitives/Tabs/Tabs.stories.svelte +112 -112
- package/dist/primitives/Tabs/Tabs.svelte +137 -137
- package/dist/primitives/Toggle.spec.js +221 -221
- package/dist/primitives/Toggle.stories.svelte +92 -92
- package/dist/primitives/Toggle.svelte +141 -141
- package/dist/primitives/Tooltip/Tooltip.svelte +83 -83
- package/dist/primitives/Typography/Typography.svelte +53 -53
- package/dist/primitives/ValidationError.spec.js +103 -103
- package/dist/primitives/ValidationError.stories.svelte +69 -69
- package/dist/primitives/ValidationError.svelte +29 -29
- package/dist/primitives/index.js +113 -113
- package/dist/recipes/CropImage/CropImage.spec.js +208 -208
- package/dist/recipes/CropImage/CropImage.stories.svelte +104 -104
- package/dist/recipes/CropImage/CropImage.svelte +241 -241
- package/dist/recipes/ImageUploader/ImageUploader.stories.svelte +125 -125
- package/dist/recipes/ImageUploader/ImageUploader.svelte +992 -992
- package/dist/recipes/SuperLogin/SuperLogin.spec.js +2 -2
- package/dist/recipes/SuperLogin/SuperLogin.svelte +1 -1
- package/dist/recipes/Toaster/Toaster.stories.svelte +62 -62
- package/dist/recipes/feedback/EmptyState/EmptyState.svelte +1 -1
- package/dist/recipes/feedback/ErrorDisplay.spec.js +69 -69
- package/dist/recipes/feedback/ErrorDisplay.stories.svelte +101 -101
- package/dist/recipes/feedback/ErrorDisplay.svelte +1 -1
- package/dist/recipes/feedback/StatusIndicator/StatusIndicator.spec.js +133 -133
- package/dist/recipes/feedback/StatusIndicator/StatusIndicator.svelte +157 -157
- package/dist/recipes/fields/CheckboxField.svelte +85 -85
- package/dist/recipes/fields/FormField.svelte +58 -58
- package/dist/recipes/fields/RadioGroup.svelte +95 -95
- package/dist/recipes/fields/SelectField.svelte +82 -82
- package/dist/recipes/fields/TextareaField.svelte +97 -97
- package/dist/recipes/fields/ToggleField.svelte +60 -60
- package/dist/recipes/fields/index.js +7 -7
- package/dist/recipes/inputs/MultiSelect.spec.js +263 -263
- package/dist/recipes/inputs/MultiSelect.stories.svelte +133 -133
- package/dist/recipes/inputs/MultiSelect.svelte +283 -283
- package/dist/recipes/inputs/OTPInput.spec.js +251 -251
- package/dist/recipes/inputs/OTPInput.stories.svelte +162 -162
- package/dist/recipes/inputs/OTPInput.svelte +117 -117
- package/dist/recipes/inputs/PasswordInput.svelte +22 -22
- package/dist/recipes/inputs/PasswordStrengthIndicator/PasswordStrengthIndicator.svelte +131 -131
- package/dist/recipes/inputs/PhoneInput.svelte +258 -0
- package/dist/recipes/inputs/PhoneInput.svelte.d.ts +42 -0
- package/dist/recipes/inputs/PhoneInput.svelte.d.ts.map +1 -0
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.stories.svelte +123 -123
- package/dist/recipes/inputs/PlaceAutocomplete/PlaceAutocomplete.svelte +336 -336
- package/dist/recipes/inputs/Search.svelte +102 -102
- package/dist/recipes/inputs/index.d.ts +1 -0
- package/dist/recipes/inputs/index.js +8 -7
- package/dist/recipes/inputs/phoneInput/CountrySelector.svelte +297 -0
- package/dist/recipes/inputs/phoneInput/CountrySelector.svelte.d.ts +17 -0
- package/dist/recipes/inputs/phoneInput/CountrySelector.svelte.d.ts.map +1 -0
- package/dist/recipes/inputs/phoneInput/countryData.d.ts +20 -0
- package/dist/recipes/inputs/phoneInput/countryData.d.ts.map +1 -0
- package/dist/recipes/inputs/phoneInput/countryData.js +211 -0
- package/dist/recipes/modals/AlertModal.svelte +130 -130
- package/dist/recipes/modals/ConfirmationModal.spec.js +396 -396
- package/dist/recipes/modals/ConfirmationModal.stories.svelte +119 -119
- package/dist/recipes/modals/ConfirmationModal.svelte +162 -162
- package/dist/recipes/modals/InputModal.svelte +182 -182
- package/dist/recipes/modals/ModalStateManager.spec.js +100 -100
- package/dist/recipes/modals/ModalStateManager.svelte +77 -77
- package/dist/recipes/modals/ModalTestWrapper.svelte +65 -65
- package/dist/recipes/modals/StatusModal.svelte +206 -206
- package/dist/schemas/__tests__/auth.test.d.ts +2 -0
- package/dist/schemas/__tests__/auth.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/auth.test.js +210 -0
- package/dist/schemas/__tests__/common.test.d.ts +2 -0
- package/dist/schemas/__tests__/common.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/common.test.js +340 -0
- package/dist/schemas/__tests__/domain.test.d.ts +2 -0
- package/dist/schemas/__tests__/domain.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/domain.test.js +293 -0
- package/dist/schemas/__tests__/order.test.d.ts +2 -0
- package/dist/schemas/__tests__/order.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/order.test.js +349 -0
- package/dist/schemas/__tests__/user.test.d.ts +2 -0
- package/dist/schemas/__tests__/user.test.d.ts.map +1 -0
- package/dist/schemas/__tests__/user.test.js +325 -0
- package/dist/schemas/auth.d.ts +41 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/auth.js +69 -0
- package/dist/schemas/common.d.ts +43 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +157 -0
- package/dist/schemas/event.d.ts +82 -0
- package/dist/schemas/event.d.ts.map +1 -0
- package/dist/schemas/event.js +58 -0
- package/dist/schemas/index.d.ts +10 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +9 -0
- package/dist/schemas/order.d.ts +111 -0
- package/dist/schemas/order.d.ts.map +1 -0
- package/dist/schemas/order.js +73 -0
- package/dist/schemas/performer.d.ts +133 -0
- package/dist/schemas/performer.d.ts.map +1 -0
- package/dist/schemas/performer.js +73 -0
- package/dist/schemas/promo.d.ts +87 -0
- package/dist/schemas/promo.d.ts.map +1 -0
- package/dist/schemas/promo.js +98 -0
- package/dist/schemas/ticket.d.ts +104 -0
- package/dist/schemas/ticket.d.ts.map +1 -0
- package/dist/schemas/ticket.js +82 -0
- package/dist/schemas/user.d.ts +92 -0
- package/dist/schemas/user.d.ts.map +1 -0
- package/dist/schemas/user.js +53 -0
- package/dist/schemas/venue.d.ts +95 -0
- package/dist/schemas/venue.d.ts.map +1 -0
- package/dist/schemas/venue.js +52 -0
- package/dist/services/EventService.js +79 -79
- package/dist/services/EventService.spec.js +217 -217
- package/dist/services/ShowService.js +144 -144
- package/dist/services/ShowService.spec.js +345 -345
- package/dist/stores/auth.svelte.spec.js +1 -1
- package/dist/stores/toaster.js +13 -13
- package/dist/stories/ButtonAuditReview.stories.svelte +14 -14
- package/dist/stories/ButtonAuditReview.svelte +427 -427
- package/dist/stories/PatternsGallery.stories.svelte +19 -19
- package/dist/stories/PatternsGallery.svelte +206 -206
- package/dist/stories/PrimitivesGallery.stories.svelte +19 -19
- package/dist/stories/PrimitivesGallery.svelte +756 -756
- package/dist/stories/RecipesGallery.stories.svelte +19 -19
- package/dist/stories/RecipesGallery.svelte +454 -454
- package/dist/stories/button-audit-manifest.json +11186 -11186
- package/dist/tailwind/preset.cjs +82 -82
- package/dist/telemetry.js +402 -402
- package/dist/telemetry.server.js +212 -212
- package/dist/telemetry.server.spec.js +437 -437
- package/dist/telemetry.spec.js +1173 -1168
- package/dist/tokens/__tests__/sizing.test.js +2 -2
- package/dist/tokens/sizing.d.ts +5 -0
- package/dist/tokens/sizing.d.ts.map +1 -1
- package/dist/tokens/sizing.js +6 -0
- package/dist/tokens/tokens.css +87 -87
- package/dist/tokens/typography-base.css +163 -163
- package/dist/tokens/utilities.css +353 -353
- package/dist/utils/apiConfig.js +117 -117
- package/dist/utils/apiConfig.spec.js +219 -219
- package/dist/utils/greetings.js +187 -187
- package/dist/utils/haptic.spec.js +1 -1
- package/dist/utils/imageValidation.js +121 -121
- package/dist/utils/phoneUtils.d.ts +35 -0
- package/dist/utils/phoneUtils.d.ts.map +1 -0
- package/dist/utils/phoneUtils.js +104 -0
- package/dist/utils/transitions.js +4 -4
- package/dist/utils/utils.js +693 -693
- 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"}
|