@stacksjs/components 0.2.368 → 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.
- package/dist/{Accordion-py9ntmst.stx → Accordion-ehpymjam.stx} +1 -1
- package/dist/{AccordionItem-asmsqxz9.stx → AccordionItem-fc4ekdqf.stx} +1 -1
- package/dist/{Button-tcjt3m8s.stx → Button-k2q6811a.stx} +1 -1
- package/dist/Combobox-9xh1jgjr.stx +266 -0
- package/dist/{ComboboxButton-g76stp1e.stx → ComboboxButton-4r6a45s1.stx} +8 -1
- package/dist/{ComboboxInput-4jcpvw7e.stx → ComboboxInput-1gyfpnca.stx} +4 -1
- package/dist/{ComboboxOption-vnb67p8d.stx → ComboboxOption-wkw70js7.stx} +27 -1
- package/dist/{ComboboxOptions-nbndbrxz.stx → ComboboxOptions-zhr9b6rx.stx} +1 -1
- package/dist/{CommandPalette-6rjcgske.stx → CommandPalette-vvaqtqat.stx} +3 -3
- package/dist/CommandPaletteItem-7290ce1z.stx +40 -0
- package/dist/{DefaultPaymentMethod-r0hcjajr.stx → DefaultPaymentMethod-ss3x61tr.stx} +1 -1
- package/dist/{Drawer-jcdj3qk2.stx → Drawer-hc0jjpsw.stx} +1 -1
- package/dist/Dropdown-25160tc6.stx +204 -0
- package/dist/{DropdownButton-tx9hb2de.stx → DropdownButton-wxc25hsy.stx} +3 -1
- package/dist/{DropdownItem-wht1vcm5.stx → DropdownItem-af0vzc8a.stx} +15 -1
- package/dist/{DropdownItems-v12h6zpf.stx → DropdownItems-bkz7jkyz.stx} +1 -1
- package/dist/Listbox-32gzxace.stx +273 -0
- package/dist/{ListboxButton-t43pp03e.stx → ListboxButton-gan8e3nw.stx} +3 -1
- package/dist/{ListboxOption-9c9jpz1n.stx → ListboxOption-gpaqvk3s.stx} +14 -1
- package/dist/{ListboxOptions-qxrkrb8z.stx → ListboxOptions-2928864k.stx} +1 -1
- package/dist/{Login-j3pc04ka.stx → Login-3dsk93vm.stx} +4 -4
- package/dist/{Notification-7wgk0sw6.stx → Notification-2ws4ym4s.stx} +2 -2
- package/dist/{Pagination-z9jxnaeq.stx → Pagination-330ybzf1.stx} +2 -2
- package/dist/Popover-9m42pym0.stx +101 -0
- package/dist/{PopoverButton-70th24xc.stx → PopoverButton-3w6550hv.stx} +2 -1
- package/dist/{PopoverPanel-7771yf35.stx → PopoverPanel-d84gk1w1.stx} +1 -1
- package/dist/{RadioGroup-hzz4xep9.stx → RadioGroup-smqcqgds.stx} +15 -2
- package/dist/{RadioGroupOption-7fcgfsah.stx → RadioGroupOption-twcw1b2a.stx} +14 -2
- package/dist/{Select-sbr8dqzn.stx → Select-danh680d.stx} +1 -1
- package/dist/{Signup-77y9ea7t.stx → Signup-dh96kskd.stx} +2 -2
- package/dist/{StepperStep-34kwv0t0.stx → StepperStep-b78wmshd.stx} +1 -1
- package/dist/{SubscriptionCheckout-pggq5a4k.stx → SubscriptionCheckout-n3btqrzk.stx} +2 -2
- package/dist/{Switch-fxbw7s16.stx → Switch-27hp6pq5.stx} +1 -1
- package/dist/{TabBarItem-wv2r8496.stx → TabBarItem-kddfnhk3.stx} +1 -1
- package/dist/{Tabs-51vr631j.stx → Tabs-f1n3ggkw.stx} +1 -1
- package/dist/{TwoFactorChallenge-28px8pyk.stx → TwoFactorChallenge-ete7yk9y.stx} +1 -1
- package/dist/index.js +7 -7
- package/package.json +3 -3
- package/src/components/Footer.stx +2 -2
- package/src/components/Hero.stx +1 -1
- package/src/ui/accordion/Accordion.stx +1 -1
- package/src/ui/accordion/AccordionItem.stx +1 -1
- package/src/ui/auth/Login.stx +4 -4
- package/src/ui/auth/Signup.stx +2 -2
- package/src/ui/auth/TwoFactorChallenge.stx +1 -1
- package/src/ui/button/Button.stx +1 -1
- package/src/ui/combobox/Combobox.stx +174 -4
- package/src/ui/combobox/ComboboxButton.stx +8 -1
- package/src/ui/combobox/ComboboxInput.stx +4 -1
- package/src/ui/combobox/ComboboxOption.stx +27 -1
- package/src/ui/combobox/ComboboxOptions.stx +1 -1
- package/src/ui/command-palette/CommandPalette.stx +3 -3
- package/src/ui/command-palette/CommandPaletteItem.stx +14 -1
- package/src/ui/drawer/Drawer.stx +1 -1
- package/src/ui/dropdown/Dropdown.stx +122 -0
- package/src/ui/dropdown/DropdownButton.stx +3 -1
- package/src/ui/dropdown/DropdownItem.stx +15 -1
- package/src/ui/dropdown/DropdownItems.stx +1 -1
- package/src/ui/listbox/Listbox.stx +175 -3
- package/src/ui/listbox/ListboxButton.stx +3 -1
- package/src/ui/listbox/ListboxOption.stx +14 -1
- package/src/ui/listbox/ListboxOptions.stx +1 -1
- package/src/ui/mobile/TabBarItem.stx +1 -1
- package/src/ui/notification/Notification.stx +2 -2
- package/src/ui/pagination/Pagination.stx +2 -2
- package/src/ui/payment/DefaultPaymentMethod.stx +1 -1
- package/src/ui/payment/SubscriptionCheckout.stx +2 -2
- package/src/ui/popover/Popover.stx +43 -2
- package/src/ui/popover/PopoverButton.stx +2 -1
- package/src/ui/popover/PopoverPanel.stx +1 -1
- package/src/ui/radio-group/RadioGroup.stx +15 -2
- package/src/ui/radio-group/RadioGroupOption.stx +14 -2
- package/src/ui/select/Select.stx +1 -1
- package/src/ui/stepper/StepperStep.stx +1 -1
- package/src/ui/switch/Switch.stx +1 -1
- package/src/ui/tabs/Tabs.stx +1 -1
- package/dist/Combobox-06x0nywb.stx +0 -96
- package/dist/CommandPaletteItem-6rp133ta.stx +0 -27
- package/dist/Dropdown-cmwge7vx.stx +0 -82
- package/dist/Listbox-e5jreb0a.stx +0 -101
- package/dist/Popover-3g8rgxt1.stx +0 -60
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const value = $props.value
|
|
3
|
-
export const className = $props.className || ''
|
|
4
|
-
export const as = $props.as || 'div'
|
|
5
|
-
|
|
6
|
-
const baseClasses = 'relative'
|
|
7
|
-
export const comboboxClasses = `${baseClasses} ${className}`.trim()
|
|
8
|
-
export const comboboxInstanceId = $uid
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<script client>
|
|
12
|
-
const emit = defineEmits()
|
|
13
|
-
const comboboxInstanceId = {{ comboboxInstanceId }}
|
|
14
|
-
const initialValue = {{ value === undefined ? 'null' : value }}
|
|
15
|
-
|
|
16
|
-
const isOpen = state(false)
|
|
17
|
-
const selected = state(initialValue)
|
|
18
|
-
const query = state('')
|
|
19
|
-
let rootEl = null
|
|
20
|
-
let outsideHandler = null
|
|
21
|
-
|
|
22
|
-
function isSelectedValue(v) {
|
|
23
|
-
return selected() === v
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function selectValue(v) {
|
|
27
|
-
selected.set(v)
|
|
28
|
-
isOpen.set(false)
|
|
29
|
-
syncOptionStates()
|
|
30
|
-
emit('change', v)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function syncOptionStates() {
|
|
34
|
-
if (!rootEl) return
|
|
35
|
-
const options = rootEl.querySelectorAll('[data-stx-combobox-option]')
|
|
36
|
-
for (const opt of options) {
|
|
37
|
-
const raw = opt.dataset.optionValue
|
|
38
|
-
let v
|
|
39
|
-
try { v = JSON.parse(raw ?? 'null') }
|
|
40
|
-
catch { v = raw }
|
|
41
|
-
const sel = isSelectedValue(v)
|
|
42
|
-
opt.setAttribute('aria-selected', sel ? 'true' : 'false')
|
|
43
|
-
opt.setAttribute('data-selected', sel ? 'true' : 'false')
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function open() { if (!isOpen()) { isOpen.set(true) } }
|
|
48
|
-
function close() { if (isOpen()) isOpen.set(false) }
|
|
49
|
-
function toggle() { isOpen() ? close() : open() }
|
|
50
|
-
|
|
51
|
-
function onToggle(event) { event.stopPropagation(); toggle() }
|
|
52
|
-
function onSelect(event) { event.stopPropagation(); selectValue(event.detail) }
|
|
53
|
-
function onQuery(event) {
|
|
54
|
-
event.stopPropagation()
|
|
55
|
-
query.set(event.detail)
|
|
56
|
-
if (!isOpen()) open()
|
|
57
|
-
emit('query', event.detail)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
onMount(() => {
|
|
61
|
-
rootEl = document.querySelector(`[data-combobox-id="${comboboxInstanceId}"]`)
|
|
62
|
-
syncOptionStates()
|
|
63
|
-
outsideHandler = (event) => {
|
|
64
|
-
if (!isOpen()) return
|
|
65
|
-
if (rootEl && !rootEl.contains(event.target)) close()
|
|
66
|
-
}
|
|
67
|
-
document.addEventListener('click', outsideHandler, true)
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
onDestroy(() => {
|
|
71
|
-
if (outsideHandler) document.removeEventListener('click', outsideHandler, true)
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
const dataState = derived(() => isOpen() ? 'open' : 'closed')
|
|
75
|
-
|
|
76
|
-
defineExpose({ isOpen, selected, query, toggle, open, close, selectValue })
|
|
77
|
-
</script>
|
|
78
|
-
|
|
79
|
-
<component
|
|
80
|
-
:is="{{ as }}"
|
|
81
|
-
class="{{ comboboxClasses }}"
|
|
82
|
-
data-stx-combobox
|
|
83
|
-
data-combobox-id="{{ comboboxInstanceId }}"
|
|
84
|
-
:data-state="dataState()"
|
|
85
|
-
@stx:combobox-toggle="onToggle($event)"
|
|
86
|
-
@stx:combobox-select="onSelect($event)"
|
|
87
|
-
@stx:combobox-query="onQuery($event)"
|
|
88
|
-
>
|
|
89
|
-
<slot />
|
|
90
|
-
</component>
|
|
91
|
-
|
|
92
|
-
<style>
|
|
93
|
-
[data-stx-combobox][data-state="closed"] [data-stx-combobox-options] {
|
|
94
|
-
display: none;
|
|
95
|
-
}
|
|
96
|
-
</style>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const className = $props.className || ''
|
|
3
|
-
export const value = $props.value
|
|
4
|
-
|
|
5
|
-
const baseClasses = 'flex cursor-pointer select-none items-center px-4 py-2 text-fg hover:bg-accent-solid hover:text-accent-ink'
|
|
6
|
-
export const itemClasses = `${baseClasses} ${className}`.trim()
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<script client>
|
|
10
|
-
const emit = defineEmits()
|
|
11
|
-
const itemValue = {{ value === undefined ? 'null' : value }}
|
|
12
|
-
|
|
13
|
-
function onClick(event) {
|
|
14
|
-
emit('click', event)
|
|
15
|
-
event.currentTarget.dispatchEvent(
|
|
16
|
-
new CustomEvent('stx:command-select', { bubbles: true, detail: itemValue }),
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<div
|
|
22
|
-
class="{{ itemClasses }}"
|
|
23
|
-
data-stx-command-item
|
|
24
|
-
@click="onClick($event)"
|
|
25
|
-
>
|
|
26
|
-
<slot />
|
|
27
|
-
</div>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
export const className = $props.className || ''
|
|
3
|
-
export const as = $props.as || 'div'
|
|
4
|
-
|
|
5
|
-
const baseClasses = 'relative inline-block text-left'
|
|
6
|
-
export const dropdownClasses = `${baseClasses} ${className}`.trim()
|
|
7
|
-
export const dropdownInstanceId = $uid
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<script client>
|
|
11
|
-
const emit = defineEmits()
|
|
12
|
-
const dropdownInstanceId = {{ dropdownInstanceId }}
|
|
13
|
-
const isOpen = state(false)
|
|
14
|
-
let rootEl = null
|
|
15
|
-
let outsideHandler = null
|
|
16
|
-
|
|
17
|
-
function toggle() {
|
|
18
|
-
isOpen.set(!isOpen())
|
|
19
|
-
emit('change', isOpen())
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function open() {
|
|
23
|
-
if (isOpen()) return
|
|
24
|
-
isOpen.set(true)
|
|
25
|
-
emit('change', true)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function close() {
|
|
29
|
-
if (!isOpen()) return
|
|
30
|
-
isOpen.set(false)
|
|
31
|
-
emit('change', false)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function onItemSelect(event) {
|
|
35
|
-
event.stopPropagation()
|
|
36
|
-
emit('select', event.detail)
|
|
37
|
-
close()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function onToggle(event) { event.stopPropagation(); toggle() }
|
|
41
|
-
function onOpen(event) { event.stopPropagation(); open() }
|
|
42
|
-
function onClose(event) { event.stopPropagation(); close() }
|
|
43
|
-
|
|
44
|
-
onMount(() => {
|
|
45
|
-
rootEl = document.querySelector(`[data-dropdown-id="${dropdownInstanceId}"]`)
|
|
46
|
-
outsideHandler = (event) => {
|
|
47
|
-
if (!isOpen()) return
|
|
48
|
-
if (rootEl && !rootEl.contains(event.target)) close()
|
|
49
|
-
}
|
|
50
|
-
document.addEventListener('click', outsideHandler, true)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
onDestroy(() => {
|
|
54
|
-
if (outsideHandler) document.removeEventListener('click', outsideHandler, true)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const dataState = derived(() => isOpen() ? 'open' : 'closed')
|
|
58
|
-
const dataExpanded = derived(() => isOpen() ? 'true' : 'false')
|
|
59
|
-
|
|
60
|
-
defineExpose({ isOpen, toggle, open, close })
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
<component
|
|
64
|
-
:is="{{ as }}"
|
|
65
|
-
class="{{ dropdownClasses }}"
|
|
66
|
-
data-stx-dropdown
|
|
67
|
-
data-dropdown-id="{{ dropdownInstanceId }}"
|
|
68
|
-
:data-state="dataState()"
|
|
69
|
-
:data-expanded="dataExpanded()"
|
|
70
|
-
@stx:dropdown-toggle="onToggle($event)"
|
|
71
|
-
@stx:dropdown-open="onOpen($event)"
|
|
72
|
-
@stx:dropdown-close="onClose($event)"
|
|
73
|
-
@stx:dropdown-select="onItemSelect($event)"
|
|
74
|
-
>
|
|
75
|
-
<slot />
|
|
76
|
-
</component>
|
|
77
|
-
|
|
78
|
-
<style>
|
|
79
|
-
[data-stx-dropdown][data-state="closed"] [data-stx-dropdown-items] {
|
|
80
|
-
display: none;
|
|
81
|
-
}
|
|
82
|
-
</style>
|
|
@@ -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>
|