@sparklingopinions/sparkling-ui 0.4.2 → 0.6.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 +1 -1
- package/dist/aliases.d.ts +176 -26
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/Avatar.vue.d.ts +3 -2
- package/dist/components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js +20 -14
- package/dist/components/Avatar/Avatar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Board/Board.js.map +1 -1
- package/dist/components/Board/Board.vue.d.ts +6 -2
- package/dist/components/Board/Board.vue_vue_type_script_setup_true_lang.js +142 -74
- package/dist/components/Board/Board.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/components/Button/Button.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +7 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenu.vue.d.ts +44 -0
- package/dist/components/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/components/ContextMenu/ContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/DataList/DataList.js.map +1 -1
- package/dist/components/DataList/DataList.vue.d.ts +8 -0
- package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js +71 -52
- package/dist/components/DataList/DataList.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DataList/types.d.ts +5 -1
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Dialog/Dialog.vue.d.ts +22 -6
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js +174 -72
- package/dist/components/Dialog/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Dialog/useSheetDrag.d.ts +16 -0
- package/dist/components/Dialog/useSheetDrag.js +37 -0
- package/dist/components/Dialog/useSheetDrag.js.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.vue.d.ts +6 -30
- package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js +54 -74
- package/dist/components/DropdownMenu/DropdownMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.vue.d.ts +9 -3
- package/dist/components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js +35 -7
- package/dist/components/EmptyState/EmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/FilterChip.js.map +1 -1
- package/dist/components/Filters/FilterChip.vue.d.ts +4 -1
- package/dist/components/Filters/FilterChip.vue_vue_type_script_setup_true_lang.js +29 -24
- package/dist/components/Filters/FilterChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/FilterMenu.js.map +1 -1
- package/dist/components/Filters/FilterMenu.vue.d.ts +20 -1
- package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js +78 -56
- package/dist/components/Filters/FilterMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/SortMenu.js.map +1 -1
- package/dist/components/Filters/SortMenu.vue.d.ts +21 -1
- package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js +90 -66
- package/dist/components/Filters/SortMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Filters/index.d.ts +2 -1
- package/dist/components/Filters/trigger.d.ts +17 -0
- package/dist/components/Filters/trigger.js +33 -0
- package/dist/components/Filters/trigger.js.map +1 -0
- package/dist/components/Filters/types.d.ts +8 -0
- package/dist/components/FormField/FormField.js.map +1 -1
- package/dist/components/FormField/FormField.vue.d.ts +10 -0
- package/dist/components/FormField/FormField.vue_vue_type_script_setup_true_lang.js +31 -20
- package/dist/components/FormField/FormField.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Icon/iconSet.js +9 -1
- package/dist/components/Icon/iconSet.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.vue.d.ts +6 -3
- package/dist/components/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js +20 -17
- package/dist/components/SegmentedControl/SegmentedControl.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts +1 -1
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.vue.d.ts +4 -0
- package/dist/components/Table/Table.vue_vue_type_script_setup_true_lang.js +66 -56
- package/dist/components/Table/Table.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Table/types.d.ts +2 -0
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Tag/Tag.vue.d.ts +16 -3
- package/dist/components/Tag/Tag.vue_vue_type_script_setup_true_lang.js +42 -19
- package/dist/components/Tag/Tag.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Toast/ToastMessage.js.map +1 -1
- package/dist/components/Toast/ToastMessage.vue.d.ts +13 -1
- package/dist/components/Toast/ToastMessage.vue_vue_type_script_setup_true_lang.js +58 -23
- package/dist/components/Toast/ToastMessage.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/Toast/Toaster.js.map +1 -1
- package/dist/components/Toast/Toaster.vue.d.ts +7 -3
- package/dist/components/Toast/Toaster.vue_vue_type_script_setup_true_lang.js +50 -21
- package/dist/components/Toast/Toaster.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/internal/MenuItemContent.js +7 -0
- package/dist/components/internal/MenuItemContent.js.map +1 -0
- package/dist/components/internal/MenuItemContent.vue.d.ts +7 -0
- package/dist/components/internal/MenuItemContent.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/components/internal/MenuItemContent.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/internal/menu.d.ts +46 -0
- package/dist/components/internal/menu.js +33 -0
- package/dist/components/internal/menu.js.map +1 -0
- package/dist/composables/toast.d.ts +20 -5
- package/dist/composables/toast.js +28 -20
- package/dist/composables/toast.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +34 -33
- package/package.json +1 -1
- package/src/styles/tailwind.css +29 -0
|
@@ -3,22 +3,39 @@ import t from "../Icon/Icon.js";
|
|
|
3
3
|
import n from "../Tooltip/Tooltip.js";
|
|
4
4
|
import r from "../internal/CloseIcon.js";
|
|
5
5
|
import { focusFirst as i } from "./focus.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useSheetDrag as a } from "./useSheetDrag.js";
|
|
7
|
+
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, mergeModels as m, mergeProps as ee, normalizeClass as h, normalizeStyle as g, onBeforeUnmount as te, openBlock as _, ref as v, renderSlot as y, toDisplayString as b, unref as x, useModel as ne, useSlots as re, useTemplateRef as ie, watch as S, withCtx as C, withKeys as w, withModifiers as ae } from "vue";
|
|
7
8
|
import { DialogContent as T, DialogOverlay as E, DialogPortal as D, DialogRoot as O, DialogTitle as k } from "reka-ui";
|
|
8
9
|
//#region src/components/Dialog/Dialog.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
-
var A = {
|
|
10
|
+
var A = {
|
|
10
11
|
key: 0,
|
|
11
|
-
class: "
|
|
12
|
+
class: "flex min-h-11 items-center justify-between gap-3 pt-2 pr-4 pb-1 pl-5"
|
|
13
|
+
}, j = {
|
|
14
|
+
class: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-2 pb-5 text-sm leading-5 text-sui-ink-emphasis",
|
|
15
|
+
"data-modal-body": ""
|
|
12
16
|
}, M = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "flex shrink-0 flex-col gap-2.5 border-t border-sui-line-subtle bg-sui-surface px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
|
|
19
|
+
"data-modal-footer": ""
|
|
20
|
+
}, N = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "flex min-w-0 items-center justify-center gap-2"
|
|
23
|
+
}, P = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "min-w-0 truncate text-xs text-sui-ink-muted"
|
|
26
|
+
}, F = { class: "flex items-center justify-between gap-3" }, I = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "mt-0.5 flex flex-col items-center gap-1.5 pr-1.5"
|
|
29
|
+
}, L = {
|
|
13
30
|
key: 1,
|
|
14
31
|
class: "flex shrink-0 items-center justify-between gap-3 rounded-t-xl border-b border-sui-line-subtle bg-sui-surface px-5 py-4 text-sui-ink",
|
|
15
32
|
"data-modal-header": ""
|
|
16
|
-
},
|
|
33
|
+
}, R = {
|
|
17
34
|
key: 0,
|
|
18
35
|
class: "min-w-0 truncate text-xs text-sui-ink-muted"
|
|
19
|
-
},
|
|
36
|
+
}, z = /*@__PURE__*/ p({
|
|
20
37
|
__name: "Dialog",
|
|
21
|
-
props: /*@__PURE__*/
|
|
38
|
+
props: /*@__PURE__*/ m({
|
|
22
39
|
title: { default: void 0 },
|
|
23
40
|
closable: {
|
|
24
41
|
type: Boolean,
|
|
@@ -36,7 +53,9 @@ var A = { class: "flex items-center justify-between gap-3" }, j = {
|
|
|
36
53
|
default: void 0
|
|
37
54
|
},
|
|
38
55
|
hint: { default: void 0 },
|
|
39
|
-
headerless: { type: Boolean }
|
|
56
|
+
headerless: { type: Boolean },
|
|
57
|
+
presentation: { default: "dialog" },
|
|
58
|
+
sheetBelow: { default: 640 }
|
|
40
59
|
}, {
|
|
41
60
|
open: {
|
|
42
61
|
type: Boolean,
|
|
@@ -44,129 +63,212 @@ var A = { class: "flex items-center justify-between gap-3" }, j = {
|
|
|
44
63
|
},
|
|
45
64
|
openModifiers: {}
|
|
46
65
|
}),
|
|
47
|
-
emits: /*@__PURE__*/
|
|
48
|
-
setup(
|
|
49
|
-
let
|
|
66
|
+
emits: /*@__PURE__*/ m(["confirm", "cancel"], ["update:open"]),
|
|
67
|
+
setup(p, { emit: m }) {
|
|
68
|
+
let z = p, B = m, V = ne(p, "open"), H = re(), U = o(() => !!H.footer || !!z.confirmLabel), W = o(() => !!z.band || !!H.hero), oe = {
|
|
50
69
|
sm: "max-w-[27rem]",
|
|
51
70
|
md: "max-w-lg",
|
|
52
71
|
record: "max-w-130",
|
|
53
72
|
lg: "max-w-2xl",
|
|
54
73
|
xl: "max-w-3xl"
|
|
55
|
-
},
|
|
74
|
+
}, se = o(() => oe[z.size ?? (W.value ? "record" : "md")]), ce = o(() => typeof z.band == "string" ? z.band : "rgb(var(--sui-accent-wash))"), G = v(!1), K, q = () => G.value = !!K?.matches;
|
|
75
|
+
S(() => [z.presentation, z.sheetBelow], ([e, t]) => {
|
|
76
|
+
K?.removeEventListener("change", q), K = e === "auto" && typeof window < "u" ? window.matchMedia(`(max-width: ${t - .02}px)`) : void 0, K?.addEventListener("change", q), q();
|
|
77
|
+
}, { immediate: !0 }), te(() => K?.removeEventListener("change", q));
|
|
78
|
+
let J = o(() => z.presentation === "sheet" || z.presentation === "auto" && G.value), Y = ie("panel"), X = a(o(() => Y.value?.$el), () => Q());
|
|
79
|
+
S(V, (e) => e && X.reset());
|
|
80
|
+
let Z = {
|
|
56
81
|
primary: "on-accent",
|
|
57
82
|
danger: "on-danger",
|
|
58
83
|
contrast: "on-contrast"
|
|
59
84
|
};
|
|
60
|
-
function
|
|
61
|
-
|
|
85
|
+
function Q() {
|
|
86
|
+
B("cancel"), V.value = !1;
|
|
87
|
+
}
|
|
88
|
+
function le(e) {
|
|
89
|
+
J.value ? B("cancel") : e.preventDefault();
|
|
62
90
|
}
|
|
63
|
-
function
|
|
64
|
-
(e.metaKey || e.ctrlKey) && (e.preventDefault(),
|
|
91
|
+
function $(e) {
|
|
92
|
+
(e.metaKey || e.ctrlKey) && (e.preventDefault(), z.confirmLabel && !z.confirmDisabled && B("confirm"));
|
|
65
93
|
}
|
|
66
|
-
return (a,
|
|
67
|
-
open:
|
|
68
|
-
"onUpdate:open":
|
|
94
|
+
return (a, o) => (_(), s(x(O), {
|
|
95
|
+
open: V.value,
|
|
96
|
+
"onUpdate:open": o[5] ||= (e) => V.value = e
|
|
69
97
|
}, {
|
|
70
|
-
default:
|
|
71
|
-
default:
|
|
72
|
-
default:
|
|
98
|
+
default: C(() => [f(x(D), null, {
|
|
99
|
+
default: C(() => [f(x(E), { class: h(["fixed inset-0 z-[1100] flex justify-center bg-sui-scrim/40 backdrop-blur-[4px] data-[state=closed]:animate-sui-scrim-out data-[state=open]:animate-sui-scrim-in", J.value ? "items-end" : "items-center"]) }, {
|
|
100
|
+
default: C(() => [J.value ? (_(), s(x(T), {
|
|
101
|
+
key: 0,
|
|
102
|
+
ref_key: "panel",
|
|
103
|
+
ref: Y,
|
|
104
|
+
"aria-describedby": void 0,
|
|
105
|
+
class: h(["relative flex max-h-[calc(100dvh-1.5rem)] w-full flex-col rounded-t-(--sui-radius-sheet) bg-sui-surface shadow-xl outline-hidden data-[state=closed]:animate-sui-sheet-out data-[state=open]:animate-sui-sheet-in motion-reduce:animate-none motion-reduce:transition-none", !x(X).dragging.value && "transition-transform duration-[250ms] ease-[cubic-bezier(0.32,0.72,0,1)]"]),
|
|
106
|
+
style: g(x(X).style.value),
|
|
107
|
+
onEscapeKeyDown: o[1] ||= (e) => B("cancel"),
|
|
108
|
+
onInteractOutside: le,
|
|
109
|
+
onKeydown: w($, ["enter"]),
|
|
110
|
+
onOpenAutoFocus: x(i)
|
|
111
|
+
}, {
|
|
112
|
+
default: C(() => [
|
|
113
|
+
p.closable ? c("", !0) : (_(), l("button", {
|
|
114
|
+
key: 0,
|
|
115
|
+
class: "pointer-events-none absolute top-2 right-3 h-7 rounded-md bg-sui-sunken px-2.5 text-13 font-medium text-sui-ink opacity-0 outline-hidden focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:sui-ring",
|
|
116
|
+
type: "button",
|
|
117
|
+
onClick: Q
|
|
118
|
+
}, b(p.closeLabel), 1)),
|
|
119
|
+
u("div", ee({
|
|
120
|
+
class: "shrink-0 cursor-grab touch-none pt-2",
|
|
121
|
+
"data-modal-header": ""
|
|
122
|
+
}, x(X).handlers), [o[6] ||= u("span", {
|
|
123
|
+
"aria-hidden": "true",
|
|
124
|
+
class: "mx-auto block h-1 w-9 rounded-full bg-sui-mark-faint"
|
|
125
|
+
}, null, -1), p.headerless ? (_(), s(x(k), {
|
|
126
|
+
key: 1,
|
|
127
|
+
class: "sr-only"
|
|
128
|
+
}, {
|
|
129
|
+
default: C(() => [d(b(p.title), 1)]),
|
|
130
|
+
_: 1
|
|
131
|
+
})) : (_(), l("div", A, [f(x(k), { class: "min-w-0 truncate text-base font-semibold text-sui-ink" }, {
|
|
132
|
+
default: C(() => [y(a.$slots, "title", {}, () => [d(b(p.title), 1)])]),
|
|
133
|
+
_: 3
|
|
134
|
+
}), p.closable ? (_(), s(n, {
|
|
135
|
+
key: 0,
|
|
136
|
+
text: p.closeLabel
|
|
137
|
+
}, {
|
|
138
|
+
default: C(() => [f(e, {
|
|
139
|
+
"aria-label": p.closeLabel,
|
|
140
|
+
class: "shrink-0",
|
|
141
|
+
"icon-only": "",
|
|
142
|
+
size: "sm",
|
|
143
|
+
variant: "ghost",
|
|
144
|
+
onClick: Q
|
|
145
|
+
}, {
|
|
146
|
+
default: C(() => [f(r, { class: "fill-sui-ink-subtle stroke-sui-ink-subtle" })]),
|
|
147
|
+
_: 1
|
|
148
|
+
}, 8, ["aria-label"])]),
|
|
149
|
+
_: 1
|
|
150
|
+
}, 8, ["text"])) : c("", !0)]))], 16),
|
|
151
|
+
u("div", j, [y(a.$slots, "default")]),
|
|
152
|
+
U.value ? (_(), l("div", M, [y(a.$slots, "footer", {}, () => [a.$slots["footer-start"] || p.hint ? (_(), l("div", N, [y(a.$slots, "footer-start"), p.hint ? (_(), l("span", P, b(p.hint), 1)) : c("", !0)])) : c("", !0), f(e, {
|
|
153
|
+
class: "w-full",
|
|
154
|
+
disabled: p.confirmDisabled,
|
|
155
|
+
size: "lg",
|
|
156
|
+
type: "button",
|
|
157
|
+
variant: p.confirmVariant,
|
|
158
|
+
onClick: o[0] ||= (e) => B("confirm")
|
|
159
|
+
}, {
|
|
160
|
+
default: C(() => [p.confirmIcon ? (_(), s(t, {
|
|
161
|
+
key: 0,
|
|
162
|
+
color: Z[p.confirmVariant],
|
|
163
|
+
name: p.confirmIcon
|
|
164
|
+
}, null, 8, ["color", "name"])) : c("", !0), d(" " + b(p.confirmLabel), 1)]),
|
|
165
|
+
_: 1
|
|
166
|
+
}, 8, ["disabled", "variant"])])])) : c("", !0)
|
|
167
|
+
]),
|
|
168
|
+
_: 3
|
|
169
|
+
}, 8, [
|
|
170
|
+
"class",
|
|
171
|
+
"style",
|
|
172
|
+
"onOpenAutoFocus"
|
|
173
|
+
])) : (_(), s(x(T), {
|
|
174
|
+
key: 1,
|
|
73
175
|
"aria-describedby": void 0,
|
|
74
|
-
class:
|
|
75
|
-
onEscapeKeyDown:
|
|
76
|
-
onInteractOutside:
|
|
77
|
-
onKeydown:
|
|
78
|
-
onOpenAutoFocus:
|
|
176
|
+
class: h(["flex max-h-[90vh] w-full flex-col bg-sui-surface shadow-xl outline-hidden data-[state=closed]:animate-sui-dialog-out data-[state=open]:animate-sui-dialog-in", [se.value, W.value ? "rounded-2xl" : "rounded-xl"]]),
|
|
177
|
+
onEscapeKeyDown: o[3] ||= (e) => B("cancel"),
|
|
178
|
+
onInteractOutside: o[4] ||= ae(() => {}, ["prevent"]),
|
|
179
|
+
onKeydown: w($, ["enter"]),
|
|
180
|
+
onOpenAutoFocus: x(i)
|
|
79
181
|
}, {
|
|
80
|
-
default:
|
|
81
|
-
|
|
182
|
+
default: C(() => [
|
|
183
|
+
W.value ? (_(), l("div", {
|
|
82
184
|
key: 0,
|
|
83
185
|
class: "shrink-0 rounded-t-2xl pt-3.5 pr-3.5 pb-4.5 pl-5 transition-colors duration-200",
|
|
84
186
|
"data-modal-header": "",
|
|
85
|
-
style:
|
|
86
|
-
}, [
|
|
87
|
-
default:
|
|
187
|
+
style: g({ backgroundColor: ce.value })
|
|
188
|
+
}, [u("div", F, [f(x(k), { class: "text-13 leading-5 font-medium text-sui-ink-body" }, {
|
|
189
|
+
default: C(() => [d(b(p.title), 1)]),
|
|
88
190
|
_: 1
|
|
89
|
-
}),
|
|
191
|
+
}), p.closable ? (_(), s(n, {
|
|
90
192
|
key: 0,
|
|
91
|
-
text:
|
|
193
|
+
text: p.closeLabel
|
|
92
194
|
}, {
|
|
93
|
-
default:
|
|
94
|
-
"aria-label":
|
|
195
|
+
default: C(() => [f(e, {
|
|
196
|
+
"aria-label": p.closeLabel,
|
|
95
197
|
class: "shrink-0",
|
|
96
198
|
"icon-only": "",
|
|
97
199
|
size: "sm",
|
|
98
200
|
variant: "ghost",
|
|
99
|
-
onClick:
|
|
201
|
+
onClick: Q
|
|
100
202
|
}, {
|
|
101
|
-
default:
|
|
203
|
+
default: C(() => [f(r, { class: "fill-sui-ink-muted stroke-sui-ink-muted" })]),
|
|
102
204
|
_: 1
|
|
103
205
|
}, 8, ["aria-label"])]),
|
|
104
206
|
_: 1
|
|
105
|
-
}, 8, ["text"])) :
|
|
207
|
+
}, 8, ["text"])) : c("", !0)]), a.$slots.hero ? (_(), l("div", I, [y(a.$slots, "hero")])) : c("", !0)], 4)) : p.headerless ? (_(), s(x(k), {
|
|
106
208
|
key: 2,
|
|
107
209
|
class: "sr-only"
|
|
108
210
|
}, {
|
|
109
|
-
default:
|
|
211
|
+
default: C(() => [d(b(p.title), 1)]),
|
|
110
212
|
_: 1
|
|
111
|
-
})) : (
|
|
112
|
-
default:
|
|
213
|
+
})) : (_(), l("div", L, [f(x(k), { class: "min-w-0 truncate text-base font-semibold text-sui-ink" }, {
|
|
214
|
+
default: C(() => [y(a.$slots, "title", {}, () => [d(b(p.title), 1)])]),
|
|
113
215
|
_: 3
|
|
114
|
-
}),
|
|
216
|
+
}), p.closable ? (_(), s(n, {
|
|
115
217
|
key: 0,
|
|
116
|
-
text:
|
|
218
|
+
text: p.closeLabel
|
|
117
219
|
}, {
|
|
118
|
-
default:
|
|
119
|
-
"aria-label":
|
|
220
|
+
default: C(() => [f(e, {
|
|
221
|
+
"aria-label": p.closeLabel,
|
|
120
222
|
class: "shrink-0",
|
|
121
223
|
"icon-only": "",
|
|
122
224
|
size: "sm",
|
|
123
225
|
variant: "ghost",
|
|
124
|
-
onClick:
|
|
226
|
+
onClick: Q
|
|
125
227
|
}, {
|
|
126
|
-
default:
|
|
228
|
+
default: C(() => [f(r, { class: "fill-sui-ink-subtle stroke-sui-ink-subtle" })]),
|
|
127
229
|
_: 1
|
|
128
230
|
}, 8, ["aria-label"])]),
|
|
129
231
|
_: 1
|
|
130
|
-
}, 8, ["text"])) :
|
|
131
|
-
|
|
132
|
-
class:
|
|
232
|
+
}, 8, ["text"])) : c("", !0)])),
|
|
233
|
+
u("div", {
|
|
234
|
+
class: h(["overflow-y-auto bg-sui-surface text-sm text-sui-ink-emphasis", [W.value ? "px-5 pt-0.5 pb-4" : "p-5", !U.value && (W.value ? "rounded-b-2xl" : "rounded-b-xl")]]),
|
|
133
235
|
"data-modal-body": ""
|
|
134
|
-
}, [
|
|
135
|
-
|
|
236
|
+
}, [y(a.$slots, "default")], 2),
|
|
237
|
+
U.value ? (_(), l("div", {
|
|
136
238
|
key: 3,
|
|
137
|
-
class:
|
|
239
|
+
class: h(["flex shrink-0 items-center border-t border-sui-line-subtle bg-sui-canvas text-sui-ink", W.value ? "gap-2 rounded-b-2xl py-3 pr-4 pl-5" : "gap-3 rounded-b-xl px-5 py-4"]),
|
|
138
240
|
"data-modal-footer": ""
|
|
139
|
-
}, [
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
241
|
+
}, [y(a.$slots, "footer", {}, () => [
|
|
242
|
+
y(a.$slots, "footer-start"),
|
|
243
|
+
p.hint ? (_(), l("span", R, b(p.hint), 1)) : c("", !0),
|
|
244
|
+
o[7] ||= u("span", { class: "flex-1" }, null, -1),
|
|
245
|
+
f(e, {
|
|
144
246
|
type: "button",
|
|
145
247
|
variant: "ghost",
|
|
146
|
-
onClick:
|
|
248
|
+
onClick: Q
|
|
147
249
|
}, {
|
|
148
|
-
default:
|
|
250
|
+
default: C(() => [d(b(p.cancelLabel), 1)]),
|
|
149
251
|
_: 1
|
|
150
252
|
}),
|
|
151
|
-
|
|
152
|
-
disabled:
|
|
253
|
+
f(e, {
|
|
254
|
+
disabled: p.confirmDisabled,
|
|
153
255
|
type: "button",
|
|
154
|
-
variant:
|
|
155
|
-
onClick:
|
|
256
|
+
variant: p.confirmVariant,
|
|
257
|
+
onClick: o[2] ||= (e) => B("confirm")
|
|
156
258
|
}, {
|
|
157
|
-
default:
|
|
259
|
+
default: C(() => [p.confirmIcon ? (_(), s(t, {
|
|
158
260
|
key: 0,
|
|
159
|
-
color:
|
|
160
|
-
name:
|
|
161
|
-
}, null, 8, ["color", "name"])) :
|
|
261
|
+
color: Z[p.confirmVariant],
|
|
262
|
+
name: p.confirmIcon
|
|
263
|
+
}, null, 8, ["color", "name"])) : c("", !0), d(" " + b(p.confirmLabel), 1)]),
|
|
162
264
|
_: 1
|
|
163
265
|
}, 8, ["disabled", "variant"])
|
|
164
|
-
])], 2)) :
|
|
266
|
+
])], 2)) : c("", !0)
|
|
165
267
|
]),
|
|
166
268
|
_: 3
|
|
167
|
-
}, 8, ["class", "onOpenAutoFocus"])]),
|
|
269
|
+
}, 8, ["class", "onOpenAutoFocus"]))]),
|
|
168
270
|
_: 3
|
|
169
|
-
})]),
|
|
271
|
+
}, 8, ["class"])]),
|
|
170
272
|
_: 3
|
|
171
273
|
})]),
|
|
172
274
|
_: 3
|
|
@@ -174,6 +276,6 @@ var A = { class: "flex items-center justify-between gap-3" }, j = {
|
|
|
174
276
|
}
|
|
175
277
|
});
|
|
176
278
|
//#endregion
|
|
177
|
-
export {
|
|
279
|
+
export { z as default };
|
|
178
280
|
|
|
179
281
|
//# sourceMappingURL=Dialog.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.vue_vue_type_script_setup_true_lang.js","names":["$slots","_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_normalizeClass","_withModifiers","_withKeys","_createElementBlock","_normalizeStyle","_createElementVNode","_createTextVNode","_toDisplayString","Tooltip","Button","CloseIcon","_createCommentVNode","_renderSlot","Icon","Button_default","Icon_default","Tooltip_default","CloseIcon_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","Dialog_vue_vue_type_script_setup_true_lang_default","\"open\"","\"openModifiers\"","__emit","props","__props","emit","open","useModel","slots","useSlots","hasFooter","computed","banded","sizes","width","bandColour","iconColours","cancel","confirmFromKeyboard","event","openBlock","createBlock","unref","DialogRoot","_cache","$event","withCtx","createVNode","DialogPortal","DialogOverlay","DialogContent","normalizeClass","withModifiers","withKeys","focusFirst","createElementBlock","normalizeStyle","createElementVNode","DialogTitle","createTextVNode","toDisplayString","createCommentVNode","_ctx","renderSlot"],"sources":["../../../src/components/Dialog/Dialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useSlots } from 'vue'\n\nimport { DialogContent, DialogOverlay, DialogPortal, DialogRoot, DialogTitle } from 'reka-ui'\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'\nimport { focusFirst } from './focus'\n\nexport interface DialogProps {\n title?: string\n /** The close button in the header. */\n closable?: boolean\n closeLabel?: string\n cancelLabel?: string\n /** Shows the standard footer's confirm button, which emits `confirm`, as ⌘ or Ctrl Enter does. */\n confirmLabel?: string\n confirmIcon?: string\n confirmVariant?: 'primary' | 'danger' | 'contrast'\n confirmDisabled?: boolean\n /** sm 432px, md 512px, record 520px (the default with a band), lg 672px, xl 768px. */\n size?: 'sm' | 'md' | 'record' | 'lg' | 'xl'\n /** A record form's tinted header band: a CSS colour such as `rgb(var(--sui-hue-blue-soft))`, or `true` for the accent\n * wash. The `hero` slot sits centred in it. */\n band?: string | boolean\n /** Muted text at the footer's start, e.g. `saveHint()`. */\n hint?: string\n /** The body draws its own header, edge to edge. */\n headerless?: boolean\n}\n\nconst props = withDefaults(defineProps<DialogProps>(), {\n title: undefined,\n closable: true,\n closeLabel: 'Close',\n cancelLabel: 'Cancel',\n confirmLabel: undefined,\n confirmIcon: undefined,\n confirmVariant: 'primary',\n size: undefined,\n band: undefined,\n hint: undefined\n})\n\nconst emit = defineEmits<{ confirm: []; cancel: [] }>()\n\nconst open = defineModel<boolean>('open', { default: false })\n\nconst slots = useSlots()\nconst hasFooter = computed(() => !!slots.footer || !!props.confirmLabel)\nconst banded = computed(() => !!props.band || !!slots.hero)\n\nconst sizes = {\n sm: 'max-w-[27rem]',\n md: 'max-w-lg',\n record: 'max-w-130',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl'\n}\nconst width = computed(() => sizes[props.size ?? (banded.value ? 'record' : 'md')])\nconst bandColour = computed(() => (typeof props.band === 'string' ? props.band : 'rgb(var(--sui-accent-wash))'))\n\nconst iconColours = { primary: 'on-accent', danger: 'on-danger', contrast: 'on-contrast' } as const\n\nfunction cancel() {\n emit('cancel')\n open.value = false\n}\n\nfunction confirmFromKeyboard(event: KeyboardEvent) {\n if (!event.metaKey && !event.ctrlKey) return\n event.preventDefault()\n if (props.confirmLabel && !props.confirmDisabled) emit('confirm')\n}\n</script>\n\n<!-- The one dialog: a header, body and canvas footer; or, with a `band` or `hero`, a record form under a tinted band. -->\n<template>\n <DialogRoot v-model:open=\"open\">\n <DialogPortal>\n <DialogOverlay\n class=\"fixed inset-0 z-[1100] flex items-center justify-center bg-sui-scrim/40 backdrop-blur-[4px] data-[state=closed]:animate-sui-scrim-out data-[state=open]:animate-sui-scrim-in\"\n >\n <DialogContent\n :aria-describedby=\"undefined\"\n class=\"flex max-h-[90vh] w-full flex-col bg-sui-surface shadow-xl outline-hidden data-[state=closed]:animate-sui-dialog-out data-[state=open]:animate-sui-dialog-in\"\n :class=\"[width, banded ? 'rounded-2xl' : 'rounded-xl']\"\n @escape-key-down=\"emit('cancel')\"\n @interact-outside.prevent\n @keydown.enter=\"confirmFromKeyboard\"\n @open-auto-focus=\"focusFirst\"\n >\n <div\n v-if=\"banded\"\n class=\"shrink-0 rounded-t-2xl pt-3.5 pr-3.5 pb-4.5 pl-5 transition-colors duration-200\"\n data-modal-header\n :style=\"{ backgroundColor: bandColour }\"\n >\n <div class=\"flex items-center justify-between gap-3\">\n <DialogTitle class=\"text-13 leading-5 font-medium text-sui-ink-body\">{{ title }}</DialogTitle>\n <Tooltip v-if=\"closable\" :text=\"closeLabel\">\n <Button :aria-label=\"closeLabel\" class=\"shrink-0\" icon-only size=\"sm\" variant=\"ghost\" @click=\"cancel\">\n <CloseIcon class=\"fill-sui-ink-muted stroke-sui-ink-muted\" />\n </Button>\n </Tooltip>\n </div>\n <div v-if=\"$slots.hero\" class=\"mt-0.5 flex flex-col items-center gap-1.5 pr-1.5\">\n <slot name=\"hero\" />\n </div>\n </div>\n <div\n v-else-if=\"!headerless\"\n class=\"flex shrink-0 items-center justify-between gap-3 rounded-t-xl border-b border-sui-line-subtle bg-sui-surface px-5 py-4 text-sui-ink\"\n data-modal-header\n >\n <DialogTitle class=\"min-w-0 truncate text-base font-semibold text-sui-ink\">\n <slot name=\"title\">{{ title }}</slot>\n </DialogTitle>\n <Tooltip v-if=\"closable\" :text=\"closeLabel\">\n <Button :aria-label=\"closeLabel\" class=\"shrink-0\" icon-only size=\"sm\" variant=\"ghost\" @click=\"cancel\">\n <CloseIcon class=\"fill-sui-ink-subtle stroke-sui-ink-subtle\" />\n </Button>\n </Tooltip>\n </div>\n <DialogTitle v-else class=\"sr-only\">{{ title }}</DialogTitle>\n\n <div\n class=\"overflow-y-auto bg-sui-surface text-sm text-sui-ink-emphasis\"\n :class=\"[banded ? 'px-5 pt-0.5 pb-4' : 'p-5', !hasFooter && (banded ? 'rounded-b-2xl' : 'rounded-b-xl')]\"\n data-modal-body\n >\n <slot />\n </div>\n\n <div\n v-if=\"hasFooter\"\n class=\"flex shrink-0 items-center border-t border-sui-line-subtle bg-sui-canvas text-sui-ink\"\n :class=\"banded ? 'gap-2 rounded-b-2xl py-3 pr-4 pl-5' : 'gap-3 rounded-b-xl px-5 py-4'\"\n data-modal-footer\n >\n <slot name=\"footer\">\n <slot name=\"footer-start\" />\n <span v-if=\"hint\" class=\"min-w-0 truncate text-xs text-sui-ink-muted\">{{ hint }}</span>\n <span class=\"flex-1\" />\n <Button type=\"button\" variant=\"ghost\" @click=\"cancel\">{{ cancelLabel }}</Button>\n <Button :disabled=\"confirmDisabled\" type=\"button\" :variant=\"confirmVariant\" @click=\"emit('confirm')\">\n <Icon v-if=\"confirmIcon\" :color=\"iconColours[confirmVariant]\" :name=\"confirmIcon\" />\n {{ confirmLabel }}\n </Button>\n </slot>\n </div>\n </DialogContent>\n </DialogOverlay>\n </DialogPortal>\n </DialogRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,IAAMiC,IAAQC,GAaRC,IAAOH,GAEPI,IAAOnC,EAAoBiC,GAAC,MAA0B,GAEtDI,IAAQC,EAAS,GACjBC,IAAYC,QAAe,CAAC,CAACH,EAAM,UAAU,CAAC,CAACL,EAAM,YAAY,GACjES,IAASD,QAAe,CAAC,CAACR,EAAM,QAAQ,CAAC,CAACK,EAAM,IAAI,GAEpDK,IAAQ;GACZ,IAAI;GACJ,IAAI;GACJ,QAAQ;GACR,IAAI;GACJ,IAAI;EACN,GACMC,IAAQH,QAAeE,EAAMV,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D,CAC3DmC,EAAA,QAAM,qBAAA,OAAA,CAAgCF,EAAA,UAAcE,EAAA,QAAM,kBAAA,eAAA,CAAA,CAAA;QACnE,mBAAA;O,IAEAvB,EAAQqD,EAAA,QAAA,SAAA,C;OAIFhC,EAAA,SADRtC,EAAA,GAAAQ,EAgBM,OAAA;;QAdJ,OAAKH,EAAA,CAAC,yFACEmC,EAAA,QAAM,uCAAA,8BAAA,CAAA;QACd,qBAAA;O,IAEAvB,EASOqD,EAAA,QAAA,UAAA,CAAA,SAAA;QARLrD,EAA4BqD,EAAA,QAAA,cAAA;QAChBtC,EAAA,QAAZhC,EAAA,GAAAQ,EAAuF,QAAvFkB,GAAuFd,EAAdoB,EAAA,IAAI,GAAA,CAAA,K;QAC7E,AAAAoB,EAAA,OAAA1C,EAAuB,QAAA,EAAjB,OAAM,SAAQ,GAAA,MAAA,EAAA;QACpBN,EAAgFU,GAAA;SAAxE,MAAK;SAAS,SAAQ;SAAS,SAAO+B;;SAAQ,SAAA1C,QAAiB,CAAdQ,EAAAC,EAAAoB,EAAA,WAAW,GAAA,CAAA,C;;;QACpE5B,EAGSU,GAAA;SAHA,UAAUkB,EAAA;SAAiB,MAAK;SAAU,SAASA,EAAA;SAAiB,SAAK,AAAAoB,EAAA,QAAA,MAAEnB,EAAI,SAAA;;SACtF,SAAA9B,QAAoF,CAAxE6B,EAAA,eAAZhC,EAAA,GAAAC,EAAoFiB,GAAA;;UAA1D,OAAO0B,EAAYZ,EAAA;UAAkB,MAAMA,EAAA;S,6CAAerB,EAAA,MACpFC,EAAGoB,EAAA,YAAY,GAAA,CAAA,C"}
|
|
1
|
+
{"version":3,"file":"Dialog.vue_vue_type_script_setup_true_lang.js","names":["$slots","_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_normalizeClass","_normalizeStyle","_withKeys","_createElementBlock","_toDisplayString","_createCommentVNode","_createElementVNode","_mergeProps","_renderSlot","_createTextVNode","Tooltip","Button","CloseIcon","Icon","_withModifiers","Button_default","Icon_default","Tooltip_default","CloseIcon_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","Dialog_vue_vue_type_script_setup_true_lang_default","\"open\"","\"openModifiers\"","__emit","props","__props","emit","open","useModel","slots","useSlots","hasFooter","computed","banded","sizes","width","bandColour","narrow","ref","query","onQuery","watch","presentation","below","onBeforeUnmount","sheet","panel","useTemplateRef","drag","useSheetDrag","cancel","isOpen","iconColours","onOutside","event","confirmFromKeyboard","openBlock","createBlock","unref","DialogRoot","_cache","$event","withCtx","createVNode","DialogPortal","DialogOverlay","normalizeClass","DialogContent","normalizeStyle","withKeys","focusFirst","createCommentVNode","createElementBlock","toDisplayString","createElementVNode","mergeProps","DialogTitle","createTextVNode","renderSlot","_ctx","withModifiers"],"sources":["../../../src/components/Dialog/Dialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, useSlots, useTemplateRef, watch } from 'vue'\n\nimport { DialogContent, DialogOverlay, DialogPortal, DialogRoot, DialogTitle } from 'reka-ui'\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'\nimport { focusFirst } from './focus'\nimport { useSheetDrag } from './useSheetDrag'\n\nexport interface DialogProps {\n title?: string\n /** The close button in the header. */\n closable?: boolean\n closeLabel?: string\n cancelLabel?: string\n /** Shows the standard footer's confirm button, which emits `confirm`, as ⌘ or Ctrl Enter does. */\n confirmLabel?: string\n confirmIcon?: string\n confirmVariant?: 'primary' | 'danger' | 'contrast'\n confirmDisabled?: boolean\n /** sm 432px, md 512px, record 520px (the default with a band), lg 672px, xl 768px. */\n size?: 'sm' | 'md' | 'record' | 'lg' | 'xl'\n /** A record form's tinted header band: a CSS colour such as `rgb(var(--sui-hue-blue-soft))`, or `true` for the accent\n * wash. The `hero` slot sits centred in it. */\n band?: string | boolean\n /** Muted text at the footer's start, e.g. `saveHint()`. */\n hint?: string\n /** The body draws its own header, edge to edge. */\n headerless?: boolean\n /** sheet: a bottom sheet with a grab handle, drag to dismiss and a full-width confirm. auto: a sheet on a viewport\n * narrower than `sheetBelow`, a dialog otherwise. A sheet draws no Cancel and no band: dragging it down, the\n * scrim and Escape cancel. */\n presentation?: 'dialog' | 'sheet' | 'auto'\n /** The width in px below which `auto` is a sheet. */\n sheetBelow?: number\n}\n\nconst props = withDefaults(defineProps<DialogProps>(), {\n title: undefined,\n closable: true,\n closeLabel: 'Close',\n cancelLabel: 'Cancel',\n confirmLabel: undefined,\n confirmIcon: undefined,\n confirmVariant: 'primary',\n size: undefined,\n band: undefined,\n hint: undefined,\n presentation: 'dialog',\n sheetBelow: 640\n})\n\nconst emit = defineEmits<{ confirm: []; cancel: [] }>()\n\nconst open = defineModel<boolean>('open', { default: false })\n\nconst slots = useSlots()\nconst hasFooter = computed(() => !!slots.footer || !!props.confirmLabel)\nconst banded = computed(() => !!props.band || !!slots.hero)\n\nconst sizes = {\n sm: 'max-w-[27rem]',\n md: 'max-w-lg',\n record: 'max-w-130',\n lg: 'max-w-2xl',\n xl: 'max-w-3xl'\n}\nconst width = computed(() => sizes[props.size ?? (banded.value ? 'record' : 'md')])\nconst bandColour = computed(() => (typeof props.band === 'string' ? props.band : 'rgb(var(--sui-accent-wash))'))\n\nconst narrow = ref(false)\nlet query: MediaQueryList | undefined\nconst onQuery = () => (narrow.value = !!query?.matches)\nwatch(\n () => [props.presentation, props.sheetBelow] as const,\n ([presentation, below]) => {\n query?.removeEventListener('change', onQuery)\n query =\n presentation === 'auto' && typeof window !== 'undefined'\n ? window.matchMedia(`(max-width: ${below - 0.02}px)`)\n : undefined\n query?.addEventListener('change', onQuery)\n onQuery()\n },\n { immediate: true }\n)\nonBeforeUnmount(() => query?.removeEventListener('change', onQuery))\n\nconst sheet = computed(() => props.presentation === 'sheet' || (props.presentation === 'auto' && narrow.value))\nconst panel = useTemplateRef<InstanceType<typeof DialogContent>>('panel')\nconst drag = useSheetDrag(\n computed(() => panel.value?.$el as HTMLElement | undefined),\n () => cancel()\n)\nwatch(open, (isOpen) => isOpen && drag.reset())\n\nconst iconColours = { primary: 'on-accent', danger: 'on-danger', contrast: 'on-contrast' } as const\n\nfunction cancel() {\n emit('cancel')\n open.value = false\n}\n\n// A sheet closes on a tap on the scrim; a dialog only from its buttons and Escape.\nfunction onOutside(event: Event) {\n if (sheet.value) emit('cancel')\n else event.preventDefault()\n}\n\nfunction confirmFromKeyboard(event: KeyboardEvent) {\n if (!event.metaKey && !event.ctrlKey) return\n event.preventDefault()\n if (props.confirmLabel && !props.confirmDisabled) emit('confirm')\n}\n</script>\n\n<!-- The one dialog: a header, body and canvas footer; or, with a `band` or `hero`, a record form under a tinted band; or\n a bottom sheet. -->\n<template>\n <DialogRoot v-model:open=\"open\">\n <DialogPortal>\n <DialogOverlay\n class=\"fixed inset-0 z-[1100] flex justify-center bg-sui-scrim/40 backdrop-blur-[4px] data-[state=closed]:animate-sui-scrim-out data-[state=open]:animate-sui-scrim-in\"\n :class=\"sheet ? 'items-end' : 'items-center'\"\n >\n <DialogContent\n v-if=\"sheet\"\n ref=\"panel\"\n :aria-describedby=\"undefined\"\n class=\"relative flex max-h-[calc(100dvh-1.5rem)] w-full flex-col rounded-t-(--sui-radius-sheet) bg-sui-surface shadow-xl outline-hidden data-[state=closed]:animate-sui-sheet-out data-[state=open]:animate-sui-sheet-in motion-reduce:animate-none motion-reduce:transition-none\"\n :class=\"!drag.dragging.value && 'transition-transform duration-[250ms] ease-[cubic-bezier(0.32,0.72,0,1)]'\"\n :style=\"drag.style.value\"\n @escape-key-down=\"emit('cancel')\"\n @interact-outside=\"onOutside\"\n @keydown.enter=\"confirmFromKeyboard\"\n @open-auto-focus=\"focusFirst\"\n >\n <!-- Without a close button, keyboard and screen-reader users still get one: it shows when focused. -->\n <button\n v-if=\"!closable\"\n class=\"pointer-events-none absolute top-2 right-3 h-7 rounded-md bg-sui-sunken px-2.5 text-13 font-medium text-sui-ink opacity-0 outline-hidden focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:sui-ring\"\n type=\"button\"\n @click=\"cancel\"\n >\n {{ closeLabel }}\n </button>\n <div class=\"shrink-0 cursor-grab touch-none pt-2\" data-modal-header v-bind=\"drag.handlers\">\n <span aria-hidden=\"true\" class=\"mx-auto block h-1 w-9 rounded-full bg-sui-mark-faint\" />\n <div v-if=\"!headerless\" class=\"flex min-h-11 items-center justify-between gap-3 pt-2 pr-4 pb-1 pl-5\">\n <DialogTitle class=\"min-w-0 truncate text-base font-semibold text-sui-ink\">\n <slot name=\"title\">{{ title }}</slot>\n </DialogTitle>\n <Tooltip v-if=\"closable\" :text=\"closeLabel\">\n <Button :aria-label=\"closeLabel\" class=\"shrink-0\" icon-only size=\"sm\" variant=\"ghost\" @click=\"cancel\">\n <CloseIcon class=\"fill-sui-ink-subtle stroke-sui-ink-subtle\" />\n </Button>\n </Tooltip>\n </div>\n <DialogTitle v-else class=\"sr-only\">{{ title }}</DialogTitle>\n </div>\n\n <div\n class=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-2 pb-5 text-sm leading-5 text-sui-ink-emphasis\"\n data-modal-body\n >\n <slot />\n </div>\n\n <div\n v-if=\"hasFooter\"\n class=\"flex shrink-0 flex-col gap-2.5 border-t border-sui-line-subtle bg-sui-surface px-4 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\n data-modal-footer\n >\n <slot name=\"footer\">\n <div v-if=\"$slots['footer-start'] || hint\" class=\"flex min-w-0 items-center justify-center gap-2\">\n <slot name=\"footer-start\" />\n <span v-if=\"hint\" class=\"min-w-0 truncate text-xs text-sui-ink-muted\">{{ hint }}</span>\n </div>\n <Button\n class=\"w-full\"\n :disabled=\"confirmDisabled\"\n size=\"lg\"\n type=\"button\"\n :variant=\"confirmVariant\"\n @click=\"emit('confirm')\"\n >\n <Icon v-if=\"confirmIcon\" :color=\"iconColours[confirmVariant]\" :name=\"confirmIcon\" />\n {{ confirmLabel }}\n </Button>\n </slot>\n </div>\n </DialogContent>\n <DialogContent\n v-else\n :aria-describedby=\"undefined\"\n class=\"flex max-h-[90vh] w-full flex-col bg-sui-surface shadow-xl outline-hidden data-[state=closed]:animate-sui-dialog-out data-[state=open]:animate-sui-dialog-in\"\n :class=\"[width, banded ? 'rounded-2xl' : 'rounded-xl']\"\n @escape-key-down=\"emit('cancel')\"\n @interact-outside.prevent\n @keydown.enter=\"confirmFromKeyboard\"\n @open-auto-focus=\"focusFirst\"\n >\n <div\n v-if=\"banded\"\n class=\"shrink-0 rounded-t-2xl pt-3.5 pr-3.5 pb-4.5 pl-5 transition-colors duration-200\"\n data-modal-header\n :style=\"{ backgroundColor: bandColour }\"\n >\n <div class=\"flex items-center justify-between gap-3\">\n <DialogTitle class=\"text-13 leading-5 font-medium text-sui-ink-body\">{{ title }}</DialogTitle>\n <Tooltip v-if=\"closable\" :text=\"closeLabel\">\n <Button :aria-label=\"closeLabel\" class=\"shrink-0\" icon-only size=\"sm\" variant=\"ghost\" @click=\"cancel\">\n <CloseIcon class=\"fill-sui-ink-muted stroke-sui-ink-muted\" />\n </Button>\n </Tooltip>\n </div>\n <div v-if=\"$slots.hero\" class=\"mt-0.5 flex flex-col items-center gap-1.5 pr-1.5\">\n <slot name=\"hero\" />\n </div>\n </div>\n <div\n v-else-if=\"!headerless\"\n class=\"flex shrink-0 items-center justify-between gap-3 rounded-t-xl border-b border-sui-line-subtle bg-sui-surface px-5 py-4 text-sui-ink\"\n data-modal-header\n >\n <DialogTitle class=\"min-w-0 truncate text-base font-semibold text-sui-ink\">\n <slot name=\"title\">{{ title }}</slot>\n </DialogTitle>\n <Tooltip v-if=\"closable\" :text=\"closeLabel\">\n <Button :aria-label=\"closeLabel\" class=\"shrink-0\" icon-only size=\"sm\" variant=\"ghost\" @click=\"cancel\">\n <CloseIcon class=\"fill-sui-ink-subtle stroke-sui-ink-subtle\" />\n </Button>\n </Tooltip>\n </div>\n <DialogTitle v-else class=\"sr-only\">{{ title }}</DialogTitle>\n\n <div\n class=\"overflow-y-auto bg-sui-surface text-sm text-sui-ink-emphasis\"\n :class=\"[banded ? 'px-5 pt-0.5 pb-4' : 'p-5', !hasFooter && (banded ? 'rounded-b-2xl' : 'rounded-b-xl')]\"\n data-modal-body\n >\n <slot />\n </div>\n\n <div\n v-if=\"hasFooter\"\n class=\"flex shrink-0 items-center border-t border-sui-line-subtle bg-sui-canvas text-sui-ink\"\n :class=\"banded ? 'gap-2 rounded-b-2xl py-3 pr-4 pl-5' : 'gap-3 rounded-b-xl px-5 py-4'\"\n data-modal-footer\n >\n <slot name=\"footer\">\n <slot name=\"footer-start\" />\n <span v-if=\"hint\" class=\"min-w-0 truncate text-xs text-sui-ink-muted\">{{ hint }}</span>\n <span class=\"flex-1\" />\n <Button type=\"button\" variant=\"ghost\" @click=\"cancel\">{{ cancelLabel }}</Button>\n <Button :disabled=\"confirmDisabled\" type=\"button\" :variant=\"confirmVariant\" @click=\"emit('confirm')\">\n <Icon v-if=\"confirmIcon\" :color=\"iconColours[confirmVariant]\" :name=\"confirmIcon\" />\n {{ confirmLabel }}\n </Button>\n </slot>\n </div>\n </DialogContent>\n </DialogOverlay>\n </DialogPortal>\n </DialogRoot>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,IAAMuC,IAAQC,GAeRC,IAAOH,GAEPI,IAAOzC,GAAoBuC,GAAC,MAA0B,GAEtDI,IAAQC,GAAS,GACjBC,IAAYC,QAAe,CAAC,CAACH,EAAM,UAAU,CAAC,CAACL,EAAM,YAAY,GACjES,IAASD,QAAe,CAAC,CAACR,EAAM,QAAQ,CAAC,CAACK,EAAM,IAAI,GAEpDK,KAAQ;GACZ,IAAI;GACJ,IAAI;GACJ,QAAQ;GACR,IAAI;GACJ,IAAI;EACN,GACMC,KAAQH,QAAeE,GAAMV,E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AAU,SAASA,EAAA;SAAiB,SAAK,AAAAmC,EAAA,QAAA,MAAElC,EAAI,SAAA;;SACtF,SAAApC,QAAoF,CAAxEmC,EAAA,eAAZtC,EAAA,GAAAC,EAAoFiB,GAAA;;UAA1D,OAAO+C,EAAY3B,EAAA;UAAkB,MAAMA,EAAA;S,6CAAexB,EAAA,MACpFL,EAAG6B,EAAA,YAAY,GAAA,CAAA,C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
/** Dragging a bottom sheet down: it follows the pointer, and past a third of its height, or a flick faster than
|
|
3
|
+
* 0.6 px/ms, it dismisses; otherwise it springs back. */
|
|
4
|
+
export declare function useSheetDrag(panel: Ref<HTMLElement | null | undefined>, dismiss: () => void): {
|
|
5
|
+
dragging: import("vue").ComputedRef<boolean>;
|
|
6
|
+
style: import("vue").ComputedRef<{
|
|
7
|
+
transform: string;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
handlers: {
|
|
10
|
+
onPointerdown: (event: PointerEvent) => void;
|
|
11
|
+
onPointermove: (event: PointerEvent) => void;
|
|
12
|
+
onPointerup: (event: PointerEvent) => void;
|
|
13
|
+
onPointercancel: () => void;
|
|
14
|
+
};
|
|
15
|
+
reset: () => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { computed as e, ref as t } from "vue";
|
|
2
|
+
//#region src/components/Dialog/useSheetDrag.ts
|
|
3
|
+
function n(n, r) {
|
|
4
|
+
let i = t(0), a = t(null);
|
|
5
|
+
function o(e) {
|
|
6
|
+
e.button !== 0 || e.target.closest("button, a, input") || (a.value = {
|
|
7
|
+
y: e.clientY,
|
|
8
|
+
t: Date.now()
|
|
9
|
+
}, e.currentTarget.setPointerCapture?.(e.pointerId));
|
|
10
|
+
}
|
|
11
|
+
function s(e) {
|
|
12
|
+
a.value && (i.value = Math.max(0, e.clientY - a.value.y));
|
|
13
|
+
}
|
|
14
|
+
function c(e) {
|
|
15
|
+
if (!a.value) return;
|
|
16
|
+
let t = Math.max(0, e.clientY - a.value.y), o = t / Math.max(1, Date.now() - a.value.t);
|
|
17
|
+
a.value = null, t > (n.value?.offsetHeight ?? 1) / 3 || o > .6 ? r() : i.value = 0;
|
|
18
|
+
}
|
|
19
|
+
function l() {
|
|
20
|
+
a.value = null, i.value = 0;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
dragging: e(() => a.value !== null),
|
|
24
|
+
style: e(() => i.value ? { transform: `translateY(${i.value}px)` } : void 0),
|
|
25
|
+
handlers: {
|
|
26
|
+
onPointerdown: o,
|
|
27
|
+
onPointermove: s,
|
|
28
|
+
onPointerup: c,
|
|
29
|
+
onPointercancel: l
|
|
30
|
+
},
|
|
31
|
+
reset: l
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { n as useSheetDrag };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=useSheetDrag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSheetDrag.js","names":["useSheetDrag","offset","ref","start","down","event","move","up","dy","speed","panel","dismiss","cancel","computed"],"sources":["../../../src/components/Dialog/useSheetDrag.ts"],"sourcesContent":["import { type Ref, computed, ref } from 'vue'\n\n/** Dragging a bottom sheet down: it follows the pointer, and past a third of its height, or a flick faster than\n * 0.6 px/ms, it dismisses; otherwise it springs back. */\nexport function useSheetDrag(panel: Ref<HTMLElement | null | undefined>, dismiss: () => void) {\n const offset = ref(0)\n const start = ref<{ y: number; t: number } | null>(null)\n\n function down(event: PointerEvent) {\n // The close button inside the grab area still clicks.\n if (event.button !== 0 || (event.target as Element).closest('button, a, input')) return\n start.value = { y: event.clientY, t: Date.now() }\n ;(event.currentTarget as HTMLElement).setPointerCapture?.(event.pointerId)\n }\n\n function move(event: PointerEvent) {\n if (start.value) offset.value = Math.max(0, event.clientY - start.value.y)\n }\n\n function up(event: PointerEvent) {\n if (!start.value) return\n const dy = Math.max(0, event.clientY - start.value.y)\n const speed = dy / Math.max(1, Date.now() - start.value.t)\n start.value = null\n if (dy > (panel.value?.offsetHeight ?? 1) / 3 || speed > 0.6) dismiss()\n else offset.value = 0\n }\n\n function cancel() {\n start.value = null\n offset.value = 0\n }\n\n return {\n dragging: computed(() => start.value !== null),\n style: computed(() => (offset.value ? { transform: `translateY(${offset.value}px)` } : undefined)),\n handlers: { onPointerdown: down, onPointermove: move, onPointerup: up, onPointercancel: cancel },\n reset: cancel\n }\n}\n"],"mappings":";;AAIA,SAAgBA,EAAa,GAA4C,GAAqB;CAC5F,IAAMC,IAASC,EAAI,CAAC,GACdC,IAAQD,EAAqC,IAAI;CAEvD,SAASE,EAAK,GAAqB;EAEjC,AAAIC,EAAM,WAAW,KAAMA,EAAM,OAAmB,QAAQ,kBAAkB,MAC9E,EAAM,QAAQ;GAAE,GAAGA,EAAM;GAAS,GAAG,KAAK,IAAI;EAAE,GAC/CA,EAAO,cAA8B,oBAAoBA,EAAM,SAAS;CAC3E;CAEA,SAASC,EAAK,GAAqB;EACjC,AAAIH,EAAM,UAAO,EAAO,QAAQ,KAAK,IAAI,GAAGE,EAAM,UAAUF,EAAM,MAAM,CAAC;CAC3E;CAEA,SAASI,EAAG,GAAqB;EAC/B,IAAI,CAACJ,EAAM,OAAO;EAClB,IAAMK,IAAK,KAAK,IAAI,GAAGH,EAAM,UAAUF,EAAM,MAAM,CAAC,GAC9CM,IAAQD,IAAK,KAAK,IAAI,GAAG,KAAK,IAAI,IAAIL,EAAM,MAAM,CAAC;EAEzD,AADA,EAAM,QAAQ,MACVK,KAAME,EAAM,OAAO,gBAAgB,KAAK,KAAKD,IAAQ,KAAKE,EAAQ,IACjE,EAAO,QAAQ;CACtB;CAEA,SAASC,IAAS;EAEhB,AADA,EAAM,QAAQ,MACd,EAAO,QAAQ;CACjB;CAEA,OAAO;EACL,UAAUC,QAAeV,EAAM,UAAU,IAAI;EAC7C,OAAOU,QAAgBZ,EAAO,QAAQ,EAAE,WAAW,cAAcA,EAAO,MAAM,KAAK,IAAI,KAAA,CAAU;EACjG,UAAU;GAAE,eAAeG;GAAM,eAAeE;GAAM,aAAaC;GAAI,iBAAiBK;EAAO;EAC/F,OAAOA;CACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","names":["_sfc_main","DropdownMenu_vue_vue_type_script_setup_true_lang_default","DropdownMenu_default"],"sources":["../../../src/components/DropdownMenu/DropdownMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref } from 'vue'\n\nimport {\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuPortal,\n DropdownMenuRoot,\n DropdownMenuSeparator,\n DropdownMenuTrigger\n} from 'reka-ui'\n\nimport
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","names":["_sfc_main","DropdownMenu_vue_vue_type_script_setup_true_lang_default","DropdownMenu_default"],"sources":["../../../src/components/DropdownMenu/DropdownMenu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ref } from 'vue'\n\nimport {\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuPortal,\n DropdownMenuRoot,\n DropdownMenuSeparator,\n DropdownMenuTrigger\n} from 'reka-ui'\n\nimport Button from '../Button/Button.vue'\nimport Icon from '../Icon/Icon.vue'\nimport Tooltip from '../Tooltip/Tooltip.vue'\nimport MenuItemContent from '../internal/MenuItemContent.vue'\nimport {\n type DropdownMenuAction,\n type DropdownMenuEntry,\n type MenuConfirmLabels,\n menuConfirmDefaults,\n menuContentClass,\n menuItemClass,\n menuSeparatorClass,\n useMenuSelect\n} from '../internal/menu'\n\nexport type { DropdownMenuAction, DropdownMenuEntry }\n\nexport interface DropdownMenuProps extends MenuConfirmLabels {\n items?: DropdownMenuEntry[]\n buttonIcon?: string\n /** A label beside the icon; without one the button is icon-only, named by the tooltip. */\n buttonLabel?: string\n /** The trigger's tooltip and name; null for none. */\n tooltip?: string | null\n /** Lines the menu up with the trigger's start or end edge. */\n align?: 'start' | 'end'\n}\n\nconst props = withDefaults(defineProps<DropdownMenuProps>(), {\n ...menuConfirmDefaults,\n items: () => [],\n buttonIcon: 'more-vertical',\n buttonLabel: undefined,\n tooltip: 'More actions',\n align: 'start'\n})\n\nconst emit = defineEmits<{ 'click-item': [item: DropdownMenuAction & { id?: string }]; show: []; hide: [] }>()\n\nconst open = ref(false)\nconst select = useMenuSelect(props, (item) => emit('click-item', item))\n\nfunction onOpenChange(value: boolean) {\n open.value = value\n if (value) emit('show')\n else emit('hide')\n}\n</script>\n\n<template>\n <div>\n <!-- Not modal: the page stays live (hover, scroll) while it's open. -->\n <DropdownMenuRoot :modal=\"false\" :open=\"open\" @update:open=\"onOpenChange\">\n <!-- The tooltip inside the menu's trigger: Reka's anchors attach to the nearest popper, which must be the menu's. -->\n <DropdownMenuTrigger as-child>\n <Tooltip :disabled=\"!tooltip || open\" :text=\"tooltip ?? undefined\">\n <slot name=\"trigger\" :open=\"open\">\n <Button\n :aria-label=\"buttonLabel ? undefined : (tooltip ?? undefined)\"\n :icon-only=\"!buttonLabel\"\n size=\"sm\"\n type=\"button\"\n variant=\"ghost\"\n @click.stop\n >\n <span v-if=\"buttonLabel\">{{ buttonLabel }}</span>\n <Icon v-if=\"buttonIcon\" color=\"ink-subtle\" :name=\"buttonIcon\" />\n </Button>\n </slot>\n </Tooltip>\n </DropdownMenuTrigger>\n <DropdownMenuPortal>\n <DropdownMenuContent\n :align=\"align\"\n :class=\"[menuContentClass, 'min-w-[max(12rem,var(--reka-dropdown-menu-trigger-width))]']\"\n side=\"bottom\"\n >\n <template v-for=\"(item, index) in items\" :key=\"index\">\n <DropdownMenuSeparator v-if=\"item.type === 'separator'\" :class=\"menuSeparatorClass\" />\n <DropdownMenuItem v-else :class=\"menuItemClass\" @select=\"select(item)\">\n <MenuItemContent :item=\"item\" />\n </DropdownMenuItem>\n </template>\n </DropdownMenuContent>\n </DropdownMenuPortal>\n </DropdownMenuRoot>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -1,25 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
action?: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
variant?: 'danger';
|
|
7
|
-
shortcut?: string;
|
|
8
|
-
/** Asks first, with this wording; `confirmed: true` asks with the generic wording. */
|
|
9
|
-
confirm?: {
|
|
10
|
-
message: string;
|
|
11
|
-
title?: string;
|
|
12
|
-
acceptLabel?: string;
|
|
13
|
-
};
|
|
14
|
-
confirmed?: boolean;
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}
|
|
17
|
-
export type DropdownMenuEntry = DropdownMenuAction | {
|
|
18
|
-
type: 'separator';
|
|
19
|
-
};
|
|
20
|
-
export interface DropdownMenuProps {
|
|
21
|
-
/** Passed back with every clicked item, e.g. the record the menu acts on. */
|
|
22
|
-
id?: string;
|
|
1
|
+
import { type DropdownMenuAction, type DropdownMenuEntry, type MenuConfirmLabels } from '../internal/menu';
|
|
2
|
+
export type { DropdownMenuAction, DropdownMenuEntry };
|
|
3
|
+
export interface DropdownMenuProps extends MenuConfirmLabels {
|
|
23
4
|
items?: DropdownMenuEntry[];
|
|
24
5
|
buttonIcon?: string;
|
|
25
6
|
/** A label beside the icon; without one the button is icon-only, named by the tooltip. */
|
|
@@ -28,11 +9,6 @@ export interface DropdownMenuProps {
|
|
|
28
9
|
tooltip?: string | null;
|
|
29
10
|
/** Lines the menu up with the trigger's start or end edge. */
|
|
30
11
|
align?: 'start' | 'end';
|
|
31
|
-
confirmTitle?: string;
|
|
32
|
-
confirmMessage?: string;
|
|
33
|
-
confirmLabel?: string;
|
|
34
|
-
deleteLabel?: string;
|
|
35
|
-
cancelLabel?: string;
|
|
36
12
|
}
|
|
37
13
|
declare var __VLS_21: {
|
|
38
14
|
open: boolean;
|
|
@@ -57,13 +33,13 @@ declare const __VLS_base: import("vue").DefineComponent<DropdownMenuProps, {}, {
|
|
|
57
33
|
confirmLabel: string;
|
|
58
34
|
cancelLabel: string;
|
|
59
35
|
id: string;
|
|
36
|
+
confirmTitle: string;
|
|
37
|
+
confirmMessage: string;
|
|
38
|
+
deleteLabel: string;
|
|
60
39
|
items: DropdownMenuEntry[];
|
|
61
40
|
buttonIcon: string;
|
|
62
41
|
buttonLabel: string;
|
|
63
42
|
tooltip: string | null;
|
|
64
|
-
confirmTitle: string;
|
|
65
|
-
confirmMessage: string;
|
|
66
|
-
deleteLabel: string;
|
|
67
43
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
68
44
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
69
45
|
declare const _default: typeof __VLS_export;
|