compote-ui 0.79.2 → 0.80.0
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/components/data-table-v9/column-filter-editing.svelte.d.ts +41 -0
- package/dist/components/data-table-v9/column-filter-editing.svelte.js +88 -0
- package/dist/components/data-table-v9/column-filter-kind.d.ts +10 -0
- package/dist/components/data-table-v9/column-filter-kind.js +25 -0
- package/dist/components/data-table-v9/create-table.svelte.js +37 -25
- package/dist/components/data-table-v9/data-table-head.svelte +230 -201
- package/dist/components/data-table-v9/data-table-head.svelte.d.ts +2 -0
- package/dist/components/data-table-v9/data-table-utils.d.ts +7 -0
- package/dist/components/data-table-v9/data-table-utils.js +4 -0
- package/dist/components/data-table-v9/data-table.svelte +154 -151
- package/dist/components/data-table-v9/data-table.svelte.d.ts +2 -0
- package/dist/components/data-table-v9/date-cell.d.ts +13 -0
- package/dist/components/data-table-v9/date-cell.js +38 -0
- package/dist/components/data-table-v9/filter-editors/boolean-filter-editor.svelte +45 -0
- package/dist/components/data-table-v9/filter-editors/boolean-filter-editor.svelte.d.ts +7 -0
- package/dist/components/data-table-v9/filter-editors/column-filter-editor.svelte +33 -0
- package/dist/components/data-table-v9/filter-editors/column-filter-editor.svelte.d.ts +30 -0
- package/dist/components/data-table-v9/filter-editors/date-range-filter-editor.svelte +52 -0
- package/dist/components/data-table-v9/filter-editors/date-range-filter-editor.svelte.d.ts +28 -0
- package/dist/components/data-table-v9/filter-editors/range-filter-editor.svelte +51 -0
- package/dist/components/data-table-v9/filter-editors/range-filter-editor.svelte.d.ts +30 -0
- package/dist/components/data-table-v9/filter-editors/select-filter-editor.svelte +59 -0
- package/dist/components/data-table-v9/filter-editors/select-filter-editor.svelte.d.ts +28 -0
- package/dist/components/data-table-v9/filter-editors/text-filter-editor.svelte +20 -0
- package/dist/components/data-table-v9/filter-editors/text-filter-editor.svelte.d.ts +8 -0
- package/dist/components/data-table-v9/header/column-header-filter.svelte +66 -0
- package/dist/components/data-table-v9/header/column-header-filter.svelte.d.ts +30 -0
- package/dist/components/data-table-v9/table-view-state.svelte.d.ts +1 -0
- package/dist/components/data-table-v9/table-view-state.svelte.js +3 -0
- package/dist/components/data-table-v9/toolbar/data-table-column-filter.svelte +203 -459
- package/dist/components/data-table-v9/toolbar/data-table-column-filter.svelte.d.ts +1 -1
- package/dist/components/data-table-v9/virtual/data-table-virtualized.svelte +82 -79
- package/dist/components/data-table-v9/virtual/data-table-virtualized.svelte.d.ts +2 -0
- package/dist/components/dialog/alert-dialog.svelte +73 -71
- package/dist/components/dialog/dialog-root.svelte +45 -43
- package/dist/components/drawer/drawer-content.svelte +213 -211
- package/dist/components/popover/popover-content.svelte +97 -71
- package/dist/components/popover/popover-content.svelte.d.ts +2 -1
- package/dist/components/popover/popover-description.svelte +19 -15
- package/dist/components/popover/popover-labels.svelte.d.ts +18 -0
- package/dist/components/popover/popover-labels.svelte.js +35 -0
- package/dist/components/popover/popover-root.svelte +27 -24
- package/dist/components/popover/popover-title.svelte +19 -15
- package/dist/icons/PhFunnelFill.svelte +19 -0
- package/dist/icons/PhFunnelFill.svelte.d.ts +5 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/utils/date-filter.d.ts +31 -0
- package/dist/utils/date-filter.js +58 -0
- package/dist/utils/date.d.ts +19 -1
- package/dist/utils/date.js +48 -1
- package/dist/utils/release-focus-on-exit.d.ts +22 -0
- package/dist/utils/release-focus-on-exit.js +26 -0
- package/package.json +1 -1
- package/skills/component-usage/references/overlays-and-floating-ui.md +278 -273
- package/skills/data-table/SKILL.md +314 -283
- package/skills/data-table/references/column-options.md +175 -150
- package/skills/data-table/references/table-state-and-reactivity.md +65 -60
|
@@ -1,211 +1,213 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Drawer } from '@ark-ui/svelte/drawer';
|
|
3
|
-
import type { DrawerContentBaseProps } from '@ark-ui/svelte/drawer';
|
|
4
|
-
import type { ClassValue } from 'svelte/elements';
|
|
5
|
-
import { cn } from 'tailwind-variants';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'
|
|
31
|
-
'data-[state=
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
'data-[swipe-direction=
|
|
40
|
-
'data-[swipe-direction=
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
[data-scope='drawer'][data-part='content'][data-swipe-direction='
|
|
68
|
-
[data-scope='drawer'][data-part='grabber']
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
[data-scope='drawer'][data-part='content'][data-swipe-direction='
|
|
96
|
-
[data-scope='drawer'][data-part='grabber-indicator']
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
[data-scope='drawer'][data-part='content'][data-swipe-direction
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
animation-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
animation-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Drawer } from '@ark-ui/svelte/drawer';
|
|
3
|
+
import type { DrawerContentBaseProps } from '@ark-ui/svelte/drawer';
|
|
4
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
|
+
import { cn } from 'tailwind-variants';
|
|
6
|
+
import { releaseFocusOnExitProps } from '../../utils/release-focus-on-exit';
|
|
7
|
+
|
|
8
|
+
interface Props extends DrawerContentBaseProps {
|
|
9
|
+
class?: ClassValue;
|
|
10
|
+
backdropClass?: ClassValue;
|
|
11
|
+
positionerClass?: ClassValue;
|
|
12
|
+
maxWidth?: string;
|
|
13
|
+
maxHeight?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
class: className,
|
|
18
|
+
backdropClass,
|
|
19
|
+
positionerClass,
|
|
20
|
+
maxWidth,
|
|
21
|
+
maxHeight,
|
|
22
|
+
children,
|
|
23
|
+
draggable = false,
|
|
24
|
+
...rest
|
|
25
|
+
}: Props = $props();
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<Drawer.Backdrop
|
|
29
|
+
class={cn(
|
|
30
|
+
'fixed inset-0 z-50 bg-black/50',
|
|
31
|
+
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0',
|
|
32
|
+
'data-[state=open]:animate-in data-[state=open]:fade-in-0',
|
|
33
|
+
backdropClass
|
|
34
|
+
)}
|
|
35
|
+
/>
|
|
36
|
+
<Drawer.Positioner
|
|
37
|
+
class={cn(
|
|
38
|
+
'fixed inset-0 z-50 flex items-end justify-center',
|
|
39
|
+
'data-[swipe-direction=left]:items-stretch data-[swipe-direction=left]:justify-start',
|
|
40
|
+
'data-[swipe-direction=right]:items-stretch data-[swipe-direction=right]:justify-end',
|
|
41
|
+
'data-[swipe-direction=up]:items-start',
|
|
42
|
+
positionerClass
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<Drawer.Content
|
|
46
|
+
{...rest}
|
|
47
|
+
{draggable}
|
|
48
|
+
style={[
|
|
49
|
+
maxWidth && `--drawer-max-width:${maxWidth}`,
|
|
50
|
+
maxHeight && `--drawer-max-height:${maxHeight}`
|
|
51
|
+
]
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(';')}
|
|
54
|
+
class={cn(
|
|
55
|
+
'pointer-events-auto relative flex h-full w-full flex-col bg-surface-1 shadow-xl outline-none',
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
{...releaseFocusOnExitProps}
|
|
59
|
+
>
|
|
60
|
+
{@render children?.()}
|
|
61
|
+
</Drawer.Content>
|
|
62
|
+
</Drawer.Positioner>
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
/* Side drawers: grabber becomes an absolutely-positioned vertical strip on the open edge */
|
|
66
|
+
:global(
|
|
67
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='left']
|
|
68
|
+
[data-scope='drawer'][data-part='grabber'],
|
|
69
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='right']
|
|
70
|
+
[data-scope='drawer'][data-part='grabber']
|
|
71
|
+
) {
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
bottom: 0;
|
|
75
|
+
width: auto;
|
|
76
|
+
height: 100%;
|
|
77
|
+
padding: 0 0.75rem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:global(
|
|
81
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='left']
|
|
82
|
+
[data-scope='drawer'][data-part='grabber']
|
|
83
|
+
) {
|
|
84
|
+
right: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:global(
|
|
88
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='right']
|
|
89
|
+
[data-scope='drawer'][data-part='grabber']
|
|
90
|
+
) {
|
|
91
|
+
left: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:global(
|
|
95
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='left']
|
|
96
|
+
[data-scope='drawer'][data-part='grabber-indicator'],
|
|
97
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='right']
|
|
98
|
+
[data-scope='drawer'][data-part='grabber-indicator']
|
|
99
|
+
) {
|
|
100
|
+
width: 4px;
|
|
101
|
+
height: 2.5rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Bottom/top drawers: cap height, overridable via --drawer-max-height */
|
|
105
|
+
:global(
|
|
106
|
+
[data-scope='drawer'][data-part='content']:not([data-swipe-direction]),
|
|
107
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='down'],
|
|
108
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='up']
|
|
109
|
+
) {
|
|
110
|
+
max-height: var(--drawer-max-height, 96svh);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Side drawers: constrain width, remove height cap — overridable via --drawer-max-width */
|
|
114
|
+
:global(
|
|
115
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='left'],
|
|
116
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='right']
|
|
117
|
+
) {
|
|
118
|
+
max-width: var(--drawer-max-width, 25rem);
|
|
119
|
+
max-height: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Bleed pseudo-element so background extends past rounded corners on the open edge */
|
|
123
|
+
:global([data-scope='drawer'][data-part='content'])::after {
|
|
124
|
+
content: '';
|
|
125
|
+
position: absolute;
|
|
126
|
+
left: 0;
|
|
127
|
+
right: 0;
|
|
128
|
+
top: 100%;
|
|
129
|
+
height: 50px;
|
|
130
|
+
background: inherit;
|
|
131
|
+
pointer-events: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:global([data-scope='drawer'][data-part='content'][data-swipe-direction='up'])::after {
|
|
135
|
+
top: auto;
|
|
136
|
+
bottom: 100%;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:global([data-scope='drawer'][data-part='content'][data-swipe-direction='left'])::after {
|
|
140
|
+
top: 0;
|
|
141
|
+
bottom: 0;
|
|
142
|
+
left: auto;
|
|
143
|
+
right: 100%;
|
|
144
|
+
width: 50px;
|
|
145
|
+
height: auto;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:global([data-scope='drawer'][data-part='content'][data-swipe-direction='right'])::after {
|
|
149
|
+
top: 0;
|
|
150
|
+
bottom: 0;
|
|
151
|
+
right: auto;
|
|
152
|
+
left: 100%;
|
|
153
|
+
width: 50px;
|
|
154
|
+
height: auto;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:global([data-scope='drawer'][data-part='content'][data-state='open']) {
|
|
158
|
+
animation-name: enter;
|
|
159
|
+
animation-duration: 500ms;
|
|
160
|
+
animation-fill-mode: both;
|
|
161
|
+
}
|
|
162
|
+
:global([data-scope='drawer'][data-part='content'][data-state='closed']) {
|
|
163
|
+
animation-name: exit;
|
|
164
|
+
animation-duration: 300ms;
|
|
165
|
+
animation-fill-mode: both;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
:global(
|
|
169
|
+
[data-scope='drawer'][data-part='content']:not([data-swipe-direction])[data-state='open'],
|
|
170
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='down'][data-state='open']
|
|
171
|
+
) {
|
|
172
|
+
--tw-enter-translate-y: 100%;
|
|
173
|
+
}
|
|
174
|
+
:global(
|
|
175
|
+
[data-scope='drawer'][data-part='content']:not([data-swipe-direction])[data-state='closed'],
|
|
176
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='down'][data-state='closed']
|
|
177
|
+
) {
|
|
178
|
+
--tw-exit-translate-y: 100%;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:global(
|
|
182
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='up'][data-state='open']
|
|
183
|
+
) {
|
|
184
|
+
--tw-enter-translate-y: -100%;
|
|
185
|
+
}
|
|
186
|
+
:global(
|
|
187
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='up'][data-state='closed']
|
|
188
|
+
) {
|
|
189
|
+
--tw-exit-translate-y: -100%;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:global(
|
|
193
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='left'][data-state='open']
|
|
194
|
+
) {
|
|
195
|
+
--tw-enter-translate-x: -100%;
|
|
196
|
+
}
|
|
197
|
+
:global(
|
|
198
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='left'][data-state='closed']
|
|
199
|
+
) {
|
|
200
|
+
--tw-exit-translate-x: -100%;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
:global(
|
|
204
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='right'][data-state='open']
|
|
205
|
+
) {
|
|
206
|
+
--tw-enter-translate-x: 100%;
|
|
207
|
+
}
|
|
208
|
+
:global(
|
|
209
|
+
[data-scope='drawer'][data-part='content'][data-swipe-direction='right'][data-state='closed']
|
|
210
|
+
) {
|
|
211
|
+
--tw-exit-translate-x: 100%;
|
|
212
|
+
}
|
|
213
|
+
</style>
|
|
@@ -1,71 +1,97 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Popover } from '@ark-ui/svelte/popover';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Popover, usePopoverContext } from '@ark-ui/svelte/popover';
|
|
3
|
+
import type { PopoverContentProps } from '@ark-ui/svelte/popover';
|
|
4
|
+
import { Portal } from '@ark-ui/svelte/portal';
|
|
5
|
+
import { cn } from 'tailwind-variants';
|
|
6
|
+
import { releaseFocusOnExitProps } from '../../utils/release-focus-on-exit';
|
|
7
|
+
import type { ClassValue } from 'svelte/elements';
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
import { getPopoverLabels } from './popover-labels.svelte';
|
|
10
|
+
|
|
11
|
+
interface Props extends Omit<PopoverContentProps, 'class' | 'children'> {
|
|
12
|
+
class?: ClassValue;
|
|
13
|
+
children: Snippet;
|
|
14
|
+
showArrow?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
class: className,
|
|
19
|
+
children,
|
|
20
|
+
showArrow = true,
|
|
21
|
+
'aria-labelledby': ariaLabelledby,
|
|
22
|
+
'aria-describedby': ariaDescribedby,
|
|
23
|
+
...rest
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
const popover = usePopoverContext();
|
|
27
|
+
const labels = getPopoverLabels();
|
|
28
|
+
|
|
29
|
+
// Explicit labelling wins; otherwise link the Title / Description rendered inside.
|
|
30
|
+
const labelledby = $derived(
|
|
31
|
+
ariaLabelledby ??
|
|
32
|
+
(labels?.hasTitle && !rest['aria-label'] ? popover().getTitleProps().id : undefined)
|
|
33
|
+
);
|
|
34
|
+
const describedby = $derived(
|
|
35
|
+
ariaDescribedby ?? (labels?.hasDescription ? popover().getDescriptionProps().id : undefined)
|
|
36
|
+
);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<Portal>
|
|
40
|
+
<Popover.Positioner>
|
|
41
|
+
<Popover.Content
|
|
42
|
+
{...rest}
|
|
43
|
+
aria-labelledby={labelledby}
|
|
44
|
+
aria-describedby={describedby}
|
|
45
|
+
class={cn(
|
|
46
|
+
'z-50 w-72 rounded-md border bg-surface-document p-4 shadow-md outline-none [--arrow-background:var(--compote-surface-1)] [--arrow-size:10px]',
|
|
47
|
+
'data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',
|
|
48
|
+
'data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95',
|
|
49
|
+
className
|
|
50
|
+
)}
|
|
51
|
+
{...releaseFocusOnExitProps}
|
|
52
|
+
>
|
|
53
|
+
{#if showArrow}
|
|
54
|
+
<Popover.Arrow>
|
|
55
|
+
<Popover.ArrowTip class="border-t border-l border-border" />
|
|
56
|
+
</Popover.Arrow>
|
|
57
|
+
{/if}
|
|
58
|
+
{@render children()}
|
|
59
|
+
</Popover.Content>
|
|
60
|
+
</Popover.Positioner>
|
|
61
|
+
</Portal>
|
|
62
|
+
|
|
63
|
+
<style>
|
|
64
|
+
:global([data-scope='popover'][data-part='content']) {
|
|
65
|
+
transform-origin: var(--transform-origin);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:global([data-scope='popover'][data-part='content'][data-state='open']) {
|
|
69
|
+
animation: popover-in 150ms ease-out;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global([data-scope='popover'][data-part='content'][data-state='closed']) {
|
|
73
|
+
animation: popover-out 100ms ease-in;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes popover-in {
|
|
77
|
+
from {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
transform: scale(0.95);
|
|
80
|
+
}
|
|
81
|
+
to {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
transform: scale(1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@keyframes popover-out {
|
|
88
|
+
from {
|
|
89
|
+
opacity: 1;
|
|
90
|
+
transform: scale(1);
|
|
91
|
+
}
|
|
92
|
+
to {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
transform: scale(0.95);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { PopoverContentProps } from '@ark-ui/svelte/popover';
|
|
1
2
|
import type { ClassValue } from 'svelte/elements';
|
|
2
3
|
import type { Snippet } from 'svelte';
|
|
3
|
-
interface Props {
|
|
4
|
+
interface Props extends Omit<PopoverContentProps, 'class' | 'children'> {
|
|
4
5
|
class?: ClassValue;
|
|
5
6
|
children: Snippet;
|
|
6
7
|
showArrow?: boolean;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Popover } from '@ark-ui/svelte/popover';
|
|
3
|
-
import type { PopoverDescriptionBaseProps } from '@ark-ui/svelte/popover';
|
|
4
|
-
import type { ClassValue } from 'svelte/elements';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Popover } from '@ark-ui/svelte/popover';
|
|
3
|
+
import type { PopoverDescriptionBaseProps } from '@ark-ui/svelte/popover';
|
|
4
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
|
+
import { getPopoverLabels } from './popover-labels.svelte';
|
|
6
|
+
|
|
7
|
+
interface Props extends PopoverDescriptionBaseProps {
|
|
8
|
+
class?: ClassValue;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { class: className, children, ...rest }: Props = $props();
|
|
12
|
+
|
|
13
|
+
const labels = getPopoverLabels();
|
|
14
|
+
$effect(() => labels?.registerDescription());
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Popover.Description {...rest} class={className ?? 'mt-1 text-sm text-ink-dim'}>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
</Popover.Description>
|