@stacksjs/components 0.2.342 → 0.2.344
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/{Accordion-8tv78bh9.stx → Accordion-ccye7erw.stx} +23 -3
- package/dist/{Audio-y0sgq50z.stx → Audio-tnjd6anm.stx} +7 -7
- package/dist/{Avatar-e43x17z1.stx → Avatar-7vegrsg6.stx} +3 -3
- package/dist/Badge-439n5p0a.stx +74 -0
- package/dist/{Breadcrumb-csf164sd.stx → Breadcrumb-7hwnfyyw.stx} +21 -6
- package/dist/Button-y8fnx29x.stx +193 -0
- package/dist/{Calendar-gjjhhfnt.stx → Calendar-8q76ees6.stx} +6 -6
- package/dist/{Card-7byck6ep.stx → Card-r55zpjqh.stx} +6 -6
- package/dist/{Checkbox-2s2a7n4h.stx → Checkbox-xnm8ax5q.stx} +9 -9
- package/dist/{ComboboxInput-z1293bbh.stx → ComboboxInput-9q87fb22.stx} +2 -2
- package/dist/{ComboboxOption-6yh7xk7q.stx → ComboboxOption-qm38e8e9.stx} +2 -2
- package/dist/{ComboboxOptions-sq5360ae.stx → ComboboxOptions-nbndbrxz.stx} +1 -1
- package/dist/{CommandPalette-fzfv1pme.stx → CommandPalette-mkqqep2s.stx} +4 -4
- package/dist/{DefaultPaymentMethod-6qrem3sg.stx → DefaultPaymentMethod-v11254p4.stx} +8 -8
- package/dist/Dialog-d1020hj6.stx +268 -0
- package/dist/DialogBackdrop-de5m5m4w.stx +12 -0
- package/dist/DialogPanel-vhdqymc2.stx +19 -0
- package/dist/{DialogTitle-x0r6k8x9.stx → DialogTitle-0jjdk5ra.stx} +1 -1
- package/dist/{Drawer-9jx39xef.stx → Drawer-rymajw9v.stx} +86 -21
- package/dist/{DropdownButton-wcz67dxy.stx → DropdownButton-n6gsmcte.stx} +2 -2
- package/dist/{DropdownItem-d8ht2bp5.stx → DropdownItem-qs772agw.stx} +1 -1
- package/dist/{DropdownItems-1sxnd5qn.stx → DropdownItems-yf25hdh1.stx} +1 -1
- package/dist/{EmailInput-vak3kkmk.stx → EmailInput-agb8kqae.stx} +4 -4
- package/dist/{FilterChip-h896vrxm.stx → FilterChip-ww5nkepm.stx} +26 -2
- package/dist/{Image-4ezne2xj.stx → Image-79xyzb5j.stx} +3 -3
- package/dist/{ListRow-v45ymhcn.stx → ListRow-8d3e1yxh.stx} +2 -2
- package/dist/{Listbox-0cyysv0f.stx → Listbox-e5jreb0a.stx} +1 -1
- package/dist/{ListboxButton-keb8gm0q.stx → ListboxButton-w3vfvte7.stx} +2 -2
- package/dist/{RadioGroupLabel-7mymt1b8.stx → ListboxLabel-ka0hfm7b.stx} +1 -1
- package/dist/{ListboxOption-4j070101.stx → ListboxOption-ea0j02a8.stx} +2 -2
- package/dist/{ListboxOptions-ejkatcfg.stx → ListboxOptions-qxrkrb8z.stx} +1 -1
- package/dist/{Login-2cp65d41.stx → Login-hh53d6tw.stx} +14 -14
- package/dist/{NavBar-wcb6f2d3.stx → NavBar-qqrrhdnk.stx} +24 -0
- package/dist/{Navigator-smpa7my4.stx → Navigator-55wpcpx1.stx} +2 -2
- package/dist/{Notification-03vfh3k6.stx → Notification-7wgk0sw6.stx} +6 -6
- package/dist/{NumberInput-j9p5bm5y.stx → NumberInput-54d23rq0.stx} +21 -11
- package/dist/{Pagination-ff7nzp7d.stx → Pagination-0ra20dja.stx} +4 -4
- package/dist/{PasswordInput-4qykq1dz.stx → PasswordInput-3snyppj4.stx} +24 -14
- package/dist/{PaymentMethods-2xy66bwk.stx → PaymentMethods-zwa7c6kh.stx} +10 -10
- package/dist/{PopoverButton-mffzc9pr.stx → PopoverButton-panmcysh.stx} +2 -2
- package/dist/{PopoverPanel-054yh38h.stx → PopoverPanel-7771yf35.stx} +2 -2
- package/dist/{Portal-yghnqdj8.stx → Portal-m73vz879.stx} +1 -1
- package/dist/{Progress-twhhzsd9.stx → Progress-cj0z83rx.stx} +47 -18
- package/dist/{Radio-ccm07b2m.stx → Radio-m2wz5ny6.stx} +8 -8
- package/dist/{RadioGroup-82ytfqdb.stx → RadioGroup-jg9s4ttg.stx} +1 -1
- package/dist/{ListboxLabel-7mymt1b8.stx → RadioGroupLabel-ka0hfm7b.stx} +1 -1
- package/dist/{RadioGroupOption-7pq7rw84.stx → RadioGroupOption-zvp0y9sn.stx} +2 -2
- package/dist/{SearchInput-pdx7agn0.stx → SearchInput-psbjk2ye.stx} +3 -3
- package/dist/{SectionCard-r73hvvbc.stx → SectionCard-8ctdacjr.stx} +28 -1
- package/dist/{Select-zt72gg1e.stx → Select-pj584jza.stx} +19 -9
- package/dist/{Sidebar-f1tff5p3.stx → Sidebar-ve2asgf3.stx} +6 -6
- package/dist/{SidebarHeader-3dppxxjh.stx → SidebarHeader-esvby82n.stx} +3 -3
- package/dist/{SidebarItem-5v8atp7p.stx → SidebarItem-r4f2pref.stx} +4 -4
- package/dist/{SidebarSection-sqz49ary.stx → SidebarSection-5sqza2j6.stx} +2 -2
- package/dist/{SidebarSpace-nmbvgrky.stx → SidebarSpace-bwv98azf.stx} +3 -3
- package/dist/{SidebarSpaceSwitcher-v5e472j0.stx → SidebarSpaceSwitcher-1mycft2g.stx} +1 -1
- package/dist/{SidebarSpaces-6v3p9htw.stx → SidebarSpaces-mdtrynr2.stx} +2 -2
- package/dist/{Signup-cbncrtvd.stx → Signup-egdrk3rh.stx} +11 -11
- package/dist/{Skeleton-y9tycz2h.stx → Skeleton-me2hwqrc.stx} +4 -4
- package/dist/{Spinner-reb6rse4.stx → Spinner-grahbp9a.stx} +9 -9
- package/dist/{StepperStep-3ahq4d9m.stx → StepperStep-xw55xjh0.stx} +9 -4
- package/dist/{SubscriptionCheckout-7fdkwf04.stx → SubscriptionCheckout-wj4s182k.stx} +13 -13
- package/dist/{Switch-cgy7hy0s.stx → Switch-fxbw7s16.stx} +7 -4
- package/dist/{TabBarItem-hd2r2ayy.stx → TabBarItem-cnxhgy92.stx} +25 -1
- package/dist/{Table-0mc3fdek.stx → Table-akbk3t5q.stx} +1 -1
- package/dist/{TableHeader-sxc77b4d.stx → TableHeader-qsc3e208.stx} +1 -1
- package/dist/{Tabs-b4xsba1w.stx → Tabs-2cjt68my.stx} +28 -8
- package/dist/{Teleport-3gnjtsjf.stx → Teleport-c8nn3757.stx} +2 -2
- package/dist/{TextInput-hbe2ynzj.stx → TextInput-9wqzeeg1.stx} +23 -13
- package/dist/{Textarea-xcdym703.stx → Textarea-xwkdg8se.stx} +11 -11
- package/dist/{Tooltip-y0kzkwh4.stx → Tooltip-14gt4f1w.stx} +9 -6
- package/dist/{Transition-7smenaz8.stx → Transition-yrvqbhjy.stx} +1 -1
- package/dist/{TwoFactorChallenge-y7n4yrk9.stx → TwoFactorChallenge-0200pjc0.stx} +5 -5
- package/dist/{Video-a0aeyexv.stx → Video-rhy7dskw.stx} +6 -6
- package/dist/{VirtualTable-jvm1784g.stx → VirtualTable-jvje0ybn.stx} +4 -4
- package/dist/composables/index.js +2 -2
- package/dist/index.js +13 -13
- package/dist/utils/highlighter.d.ts +1 -0
- package/dist/utils/highlighter.js +1 -1
- package/package.json +3 -3
- package/src/components/CodeBlock.stx +7 -1
- package/src/components/Footer.stx +1 -1
- package/src/components/Hero.stx +2 -2
- package/src/components/Installation.stx +4 -4
- package/src/ui/accordion/Accordion.stx +23 -3
- package/src/ui/audio/Audio.stx +7 -7
- package/src/ui/auth/Login.stx +14 -14
- package/src/ui/auth/Signup.stx +11 -11
- package/src/ui/auth/TwoFactorChallenge.stx +5 -5
- package/src/ui/avatar/Avatar.stx +3 -3
- package/src/ui/badge/Badge.stx +31 -19
- package/src/ui/breadcrumb/Breadcrumb.stx +21 -6
- package/src/ui/button/Button.stx +148 -29
- package/src/ui/calendar/Calendar.stx +6 -6
- package/src/ui/card/Card.stx +6 -6
- package/src/ui/checkbox/Checkbox.stx +9 -9
- package/src/ui/combobox/ComboboxInput.stx +2 -2
- package/src/ui/combobox/ComboboxOption.stx +2 -2
- package/src/ui/combobox/ComboboxOptions.stx +1 -1
- package/src/ui/command-palette/CommandPalette.stx +4 -4
- package/src/ui/dialog/Dialog.stx +231 -4
- package/src/ui/dialog/DialogBackdrop.stx +5 -2
- package/src/ui/dialog/DialogPanel.stx +5 -2
- package/src/ui/dialog/DialogTitle.stx +1 -1
- package/src/ui/dialog/README.md +15 -4
- package/src/ui/drawer/Drawer.stx +86 -21
- package/src/ui/dropdown/DropdownButton.stx +2 -2
- package/src/ui/dropdown/DropdownItem.stx +1 -1
- package/src/ui/dropdown/DropdownItems.stx +1 -1
- package/src/ui/heatmap/Heatmap.stx +1 -1
- package/src/ui/image/Image.stx +3 -3
- package/src/ui/input/EmailInput.stx +4 -4
- package/src/ui/input/NumberInput.stx +21 -11
- package/src/ui/input/PasswordInput.stx +24 -14
- package/src/ui/input/SearchInput.stx +3 -3
- package/src/ui/input/TextInput.stx +23 -13
- package/src/ui/listbox/Listbox.stx +1 -1
- package/src/ui/listbox/ListboxButton.stx +2 -2
- package/src/ui/listbox/ListboxLabel.stx +1 -1
- package/src/ui/listbox/ListboxOption.stx +2 -2
- package/src/ui/listbox/ListboxOptions.stx +1 -1
- package/src/ui/mobile/FilterChip.stx +26 -2
- package/src/ui/mobile/ListRow.stx +2 -2
- package/src/ui/mobile/NavBar.stx +24 -0
- package/src/ui/mobile/SectionCard.stx +28 -1
- package/src/ui/mobile/TabBarItem.stx +25 -1
- package/src/ui/navigator/Navigator.stx +2 -2
- package/src/ui/notification/Notification.stx +6 -6
- package/src/ui/pagination/Pagination.stx +4 -4
- package/src/ui/payment/DefaultPaymentMethod.stx +8 -8
- package/src/ui/payment/PaymentMethods.stx +10 -10
- package/src/ui/payment/SubscriptionCheckout.stx +13 -13
- package/src/ui/popover/PopoverButton.stx +2 -2
- package/src/ui/popover/PopoverPanel.stx +2 -2
- package/src/ui/portal/Portal.stx +1 -1
- package/src/ui/progress/Progress.stx +47 -18
- package/src/ui/radio/Radio.stx +8 -8
- package/src/ui/radio-group/RadioGroup.stx +1 -1
- package/src/ui/radio-group/RadioGroupLabel.stx +1 -1
- package/src/ui/radio-group/RadioGroupOption.stx +2 -2
- package/src/ui/select/Select.stx +19 -9
- package/src/ui/sidebar/Sidebar.stx +6 -6
- package/src/ui/sidebar/SidebarHeader.stx +3 -3
- package/src/ui/sidebar/SidebarItem.stx +4 -4
- package/src/ui/sidebar/SidebarSection.stx +2 -2
- package/src/ui/sidebar/SidebarSpace.stx +3 -3
- package/src/ui/sidebar/SidebarSpaceSwitcher.stx +1 -1
- package/src/ui/sidebar/SidebarSpaces.stx +2 -2
- package/src/ui/skeleton/Skeleton.stx +4 -4
- package/src/ui/spinner/Spinner.stx +9 -9
- package/src/ui/stepper/StepperStep.stx +9 -4
- package/src/ui/switch/Switch.stx +7 -4
- package/src/ui/table/Table.stx +1 -1
- package/src/ui/table/TableHeader.stx +1 -1
- package/src/ui/tabs/Tabs.stx +28 -8
- package/src/ui/teleport/Teleport.stx +2 -2
- package/src/ui/textarea/Textarea.stx +11 -11
- package/src/ui/tooltip/Tooltip.stx +9 -6
- package/src/ui/transition/Transition.stx +1 -1
- package/src/ui/video/Video.stx +6 -6
- package/src/ui/virtual-table/VirtualTable.stx +4 -4
- package/src/utils/highlighter.ts +65 -4
- package/dist/Badge-xwjeq24d.stx +0 -62
- package/dist/Button-h2mk4wfw.stx +0 -74
- package/dist/Dialog-y5rz2vrq.stx +0 -41
- package/dist/DialogBackdrop-rxax3sec.stx +0 -9
- package/dist/DialogPanel-44d8jeqy.stx +0 -16
|
@@ -1,34 +1,44 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const value = $props.value || ''
|
|
3
3
|
export const placeholder = $props.placeholder || 'Enter your password'
|
|
4
|
-
export const disabled = $props.disabled
|
|
5
|
-
export const readonly = $props.readonly
|
|
4
|
+
export const disabled = $bool($props.disabled)
|
|
5
|
+
export const readonly = $bool($props.readonly)
|
|
6
6
|
export const size = $props.size || 'md'
|
|
7
|
-
export const error = $props.error
|
|
7
|
+
export const error = $bool($props.error)
|
|
8
8
|
export const label = $props.label || ''
|
|
9
9
|
export const helperText = $props.helperText || ''
|
|
10
|
-
export const required = $props.required
|
|
11
|
-
export const showStrength = $props.showStrength
|
|
10
|
+
export const required = $bool($props.required)
|
|
11
|
+
export const showStrength = $bool($props.showStrength)
|
|
12
12
|
export const className = $props.className || ''
|
|
13
13
|
export const inputClassName = $props.inputClassName || ''
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/*
|
|
16
|
+
* Padding decides the height here too, with no `h-*` to override it: an app
|
|
17
|
+
* passing its own `py-1.5` got the padding it asked for and the height it did
|
|
18
|
+
* not, and `className` cannot beat `h-10` at equal specificity
|
|
19
|
+
* (stacksjs/stx#1993).
|
|
20
|
+
*
|
|
21
|
+
* `lg` also needed a padding step adjusted - py-3 around a 1.75rem line-height
|
|
22
|
+
* is 3.25rem of content inside a declared 3rem box - so py-2.5 lands on the
|
|
23
|
+
* 3rem it always claimed. sm and md were already exact.
|
|
24
|
+
*/
|
|
25
|
+
const sizeClasses = { sm: 'px-3 py-1.5 text-sm', md: 'px-4 py-2 text-base', lg: 'px-5 py-2.5 text-lg' }
|
|
16
26
|
const iconSizeClasses = { sm: 'h-4 w-4', md: 'h-5 w-5', lg: 'h-6 w-6' }
|
|
17
27
|
|
|
18
|
-
const baseClasses = 'block w-full border-0 rounded-
|
|
28
|
+
const baseClasses = 'block w-full border-0 rounded-control shadow-sm ring-1 ring-inset transition-colors duration-200 focus:ring-2 focus:ring-inset dark:bg-neutral-700 dark:text-neutral-100 pr-10'
|
|
19
29
|
const stateClasses = error
|
|
20
|
-
? 'ring-
|
|
30
|
+
? 'ring-danger-line text-danger-fg placeholder-danger-fg-subtle focus:ring-danger-focus'
|
|
21
31
|
: 'ring-line-strong text-fg placeholder-fg-subtle focus:ring-accent'
|
|
22
32
|
const disabledClasses = disabled
|
|
23
33
|
? 'opacity-50 cursor-not-allowed bg-surface'
|
|
24
34
|
: readonly
|
|
25
35
|
? 'bg-surface cursor-default'
|
|
26
|
-
: 'bg-
|
|
36
|
+
: 'bg-field'
|
|
27
37
|
|
|
28
|
-
export const inputClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses} ${inputClassName}`.trim()
|
|
38
|
+
export const inputClasses = `${baseClasses} ${sizeClasses[size] || sizeClasses.md} ${stateClasses} ${disabledClasses} ${inputClassName}`.trim()
|
|
29
39
|
export const labelClasses = `block text-sm font-medium leading-6 mb-2 ${error ? 'text-danger' : 'text-fg'}`.trim()
|
|
30
40
|
export const helperClasses = `mt-2 text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
|
|
31
|
-
export const iconClasses = iconSizeClasses[size]
|
|
41
|
+
export const iconClasses = iconSizeClasses[size] || iconSizeClasses.md
|
|
32
42
|
</script>
|
|
33
43
|
|
|
34
44
|
<script client>
|
|
@@ -64,11 +74,11 @@ const strengthText = derived(() => {
|
|
|
64
74
|
})
|
|
65
75
|
const strengthColor = derived(() => {
|
|
66
76
|
const s = strength()
|
|
67
|
-
return s < 40 ? 'bg-
|
|
77
|
+
return s < 40 ? 'bg-danger-solid' : s < 70 ? 'bg-warning-solid' : 'bg-success-solid'
|
|
68
78
|
})
|
|
69
79
|
const strengthLabelColor = derived(() => {
|
|
70
80
|
const s = strength()
|
|
71
|
-
return s < 40 ? 'text-
|
|
81
|
+
return s < 40 ? 'text-danger' : s < 70 ? 'text-warning' : 'text-success'
|
|
72
82
|
})
|
|
73
83
|
const inputType = derived(() => showPassword() ? 'text' : 'password')
|
|
74
84
|
const toggleAriaLabel = derived(() => showPassword() ? 'Hide password' : 'Show password')
|
|
@@ -81,7 +91,7 @@ defineExpose({ value: inputValue })
|
|
|
81
91
|
<label for="password-input" class="{{ labelClasses }}">
|
|
82
92
|
{{ label }}
|
|
83
93
|
@if(required)
|
|
84
|
-
<span class="text-
|
|
94
|
+
<span class="text-danger ml-1">*</span>
|
|
85
95
|
@endif
|
|
86
96
|
</label>
|
|
87
97
|
@endif
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const value = $props.value || ''
|
|
3
3
|
export const placeholder = $props.placeholder || 'Search...'
|
|
4
|
-
export const disabled = $props.disabled
|
|
4
|
+
export const disabled = $bool($props.disabled)
|
|
5
5
|
export const size = $props.size || 'md'
|
|
6
|
-
export const error = $props.error
|
|
6
|
+
export const error = $bool($props.error)
|
|
7
7
|
export const label = $props.label || ''
|
|
8
8
|
export const helperText = $props.helperText || ''
|
|
9
|
-
export const loading = $props.loading
|
|
9
|
+
export const loading = $bool($props.loading)
|
|
10
10
|
export const className = $props.className || ''
|
|
11
11
|
|
|
12
12
|
export const searchIcon = '<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>'
|
|
@@ -1,39 +1,49 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const value = $props.value || ''
|
|
3
3
|
export const placeholder = $props.placeholder || ''
|
|
4
|
-
export const disabled = $props.disabled
|
|
5
|
-
export const readonly = $props.readonly
|
|
4
|
+
export const disabled = $bool($props.disabled)
|
|
5
|
+
export const readonly = $bool($props.readonly)
|
|
6
6
|
export const size = $props.size || 'md'
|
|
7
|
-
export const error = $props.error
|
|
7
|
+
export const error = $bool($props.error)
|
|
8
8
|
export const label = $props.label || ''
|
|
9
9
|
export const helperText = $props.helperText || ''
|
|
10
|
-
export const required = $props.required
|
|
10
|
+
export const required = $bool($props.required)
|
|
11
11
|
export const leftIcon = $props.leftIcon || ''
|
|
12
12
|
export const rightIcon = $props.rightIcon || ''
|
|
13
|
-
export const clearable = $props.clearable
|
|
13
|
+
export const clearable = $bool($props.clearable)
|
|
14
14
|
export const maxLength = $props.maxLength
|
|
15
|
-
export const showCount = $props.showCount
|
|
15
|
+
export const showCount = $bool($props.showCount)
|
|
16
16
|
export const className = $props.className || ''
|
|
17
17
|
export const inputClassName = $props.inputClassName || ''
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/*
|
|
20
|
+
* Padding decides the height here too, with no `h-*` to override it: an app
|
|
21
|
+
* passing its own `py-1.5` got the padding it asked for and the height it did
|
|
22
|
+
* not, and `className` cannot beat `h-10` at equal specificity
|
|
23
|
+
* (stacksjs/stx#1993).
|
|
24
|
+
*
|
|
25
|
+
* `lg` also needed a padding step adjusted - py-3 around a 1.75rem line-height
|
|
26
|
+
* is 3.25rem of content inside a declared 3rem box - so py-2.5 lands on the
|
|
27
|
+
* 3rem it always claimed. sm and md were already exact.
|
|
28
|
+
*/
|
|
29
|
+
const sizeClasses = { sm: 'px-3 py-1.5 text-sm', md: 'px-4 py-2 text-base', lg: 'px-5 py-2.5 text-lg' }
|
|
20
30
|
const iconSizeClasses = { sm: 'h-4 w-4', md: 'h-5 w-5', lg: 'h-6 w-6' }
|
|
21
31
|
|
|
22
|
-
const baseClasses = 'block w-full border-0 rounded-
|
|
32
|
+
const baseClasses = 'block w-full border-0 rounded-control shadow-sm ring-1 ring-inset transition-colors duration-200 focus:ring-2 focus:ring-inset dark:bg-neutral-700 dark:text-neutral-100'
|
|
23
33
|
const stateClasses = error
|
|
24
|
-
? 'ring-
|
|
34
|
+
? 'ring-danger-line text-danger-fg placeholder-danger-fg-subtle focus:ring-danger-focus'
|
|
25
35
|
: 'ring-line-strong text-fg placeholder-fg-subtle focus:ring-accent'
|
|
26
36
|
const disabledClasses = disabled
|
|
27
37
|
? 'opacity-50 cursor-not-allowed bg-surface'
|
|
28
38
|
: readonly
|
|
29
39
|
? 'bg-surface cursor-default'
|
|
30
|
-
: 'bg-
|
|
40
|
+
: 'bg-field'
|
|
31
41
|
const paddingClasses = leftIcon ? 'pl-10' : rightIcon || clearable ? 'pr-10' : ''
|
|
32
42
|
|
|
33
|
-
export const inputClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses} ${paddingClasses} ${inputClassName}`.trim()
|
|
43
|
+
export const inputClasses = `${baseClasses} ${sizeClasses[size] || sizeClasses.md} ${stateClasses} ${disabledClasses} ${paddingClasses} ${inputClassName}`.trim()
|
|
34
44
|
export const labelClasses = `block text-sm font-medium leading-6 mb-2 ${error ? 'text-danger' : 'text-fg'}`.trim()
|
|
35
45
|
export const helperClasses = `mt-2 text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
|
|
36
|
-
export const iconClasses = iconSizeClasses[size]
|
|
46
|
+
export const iconClasses = iconSizeClasses[size] || iconSizeClasses.md
|
|
37
47
|
export const inputId = `input-${label}`
|
|
38
48
|
</script>
|
|
39
49
|
|
|
@@ -69,7 +79,7 @@ defineExpose({ value: inputValue, clear: onClear })
|
|
|
69
79
|
<label for="{{ inputId }}" class="{{ labelClasses }}">
|
|
70
80
|
{{ label }}
|
|
71
81
|
@if(required)
|
|
72
|
-
<span class="text-
|
|
82
|
+
<span class="text-danger ml-1">*</span>
|
|
73
83
|
@endif
|
|
74
84
|
</label>
|
|
75
85
|
@endif
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const className = $props.className || ''
|
|
3
3
|
export const as = $props.as || 'button'
|
|
4
|
-
export const disabled = $props.disabled
|
|
4
|
+
export const disabled = $bool($props.disabled)
|
|
5
5
|
|
|
6
|
-
const baseClasses = 'relative w-full cursor-pointer rounded-
|
|
6
|
+
const baseClasses = 'relative w-full cursor-pointer rounded-panel bg-panel py-2 pl-3 pr-10 text-left shadow-md focus:outline-none focus-visible:border-blue-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2 focus-visible:ring-offset-blue-300'
|
|
7
7
|
const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : ''
|
|
8
8
|
export const buttonClasses = `${baseClasses} ${disabledClasses} ${className}`.trim()
|
|
9
9
|
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const className = $props.className || ''
|
|
3
3
|
export const as = $props.as || 'label'
|
|
4
4
|
|
|
5
|
-
const baseClasses = 'block text-sm font-medium text-
|
|
5
|
+
const baseClasses = 'block text-sm font-medium text-fg'
|
|
6
6
|
const labelClasses = `${baseClasses} ${className}`.trim()
|
|
7
7
|
</script>
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const value = $props.value
|
|
3
|
-
export const disabled = $props.disabled
|
|
3
|
+
export const disabled = $bool($props.disabled)
|
|
4
4
|
export const className = $props.className || ''
|
|
5
5
|
export const as = $props.as || 'li'
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ function onClick(event) {
|
|
|
32
32
|
@if(disabled)aria-disabled="true"@endif
|
|
33
33
|
@click="onClick($event)"
|
|
34
34
|
>
|
|
35
|
-
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-
|
|
35
|
+
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-accent" data-stx-listbox-check>
|
|
36
36
|
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
37
37
|
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
|
|
38
38
|
</svg>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const className = $props.className || ''
|
|
3
3
|
export const as = $props.as || 'ul'
|
|
4
4
|
|
|
5
|
-
const baseClasses = 'absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-
|
|
5
|
+
const baseClasses = 'absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-panel bg-panel py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none'
|
|
6
6
|
export const optionsClasses = `${baseClasses} ${className}`.trim()
|
|
7
7
|
</script>
|
|
8
8
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/** One pill. See `FilterChips` for why a menu chip is not a toggle chip. */
|
|
3
3
|
export const label = $props.label || ''
|
|
4
4
|
export const href = $props.href || '#'
|
|
5
|
-
export const active = $props.active
|
|
5
|
+
export const active = $bool($props.active)
|
|
6
6
|
/** Opens a picker rather than toggling in place — draws a chevron. */
|
|
7
|
-
export const menu = $props.menu
|
|
7
|
+
export const menu = $bool($props.menu)
|
|
8
8
|
export const count = $props.count || ''
|
|
9
9
|
|
|
10
10
|
export const hasCount = count !== '' && count !== 0 && count !== '0'
|
|
@@ -22,12 +22,36 @@ export const chipClasses = `
|
|
|
22
22
|
? 'border-transparent bg-fg text-surface'
|
|
23
23
|
: 'border-line bg-surface-raised text-fg hover:bg-surface-sunken'}
|
|
24
24
|
`.replace(/\s+/g, ' ').trim()
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* Whether the router should own this link.
|
|
28
|
+
*
|
|
29
|
+
* The SPA router intercepts `[data-stx-link]` and nothing else, so a plain
|
|
30
|
+
* `<a href>` here was a full document load: the runtime rebooted, every signal
|
|
31
|
+
* and store was discarded, and the screen flashed white. On a phone this is
|
|
32
|
+
* the primary navigation control, so the app's main interaction was its worst
|
|
33
|
+
* one - the single largest reason a wrapped build feels like a browser rather
|
|
34
|
+
* than an app. stacksjs/stx#1988
|
|
35
|
+
*
|
|
36
|
+
* An absolute URL, a scheme (mailto:, tel:), a protocol-relative URL and a
|
|
37
|
+
* bare fragment are left to the browser: the router does not handle those, and
|
|
38
|
+
* claiming them would break a tab that points off-site.
|
|
39
|
+
*/
|
|
40
|
+
function routerOwns(url) {
|
|
41
|
+
if (!url || url === '#') return false
|
|
42
|
+
return !/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(url)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const routerOwned = routerOwns(href)
|
|
25
46
|
</script>
|
|
26
47
|
|
|
27
48
|
<a
|
|
28
49
|
href="{{ href }}"
|
|
29
50
|
class="{{ chipClasses }}"
|
|
30
51
|
data-stx-filter-chip
|
|
52
|
+
@if (routerOwned)
|
|
53
|
+
data-stx-link
|
|
54
|
+
@endif
|
|
31
55
|
@if (active)
|
|
32
56
|
aria-current="true"
|
|
33
57
|
@endif
|
|
@@ -24,7 +24,7 @@ export const trailing = $props.trailing || ''
|
|
|
24
24
|
/** Inline SVG for the leading column. */
|
|
25
25
|
export const icon = $props.icon || ''
|
|
26
26
|
/** Draws the unread dot in the leading column, under the icon. */
|
|
27
|
-
export const unread = $props.unread
|
|
27
|
+
export const unread = $bool($props.unread)
|
|
28
28
|
export const href = $props.href || ''
|
|
29
29
|
export const className = $props.className || ''
|
|
30
30
|
|
|
@@ -91,7 +91,7 @@ export const rowClasses = `
|
|
|
91
91
|
@endif
|
|
92
92
|
|
|
93
93
|
@if (trailing)
|
|
94
|
-
<span class="rounded-
|
|
94
|
+
<span class="rounded-control bg-surface-sunken px-1.5 py-0.5 text-xs font-medium text-fg-muted">{{ trailing }}</span>
|
|
95
95
|
@endif
|
|
96
96
|
</span>
|
|
97
97
|
@endif
|
package/src/ui/mobile/NavBar.stx
CHANGED
|
@@ -28,6 +28,27 @@ export const hasControls = backHref !== '' || compactTitle !== '' || actions !==
|
|
|
28
28
|
* right on exactly one device.
|
|
29
29
|
*/
|
|
30
30
|
export const headerStyle = 'padding-top: max(env(safe-area-inset-top, 0px), 12px);'
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Whether the router should own this link.
|
|
34
|
+
*
|
|
35
|
+
* The SPA router intercepts `[data-stx-link]` and nothing else, so a plain
|
|
36
|
+
* `<a href>` here was a full document load: the runtime rebooted, every signal
|
|
37
|
+
* and store was discarded, and the screen flashed white. On a phone this is
|
|
38
|
+
* the primary navigation control, so the app's main interaction was its worst
|
|
39
|
+
* one - the single largest reason a wrapped build feels like a browser rather
|
|
40
|
+
* than an app. stacksjs/stx#1988
|
|
41
|
+
*
|
|
42
|
+
* An absolute URL, a scheme (mailto:, tel:), a protocol-relative URL and a
|
|
43
|
+
* bare fragment are left to the browser: the router does not handle those, and
|
|
44
|
+
* claiming them would break a tab that points off-site.
|
|
45
|
+
*/
|
|
46
|
+
function routerOwns(url) {
|
|
47
|
+
if (!url || url === '#') return false
|
|
48
|
+
return !/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(url)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const backRouterOwned = routerOwns(backHref)
|
|
31
52
|
</script>
|
|
32
53
|
|
|
33
54
|
<header class="px-4 {{ className }}" style="{{ headerStyle }}" data-stx-nav-bar>
|
|
@@ -38,6 +59,9 @@ export const headerStyle = 'padding-top: max(env(safe-area-inset-top, 0px), 12px
|
|
|
38
59
|
href="{{ backHref }}"
|
|
39
60
|
class="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-surface-raised text-fg"
|
|
40
61
|
aria-label="Back"
|
|
62
|
+
@if (backRouterOwned)
|
|
63
|
+
data-stx-link
|
|
64
|
+
@endif
|
|
41
65
|
>
|
|
42
66
|
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="none" aria-hidden="true">
|
|
43
67
|
<path d="M12 4l-6 6 6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
@@ -21,6 +21,27 @@ export const cardClasses = `
|
|
|
21
21
|
overflow-hidden rounded-2xl border border-line bg-surface-raised
|
|
22
22
|
divide-y divide-line
|
|
23
23
|
`.replace(/\s+/g, ' ').trim()
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Whether the router should own this link.
|
|
27
|
+
*
|
|
28
|
+
* The SPA router intercepts `[data-stx-link]` and nothing else, so a plain
|
|
29
|
+
* `<a href>` here was a full document load: the runtime rebooted, every signal
|
|
30
|
+
* and store was discarded, and the screen flashed white. On a phone this is
|
|
31
|
+
* the primary navigation control, so the app's main interaction was its worst
|
|
32
|
+
* one - the single largest reason a wrapped build feels like a browser rather
|
|
33
|
+
* than an app. stacksjs/stx#1988
|
|
34
|
+
*
|
|
35
|
+
* An absolute URL, a scheme (mailto:, tel:), a protocol-relative URL and a
|
|
36
|
+
* bare fragment are left to the browser: the router does not handle those, and
|
|
37
|
+
* claiming them would break a tab that points off-site.
|
|
38
|
+
*/
|
|
39
|
+
function routerOwns(url) {
|
|
40
|
+
if (!url || url === '#') return false
|
|
41
|
+
return !/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(url)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const actionRouterOwned = routerOwns(actionHref)
|
|
24
45
|
</script>
|
|
25
46
|
|
|
26
47
|
<section class="{{ className }}" data-stx-section-card>
|
|
@@ -31,7 +52,13 @@ export const cardClasses = `
|
|
|
31
52
|
@endif
|
|
32
53
|
|
|
33
54
|
@if (action)
|
|
34
|
-
<a
|
|
55
|
+
<a
|
|
56
|
+
href="{{ actionHref }}"
|
|
57
|
+
class="text-sm font-medium text-accent"
|
|
58
|
+
@if (actionRouterOwned)
|
|
59
|
+
data-stx-link
|
|
60
|
+
@endif
|
|
61
|
+
>{{ action }}</a>
|
|
35
62
|
@endif
|
|
36
63
|
</header>
|
|
37
64
|
@endif
|
|
@@ -9,12 +9,33 @@
|
|
|
9
9
|
export const label = $props.label || ''
|
|
10
10
|
export const href = $props.href || '#'
|
|
11
11
|
export const icon = $props.icon || ''
|
|
12
|
-
export const active = $props.active
|
|
12
|
+
export const active = $bool($props.active)
|
|
13
13
|
/** A count, or any short string. Zero and empty are not rendered. */
|
|
14
14
|
export const badge = $props.badge || ''
|
|
15
15
|
|
|
16
16
|
export const hasBadge = badge !== '' && badge !== 0 && badge !== '0'
|
|
17
17
|
|
|
18
|
+
/*
|
|
19
|
+
* Whether the router should own this link.
|
|
20
|
+
*
|
|
21
|
+
* The SPA router intercepts `[data-stx-link]` and nothing else, so a plain
|
|
22
|
+
* `<a href>` here was a full document load: the runtime rebooted, every signal
|
|
23
|
+
* and store was discarded, and the screen flashed white. On a phone this is
|
|
24
|
+
* the primary navigation control, so the app's main interaction was its worst
|
|
25
|
+
* one - the single largest reason a wrapped build feels like a browser rather
|
|
26
|
+
* than an app. stacksjs/stx#1988
|
|
27
|
+
*
|
|
28
|
+
* An absolute URL, a scheme (mailto:, tel:), a protocol-relative URL and a
|
|
29
|
+
* bare fragment are left to the browser: the router does not handle those, and
|
|
30
|
+
* claiming them would break a tab that points off-site.
|
|
31
|
+
*/
|
|
32
|
+
function routerOwns(url) {
|
|
33
|
+
if (!url || url === '#') return false
|
|
34
|
+
return !/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(url)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const routerOwned = routerOwns(href)
|
|
38
|
+
|
|
18
39
|
/*
|
|
19
40
|
* The active state is a filled pill behind the item rather than a colour
|
|
20
41
|
* change alone. Colour alone is the one distinction that disappears for the
|
|
@@ -32,6 +53,9 @@ export const itemClasses = `
|
|
|
32
53
|
href="{{ href }}"
|
|
33
54
|
class="{{ itemClasses }}"
|
|
34
55
|
data-stx-tab-bar-item
|
|
56
|
+
@if (routerOwned)
|
|
57
|
+
data-stx-link
|
|
58
|
+
@endif
|
|
35
59
|
@if (active)
|
|
36
60
|
aria-current="page"
|
|
37
61
|
@endif
|
|
@@ -45,12 +45,12 @@ function getItemClasses(item) {
|
|
|
45
45
|
}
|
|
46
46
|
else if (variant === 'underline') {
|
|
47
47
|
cls += isActiveItem
|
|
48
|
-
? 'text-
|
|
48
|
+
? 'text-accent font-medium border-b-2 border-accent'
|
|
49
49
|
: 'text-fg-muted hover:text-fg border-b-2 border-transparent'
|
|
50
50
|
}
|
|
51
51
|
else if (variant === 'sidebar') {
|
|
52
52
|
cls += isActiveItem
|
|
53
|
-
? 'bg-blue-50 dark:bg-blue-900/20 text-
|
|
53
|
+
? 'bg-blue-50 dark:bg-blue-900/20 text-accent font-medium border-l-4 border-accent'
|
|
54
54
|
: 'text-fg-strong hover:bg-surface-raised border-l-4 border-transparent'
|
|
55
55
|
}
|
|
56
56
|
cls += ' transition-all duration-200 cursor-pointer flex items-center gap-2'
|
|
@@ -22,10 +22,10 @@ const position = state({{ initialPosition }})
|
|
|
22
22
|
const duration = state({{ initialDuration }})
|
|
23
23
|
|
|
24
24
|
const typeColors = {
|
|
25
|
-
info: 'bg-
|
|
26
|
-
success: 'bg-
|
|
27
|
-
warning: 'bg-
|
|
28
|
-
error: 'bg-
|
|
25
|
+
info: 'bg-info-soft text-info-soft-ink',
|
|
26
|
+
success: 'bg-success-soft text-success-soft-ink',
|
|
27
|
+
warning: 'bg-warning-soft text-warning-soft-ink',
|
|
28
|
+
error: 'bg-danger-soft text-danger-soft-ink',
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const positions = {
|
|
@@ -37,7 +37,7 @@ const positions = {
|
|
|
37
37
|
'bottom-center': 'bottom-0 left-1/2 -translate-x-1/2',
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const baseClasses = 'fixed z-50 m-4 max-w-md w-full pointer-events-auto rounded-
|
|
40
|
+
const baseClasses = 'fixed z-50 m-4 max-w-md w-full pointer-events-auto rounded-panel p-4 shadow-lg ring-1 ring-black/5 transition-all'
|
|
41
41
|
const extraClassName = {{ JSON.stringify(className) }}
|
|
42
42
|
|
|
43
43
|
const notificationClasses = derived(() => {
|
|
@@ -106,7 +106,7 @@ defineExpose({
|
|
|
106
106
|
<button
|
|
107
107
|
type="button"
|
|
108
108
|
@click="close()"
|
|
109
|
-
class="ml-4 inline-flex rounded-
|
|
109
|
+
class="ml-4 inline-flex rounded-panel focus:outline-none focus:ring-2 focus:ring-offset-2"
|
|
110
110
|
>
|
|
111
111
|
<span class="sr-only">Close</span>
|
|
112
112
|
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
export const currentPage = $props.currentPage || 1
|
|
3
3
|
export const totalPages = $props.totalPages || 1
|
|
4
4
|
export const siblingCount = $props.siblingCount || 1
|
|
5
|
-
export const showFirstLast = $props.showFirstLast
|
|
6
|
-
export const showPrevNext = $props.showPrevNext
|
|
5
|
+
export const showFirstLast = $bool($props.showFirstLast, true)
|
|
6
|
+
export const showPrevNext = $bool($props.showPrevNext, true)
|
|
7
7
|
export const className = $props.className || ''
|
|
8
8
|
|
|
9
9
|
export const paginationClasses = `flex items-center gap-1 ${className}`.trim()
|
|
10
|
-
export const buttonClasses = `px-3 py-2 text-sm font-medium text-fg-strong bg-
|
|
11
|
-
export const activeButtonClasses = `px-3 py-2 text-sm font-medium text-white bg-
|
|
10
|
+
export const buttonClasses = `px-3 py-2 text-sm font-medium text-fg-strong bg-panel border border-line-strong rounded-control hover:bg-surface focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-white dark:disabled:hover:bg-neutral-800 transition-colors duration-150`.trim()
|
|
11
|
+
export const activeButtonClasses = `px-3 py-2 text-sm font-medium text-white bg-accent-solid border border-accent rounded-control focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900`.trim()
|
|
12
12
|
export const ellipsisClasses = `px-3 py-2 text-sm font-medium text-fg-subtle`.trim()
|
|
13
13
|
export const iconClasses = `w-5 h-5`.trim()
|
|
14
14
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const paymentMethod = $props.paymentMethod
|
|
3
|
-
export const isLoading = $props.isLoading
|
|
3
|
+
export const isLoading = $bool($props.isLoading)
|
|
4
4
|
export const className = $props.className || ''
|
|
5
5
|
|
|
6
6
|
const brandIcons = {
|
|
@@ -11,7 +11,7 @@ const brandIcons = {
|
|
|
11
11
|
default: '💳',
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const containerClasses = `mt-16 w-2/3 bg-
|
|
14
|
+
export const containerClasses = `mt-16 w-2/3 bg-panel px-8 py-6 shadow ring-1 ring-black/5 dark:ring-neutral-700 sm:rounded-panel ${className}`.trim()
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<div class="{{ containerClasses }}">
|
|
@@ -21,17 +21,17 @@ export const containerClasses = `mt-16 w-2/3 bg-white dark:bg-blue-gray-800 px-8
|
|
|
21
21
|
|
|
22
22
|
@if(isLoading)
|
|
23
23
|
<!-- Loading skeleton -->
|
|
24
|
-
<div class="mt-8 animate-pulse">
|
|
25
|
-
<div class="h-20 bg-surface-sunken rounded-
|
|
24
|
+
<div class="mt-8 motion-safe:animate-pulse">
|
|
25
|
+
<div class="h-20 bg-surface-sunken rounded-panel"></div>
|
|
26
26
|
</div>
|
|
27
27
|
@else
|
|
28
28
|
@if(paymentMethod)
|
|
29
|
-
<div class="col-span-1 mt-8 border border-line rounded-
|
|
29
|
+
<div class="col-span-1 mt-8 border border-line rounded-panel bg-panel shadow divide-y divide-line">
|
|
30
30
|
<div class="w-full p-3">
|
|
31
31
|
<div class="flex items-center justify-between">
|
|
32
32
|
<div class="flex items-center space-x-4">
|
|
33
33
|
<!-- Card Brand Icon -->
|
|
34
|
-
<div class="flex-shrink-0 h-10 w-10 flex items-center justify-center bg-surface-raised rounded-
|
|
34
|
+
<div class="flex-shrink-0 h-10 w-10 flex items-center justify-center bg-surface-raised rounded-control">
|
|
35
35
|
<span class="text-2xl">{{ brandIcons[paymentMethod.brand.toLowerCase()] || brandIcons.default }}</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
@@ -39,7 +39,7 @@ export const containerClasses = `mt-16 w-2/3 bg-white dark:bg-blue-gray-800 px-8
|
|
|
39
39
|
<div>
|
|
40
40
|
<h2 class="text-sm text-fg-muted">
|
|
41
41
|
{{ paymentMethod.brand }} •••• {{ paymentMethod.last_four }}
|
|
42
|
-
<span class="ml-4 inline-flex items-center rounded-
|
|
42
|
+
<span class="ml-4 inline-flex items-center rounded-control bg-indigo-50 dark:bg-indigo-900/30 px-2 py-1 text-xs text-indigo-700 dark:text-indigo-300 font-medium ring-1 ring-indigo-700/10 dark:ring-indigo-300/20 ring-inset">Default</span>
|
|
43
43
|
<br>
|
|
44
44
|
<span class="text-xs text-fg-soft italic">Expires {{ paymentMethod.exp_month }} / {{ paymentMethod.exp_year }}</span>
|
|
45
45
|
</h2>
|
|
@@ -50,7 +50,7 @@ export const containerClasses = `mt-16 w-2/3 bg-white dark:bg-blue-gray-800 px-8
|
|
|
50
50
|
</div>
|
|
51
51
|
@else
|
|
52
52
|
<!-- Empty state -->
|
|
53
|
-
<div class="col-span-1 mt-8 border border-line rounded-
|
|
53
|
+
<div class="col-span-1 mt-8 border border-line rounded-panel bg-panel shadow divide-y divide-line">
|
|
54
54
|
<div class="w-full px-4 py-5">
|
|
55
55
|
<h2 class="text-center text-sm text-fg-muted">
|
|
56
56
|
You haven't added any payment methods yet.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const paymentMethods = $props.paymentMethods || []
|
|
3
|
-
export const isLoading = $props.isLoading
|
|
4
|
-
export const showMakeDefault = $props.showMakeDefault
|
|
5
|
-
export const showDelete = $props.showDelete
|
|
3
|
+
export const isLoading = $bool($props.isLoading)
|
|
4
|
+
export const showMakeDefault = $bool($props.showMakeDefault, true)
|
|
5
|
+
export const showDelete = $bool($props.showDelete, true)
|
|
6
6
|
export const className = $props.className || ''
|
|
7
7
|
|
|
8
8
|
export const brandIcons = {
|
|
@@ -32,18 +32,18 @@ function onDelete(methodId) {
|
|
|
32
32
|
|
|
33
33
|
<div class="{{ containerClasses }}">
|
|
34
34
|
@if(isLoading)
|
|
35
|
-
<div class="animate-pulse">
|
|
36
|
-
<div class="h-24 bg-surface-sunken rounded-
|
|
35
|
+
<div class="motion-safe:animate-pulse">
|
|
36
|
+
<div class="h-24 bg-surface-sunken rounded-panel"></div>
|
|
37
37
|
</div>
|
|
38
38
|
@else
|
|
39
39
|
@if(paymentMethods.length > 0)
|
|
40
40
|
<ul role="list" class="grid grid-cols-1 gap-6 lg:grid-cols-1 sm:grid-cols-1">
|
|
41
41
|
@foreach(method in paymentMethods)
|
|
42
|
-
<li class="col-span-1 border border-line rounded-
|
|
42
|
+
<li class="col-span-1 border border-line rounded-panel bg-panel shadow divide-y divide-line">
|
|
43
43
|
<div class="w-full p-3">
|
|
44
44
|
<div class="flex items-center justify-between">
|
|
45
45
|
<div class="flex items-center space-x-4">
|
|
46
|
-
<div class="flex-shrink-0 h-10 w-10 flex items-center justify-center bg-surface-raised rounded-
|
|
46
|
+
<div class="flex-shrink-0 h-10 w-10 flex items-center justify-center bg-surface-raised rounded-control">
|
|
47
47
|
<span class="text-2xl">{{ brandIcons[method.brand.toLowerCase()] || brandIcons.default }}</span>
|
|
48
48
|
</div>
|
|
49
49
|
|
|
@@ -61,7 +61,7 @@ function onDelete(methodId) {
|
|
|
61
61
|
@if(showMakeDefault)
|
|
62
62
|
<button
|
|
63
63
|
type="button"
|
|
64
|
-
class="border border-line-strong rounded-
|
|
64
|
+
class="border border-line-strong rounded-control bg-field px-2 py-1 text-sm text-fg-strong font-semibold shadow-sm hover:bg-neutral-50 dark:hover:bg-neutral-600 focus-visible:outline-2 focus-visible:outline-blue-600 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
65
65
|
@click="onMakeDefault('{{ method.id }}')"
|
|
66
66
|
title="Make default"
|
|
67
67
|
>
|
|
@@ -74,7 +74,7 @@ function onDelete(methodId) {
|
|
|
74
74
|
@if(showDelete)
|
|
75
75
|
<button
|
|
76
76
|
type="button"
|
|
77
|
-
class="border border-line-strong rounded-
|
|
77
|
+
class="border border-line-strong rounded-control bg-field px-2 py-1 text-sm text-danger font-semibold shadow-sm hover:bg-red-50 dark:hover:bg-red-900/20 focus-visible:outline-2 focus-visible:outline-red-600 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
78
78
|
@click="onDelete('{{ method.id }}')"
|
|
79
79
|
title="Delete payment method"
|
|
80
80
|
>
|
|
@@ -90,7 +90,7 @@ function onDelete(methodId) {
|
|
|
90
90
|
@endforeach
|
|
91
91
|
</ul>
|
|
92
92
|
@else
|
|
93
|
-
<div class="text-center py-12 bg-
|
|
93
|
+
<div class="text-center py-12 bg-panel rounded-panel border border-line">
|
|
94
94
|
<svg class="mx-auto h-12 w-12 text-fg-subtle" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
95
95
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" />
|
|
96
96
|
</svg>
|