@poirazis/supercomponents-shared 0.0.1
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/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/index.js +30635 -0
- package/dist/index.umd.cjs +12 -0
- package/dist/style.css +1 -0
- package/package.json +117 -0
- package/src/index.js +29 -0
- package/src/index.ts +31 -0
- package/src/lib/Actions/autoresize_textarea.js +14 -0
- package/src/lib/Actions/click_outside.js +80 -0
- package/src/lib/Actions/index.js +4 -0
- package/src/lib/Actions/position_dropdown.js +129 -0
- package/src/lib/SuperButton/SuperButton.svelte +341 -0
- package/src/lib/SuperFieldLabel/SuperFieldLabel.svelte +91 -0
- package/src/lib/SuperFieldsCommon.css +54 -0
- package/src/lib/SuperList/SuperList.svelte +308 -0
- package/src/lib/SuperList/drag-handle.svelte +31 -0
- package/src/lib/SuperPopover/SuperPopover.svelte +134 -0
- package/src/lib/SuperTable/SuperTable.css +410 -0
- package/src/lib/SuperTable/SuperTable.svelte +1332 -0
- package/src/lib/SuperTable/constants.js +85 -0
- package/src/lib/SuperTable/controls/ColumnsSection.svelte +34 -0
- package/src/lib/SuperTable/controls/ControlSection.svelte +3 -0
- package/src/lib/SuperTable/controls/RowButtonsColumn.svelte +169 -0
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +174 -0
- package/src/lib/SuperTable/controls/SuperTableWelcome.svelte +58 -0
- package/src/lib/SuperTable/overlays/AddNewRowOverlay.svelte +52 -0
- package/src/lib/SuperTable/overlays/EmptyResultSetOverlay.svelte +13 -0
- package/src/lib/SuperTable/overlays/LoadingOverlay.svelte +3 -0
- package/src/lib/SuperTable/overlays/RowContextMenu copy.svelte +57 -0
- package/src/lib/SuperTable/overlays/RowContextMenu.svelte +58 -0
- package/src/lib/SuperTable/overlays/ScrollbarsOverlay.svelte +184 -0
- package/src/lib/SuperTable/overlays/SelectedActionsOverlay.svelte +64 -0
- package/src/lib/SuperTable/state/API.js +0 -0
- package/src/lib/SuperTable/state/SuperTableStateMachine.js +0 -0
- package/src/lib/SuperTable/types.js +0 -0
- package/src/lib/SuperTableCells/CellAttachment.svelte +288 -0
- package/src/lib/SuperTableCells/CellBoolean.svelte +158 -0
- package/src/lib/SuperTableCells/CellColor.svelte +460 -0
- package/src/lib/SuperTableCells/CellCommon.css +319 -0
- package/src/lib/SuperTableCells/CellDatetime.svelte +180 -0
- package/src/lib/SuperTableCells/CellIcon.svelte +627 -0
- package/src/lib/SuperTableCells/CellJSON.svelte +297 -0
- package/src/lib/SuperTableCells/CellLink.svelte +274 -0
- package/src/lib/SuperTableCells/CellLinkAdvanced.svelte +298 -0
- package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +355 -0
- package/src/lib/SuperTableCells/CellLinkPickerTable.svelte +91 -0
- package/src/lib/SuperTableCells/CellLinkPickerTree.svelte +226 -0
- package/src/lib/SuperTableCells/CellNumber.svelte +179 -0
- package/src/lib/SuperTableCells/CellNumberSimple.svelte +56 -0
- package/src/lib/SuperTableCells/CellOptions.svelte +631 -0
- package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +684 -0
- package/src/lib/SuperTableCells/CellSkeleton.svelte +59 -0
- package/src/lib/SuperTableCells/CellString.svelte +178 -0
- package/src/lib/SuperTableCells/CellStringSimple.svelte +55 -0
- package/src/lib/SuperTableCells/index.js +21 -0
- package/src/lib/SuperTableCells/remixIcons.js +6772 -0
- package/src/lib/SuperTableColumn/SuperTableColumn.svelte +392 -0
- package/src/lib/SuperTableColumn/index.js +9 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnBody.svelte +57 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnFooter.svelte +14 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +228 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +142 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnRowNew.svelte +34 -0
- package/src/lib/SuperTree/SuperTree.svelte +117 -0
- package/src/types/svelte-portal.d.ts +1 -0
@@ -0,0 +1,308 @@
|
|
1
|
+
<script>
|
2
|
+
import { dndzone } from "svelte-dnd-action";
|
3
|
+
import { createEventDispatcher } from "svelte";
|
4
|
+
import { generate } from "shortid";
|
5
|
+
import { writable, get } from "svelte/store";
|
6
|
+
|
7
|
+
export let items = [];
|
8
|
+
export let itemsColors = [];
|
9
|
+
export let itemsLabels = [];
|
10
|
+
|
11
|
+
export let showColors;
|
12
|
+
export let showHandle = true;
|
13
|
+
export let listItemKey;
|
14
|
+
export const listItemText = "primaryDisplay"; // Changed to const as it was unused
|
15
|
+
export let draggable = true;
|
16
|
+
export let focus;
|
17
|
+
export let editorState;
|
18
|
+
export const cellState = undefined; // Changed to const as it was unused
|
19
|
+
export let reorderOnly;
|
20
|
+
export let placeholder;
|
21
|
+
export let fullSelection;
|
22
|
+
export let readonly;
|
23
|
+
|
24
|
+
let zoneType = generate();
|
25
|
+
|
26
|
+
let store = writable({
|
27
|
+
selected: null,
|
28
|
+
actions: {
|
29
|
+
select: (id) => {
|
30
|
+
store.update((state) => ({
|
31
|
+
...state,
|
32
|
+
selected: id,
|
33
|
+
}));
|
34
|
+
},
|
35
|
+
},
|
36
|
+
});
|
37
|
+
|
38
|
+
$: if (focus && store) {
|
39
|
+
get(store).actions.select(focus);
|
40
|
+
}
|
41
|
+
|
42
|
+
$: inEdit = !readonly;
|
43
|
+
$: showHandle = draggable && inEdit;
|
44
|
+
$: isEmpty = draggableItems?.length < 1;
|
45
|
+
|
46
|
+
const dispatch = createEventDispatcher();
|
47
|
+
|
48
|
+
let anchors = {};
|
49
|
+
let draggableItems = [];
|
50
|
+
|
51
|
+
// Used for controlling cursor behaviour in order to limit drag behaviour
|
52
|
+
// to the drag handle
|
53
|
+
export let inactive = true;
|
54
|
+
|
55
|
+
const buildDraggable = (items) => {
|
56
|
+
return items
|
57
|
+
.map((item) => {
|
58
|
+
return {
|
59
|
+
id: listItemKey ? item[listItemKey] : generate(),
|
60
|
+
color: itemsColors[item],
|
61
|
+
item,
|
62
|
+
type: zoneType,
|
63
|
+
};
|
64
|
+
})
|
65
|
+
.filter((item) => item.id);
|
66
|
+
};
|
67
|
+
|
68
|
+
$: draggableItems = buildDraggable(items);
|
69
|
+
|
70
|
+
const updateRowOrder = (e) => {
|
71
|
+
draggableItems = e.detail.items;
|
72
|
+
};
|
73
|
+
|
74
|
+
const serialiseUpdate = () => {
|
75
|
+
return draggableItems.reduce((acc, ele) => {
|
76
|
+
acc.push(ele.item);
|
77
|
+
return acc;
|
78
|
+
}, []);
|
79
|
+
};
|
80
|
+
|
81
|
+
const handleFinalize = (e) => {
|
82
|
+
inactive = true;
|
83
|
+
updateRowOrder(e);
|
84
|
+
dispatch("change", serialiseUpdate());
|
85
|
+
};
|
86
|
+
|
87
|
+
const onItemChanged = (e) => {
|
88
|
+
dispatch("itemChange", e.detail);
|
89
|
+
};
|
90
|
+
|
91
|
+
const removeItem = (id) => {
|
92
|
+
let index = draggableItems.findIndex((item) => item.id == id);
|
93
|
+
if (index > -1) {
|
94
|
+
draggableItems.splice(index, 1);
|
95
|
+
dispatch("change", serialiseUpdate());
|
96
|
+
}
|
97
|
+
};
|
98
|
+
</script>
|
99
|
+
|
100
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
101
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
102
|
+
<!-- svelte-ignore a11y-no-noninteractive-element-interactions-->
|
103
|
+
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
104
|
+
<ul
|
105
|
+
class="list-wrap"
|
106
|
+
class:inEdit
|
107
|
+
use:dndzone={{
|
108
|
+
items: draggableItems,
|
109
|
+
dropTargetStyle: { outline: "none" },
|
110
|
+
dragDisabled: !draggable || inactive,
|
111
|
+
type: zoneType,
|
112
|
+
dropFromOthersDisabled: true,
|
113
|
+
}}
|
114
|
+
on:finalize={handleFinalize}
|
115
|
+
on:consider={updateRowOrder}
|
116
|
+
>
|
117
|
+
{#each draggableItems as draggableItem, idx (draggableItem.id)}
|
118
|
+
<li
|
119
|
+
on:click={() => {
|
120
|
+
get(store).actions.select(draggableItem.id);
|
121
|
+
}}
|
122
|
+
bind:this={anchors[draggableItem.id]}
|
123
|
+
>
|
124
|
+
{#if showHandle}
|
125
|
+
<div
|
126
|
+
class="handle"
|
127
|
+
class:inEdit
|
128
|
+
aria-label="drag-handle"
|
129
|
+
style={!inactive ? "cursor:grabbing" : "cursor:grab"}
|
130
|
+
on:mousedown={() => {
|
131
|
+
inactive = false;
|
132
|
+
}}
|
133
|
+
on:mouseup={() => {
|
134
|
+
inactive = true;
|
135
|
+
}}
|
136
|
+
>
|
137
|
+
<svg
|
138
|
+
xmlns="http://www.w3.org/2000/svg"
|
139
|
+
viewBox="0 0 24 24"
|
140
|
+
width="14"
|
141
|
+
height="18"
|
142
|
+
><path
|
143
|
+
d="M8.5 7C9.32843 7 10 6.32843 10 5.5C10 4.67157 9.32843 4 8.5 4C7.67157 4 7 4.67157 7 5.5C7 6.32843 7.67157 7 8.5 7ZM8.5 13.5C9.32843 13.5 10 12.8284 10 12C10 11.1716 9.32843 10.5 8.5 10.5C7.67157 10.5 7 11.1716 7 12C7 12.8284 7.67157 13.5 8.5 13.5ZM10 18.5C10 19.3284 9.32843 20 8.5 20C7.67157 20 7 19.3284 7 18.5C7 17.6716 7.67157 17 8.5 17C9.32843 17 10 17.6716 10 18.5ZM15.5 7C16.3284 7 17 6.32843 17 5.5C17 4.67157 16.3284 4 15.5 4C14.6716 4 14 4.67157 14 5.5C14 6.32843 14.6716 7 15.5 7ZM17 12C17 12.8284 16.3284 13.5 15.5 13.5C14.6716 13.5 14 12.8284 14 12C14 11.1716 14.6716 10.5 15.5 10.5C16.3284 10.5 17 11.1716 17 12ZM15.5 20C16.3284 20 17 19.3284 17 18.5C17 17.6716 16.3284 17 15.5 17C14.6716 17 14 17.6716 14 18.5C14 19.3284 14.6716 20 15.5 20Z"
|
144
|
+
></path></svg
|
145
|
+
>
|
146
|
+
</div>
|
147
|
+
{/if}
|
148
|
+
<div
|
149
|
+
class="right-content"
|
150
|
+
class:showColors
|
151
|
+
style:--option-color={itemsColors[draggableItem.item]}
|
152
|
+
>
|
153
|
+
<i class="ri-checkbox-blank-fill" />
|
154
|
+
{itemsLabels[draggableItem.item] || draggableItem.item}
|
155
|
+
</div>
|
156
|
+
{#if !reorderOnly && inEdit}
|
157
|
+
<i
|
158
|
+
class="ri-close-line"
|
159
|
+
on:mousedown|preventDefault={() => removeItem(draggableItem.id)}
|
160
|
+
/>
|
161
|
+
{/if}
|
162
|
+
</li>
|
163
|
+
{/each}
|
164
|
+
|
165
|
+
{#if inEdit && !reorderOnly}
|
166
|
+
<li class="buttons" class:inEdit>
|
167
|
+
<div
|
168
|
+
class="add-button"
|
169
|
+
class:disabled={fullSelection}
|
170
|
+
on:click|preventDefault={() => dispatch("togglePicker")}
|
171
|
+
>
|
172
|
+
{$editorState == "Closed"
|
173
|
+
? fullSelection
|
174
|
+
? "All Selected"
|
175
|
+
: "Select"
|
176
|
+
: "Close"}
|
177
|
+
</div>
|
178
|
+
{#if draggableItems.length}
|
179
|
+
<div
|
180
|
+
class="clear-button"
|
181
|
+
on:click|preventDefault={() => dispatch("clear")}
|
182
|
+
>
|
183
|
+
Clear
|
184
|
+
</div>
|
185
|
+
{/if}
|
186
|
+
</li>
|
187
|
+
{:else if items.length < 1}
|
188
|
+
<li class="buttons">
|
189
|
+
<div class="add-button placeholder">{placeholder}</div>
|
190
|
+
</li>
|
191
|
+
{/if}
|
192
|
+
</ul>
|
193
|
+
|
194
|
+
<style>
|
195
|
+
.list-wrap {
|
196
|
+
list-style-type: none;
|
197
|
+
margin: 0;
|
198
|
+
padding: 0;
|
199
|
+
width: 100%;
|
200
|
+
border-radius: 4px;
|
201
|
+
}
|
202
|
+
.list-wrap > li:not(.buttons) {
|
203
|
+
background-color: transparent;
|
204
|
+
transition: background-color ease-in-out 130ms;
|
205
|
+
display: flex;
|
206
|
+
align-items: center;
|
207
|
+
border-bottom: 1px solid var(--spectrum-global-color-gray-200);
|
208
|
+
}
|
209
|
+
.list-wrap.inEdit > li:hover {
|
210
|
+
background-color: var(
|
211
|
+
--spectrum-table-row-background-color-hover,
|
212
|
+
var(--spectrum-alias-highlight-hover)
|
213
|
+
);
|
214
|
+
cursor: pointer;
|
215
|
+
}
|
216
|
+
.list-wrap > li:first-child {
|
217
|
+
border-top-left-radius: 4px;
|
218
|
+
border-top-right-radius: 4px;
|
219
|
+
}
|
220
|
+
.list-wrap > li:last-child {
|
221
|
+
border-bottom-left-radius: 4px;
|
222
|
+
border-bottom-right-radius: 4px;
|
223
|
+
border-bottom: 0px;
|
224
|
+
}
|
225
|
+
.right-content {
|
226
|
+
flex: 1;
|
227
|
+
min-width: 0;
|
228
|
+
display: flex;
|
229
|
+
align-items: center;
|
230
|
+
gap: 0.5rem;
|
231
|
+
|
232
|
+
&.showColors {
|
233
|
+
& > i {
|
234
|
+
display: block;
|
235
|
+
color: var(--option-color);
|
236
|
+
font-size: 16px;
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
& > i {
|
241
|
+
display: none;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
li.buttons {
|
245
|
+
display: flex;
|
246
|
+
padding: unset !important;
|
247
|
+
color: var(--spectrum-global-color-gray-500);
|
248
|
+
|
249
|
+
&.inEdit {
|
250
|
+
color: var(--spectrum-global-color-gray-700);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
li.buttons:hover {
|
254
|
+
background-color: transparent !important;
|
255
|
+
}
|
256
|
+
i:hover {
|
257
|
+
cursor: pointer;
|
258
|
+
}
|
259
|
+
.add-button {
|
260
|
+
flex: 1;
|
261
|
+
min-width: 0;
|
262
|
+
display: flex;
|
263
|
+
justify-content: center;
|
264
|
+
align-items: center;
|
265
|
+
|
266
|
+
&.disabled {
|
267
|
+
background-color: var(--spectrum-global-color-gray-200);
|
268
|
+
color: var(--spectrum-global-color-gray-500);
|
269
|
+
}
|
270
|
+
&.placeholder {
|
271
|
+
font-style: italic;
|
272
|
+
color: var(--spectrum-global-color-gray-500);
|
273
|
+
}
|
274
|
+
}
|
275
|
+
.clear-button {
|
276
|
+
flex: 1;
|
277
|
+
min-width: 0;
|
278
|
+
display: flex;
|
279
|
+
justify-content: center;
|
280
|
+
align-items: center;
|
281
|
+
border-left: 1px solid var(--spectrum-global-color-gray-300);
|
282
|
+
}
|
283
|
+
.clear-button:hover {
|
284
|
+
color: var(--spectrum-global-color-red-500);
|
285
|
+
cursor: pointer;
|
286
|
+
}
|
287
|
+
.list-wrap li {
|
288
|
+
padding-left: var(--spacing-s);
|
289
|
+
padding-right: var(--spacing-s);
|
290
|
+
line-height: 1.85rem;
|
291
|
+
|
292
|
+
&:focus {
|
293
|
+
outline: none;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
.handle > svg:hover {
|
297
|
+
cursor: grab;
|
298
|
+
}
|
299
|
+
|
300
|
+
.handle {
|
301
|
+
display: flex;
|
302
|
+
min-width: 1.5rem;
|
303
|
+
align-items: center;
|
304
|
+
color: var(--spectrum-global-color-gray-500);
|
305
|
+
fill: var(--spectrum-global-color-gray-700);
|
306
|
+
font-size: 14px;
|
307
|
+
}
|
308
|
+
</style>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<svg
|
2
|
+
class="drag-handle spectrum-Icon spectrum-Icon--sizeS"
|
3
|
+
focusable="false"
|
4
|
+
aria-hidden="true"
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
6
|
+
>
|
7
|
+
<path
|
8
|
+
d="m1,11c0.55228,0 1,-0.4477 1,-1c0,-0.5523 -0.44772,-1 -1,-1c-0.55228,0 -1,0.4477 -1,1c0,0.5523 0.44772,1 1,1z"
|
9
|
+
/>
|
10
|
+
<path
|
11
|
+
d="m1,8c0.55228,0 1,-0.4477 1,-1c0,-0.55228 -0.44772,-1 -1,-1c-0.55228,0 -1,0.44772 -1,1c0,0.5523 0.44772,1 1,1z"
|
12
|
+
/>
|
13
|
+
<path
|
14
|
+
d="m1,5c0.55228,0 1,-0.44772 1,-1c0,-0.55228 -0.44772,-1 -1,-1c-0.55228,0 -1,0.44772 -1,1c0,0.55228 0.44772,1 1,1z"
|
15
|
+
/>
|
16
|
+
<path
|
17
|
+
d="m1,2c0.55228,0 1,-0.44772 1,-1c0,-0.55228 -0.44772,-1 -1,-1c-0.55228,0 -1,0.44772 -1,1c0,0.55228 0.44772,1 1,1z"
|
18
|
+
/>
|
19
|
+
<path
|
20
|
+
d="m4,11c0.5523,0 1,-0.4477 1,-1c0,-0.5523 -0.4477,-1 -1,-1c-0.55228,0 -1,0.4477 -1,1c0,0.5523 0.44772,1 1,1z"
|
21
|
+
/>
|
22
|
+
<path
|
23
|
+
d="m4,8c0.5523,0 1,-0.4477 1,-1c0,-0.55228 -0.4477,-1 -1,-1c-0.55228,0 -1,0.44772 -1,1c0,0.5523 0.44772,1 1,1z"
|
24
|
+
/>
|
25
|
+
<path
|
26
|
+
d="m4,5c0.5523,0 1,-0.44772 1,-1c0,-0.55228 -0.4477,-1 -1,-1c-0.55228,0 -1,0.44772 -1,1c0,0.55228 0.44772,1 1,1z"
|
27
|
+
/>
|
28
|
+
<path
|
29
|
+
d="m4,2c0.5523,0 1,-0.44772 1,-1c0,-0.55228 -0.4477,-1 -1,-1c-0.55228,0 -1,0.44772 -1,1c0,0.55228 0.44772,1 1,1z"
|
30
|
+
/>
|
31
|
+
</svg>
|
@@ -0,0 +1,134 @@
|
|
1
|
+
<script>
|
2
|
+
import Portal from "svelte-portal";
|
3
|
+
import { createEventDispatcher, getContext } from "svelte";
|
4
|
+
import positionDropdown from "../Actions/position_dropdown";
|
5
|
+
import clickOutside from "../Actions/click_outside";
|
6
|
+
import { fly } from "svelte/transition";
|
7
|
+
|
8
|
+
const dispatch = createEventDispatcher();
|
9
|
+
|
10
|
+
export let anchor;
|
11
|
+
export let align = "right";
|
12
|
+
export let portalTarget;
|
13
|
+
export let minWidth;
|
14
|
+
export let maxWidth;
|
15
|
+
export let maxHeight;
|
16
|
+
export let open = false;
|
17
|
+
export let useAnchorWidth = false;
|
18
|
+
export let dismissible = true;
|
19
|
+
export let offset = 5;
|
20
|
+
export let offsetBelow;
|
21
|
+
export let customHeight;
|
22
|
+
export let animate = true;
|
23
|
+
export let customZindex;
|
24
|
+
|
25
|
+
export let handlePositionUpdate;
|
26
|
+
export let showPopover = true;
|
27
|
+
export let clickOutsideOverride = false;
|
28
|
+
|
29
|
+
export let ignoreAnchor = false;
|
30
|
+
|
31
|
+
export let popup;
|
32
|
+
|
33
|
+
export let className;
|
34
|
+
|
35
|
+
$: target = portalTarget || ".spectrum";
|
36
|
+
|
37
|
+
export const show = () => {
|
38
|
+
dispatch("open");
|
39
|
+
open = true;
|
40
|
+
};
|
41
|
+
|
42
|
+
export const hide = () => {
|
43
|
+
dispatch("close");
|
44
|
+
open = false;
|
45
|
+
};
|
46
|
+
|
47
|
+
export const toggle = () => {
|
48
|
+
if (!open) {
|
49
|
+
show();
|
50
|
+
} else {
|
51
|
+
hide();
|
52
|
+
}
|
53
|
+
};
|
54
|
+
|
55
|
+
export const hasFocus = () => {
|
56
|
+
return viewport.matches(":focus-within");
|
57
|
+
};
|
58
|
+
|
59
|
+
const handleOutsideClick = (e) => {
|
60
|
+
if (clickOutsideOverride) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
if (open) {
|
64
|
+
// Stop propagation if the source is the anchor
|
65
|
+
let node = e.target;
|
66
|
+
let fromAnchor = false;
|
67
|
+
while (!fromAnchor && node && node.parentNode) {
|
68
|
+
fromAnchor = node === anchor;
|
69
|
+
node = node.parentNode;
|
70
|
+
}
|
71
|
+
// Hide the popover
|
72
|
+
if (!fromAnchor || (fromAnchor && !ignoreAnchor)) hide();
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
function handleEscape(e) {
|
77
|
+
if (!clickOutsideOverride) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
if (open && e.key === "Escape") {
|
81
|
+
hide();
|
82
|
+
}
|
83
|
+
}
|
84
|
+
</script>
|
85
|
+
|
86
|
+
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
87
|
+
{#if open}
|
88
|
+
<Portal {target}>
|
89
|
+
<div
|
90
|
+
tabindex="0"
|
91
|
+
bind:this={popup}
|
92
|
+
use:positionDropdown={{
|
93
|
+
anchor,
|
94
|
+
align,
|
95
|
+
maxHeight,
|
96
|
+
maxWidth,
|
97
|
+
minWidth,
|
98
|
+
useAnchorWidth,
|
99
|
+
offset,
|
100
|
+
offsetBelow,
|
101
|
+
customUpdate: handlePositionUpdate,
|
102
|
+
}}
|
103
|
+
use:clickOutside={{
|
104
|
+
callback: dismissible ? handleOutsideClick : () => {},
|
105
|
+
anchor,
|
106
|
+
}}
|
107
|
+
on:keydown={handleEscape}
|
108
|
+
class={"spectrum-Popover is-open " + className}
|
109
|
+
class:customZindex
|
110
|
+
class:hide-popover={open && !showPopover}
|
111
|
+
role="presentation"
|
112
|
+
style="height: {customHeight}; --customZindex: {customZindex};"
|
113
|
+
transition:fly|local={{ y: -20, duration: animate ? 200 : 0 }}
|
114
|
+
>
|
115
|
+
<slot />
|
116
|
+
</div>
|
117
|
+
</Portal>
|
118
|
+
{/if}
|
119
|
+
|
120
|
+
<style>
|
121
|
+
.hide-popover {
|
122
|
+
display: contents;
|
123
|
+
}
|
124
|
+
|
125
|
+
.spectrum-Popover {
|
126
|
+
border-color: var(--spectrum-global-color-gray-300);
|
127
|
+
background-color: var(--spectrum-global-color-gray-50);
|
128
|
+
overflow: auto;
|
129
|
+
}
|
130
|
+
|
131
|
+
.customZindex {
|
132
|
+
z-index: var(--customZindex) !important;
|
133
|
+
}
|
134
|
+
</style>
|