@stacksjs/components 0.2.343 → 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,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
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script server>
|
|
2
|
-
export const showLogo = $props.showLogo
|
|
2
|
+
export const showLogo = $bool($props.showLogo, true)
|
|
3
3
|
export const headingText = $props.headingText || 'Sign in to your account'
|
|
4
|
-
export const showSocialLogin = $props.showSocialLogin
|
|
5
|
-
export const showRememberMe = $props.showRememberMe
|
|
6
|
-
export const showForgotPassword = $props.showForgotPassword
|
|
7
|
-
export const showSignup = $props.showSignup
|
|
4
|
+
export const showSocialLogin = $bool($props.showSocialLogin, true)
|
|
5
|
+
export const showRememberMe = $bool($props.showRememberMe, true)
|
|
6
|
+
export const showForgotPassword = $bool($props.showForgotPassword, true)
|
|
7
|
+
export const showSignup = $bool($props.showSignup, true)
|
|
8
8
|
export const signupText = $props.signupText || 'Start a 14 day free trial'
|
|
9
9
|
export const className = $props.className || ''
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ export const className = $props.className || ''
|
|
|
16
16
|
export const forgotPasswordHref = $props.forgotPasswordHref || '/forgot-password'
|
|
17
17
|
export const signupHref = $props.signupHref || '/register'
|
|
18
18
|
|
|
19
|
-
export const containerClasses = `min-h-full flex flex-col justify-center py-12 lg:px-8 sm:px-6 dark:bg-
|
|
19
|
+
export const containerClasses = `min-h-full flex flex-col justify-center py-12 lg:px-8 sm:px-6 dark:bg-neutral-900 ${className}`.trim()
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<script client>
|
|
@@ -55,7 +55,7 @@ function onSubmit(event) {
|
|
|
55
55
|
|
|
56
56
|
<form @submit="onSubmit($event)">
|
|
57
57
|
<div class="mt-10 sm:mx-auto sm:max-w-[480px] sm:w-full">
|
|
58
|
-
<div class="bg-
|
|
58
|
+
<div class="bg-panel px-6 py-12 shadow sm:rounded-panel sm:px-12">
|
|
59
59
|
<div class="space-y-6">
|
|
60
60
|
<div>
|
|
61
61
|
<label for="email" class="block text-sm text-fg font-medium leading-6">
|
|
@@ -68,7 +68,7 @@ function onSubmit(event) {
|
|
|
68
68
|
type="email"
|
|
69
69
|
autocomplete="email"
|
|
70
70
|
required
|
|
71
|
-
class="block w-full border-0 rounded-
|
|
71
|
+
class="block w-full border-0 rounded-control py-1.5 text-fg shadow-sm ring-1 ring-line-strong ring-inset sm:text-sm placeholder:text-fg-subtle sm:leading-6 focus:ring-2 focus:ring-indigo-600 focus:ring-inset dark:bg-neutral-700"
|
|
72
72
|
/>
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
@@ -84,7 +84,7 @@ function onSubmit(event) {
|
|
|
84
84
|
type="password"
|
|
85
85
|
autocomplete="current-password"
|
|
86
86
|
required
|
|
87
|
-
class="block w-full border-0 rounded-
|
|
87
|
+
class="block w-full border-0 rounded-control py-1.5 text-fg shadow-sm ring-1 ring-line-strong ring-inset sm:text-sm placeholder:text-fg-subtle sm:leading-6 focus:ring-2 focus:ring-indigo-600 focus:ring-inset dark:bg-neutral-700"
|
|
88
88
|
/>
|
|
89
89
|
</div>
|
|
90
90
|
</div>
|
|
@@ -96,7 +96,7 @@ function onSubmit(event) {
|
|
|
96
96
|
id="remember-me"
|
|
97
97
|
name="remember-me"
|
|
98
98
|
type="checkbox"
|
|
99
|
-
class="h-4 w-4 border-line-strong rounded text-indigo-600 focus:ring-indigo-600 dark:bg-
|
|
99
|
+
class="h-4 w-4 border-line-strong rounded text-indigo-600 focus:ring-indigo-600 dark:bg-neutral-700"
|
|
100
100
|
/>
|
|
101
101
|
<label for="remember-me" class="ml-3 block text-sm text-fg leading-6">
|
|
102
102
|
Remember me
|
|
@@ -116,7 +116,7 @@ function onSubmit(event) {
|
|
|
116
116
|
<div>
|
|
117
117
|
<button
|
|
118
118
|
type="submit"
|
|
119
|
-
class="w-full flex justify-center rounded-
|
|
119
|
+
class="w-full flex justify-center rounded-control bg-indigo-600 px-3 py-1.5 text-sm text-white font-semibold leading-6 shadow-sm hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-indigo-600 focus-visible:outline-offset-2 focus-visible:outline"
|
|
120
120
|
>
|
|
121
121
|
Sign in
|
|
122
122
|
</button>
|
|
@@ -130,7 +130,7 @@ function onSubmit(event) {
|
|
|
130
130
|
<div class="w-full border-t border-line"></div>
|
|
131
131
|
</div>
|
|
132
132
|
<div class="relative flex justify-center text-sm font-medium leading-6">
|
|
133
|
-
<span class="bg-
|
|
133
|
+
<span class="bg-panel px-6 text-fg">
|
|
134
134
|
Or continue with
|
|
135
135
|
</span>
|
|
136
136
|
</div>
|
|
@@ -140,7 +140,7 @@ function onSubmit(event) {
|
|
|
140
140
|
<button
|
|
141
141
|
type="button"
|
|
142
142
|
@click="onSocial('google')"
|
|
143
|
-
class="w-full flex items-center justify-center gap-3 rounded-
|
|
143
|
+
class="w-full flex items-center justify-center gap-3 rounded-control bg-field px-3 py-2 text-sm text-fg font-semibold shadow-sm ring-1 ring-line-strong ring-inset hover:bg-neutral-50 dark:hover:bg-neutral-600 focus-visible:ring-transparent"
|
|
144
144
|
>
|
|
145
145
|
<svg class="h-5 w-5" viewBox="0 0 24 24" aria-hidden="true">
|
|
146
146
|
<path d="M12.0003 4.75C13.7703 4.75 15.3553 5.36002 16.6053 6.54998L20.0303 3.125C17.9502 1.19 15.2353 0 12.0003 0C7.31028 0 3.25527 2.69 1.28027 6.60998L5.27028 9.70498C6.21525 6.86002 8.87028 4.75 12.0003 4.75Z" fill="#EA4335" />
|
|
@@ -154,7 +154,7 @@ function onSubmit(event) {
|
|
|
154
154
|
<button
|
|
155
155
|
type="button"
|
|
156
156
|
@click="onSocial('github')"
|
|
157
|
-
class="w-full flex items-center justify-center gap-3 rounded-
|
|
157
|
+
class="w-full flex items-center justify-center gap-3 rounded-control bg-field px-3 py-2 text-sm text-fg font-semibold shadow-sm ring-1 ring-line-strong ring-inset hover:bg-neutral-50 dark:hover:bg-neutral-600 focus-visible:ring-transparent"
|
|
158
158
|
>
|
|
159
159
|
<svg class="h-5 w-5 fill-[#24292F]" fill="currentColor" viewBox="0 0 20 20" aria-hidden="true">
|
|
160
160
|
<path fill-rule="evenodd" d="M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z" clip-rule="evenodd" />
|
|
@@ -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" />
|
|
@@ -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">
|
|
@@ -1,33 +1,43 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const value = $props.value || ''
|
|
3
3
|
export const placeholder = $props.placeholder || '0'
|
|
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 min = $props.min
|
|
12
12
|
export const max = $props.max
|
|
13
13
|
export const step = $props.step || 1
|
|
14
|
-
export const showControls = $props.showControls
|
|
14
|
+
export const showControls = $bool($props.showControls, true)
|
|
15
15
|
export const className = $props.className || ''
|
|
16
16
|
export const inputClassName = $props.inputClassName || ''
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/*
|
|
19
|
+
* Padding decides the height here too, with no `h-*` to override it: an app
|
|
20
|
+
* passing its own `py-1.5` got the padding it asked for and the height it did
|
|
21
|
+
* not, and `className` cannot beat `h-10` at equal specificity
|
|
22
|
+
* (stacksjs/stx#1993).
|
|
23
|
+
*
|
|
24
|
+
* `lg` also needed a padding step adjusted - py-3 around a 1.75rem line-height
|
|
25
|
+
* is 3.25rem of content inside a declared 3rem box - so py-2.5 lands on the
|
|
26
|
+
* 3rem it always claimed. sm and md were already exact.
|
|
27
|
+
*/
|
|
28
|
+
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' }
|
|
29
|
+
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'
|
|
20
30
|
const stateClasses = error
|
|
21
|
-
? 'ring-
|
|
31
|
+
? 'ring-danger-line text-danger-fg placeholder-danger-fg-subtle focus:ring-danger-focus'
|
|
22
32
|
: 'ring-line-strong text-fg placeholder-fg-subtle focus:ring-accent'
|
|
23
33
|
const disabledClasses = disabled
|
|
24
34
|
? 'opacity-50 cursor-not-allowed bg-surface'
|
|
25
35
|
: readonly
|
|
26
36
|
? 'bg-surface cursor-default'
|
|
27
|
-
: 'bg-
|
|
37
|
+
: 'bg-field'
|
|
28
38
|
const paddingClasses = showControls ? 'pr-10' : ''
|
|
29
39
|
|
|
30
|
-
export const inputClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses} ${paddingClasses} ${inputClassName}`.trim()
|
|
40
|
+
export const inputClasses = `${baseClasses} ${sizeClasses[size] || sizeClasses.md} ${stateClasses} ${disabledClasses} ${paddingClasses} ${inputClassName}`.trim()
|
|
31
41
|
export const labelClasses = `block text-sm font-medium leading-6 mb-2 ${error ? 'text-danger' : 'text-fg'}`.trim()
|
|
32
42
|
export const helperClasses = `mt-2 text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
|
|
33
43
|
</script>
|
|
@@ -69,7 +79,7 @@ defineExpose({ value: inputValue, increment, decrement })
|
|
|
69
79
|
<label for="number-input" 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
|
|
@@ -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,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,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>
|
|
@@ -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 = 'inline-flex items-center gap-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white
|
|
6
|
+
const baseClasses = 'inline-flex items-center gap-2 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/75'
|
|
7
7
|
export const buttonClasses = `${baseClasses} ${className}`.trim()
|
|
8
8
|
</script>
|
|
9
9
|
|
|
@@ -10,8 +10,8 @@ const positionClasses = {
|
|
|
10
10
|
right: 'left-full ml-2',
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const baseClasses = 'absolute z-10 rounded-
|
|
14
|
-
export const panelClasses = `${baseClasses} ${positionClasses[position]} ${className}`.trim()
|
|
13
|
+
const baseClasses = 'absolute z-10 rounded-panel bg-panel p-4 shadow-lg ring-1 ring-black/5 focus:outline-none'
|
|
14
|
+
export const panelClasses = `${baseClasses} ${positionClasses[position] || positionClasses.bottom} ${className}`.trim()
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<component
|
|
@@ -4,17 +4,17 @@ export const max = $props.max || 100
|
|
|
4
4
|
export const variant = $props.variant || 'linear'
|
|
5
5
|
export const size = $props.size || 'md'
|
|
6
6
|
export const color = $props.color || 'primary'
|
|
7
|
-
export const showLabel = $props.showLabel
|
|
8
|
-
export const indeterminate = $props.indeterminate
|
|
7
|
+
export const showLabel = $bool($props.showLabel)
|
|
8
|
+
export const indeterminate = $bool($props.indeterminate)
|
|
9
9
|
export const className = $props.className || ''
|
|
10
10
|
|
|
11
11
|
const linearSizeClasses = { sm: 'h-1', md: 'h-2', lg: 'h-3' }
|
|
12
12
|
const circularSizeClasses = { sm: 'w-12 h-12', md: 'w-16 h-16', lg: 'w-24 h-24' }
|
|
13
13
|
const colorClasses = {
|
|
14
|
-
primary: 'bg-
|
|
15
|
-
secondary: 'bg-
|
|
14
|
+
primary: 'bg-accent-solid',
|
|
15
|
+
secondary: 'bg-secondary-solid',
|
|
16
16
|
success: 'bg-success-solid',
|
|
17
|
-
warning: 'bg-
|
|
17
|
+
warning: 'bg-warning-solid',
|
|
18
18
|
danger: 'bg-danger-solid',
|
|
19
19
|
info: 'bg-cyan-600 dark:bg-cyan-500',
|
|
20
20
|
}
|
|
@@ -28,30 +28,56 @@ export const containerClasses = variant === 'linear'
|
|
|
28
28
|
? `w-full ${className}`.trim()
|
|
29
29
|
: `inline-flex items-center justify-center ${className}`.trim()
|
|
30
30
|
|
|
31
|
-
export const linearTrackClasses = `w-full ${linearSizeClasses[size]} bg-surface-sunken rounded-full overflow-hidden`.trim()
|
|
32
|
-
export const linearBarClasses = `h-full ${colorClasses[color]} transition-all duration-300 ease-in-out ${indeterminate ? 'animate-progress-indeterminate' : ''}`.trim()
|
|
33
|
-
export const circularSizeClass = circularSizeClasses[size]
|
|
31
|
+
export const linearTrackClasses = `w-full ${linearSizeClasses[size] || linearSizeClasses.md} bg-surface-sunken rounded-full overflow-hidden`.trim()
|
|
32
|
+
export const linearBarClasses = `h-full ${colorClasses[color] || colorClasses.primary} transition-all duration-300 ease-in-out ${indeterminate ? 'animate-progress-indeterminate' : ''}`.trim()
|
|
33
|
+
export const circularSizeClass = circularSizeClasses[size] || circularSizeClasses.md
|
|
34
34
|
export const labelClasses = `text-sm font-medium text-fg-strong mb-2`.trim()
|
|
35
|
-
export const circularTrackColor = 'stroke-
|
|
36
|
-
export const circularBarColor = color === 'primary' ? 'stroke-
|
|
37
|
-
: color === 'secondary' ? 'stroke-
|
|
35
|
+
export const circularTrackColor = 'stroke-line'
|
|
36
|
+
export const circularBarColor = color === 'primary' ? 'stroke-accent'
|
|
37
|
+
: color === 'secondary' ? 'stroke-secondary-solid'
|
|
38
38
|
: color === 'success' ? 'stroke-success'
|
|
39
|
-
: color === 'warning' ? 'stroke-
|
|
39
|
+
: color === 'warning' ? 'stroke-warning-solid'
|
|
40
40
|
: color === 'danger' ? 'stroke-danger'
|
|
41
41
|
: 'stroke-cyan-600 dark:stroke-cyan-500'
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
<script client>
|
|
45
|
-
const max = {{ max }}
|
|
46
|
-
const indeterminate = {{ indeterminate }}
|
|
47
45
|
const circumference = {{ circumference }}
|
|
48
|
-
|
|
46
|
+
const circularBarColor = {{ circularBarColor }}
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
* `value` has been a live prop since #1704. `max` and `indeterminate` were not,
|
|
50
|
+
* and they are bound for the same reasons:
|
|
51
|
+
*
|
|
52
|
+
* :max="total()" the denominator is often unknown until the
|
|
53
|
+
* response that supplies it arrives
|
|
54
|
+
* :indeterminate="!total()" and the bar starts indeterminate precisely
|
|
55
|
+
* BECAUSE the total is not known yet
|
|
56
|
+
*
|
|
57
|
+
* Frozen, those two could only ever describe the state the page was built in,
|
|
58
|
+
* so a bar could never stop spinning once the total showed up. See #1997 for
|
|
59
|
+
* the same freeze on Button.
|
|
60
|
+
*/
|
|
61
|
+
/*
|
|
62
|
+
* The locals are deliberately NOT named `max` / `indeterminate`.
|
|
63
|
+
*
|
|
64
|
+
* A client-script name that matches a server-script export stops the server
|
|
65
|
+
* interpolating that name in the template: the `animate-spin` ternary below
|
|
66
|
+
* rendered as literal text rather than being evaluated. The attribute
|
|
67
|
+
* useReactiveProp watches is its first argument, so the local is free to be
|
|
68
|
+
* called something else — and has to be.
|
|
69
|
+
*/
|
|
49
70
|
const value = useReactiveProp('value', {{ value }})
|
|
71
|
+
const maxValue = useReactiveProp('max', {{ max }})
|
|
72
|
+
const isIndeterminate = useReactiveProp('indeterminate', {{ indeterminate }})
|
|
50
73
|
|
|
51
|
-
const percentage = derived(() => Math.min(Math.max((value() /
|
|
74
|
+
const percentage = derived(() => Math.min(Math.max((value() / maxValue()) * 100, 0), 100))
|
|
52
75
|
const percentLabel = derived(() => `${Math.round(percentage())}%`)
|
|
53
|
-
const linearWidth = derived(() =>
|
|
54
|
-
const dashOffset = derived(() =>
|
|
76
|
+
const linearWidth = derived(() => isIndeterminate() ? '30%' : `${percentage()}%`)
|
|
77
|
+
const dashOffset = derived(() => isIndeterminate() ? 0 : circumference - (percentage() / 100) * circumference)
|
|
78
|
+
// The spin is part of what `indeterminate` MEANS, so it follows the signal
|
|
79
|
+
// rather than the server's snapshot of it.
|
|
80
|
+
const circularBarClass = derived(() => `${circularBarColor} transition-all duration-300 ease-in-out ${isIndeterminate() ? 'animate-spin' : ''}`.trim())
|
|
55
81
|
|
|
56
82
|
defineExpose({ value, setValue: (v) => value.set(v) })
|
|
57
83
|
</script>
|
|
@@ -70,6 +96,7 @@ defineExpose({ value, setValue: (v) => value.set(v) })
|
|
|
70
96
|
:aria-valuenow="value()"
|
|
71
97
|
aria-valuemin="0"
|
|
72
98
|
aria-valuemax="{{ max }}"
|
|
99
|
+
:aria-valuemax="maxValue()"
|
|
73
100
|
>
|
|
74
101
|
<div
|
|
75
102
|
class="{{ linearBarClasses }}"
|
|
@@ -88,6 +115,7 @@ defineExpose({ value, setValue: (v) => value.set(v) })
|
|
|
88
115
|
:aria-valuenow="value()"
|
|
89
116
|
aria-valuemin="0"
|
|
90
117
|
aria-valuemax="{{ max }}"
|
|
118
|
+
:aria-valuemax="maxValue()"
|
|
91
119
|
>
|
|
92
120
|
<circle
|
|
93
121
|
class="{{ circularTrackColor }}"
|
|
@@ -99,6 +127,7 @@ defineExpose({ value, setValue: (v) => value.set(v) })
|
|
|
99
127
|
/>
|
|
100
128
|
<circle
|
|
101
129
|
class="{{ circularBarColor }} transition-all duration-300 ease-in-out {{ indeterminate ? 'animate-spin' : '' }}"
|
|
130
|
+
:class="circularBarClass()"
|
|
102
131
|
cx="{{ circularSize / 2 }}"
|
|
103
132
|
cy="{{ circularSize / 2 }}"
|
|
104
133
|
r="{{ radius }}"
|