@stacksjs/components 0.2.27 → 0.2.53
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-19x8q4rj.stx +88 -0
- package/dist/{Audio-vdmg1258.stx → Audio-hjywk3qc.stx} +4 -4
- package/dist/{Avatar-365cvrh4.stx → Avatar-h3jmwcq0.stx} +23 -34
- package/dist/{Badge-8m3qete4.stx → Badge-k8dy3d53.stx} +11 -19
- package/dist/{Button-3tt4vsqt.stx → Button-1vknasy3.stx} +18 -33
- package/dist/Calendar-reny0et7.stx +189 -0
- package/dist/{Card-6wdbexqr.stx → Card-c1g1fd1w.stx} +27 -33
- package/dist/{Checkbox-p3q3e3nf.stx → Checkbox-zgdmy3p5.stx} +36 -44
- package/dist/{Checkout-e4037tyy.stx → Checkout-agt0ngpw.stx} +8 -16
- package/dist/Combobox-fdkr6cdq.stx +96 -0
- package/dist/{ComboboxButton-8gxwkhdx.stx → ComboboxButton-g76stp1e.stx} +14 -2
- package/dist/{ComboboxInput-mk99z65n.stx → ComboboxInput-z1293bbh.stx} +12 -5
- package/dist/ComboboxOption-hmxt3gte.stx +49 -0
- package/dist/{ListboxOptions-8kqvfp7z.stx → ComboboxOptions-sq5360ae.stx} +2 -2
- package/dist/CommandPalette-36mxf05w.stx +81 -0
- package/dist/CommandPaletteItem-mvk6q7a2.stx +27 -0
- package/dist/Dialog-hczpexs4.stx +37 -0
- package/dist/{Drawer-p7m351bn.stx → Drawer-xhevp5cw.stx} +29 -49
- package/dist/Dropdown-vvhemtc0.stx +82 -0
- package/dist/{DropdownButton-9w8zkfwj.stx → DropdownButton-wcz67dxy.stx} +12 -6
- package/dist/DropdownItem-c7rz08e5.stx +35 -0
- package/dist/{DropdownItems-aygjpxkx.stx → DropdownItems-1sxnd5qn.stx} +2 -2
- package/dist/EmailInput-vak3kkmk.stx +30 -0
- package/dist/Form-mas630hy.stx +95 -0
- package/dist/{Image-jhkm6w1f.stx → Image-yhxcvgzs.stx} +68 -100
- package/dist/Listbox-q49tnr90.stx +101 -0
- package/dist/{ListboxButton-spwx7513.stx → ListboxButton-keb8gm0q.stx} +12 -1
- package/dist/ListboxOption-e0dtv1gc.stx +49 -0
- package/dist/{ComboboxOptions-6b5ywc5x.stx → ListboxOptions-ejkatcfg.stx} +7 -3
- package/dist/{Login-rx9gyqhx.stx → Login-gepemsth.stx} +17 -19
- package/dist/Navigator-rk2a5wvk.stx +113 -0
- package/dist/Notification-tb9b525s.stx +78 -0
- package/dist/{NumberInput-nzpkx1ry.stx → NumberInput-drnvtqej.stx} +40 -53
- package/dist/{Pagination-h61eq390.stx → Pagination-n3d31cns.stx} +73 -108
- package/dist/PasswordInput-n02x6053.stx +142 -0
- package/dist/{PaymentMethods-j42jsk5x.stx → PaymentMethods-x4vrx9yb.stx} +21 -30
- package/dist/Popover-et2q44m7.stx +60 -0
- package/dist/{PopoverButton-fnaqc77g.stx → PopoverButton-mffzc9pr.stx} +12 -6
- package/dist/{PopoverPanel-y0vtf5w9.stx → PopoverPanel-054yh38h.stx} +6 -6
- package/dist/{Portal-s2q37yp0.stx → Portal-1vf14s4x.stx} +20 -37
- package/dist/{Progress-vmdkm06p.stx → Progress-yxcntr4x.stx} +36 -48
- package/dist/{Radio-04bs3d21.stx → Radio-cgjv2hb2.stx} +29 -34
- package/dist/RadioGroup-qxmnm3xm.stx +60 -0
- package/dist/RadioGroupOption-s1d6r221.stx +58 -0
- package/dist/SearchInput-pdx7agn0.stx +44 -0
- package/dist/{Select-g4mmvfv8.stx → Select-28y0pg83.stx} +23 -31
- package/dist/Sidebar-73vc78as.stx +236 -0
- package/dist/SidebarFooter-zsfsgcxb.stx +109 -0
- package/dist/SidebarHeader-7v174a9c.stx +122 -0
- package/dist/SidebarItem-3y3e8g2t.stx +92 -0
- package/dist/SidebarSection-z5ey6awe.stx +113 -0
- package/dist/{Signup-c4dyv6f3.stx → Signup-hxm5hwkr.stx} +26 -28
- package/dist/{StepperStep-en4r00zv.stx → StepperStep-wxgembat.stx} +9 -5
- package/dist/{SubscriptionCheckout-gawjzf3q.stx → SubscriptionCheckout-zy2ycrmw.stx} +99 -129
- package/dist/Switch-r5t5w04w.stx +70 -0
- package/dist/{TableHeader-ydys9rzz.stx → TableHeader-0eyzbqpz.stx} +10 -3
- package/dist/Tabs-bzvvn4ke.stx +126 -0
- package/dist/Teleport-tsx4bt4n.stx +65 -0
- package/dist/{TextInput-k2kfkgy1.stx → TextInput-kf084763.stx} +42 -59
- package/dist/{Textarea-szad57dz.stx → Textarea-xg4rr2xz.stx} +42 -54
- package/dist/{Tooltip-em7t551n.stx → Tooltip-m0tqd72e.stx} +34 -40
- package/dist/Transition-7smenaz8.stx +102 -0
- package/dist/{TwoFactorChallenge-an9yvxvq.stx → TwoFactorChallenge-y5m3nk79.stx} +49 -63
- package/dist/{Video-crxva65p.stx → Video-84j4pv6h.stx} +4 -4
- package/dist/VirtualList-fa7v5a3h.stx +67 -0
- package/dist/VirtualTable-f9crbfjr.stx +103 -0
- package/dist/components/CodeBlock.stx +1 -6
- package/dist/index.js +13 -13
- package/dist/ui/accordion/Accordion.stx +1 -3
- package/dist/ui/auth/Login.stx +0 -1
- package/dist/ui/auth/Signup.stx +0 -1
- package/dist/ui/auth/TwoFactorChallenge.stx +1 -3
- package/dist/ui/avatar/Avatar.stx +0 -2
- package/dist/ui/badge/Badge.stx +0 -1
- package/dist/ui/button/Button.stx +1 -2
- package/dist/ui/calendar/Calendar.stx +12 -2
- package/dist/ui/card/Card.stx +0 -2
- package/dist/ui/checkbox/Checkbox.stx +2 -2
- package/dist/ui/combobox/Combobox.stx +2 -1
- package/dist/ui/combobox/ComboboxButton.stx +1 -0
- package/dist/ui/combobox/ComboboxInput.stx +1 -4
- package/dist/ui/combobox/ComboboxOption.stx +2 -9
- package/dist/ui/combobox/ComboboxOptions.stx +1 -1
- package/dist/ui/command-palette/CommandPalette.stx +3 -6
- package/dist/ui/command-palette/CommandPaletteItem.stx +2 -7
- package/dist/ui/dialog/Dialog.stx +1 -3
- package/dist/ui/drawer/Drawer.stx +1 -3
- package/dist/ui/dropdown/Dropdown.stx +2 -5
- package/dist/ui/dropdown/DropdownButton.stx +1 -3
- package/dist/ui/dropdown/DropdownItem.stx +2 -7
- package/dist/ui/dropdown/DropdownItems.stx +1 -1
- package/dist/ui/form/Form.stx +0 -5
- package/dist/ui/image/Image.stx +1 -6
- package/dist/ui/input/EmailInput.stx +1 -1
- package/dist/ui/input/NumberInput.stx +0 -1
- package/dist/ui/input/PasswordInput.stx +1 -4
- package/dist/ui/input/SearchInput.stx +2 -2
- package/dist/ui/input/TextInput.stx +1 -2
- package/dist/ui/listbox/Listbox.stx +2 -1
- package/dist/ui/listbox/ListboxButton.stx +1 -0
- package/dist/ui/listbox/ListboxOption.stx +2 -9
- package/dist/ui/listbox/ListboxOptions.stx +1 -1
- package/dist/ui/navigator/Navigator.stx +4 -4
- package/dist/ui/notification/Notification.stx +1 -5
- package/dist/ui/pagination/Pagination.stx +1 -2
- package/dist/ui/payment/Checkout.stx +0 -4
- package/dist/ui/payment/PaymentMethods.stx +15 -2
- package/dist/ui/payment/SubscriptionCheckout.stx +3 -184
- package/dist/ui/popover/Popover.stx +2 -5
- package/dist/ui/popover/PopoverButton.stx +1 -3
- package/dist/ui/popover/PopoverPanel.stx +1 -1
- package/dist/ui/portal/Portal.stx +1 -0
- package/dist/ui/progress/Progress.stx +6 -1
- package/dist/ui/radio/Radio.stx +1 -1
- package/dist/ui/radio-group/RadioGroup.stx +2 -1
- package/dist/ui/radio-group/RadioGroupOption.stx +2 -9
- package/dist/ui/select/Select.stx +1 -1
- package/dist/ui/sidebar/Sidebar.stx +9 -26
- package/dist/ui/sidebar/SidebarFooter.stx +6 -21
- package/dist/ui/sidebar/SidebarHeader.stx +7 -18
- package/dist/ui/sidebar/SidebarItem.stx +4 -20
- package/dist/ui/sidebar/SidebarSection.stx +5 -18
- package/dist/ui/sidebar/index.d.ts +13 -1
- package/dist/ui/stepper/StepperStep.stx +1 -5
- package/dist/ui/switch/Switch.stx +4 -10
- package/dist/ui/table/TableHeader.stx +1 -1
- package/dist/ui/tabs/Tabs.stx +0 -1
- package/dist/ui/teleport/Teleport.stx +1 -0
- package/dist/ui/textarea/Textarea.stx +1 -1
- package/dist/ui/tooltip/Tooltip.stx +1 -2
- package/dist/ui/transition/Transition.stx +9 -16
- package/dist/ui/virtual-list/VirtualList.stx +2 -4
- package/dist/ui/virtual-table/VirtualTable.stx +1 -1
- package/package.json +3 -3
- package/src/components/CodeBlock.stx +26 -29
- package/src/components/Footer.stx +1 -1
- package/src/components/Hero.stx +1 -1
- package/src/components/Installation.stx +5 -7
- package/src/ui/accordion/Accordion.stx +48 -68
- package/src/ui/audio/Audio.stx +4 -4
- package/src/ui/auth/Login.stx +17 -19
- package/src/ui/auth/Signup.stx +26 -28
- package/src/ui/auth/TwoFactorChallenge.stx +49 -63
- package/src/ui/avatar/Avatar.stx +23 -34
- package/src/ui/badge/Badge.stx +11 -19
- package/src/ui/button/Button.stx +18 -33
- package/src/ui/calendar/Calendar.stx +93 -136
- package/src/ui/card/Card.stx +27 -33
- package/src/ui/checkbox/Checkbox.stx +36 -44
- package/src/ui/combobox/Combobox.stx +87 -4
- package/src/ui/combobox/ComboboxButton.stx +14 -2
- package/src/ui/combobox/ComboboxInput.stx +12 -5
- package/src/ui/combobox/ComboboxOption.stx +29 -32
- package/src/ui/combobox/ComboboxOptions.stx +7 -3
- package/src/ui/command-palette/CommandPalette.stx +70 -28
- package/src/ui/command-palette/CommandPaletteItem.stx +15 -20
- package/src/ui/dialog/Dialog.stx +28 -10
- package/src/ui/drawer/Drawer.stx +29 -49
- package/src/ui/dropdown/Dropdown.stx +69 -11
- package/src/ui/dropdown/DropdownButton.stx +12 -6
- package/src/ui/dropdown/DropdownItem.stx +18 -26
- package/src/ui/dropdown/DropdownItems.stx +2 -2
- package/src/ui/form/Form.stx +50 -164
- package/src/ui/heatmap/Heatmap.stx +16 -37
- package/src/ui/image/Image.stx +68 -100
- package/src/ui/input/EmailInput.stx +16 -27
- package/src/ui/input/NumberInput.stx +40 -53
- package/src/ui/input/PasswordInput.stx +64 -77
- package/src/ui/input/SearchInput.stx +27 -46
- package/src/ui/input/TextInput.stx +42 -59
- package/src/ui/listbox/Listbox.stx +91 -4
- package/src/ui/listbox/ListboxButton.stx +12 -1
- package/src/ui/listbox/ListboxOption.stx +30 -38
- package/src/ui/listbox/ListboxOptions.stx +2 -2
- package/src/ui/navigator/Navigator.stx +52 -77
- package/src/ui/notification/Notification.stx +46 -39
- package/src/ui/pagination/Pagination.stx +73 -108
- package/src/ui/payment/Checkout.stx +8 -16
- package/src/ui/payment/PaymentMethods.stx +21 -30
- package/src/ui/payment/SubscriptionCheckout.stx +99 -129
- package/src/ui/popover/Popover.stx +50 -14
- package/src/ui/popover/PopoverButton.stx +12 -6
- package/src/ui/popover/PopoverPanel.stx +6 -6
- package/src/ui/portal/Portal.stx +20 -37
- package/src/ui/progress/Progress.stx +36 -48
- package/src/ui/radio/Radio.stx +29 -34
- package/src/ui/radio-group/RadioGroup.stx +51 -4
- package/src/ui/radio-group/RadioGroupOption.stx +37 -30
- package/src/ui/select/Select.stx +23 -31
- package/src/ui/sidebar/Sidebar.stx +136 -188
- package/src/ui/sidebar/SidebarFooter.stx +49 -35
- package/src/ui/sidebar/SidebarHeader.stx +52 -30
- package/src/ui/sidebar/SidebarItem.stx +52 -78
- package/src/ui/sidebar/SidebarSection.stx +56 -51
- package/src/ui/sidebar/index.ts +21 -1
- package/src/ui/stepper/StepperStep.stx +9 -5
- package/src/ui/switch/Switch.stx +38 -42
- package/src/ui/table/TableHeader.stx +10 -3
- package/src/ui/tabs/Tabs.stx +68 -87
- package/src/ui/teleport/Teleport.stx +23 -59
- package/src/ui/textarea/Textarea.stx +42 -54
- package/src/ui/tooltip/Tooltip.stx +34 -40
- package/src/ui/transition/Transition.stx +76 -148
- package/src/ui/video/Video.stx +4 -4
- package/src/ui/virtual-list/VirtualList.stx +45 -61
- package/src/ui/virtual-table/VirtualTable.stx +62 -72
- package/dist/Accordion-sbfra0mz.stx +0 -108
- package/dist/Calendar-58nnkdh8.stx +0 -232
- package/dist/Combobox-th5ebw62.stx +0 -13
- package/dist/ComboboxOption-an9zyan6.stx +0 -52
- package/dist/CommandPalette-kwmdf2np.stx +0 -39
- package/dist/CommandPaletteItem-zx2fbpts.stx +0 -32
- package/dist/Dialog-rgmj8q2j.stx +0 -19
- package/dist/Dropdown-jz4jy0n3.stx +0 -24
- package/dist/DropdownItem-wagdspb8.stx +0 -43
- package/dist/EmailInput-ajsp9vw6.stx +0 -41
- package/dist/Form-1mdmx9b6.stx +0 -209
- package/dist/Listbox-pqqh72g8.stx +0 -14
- package/dist/ListboxOption-7nxzaexq.stx +0 -57
- package/dist/Navigator-aay8bjab.stx +0 -138
- package/dist/Notification-gk33gv7b.stx +0 -71
- package/dist/PasswordInput-zv4hm43j.stx +0 -155
- package/dist/Popover-469gbt6r.stx +0 -24
- package/dist/RadioGroup-bvb1mrhd.stx +0 -13
- package/dist/RadioGroupOption-cpdwgnhw.stx +0 -51
- package/dist/SearchInput-2521m475.stx +0 -63
- package/dist/Sidebar-40ckbzh8.stx +0 -288
- package/dist/SidebarFooter-hnth56mg.stx +0 -95
- package/dist/SidebarHeader-3wrte2p2.stx +0 -100
- package/dist/SidebarItem-zqtvvzpc.stx +0 -118
- package/dist/SidebarSection-3etwnbjr.stx +0 -108
- package/dist/Switch-036j9vm1.stx +0 -74
- package/dist/Tabs-svh721m0.stx +0 -145
- package/dist/Teleport-qfch3w0b.stx +0 -101
- package/dist/Transition-0hmr6zxb.stx +0 -174
- package/dist/VirtualList-cndhjejh.stx +0 -83
- package/dist/VirtualTable-ng0b48yp.stx +0 -113
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const show = $props.show !== false
|
|
3
|
-
export const enter = $props.enter || 'transition-opacity duration-300'
|
|
4
|
-
export const enterFrom = $props.enterFrom || 'opacity-0'
|
|
5
|
-
export const enterTo = $props.enterTo || 'opacity-100'
|
|
6
|
-
export const leave = $props.leave || 'transition-opacity duration-200'
|
|
7
|
-
export const leaveFrom = $props.leaveFrom || 'opacity-100'
|
|
8
|
-
export const leaveTo = $props.leaveTo || 'opacity-0'
|
|
9
|
-
export const appear = $props.appear || false
|
|
10
|
-
export const appearFrom = $props.appearFrom || enterFrom
|
|
11
|
-
export const appearTo = $props.appearTo || enterTo
|
|
12
|
-
export const mode = $props.mode || 'in-out' // 'in-out' | 'out-in' | 'default'
|
|
13
|
-
export const duration = $props.duration || 300
|
|
14
|
-
export const delay = $props.delay || 0
|
|
15
|
-
export const preset = $props.preset || ''
|
|
16
|
-
export const onBeforeEnter = $props.onBeforeEnter
|
|
17
|
-
export const onEnter = $props.onEnter
|
|
18
|
-
export const onAfterEnter = $props.onAfterEnter
|
|
19
|
-
export const onBeforeLeave = $props.onBeforeLeave
|
|
20
|
-
export const onLeave = $props.onLeave
|
|
21
|
-
export const onAfterLeave = $props.onAfterLeave
|
|
22
|
-
export const className = $props.className || ''
|
|
23
|
-
|
|
24
|
-
// Preset transitions
|
|
25
|
-
const presets = {
|
|
26
|
-
fade: {
|
|
27
|
-
enter: 'transition-opacity',
|
|
28
|
-
enterFrom: 'opacity-0',
|
|
29
|
-
enterTo: 'opacity-100',
|
|
30
|
-
leave: 'transition-opacity',
|
|
31
|
-
leaveFrom: 'opacity-100',
|
|
32
|
-
leaveTo: 'opacity-0',
|
|
33
|
-
},
|
|
34
|
-
slide: {
|
|
35
|
-
enter: 'transition-transform',
|
|
36
|
-
enterFrom: 'translate-y-2',
|
|
37
|
-
enterTo: 'translate-y-0',
|
|
38
|
-
leave: 'transition-transform',
|
|
39
|
-
leaveFrom: 'translate-y-0',
|
|
40
|
-
leaveTo: 'translate-y-2',
|
|
41
|
-
},
|
|
42
|
-
slideLeft: {
|
|
43
|
-
enter: 'transition-transform',
|
|
44
|
-
enterFrom: 'translate-x-full',
|
|
45
|
-
enterTo: 'translate-x-0',
|
|
46
|
-
leave: 'transition-transform',
|
|
47
|
-
leaveFrom: 'translate-x-0',
|
|
48
|
-
leaveTo: '-translate-x-full',
|
|
49
|
-
},
|
|
50
|
-
slideRight: {
|
|
51
|
-
enter: 'transition-transform',
|
|
52
|
-
enterFrom: '-translate-x-full',
|
|
53
|
-
enterTo: 'translate-x-0',
|
|
54
|
-
leave: 'transition-transform',
|
|
55
|
-
leaveFrom: 'translate-x-0',
|
|
56
|
-
leaveTo: 'translate-x-full',
|
|
57
|
-
},
|
|
58
|
-
scale: {
|
|
59
|
-
enter: 'transition-transform',
|
|
60
|
-
enterFrom: 'scale-95',
|
|
61
|
-
enterTo: 'scale-100',
|
|
62
|
-
leave: 'transition-transform',
|
|
63
|
-
leaveFrom: 'scale-100',
|
|
64
|
-
leaveTo: 'scale-95',
|
|
65
|
-
},
|
|
66
|
-
rotate: {
|
|
67
|
-
enter: 'transition-transform',
|
|
68
|
-
enterFrom: 'rotate-12 scale-95',
|
|
69
|
-
enterTo: 'rotate-0 scale-100',
|
|
70
|
-
leave: 'transition-transform',
|
|
71
|
-
leaveFrom: 'rotate-0 scale-100',
|
|
72
|
-
leaveTo: '-rotate-12 scale-95',
|
|
73
|
-
},
|
|
74
|
-
zoom: {
|
|
75
|
-
enter: 'transition-all',
|
|
76
|
-
enterFrom: 'scale-0 opacity-0',
|
|
77
|
-
enterTo: 'scale-100 opacity-100',
|
|
78
|
-
leave: 'transition-all',
|
|
79
|
-
leaveFrom: 'scale-100 opacity-100',
|
|
80
|
-
leaveTo: 'scale-0 opacity-0',
|
|
81
|
-
},
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Apply preset if specified
|
|
85
|
-
const presetTransition = preset && presets[preset] ? presets[preset] : {}
|
|
86
|
-
const finalEnter = presetTransition.enter || enter
|
|
87
|
-
const finalEnterFrom = presetTransition.enterFrom || enterFrom
|
|
88
|
-
const finalEnterTo = presetTransition.enterTo || enterTo
|
|
89
|
-
const finalLeave = presetTransition.leave || leave
|
|
90
|
-
const finalLeaveFrom = presetTransition.leaveFrom || leaveFrom
|
|
91
|
-
const finalLeaveTo = presetTransition.leaveTo || leaveTo
|
|
92
|
-
|
|
93
|
-
export let isEntering = false
|
|
94
|
-
export let isLeaving = false
|
|
95
|
-
export let shouldRender = show
|
|
96
|
-
export let hasAppeared = false
|
|
97
|
-
|
|
98
|
-
const transitionClasses = show
|
|
99
|
-
? isEntering
|
|
100
|
-
? `${finalEnter} ${finalEnterFrom}`
|
|
101
|
-
: `${finalEnterTo}`
|
|
102
|
-
: isLeaving
|
|
103
|
-
? `${finalLeave} ${finalLeaveFrom}`
|
|
104
|
-
: `${finalLeaveTo}`
|
|
105
|
-
|
|
106
|
-
const componentClasses = `${transitionClasses} ${className}`.trim()
|
|
107
|
-
const durationStyle = `transition-duration: ${duration}ms; transition-delay: ${delay}ms;`
|
|
108
|
-
</script>
|
|
109
|
-
|
|
110
|
-
@if(shouldRender)
|
|
111
|
-
<div class="{{ componentClasses }}" style="{{ durationStyle }}">
|
|
112
|
-
<slot />
|
|
113
|
-
</div>
|
|
114
|
-
@endif
|
|
115
|
-
|
|
116
|
-
<script>
|
|
117
|
-
// Handle transitions with lifecycle callbacks
|
|
118
|
-
if (typeof window !== 'undefined') {
|
|
119
|
-
let previousShow = show
|
|
120
|
-
|
|
121
|
-
// Watch for show changes
|
|
122
|
-
function checkTransition() {
|
|
123
|
-
if (show !== previousShow) {
|
|
124
|
-
if (show && !shouldRender) {
|
|
125
|
-
// Entering
|
|
126
|
-
if (onBeforeEnter) onBeforeEnter()
|
|
127
|
-
|
|
128
|
-
shouldRender = true
|
|
129
|
-
isEntering = true
|
|
130
|
-
|
|
131
|
-
setTimeout(() => {
|
|
132
|
-
if (onEnter) onEnter()
|
|
133
|
-
}, delay)
|
|
134
|
-
|
|
135
|
-
setTimeout(() => {
|
|
136
|
-
isEntering = false
|
|
137
|
-
if (onAfterEnter) onAfterEnter()
|
|
138
|
-
}, duration + delay)
|
|
139
|
-
|
|
140
|
-
} else if (!show && shouldRender) {
|
|
141
|
-
// Leaving
|
|
142
|
-
if (onBeforeLeave) onBeforeLeave()
|
|
143
|
-
|
|
144
|
-
isLeaving = true
|
|
145
|
-
|
|
146
|
-
setTimeout(() => {
|
|
147
|
-
if (onLeave) onLeave()
|
|
148
|
-
}, delay)
|
|
149
|
-
|
|
150
|
-
setTimeout(() => {
|
|
151
|
-
isLeaving = false
|
|
152
|
-
shouldRender = false
|
|
153
|
-
if (onAfterLeave) onAfterLeave()
|
|
154
|
-
}, duration + delay)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
previousShow = show
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
requestAnimationFrame(checkTransition)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
requestAnimationFrame(checkTransition)
|
|
164
|
-
|
|
165
|
-
// Handle initial appear
|
|
166
|
-
if (appear && show && !hasAppeared) {
|
|
167
|
-
hasAppeared = true
|
|
168
|
-
isEntering = true
|
|
169
|
-
setTimeout(() => {
|
|
170
|
-
isEntering = false
|
|
171
|
-
}, duration + delay)
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
</script>
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const items = $props.items || []
|
|
3
|
-
export const itemHeight = $props.itemHeight || 50
|
|
4
|
-
export const height = $props.height || 400
|
|
5
|
-
export const overscan = $props.overscan || 3
|
|
6
|
-
export const renderItem = $props.renderItem
|
|
7
|
-
export const className = $props.className || ''
|
|
8
|
-
|
|
9
|
-
// Calculate visible range
|
|
10
|
-
let scrollTop = 0
|
|
11
|
-
const visibleCount = Math.ceil(height / itemHeight)
|
|
12
|
-
const totalHeight = items.length * itemHeight
|
|
13
|
-
|
|
14
|
-
// Calculate start and end indices with overscan
|
|
15
|
-
function getVisibleRange() {
|
|
16
|
-
const startIndex = Math.max(0, Math.floor(scrollTop / itemHeight) - overscan)
|
|
17
|
-
const endIndex = Math.min(items.length - 1, Math.floor((scrollTop + height) / itemHeight) + overscan)
|
|
18
|
-
return { startIndex, endIndex }
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const { startIndex, endIndex } = getVisibleRange()
|
|
22
|
-
const visibleItems = items.slice(startIndex, endIndex + 1)
|
|
23
|
-
const offsetY = startIndex * itemHeight
|
|
24
|
-
|
|
25
|
-
// Handle scroll
|
|
26
|
-
function handleScroll(event) {
|
|
27
|
-
const target = event.target
|
|
28
|
-
scrollTop = target.scrollTop
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const containerClasses = `overflow-auto ${className}`.trim()
|
|
32
|
-
export const innerClasses = `relative`.trim()
|
|
33
|
-
export const itemClasses = `absolute left-0 right-0`.trim()
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<div
|
|
37
|
-
class="{{ containerClasses }}"
|
|
38
|
-
style="height: {{ height }}px"
|
|
39
|
-
onscroll="handleScroll(event)"
|
|
40
|
-
>
|
|
41
|
-
<div
|
|
42
|
-
class="{{ innerClasses }}"
|
|
43
|
-
style="height: {{ totalHeight }}px"
|
|
44
|
-
>
|
|
45
|
-
@foreach(item in visibleItems)
|
|
46
|
-
<div
|
|
47
|
-
class="{{ itemClasses }}"
|
|
48
|
-
style="top: {{ (startIndex + $loop.index) * itemHeight }}px; height: {{ itemHeight }}px"
|
|
49
|
-
data-index="{{ startIndex + $loop.index }}"
|
|
50
|
-
>
|
|
51
|
-
@if(renderItem)
|
|
52
|
-
{!! renderItem(item, startIndex + $loop.index) !!}
|
|
53
|
-
@else
|
|
54
|
-
<slot item="{{ item }}" index="{{ startIndex + $loop.index }}" />
|
|
55
|
-
@endif
|
|
56
|
-
</div>
|
|
57
|
-
@endforeach
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<script>
|
|
62
|
-
// Re-render on scroll (simplified reactivity)
|
|
63
|
-
if (typeof window !== 'undefined') {
|
|
64
|
-
let ticking = false
|
|
65
|
-
|
|
66
|
-
function updateVisibleItems() {
|
|
67
|
-
const range = getVisibleRange()
|
|
68
|
-
// Trigger re-render by updating visible range
|
|
69
|
-
// In a real implementation, this would update reactive state
|
|
70
|
-
ticking = false
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const scrollContainer = document.querySelector('.overflow-auto')
|
|
74
|
-
if (scrollContainer) {
|
|
75
|
-
scrollContainer.addEventListener('scroll', () => {
|
|
76
|
-
if (!ticking) {
|
|
77
|
-
window.requestAnimationFrame(updateVisibleItems)
|
|
78
|
-
ticking = true
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
</script>
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const columns = $props.columns || []
|
|
3
|
-
export const data = $props.data || []
|
|
4
|
-
export const rowHeight = $props.rowHeight || 48
|
|
5
|
-
export const height = $props.height || 600
|
|
6
|
-
export const headerHeight = $props.headerHeight || 56
|
|
7
|
-
export const overscan = $props.overscan || 5
|
|
8
|
-
export const striped = $props.striped || false
|
|
9
|
-
export const hoverable = $props.hoverable ?? true
|
|
10
|
-
export const className = $props.className || ''
|
|
11
|
-
|
|
12
|
-
// Calculate visible range
|
|
13
|
-
let scrollTop = 0
|
|
14
|
-
const visibleCount = Math.ceil((height - headerHeight) / rowHeight)
|
|
15
|
-
const totalHeight = data.length * rowHeight
|
|
16
|
-
|
|
17
|
-
function getVisibleRange() {
|
|
18
|
-
const startIndex = Math.max(0, Math.floor(scrollTop / rowHeight) - overscan)
|
|
19
|
-
const endIndex = Math.min(data.length - 1, Math.floor((scrollTop + height - headerHeight) / rowHeight) + overscan)
|
|
20
|
-
return { startIndex, endIndex }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const { startIndex, endIndex } = getVisibleRange()
|
|
24
|
-
const visibleRows = data.slice(startIndex, endIndex + 1)
|
|
25
|
-
const offsetY = startIndex * rowHeight
|
|
26
|
-
|
|
27
|
-
function handleScroll(event) {
|
|
28
|
-
const target = event.target
|
|
29
|
-
scrollTop = target.scrollTop
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Get cell value
|
|
33
|
-
function getCellValue(row, column) {
|
|
34
|
-
if (column.render) {
|
|
35
|
-
return column.render(row[column.key], row)
|
|
36
|
-
}
|
|
37
|
-
return row[column.key]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const containerClasses = `border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden ${className}`.trim()
|
|
41
|
-
export const headerClasses = `bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 flex`.trim()
|
|
42
|
-
export const headerCellClasses = `px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider`.trim()
|
|
43
|
-
export const bodyClasses = `overflow-auto bg-white dark:bg-gray-900`.trim()
|
|
44
|
-
export const innerClasses = `relative`.trim()
|
|
45
|
-
export const rowClasses = `absolute left-0 right-0 flex border-b border-gray-200 dark:border-gray-700 ${hoverable ? 'hover:bg-gray-50 dark:hover:bg-gray-800' : ''}`.trim()
|
|
46
|
-
export const cellClasses = `px-6 py-4 text-sm text-gray-900 dark:text-gray-100`.trim()
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<div class="{{ containerClasses }}">
|
|
50
|
-
<!-- Header -->
|
|
51
|
-
<div class="{{ headerClasses }}" style="height: {{ headerHeight }}px">
|
|
52
|
-
@foreach(column in columns)
|
|
53
|
-
<div
|
|
54
|
-
class="{{ headerCellClasses }}"
|
|
55
|
-
style="flex: {{ column.width || 1 }}; min-width: {{ column.minWidth || 'auto' }}"
|
|
56
|
-
>
|
|
57
|
-
{{ column.label || column.key }}
|
|
58
|
-
</div>
|
|
59
|
-
@endforeach
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<!-- Body -->
|
|
63
|
-
<div
|
|
64
|
-
class="{{ bodyClasses }}"
|
|
65
|
-
style="height: {{ height - headerHeight }}px"
|
|
66
|
-
onscroll="handleScroll(event)"
|
|
67
|
-
>
|
|
68
|
-
<div
|
|
69
|
-
class="{{ innerClasses }}"
|
|
70
|
-
style="height: {{ totalHeight }}px"
|
|
71
|
-
>
|
|
72
|
-
@foreach(row in visibleRows)
|
|
73
|
-
<div
|
|
74
|
-
class="{{ rowClasses }} {{ striped && ($loop.index % 2 === 1) ? 'bg-gray-50 dark:bg-gray-800' : '' }}"
|
|
75
|
-
style="top: {{ (startIndex + $loop.index) * rowHeight }}px; height: {{ rowHeight }}px"
|
|
76
|
-
data-index="{{ startIndex + $loop.index }}"
|
|
77
|
-
>
|
|
78
|
-
@foreach(column in columns)
|
|
79
|
-
<div
|
|
80
|
-
class="{{ cellClasses }}"
|
|
81
|
-
style="flex: {{ column.width || 1 }}; min-width: {{ column.minWidth || 'auto' }}"
|
|
82
|
-
>
|
|
83
|
-
{!! getCellValue(row, column) !!}
|
|
84
|
-
</div>
|
|
85
|
-
@endforeach
|
|
86
|
-
</div>
|
|
87
|
-
@endforeach
|
|
88
|
-
</div>
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<script>
|
|
93
|
-
// Re-render on scroll (simplified reactivity)
|
|
94
|
-
if (typeof window !== 'undefined') {
|
|
95
|
-
let ticking = false
|
|
96
|
-
|
|
97
|
-
function updateVisibleRows() {
|
|
98
|
-
const range = getVisibleRange()
|
|
99
|
-
// Trigger re-render
|
|
100
|
-
ticking = false
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const bodyContainer = document.querySelector('.overflow-auto')
|
|
104
|
-
if (bodyContainer) {
|
|
105
|
-
bodyContainer.addEventListener('scroll', () => {
|
|
106
|
-
if (!ticking) {
|
|
107
|
-
window.requestAnimationFrame(updateVisibleRows)
|
|
108
|
-
ticking = true
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
</script>
|