@ibobbyts/svelte-ui-utils 0.2.12 → 0.3.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/README.md +183 -20
- package/dist/dialog/ConfirmDialog.svelte +2 -0
- package/dist/dialog/ConfirmDialog.svelte.d.ts +1 -0
- package/dist/dialog/ConfirmDialog.svelte.d.ts.map +1 -1
- package/dist/dialog/CsvUploadDialog.svelte +2 -0
- package/dist/dialog/CsvUploadDialog.svelte.d.ts +1 -0
- package/dist/dialog/CsvUploadDialog.svelte.d.ts.map +1 -1
- package/dist/dialog/Dialog.svelte +3 -0
- package/dist/dialog/Dialog.svelte.d.ts +1 -0
- package/dist/dialog/Dialog.svelte.d.ts.map +1 -1
- package/dist/dialog/ImagePreviewDialog.svelte +2 -0
- package/dist/dialog/ImagePreviewDialog.svelte.d.ts +1 -0
- package/dist/dialog/ImagePreviewDialog.svelte.d.ts.map +1 -1
- package/dist/dialog/InputDialog.svelte +2 -0
- package/dist/dialog/InputDialog.svelte.d.ts +1 -0
- package/dist/dialog/InputDialog.svelte.d.ts.map +1 -1
- package/dist/dialog/PasswordCopyDialog.svelte +2 -0
- package/dist/dialog/PasswordCopyDialog.svelte.d.ts +1 -0
- package/dist/dialog/PasswordCopyDialog.svelte.d.ts.map +1 -1
- package/dist/dropdown/Dropdown.svelte +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/ordered-list/OrderedListEditor.svelte +60 -0
- package/dist/ordered-list/OrderedListEditor.svelte.d.ts +23 -0
- package/dist/ordered-list/OrderedListEditor.svelte.d.ts.map +1 -0
- package/dist/ordered-list/index.d.ts +3 -0
- package/dist/ordered-list/index.d.ts.map +1 -0
- package/dist/ordered-list/index.js +1 -0
- package/dist/sortable-list/SortableList.svelte +167 -0
- package/dist/sortable-list/SortableList.svelte.d.ts +38 -0
- package/dist/sortable-list/SortableList.svelte.d.ts.map +1 -0
- package/dist/sortable-list/index.d.ts +3 -0
- package/dist/sortable-list/index.d.ts.map +1 -0
- package/dist/sortable-list/index.js +1 -0
- package/dist/sortable-list/types.d.ts +23 -0
- package/dist/sortable-list/types.d.ts.map +1 -0
- package/dist/sortable-list/types.js +1 -0
- package/dist/sortable-table/SortableTable.svelte +118 -0
- package/dist/sortable-table/SortableTable.svelte.d.ts +41 -0
- package/dist/sortable-table/SortableTable.svelte.d.ts.map +1 -0
- package/dist/sortable-table/SortableTableEnhanced.svelte +128 -0
- package/dist/sortable-table/SortableTableEnhanced.svelte.d.ts +44 -0
- package/dist/sortable-table/SortableTableEnhanced.svelte.d.ts.map +1 -0
- package/dist/sortable-table/index.d.ts +4 -0
- package/dist/sortable-table/index.d.ts.map +1 -0
- package/dist/sortable-table/index.js +2 -0
- package/dist/sortable-table/types.d.ts +16 -0
- package/dist/sortable-table/types.d.ts.map +1 -0
- package/dist/sortable-table/types.js +1 -0
- package/dist/style.css +2 -2
- package/package.json +16 -1
package/README.md
CHANGED
|
@@ -10,19 +10,19 @@ Install from the public npm registry. No GitHub Packages token is required.
|
|
|
10
10
|
With Bun:
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
bun add @ibobbyts/svelte-ui-utils@0.
|
|
13
|
+
bun add @ibobbyts/svelte-ui-utils@0.3.0
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Canonical Bun pull address:
|
|
17
17
|
|
|
18
18
|
```text
|
|
19
|
-
@ibobbyts/svelte-ui-utils@0.
|
|
19
|
+
@ibobbyts/svelte-ui-utils@0.3.0
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
With npm:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install @ibobbyts/svelte-ui-utils@0.
|
|
25
|
+
npm install @ibobbyts/svelte-ui-utils@0.3.0
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
The repository does not track `dist/`; releases and local integration builds run
|
|
@@ -82,7 +82,8 @@ Dropdown menus default to `placement="auto"` and open toward whichever side of
|
|
|
82
82
|
the trigger has more available viewport space. The direction is recalculated
|
|
83
83
|
while the menu is open when the viewport is resized or a scroll container
|
|
84
84
|
moves. Set `placement="up"` or `placement="down"` to force a direction. Use
|
|
85
|
-
`fitViewport={
|
|
85
|
+
`fitViewport={false}` to disable the default panel-height constraint for the
|
|
86
|
+
chosen side.
|
|
86
87
|
|
|
87
88
|
## DropdownSearch
|
|
88
89
|
|
|
@@ -170,6 +171,98 @@ In multiselect mode, the text input remains a search query. Selecting an item
|
|
|
170
171
|
adds or removes it from `selectedItems`, clears the query, and emits both
|
|
171
172
|
`onChange` and `onSelectedItemsChange`.
|
|
172
173
|
|
|
174
|
+
## SortableList
|
|
175
|
+
|
|
176
|
+
`SortableList` provides controlled vertical HTML5 drag-and-drop ordering. Each
|
|
177
|
+
item has a string `id` (and may contain any additional fields); `getId` can
|
|
178
|
+
project a different string key while retaining that typed item contract. The
|
|
179
|
+
caller owns the item array and receives the reordered array through
|
|
180
|
+
`onReorder`. Use the third snippet argument to attach drag bindings to a
|
|
181
|
+
dedicated handle. `listTag` and `itemTag` can be changed when the list must
|
|
182
|
+
render valid table markup such as direct `<tr>` children under `<tbody>`.
|
|
183
|
+
|
|
184
|
+
```svelte
|
|
185
|
+
<script lang="ts">
|
|
186
|
+
import { SortableList } from '@ibobbyts/svelte-ui-utils/sortable-list';
|
|
187
|
+
|
|
188
|
+
let items = [{ id: 'a', label: 'First' }, { id: 'b', label: 'Second' }];
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<SortableList {items} onReorder={(next) => (items = next)}>
|
|
192
|
+
{#snippet children(item, _index, handle)}
|
|
193
|
+
<div {...handle} aria-label={`Drag ${item.label}`}>⠿</div>
|
|
194
|
+
<span>{item.label}</span>
|
|
195
|
+
{/snippet}
|
|
196
|
+
</SortableList>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Dragging over the target item's upper or lower half displays a before/after
|
|
200
|
+
insertion indicator. Dropping on the same item or while `disabled={true}` is a
|
|
201
|
+
no-op. The component does not persist order or perform rollback; those remain
|
|
202
|
+
the responsibility of the controlled parent.
|
|
203
|
+
|
|
204
|
+
## OrderedListEditor
|
|
205
|
+
|
|
206
|
+
`OrderedListEditor` is the shared editor for ordered fields. It renders the
|
|
207
|
+
provided content first, an optional current/select action next, and a trash-icon
|
|
208
|
+
remove action at the far right. Reorder arrows are intentionally not rendered;
|
|
209
|
+
use `SortableList` when drag-and-drop ordering is needed. Set
|
|
210
|
+
`allowRemoveLast={true}` when an empty list is valid.
|
|
211
|
+
|
|
212
|
+
```svelte
|
|
213
|
+
<script lang="ts">
|
|
214
|
+
import { OrderedListEditor } from '@ibobbyts/svelte-ui-utils/ordered-list';
|
|
215
|
+
</script>
|
|
216
|
+
|
|
217
|
+
<OrderedListEditor items={rows} onremove={(id) => remove(id)}>
|
|
218
|
+
{#snippet children(item)}
|
|
219
|
+
<input value={item.value ?? ''} />
|
|
220
|
+
{/snippet}
|
|
221
|
+
</OrderedListEditor>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## SortableTable
|
|
225
|
+
|
|
226
|
+
`SortableTable` is the table-level ordering primitive. It owns the table rows,
|
|
227
|
+
the left drag-handle column, and the right trash-icon delete column. Callers
|
|
228
|
+
provide only the header cells and the middle row cells through snippets.
|
|
229
|
+
Use `getDragLabel(item, index)` and `getRemoveLabel(item, index)` when the
|
|
230
|
+
controls need caller-owned accessible labels. Each label is applied to both
|
|
231
|
+
`aria-label` and `title`; defaults remain `Drag ${getId(item)}` and
|
|
232
|
+
`Remove ${getId(item)}`.
|
|
233
|
+
|
|
234
|
+
```svelte
|
|
235
|
+
<SortableTable items={rows} onReorder={reorder} onRemove={remove}>
|
|
236
|
+
{#snippet header()}<th>Name</th><th>Protocol</th>{/snippet}
|
|
237
|
+
{#snippet children(row)}<td>{row.name}</td><td>{row.protocol}</td>{/snippet}
|
|
238
|
+
</SortableTable>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
`SortableTableEnhanced` composes the same table and adds a controlled current
|
|
242
|
+
radio immediately after each drag handle. `currentId` is read-only input;
|
|
243
|
+
`onCurrentChange` asks the caller to persist a new current item. Use
|
|
244
|
+
`getCurrentDisabled` for per-row eligibility and `getRowColorPreset` to select
|
|
245
|
+
the package-owned `red`, `yellow`, or `green` background. The presets include
|
|
246
|
+
light and dark defaults and expose `--suu-sortable-table-row-*-light` and
|
|
247
|
+
`--suu-sortable-table-row-*-dark` override variables.
|
|
248
|
+
|
|
249
|
+
```svelte
|
|
250
|
+
<SortableTableEnhanced
|
|
251
|
+
items={rows}
|
|
252
|
+
currentId={currentRowId}
|
|
253
|
+
getDragLabel={(row) => `Reorder ${row.name}`}
|
|
254
|
+
getRemoveLabel={(row) => `Remove ${row.name}`}
|
|
255
|
+
onCurrentChange={(row) => selectCurrent(row.id)}
|
|
256
|
+
getCurrentDisabled={(row) => row.exhausted}
|
|
257
|
+
getRowColorPreset={(row) => row.exhausted ? 'red' : row.cooling ? 'yellow' : 'green'}
|
|
258
|
+
onReorder={reorder}
|
|
259
|
+
onRemove={remove}
|
|
260
|
+
>
|
|
261
|
+
{#snippet header()}<th>Name</th><th>Protocol</th>{/snippet}
|
|
262
|
+
{#snippet children(row)}<td>{row.name}</td><td>{row.protocol}</td>{/snippet}
|
|
263
|
+
</SortableTableEnhanced>
|
|
264
|
+
```
|
|
265
|
+
|
|
173
266
|
## Dialogs
|
|
174
267
|
|
|
175
268
|
```svelte
|
|
@@ -189,6 +282,7 @@ adds or removes it from `selectedItems`, clears the query, and emits both
|
|
|
189
282
|
open={dialogOpen}
|
|
190
283
|
title="Edit record"
|
|
191
284
|
description="Update the shared fields."
|
|
285
|
+
padding="12px 16px"
|
|
192
286
|
closeLabel="Close dialog"
|
|
193
287
|
blurBackdrop={true}
|
|
194
288
|
showCountdown={true}
|
|
@@ -245,7 +339,10 @@ from the close button, backdrop, or Escape key when dismissible; it does not
|
|
|
245
339
|
mutate `open` internally. Set `dimBackdrop={false}` to disable background
|
|
246
340
|
darkening, `blurBackdrop={true}` to blur content behind the dialog, and
|
|
247
341
|
`showCountdown={true}` with `countdownDurationMs` to show a toast-style top
|
|
248
|
-
countdown bar.
|
|
342
|
+
countdown bar. The optional `padding` prop accepts a CSS padding shorthand and
|
|
343
|
+
applies it consistently to the dialog header, body, and footer. The default
|
|
344
|
+
section-specific spacing is preserved when `padding` is omitted, and the same
|
|
345
|
+
prop is available on all dialog wrapper components.
|
|
249
346
|
|
|
250
347
|
## Dropdown
|
|
251
348
|
|
|
@@ -267,7 +364,6 @@ countdown bar.
|
|
|
267
364
|
options={pageSizeOptions}
|
|
268
365
|
ariaLabel="Rows"
|
|
269
366
|
placement="down"
|
|
270
|
-
menuAlign="left"
|
|
271
367
|
onChange={(next) => {
|
|
272
368
|
pageSize = next;
|
|
273
369
|
}}
|
|
@@ -276,19 +372,86 @@ countdown bar.
|
|
|
276
372
|
|
|
277
373
|
`Dropdown` is a controlled select-like component for simple option lists. Use
|
|
278
374
|
`placement="up"` when the menu should open above the trigger, such as bottom
|
|
279
|
-
pagination bars.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
375
|
+
pagination bars. The expanded menu shares the trigger's left edge by default;
|
|
376
|
+
use `menuAlign="right"` to align their right edges instead. `fitContent` sizes
|
|
377
|
+
the menu to its longest option while keeping the selected edge aligned.
|
|
378
|
+
`DataTable` uses this same component for its page-size picker.
|
|
379
|
+
|
|
380
|
+
The dropdown panel is constrained by default to the space available above or
|
|
381
|
+
below the trigger and remains scrollable when its contents exceed that height.
|
|
382
|
+
Set `fitViewport={false}` to fall back to the stylesheet's viewport-height
|
|
383
|
+
limit (`100vh`).
|
|
384
|
+
|
|
385
|
+
### Allowing a Dropdown menu to extend outside a modal
|
|
386
|
+
|
|
387
|
+
`fitViewport` chooses the opening direction and limits the panel height against
|
|
388
|
+
the browser viewport. It does not portal the menu to `document.body`, so an
|
|
389
|
+
ancestor with `overflow: auto` or `overflow: hidden` can still clip the menu or
|
|
390
|
+
include it in the ancestor's scrollable overflow area.
|
|
391
|
+
|
|
392
|
+
For a modal whose content otherwise fits without scrolling, use a full-width
|
|
393
|
+
positioning boundary around the Dropdown and release the modal overflow only
|
|
394
|
+
while the menu exists:
|
|
395
|
+
|
|
396
|
+
```svelte
|
|
397
|
+
<div class="app-modal">
|
|
398
|
+
<div class="app-modal__body">
|
|
399
|
+
<div class="dropdown-overflow-boundary">
|
|
400
|
+
<Dropdown
|
|
401
|
+
value={selectedValue}
|
|
402
|
+
options={options}
|
|
403
|
+
onChange={(next) => {
|
|
404
|
+
selectedValue = next;
|
|
405
|
+
}}
|
|
406
|
+
/>
|
|
407
|
+
</div>
|
|
408
|
+
</div>
|
|
409
|
+
</div>
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
```css
|
|
413
|
+
.dropdown-overflow-boundary {
|
|
414
|
+
position: relative;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/* Position the absolute menu against the full-width boundary, not the
|
|
418
|
+
intrinsic-width Dropdown trigger. */
|
|
419
|
+
.dropdown-overflow-boundary .suu-dropdown {
|
|
420
|
+
position: static;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.dropdown-overflow-boundary .suu-dropdown__menu {
|
|
424
|
+
width: max-content;
|
|
425
|
+
min-width: 0;
|
|
426
|
+
max-width: 100%;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.dropdown-overflow-boundary .suu-dropdown__option {
|
|
430
|
+
white-space: normal;
|
|
431
|
+
overflow-wrap: anywhere;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/* :has() scopes the overflow exception to the time the menu is open. */
|
|
435
|
+
.app-modal:has(.dropdown-overflow-boundary .suu-dropdown__menu),
|
|
436
|
+
.app-modal:has(.dropdown-overflow-boundary .suu-dropdown__menu) .app-modal__body {
|
|
437
|
+
overflow: visible;
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
This keeps the trigger at its intrinsic width, lets the menu grow toward its
|
|
442
|
+
aligned edge up to the modal content width, wraps longer options, and allows
|
|
443
|
+
the menu to paint outside the modal. The default `fitViewport={true}` still
|
|
444
|
+
sets the panel's upper or lower limit from the browser viewport and keeps an
|
|
445
|
+
oversized option list scrollable.
|
|
446
|
+
|
|
447
|
+
This CSS pattern intentionally does not implement a portal. If the modal body
|
|
448
|
+
must remain independently scrollable while the menu is open, use a portal or
|
|
449
|
+
floating-layer component instead; releasing `overflow` would change that
|
|
450
|
+
scrolling contract. `:has()` also requires a browser that supports the CSS
|
|
451
|
+
relational pseudo-class.
|
|
452
|
+
|
|
453
|
+
The original flat `options` API remains available. New callers may opt into
|
|
454
|
+
grouped options with `optionGroups`; each group can have an
|
|
292
455
|
optional accessible label and its options keep the same keyboard and disabled
|
|
293
456
|
semantics. `width`, `minWidth`, `maxWidth`, and `className` are optional styling
|
|
294
457
|
hooks. `onTriggerClick` runs before the dropdown toggles, so a nested control
|
|
@@ -544,7 +707,7 @@ consumer project and installs the released npm version without registry-specific
|
|
|
544
707
|
tokens:
|
|
545
708
|
|
|
546
709
|
```bash
|
|
547
|
-
bun add @ibobbyts/svelte-ui-utils@0.
|
|
710
|
+
bun add @ibobbyts/svelte-ui-utils@0.3.0 svelte
|
|
548
711
|
```
|
|
549
712
|
|
|
550
713
|
Use it after each release when a Bun-based project will consume the package.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
export let closeLabel = 'Close dialog';
|
|
13
13
|
export let intent: ConfirmDialogIntent = 'default';
|
|
14
14
|
export let size: DialogSize = 'sm';
|
|
15
|
+
export let padding: string | undefined = undefined;
|
|
15
16
|
export let confirmDisabled = false;
|
|
16
17
|
export let cancelDisabled = false;
|
|
17
18
|
export let dismissible = true;
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
{title}
|
|
48
49
|
{closeLabel}
|
|
49
50
|
{size}
|
|
51
|
+
{padding}
|
|
50
52
|
{dismissible}
|
|
51
53
|
{closeOnBackdrop}
|
|
52
54
|
{closeOnEscape}
|
|
@@ -26,6 +26,7 @@ declare const ConfirmDialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_P
|
|
|
26
26
|
closeLabel?: string;
|
|
27
27
|
intent?: ConfirmDialogIntent;
|
|
28
28
|
size?: DialogSize;
|
|
29
|
+
padding?: string | undefined;
|
|
29
30
|
confirmDisabled?: boolean;
|
|
30
31
|
cancelDisabled?: boolean;
|
|
31
32
|
dismissible?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/ConfirmDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/ConfirmDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAkElE,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AACD,KAAK,gCAAgC,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,GACvD,CAAC,KAAK,SAAS;IAAE,OAAO,EAAE,GAAG,CAAA;CAAE,GACzB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,GAAG,GACH;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,GAClB,EAAE,CAAC,CAAC;AAId,QAAA,MAAM,aAAa;;;;;;;aAfwyB,mBAAmB;WAAS,UAAU;cAAY,MAAM,GAAG,SAAS;;;;;;;;sBAA8R,MAAM,GAAG,MAAM;;;;;gBAAkL,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS;eAAa,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;cAAY,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;;;;;;;cAev2C,CAAC;AACvF,KAAK,aAAa,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,eAAe,aAAa,CAAC"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export let description = '';
|
|
10
10
|
export let closeLabel = 'Close dialog';
|
|
11
11
|
export let size: DialogSize = 'lg';
|
|
12
|
+
export let padding: string | undefined = undefined;
|
|
12
13
|
export let dismissible = true;
|
|
13
14
|
export let closeOnBackdrop = true;
|
|
14
15
|
export let closeOnEscape = true;
|
|
@@ -103,6 +104,7 @@
|
|
|
103
104
|
{description}
|
|
104
105
|
{closeLabel}
|
|
105
106
|
{size}
|
|
107
|
+
{padding}
|
|
106
108
|
{dismissible}
|
|
107
109
|
{closeOnBackdrop}
|
|
108
110
|
{closeOnEscape}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CsvUploadDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/CsvUploadDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"CsvUploadDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/CsvUploadDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA8K7C,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAUD,QAAA,MAAM,eAAe;;;;;WAfmhC,UAAU;cAAY,MAAM,GAAG,SAAS;;;;;;sBAA4M,MAAM,GAAG,MAAM;;kBAAoD,MAAM,GAAG,SAAS;2BAAyB,MAAM,GAAG,SAAS;;;;;;;;mBAAqS,MAAM,EAAE;;;;;;;eAAiP,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS;eAAa,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;cAAY,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;mBAAiB,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS;;;;;;;;;cAergE,CAAC;AACzF,KAAK,eAAe,GAAG,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,eAAe,eAAe,CAAC"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export let description = '';
|
|
10
10
|
export let closeLabel = 'Close dialog';
|
|
11
11
|
export let size: DialogSize = 'md';
|
|
12
|
+
export let padding: string | undefined = undefined;
|
|
12
13
|
export let dismissible = true;
|
|
13
14
|
export let showCloseButton = true;
|
|
14
15
|
export let closeOnBackdrop = true;
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
describedBy ?? (description ? descriptionId : undefined);
|
|
36
37
|
$: backdropStyle =
|
|
37
38
|
`--suu-dialog-backdrop-opacity: ${backdropOpacity}; --suu-dialog-backdrop-blur: ${backdropBlur};`;
|
|
39
|
+
$: dialogStyle = padding ? `--suu-dialog-padding: ${padding};` : '';
|
|
38
40
|
$: countdownStyle = `--suu-dialog-countdown-duration: ${Math.max(0, countdownDurationMs)}ms;`;
|
|
39
41
|
$: if (open && !wasOpen) {
|
|
40
42
|
wasOpen = true;
|
|
@@ -99,6 +101,7 @@
|
|
|
99
101
|
<div
|
|
100
102
|
bind:this={dialogElement}
|
|
101
103
|
class={`suu-dialog suu-dialog--${size}`}
|
|
104
|
+
style={dialogStyle}
|
|
102
105
|
role="dialog"
|
|
103
106
|
aria-modal="true"
|
|
104
107
|
aria-labelledby={resolvedLabelledBy}
|
|
@@ -23,6 +23,7 @@ declare const Dialog: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWit
|
|
|
23
23
|
description?: string;
|
|
24
24
|
closeLabel?: string;
|
|
25
25
|
size?: DialogSize;
|
|
26
|
+
padding?: string | undefined;
|
|
26
27
|
dismissible?: boolean;
|
|
27
28
|
showCloseButton?: boolean;
|
|
28
29
|
closeOnBackdrop?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/Dialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/Dialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAsI7C,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AACD,KAAK,gCAAgC,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,GACvD,CAAC,KAAK,SAAS;IAAE,OAAO,EAAE,GAAG,CAAA;CAAE,GACzB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,GAAG,GACH;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAA;CAAE,GAClB,EAAE,CAAC,CAAC;AAId,QAAA,MAAM,MAAM;;;;;WAfqpB,UAAU;cAAY,MAAM,GAAG,SAAS;;;;;;;sBAAsP,MAAM,GAAG,MAAM;;;;;iBAAmL,MAAM,GAAG,SAAS;kBAAgB,MAAM,GAAG,SAAS;cAAY,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;;;;;;;;;cAexnC,CAAC;AAChF,KAAK,MAAM,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,eAAe,MAAM,CAAC"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
export let closeLabel = 'Close dialog';
|
|
13
13
|
export let downloadLabel = 'Download';
|
|
14
14
|
export let size: DialogSize = 'lg';
|
|
15
|
+
export let padding: string | undefined = undefined;
|
|
15
16
|
export let dismissible = true;
|
|
16
17
|
export let closeOnBackdrop = true;
|
|
17
18
|
export let closeOnEscape = true;
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
title={resolvedTitle}
|
|
46
47
|
{closeLabel}
|
|
47
48
|
{size}
|
|
49
|
+
{padding}
|
|
48
50
|
{dismissible}
|
|
49
51
|
{closeOnBackdrop}
|
|
50
52
|
{closeOnEscape}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePreviewDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/ImagePreviewDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ImagePreviewDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/ImagePreviewDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA+D7C,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,kBAAkB;;;;;;;;WAV2mB,UAAU;cAAY,MAAM,GAAG,SAAS;;;;;;sBAA4M,MAAM,GAAG,MAAM;;;cAAoF,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;;;kBAU34B,CAAC;AACtF,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACpE,eAAe,kBAAkB,CAAC"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export let cancelLabel = 'Cancel';
|
|
17
17
|
export let closeLabel = 'Close dialog';
|
|
18
18
|
export let size: DialogSize = 'sm';
|
|
19
|
+
export let padding: string | undefined = undefined;
|
|
19
20
|
export let confirmDisabled = false;
|
|
20
21
|
export let cancelDisabled = false;
|
|
21
22
|
export let dismissible = true;
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
{title}
|
|
82
83
|
{closeLabel}
|
|
83
84
|
{size}
|
|
85
|
+
{padding}
|
|
84
86
|
{dismissible}
|
|
85
87
|
{closeOnBackdrop}
|
|
86
88
|
{closeOnEscape}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/InputDialog.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"InputDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/InputDialog.svelte.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA0G9D,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,WAAW;;;;;gBAVsuB,eAAe;;;;;;WAAiL,UAAU;cAAY,MAAM,GAAG,SAAS;;;;;;;;sBAA8R,MAAM,GAAG,MAAM;;;gBAAgF,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS;eAAa,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;cAAY,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;;;kBAU13C,CAAC;AAC/E,KAAK,WAAW,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,eAAe,WAAW,CAAC"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
export let doneLabel = 'Done';
|
|
15
15
|
export let closeLabel = 'Close dialog';
|
|
16
16
|
export let size: DialogSize = 'sm';
|
|
17
|
+
export let padding: string | undefined = undefined;
|
|
17
18
|
export let dismissible = true;
|
|
18
19
|
export let closeOnBackdrop = true;
|
|
19
20
|
export let closeOnEscape = true;
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
{title}
|
|
54
55
|
{closeLabel}
|
|
55
56
|
{size}
|
|
57
|
+
{padding}
|
|
56
58
|
{dismissible}
|
|
57
59
|
{closeOnBackdrop}
|
|
58
60
|
{closeOnEscape}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordCopyDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/PasswordCopyDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"PasswordCopyDialog.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/dialog/PasswordCopyDialog.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA+E7C,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IAC9G,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,kBAAkB;;;;;;;;;;WAV6sB,UAAU;cAAY,MAAM,GAAG,SAAS;;;;;;sBAA4M,MAAM,GAAG,MAAM;;cAAgD,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS;aAAW,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS;;;kBAU5/B,CAAC;AACtF,KAAK,kBAAkB,GAAG,YAAY,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACpE,eAAe,kBAAkB,CAAC"}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
export let optionGroups: DropdownOptionGroup[] | undefined = undefined;
|
|
19
19
|
export let ariaLabel: string | undefined = undefined;
|
|
20
20
|
export let placement: DropdownPlacement = 'auto';
|
|
21
|
-
export let menuAlign: DropdownMenuAlign = '
|
|
22
|
-
export let fitViewport =
|
|
21
|
+
export let menuAlign: DropdownMenuAlign = 'left';
|
|
22
|
+
export let fitViewport = true;
|
|
23
23
|
export let fitContent = false;
|
|
24
24
|
export let disabled = false;
|
|
25
25
|
export let width: string | undefined = undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export * from './dropdown/index.js';
|
|
|
3
3
|
export * from './dropdown-search/index.js';
|
|
4
4
|
export * from './dialog/index.js';
|
|
5
5
|
export * from './data-table/index.js';
|
|
6
|
+
export * from './sortable-list/index.js';
|
|
7
|
+
export * from './ordered-list/index.js';
|
|
8
|
+
export * from './sortable-table/index.js';
|
|
6
9
|
export { getUiMessages, resolveUiLanguage, uiLanguages } from './i18n.js';
|
|
7
10
|
export type { UiLanguage, UiMessages } from './i18n.js';
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1E,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1E,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,7 @@ export * from './dropdown/index.js';
|
|
|
3
3
|
export * from './dropdown-search/index.js';
|
|
4
4
|
export * from './dialog/index.js';
|
|
5
5
|
export * from './data-table/index.js';
|
|
6
|
+
export * from './sortable-list/index.js';
|
|
7
|
+
export * from './ordered-list/index.js';
|
|
8
|
+
export * from './sortable-table/index.js';
|
|
6
9
|
export { getUiMessages, resolveUiLanguage, uiLanguages } from './i18n.js';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export type OrderedListItem = { id: string; value?: string; current?: boolean; status?: string };
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
items,
|
|
8
|
+
disabled = false,
|
|
9
|
+
compact = false,
|
|
10
|
+
allowRemoveLast = false,
|
|
11
|
+
renderId,
|
|
12
|
+
onremove,
|
|
13
|
+
oncurrent,
|
|
14
|
+
currentLabel,
|
|
15
|
+
removeLabel,
|
|
16
|
+
children
|
|
17
|
+
}: {
|
|
18
|
+
items: OrderedListItem[];
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
allowRemoveLast?: boolean;
|
|
22
|
+
renderId?: string;
|
|
23
|
+
onremove?: (id: string) => void;
|
|
24
|
+
oncurrent?: (id: string) => void;
|
|
25
|
+
currentLabel?: (item: OrderedListItem) => string;
|
|
26
|
+
removeLabel?: (item: OrderedListItem) => string;
|
|
27
|
+
children?: Snippet<[OrderedListItem, number]>;
|
|
28
|
+
} = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<div class:compact class="suu-ordered-list-editor">
|
|
32
|
+
{#each items as item, index}
|
|
33
|
+
{#if renderId === undefined || renderId === item.id}
|
|
34
|
+
<div class="suu-ordered-list-editor__row" data-ordered-id={item.id}>
|
|
35
|
+
{#if children}{@render children(item, index)}{/if}
|
|
36
|
+
{#if oncurrent}
|
|
37
|
+
<button type="button" class="suu-ordered-list-editor__current" disabled={disabled || item.current} aria-label={currentLabel?.(item) ?? `Select ${item.id}`} onclick={() => oncurrent?.(item.id)}>{item.current ? 'Current' : 'Select'}</button>
|
|
38
|
+
{/if}
|
|
39
|
+
{#if onremove}
|
|
40
|
+
<button type="button" class="suu-ordered-list-editor__remove" disabled={disabled || (!allowRemoveLast && items.length === 1)} aria-label={removeLabel?.(item) ?? `Remove ${item.id}`} title={removeLabel?.(item) ?? `Remove ${item.id}`} onclick={() => onremove?.(item.id)}>
|
|
41
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 3h6l1 2h4v2H4V5h4l1-2Zm-2 6h2v9H7V9Zm4 0h2v9h-2V9Zm4 0h2v9h-2V9ZM6 21V8h12v13H6Z" fill="currentColor"/></svg>
|
|
42
|
+
</button>
|
|
43
|
+
{/if}
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
{/each}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<style>
|
|
50
|
+
.suu-ordered-list-editor { display: grid; gap: 5px; }
|
|
51
|
+
.suu-ordered-list-editor__row { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
52
|
+
.suu-ordered-list-editor__row :global(input) { min-width: 0; flex: 1; }
|
|
53
|
+
.suu-ordered-list-editor__row :global(label) { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 11px; }
|
|
54
|
+
.suu-ordered-list-editor__row :global(label input) { flex: 0; }
|
|
55
|
+
.compact .suu-ordered-list-editor__row { gap: 3px; }
|
|
56
|
+
.suu-ordered-list-editor__current { margin-left: auto; }
|
|
57
|
+
.suu-ordered-list-editor__remove { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #dc2626; cursor: pointer; }
|
|
58
|
+
.suu-ordered-list-editor__remove svg { width: 16px; height: 16px; }
|
|
59
|
+
.suu-ordered-list-editor__remove:disabled { cursor: default; opacity: .35; }
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type OrderedListItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
current?: boolean;
|
|
6
|
+
status?: string;
|
|
7
|
+
};
|
|
8
|
+
type $$ComponentProps = {
|
|
9
|
+
items: OrderedListItem[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
allowRemoveLast?: boolean;
|
|
13
|
+
renderId?: string;
|
|
14
|
+
onremove?: (id: string) => void;
|
|
15
|
+
oncurrent?: (id: string) => void;
|
|
16
|
+
currentLabel?: (item: OrderedListItem) => string;
|
|
17
|
+
removeLabel?: (item: OrderedListItem) => string;
|
|
18
|
+
children?: Snippet<[OrderedListItem, number]>;
|
|
19
|
+
};
|
|
20
|
+
declare const OrderedListEditor: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
21
|
+
type OrderedListEditor = ReturnType<typeof OrderedListEditor>;
|
|
22
|
+
export default OrderedListEditor;
|
|
23
|
+
//# sourceMappingURL=OrderedListEditor.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderedListEditor.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/ordered-list/OrderedListEditor.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGpC,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAClG,KAAK,gBAAgB,GAAI;IACtB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;IACjD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,MAAM,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/C,CAAC;AAyCJ,QAAA,MAAM,iBAAiB,sDAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/ordered-list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OrderedListEditor } from './OrderedListEditor.svelte';
|