@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
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
// content. Each AccordionItem renders its own header + content panel;
|
|
8
8
|
// this parent attaches click handlers and toggles content visibility.
|
|
9
9
|
export const items = $props.items || []
|
|
10
|
-
export const allowMultiple = $props.allowMultiple
|
|
10
|
+
export const allowMultiple = $bool($props.allowMultiple)
|
|
11
11
|
export const defaultOpen = $props.defaultOpen || []
|
|
12
12
|
export const className = $props.className || ''
|
|
13
13
|
|
|
14
|
-
export const accordionClasses = `divide-y divide-line border border-line rounded-
|
|
14
|
+
export const accordionClasses = `divide-y divide-line border border-line rounded-panel ${className}`.trim()
|
|
15
15
|
export const headerClasses = `w-full flex items-center justify-between px-4 py-3 text-left font-medium text-fg hover:bg-surface transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900`.trim()
|
|
16
16
|
export const iconClasses = `w-5 h-5 text-fg-soft transition-transform duration-200`.trim()
|
|
17
17
|
export const contentClasses = `px-4 py-3 text-fg-strong`.trim()
|
|
@@ -22,8 +22,26 @@ export const hasPropItems = Array.isArray(items) && items.length > 0
|
|
|
22
22
|
const emit = defineEmits()
|
|
23
23
|
const allowMultiple = {{ allowMultiple }}
|
|
24
24
|
const hasPropItems = {{ hasPropItems }}
|
|
25
|
-
|
|
25
|
+
// useRef takes the NAME the x-ref attribute uses. Called with no
|
|
26
|
+
// argument it read $refs[undefined], which nothing ever fills, so
|
|
27
|
+
// containerRef.value was null forever - the mount hook found no panels,
|
|
28
|
+
// the list stayed empty, and the component rendered nothing.
|
|
29
|
+
// stacksjs/stx#1979
|
|
30
|
+
const containerRef = useRef('containerRef')
|
|
26
31
|
const openItems = state({{ defaultOpen }})
|
|
32
|
+
/*
|
|
33
|
+
* Whether the mount hook has run.
|
|
34
|
+
*
|
|
35
|
+
* The effect below reaches into the DOM through containerRef, and an effect's
|
|
36
|
+
* first run happens while the setup function is still executing - before
|
|
37
|
+
* hydration has wired x-ref, so containerRef.value is null and the query can
|
|
38
|
+
* only come back empty. Nothing else it reads ever changed afterwards, so it
|
|
39
|
+
* never ran again and the DOM was never touched: every panel kept the hidden
|
|
40
|
+
* attribute it was served with, forever. Reading this makes the effect re-run
|
|
41
|
+
* once the DOM is actually reachable. stacksjs/stx#1979
|
|
42
|
+
*/
|
|
43
|
+
const mounted = state(false)
|
|
44
|
+
|
|
27
45
|
|
|
28
46
|
function findOwnItems() {
|
|
29
47
|
const root = containerRef.value
|
|
@@ -43,12 +61,14 @@ onMount(() => {
|
|
|
43
61
|
header.addEventListener('keydown', (e) => onHeaderKey(e, idx))
|
|
44
62
|
}
|
|
45
63
|
})
|
|
64
|
+
mounted.set(true)
|
|
46
65
|
})
|
|
47
66
|
|
|
48
67
|
// Sync the open state into the DOM: show/hide content panels, update
|
|
49
68
|
// aria-expanded on headers, rotate chevrons.
|
|
50
69
|
effect(() => {
|
|
51
70
|
if (hasPropItems) return
|
|
71
|
+
if (!mounted()) return
|
|
52
72
|
const items = findOwnItems()
|
|
53
73
|
const open = openItems()
|
|
54
74
|
items.forEach((item, idx) => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const src = $props.src || ''
|
|
3
|
-
export const autoplay = $props.autoplay
|
|
4
|
-
export const loop = $props.loop
|
|
5
|
-
export const muted = $props.muted
|
|
6
|
-
export const controls = $props.controls
|
|
3
|
+
export const autoplay = $bool($props.autoplay)
|
|
4
|
+
export const loop = $bool($props.loop)
|
|
5
|
+
export const muted = $bool($props.muted)
|
|
6
|
+
export const controls = $bool($props.controls, true)
|
|
7
7
|
export const preload = $props.preload || 'metadata'
|
|
8
8
|
export const className = $props.className || ''
|
|
9
|
-
export const showWaveform = $props.showWaveform
|
|
9
|
+
export const showWaveform = $bool($props.showWaveform)
|
|
10
10
|
export const title = $props.title || ''
|
|
11
11
|
|
|
12
12
|
export const containerClasses = `relative w-full ${className}`.trim()
|
|
13
|
-
export const audioClasses = 'w-full rounded-
|
|
13
|
+
export const audioClasses = 'w-full rounded-control bg-surface-raised'
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<div class="{{ containerClasses }}">
|
|
@@ -35,7 +35,7 @@ export const audioClasses = 'w-full rounded-md bg-surface-raised'
|
|
|
35
35
|
</audio>
|
|
36
36
|
|
|
37
37
|
@if(showWaveform)
|
|
38
|
-
<div class="mt-2 h-16 bg-surface-raised rounded-
|
|
38
|
+
<div class="mt-2 h-16 bg-surface-raised rounded-control flex items-center justify-center">
|
|
39
39
|
<svg class="w-full h-full px-4" viewBox="0 0 100 40" preserveAspectRatio="none">
|
|
40
40
|
<path
|
|
41
41
|
d="M 0,20 L 10,15 L 20,10 L 30,5 L 40,15 L 50,20 L 60,25 L 70,30 L 80,20 L 90,15 L 100,20"
|
|
@@ -29,16 +29,16 @@ const statusSizeClasses = {
|
|
|
29
29
|
|
|
30
30
|
const statusColorClasses = {
|
|
31
31
|
online: 'bg-green-500 dark:bg-green-400',
|
|
32
|
-
offline: 'bg-
|
|
32
|
+
offline: 'bg-neutral-400 dark:bg-neutral-600',
|
|
33
33
|
away: 'bg-yellow-500 dark:bg-yellow-400',
|
|
34
34
|
busy: 'bg-red-500 dark:bg-red-400',
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export const containerClasses = `relative inline-block ${className}`.trim()
|
|
38
|
-
export const avatarClasses = `flex items-center justify-center overflow-hidden bg-surface-sunken ${sizeClasses[size]} ${shapeClasses[shape]}`.trim()
|
|
38
|
+
export const avatarClasses = `flex items-center justify-center overflow-hidden bg-surface-sunken ${sizeClasses[size] || sizeClasses.md} ${shapeClasses[shape] || shapeClasses.circle}`.trim()
|
|
39
39
|
export const imageClasses = `w-full h-full object-cover`.trim()
|
|
40
40
|
export const initialsClasses = `font-medium text-fg-muted uppercase select-none`.trim()
|
|
41
|
-
export const statusClasses = status ? `absolute bottom-0 right-0 ${statusSizeClasses[size]} ${statusColorClasses[status]} ${shapeClasses[shape]} border-white dark:border-
|
|
41
|
+
export const statusClasses = status ? `absolute bottom-0 right-0 ${statusSizeClasses[size] || statusSizeClasses.md} ${statusColorClasses[status] || statusColorClasses.offline} ${shapeClasses[shape] || shapeClasses.circle} border-white dark:border-neutral-900`.trim() : ''
|
|
42
42
|
export const displayInitials = initials || (alt ? alt.split(' ').map(n => n[0]).join('').substring(0, 2) : '?')
|
|
43
43
|
</script>
|
|
44
44
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script server cache>
|
|
2
|
+
export const variant = $props.variant || 'default'
|
|
3
|
+
export const size = $props.size || 'md'
|
|
4
|
+
export const dot = $bool($props.dot)
|
|
5
|
+
export const removable = $bool($props.removable)
|
|
6
|
+
export const className = $props.className || ''
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Role tokens for the status variants, so an app re-themes a badge by setting
|
|
10
|
+
* --stx-accent-soft rather than by cancelling a class (stacksjs/stx#1993).
|
|
11
|
+
* The 100/800 light and 900/200 dark pairing these used IS the soft-fill
|
|
12
|
+
* token's definition, so primary, success, warning and danger are unchanged.
|
|
13
|
+
*
|
|
14
|
+
* `secondary` (purple) and `info` (cyan) stay literal. The role vocabulary has
|
|
15
|
+
* five status hues and neither of those is one of them: mapping info onto the
|
|
16
|
+
* `info` role would paint it blue, which is what `primary` already is, so a
|
|
17
|
+
* badge whose whole job is to distinguish would render two of its variants
|
|
18
|
+
* identically. A wrong colour is worse than an unthemeable one.
|
|
19
|
+
*/
|
|
20
|
+
const variantClasses = {
|
|
21
|
+
default: 'bg-surface-raised text-neutral-800 dark:text-neutral-300',
|
|
22
|
+
primary: 'bg-accent-soft text-accent-soft-ink',
|
|
23
|
+
secondary: 'bg-secondary-soft text-secondary-soft-ink',
|
|
24
|
+
success: 'bg-success-soft text-success-soft-ink',
|
|
25
|
+
warning: 'bg-warning-soft text-warning-soft-ink',
|
|
26
|
+
danger: 'bg-danger-soft text-danger-soft-ink',
|
|
27
|
+
info: 'bg-info-soft text-info-soft-ink',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const sizeClasses = { sm: 'px-2 py-0.5 text-xs', md: 'px-2.5 py-0.5 text-sm', lg: 'px-3 py-1 text-base' }
|
|
31
|
+
|
|
32
|
+
const dotColorClasses = {
|
|
33
|
+
default: 'bg-fg-soft',
|
|
34
|
+
primary: 'bg-accent',
|
|
35
|
+
secondary: 'bg-secondary',
|
|
36
|
+
success: 'bg-success',
|
|
37
|
+
warning: 'bg-warning',
|
|
38
|
+
danger: 'bg-danger',
|
|
39
|
+
info: 'bg-info',
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const badgeClasses = `inline-flex items-center gap-1.5 font-medium rounded-pill ${variantClasses[variant] || variantClasses.default} ${sizeClasses[size] || sizeClasses.md} ${className}`.trim()
|
|
43
|
+
export const dotClasses = `w-2 h-2 rounded-full ${dotColorClasses[variant] || dotColorClasses.default}`.trim()
|
|
44
|
+
export const removeButtonClasses = `ml-0.5 -mr-1 text-current hover:bg-black/10 dark:hover:bg-white/10 rounded-full p-0.5 transition-colors duration-150`.trim()
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<script client>
|
|
48
|
+
const emit = defineEmits()
|
|
49
|
+
|
|
50
|
+
function onRemove() {
|
|
51
|
+
emit('remove')
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<span class="{{ badgeClasses }}" role="status">
|
|
56
|
+
@if(dot)
|
|
57
|
+
<span class="{{ dotClasses }}" aria-hidden="true"></span>
|
|
58
|
+
@endif
|
|
59
|
+
|
|
60
|
+
<slot />
|
|
61
|
+
|
|
62
|
+
@if(removable)
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
@click="onRemove()"
|
|
66
|
+
class="{{ removeButtonClasses }}"
|
|
67
|
+
aria-label="Remove"
|
|
68
|
+
>
|
|
69
|
+
<svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
70
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
71
|
+
</svg>
|
|
72
|
+
</button>
|
|
73
|
+
@endif
|
|
74
|
+
</span>
|
|
@@ -4,12 +4,27 @@ export const separator = $props.separator || '/'
|
|
|
4
4
|
export const maxItems = $props.maxItems || 0
|
|
5
5
|
export const className = $props.className || ''
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/*
|
|
8
|
+
* Collapse to exactly maxItems crumbs: first + ellipsis + tail.
|
|
9
|
+
*
|
|
10
|
+
* The ellipsis was not counted against the budget - the tail was
|
|
11
|
+
* `items.slice(-(maxItems - 1))` taken AFTER the first item - so the result
|
|
12
|
+
* was maxItems + 1 crumbs at every setting. maxItems: 2 was the only value
|
|
13
|
+
* that kept its promise, and it did so by coincidence.
|
|
14
|
+
*
|
|
15
|
+
* maxItems: 1 was the sharp edge: `-(1 - 1)` is `-0`, and `slice(-0)` is
|
|
16
|
+
* `slice(0)`, so the tail was the WHOLE array. Asking for one crumb rendered
|
|
17
|
+
* a five-item trail as seven, with the first crumb appearing both before and
|
|
18
|
+
* after the ellipsis. stacksjs/stx#1999
|
|
19
|
+
*
|
|
20
|
+
* At maxItems: 1 there is no room for a tail, so it renders `first …` - the
|
|
21
|
+
* most honest thing a one-slot breadcrumb can show.
|
|
22
|
+
*/
|
|
8
23
|
let displayItems = items
|
|
9
24
|
if (maxItems > 0 && items.length > maxItems) {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
displayItems = [
|
|
25
|
+
const tailCount = Math.max(0, maxItems - 2)
|
|
26
|
+
const tail = tailCount > 0 ? items.slice(-tailCount) : []
|
|
27
|
+
displayItems = [items[0], { label: '...', href: '#', collapsed: true }, ...tail]
|
|
13
28
|
}
|
|
14
29
|
|
|
15
30
|
// Separator element
|
|
@@ -38,7 +53,7 @@ export const collapsedClasses = `text-fg-subtle cursor-default`.trim()
|
|
|
38
53
|
<span class="{{ activeItemClasses }}" aria-current="page">
|
|
39
54
|
@if(item.icon)
|
|
40
55
|
<span class="inline-flex items-center gap-1.5">
|
|
41
|
-
<span
|
|
56
|
+
<span>{!! item.icon !!}</span>
|
|
42
57
|
<span>{{ item.label }}</span>
|
|
43
58
|
</span>
|
|
44
59
|
@else
|
|
@@ -53,7 +68,7 @@ export const collapsedClasses = `text-fg-subtle cursor-default`.trim()
|
|
|
53
68
|
>
|
|
54
69
|
@if(item.icon)
|
|
55
70
|
<span class="inline-flex items-center gap-1.5">
|
|
56
|
-
<span
|
|
71
|
+
<span>{!! item.icon !!}</span>
|
|
57
72
|
<span>{{ item.label }}</span>
|
|
58
73
|
</span>
|
|
59
74
|
@else
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script server cache>
|
|
2
|
+
export const variant = $props.variant || 'primary'
|
|
3
|
+
export const size = $props.size || 'md'
|
|
4
|
+
export const disabled = $bool($props.disabled)
|
|
5
|
+
export const loading = $bool($props.loading)
|
|
6
|
+
export const type = $props.type || 'button'
|
|
7
|
+
export const fullWidth = $bool($props.fullWidth)
|
|
8
|
+
/*
|
|
9
|
+
* The label, as a prop, for a button whose text changes with its state.
|
|
10
|
+
*
|
|
11
|
+
* "Rotate" -> "Rotating..." is as common as disabling the button, and the slot
|
|
12
|
+
* cannot express it: slot content is the CALLER's markup, interpolated in the
|
|
13
|
+
* caller's scope at render time, so it is a snapshot like `disabled` used to
|
|
14
|
+
* be. `:text` on the component tag is not the answer either - the runtime's
|
|
15
|
+
* text binding writes textContent, which would erase the spinner and the icons
|
|
16
|
+
* this button keeps inside itself.
|
|
17
|
+
*
|
|
18
|
+
* So the reactive spelling is a prop: `<Button :label="rotateLabel()">`. Given
|
|
19
|
+
* one, the button renders it in a span that tracks the parent's binding; given
|
|
20
|
+
* none, the slot behaves exactly as before. See stacksjs/stx#1997.
|
|
21
|
+
*/
|
|
22
|
+
export const label = $props.label || ''
|
|
23
|
+
export const hasLabel = label !== ''
|
|
24
|
+
export const leftIcon = $props.leftIcon || ''
|
|
25
|
+
export const rightIcon = $props.rightIcon || ''
|
|
26
|
+
export const className = $props.className || ''
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* Role tokens, not palette shades, so an app can re-theme the button by
|
|
30
|
+
* meaning rather than by cancelling its classes (stacksjs/stx#1993).
|
|
31
|
+
*
|
|
32
|
+
* `className` was never an escape hatch for this: it is appended last in the
|
|
33
|
+
* class ATTRIBUTE, and attribute order does not decide CSS. `bg-blue-500` and
|
|
34
|
+
* `bg-accent` are both single-class selectors of equal specificity, so the
|
|
35
|
+
* winner is whichever lands later in the generated stylesheet - not something
|
|
36
|
+
* a call site can control.
|
|
37
|
+
*
|
|
38
|
+
* `bg-accent-solid` is `var(--stx-accent-solid, <blue-500>)`, so an app sets
|
|
39
|
+
* one variable and primary buttons follow, dark mode included and with no
|
|
40
|
+
* `dark:` anywhere. The solid/hover/ink triple exists because all three have
|
|
41
|
+
* to move together: a themed fill needs its own hover step, and white text on
|
|
42
|
+
* a light themed fill is unreadable.
|
|
43
|
+
*
|
|
44
|
+
* primary and danger are byte-for-byte the same colours as before. outline
|
|
45
|
+
* moves one shade in light mode (its border and text were blue-500, `accent`
|
|
46
|
+
* is blue-600) and its hover tint one step stronger, because a role for every
|
|
47
|
+
* shade would be a palette with extra steps.
|
|
48
|
+
*/
|
|
49
|
+
const variantClasses = {
|
|
50
|
+
primary: 'bg-accent-solid hover:bg-accent-solid-hover text-accent-ink shadow-md hover:shadow-lg',
|
|
51
|
+
secondary: 'bg-surface-sunken hover:bg-neutral-300 text-fg dark:hover:bg-neutral-600',
|
|
52
|
+
outline: 'border-2 border-accent text-accent hover:bg-accent-soft',
|
|
53
|
+
ghost: 'hover:bg-surface-raised text-fg-strong',
|
|
54
|
+
danger: 'bg-danger-solid hover:bg-danger-solid-hover text-danger-ink shadow-md hover:shadow-lg',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
* Padding decides the height, with no `h-*` to override it.
|
|
59
|
+
*
|
|
60
|
+
* Each size used to carry a fixed height beside its padding, which meant an app
|
|
61
|
+
* passing its own `py-1.5` got the padding it asked for and the height it did
|
|
62
|
+
* not - and `className` cannot win that fight, because `h-10` and `h-8` are
|
|
63
|
+
* single-class selectors of equal specificity (stacksjs/stx#1993).
|
|
64
|
+
*
|
|
65
|
+
* The fixed heights were also wrong on three of five sizes. Measured against
|
|
66
|
+
* the theme's own line-heights: xs declared 1.75rem around 1.5rem of content,
|
|
67
|
+
* while lg declared 3rem around 3.25rem and xl 3.5rem around 3.75rem - so the
|
|
68
|
+
* two largest sizes had been quietly eating a quarter-rem of their own padding.
|
|
69
|
+
*
|
|
70
|
+
* The padding below reproduces all five declared heights EXACTLY - 1.75, 2,
|
|
71
|
+
* 2.5, 3 and 3.5rem - so nothing changes on screen while the height becomes
|
|
72
|
+
* something a call site can actually set. xs, lg and xl needed a padding step
|
|
73
|
+
* adjusted to land on the same number they claimed before.
|
|
74
|
+
*/
|
|
75
|
+
const sizeClasses = {
|
|
76
|
+
xs: 'px-2.5 py-1.5 text-xs gap-1',
|
|
77
|
+
sm: 'px-3 py-1.5 text-sm gap-1.5',
|
|
78
|
+
md: 'px-4 py-2 text-base gap-2',
|
|
79
|
+
lg: 'px-6 py-2.5 text-lg gap-2.5',
|
|
80
|
+
xl: 'px-8 py-3.5 text-xl gap-3',
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const iconSizeClasses = { xs: 'h-3 w-3', sm: 'h-4 w-4', md: 'h-5 w-5', lg: 'h-6 w-6', xl: 'h-7 w-7' }
|
|
84
|
+
/*
|
|
85
|
+
* The focus ring follows the accent too. It was `ring-blue-500` with no dark
|
|
86
|
+
* twin, so it stayed blue in a dark theme and in a rose-accented app alike;
|
|
87
|
+
* the token's light value is that same blue-500 and its dark value is a step
|
|
88
|
+
* darker, which is a ring that was missing rather than one that changed.
|
|
89
|
+
*/
|
|
90
|
+
const baseClasses = 'inline-flex items-center justify-center font-semibold rounded-control transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-accent-solid disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none'
|
|
91
|
+
const widthClasses = fullWidth ? 'w-full' : ''
|
|
92
|
+
export const isDisabled = disabled || loading
|
|
93
|
+
|
|
94
|
+
export const buttonClasses = `${baseClasses} ${variantClasses[variant] || variantClasses.primary} ${sizeClasses[size] || sizeClasses.md} ${widthClasses} ${className}`.trim()
|
|
95
|
+
export const iconClasses = iconSizeClasses[size] || iconSizeClasses.md
|
|
96
|
+
export const spinnerClasses = `animate-spin ${iconClasses}`.trim()
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<script client>
|
|
100
|
+
const emit = defineEmits()
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* `disabled` and `loading` are read as live props, not as a server snapshot.
|
|
104
|
+
*
|
|
105
|
+
* This used to be `const disabledNow = {{ isDisabled }}` — a value computed
|
|
106
|
+
* before the page was sent and never looked at again. So the most common piece
|
|
107
|
+
* of button state in an application could not be expressed:
|
|
108
|
+
*
|
|
109
|
+
* <Button :disabled="saving()" @click="save">Save</Button>
|
|
110
|
+
*
|
|
111
|
+
* `saving()` is a signal. On the server it is not yet meaningful, so the button
|
|
112
|
+
* shipped enabled and STAYED enabled for the life of the page — through the
|
|
113
|
+
* exact async action it was there to guard. Double submits, destructive
|
|
114
|
+
* deletes and rotate-key confirmations all land on this.
|
|
115
|
+
*
|
|
116
|
+
* useReactiveProp wires the parent's binding into a local signal: the parent's
|
|
117
|
+
* bindAttr writes the attribute on our root, a MutationObserver picks it up,
|
|
118
|
+
* and the signal flips. Dialog already does this for `open` (#1704) and Switch
|
|
119
|
+
* for `checked`, so this is the package's existing answer rather than a new one.
|
|
120
|
+
*
|
|
121
|
+
* See stacksjs/stx#1997.
|
|
122
|
+
*/
|
|
123
|
+
const labelText = useReactiveProp('label', {{ label }}, { parse: value => value == null ? '' : String(value) })
|
|
124
|
+
const isLoading = useReactiveProp('loading', {{ loading }})
|
|
125
|
+
const disabledProp = useReactiveProp('disabled', {{ disabled }})
|
|
126
|
+
|
|
127
|
+
// Loading implies disabled, the same combination the server computes for the
|
|
128
|
+
// initial render, so the two agree before and after hydration.
|
|
129
|
+
const isDisabled = derived(() => disabledProp() || isLoading())
|
|
130
|
+
|
|
131
|
+
function onClick(event) {
|
|
132
|
+
// Read through the signal: a button disabled after render must stop guarding
|
|
133
|
+
// on the live value, not on what was true when the page was built.
|
|
134
|
+
if (isDisabled()) {
|
|
135
|
+
event.preventDefault()
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
emit('click', event)
|
|
139
|
+
}
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<button
|
|
143
|
+
type="{{ type }}"
|
|
144
|
+
class="{{ buttonClasses }}"
|
|
145
|
+
@if(isDisabled)disabled@endif
|
|
146
|
+
:disabled="isDisabled()"
|
|
147
|
+
aria-busy="{{ loading ? 'true' : 'false' }}"
|
|
148
|
+
:aria-busy="isLoading() ? 'true' : 'false'"
|
|
149
|
+
@click="onClick($event)"
|
|
150
|
+
>
|
|
151
|
+
{{-- The spinner is always in the DOM so `loading` can turn it on after render;
|
|
152
|
+
it was inside an @if, which meant the only way to see it was to have been
|
|
153
|
+
loading when the page was built. x-cloak only when the server says we are
|
|
154
|
+
NOT loading, so a button rendered loading shows its spinner on first
|
|
155
|
+
paint rather than waiting for hydration. --}}
|
|
156
|
+
<svg
|
|
157
|
+
:show="isLoading()"
|
|
158
|
+
@if(!loading)x-cloak@endif
|
|
159
|
+
class="{{ spinnerClasses }}"
|
|
160
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
161
|
+
fill="none"
|
|
162
|
+
viewBox="0 0 24 24"
|
|
163
|
+
>
|
|
164
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
165
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
166
|
+
</svg>
|
|
167
|
+
|
|
168
|
+
@if(leftIcon)
|
|
169
|
+
<span :show="!isLoading()" @if(loading)x-cloak@endif class="{{ iconClasses }}">{!! leftIcon !!}</span>
|
|
170
|
+
@endif
|
|
171
|
+
|
|
172
|
+
<slot />
|
|
173
|
+
|
|
174
|
+
{{-- The label span is decided on the CLIENT, because the server cannot see a
|
|
175
|
+
reactive prop at all: `:label="rotateLabel()"` is categorised as client
|
|
176
|
+
reactive, so `$props.label` is undefined during render and only the
|
|
177
|
+
root's data-stx-parent-bindings records that a binding exists.
|
|
178
|
+
|
|
179
|
+
`:if` rather than always rendering it, because the button is a flex
|
|
180
|
+
container with a gap: an empty span is still a flex item and would add a
|
|
181
|
+
trailing gap to every button that uses the slot. x-cloak while the
|
|
182
|
+
server has no label, so that gap is not visible for the frame before
|
|
183
|
+
hydration - the same pairing the spinner above uses. --}}
|
|
184
|
+
<span
|
|
185
|
+
:if="labelText()"
|
|
186
|
+
@if(!hasLabel)x-cloak@endif
|
|
187
|
+
:text="labelText()"
|
|
188
|
+
>{{ label }}</span>
|
|
189
|
+
|
|
190
|
+
@if(rightIcon)
|
|
191
|
+
<span :show="!isLoading()" @if(loading)x-cloak@endif class="{{ iconClasses }}">{!! rightIcon !!}</span>
|
|
192
|
+
@endif
|
|
193
|
+
</button>
|
|
@@ -9,11 +9,11 @@ export const showToday = $props.showToday !== false
|
|
|
9
9
|
export const className = $props.className || ''
|
|
10
10
|
export const highlightToday = $props.highlightToday !== false
|
|
11
11
|
|
|
12
|
-
const baseClasses = 'bg-
|
|
12
|
+
const baseClasses = 'bg-panel rounded-panel shadow-lg p-4 w-full max-w-sm'
|
|
13
13
|
export const calendarClasses = `${baseClasses} ${className}`.trim()
|
|
14
14
|
export const headerClasses = 'flex items-center justify-between mb-4'
|
|
15
15
|
export const monthYearClasses = 'text-lg font-semibold text-fg'
|
|
16
|
-
export const buttonClasses = 'p-2 hover:bg-surface-raised rounded-
|
|
16
|
+
export const buttonClasses = 'p-2 hover:bg-surface-raised rounded-control transition-colors'
|
|
17
17
|
export const weekdaysClasses = 'grid grid-cols-7 gap-1 mb-2'
|
|
18
18
|
export const weekdayClasses = 'text-center text-xs font-medium text-fg-muted py-2'
|
|
19
19
|
export const daysGridClasses = 'grid grid-cols-7 gap-1'
|
|
@@ -116,15 +116,15 @@ function goToToday() {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
function dayClasses(day) {
|
|
119
|
-
const base = 'flex items-center justify-center h-10 w-10 rounded-
|
|
119
|
+
const base = 'flex items-center justify-center h-10 w-10 rounded-control text-sm transition-colors'
|
|
120
120
|
const isSelected = isSameDay(day.date, selectedDate())
|
|
121
121
|
const isTodayDate = isToday(day.date)
|
|
122
122
|
const disabled = isDisabled(day.date)
|
|
123
123
|
let cls = base
|
|
124
124
|
cls += day.isCurrentMonth ? 'text-fg' : 'text-fg-subtle'
|
|
125
125
|
cls += disabled ? ' opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-surface-raised'
|
|
126
|
-
if (isSelected) cls += 'bg-
|
|
127
|
-
if (isTodayDate && highlightToday && !isSelected) cls += 'border-2 border-
|
|
126
|
+
if (isSelected) cls += 'bg-accent-solid text-white hover:bg-blue-700 dark:hover:bg-blue-600'
|
|
127
|
+
if (isTodayDate && highlightToday && !isSelected) cls += 'border-2 border-accent'
|
|
128
128
|
return cls
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -179,7 +179,7 @@ defineExpose({ selectedDate, currentMonth, selectDate })
|
|
|
179
179
|
<div class="mt-4 flex justify-center">
|
|
180
180
|
<button
|
|
181
181
|
type="button"
|
|
182
|
-
class="px-4 py-2 text-sm font-medium text-
|
|
182
|
+
class="px-4 py-2 text-sm font-medium text-accent hover:bg-blue-50 dark:hover:bg-neutral-700 rounded-control transition-colors"
|
|
183
183
|
@click="goToToday()"
|
|
184
184
|
>
|
|
185
185
|
Today
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script server cache>
|
|
2
2
|
export const variant = $props.variant || 'default'
|
|
3
3
|
export const padding = $props.padding || 'default'
|
|
4
|
-
export const hover = $props.hover
|
|
5
|
-
export const clickable = $props.clickable
|
|
4
|
+
export const hover = $bool($props.hover)
|
|
5
|
+
export const clickable = $bool($props.clickable)
|
|
6
6
|
export const image = $props.image || ''
|
|
7
7
|
export const imageAlt = $props.imageAlt || ''
|
|
8
8
|
export const className = $props.className || ''
|
|
9
9
|
|
|
10
10
|
const variantClasses = {
|
|
11
|
-
default: 'bg-
|
|
11
|
+
default: 'bg-panel border border-line',
|
|
12
12
|
outlined: 'bg-transparent border-2 border-line-strong',
|
|
13
|
-
elevated: 'bg-
|
|
13
|
+
elevated: 'bg-panel shadow-lg border-0',
|
|
14
14
|
flat: 'bg-surface border-0',
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -18,9 +18,9 @@ const paddingClasses = { none: 'p-0', sm: 'p-3', default: 'p-6', lg: 'p-8' }
|
|
|
18
18
|
const hoverClasses = hover ? 'transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5' : ''
|
|
19
19
|
const clickableClasses = clickable ? 'cursor-pointer' : ''
|
|
20
20
|
|
|
21
|
-
export const cardClasses = `rounded-
|
|
21
|
+
export const cardClasses = `rounded-panel overflow-hidden ${variantClasses[variant] || variantClasses.default} ${paddingClasses[image ? 'none' : padding] || paddingClasses.default} ${hoverClasses} ${clickableClasses} ${className}`.trim()
|
|
22
22
|
export const imageClasses = `w-full h-48 object-cover`.trim()
|
|
23
|
-
export const contentClasses = `${image ? paddingClasses[padding] : ''}`.trim()
|
|
23
|
+
export const contentClasses = `${image ? paddingClasses[padding] || paddingClasses.default : ''}`.trim()
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<script client>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
<script server>
|
|
2
|
-
export const checked = $props.checked
|
|
3
|
-
export const disabled = $props.disabled
|
|
4
|
-
export const indeterminate = $props.indeterminate
|
|
2
|
+
export const checked = $bool($props.checked)
|
|
3
|
+
export const disabled = $bool($props.disabled)
|
|
4
|
+
export const indeterminate = $bool($props.indeterminate)
|
|
5
5
|
export const size = $props.size || 'md'
|
|
6
6
|
export const label = $props.label || ''
|
|
7
7
|
export const description = $props.description || ''
|
|
8
|
-
export const error = $props.error
|
|
9
|
-
export const required = $props.required
|
|
8
|
+
export const error = $bool($props.error)
|
|
9
|
+
export const required = $bool($props.required)
|
|
10
10
|
export const value = $props.value || ''
|
|
11
11
|
export const name = $props.name || ''
|
|
12
12
|
export const className = $props.className || ''
|
|
13
13
|
|
|
14
14
|
const sizeClasses = { sm: 'h-4 w-4', md: 'h-5 w-5', lg: 'h-6 w-6' }
|
|
15
15
|
const baseClasses = 'rounded border-line-strong text-accent focus:ring-accent focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-900 transition-colors'
|
|
16
|
-
const stateClasses = error ? 'border-
|
|
16
|
+
const stateClasses = error ? 'border-danger-line text-danger focus:ring-danger-focus' : ''
|
|
17
17
|
const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'
|
|
18
18
|
|
|
19
|
-
export const checkboxClasses = `${baseClasses} ${sizeClasses[size]} ${stateClasses} ${disabledClasses}`.trim()
|
|
19
|
+
export const checkboxClasses = `${baseClasses} ${sizeClasses[size] || sizeClasses.md} ${stateClasses} ${disabledClasses}`.trim()
|
|
20
20
|
export const labelClasses = `text-sm font-medium ${error ? 'text-danger' : 'text-fg'} ${disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`.trim()
|
|
21
|
-
export const descriptionClasses = `text-sm ${error ? 'text-
|
|
21
|
+
export const descriptionClasses = `text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
|
|
22
22
|
export const inputId = `checkbox-${value || label}`
|
|
23
23
|
</script>
|
|
24
24
|
|
|
@@ -72,7 +72,7 @@ defineExpose({ isChecked })
|
|
|
72
72
|
<label for="{{ inputId }}" class="{{ labelClasses }}">
|
|
73
73
|
{{ label }}
|
|
74
74
|
@if(required)
|
|
75
|
-
<span class="text-
|
|
75
|
+
<span class="text-danger ml-1">*</span>
|
|
76
76
|
@endif
|
|
77
77
|
</label>
|
|
78
78
|
@endif
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
export const displayValue = $props.displayValue
|
|
3
3
|
export const className = $props.className || ''
|
|
4
4
|
export const placeholder = $props.placeholder || ''
|
|
5
|
-
export const disabled = $props.disabled
|
|
5
|
+
export const disabled = $bool($props.disabled)
|
|
6
6
|
|
|
7
|
-
const baseClasses = 'w-full rounded-
|
|
7
|
+
const baseClasses = 'w-full rounded-panel border-none bg-panel py-2 pl-3 pr-10 text-sm leading-5 text-fg focus:ring-0 focus:outline-none focus-visible:border-blue-500 focus-visible:ring-2 focus-visible:ring-white/75 focus-visible:ring-offset-2'
|
|
8
8
|
const disabledClasses = disabled ? 'opacity-50 cursor-not-allowed' : ''
|
|
9
9
|
export const inputClasses = `${baseClasses} ${disabledClasses} ${className}`.trim()
|
|
10
10
|
</script>
|
|
@@ -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-combobox-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,5 +1,5 @@
|
|
|
1
1
|
<script server>
|
|
2
|
-
export const open = $props.open
|
|
2
|
+
export const open = $bool($props.open)
|
|
3
3
|
export const initialQuery = $props.query || ''
|
|
4
4
|
export const className = $props.className || ''
|
|
5
5
|
|
|
@@ -58,16 +58,16 @@ defineExpose({ isOpen, query, show, close })
|
|
|
58
58
|
data-palette-id="{{ paletteInstanceId }}"
|
|
59
59
|
@stx:command-select="onItemSelect($event)"
|
|
60
60
|
>
|
|
61
|
-
<div class="fixed inset-0 bg-neutral-500
|
|
61
|
+
<div class="fixed inset-0 bg-neutral-500/25 dark:bg-neutral-500/50 transition-opacity" @click="close()"></div>
|
|
62
62
|
|
|
63
|
-
<div class="mx-auto max-w-xl transform divide-y divide-
|
|
63
|
+
<div class="mx-auto max-w-xl transform divide-y divide-line overflow-hidden rounded-xl bg-white dark:bg-neutral-900 shadow-2xl ring-1 ring-black/5 transition-all relative">
|
|
64
64
|
<div class="relative">
|
|
65
65
|
<svg class="pointer-events-none absolute top-3.5 left-4 h-5 w-5 text-neutral-400" viewBox="0 0 20 20" fill="currentColor">
|
|
66
66
|
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
|
|
67
67
|
</svg>
|
|
68
68
|
<input
|
|
69
69
|
type="text"
|
|
70
|
-
class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-
|
|
70
|
+
class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-fg placeholder-neutral-400 focus:ring-0 sm:text-sm"
|
|
71
71
|
placeholder="Search..."
|
|
72
72
|
:value="query()"
|
|
73
73
|
@input="onQueryInput($event)"
|