@stacksjs/components 0.2.343 → 0.2.345
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-kescmd4y.stx} +24 -4
- package/dist/{AccordionItem-7bd3ga36.stx → AccordionItem-1q9k2qyc.stx} +1 -1
- 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-tcjt3m8s.stx +193 -0
- package/dist/{Calendar-gjjhhfnt.stx → Calendar-ppqdw19s.stx} +7 -7
- package/dist/{Card-7byck6ep.stx → Card-r55zpjqh.stx} +6 -6
- package/dist/{Checkbox-2s2a7n4h.stx → Checkbox-e7gn3w06.stx} +10 -10
- 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-00ja5jhz.stx} +27 -3
- 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-nmmkt5yd.stx} +14 -14
- package/dist/{NavBar-wcb6f2d3.stx → NavBar-qqrrhdnk.stx} +24 -0
- package/dist/{Navigator-smpa7my4.stx → Navigator-7rspzjys.stx} +4 -4
- 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-bvk2ss15.stx} +4 -4
- package/dist/{PasswordInput-4qykq1dz.stx → PasswordInput-3snyppj4.stx} +24 -14
- package/dist/{PaymentMethods-2xy66bwk.stx → PaymentMethods-tttjpa1m.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-nr8rbb6g.stx} +9 -9
- 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-wa31mdyc.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-5c1cy7az.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/{TableRow-xd542nvb.stx → TableRow-ytr6b5by.stx} +1 -1
- package/dist/{Tabs-b4xsba1w.stx → Tabs-esrn6j8p.stx} +29 -9
- 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-g2j17eg9.stx} +13 -10
- 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-jhdnq8xe.stx} +5 -5
- 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 +24 -4
- package/src/ui/accordion/AccordionItem.stx +1 -1
- 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 +149 -30
- package/src/ui/calendar/Calendar.stx +7 -7
- package/src/ui/card/Card.stx +6 -6
- package/src/ui/checkbox/Checkbox.stx +10 -10
- 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 +27 -3
- 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 +4 -4
- 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 +9 -9
- 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/table/TableRow.stx +1 -1
- package/src/ui/tabs/Tabs.stx +29 -9
- package/src/ui/teleport/Teleport.stx +2 -2
- package/src/ui/textarea/Textarea.stx +11 -11
- package/src/ui/tooltip/Tooltip.stx +13 -10
- package/src/ui/transition/Transition.stx +1 -1
- package/src/ui/video/Video.stx +6 -6
- package/src/ui/virtual-table/VirtualTable.stx +5 -5
- 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
package/src/ui/switch/Switch.stx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
|
-
export const checked = $props.checked
|
|
3
|
-
export const disabled = $props.disabled
|
|
2
|
+
export const checked = $bool($props.checked)
|
|
3
|
+
export const disabled = $bool($props.disabled)
|
|
4
4
|
export const size = $props.size || 'md'
|
|
5
5
|
export const className = $props.className || ''
|
|
6
6
|
export const label = $props.label || ''
|
|
@@ -11,7 +11,10 @@ const sizeConfig = {
|
|
|
11
11
|
lg: { track: 'h-12 w-24', thumb: 'h-11 w-11', translate: 'translate-x-12' },
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// Falls back rather than indexing to undefined: `size="huge"` is a typo, and
|
|
15
|
+
// without this it became `const config = {{ config }}` in the client script --
|
|
16
|
+
// a SyntaxError that killed the whole component rather than mis-sizing it.
|
|
17
|
+
export const config = sizeConfig[size] || sizeConfig.md
|
|
15
18
|
|
|
16
19
|
export const trackBaseClasses = 'relative inline-flex shrink-0 cursor-pointer border-2 border-transparent rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-offset-2 focus-visible:ring-offset-neutral-300 dark:focus-visible:ring-offset-neutral-700'
|
|
17
20
|
export const trackDisabledClasses = disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : ''
|
|
@@ -37,7 +40,7 @@ function toggle() {
|
|
|
37
40
|
|
|
38
41
|
function trackClasses() {
|
|
39
42
|
const stateClass = isChecked()
|
|
40
|
-
? 'bg-
|
|
43
|
+
? 'bg-accent-solid'
|
|
41
44
|
: 'bg-neutral-400 dark:bg-neutral-600'
|
|
42
45
|
return `${trackBase} ${stateClass} ${trackDisabled} ${config.track} ${extraClass}`.trim()
|
|
43
46
|
}
|
package/src/ui/table/Table.stx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const className = $props.className || ''
|
|
3
|
-
export const striped = $props.striped
|
|
3
|
+
export const striped = $bool($props.striped)
|
|
4
4
|
export const hoverable = $props.hoverable !== false
|
|
5
5
|
|
|
6
6
|
const baseClasses = 'min-w-full divide-y divide-line'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const className = $props.className || ''
|
|
3
|
-
export const sortable = $props.sortable
|
|
3
|
+
export const sortable = $bool($props.sortable)
|
|
4
4
|
|
|
5
5
|
const baseClasses = 'px-6 py-3 text-left text-xs font-medium text-fg-soft uppercase tracking-wider'
|
|
6
6
|
const sortableClasses = sortable ? 'cursor-pointer hover:text-fg-strong' : ''
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const className = $props.className || ''
|
|
3
3
|
export const hoverable = $props.hoverable !== false
|
|
4
4
|
|
|
5
|
-
const hoverClasses = hoverable ? 'hover:bg-surface' : ''
|
|
5
|
+
const hoverClasses = hoverable ? 'hover:bg-surface-hover' : ''
|
|
6
6
|
const rowClasses = `${hoverClasses} ${className}`.trim()
|
|
7
7
|
</script>
|
|
8
8
|
|
package/src/ui/tabs/Tabs.stx
CHANGED
|
@@ -25,12 +25,12 @@ const tabListOrientationClasses = {
|
|
|
25
25
|
|
|
26
26
|
const variantClasses = {
|
|
27
27
|
line: 'border-line',
|
|
28
|
-
pills: 'gap-2 border-0 bg-surface-raised p-1 rounded-
|
|
28
|
+
pills: 'gap-2 border-0 bg-surface-raised p-1 rounded-panel',
|
|
29
29
|
enclosed: 'border-line',
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export const containerClasses = `flex ${orientationClasses[orientation]} ${className}`.trim()
|
|
33
|
-
export const tabListClasses = `flex ${tabListOrientationClasses[orientation]} ${variantClasses[variant]}`.trim()
|
|
32
|
+
export const containerClasses = `flex ${orientationClasses[orientation] || orientationClasses.horizontal} ${className}`.trim()
|
|
33
|
+
export const tabListClasses = `flex ${tabListOrientationClasses[orientation] || tabListOrientationClasses.horizontal} ${variantClasses[variant] || variantClasses.line}`.trim()
|
|
34
34
|
export const tabPanelClasses = `p-4 focus:outline-none`.trim()
|
|
35
35
|
// True when the parent passes a non-empty `tabs` array — switches to the
|
|
36
36
|
// legacy render path so existing snapshots stay byte-identical.
|
|
@@ -43,12 +43,30 @@ const tabs = {{ tabs }}
|
|
|
43
43
|
const variant = {{ variant }}
|
|
44
44
|
const orientation = {{ orientation }}
|
|
45
45
|
const hasPropTabs = {{ hasPropTabs }}
|
|
46
|
-
|
|
46
|
+
// useRef takes the NAME the x-ref attribute uses. Called with no
|
|
47
|
+
// argument it read $refs[undefined], which nothing ever fills, so
|
|
48
|
+
// containerRef.value was null forever - the mount hook found no panels,
|
|
49
|
+
// the list stayed empty, and the component rendered nothing.
|
|
50
|
+
// stacksjs/stx#1979
|
|
51
|
+
const containerRef = useRef('containerRef')
|
|
47
52
|
// In slot mode, `discoveredTabs` is populated from child <TabPanel> data
|
|
48
53
|
// attributes on mount. In prop mode, it mirrors the `tabs` prop so the
|
|
49
54
|
// rendering loop works the same in both modes.
|
|
50
55
|
const discoveredTabs = state(hasPropTabs ? tabs : [])
|
|
51
56
|
const activeTab = state({{ defaultTab }})
|
|
57
|
+
/*
|
|
58
|
+
* Whether the mount hook has run.
|
|
59
|
+
*
|
|
60
|
+
* The effect below reaches into the DOM through containerRef, and an effect's
|
|
61
|
+
* first run happens while the setup function is still executing - before
|
|
62
|
+
* hydration has wired x-ref, so containerRef.value is null and the query can
|
|
63
|
+
* only come back empty. Nothing else it reads ever changed afterwards, so it
|
|
64
|
+
* never ran again and the DOM was never touched: every panel kept the hidden
|
|
65
|
+
* attribute it was served with, forever. Reading this makes the effect re-run
|
|
66
|
+
* once the DOM is actually reachable. stacksjs/stx#1979
|
|
67
|
+
*/
|
|
68
|
+
const mounted = state(false)
|
|
69
|
+
|
|
52
70
|
|
|
53
71
|
// Walk only direct descendants of THIS container (not nested Tabs').
|
|
54
72
|
function findOwnPanels() {
|
|
@@ -68,12 +86,14 @@ onMount(() => {
|
|
|
68
86
|
icon: p.dataset.icon || '',
|
|
69
87
|
}))
|
|
70
88
|
discoveredTabs.set(list)
|
|
89
|
+
mounted.set(true)
|
|
71
90
|
})
|
|
72
91
|
|
|
73
92
|
// In slot mode, toggle each panel's `hidden` attribute as activeTab changes.
|
|
74
93
|
// Prop mode is handled inline by the @foreach loop's :show binding below.
|
|
75
94
|
effect(() => {
|
|
76
95
|
if (hasPropTabs) return
|
|
96
|
+
if (!mounted()) return
|
|
77
97
|
const panels = findOwnPanels()
|
|
78
98
|
const idx = activeTab()
|
|
79
99
|
panels.forEach((p, i) => {
|
|
@@ -94,17 +114,17 @@ function isActive(index) {
|
|
|
94
114
|
|
|
95
115
|
function getTabClasses(index) {
|
|
96
116
|
const isActiveTab = isActive(index)
|
|
97
|
-
const base = 'px-4 py-2 font-medium text-sm transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
|
117
|
+
const base = 'px-4 py-2 font-medium text-sm transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-panel'
|
|
98
118
|
if (variant === 'line') {
|
|
99
119
|
const border = orientation === 'horizontal' ? 'border-b-2' : 'border-r-2'
|
|
100
|
-
return `${base} ${border} ${isActiveTab ? 'border-blue-500 text-
|
|
120
|
+
return `${base} ${border} ${isActiveTab ? 'border-blue-500 text-accent' : 'border-transparent text-fg-muted hover:text-fg hover:border-line-strong'}`
|
|
101
121
|
}
|
|
102
122
|
if (variant === 'pills') {
|
|
103
|
-
return `${base} rounded-
|
|
123
|
+
return `${base} rounded-control ${isActiveTab ? 'bg-field text-fg shadow-sm' : 'text-fg-muted hover:text-fg'}`
|
|
104
124
|
}
|
|
105
125
|
if (variant === 'enclosed') {
|
|
106
|
-
const borders = orientation === 'horizontal' ? 'border-t border-l border-r rounded-t-
|
|
107
|
-
return `${base} ${borders} ${isActiveTab ? 'bg-
|
|
126
|
+
const borders = orientation === 'horizontal' ? 'border-t border-l border-r rounded-t-control' : 'border-t border-l border-b rounded-l-control'
|
|
127
|
+
return `${base} ${borders} ${isActiveTab ? 'bg-panel border-line -mb-px' : 'bg-surface border-transparent hover:border-line'}`
|
|
108
128
|
}
|
|
109
129
|
return base
|
|
110
130
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const to = $props.to || 'body'
|
|
3
|
-
export const disabled = $props.disabled
|
|
4
|
-
export const defer = $props.defer
|
|
3
|
+
export const disabled = $bool($props.disabled)
|
|
4
|
+
export const defer = $bool($props.defer)
|
|
5
5
|
|
|
6
6
|
export const teleportId = $uid
|
|
7
7
|
</script>
|
|
@@ -1,32 +1,32 @@
|
|
|
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 rows = $props.rows || 4
|
|
7
|
-
export const autoResize = $props.autoResize
|
|
7
|
+
export const autoResize = $bool($props.autoResize)
|
|
8
8
|
export const maxRows = $props.maxRows || 10
|
|
9
|
-
export const error = $props.error
|
|
9
|
+
export const error = $bool($props.error)
|
|
10
10
|
export const label = $props.label || ''
|
|
11
11
|
export const helperText = $props.helperText || ''
|
|
12
|
-
export const required = $props.required
|
|
12
|
+
export const required = $bool($props.required)
|
|
13
13
|
export const maxLength = $props.maxLength
|
|
14
|
-
export const showCount = $props.showCount
|
|
14
|
+
export const showCount = $bool($props.showCount)
|
|
15
15
|
export const resize = $props.resize || 'vertical'
|
|
16
16
|
export const className = $props.className || ''
|
|
17
17
|
|
|
18
18
|
const resizeClasses = { none: 'resize-none', vertical: 'resize-y', horizontal: 'resize-x', both: 'resize' }
|
|
19
|
-
const baseClasses = 'block w-full border-0 rounded-
|
|
19
|
+
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 px-4 py-2 text-base dark:bg-neutral-700 dark:text-neutral-100'
|
|
20
20
|
const stateClasses = error
|
|
21
|
-
? 'ring-
|
|
21
|
+
? 'ring-danger-line text-danger-fg placeholder-danger-fg-subtle focus:ring-danger-focus'
|
|
22
22
|
: 'ring-line-strong text-fg placeholder-fg-subtle focus:ring-accent'
|
|
23
23
|
const disabledClasses = disabled
|
|
24
24
|
? 'opacity-50 cursor-not-allowed bg-surface'
|
|
25
25
|
: readonly
|
|
26
26
|
? 'bg-surface cursor-default'
|
|
27
|
-
: 'bg-
|
|
27
|
+
: 'bg-field'
|
|
28
28
|
|
|
29
|
-
export const textareaClasses = `${baseClasses} ${stateClasses} ${disabledClasses} ${resizeClasses[resize]} ${className}`.trim()
|
|
29
|
+
export const textareaClasses = `${baseClasses} ${stateClasses} ${disabledClasses} ${resizeClasses[resize] || resizeClasses.vertical} ${className}`.trim()
|
|
30
30
|
export const labelClasses = `block text-sm font-medium leading-6 mb-2 ${error ? 'text-danger' : 'text-fg'}`.trim()
|
|
31
31
|
export const helperClasses = `mt-2 text-sm ${error ? 'text-danger' : 'text-fg-soft'}`.trim()
|
|
32
32
|
</script>
|
|
@@ -71,7 +71,7 @@ defineExpose({ value: inputValue })
|
|
|
71
71
|
<label for="textarea-input" class="{{ labelClasses }}">
|
|
72
72
|
{{ label }}
|
|
73
73
|
@if(required)
|
|
74
|
-
<span class="text-
|
|
74
|
+
<span class="text-danger ml-1">*</span>
|
|
75
75
|
@endif
|
|
76
76
|
</label>
|
|
77
77
|
@endif
|
|
@@ -3,8 +3,8 @@ export const content = $props.content || ''
|
|
|
3
3
|
export const position = $props.position || 'top'
|
|
4
4
|
export const delay = $props.delay || 0
|
|
5
5
|
export const className = $props.className || ''
|
|
6
|
-
export const show = $props.show
|
|
7
|
-
export const disabled = $props.disabled
|
|
6
|
+
export const show = $bool($props.show)
|
|
7
|
+
export const disabled = $bool($props.disabled)
|
|
8
8
|
|
|
9
9
|
const positionClasses = {
|
|
10
10
|
top: 'bottom-full left-1/2 -translate-x-1/2 mb-2',
|
|
@@ -14,25 +14,28 @@ const positionClasses = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const arrowClasses = {
|
|
17
|
-
top: 'top-full left-1/2 -translate-x-1/2 border-t-
|
|
18
|
-
bottom: 'bottom-full left-1/2 -translate-x-1/2 border-b-
|
|
19
|
-
left: 'left-full top-1/2 -translate-y-1/2 border-l-
|
|
20
|
-
right: 'right-full top-1/2 -translate-y-1/2 border-r-
|
|
17
|
+
top: 'top-full left-1/2 -translate-x-1/2 border-t-inverse',
|
|
18
|
+
bottom: 'bottom-full left-1/2 -translate-x-1/2 border-b-inverse',
|
|
19
|
+
left: 'left-full top-1/2 -translate-y-1/2 border-l-inverse',
|
|
20
|
+
right: 'right-full top-1/2 -translate-y-1/2 border-r-inverse',
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export const tooltipClasses = `absolute z-50 px-3 py-2 text-sm font-medium text-
|
|
24
|
-
export const arrowClass = `absolute w-0 h-0 border-4 border-transparent ${arrowClasses[position]}`.trim()
|
|
23
|
+
export const tooltipClasses = `absolute z-50 px-3 py-2 text-sm font-medium text-inverse-ink bg-inverse rounded-panel shadow-lg whitespace-nowrap pointer-events-none transition-opacity duration-200 ${positionClasses[position] || positionClasses.top} ${className}`.trim()
|
|
24
|
+
export const arrowClass = `absolute w-0 h-0 border-4 border-transparent ${arrowClasses[position] || arrowClasses.top}`.trim()
|
|
25
25
|
</script>
|
|
26
26
|
|
|
27
27
|
<script client>
|
|
28
28
|
const delay = {{ delay }}
|
|
29
|
-
|
|
29
|
+
// A live prop: a tooltip is commonly suppressed by state the page only learns
|
|
30
|
+
// about later — while a field is being edited, or once a hint has been read —
|
|
31
|
+
// and frozen it could only ever reflect the state the page was built in.
|
|
32
|
+
const isDisabled = useReactiveProp('disabled', {{ disabled }})
|
|
30
33
|
// Reactive prop binding — parent can drive `show` via signals. See #1704.
|
|
31
34
|
const isVisible = useReactiveProp('show', {{ show }})
|
|
32
35
|
let timeoutId = null
|
|
33
36
|
|
|
34
37
|
function showTooltip() {
|
|
35
|
-
if (isDisabled) return
|
|
38
|
+
if (isDisabled()) return
|
|
36
39
|
if (delay > 0) {
|
|
37
40
|
timeoutId = setTimeout(() => isVisible.set(true), delay)
|
|
38
41
|
}
|
|
@@ -6,7 +6,7 @@ export const enterTo = $props.enterTo || 'opacity-100'
|
|
|
6
6
|
export const leave = $props.leave || 'transition-opacity duration-200'
|
|
7
7
|
export const leaveFrom = $props.leaveFrom || 'opacity-100'
|
|
8
8
|
export const leaveTo = $props.leaveTo || 'opacity-0'
|
|
9
|
-
export const appear = $props.appear
|
|
9
|
+
export const appear = $bool($props.appear)
|
|
10
10
|
export const duration = $props.duration || 300
|
|
11
11
|
export const delay = $props.delay || 0
|
|
12
12
|
export const preset = $props.preset || ''
|
package/src/ui/video/Video.stx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script server>
|
|
2
2
|
export const src = $props.src || ''
|
|
3
3
|
export const poster = $props.poster || ''
|
|
4
|
-
export const autoplay = $props.autoplay
|
|
5
|
-
export const loop = $props.loop
|
|
6
|
-
export const muted = $props.muted
|
|
7
|
-
export const controls = $props.controls
|
|
4
|
+
export const autoplay = $bool($props.autoplay)
|
|
5
|
+
export const loop = $bool($props.loop)
|
|
6
|
+
export const muted = $bool($props.muted)
|
|
7
|
+
export const controls = $bool($props.controls, true)
|
|
8
8
|
export const preload = $props.preload || 'metadata'
|
|
9
9
|
export const width = $props.width
|
|
10
10
|
export const height = $props.height
|
|
@@ -12,8 +12,8 @@ export const aspectRatio = $props.aspectRatio || '16/9'
|
|
|
12
12
|
export const className = $props.className || ''
|
|
13
13
|
export const title = $props.title || ''
|
|
14
14
|
|
|
15
|
-
export const containerClasses = `relative w-full overflow-hidden rounded-
|
|
16
|
-
export const videoClasses = 'w-full h-full object-cover bg-
|
|
15
|
+
export const containerClasses = `relative w-full overflow-hidden rounded-panel ${className}`.trim()
|
|
16
|
+
export const videoClasses = 'w-full h-full object-cover bg-neutral-900 dark:bg-neutral-950'
|
|
17
17
|
export const aspectRatioClass = aspectRatio === '16/9' ? 'aspect-video' : aspectRatio === '4/3' ? 'aspect-[4/3]' : aspectRatio === '1/1' ? 'aspect-square' : ''
|
|
18
18
|
</script>
|
|
19
19
|
|
|
@@ -5,16 +5,16 @@ export const rowHeight = $props.rowHeight || 48
|
|
|
5
5
|
export const height = $props.height || 600
|
|
6
6
|
export const headerHeight = $props.headerHeight || 56
|
|
7
7
|
export const overscan = $props.overscan || 5
|
|
8
|
-
export const striped = $props.striped
|
|
9
|
-
export const hoverable = $props.hoverable
|
|
8
|
+
export const striped = $bool($props.striped)
|
|
9
|
+
export const hoverable = $bool($props.hoverable, true)
|
|
10
10
|
export const className = $props.className || ''
|
|
11
11
|
|
|
12
12
|
export const totalHeight = data.length * rowHeight
|
|
13
|
-
export const containerClasses = `border border-line rounded-
|
|
13
|
+
export const containerClasses = `border border-line rounded-panel overflow-hidden ${className}`.trim()
|
|
14
14
|
export const headerClasses = `bg-surface border-b border-line flex`.trim()
|
|
15
15
|
export const headerCellClasses = `px-6 py-3 text-left text-xs font-medium text-fg-soft uppercase tracking-wider`.trim()
|
|
16
|
-
export const bodyClasses = `overflow-auto bg-white dark:bg-
|
|
17
|
-
export const rowClasses = `absolute left-0 right-0 flex border-b border-line ${hoverable ? 'hover:bg-surface' : ''}`.trim()
|
|
16
|
+
export const bodyClasses = `overflow-auto bg-white dark:bg-neutral-900`.trim()
|
|
17
|
+
export const rowClasses = `absolute left-0 right-0 flex border-b border-line ${hoverable ? 'hover:bg-surface-hover' : ''}`.trim()
|
|
18
18
|
export const cellClasses = `px-6 py-4 text-sm text-fg`.trim()
|
|
19
19
|
</script>
|
|
20
20
|
|
package/src/utils/highlighter.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import type { Highlighter as TSHighlighter } from 'ts-syntax-highlighter'
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// Imported at call time, not at module load. A static import here made the
|
|
4
|
+
// highlighter's own resolution a load-time dependency of this module, so
|
|
5
|
+
// anything importing it -- CodeBlock's <script server> -- died with it, and a
|
|
6
|
+
// server block that throws renders the component as nothing at all. 0.2.17
|
|
7
|
+
// ships a bundle that imports `bunfig` while declaring no dependencies, which
|
|
8
|
+
// is exactly the resolution failure that has to stay survivable.
|
|
9
|
+
async function loadCreateHighlighter(): Promise<typeof import('ts-syntax-highlighter')['createHighlighter'] | null> {
|
|
10
|
+
try {
|
|
11
|
+
const mod = await import('ts-syntax-highlighter')
|
|
12
|
+
return mod.createHighlighter
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null
|
|
16
|
+
}
|
|
17
|
+
}
|
|
3
18
|
|
|
4
19
|
let highlighterInstance: TSHighlighter | null = null
|
|
5
20
|
|
|
@@ -12,15 +27,33 @@ export interface HighlighterOptions {
|
|
|
12
27
|
|
|
13
28
|
export interface HighlightResult {
|
|
14
29
|
html: string
|
|
30
|
+
/**
|
|
31
|
+
* The token styles for `html`. Nothing else in this package ships styles for
|
|
32
|
+
* the highlighter's class names, so a block rendered without this CSS is
|
|
33
|
+
* correctly marked up and visually plain.
|
|
34
|
+
*/
|
|
35
|
+
css: string
|
|
15
36
|
language: string
|
|
16
37
|
theme: string
|
|
17
38
|
}
|
|
18
39
|
|
|
40
|
+
/** The code itself, escaped, for when highlighting is unavailable. */
|
|
41
|
+
function plainCodeHtml(code: string): string {
|
|
42
|
+
const escaped = code
|
|
43
|
+
.replace(/&/g, '&')
|
|
44
|
+
.replace(/</g, '<')
|
|
45
|
+
.replace(/>/g, '>')
|
|
46
|
+
return `<pre class="syntax"><code>${escaped}</code></pre>`
|
|
47
|
+
}
|
|
48
|
+
|
|
19
49
|
/**
|
|
20
50
|
* Initialize or get the syntax highlighter instance
|
|
21
51
|
*/
|
|
22
52
|
export async function getHighlighter(): Promise<TSHighlighter> {
|
|
23
53
|
if (!highlighterInstance) {
|
|
54
|
+
const createHighlighter = await loadCreateHighlighter()
|
|
55
|
+
if (!createHighlighter)
|
|
56
|
+
throw new Error('ts-syntax-highlighter could not be loaded')
|
|
24
57
|
highlighterInstance = await createHighlighter({
|
|
25
58
|
theme: 'github-light',
|
|
26
59
|
})
|
|
@@ -42,17 +75,45 @@ export async function highlight(
|
|
|
42
75
|
wrapLines: _wrapLines = true,
|
|
43
76
|
} = options
|
|
44
77
|
|
|
45
|
-
|
|
78
|
+
// A highlighter that cannot load must not take the code with it. Highlighting
|
|
79
|
+
// is decoration; the code is the content. ts-syntax-highlighter@0.2.17 ships a
|
|
80
|
+
// bundle that imports `bunfig` while declaring no dependencies, so it throws
|
|
81
|
+
// outright wherever that package is not reachable -- and a <script server>
|
|
82
|
+
// that throws renders the whole component as nothing, with no error logged.
|
|
83
|
+
// Escaped plain text is the floor.
|
|
84
|
+
let highlighter: TSHighlighter
|
|
85
|
+
try {
|
|
86
|
+
highlighter = await getHighlighter()
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return { html: plainCodeHtml(code), css: '', language, theme: 'github-light' }
|
|
90
|
+
}
|
|
46
91
|
|
|
47
92
|
// Auto-detect theme based on system preference
|
|
48
93
|
const effectiveTheme = theme === 'auto'
|
|
49
94
|
? (globalThis.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'github-dark' : 'github-light')
|
|
50
95
|
: theme === 'dark' ? 'github-dark' : 'github-light'
|
|
51
96
|
|
|
52
|
-
|
|
97
|
+
// ts-syntax-highlighter returns { html, css, tokens, ansi }. This read the
|
|
98
|
+
// whole result as if it were the HTML string, and the `String(...)` meant to
|
|
99
|
+
// be defensive turned the object into the literal text [object Object] --
|
|
100
|
+
// which is what every CodeBlock rendered, instead of the code. A fallback
|
|
101
|
+
// that stringifies anything cannot tell a wrong shape from a right one.
|
|
102
|
+
let result: unknown
|
|
103
|
+
try {
|
|
104
|
+
result = await highlighter.highlight(code, language)
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return { html: plainCodeHtml(code), css: '', language, theme: effectiveTheme }
|
|
108
|
+
}
|
|
109
|
+
const shaped = result as { html?: string, css?: string } | string | null
|
|
110
|
+
const highlighted = typeof shaped === 'string'
|
|
111
|
+
? { html: shaped, css: '' }
|
|
112
|
+
: { html: shaped?.html ?? plainCodeHtml(code), css: shaped?.css ?? '' }
|
|
53
113
|
|
|
54
114
|
return {
|
|
55
|
-
html:
|
|
115
|
+
html: highlighted.html,
|
|
116
|
+
css: highlighted.css,
|
|
56
117
|
language,
|
|
57
118
|
theme: effectiveTheme,
|
|
58
119
|
}
|
package/dist/Badge-xwjeq24d.stx
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<script server cache>
|
|
2
|
-
export const variant = $props.variant || 'default'
|
|
3
|
-
export const size = $props.size || 'md'
|
|
4
|
-
export const dot = $props.dot || false
|
|
5
|
-
export const removable = $props.removable || false
|
|
6
|
-
export const className = $props.className || ''
|
|
7
|
-
|
|
8
|
-
const variantClasses = {
|
|
9
|
-
default: 'bg-surface-raised text-gray-800 dark:text-gray-300',
|
|
10
|
-
primary: 'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200',
|
|
11
|
-
secondary: 'bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200',
|
|
12
|
-
success: 'bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200',
|
|
13
|
-
warning: 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200',
|
|
14
|
-
danger: 'bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200',
|
|
15
|
-
info: 'bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-200',
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
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' }
|
|
19
|
-
|
|
20
|
-
const dotColorClasses = {
|
|
21
|
-
default: 'bg-gray-500 dark:bg-gray-400',
|
|
22
|
-
primary: 'bg-blue-500 dark:bg-blue-400',
|
|
23
|
-
secondary: 'bg-purple-500 dark:bg-purple-400',
|
|
24
|
-
success: 'bg-green-500 dark:bg-green-400',
|
|
25
|
-
warning: 'bg-yellow-500 dark:bg-yellow-400',
|
|
26
|
-
danger: 'bg-red-500 dark:bg-red-400',
|
|
27
|
-
info: 'bg-cyan-500 dark:bg-cyan-400',
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const badgeClasses = `inline-flex items-center gap-1.5 font-medium rounded-full ${variantClasses[variant]} ${sizeClasses[size]} ${className}`.trim()
|
|
31
|
-
export const dotClasses = `w-2 h-2 rounded-full ${dotColorClasses[variant]}`.trim()
|
|
32
|
-
export const removeButtonClasses = `ml-0.5 -mr-1 text-current hover:bg-black hover:bg-opacity-10 dark:hover:bg-white dark:hover:bg-opacity-10 rounded-full p-0.5 transition-colors duration-150`.trim()
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
<script client>
|
|
36
|
-
const emit = defineEmits()
|
|
37
|
-
|
|
38
|
-
function onRemove() {
|
|
39
|
-
emit('remove')
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<span class="{{ badgeClasses }}" role="status">
|
|
44
|
-
@if(dot)
|
|
45
|
-
<span class="{{ dotClasses }}" aria-hidden="true"></span>
|
|
46
|
-
@endif
|
|
47
|
-
|
|
48
|
-
<slot />
|
|
49
|
-
|
|
50
|
-
@if(removable)
|
|
51
|
-
<button
|
|
52
|
-
type="button"
|
|
53
|
-
@click="onRemove()"
|
|
54
|
-
class="{{ removeButtonClasses }}"
|
|
55
|
-
aria-label="Remove"
|
|
56
|
-
>
|
|
57
|
-
<svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
58
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
59
|
-
</svg>
|
|
60
|
-
</button>
|
|
61
|
-
@endif
|
|
62
|
-
</span>
|
package/dist/Button-h2mk4wfw.stx
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<script server cache>
|
|
2
|
-
export const variant = $props.variant || 'primary'
|
|
3
|
-
export const size = $props.size || 'md'
|
|
4
|
-
export const disabled = $props.disabled || false
|
|
5
|
-
export const loading = $props.loading || false
|
|
6
|
-
export const type = $props.type || 'button'
|
|
7
|
-
export const fullWidth = $props.fullWidth || false
|
|
8
|
-
export const leftIcon = $props.leftIcon || ''
|
|
9
|
-
export const rightIcon = $props.rightIcon || ''
|
|
10
|
-
export const className = $props.className || ''
|
|
11
|
-
|
|
12
|
-
const variantClasses = {
|
|
13
|
-
primary: 'bg-blue-500 hover:bg-blue-600 text-white shadow-md hover:shadow-lg dark:bg-blue-600 dark:hover:bg-blue-700',
|
|
14
|
-
secondary: 'bg-surface-sunken hover:bg-neutral-300 text-neutral-900 dark:hover:bg-neutral-600 dark:text-white',
|
|
15
|
-
outline: 'border-2 border-blue-500 text-blue-500 hover:bg-blue-50 dark:border-blue-400 dark:text-blue-400 dark:hover:bg-blue-950',
|
|
16
|
-
ghost: 'hover:bg-surface-raised text-fg-strong',
|
|
17
|
-
danger: 'bg-red-500 hover:bg-red-600 text-white shadow-md hover:shadow-lg dark:bg-red-600 dark:hover:bg-red-700',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const sizeClasses = {
|
|
21
|
-
xs: 'px-2.5 py-1 text-xs h-7 gap-1',
|
|
22
|
-
sm: 'px-3 py-1.5 text-sm h-8 gap-1.5',
|
|
23
|
-
md: 'px-4 py-2 text-base h-10 gap-2',
|
|
24
|
-
lg: 'px-6 py-3 text-lg h-12 gap-2.5',
|
|
25
|
-
xl: 'px-8 py-4 text-xl h-14 gap-3',
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
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' }
|
|
29
|
-
const baseClasses = 'inline-flex items-center justify-center font-semibold rounded-md transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none'
|
|
30
|
-
const widthClasses = fullWidth ? 'w-full' : ''
|
|
31
|
-
export const isDisabled = disabled || loading
|
|
32
|
-
|
|
33
|
-
export const buttonClasses = `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${widthClasses} ${className}`.trim()
|
|
34
|
-
export const iconClasses = iconSizeClasses[size]
|
|
35
|
-
export const spinnerClasses = `animate-spin ${iconClasses}`.trim()
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<script client>
|
|
39
|
-
const emit = defineEmits()
|
|
40
|
-
const disabledNow = {{ isDisabled }}
|
|
41
|
-
|
|
42
|
-
function onClick(event) {
|
|
43
|
-
if (disabledNow) {
|
|
44
|
-
event.preventDefault()
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
emit('click', event)
|
|
48
|
-
}
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<button
|
|
52
|
-
type="{{ type }}"
|
|
53
|
-
class="{{ buttonClasses }}"
|
|
54
|
-
@if(isDisabled)disabled@endif
|
|
55
|
-
@click="onClick($event)"
|
|
56
|
-
aria-busy="{{ loading ? 'true' : 'false' }}"
|
|
57
|
-
>
|
|
58
|
-
@if(loading)
|
|
59
|
-
<svg class="{{ spinnerClasses }}" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
60
|
-
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
61
|
-
<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>
|
|
62
|
-
</svg>
|
|
63
|
-
@else
|
|
64
|
-
@if(leftIcon)
|
|
65
|
-
<span class="{{ iconClasses }}">{!! leftIcon !!}</span>
|
|
66
|
-
@endif
|
|
67
|
-
@endif
|
|
68
|
-
|
|
69
|
-
<slot />
|
|
70
|
-
|
|
71
|
-
@if(!loading && rightIcon)
|
|
72
|
-
<span class="{{ iconClasses }}">{!! rightIcon !!}</span>
|
|
73
|
-
@endif
|
|
74
|
-
</button>
|
package/dist/Dialog-y5rz2vrq.stx
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const open = $props.open || false
|
|
3
|
-
export const className = $props.className || ''
|
|
4
|
-
|
|
5
|
-
const baseClasses = 'relative z-50'
|
|
6
|
-
export const dialogClasses = `${baseClasses} ${className}`.trim()
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<script client>
|
|
10
|
-
const emit = defineEmits()
|
|
11
|
-
// useReactiveProp wires `:open="parentSignal()"` from the parent into our
|
|
12
|
-
// local `isOpen` signal — when the parent's signal changes, bindAttr
|
|
13
|
-
// updates the root's `open` attribute, our MutationObserver picks it up,
|
|
14
|
-
// and isOpen flips. See stacksjs/stx#1704.
|
|
15
|
-
const isOpen = useReactiveProp('open', {{ open }})
|
|
16
|
-
|
|
17
|
-
function close() {
|
|
18
|
-
isOpen.set(false)
|
|
19
|
-
emit('close')
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function onBackdropKey(event) {
|
|
23
|
-
if (event.key === 'Escape') close()
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
defineExpose({
|
|
27
|
-
open: () => isOpen.set(true),
|
|
28
|
-
close,
|
|
29
|
-
isOpen,
|
|
30
|
-
})
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<div
|
|
34
|
-
:show="isOpen()"
|
|
35
|
-
class="{{ dialogClasses }}"
|
|
36
|
-
role="dialog"
|
|
37
|
-
aria-modal="true"
|
|
38
|
-
@keydown="onBackdropKey($event)"
|
|
39
|
-
>
|
|
40
|
-
<slot />
|
|
41
|
-
</div>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const className = $props.className || ''
|
|
3
|
-
export const as = $props.as || 'div'
|
|
4
|
-
|
|
5
|
-
const baseClasses = 'fixed inset-0 bg-black bg-opacity-25 dark:bg-opacity-50 transition-opacity'
|
|
6
|
-
const backdropClasses = `${baseClasses} ${className}`.trim()
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<component :is="{{ as }}" class="{{ backdropClasses }}" aria-hidden="true" />
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const className = $props.className || ''
|
|
3
|
-
export const as = $props.as || 'div'
|
|
4
|
-
|
|
5
|
-
const baseClasses = 'fixed inset-0 overflow-y-auto'
|
|
6
|
-
const panelWrapperClasses = 'flex min-h-full items-center justify-center p-4 text-center'
|
|
7
|
-
const panelClasses = `transform overflow-hidden rounded-lg bg-white dark:bg-neutral-800 p-6 text-left align-middle shadow-xl transition-all ${className}`.trim()
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<component :is="{{ as }}" class="{{ baseClasses }}">
|
|
11
|
-
<div class="{{ panelWrapperClasses }}">
|
|
12
|
-
<div class="{{ panelClasses }}">
|
|
13
|
-
<slot />
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</component>
|