@stacksjs/components 0.2.369 → 0.2.370

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.
Files changed (42) hide show
  1. package/dist/Combobox-9xh1jgjr.stx +266 -0
  2. package/dist/{ComboboxButton-g76stp1e.stx → ComboboxButton-4r6a45s1.stx} +8 -1
  3. package/dist/{ComboboxInput-a5g0vn3e.stx → ComboboxInput-1gyfpnca.stx} +3 -0
  4. package/dist/{ComboboxOption-vnb67p8d.stx → ComboboxOption-wkw70js7.stx} +27 -1
  5. package/dist/{CommandPalette-y6t67rjj.stx → CommandPalette-vvaqtqat.stx} +2 -2
  6. package/dist/CommandPaletteItem-7290ce1z.stx +40 -0
  7. package/dist/Dropdown-25160tc6.stx +204 -0
  8. package/dist/{DropdownButton-6by2ybde.stx → DropdownButton-wxc25hsy.stx} +2 -0
  9. package/dist/{DropdownItem-wht1vcm5.stx → DropdownItem-af0vzc8a.stx} +15 -1
  10. package/dist/Listbox-32gzxace.stx +273 -0
  11. package/dist/{ListboxButton-3yc7tm8w.stx → ListboxButton-gan8e3nw.stx} +2 -0
  12. package/dist/{ListboxOption-9c9jpz1n.stx → ListboxOption-gpaqvk3s.stx} +14 -1
  13. package/dist/Popover-9m42pym0.stx +101 -0
  14. package/dist/{PopoverButton-htfypg00.stx → PopoverButton-3w6550hv.stx} +1 -0
  15. package/dist/{RadioGroup-neej7522.stx → RadioGroup-smqcqgds.stx} +14 -1
  16. package/dist/{RadioGroupOption-c6xd0at9.stx → RadioGroupOption-twcw1b2a.stx} +13 -1
  17. package/dist/{SubscriptionCheckout-75x9mfv2.stx → SubscriptionCheckout-n3btqrzk.stx} +1 -1
  18. package/dist/index.js +7 -7
  19. package/package.json +3 -3
  20. package/src/components/Footer.stx +2 -2
  21. package/src/ui/combobox/Combobox.stx +174 -4
  22. package/src/ui/combobox/ComboboxButton.stx +8 -1
  23. package/src/ui/combobox/ComboboxInput.stx +3 -0
  24. package/src/ui/combobox/ComboboxOption.stx +27 -1
  25. package/src/ui/command-palette/CommandPalette.stx +2 -2
  26. package/src/ui/command-palette/CommandPaletteItem.stx +14 -1
  27. package/src/ui/dropdown/Dropdown.stx +122 -0
  28. package/src/ui/dropdown/DropdownButton.stx +2 -0
  29. package/src/ui/dropdown/DropdownItem.stx +15 -1
  30. package/src/ui/listbox/Listbox.stx +175 -3
  31. package/src/ui/listbox/ListboxButton.stx +2 -0
  32. package/src/ui/listbox/ListboxOption.stx +14 -1
  33. package/src/ui/payment/SubscriptionCheckout.stx +1 -1
  34. package/src/ui/popover/Popover.stx +43 -2
  35. package/src/ui/popover/PopoverButton.stx +1 -0
  36. package/src/ui/radio-group/RadioGroup.stx +14 -1
  37. package/src/ui/radio-group/RadioGroupOption.stx +13 -1
  38. package/dist/Combobox-06x0nywb.stx +0 -96
  39. package/dist/CommandPaletteItem-6rp133ta.stx +0 -27
  40. package/dist/Dropdown-cmwge7vx.stx +0 -82
  41. package/dist/Listbox-e5jreb0a.stx +0 -101
  42. package/dist/Popover-3g8rgxt1.stx +0 -60
@@ -1,101 +0,0 @@
1
- <script server>
2
- export const value = $props.value
3
- export const multiple = $bool($props.multiple)
4
- export const className = $props.className || ''
5
- export const as = $props.as || 'div'
6
-
7
- const baseClasses = 'relative'
8
- export const listboxClasses = `${baseClasses} ${className}`.trim()
9
- export const listboxInstanceId = $uid
10
- </script>
11
-
12
- <script client>
13
- const emit = defineEmits()
14
- const listboxInstanceId = {{ listboxInstanceId }}
15
- const multiple = {{ multiple }}
16
- const initialValue = {{ value === undefined ? 'null' : value }}
17
-
18
- const isOpen = state(false)
19
- const selected = state(initialValue)
20
- let rootEl = null
21
- let outsideHandler = null
22
-
23
- function isSelectedValue(v) {
24
- const cur = selected()
25
- if (multiple && Array.isArray(cur)) return cur.includes(v)
26
- return cur === v
27
- }
28
-
29
- function selectValue(v) {
30
- if (multiple) {
31
- const cur = Array.isArray(selected()) ? selected() : []
32
- selected.set(cur.includes(v) ? cur.filter(x => x !== v) : [...cur, v])
33
- }
34
- else {
35
- selected.set(v)
36
- isOpen.set(false)
37
- }
38
- syncOptionStates()
39
- emit('change', selected())
40
- }
41
-
42
- function syncOptionStates() {
43
- if (!rootEl) return
44
- const options = rootEl.querySelectorAll('[data-stx-listbox-option]')
45
- for (const opt of options) {
46
- const raw = opt.dataset.optionValue
47
- let v
48
- try { v = JSON.parse(raw ?? 'null') }
49
- catch { v = raw }
50
- const sel = isSelectedValue(v)
51
- opt.setAttribute('aria-selected', sel ? 'true' : 'false')
52
- opt.setAttribute('data-selected', sel ? 'true' : 'false')
53
- }
54
- }
55
-
56
- function open() { if (!isOpen()) { isOpen.set(true); emit('change', selected()) } }
57
- function close() { if (isOpen()) { isOpen.set(false) } }
58
- function toggle() { isOpen() ? close() : open() }
59
-
60
- function onToggle(event) { event.stopPropagation(); toggle() }
61
- function onSelect(event) {
62
- event.stopPropagation()
63
- selectValue(event.detail)
64
- }
65
-
66
- onMount(() => {
67
- rootEl = document.querySelector(`[data-listbox-id="${listboxInstanceId}"]`)
68
- syncOptionStates()
69
- outsideHandler = (event) => {
70
- if (!isOpen()) return
71
- if (rootEl && !rootEl.contains(event.target)) close()
72
- }
73
- document.addEventListener('click', outsideHandler, true)
74
- })
75
-
76
- onDestroy(() => {
77
- if (outsideHandler) document.removeEventListener('click', outsideHandler, true)
78
- })
79
-
80
- const dataState = derived(() => isOpen() ? 'open' : 'closed')
81
-
82
- defineExpose({ isOpen, selected, toggle, open, close, selectValue })
83
- </script>
84
-
85
- <component
86
- :is="{{ as }}"
87
- class="{{ listboxClasses }}"
88
- data-stx-listbox
89
- data-listbox-id="{{ listboxInstanceId }}"
90
- :data-state="dataState()"
91
- @stx:listbox-toggle="onToggle($event)"
92
- @stx:listbox-select="onSelect($event)"
93
- >
94
- <slot />
95
- </component>
96
-
97
- <style>
98
- [data-stx-listbox][data-state="closed"] [data-stx-listbox-options] {
99
- display: none;
100
- }
101
- </style>
@@ -1,60 +0,0 @@
1
- <script server>
2
- export const className = $props.className || ''
3
- export const as = $props.as || 'div'
4
-
5
- const baseClasses = 'relative'
6
- export const popoverClasses = `${baseClasses} ${className}`.trim()
7
- export const popoverInstanceId = $uid
8
- </script>
9
-
10
- <script client>
11
- const emit = defineEmits()
12
- const popoverInstanceId = {{ popoverInstanceId }}
13
- const isOpen = state(false)
14
- let rootEl = null
15
- let outsideHandler = null
16
-
17
- function open() { if (!isOpen()) { isOpen.set(true); emit('change', true) } }
18
- function close() { if (isOpen()) { isOpen.set(false); emit('change', false) } }
19
- function toggle() { isOpen() ? close() : open() }
20
-
21
- function onToggle(event) { event.stopPropagation(); toggle() }
22
- function onClose(event) { event.stopPropagation(); close() }
23
- function onOpen(event) { event.stopPropagation(); open() }
24
-
25
- onMount(() => {
26
- rootEl = document.querySelector(`[data-popover-id="${popoverInstanceId}"]`)
27
- outsideHandler = (event) => {
28
- if (!isOpen()) return
29
- if (rootEl && !rootEl.contains(event.target)) close()
30
- }
31
- document.addEventListener('click', outsideHandler, true)
32
- })
33
-
34
- onDestroy(() => {
35
- if (outsideHandler) document.removeEventListener('click', outsideHandler, true)
36
- })
37
-
38
- const dataState = derived(() => isOpen() ? 'open' : 'closed')
39
-
40
- defineExpose({ isOpen, toggle, open, close })
41
- </script>
42
-
43
- <component
44
- :is="{{ as }}"
45
- class="{{ popoverClasses }}"
46
- data-stx-popover
47
- data-popover-id="{{ popoverInstanceId }}"
48
- :data-state="dataState()"
49
- @stx:popover-toggle="onToggle($event)"
50
- @stx:popover-open="onOpen($event)"
51
- @stx:popover-close="onClose($event)"
52
- >
53
- <slot />
54
- </component>
55
-
56
- <style>
57
- [data-stx-popover][data-state="closed"] [data-stx-popover-panel] {
58
- display: none;
59
- }
60
- </style>