@sparklingopinions/sparkling-ui 0.15.0 → 0.17.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/aliases.d.ts +43 -30
- package/dist/aliases.js +9 -9
- package/dist/aliases.js.map +1 -1
- package/dist/components/ActionBar/ActionBar.js.map +1 -1
- package/dist/components/ActionBar/ActionBar.vue.d.ts +20 -2
- package/dist/components/ActionBar/ActionBar.vue_vue_type_script_setup_true_lang.js +106 -41
- package/dist/components/ActionBar/ActionBar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ActionBar/index.d.ts +1 -1
- package/dist/components/Board/Board.js.map +1 -1
- package/dist/components/Board/Board.vue.d.ts +3 -0
- package/dist/components/Board/Board.vue_vue_type_script_setup_true_lang.js +88 -151
- package/dist/components/Board/Board.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.vue.d.ts +4 -4
- package/dist/components/DataList/DataList.js.map +1 -1
- package/dist/components/DataList/DataList.vue.d.ts +7 -1
- package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js +187 -147
- package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.vue.d.ts +2 -2
- package/dist/components/Filters/FilterChip.vue.d.ts +3 -3
- package/dist/components/Filters/FilterMenu.vue.d.ts +3 -3
- package/dist/components/Filters/SortMenu.vue.d.ts +3 -3
- package/dist/components/PropertyList/Editable.vue.d.ts +1 -1
- package/dist/components/Toast/ToastMessage.vue.d.ts +1 -1
- package/dist/components/Toast/Toaster.vue.d.ts +1 -1
- package/dist/components/internal/useDragMove.d.ts +50 -0
- package/dist/components/internal/useDragMove.js +132 -0
- package/dist/components/internal/useDragMove.js.map +1 -0
- package/dist/composables/toast.d.ts +12 -1
- package/dist/composables/toast.js +40 -21
- package/dist/composables/toast.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +25 -24
- package/dist/utils/settle.d.ts +18 -0
- package/dist/utils/settle.js +24 -0
- package/dist/utils/settle.js.map +1 -0
- package/package.json +1 -1
- package/src/styles/tailwind.css +19 -0
package/dist/aliases.d.ts
CHANGED
|
@@ -21,9 +21,13 @@ import { type PropertyRowProps } from './components/PropertyRow/PropertyRow.vue'
|
|
|
21
21
|
/** @deprecated Renamed to ActionBar. */
|
|
22
22
|
export declare const BulkActions: {
|
|
23
23
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<ActionBarProps> & Readonly<{
|
|
24
|
-
"onClick-item"?: ((action: ActionBarAction
|
|
24
|
+
"onClick-item"?: ((action: ActionBarAction & {
|
|
25
|
+
value?: unknown;
|
|
26
|
+
}) => any) | undefined;
|
|
25
27
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
-
"click-item": (action: ActionBarAction
|
|
28
|
+
"click-item": (action: ActionBarAction & {
|
|
29
|
+
value?: unknown;
|
|
30
|
+
}) => any;
|
|
27
31
|
}, import("vue").PublicProps, {
|
|
28
32
|
label: string;
|
|
29
33
|
actions: ActionBarAction[];
|
|
@@ -38,7 +42,9 @@ export declare const BulkActions: {
|
|
|
38
42
|
M: {};
|
|
39
43
|
Defaults: {};
|
|
40
44
|
}, Readonly<ActionBarProps> & Readonly<{
|
|
41
|
-
"onClick-item"?: ((action: ActionBarAction
|
|
45
|
+
"onClick-item"?: ((action: ActionBarAction & {
|
|
46
|
+
value?: unknown;
|
|
47
|
+
}) => any) | undefined;
|
|
42
48
|
}>, {}, {}, {}, {}, {
|
|
43
49
|
label: string;
|
|
44
50
|
actions: ActionBarAction[];
|
|
@@ -50,9 +56,13 @@ export declare const BulkActions: {
|
|
|
50
56
|
__isTeleport?: never;
|
|
51
57
|
__isSuspense?: never;
|
|
52
58
|
} & import("vue").ComponentOptionsBase<Readonly<ActionBarProps> & Readonly<{
|
|
53
|
-
"onClick-item"?: ((action: ActionBarAction
|
|
59
|
+
"onClick-item"?: ((action: ActionBarAction & {
|
|
60
|
+
value?: unknown;
|
|
61
|
+
}) => any) | undefined;
|
|
54
62
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
55
|
-
"click-item": (action: ActionBarAction
|
|
63
|
+
"click-item": (action: ActionBarAction & {
|
|
64
|
+
value?: unknown;
|
|
65
|
+
}) => any;
|
|
56
66
|
}, string, {
|
|
57
67
|
label: string;
|
|
58
68
|
actions: ActionBarAction[];
|
|
@@ -204,7 +214,7 @@ export declare const List: <T extends Record<string, any>>(__VLS_props: NonNulla
|
|
|
204
214
|
}) => unknown;
|
|
205
215
|
empty?: () => unknown;
|
|
206
216
|
};
|
|
207
|
-
emit: ((evt: "context-item", action: DropdownMenuAction, item: T) => void) & (((event: "update:selected", value: unknown[]) => void) & ((event: "update:collapsed", value: string[]) => void));
|
|
217
|
+
emit: (((evt: "context-item", action: DropdownMenuAction, item: T) => void) & ((evt: "move", id: unknown, group: string, index: number) => void)) & (((event: "update:selected", value: unknown[]) => void) & ((event: "update:collapsed", value: string[]) => void));
|
|
208
218
|
}, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
209
219
|
props: import("vue").PublicProps & {
|
|
210
220
|
groups: DataListGroup<T>[];
|
|
@@ -220,6 +230,8 @@ export declare const List: <T extends Record<string, any>>(__VLS_props: NonNulla
|
|
|
220
230
|
collapsible?: boolean | undefined;
|
|
221
231
|
rowHeight?: number | undefined;
|
|
222
232
|
dividers?: boolean | undefined;
|
|
233
|
+
draggable?: boolean | undefined;
|
|
234
|
+
hideEmpty?: boolean | undefined;
|
|
223
235
|
contextItems?: ((item: T) => DropdownMenuEntry[]) | undefined;
|
|
224
236
|
contextLabel?: string | undefined;
|
|
225
237
|
onRowClick?: ((item: T) => void) | undefined;
|
|
@@ -231,6 +243,7 @@ export declare const List: <T extends Record<string, any>>(__VLS_props: NonNulla
|
|
|
231
243
|
selected?: unknown[] | undefined;
|
|
232
244
|
collapsed?: string[] | undefined;
|
|
233
245
|
"onContext-item"?: ((action: DropdownMenuAction, item: T) => any) | undefined;
|
|
246
|
+
onMove?: ((id: unknown, group: string, index: number) => any) | undefined;
|
|
234
247
|
"onUpdate:selected"?: ((value: unknown[]) => any) | undefined;
|
|
235
248
|
"onUpdate:collapsed"?: ((value: string[]) => any) | undefined;
|
|
236
249
|
} & (typeof globalThis extends {
|
|
@@ -264,7 +277,7 @@ export declare const List: <T extends Record<string, any>>(__VLS_props: NonNulla
|
|
|
264
277
|
}) => unknown;
|
|
265
278
|
empty?: () => unknown;
|
|
266
279
|
};
|
|
267
|
-
emit: ((evt: "context-item", action: DropdownMenuAction, item: T) => void) & (((event: "update:selected", value: unknown[]) => void) & ((event: "update:collapsed", value: string[]) => void));
|
|
280
|
+
emit: (((evt: "context-item", action: DropdownMenuAction, item: T) => void) & ((evt: "move", id: unknown, group: string, index: number) => void)) & (((event: "update:selected", value: unknown[]) => void) & ((event: "update:collapsed", value: string[]) => void));
|
|
268
281
|
}>) => import("vue").VNode & {
|
|
269
282
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
270
283
|
};
|
|
@@ -393,12 +406,12 @@ export declare const OptionsMenu: {
|
|
|
393
406
|
hide: () => any;
|
|
394
407
|
}, import("vue").PublicProps, {
|
|
395
408
|
align: "start" | "end";
|
|
396
|
-
confirmLabel: string;
|
|
397
|
-
cancelLabel: string;
|
|
398
409
|
id: string;
|
|
399
410
|
confirmTitle: string;
|
|
400
411
|
confirmMessage: string;
|
|
412
|
+
confirmLabel: string;
|
|
401
413
|
deleteLabel: string;
|
|
414
|
+
cancelLabel: string;
|
|
402
415
|
items: DropdownMenuEntry[];
|
|
403
416
|
buttonIcon: string;
|
|
404
417
|
buttonLabel: string;
|
|
@@ -418,12 +431,12 @@ export declare const OptionsMenu: {
|
|
|
418
431
|
onHide?: (() => any) | undefined;
|
|
419
432
|
}>, {}, {}, {}, {}, {
|
|
420
433
|
align: "start" | "end";
|
|
421
|
-
confirmLabel: string;
|
|
422
|
-
cancelLabel: string;
|
|
423
434
|
id: string;
|
|
424
435
|
confirmTitle: string;
|
|
425
436
|
confirmMessage: string;
|
|
437
|
+
confirmLabel: string;
|
|
426
438
|
deleteLabel: string;
|
|
439
|
+
cancelLabel: string;
|
|
427
440
|
items: DropdownMenuEntry[];
|
|
428
441
|
buttonIcon: string;
|
|
429
442
|
buttonLabel: string;
|
|
@@ -446,12 +459,12 @@ export declare const OptionsMenu: {
|
|
|
446
459
|
hide: () => any;
|
|
447
460
|
}, string, {
|
|
448
461
|
align: "start" | "end";
|
|
449
|
-
confirmLabel: string;
|
|
450
|
-
cancelLabel: string;
|
|
451
462
|
id: string;
|
|
452
463
|
confirmTitle: string;
|
|
453
464
|
confirmMessage: string;
|
|
465
|
+
confirmLabel: string;
|
|
454
466
|
deleteLabel: string;
|
|
467
|
+
cancelLabel: string;
|
|
455
468
|
items: DropdownMenuEntry[];
|
|
456
469
|
buttonIcon: string;
|
|
457
470
|
buttonLabel: string;
|
|
@@ -480,17 +493,17 @@ export declare const FilterFieldPicker: {
|
|
|
480
493
|
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<FilterMenuProps & {
|
|
481
494
|
open?: boolean;
|
|
482
495
|
}> & Readonly<{
|
|
483
|
-
onPick?: ((name: string) => any) | undefined;
|
|
484
496
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
497
|
+
onPick?: ((name: string) => any) | undefined;
|
|
485
498
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
486
|
-
pick: (name: string) => any;
|
|
487
499
|
"update:open": (value: boolean) => any;
|
|
500
|
+
pick: (name: string) => any;
|
|
488
501
|
}, import("vue").PublicProps, {
|
|
489
502
|
variant: "secondary" | "tinted" | "ghost";
|
|
490
503
|
as: "button" | "chip";
|
|
491
504
|
label: string;
|
|
492
|
-
closeLabel: string;
|
|
493
505
|
buttonLabel: string;
|
|
506
|
+
closeLabel: string;
|
|
494
507
|
status: string;
|
|
495
508
|
inUse: string[];
|
|
496
509
|
searchPlaceholder: string;
|
|
@@ -508,14 +521,14 @@ export declare const FilterFieldPicker: {
|
|
|
508
521
|
}, Readonly<FilterMenuProps & {
|
|
509
522
|
open?: boolean;
|
|
510
523
|
}> & Readonly<{
|
|
511
|
-
onPick?: ((name: string) => any) | undefined;
|
|
512
524
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
525
|
+
onPick?: ((name: string) => any) | undefined;
|
|
513
526
|
}>, {}, {}, {}, {}, {
|
|
514
527
|
variant: "secondary" | "tinted" | "ghost";
|
|
515
528
|
as: "button" | "chip";
|
|
516
529
|
label: string;
|
|
517
|
-
closeLabel: string;
|
|
518
530
|
buttonLabel: string;
|
|
531
|
+
closeLabel: string;
|
|
519
532
|
status: string;
|
|
520
533
|
inUse: string[];
|
|
521
534
|
searchPlaceholder: string;
|
|
@@ -530,17 +543,17 @@ export declare const FilterFieldPicker: {
|
|
|
530
543
|
} & import("vue").ComponentOptionsBase<Readonly<FilterMenuProps & {
|
|
531
544
|
open?: boolean;
|
|
532
545
|
}> & Readonly<{
|
|
533
|
-
onPick?: ((name: string) => any) | undefined;
|
|
534
546
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
547
|
+
onPick?: ((name: string) => any) | undefined;
|
|
535
548
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
536
|
-
pick: (name: string) => any;
|
|
537
549
|
"update:open": (value: boolean) => any;
|
|
550
|
+
pick: (name: string) => any;
|
|
538
551
|
}, string, {
|
|
539
552
|
variant: "secondary" | "tinted" | "ghost";
|
|
540
553
|
as: "button" | "chip";
|
|
541
554
|
label: string;
|
|
542
|
-
closeLabel: string;
|
|
543
555
|
buttonLabel: string;
|
|
556
|
+
closeLabel: string;
|
|
544
557
|
status: string;
|
|
545
558
|
inUse: string[];
|
|
546
559
|
searchPlaceholder: string;
|
|
@@ -566,18 +579,18 @@ export declare const SortControl: {
|
|
|
566
579
|
modelValue?: import("./index.ts").ViewSort | null;
|
|
567
580
|
open?: boolean;
|
|
568
581
|
}> & Readonly<{
|
|
569
|
-
"onUpdate:modelValue"?: ((value: import("./index.ts").ViewSort | null) => any) | undefined;
|
|
570
582
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
583
|
+
"onUpdate:modelValue"?: ((value: import("./index.ts").ViewSort | null) => any) | undefined;
|
|
571
584
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
572
|
-
"update:modelValue": (value: import("./index.ts").ViewSort | null) => any;
|
|
573
585
|
"update:open": (value: boolean) => any;
|
|
586
|
+
"update:modelValue": (value: import("./index.ts").ViewSort | null) => any;
|
|
574
587
|
}, import("vue").PublicProps, {
|
|
575
588
|
variant: "secondary" | "tinted" | "ghost";
|
|
576
589
|
as: "button" | "chip";
|
|
577
590
|
title: string;
|
|
591
|
+
buttonLabel: string;
|
|
578
592
|
clearLabel: string;
|
|
579
593
|
closeLabel: string;
|
|
580
|
-
buttonLabel: string;
|
|
581
594
|
status: string;
|
|
582
595
|
directionLabels: Partial<Record<import("./index.ts").FilterFieldType, [string, string]>>;
|
|
583
596
|
directionLabel: string;
|
|
@@ -593,15 +606,15 @@ export declare const SortControl: {
|
|
|
593
606
|
modelValue?: import("./index.ts").ViewSort | null;
|
|
594
607
|
open?: boolean;
|
|
595
608
|
}> & Readonly<{
|
|
596
|
-
"onUpdate:modelValue"?: ((value: import("./index.ts").ViewSort | null) => any) | undefined;
|
|
597
609
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
610
|
+
"onUpdate:modelValue"?: ((value: import("./index.ts").ViewSort | null) => any) | undefined;
|
|
598
611
|
}>, {}, {}, {}, {}, {
|
|
599
612
|
variant: "secondary" | "tinted" | "ghost";
|
|
600
613
|
as: "button" | "chip";
|
|
601
614
|
title: string;
|
|
615
|
+
buttonLabel: string;
|
|
602
616
|
clearLabel: string;
|
|
603
617
|
closeLabel: string;
|
|
604
|
-
buttonLabel: string;
|
|
605
618
|
status: string;
|
|
606
619
|
directionLabels: Partial<Record<import("./index.ts").FilterFieldType, [string, string]>>;
|
|
607
620
|
directionLabel: string;
|
|
@@ -614,18 +627,18 @@ export declare const SortControl: {
|
|
|
614
627
|
modelValue?: import("./index.ts").ViewSort | null;
|
|
615
628
|
open?: boolean;
|
|
616
629
|
}> & Readonly<{
|
|
617
|
-
"onUpdate:modelValue"?: ((value: import("./index.ts").ViewSort | null) => any) | undefined;
|
|
618
630
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
631
|
+
"onUpdate:modelValue"?: ((value: import("./index.ts").ViewSort | null) => any) | undefined;
|
|
619
632
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
620
|
-
"update:modelValue": (value: import("./index.ts").ViewSort | null) => any;
|
|
621
633
|
"update:open": (value: boolean) => any;
|
|
634
|
+
"update:modelValue": (value: import("./index.ts").ViewSort | null) => any;
|
|
622
635
|
}, string, {
|
|
623
636
|
variant: "secondary" | "tinted" | "ghost";
|
|
624
637
|
as: "button" | "chip";
|
|
625
638
|
title: string;
|
|
639
|
+
buttonLabel: string;
|
|
626
640
|
clearLabel: string;
|
|
627
641
|
closeLabel: string;
|
|
628
|
-
buttonLabel: string;
|
|
629
642
|
status: string;
|
|
630
643
|
directionLabels: Partial<Record<import("./index.ts").FilterFieldType, [string, string]>>;
|
|
631
644
|
directionLabel: string;
|
|
@@ -759,8 +772,8 @@ export declare const InlineField: import("vue").DefineComponent<EditableProps &
|
|
|
759
772
|
"onUpdate:modelValue"?: ((value: import("./index.ts").SelectValue | null) => any) | undefined;
|
|
760
773
|
}>, {
|
|
761
774
|
variant: "text" | "select" | "title" | "multiline";
|
|
762
|
-
placeholder: string;
|
|
763
775
|
options: import("./index.ts").SelectOption<import("./index.ts").SelectValue>[];
|
|
776
|
+
placeholder: string;
|
|
764
777
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
765
778
|
/** @deprecated Renamed to EditableProps. */
|
|
766
779
|
export type InlineFieldProps = EditableProps;
|
package/dist/aliases.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import e from "./components/
|
|
2
|
-
import t from "./components/
|
|
3
|
-
import n from "./components/
|
|
4
|
-
import r from "./components/
|
|
5
|
-
import i from "./components/
|
|
6
|
-
import a from "./components/
|
|
7
|
-
import o from "./components/
|
|
8
|
-
import s from "./components/
|
|
1
|
+
import e from "./components/DropdownMenu/DropdownMenu.js";
|
|
2
|
+
import t from "./components/ActionBar/ActionBar.js";
|
|
3
|
+
import n from "./components/Alert/Alert.js";
|
|
4
|
+
import r from "./components/AlertDialog/AlertDialog.js";
|
|
5
|
+
import i from "./components/Badge/Badge.js";
|
|
6
|
+
import a from "./components/Calendar/Calendar.js";
|
|
7
|
+
import o from "./components/DataList/DataList.js";
|
|
8
|
+
import s from "./components/Dialog/Dialog.js";
|
|
9
9
|
import c from "./components/ErrorSummary/ErrorSummary.js";
|
|
10
10
|
import l from "./components/Input/Input.js";
|
|
11
11
|
import u from "./components/Filters/FilterMenu.js";
|
|
@@ -20,7 +20,7 @@ import v from "./components/PropertyRow/PropertyRow.js";
|
|
|
20
20
|
import y from "./components/TypingIndicator/TypingIndicator.js";
|
|
21
21
|
import { h as b } from "vue";
|
|
22
22
|
//#region src/aliases.ts
|
|
23
|
-
var x =
|
|
23
|
+
var x = t, S = n, C = r, w = i, T = a, E = o, D = s, O = e, k = c, A = u, j = d, M = f, N = p, P = l, F = h, I = g, L = _, R = v, z = y, B = (e, { slots: t }) => b(m, {
|
|
24
24
|
variant: "outline",
|
|
25
25
|
name: e.label,
|
|
26
26
|
muted: e.muted
|
package/dist/aliases.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aliases.js","names":["ActionBar","Alert","AlertDialog","Badge","Calendar","DataList","Dialog","DropdownMenu","ErrorSummary","FilterMenu","SortMenu","FormField","ImageUpload","Input","Editable","PropertyList","Collapsible","PropertyRow","TypingIndicator","Tag","ActionBar_default","Alert_default","AlertDialog_default","Badge_default","Calendar_default","DataList_default","Dialog_default","
|
|
1
|
+
{"version":3,"file":"aliases.js","names":["ActionBar","Alert","AlertDialog","Badge","Calendar","DataList","Dialog","DropdownMenu","ErrorSummary","FilterMenu","SortMenu","FormField","ImageUpload","Input","Editable","PropertyList","Collapsible","PropertyRow","TypingIndicator","Tag","DropdownMenu_default","ActionBar_default","Alert_default","AlertDialog_default","Badge_default","Calendar_default","DataList_default","Dialog_default","ErrorSummary_default","Input_default","FilterMenu_default","SortMenu_default","FormField_default","ImageUpload_default","Tag_default","Editable_default","PropertyList_default","Collapsible_default","PropertyRow_default","TypingIndicator_default","BulkActions","Banner","ConfirmDialog","Pill","CalendarMonth","List","Modal","OptionsMenu","FormErrors","FilterFieldPicker","SortControl","Field","ImageInput","TextInput","InlineField","InlineForm","LedgerMore","LedgerRow","TypingDots","Chip","h","props","slots"],"sources":["../src/aliases.ts"],"sourcesContent":["// Former names, kept so older code keeps working. Each is deprecated: use the new name.\nimport { type FunctionalComponent, h } from 'vue'\n\nimport ActionBar, { type ActionBarAction, type ActionBarProps } from './components/ActionBar/ActionBar.vue'\nimport Alert, { type AlertProps, type AlertTone } from './components/Alert/Alert.vue'\nimport AlertDialog, { type AlertDialogProps } from './components/AlertDialog/AlertDialog.vue'\nimport Badge, { type BadgeProps, type BadgeTone } from './components/Badge/Badge.vue'\nimport Calendar, { type CalendarProps } from './components/Calendar/Calendar.vue'\nimport DataList, { type DataListProps } from './components/DataList/DataList.vue'\nimport type { DataListGroup } from './components/DataList/types'\nimport Dialog, { type DialogProps } from './components/Dialog/Dialog.vue'\nimport DropdownMenu, {\n type DropdownMenuAction,\n type DropdownMenuEntry,\n type DropdownMenuProps\n} from './components/DropdownMenu/DropdownMenu.vue'\nimport ErrorSummary, { type ErrorSummaryProps } from './components/ErrorSummary/ErrorSummary.vue'\nimport FilterMenu, { type FilterMenuProps } from './components/Filters/FilterMenu.vue'\nimport SortMenu, { type SortMenuProps } from './components/Filters/SortMenu.vue'\nimport FormField, { type FormFieldProps } from './components/FormField/FormField.vue'\nimport ImageUpload, { type ImageUploadProps } from './components/ImageUpload/ImageUpload.vue'\nimport Input, { type InputProps } from './components/Input/Input.vue'\nimport Editable, { type EditableProps } from './components/PropertyList/Editable.vue'\nimport PropertyList, { type PropertyListField } from './components/PropertyList/PropertyList.vue'\nimport Collapsible, { type CollapsibleProps } from './components/PropertyRow/Collapsible.vue'\nimport PropertyRow, { type PropertyRowProps } from './components/PropertyRow/PropertyRow.vue'\nimport Tag from './components/Tag/Tag.vue'\nimport TypingIndicator from './components/TypingIndicator/TypingIndicator.vue'\n\n/** @deprecated Renamed to ActionBar. */\nexport const BulkActions = ActionBar\n/** @deprecated Renamed to ActionBarProps. */\nexport type BulkActionsProps = ActionBarProps\n/** @deprecated Renamed to ActionBarAction. */\nexport type BulkAction = ActionBarAction\n/** @deprecated Renamed to Alert. */\nexport const Banner = Alert\n/** @deprecated Renamed to AlertProps. */\nexport type BannerProps = AlertProps\n/** @deprecated Renamed to AlertTone. */\nexport type BannerTone = AlertTone\n/** @deprecated Renamed to AlertDialog. */\nexport const ConfirmDialog = AlertDialog\n/** @deprecated Renamed to AlertDialogProps. */\nexport type ConfirmDialogProps = AlertDialogProps\n/** @deprecated Renamed to Badge. */\nexport const Pill = Badge\n/** @deprecated Renamed to BadgeProps. */\nexport type PillProps = BadgeProps\n/** @deprecated Renamed to BadgeTone. */\nexport type PillTone = BadgeTone\n/** @deprecated Renamed to Calendar. */\nexport const CalendarMonth = Calendar\n/** @deprecated Renamed to CalendarProps. */\nexport type CalendarMonthProps = CalendarProps\n/** @deprecated Renamed to DataList. */\nexport const List = DataList\n/** @deprecated Renamed to DataListProps. */\nexport type ListProps<T> = DataListProps<T>\n/** @deprecated Renamed to DataListGroup. */\nexport type ListGroup<T> = DataListGroup<T>\n/** @deprecated Renamed to Dialog. */\nexport const Modal = Dialog\n/** @deprecated Renamed to DialogProps. */\nexport type ModalProps = DialogProps\n/** @deprecated Renamed to DropdownMenu. */\nexport const OptionsMenu = DropdownMenu\n/** @deprecated Renamed to DropdownMenuProps. */\nexport type OptionsMenuProps = DropdownMenuProps\n/** @deprecated Renamed to DropdownMenuAction. */\nexport type OptionsMenuAction = DropdownMenuAction\n/** @deprecated Renamed to DropdownMenuEntry. */\nexport type OptionsMenuItem = DropdownMenuEntry\n/** @deprecated Renamed to ErrorSummary. */\nexport const FormErrors = ErrorSummary\n/** @deprecated Renamed to ErrorSummaryProps. */\nexport type FormErrorsProps = ErrorSummaryProps\n/** @deprecated Renamed to FilterMenu. */\nexport const FilterFieldPicker = FilterMenu\n/** @deprecated Renamed to FilterMenuProps. */\nexport type FilterFieldPickerProps = FilterMenuProps\n/** @deprecated Renamed to SortMenu. */\nexport const SortControl = SortMenu\n/** @deprecated Renamed to SortMenuProps. */\nexport type SortControlProps = SortMenuProps\n/** @deprecated Renamed to FormField. */\nexport const Field = FormField\n/** @deprecated Renamed to FormFieldProps. */\nexport type FieldProps = FormFieldProps\n/** @deprecated Renamed to ImageUpload. */\nexport const ImageInput = ImageUpload\n/** @deprecated Renamed to ImageUploadProps. */\nexport type ImageInputProps = ImageUploadProps\n/** @deprecated Renamed to Input. */\nexport const TextInput = Input\n/** @deprecated Renamed to InputProps. */\nexport type TextInputProps = InputProps\n/** @deprecated Renamed to Editable. */\nexport const InlineField = Editable\n/** @deprecated Renamed to EditableProps. */\nexport type InlineFieldProps = EditableProps\n/** @deprecated Renamed to PropertyList. */\nexport const InlineForm = PropertyList\n/** @deprecated Renamed to PropertyListField. */\nexport type InlineFormField = PropertyListField\n/** @deprecated Renamed to Collapsible. */\nexport const LedgerMore = Collapsible\n/** @deprecated Renamed to CollapsibleProps. */\nexport type LedgerMoreProps = CollapsibleProps\n/** @deprecated Renamed to PropertyRow. */\nexport const LedgerRow = PropertyRow\n/** @deprecated Renamed to PropertyRowProps. */\nexport type LedgerRowProps = PropertyRowProps\n/** @deprecated Renamed to TypingIndicator. */\nexport const TypingDots = TypingIndicator\n\n/** @deprecated An outline Tag: `<Tag variant=\"outline\">`. */\nexport const Chip: FunctionalComponent<{ label?: string; muted?: boolean }> = (props, { slots }) =>\n h(Tag, { variant: 'outline', name: props.label, muted: props.muted }, slots)\nChip.props = ['label', 'muted']\n/** @deprecated Use TagProps with `variant: 'outline'`. */\nexport interface ChipProps {\n label?: string\n muted?: boolean\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAawC,IAAcxC,GAMdyC,IAASxC,GAMTyC,IAAgBxC,GAIhByC,IAAOxC,GAMPyC,IAAgBxC,GAIhByC,IAAOxC,GAMPyC,IAAQxC,GAIRyC,IAAcxC,GAQdyC,IAAaxC,GAIbyC,IAAoBxC,GAIpByC,IAAcxC,GAIdyC,IAAQxC,GAIRyC,IAAaxC,GAIbyC,IAAYxC,GAIZyC,IAAcxC,GAIdyC,IAAaxC,GAIbyC,IAAaxC,GAIbyC,IAAYxC,GAIZyC,IAAaxC,GAGbyC,KAAkE,GAAO,EAAE,eACtFC,EAAEzC,GAAK;CAAE,SAAS;CAAW,MAAM0C,EAAM;CAAO,OAAOA,EAAM;AAAM,GAAGC,CAAK;AAC7E,EAAK,QAAQ,CAAC,SAAS,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBar.js","names":["_sfc_main","ActionBar_vue_vue_type_script_setup_true_lang_default","ActionBar_default"],"sources":["../../../src/components/ActionBar/ActionBar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, watch } from 'vue'\n\nimport Button from '../Button/Button.vue'\nimport Icon from '../Icon/Icon.vue'\nimport Tooltip from '../Tooltip/Tooltip.vue'\nimport CloseIcon from '../internal/CloseIcon.vue'\n\nexport interface ActionBarAction {\n label: string\n /** Passed back with `click-item`, to tell the actions apart. */\n action?: string\n icon?: string\n variant?: 'danger'\n disabled?: boolean\n [key: string]: unknown\n}\n\nexport interface ActionBarProps {\n /** How many records are selected; it shows only while there are some. */\n count: number\n /** Two or three; put the rest in an DropdownMenu in the default slot. */\n actions?: ActionBarAction[]\n /** Adds a clear button, and Escape clears (`@clear`). */\n onClear?: () => void\n /** `{count}` is the number selected. */\n label?: string\n clearLabel?: string\n /** Fixed to the foot of the viewport. False draws it in place. */\n floating?: boolean\n}\n\nconst props = withDefaults(defineProps<ActionBarProps>(), {\n actions: () => [],\n onClear: undefined,\n label: '{count} selected',\n clearLabel: 'Clear selection',\n floating: true\n})\n\nconst emit = defineEmits<{ 'click-item': [action: ActionBarAction] }>()\n\ndefineSlots<{\n /** More controls after the actions, e.g. an DropdownMenu. */\n default?: () => unknown\n}>()\n\nconst text = computed(() => props.label.replace('{count}', String(props.count)))\n\n// Escape clears the selection, unless a dialog is open and takes
|
|
1
|
+
{"version":3,"file":"ActionBar.js","names":["_sfc_main","ActionBar_vue_vue_type_script_setup_true_lang_default","ActionBar_default"],"sources":["../../../src/components/ActionBar/ActionBar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, watch } from 'vue'\n\nimport Button from '../Button/Button.vue'\nimport DropdownMenu from '../DropdownMenu/DropdownMenu.vue'\nimport Icon from '../Icon/Icon.vue'\nimport Kbd from '../Kbd/Kbd.vue'\nimport Tooltip from '../Tooltip/Tooltip.vue'\nimport CloseIcon from '../internal/CloseIcon.vue'\n\nexport interface ActionBarOption {\n label: string\n /** Passed back as the action's `value`. */\n value: unknown\n icon?: string\n disabled?: boolean\n}\n\nexport interface ActionBarAction {\n label: string\n /** Passed back with `click-item`, to tell the actions apart. */\n action?: string\n icon?: string\n variant?: 'danger'\n disabled?: boolean\n /** Why it's disabled, as its tooltip, e.g. \"None of these are archived\". */\n disabledReason?: string\n /** A single key that runs it while records are selected (not while typing, with a modifier, or with a dialog or menu\n * open), shown on the button. Not for an action with `options`. */\n shortcut?: string\n /** Makes it a menu: picking one emits `click-item` with that option's `value`, e.g. Set status › Done. */\n options?: ActionBarOption[]\n [key: string]: unknown\n}\n\nexport interface ActionBarProps {\n /** How many records are selected; it shows only while there are some. */\n count: number\n /** Two or three; put the rest in an DropdownMenu in the default slot. */\n actions?: ActionBarAction[]\n /** Adds a clear button, and Escape clears (`@clear`). */\n onClear?: () => void\n /** `{count}` is the number selected. */\n label?: string\n clearLabel?: string\n /** Fixed to the foot of the viewport. False draws it in place. */\n floating?: boolean\n}\n\nconst props = withDefaults(defineProps<ActionBarProps>(), {\n actions: () => [],\n onClear: undefined,\n label: '{count} selected',\n clearLabel: 'Clear selection',\n floating: true\n})\n\nconst emit = defineEmits<{ 'click-item': [action: ActionBarAction & { value?: unknown }] }>()\n\ndefineSlots<{\n /** More controls after the actions, e.g. an DropdownMenu. */\n default?: () => unknown\n}>()\n\nconst text = computed(() => props.label.replace('{count}', String(props.count)))\n\nconst menuItems = (item: ActionBarAction) =>\n (item.options ?? []).map((option, index) => ({\n type: 'action' as const,\n label: option.label,\n action: String(index),\n icon: option.icon,\n disabled: option.disabled\n }))\nconst pick = (item: ActionBarAction, index: string | undefined) => {\n const option = item.options?.[Number(index)]\n if (option) emit('click-item', { ...item, value: option.value })\n}\n\nconst typing = (target: EventTarget | null) =>\n target instanceof HTMLElement &&\n !!target.closest('input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]')\n\n// Escape clears the selection and an action's key runs it, unless a dialog or menu is open and takes the key.\nfunction onKeydown(event: KeyboardEvent) {\n if (event.defaultPrevented || document.querySelector('[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"]')) return\n if (event.key === 'Escape') {\n props.onClear?.()\n return\n }\n if (event.metaKey || event.ctrlKey || event.altKey || typing(event.target)) return\n const item = props.actions.find(\n (a) => a.shortcut && !a.options && !a.disabled && a.shortcut.toLowerCase() === event.key.toLowerCase()\n )\n if (!item) return\n event.preventDefault()\n emit('click-item', item)\n}\n\nwatch(\n () => props.count > 0 && (!!props.onClear || props.actions.some((a) => a.shortcut)),\n (listening) => {\n if (listening) document.addEventListener('keydown', onKeydown)\n else document.removeEventListener('keydown', onKeydown)\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => document.removeEventListener('keydown', onKeydown))\n</script>\n\n<!-- Actions on the selected records: a floating pill with the count, the actions and a clear button. -->\n<template>\n <div\n v-if=\"count > 0\"\n :aria-label=\"text\"\n class=\"pointer-events-none flex justify-center\"\n :class=\"floating && 'fixed inset-x-0 bottom-4 z-[1150]'\"\n role=\"toolbar\"\n >\n <div\n class=\"pointer-events-auto flex animate-sui-toast-in items-center gap-2 rounded-xl border border-sui-edge bg-sui-raised py-1.5 pr-2 pl-4 text-sm text-sui-ink shadow-(--sui-shadow-floating)\"\n >\n <span aria-live=\"polite\" class=\"whitespace-nowrap tabular-nums\">{{ text }}</span>\n <span aria-hidden=\"true\" class=\"mx-1 h-4 w-px bg-sui-line\" />\n <template v-for=\"(item, i) in actions\" :key=\"item.action ?? i\">\n <DropdownMenu\n v-if=\"item.options\"\n align=\"start\"\n :items=\"menuItems(item)\"\n :tooltip=\"null\"\n @click-item=\"pick(item, $event.action)\"\n >\n <template #trigger>\n <Button :disabled=\"item.disabled\" size=\"sm\" variant=\"secondary\">\n <Icon v-if=\"item.icon\" :name=\"item.icon\" />\n {{ item.label }}\n <Icon color=\"ink-subtle\" name=\"chevron-down\" />\n </Button>\n </template>\n </DropdownMenu>\n <Tooltip v-else :disabled=\"!item.disabled || !item.disabledReason\" :text=\"item.disabledReason\">\n <Button\n :aria-keyshortcuts=\"item.shortcut\"\n :disabled=\"item.disabled\"\n size=\"sm\"\n :variant=\"item.variant === 'danger' ? 'danger-outline' : 'secondary'\"\n @click=\"emit('click-item', item)\"\n >\n <Icon v-if=\"item.icon\" :name=\"item.icon\" />\n {{ item.label }}\n <Kbd v-if=\"item.shortcut\" class=\"ml-0.5\">{{ item.shortcut.toUpperCase() }}</Kbd>\n </Button>\n </Tooltip>\n </template>\n <slot />\n <Tooltip v-if=\"onClear\" :text=\"clearLabel\">\n <Button :aria-label=\"clearLabel\" icon-only size=\"xs\" variant=\"ghost\" @click=\"onClear()\">\n <CloseIcon class=\"fill-sui-ink-subtle stroke-sui-ink-subtle\" />\n </Button>\n </Tooltip>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export interface ActionBarOption {
|
|
2
|
+
label: string;
|
|
3
|
+
/** Passed back as the action's `value`. */
|
|
4
|
+
value: unknown;
|
|
5
|
+
icon?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
1
8
|
export interface ActionBarAction {
|
|
2
9
|
label: string;
|
|
3
10
|
/** Passed back with `click-item`, to tell the actions apart. */
|
|
@@ -5,6 +12,13 @@ export interface ActionBarAction {
|
|
|
5
12
|
icon?: string;
|
|
6
13
|
variant?: 'danger';
|
|
7
14
|
disabled?: boolean;
|
|
15
|
+
/** Why it's disabled, as its tooltip, e.g. "None of these are archived". */
|
|
16
|
+
disabledReason?: string;
|
|
17
|
+
/** A single key that runs it while records are selected (not while typing, with a modifier, or with a dialog or menu
|
|
18
|
+
* open), shown on the button. Not for an action with `options`. */
|
|
19
|
+
shortcut?: string;
|
|
20
|
+
/** Makes it a menu: picking one emits `click-item` with that option's `value`, e.g. Set status › Done. */
|
|
21
|
+
options?: ActionBarOption[];
|
|
8
22
|
[key: string]: unknown;
|
|
9
23
|
}
|
|
10
24
|
export interface ActionBarProps {
|
|
@@ -25,9 +39,13 @@ type __VLS_Slots = {
|
|
|
25
39
|
default?: () => unknown;
|
|
26
40
|
};
|
|
27
41
|
declare const __VLS_base: import("vue").DefineComponent<ActionBarProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
|
-
"click-item": (action: ActionBarAction
|
|
42
|
+
"click-item": (action: ActionBarAction & {
|
|
43
|
+
value?: unknown;
|
|
44
|
+
}) => any;
|
|
29
45
|
}, string, import("vue").PublicProps, Readonly<ActionBarProps> & Readonly<{
|
|
30
|
-
"onClick-item"?: ((action: ActionBarAction
|
|
46
|
+
"onClick-item"?: ((action: ActionBarAction & {
|
|
47
|
+
value?: unknown;
|
|
48
|
+
}) => any) | undefined;
|
|
31
49
|
}>, {
|
|
32
50
|
label: string;
|
|
33
51
|
actions: ActionBarAction[];
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import e from "../Button/Button.js";
|
|
2
2
|
import t from "../Icon/Icon.js";
|
|
3
3
|
import n from "../Tooltip/Tooltip.js";
|
|
4
|
-
import r from "../
|
|
5
|
-
import
|
|
4
|
+
import r from "../DropdownMenu/DropdownMenu.js";
|
|
5
|
+
import i from "../Kbd/Kbd.js";
|
|
6
|
+
import a from "../internal/CloseIcon.js";
|
|
7
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, normalizeClass as h, onBeforeUnmount as g, openBlock as _, renderList as v, renderSlot as y, toDisplayString as b, watch as x, withCtx as S } from "vue";
|
|
6
8
|
//#region src/components/ActionBar/ActionBar.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var
|
|
9
|
+
var C = ["aria-label"], w = { class: "pointer-events-auto flex animate-sui-toast-in items-center gap-2 rounded-xl border border-sui-edge bg-sui-raised py-1.5 pr-2 pl-4 text-sm text-sui-ink shadow-(--sui-shadow-floating)" }, T = {
|
|
8
10
|
"aria-live": "polite",
|
|
9
11
|
class: "whitespace-nowrap tabular-nums"
|
|
10
|
-
},
|
|
12
|
+
}, E = /*@__PURE__*/ m({
|
|
11
13
|
__name: "ActionBar",
|
|
12
14
|
props: {
|
|
13
15
|
count: {},
|
|
@@ -24,62 +26,125 @@ var x = ["aria-label"], S = { class: "pointer-events-auto flex animate-sui-toast
|
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
28
|
emits: ["click-item"],
|
|
27
|
-
setup(
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
setup(m, { emit: E }) {
|
|
30
|
+
let D = m, O = E, k = s(() => D.label.replace("{count}", String(D.count))), A = (e) => (e.options ?? []).map((e, t) => ({
|
|
31
|
+
type: "action",
|
|
32
|
+
label: e.label,
|
|
33
|
+
action: String(t),
|
|
34
|
+
icon: e.icon,
|
|
35
|
+
disabled: e.disabled
|
|
36
|
+
})), j = (e, t) => {
|
|
37
|
+
let n = e.options?.[Number(t)];
|
|
38
|
+
n && O("click-item", {
|
|
39
|
+
...e,
|
|
40
|
+
value: n.value
|
|
41
|
+
});
|
|
42
|
+
}, M = (e) => e instanceof HTMLElement && !!e.closest("input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]");
|
|
43
|
+
function N(e) {
|
|
44
|
+
if (e.defaultPrevented || document.querySelector("[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"]")) return;
|
|
45
|
+
if (e.key === "Escape") {
|
|
46
|
+
D.onClear?.();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (e.metaKey || e.ctrlKey || e.altKey || M(e.target)) return;
|
|
50
|
+
let t = D.actions.find((t) => t.shortcut && !t.options && !t.disabled && t.shortcut.toLowerCase() === e.key.toLowerCase());
|
|
51
|
+
t && (e.preventDefault(), O("click-item", t));
|
|
31
52
|
}
|
|
32
|
-
return
|
|
33
|
-
e ? document.addEventListener("keydown",
|
|
34
|
-
}, { immediate: !0 }),
|
|
53
|
+
return x(() => D.count > 0 && (!!D.onClear || D.actions.some((e) => e.shortcut)), (e) => {
|
|
54
|
+
e ? document.addEventListener("keydown", N) : document.removeEventListener("keydown", N);
|
|
55
|
+
}, { immediate: !0 }), g(() => document.removeEventListener("keydown", N)), (s, g) => m.count > 0 ? (_(), u("div", {
|
|
35
56
|
key: 0,
|
|
36
|
-
"aria-label":
|
|
37
|
-
class:
|
|
57
|
+
"aria-label": k.value,
|
|
58
|
+
class: h(["pointer-events-none flex justify-center", m.floating && "fixed inset-x-0 bottom-4 z-[1150]"]),
|
|
38
59
|
role: "toolbar"
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
}, [d("div", w, [
|
|
61
|
+
d("span", T, b(k.value), 1),
|
|
62
|
+
g[1] ||= d("span", {
|
|
42
63
|
"aria-hidden": "true",
|
|
43
64
|
class: "mx-1 h-4 w-px bg-sui-line"
|
|
44
65
|
}, null, -1),
|
|
45
|
-
(
|
|
46
|
-
key:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
(_(!0), u(o, null, v(m.actions, (a, s) => (_(), u(o, { key: a.action ?? s }, [a.options ? (_(), c(r, {
|
|
67
|
+
key: 0,
|
|
68
|
+
align: "start",
|
|
69
|
+
items: A(a),
|
|
70
|
+
tooltip: null,
|
|
71
|
+
onClickItem: (e) => j(a, e.action)
|
|
51
72
|
}, {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
trigger: S(() => [p(e, {
|
|
74
|
+
disabled: a.disabled,
|
|
75
|
+
size: "sm",
|
|
76
|
+
variant: "secondary"
|
|
77
|
+
}, {
|
|
78
|
+
default: S(() => [
|
|
79
|
+
a.icon ? (_(), c(t, {
|
|
80
|
+
key: 0,
|
|
81
|
+
name: a.icon
|
|
82
|
+
}, null, 8, ["name"])) : l("", !0),
|
|
83
|
+
f(" " + b(a.label) + " ", 1),
|
|
84
|
+
p(t, {
|
|
85
|
+
color: "ink-subtle",
|
|
86
|
+
name: "chevron-down"
|
|
87
|
+
})
|
|
88
|
+
]),
|
|
89
|
+
_: 2
|
|
90
|
+
}, 1032, ["disabled"])]),
|
|
91
|
+
_: 2
|
|
92
|
+
}, 1032, ["items", "onClickItem"])) : (_(), c(n, {
|
|
93
|
+
key: 1,
|
|
94
|
+
disabled: !a.disabled || !a.disabledReason,
|
|
95
|
+
text: a.disabledReason
|
|
96
|
+
}, {
|
|
97
|
+
default: S(() => [p(e, {
|
|
98
|
+
"aria-keyshortcuts": a.shortcut,
|
|
99
|
+
disabled: a.disabled,
|
|
100
|
+
size: "sm",
|
|
101
|
+
variant: a.variant === "danger" ? "danger-outline" : "secondary",
|
|
102
|
+
onClick: (e) => O("click-item", a)
|
|
103
|
+
}, {
|
|
104
|
+
default: S(() => [
|
|
105
|
+
a.icon ? (_(), c(t, {
|
|
106
|
+
key: 0,
|
|
107
|
+
name: a.icon
|
|
108
|
+
}, null, 8, ["name"])) : l("", !0),
|
|
109
|
+
f(" " + b(a.label) + " ", 1),
|
|
110
|
+
a.shortcut ? (_(), c(i, {
|
|
111
|
+
key: 1,
|
|
112
|
+
class: "ml-0.5"
|
|
113
|
+
}, {
|
|
114
|
+
default: S(() => [f(b(a.shortcut.toUpperCase()), 1)]),
|
|
115
|
+
_: 2
|
|
116
|
+
}, 1024)) : l("", !0)
|
|
117
|
+
]),
|
|
118
|
+
_: 2
|
|
119
|
+
}, 1032, [
|
|
120
|
+
"aria-keyshortcuts",
|
|
121
|
+
"disabled",
|
|
122
|
+
"variant",
|
|
123
|
+
"onClick"
|
|
124
|
+
])]),
|
|
56
125
|
_: 2
|
|
57
|
-
}, 1032, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"onClick"
|
|
61
|
-
]))), 128)),
|
|
62
|
-
_(a.$slots, "default"),
|
|
63
|
-
f.onClear ? (h(), o(n, {
|
|
126
|
+
}, 1032, ["disabled", "text"]))], 64))), 128)),
|
|
127
|
+
y(s.$slots, "default"),
|
|
128
|
+
m.onClear ? (_(), c(n, {
|
|
64
129
|
key: 0,
|
|
65
|
-
text:
|
|
130
|
+
text: m.clearLabel
|
|
66
131
|
}, {
|
|
67
|
-
default:
|
|
68
|
-
"aria-label":
|
|
132
|
+
default: S(() => [p(e, {
|
|
133
|
+
"aria-label": m.clearLabel,
|
|
69
134
|
"icon-only": "",
|
|
70
135
|
size: "xs",
|
|
71
136
|
variant: "ghost",
|
|
72
|
-
onClick:
|
|
137
|
+
onClick: g[0] ||= (e) => m.onClear()
|
|
73
138
|
}, {
|
|
74
|
-
default:
|
|
139
|
+
default: S(() => [p(a, { class: "fill-sui-ink-subtle stroke-sui-ink-subtle" })]),
|
|
75
140
|
_: 1
|
|
76
141
|
}, 8, ["aria-label"])]),
|
|
77
142
|
_: 1
|
|
78
|
-
}, 8, ["text"])) :
|
|
79
|
-
])], 10,
|
|
143
|
+
}, 8, ["text"])) : l("", !0)
|
|
144
|
+
])], 10, C)) : l("", !0);
|
|
80
145
|
}
|
|
81
146
|
});
|
|
82
147
|
//#endregion
|
|
83
|
-
export {
|
|
148
|
+
export { E as default };
|
|
84
149
|
|
|
85
150
|
//# sourceMappingURL=ActionBar.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBar.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_toDisplayString","_Fragment","_renderList","_createBlock","
|
|
1
|
+
{"version":3,"file":"ActionBar.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_toDisplayString","_Fragment","_renderList","_createBlock","DropdownMenu","_withCtx","_createVNode","Button","Icon","_createCommentVNode","_createTextVNode","Tooltip","Kbd","_renderSlot","CloseIcon","Button_default","Icon_default","Tooltip_default","DropdownMenu_default","Kbd_default","CloseIcon_default","_hoisted_1","_hoisted_2","_hoisted_3","ActionBar_vue_vue_type_script_setup_true_lang_default","__emit","props","__props","emit","text","computed","menuItems","item","option","index","pick","typing","target","onKeydown","event","a","watch","listening","onBeforeUnmount","openBlock","createElementBlock","normalizeClass","createElementVNode","toDisplayString","_cache","Fragment","renderList","i","createBlock","$event","withCtx","createVNode","createCommentVNode","createTextVNode","renderSlot","_ctx"],"sources":["../../../src/components/ActionBar/ActionBar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, watch } from 'vue'\n\nimport Button from '../Button/Button.vue'\nimport DropdownMenu from '../DropdownMenu/DropdownMenu.vue'\nimport Icon from '../Icon/Icon.vue'\nimport Kbd from '../Kbd/Kbd.vue'\nimport Tooltip from '../Tooltip/Tooltip.vue'\nimport CloseIcon from '../internal/CloseIcon.vue'\n\nexport interface ActionBarOption {\n label: string\n /** Passed back as the action's `value`. */\n value: unknown\n icon?: string\n disabled?: boolean\n}\n\nexport interface ActionBarAction {\n label: string\n /** Passed back with `click-item`, to tell the actions apart. */\n action?: string\n icon?: string\n variant?: 'danger'\n disabled?: boolean\n /** Why it's disabled, as its tooltip, e.g. \"None of these are archived\". */\n disabledReason?: string\n /** A single key that runs it while records are selected (not while typing, with a modifier, or with a dialog or menu\n * open), shown on the button. Not for an action with `options`. */\n shortcut?: string\n /** Makes it a menu: picking one emits `click-item` with that option's `value`, e.g. Set status › Done. */\n options?: ActionBarOption[]\n [key: string]: unknown\n}\n\nexport interface ActionBarProps {\n /** How many records are selected; it shows only while there are some. */\n count: number\n /** Two or three; put the rest in an DropdownMenu in the default slot. */\n actions?: ActionBarAction[]\n /** Adds a clear button, and Escape clears (`@clear`). */\n onClear?: () => void\n /** `{count}` is the number selected. */\n label?: string\n clearLabel?: string\n /** Fixed to the foot of the viewport. False draws it in place. */\n floating?: boolean\n}\n\nconst props = withDefaults(defineProps<ActionBarProps>(), {\n actions: () => [],\n onClear: undefined,\n label: '{count} selected',\n clearLabel: 'Clear selection',\n floating: true\n})\n\nconst emit = defineEmits<{ 'click-item': [action: ActionBarAction & { value?: unknown }] }>()\n\ndefineSlots<{\n /** More controls after the actions, e.g. an DropdownMenu. */\n default?: () => unknown\n}>()\n\nconst text = computed(() => props.label.replace('{count}', String(props.count)))\n\nconst menuItems = (item: ActionBarAction) =>\n (item.options ?? []).map((option, index) => ({\n type: 'action' as const,\n label: option.label,\n action: String(index),\n icon: option.icon,\n disabled: option.disabled\n }))\nconst pick = (item: ActionBarAction, index: string | undefined) => {\n const option = item.options?.[Number(index)]\n if (option) emit('click-item', { ...item, value: option.value })\n}\n\nconst typing = (target: EventTarget | null) =>\n target instanceof HTMLElement &&\n !!target.closest('input, textarea, select, [contenteditable=\"\"], [contenteditable=\"true\"]')\n\n// Escape clears the selection and an action's key runs it, unless a dialog or menu is open and takes the key.\nfunction onKeydown(event: KeyboardEvent) {\n if (event.defaultPrevented || document.querySelector('[role=\"dialog\"], [role=\"alertdialog\"], [role=\"menu\"]')) return\n if (event.key === 'Escape') {\n props.onClear?.()\n return\n }\n if (event.metaKey || event.ctrlKey || event.altKey || typing(event.target)) return\n const item = props.actions.find(\n (a) => a.shortcut && !a.options && !a.disabled && a.shortcut.toLowerCase() === event.key.toLowerCase()\n )\n if (!item) return\n event.preventDefault()\n emit('click-item', item)\n}\n\nwatch(\n () => props.count > 0 && (!!props.onClear || props.actions.some((a) => a.shortcut)),\n (listening) => {\n if (listening) document.addEventListener('keydown', onKeydown)\n else document.removeEventListener('keydown', onKeydown)\n },\n { immediate: true }\n)\n\nonBeforeUnmount(() => document.removeEventListener('keydown', onKeydown))\n</script>\n\n<!-- Actions on the selected records: a floating pill with the count, the actions and a clear button. -->\n<template>\n <div\n v-if=\"count > 0\"\n :aria-label=\"text\"\n class=\"pointer-events-none flex justify-center\"\n :class=\"floating && 'fixed inset-x-0 bottom-4 z-[1150]'\"\n role=\"toolbar\"\n >\n <div\n class=\"pointer-events-auto flex animate-sui-toast-in items-center gap-2 rounded-xl border border-sui-edge bg-sui-raised py-1.5 pr-2 pl-4 text-sm text-sui-ink shadow-(--sui-shadow-floating)\"\n >\n <span aria-live=\"polite\" class=\"whitespace-nowrap tabular-nums\">{{ text }}</span>\n <span aria-hidden=\"true\" class=\"mx-1 h-4 w-px bg-sui-line\" />\n <template v-for=\"(item, i) in actions\" :key=\"item.action ?? i\">\n <DropdownMenu\n v-if=\"item.options\"\n align=\"start\"\n :items=\"menuItems(item)\"\n :tooltip=\"null\"\n @click-item=\"pick(item, $event.action)\"\n >\n <template #trigger>\n <Button :disabled=\"item.disabled\" size=\"sm\" variant=\"secondary\">\n <Icon v-if=\"item.icon\" :name=\"item.icon\" />\n {{ item.label }}\n <Icon color=\"ink-subtle\" name=\"chevron-down\" />\n </Button>\n </template>\n </DropdownMenu>\n <Tooltip v-else :disabled=\"!item.disabled || !item.disabledReason\" :text=\"item.disabledReason\">\n <Button\n :aria-keyshortcuts=\"item.shortcut\"\n :disabled=\"item.disabled\"\n size=\"sm\"\n :variant=\"item.variant === 'danger' ? 'danger-outline' : 'secondary'\"\n @click=\"emit('click-item', item)\"\n >\n <Icon v-if=\"item.icon\" :name=\"item.icon\" />\n {{ item.label }}\n <Kbd v-if=\"item.shortcut\" class=\"ml-0.5\">{{ item.shortcut.toUpperCase() }}</Kbd>\n </Button>\n </Tooltip>\n </template>\n <slot />\n <Tooltip v-if=\"onClear\" :text=\"clearLabel\">\n <Button :aria-label=\"clearLabel\" icon-only size=\"xs\" variant=\"ghost\" @click=\"onClear()\">\n <CloseIcon class=\"fill-sui-ink-subtle stroke-sui-ink-subtle\" />\n </Button>\n </Tooltip>\n </div>\n </div>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as ActionBar } from './ActionBar.vue';
|
|
2
|
-
export type { ActionBarAction, ActionBarProps } from './ActionBar.vue';
|
|
2
|
+
export type { ActionBarAction, ActionBarOption, ActionBarProps } from './ActionBar.vue';
|