rei-kit 0.14.1 → 0.15.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 +8 -1
- package/dist/GoogleButton-BQSsm0hp.js +507 -0
- package/dist/GoogleButton-BQSsm0hp.js.map +1 -0
- package/dist/app/AuthForm.vue.d.ts +78 -0
- package/dist/app/auth-form.d.ts +36 -0
- package/dist/app/field-errors.d.ts +39 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app.js +184 -3
- package/dist/app.js.map +1 -1
- package/dist/components/GoogleButton.vue.d.ts +8 -0
- package/dist/index.js +3 -247
- package/dist/index.js.map +1 -1
- package/dist/supabase/auth-errors.d.ts +40 -0
- package/dist/supabase/index.d.ts +2 -0
- package/dist/supabase.js +46 -2
- package/dist/supabase.js.map +1 -1
- package/package.json +1 -1
- package/dist/BaseSheet-CLIhXDwe.js +0 -253
- package/dist/BaseSheet-CLIhXDwe.js.map +0 -1
package/README.md
CHANGED
|
@@ -44,7 +44,14 @@ the app, and not a matter of taste.
|
|
|
44
44
|
|
|
45
45
|
## Status
|
|
46
46
|
|
|
47
|
-
**v0.
|
|
47
|
+
**v0.15.0 — three consumers.**
|
|
48
|
+
|
|
49
|
+
| | |
|
|
50
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| Components | 31 (`AuthForm`, `BaseButton`, `BaseCard`, `BaseInput`, `BaseSelect`, `BaseTextarea`, `BaseCheckbox`, `BaseRadioGroup`, `BaseAlert`, `BaseBadge`, `BaseSheet`, `ProgressBar`, `PriceCard`, `ToastHost`, `TabBar`, `GoogleButton`, `LocaleLinks`, `LocaleSheet`, `AuthShell`, `TourShell`, `InstallPrompt`, `UpdatePrompt`, `InstallSettings`, `SkeletonList`, `PageContainer`, `ErrorBoundary`, etc.) |
|
|
52
|
+
| Composables | 14 (`useToast`, `useTheme`, `useToday`, `useMediaQuery`, `useInstall`, `watchInstallability`, `createTabTransition`, `useThemeSync`, `useVisualViewport`, etc.) |
|
|
53
|
+
| Utilities | 22 (`applyTheme`, `formatDate`, `fieldErrors`, `toAuthMessageKey`, `Supabase error mapper`, i18n runtime, etc.) |
|
|
54
|
+
| Entry Points | `rei-kit`, `rei-kit/app`, `rei-kit/pwa`, `rei-kit/shell/mobile.css`, `rei-kit/shell/web.css` |
|
|
48
55
|
|
|
49
56
|
| | |
|
|
50
57
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import { n as _plugin_vue_export_helper_default, r as BaseButton_default } from "./SettingsRow-MnVleeTR.js";
|
|
2
|
+
import { Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createStaticVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onScopeDispose, onUnmounted, openBlock, readonly, ref, renderSlot, toDisplayString, unref, useId, useModel, vModelCheckbox, vModelDynamic, watch, withCtx, withDirectives } from "vue";
|
|
3
|
+
import { X } from "lucide-vue-next";
|
|
4
|
+
//#region src/composables/use-theme.ts
|
|
5
|
+
/**
|
|
6
|
+
* Namespaced by the app, not by this package.
|
|
7
|
+
*
|
|
8
|
+
* Two rei-kit apps served from the same origin would otherwise share one theme
|
|
9
|
+
* setting — and during development on localhost, they will be.
|
|
10
|
+
*/
|
|
11
|
+
var storageKey = "rei-theme";
|
|
12
|
+
function isThemePreference(value) {
|
|
13
|
+
return value === "system" || value === "light" || value === "dark";
|
|
14
|
+
}
|
|
15
|
+
/** Reads the stored preference, falling back to `system`. */
|
|
16
|
+
function readStoredTheme() {
|
|
17
|
+
try {
|
|
18
|
+
const stored = localStorage.getItem(storageKey);
|
|
19
|
+
return isThemePreference(stored) ? stored : "system";
|
|
20
|
+
} catch {
|
|
21
|
+
return "system";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function storeTheme(preference) {
|
|
25
|
+
try {
|
|
26
|
+
localStorage.setItem(storageKey, preference);
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Does the environment prefer a dark scheme?
|
|
31
|
+
*
|
|
32
|
+
* `matchMedia` is checked for on its own rather than inferred from `document`.
|
|
33
|
+
* Having one does not imply having the other: jsdom supplies a document and no
|
|
34
|
+
* `matchMedia`, so a consumer's component test that so much as mounts something
|
|
35
|
+
* calling `useTheme` threw — and some embedded webviews are the same. Where
|
|
36
|
+
* there is nothing to ask, the answer is no rather than an exception.
|
|
37
|
+
*/
|
|
38
|
+
function prefersDarkScheme() {
|
|
39
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia("(prefers-color-scheme: dark)").matches : false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Adds or removes `.dark` on `<html>`, resolving `system` against the OS.
|
|
43
|
+
*
|
|
44
|
+
* A no-op without a document. There is no OS preference to read on a server and
|
|
45
|
+
* no `<html>` to write to, so a prerender leaves the class off and the app
|
|
46
|
+
* decides the theme before hydration — see the note in the README.
|
|
47
|
+
*/
|
|
48
|
+
function applyTheme(preference) {
|
|
49
|
+
if (typeof document === "undefined") return;
|
|
50
|
+
const isDark = preference === "dark" || preference === "system" && prefersDarkScheme();
|
|
51
|
+
document.documentElement.classList.toggle("dark", isDark);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The shared preference, created on first use rather than at import.
|
|
55
|
+
*
|
|
56
|
+
* Lazy on purpose: reading storage at import time would lock in the default key
|
|
57
|
+
* before an app had a chance to set its own, leaving the controller reading one
|
|
58
|
+
* key and writing another.
|
|
59
|
+
*/
|
|
60
|
+
var preference = null;
|
|
61
|
+
function controller() {
|
|
62
|
+
if (preference) return preference;
|
|
63
|
+
preference = ref(readStoredTheme());
|
|
64
|
+
watch(preference, (next) => {
|
|
65
|
+
storeTheme(next);
|
|
66
|
+
applyTheme(next);
|
|
67
|
+
}, { immediate: true });
|
|
68
|
+
if (typeof window !== "undefined" && typeof window.matchMedia === "function") window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
69
|
+
if (preference?.value === "system") applyTheme("system");
|
|
70
|
+
});
|
|
71
|
+
return preference;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sets where the preference is stored.
|
|
75
|
+
*
|
|
76
|
+
* Safe in either order: called before the first `useTheme()` it simply changes
|
|
77
|
+
* the key, and called after it re-reads under the new one, so the controller
|
|
78
|
+
* never reads from one key while writing to another.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* setThemeStorageKey('hibi-theme') // once, at startup
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
function setThemeStorageKey(key) {
|
|
86
|
+
storageKey = key;
|
|
87
|
+
if (preference) preference.value = readStoredTheme();
|
|
88
|
+
}
|
|
89
|
+
/** @returns The shared preference ref; assigning to it stores and applies it. */
|
|
90
|
+
function useTheme() {
|
|
91
|
+
return controller();
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/composables/use-visual-viewport.ts
|
|
95
|
+
/**
|
|
96
|
+
* Tracks the visual viewport.
|
|
97
|
+
*
|
|
98
|
+
* Chrome and Android browsers honour `interactive-widget=resizes-content`, so
|
|
99
|
+
* the layout viewport already shrinks for the keyboard there. Safari on iOS
|
|
100
|
+
* does not implement it: it shrinks only the *visual* viewport, leaving a sheet
|
|
101
|
+
* sized in `dvh` sitting partly underneath the keyboard.
|
|
102
|
+
*
|
|
103
|
+
* `null` means the API is unavailable, which callers should read as "trust the
|
|
104
|
+
* layout viewport" rather than as zero. A server has no viewport at all, so it
|
|
105
|
+
* gets that same `null` — this runs during `setup`, and a component using it
|
|
106
|
+
* has to survive being rendered there.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const viewport = useVisualViewport()
|
|
111
|
+
* // :style="viewport ? { height: `${viewport.height}px` } : undefined"
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
function useVisualViewport() {
|
|
115
|
+
const rect = ref(null);
|
|
116
|
+
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
117
|
+
if (!viewport) return readonly(rect);
|
|
118
|
+
function read() {
|
|
119
|
+
if (!viewport) return;
|
|
120
|
+
rect.value = {
|
|
121
|
+
height: viewport.height,
|
|
122
|
+
offsetTop: viewport.offsetTop
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
read();
|
|
126
|
+
viewport.addEventListener("resize", read);
|
|
127
|
+
viewport.addEventListener("scroll", read);
|
|
128
|
+
onScopeDispose(() => {
|
|
129
|
+
viewport.removeEventListener("resize", read);
|
|
130
|
+
viewport.removeEventListener("scroll", read);
|
|
131
|
+
});
|
|
132
|
+
return readonly(rect);
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/components/BaseAlert.vue?vue&type=script&setup=true&lang.ts
|
|
136
|
+
var _hoisted_1$5 = ["role", "aria-live"];
|
|
137
|
+
var _hoisted_2$2 = { class: "min-w-0 flex-1" };
|
|
138
|
+
var _hoisted_3$2 = {
|
|
139
|
+
key: 0,
|
|
140
|
+
class: "text-ink font-semibold"
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/components/BaseAlert.vue
|
|
144
|
+
var BaseAlert_default = /* @__PURE__ */ defineComponent({
|
|
145
|
+
__name: "BaseAlert",
|
|
146
|
+
props: {
|
|
147
|
+
tone: { default: "info" },
|
|
148
|
+
assertive: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: false
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
setup(__props) {
|
|
154
|
+
const TONES = {
|
|
155
|
+
info: "border-hair bg-muted/40 text-ink",
|
|
156
|
+
success: "border-positive/35 bg-positive/8 text-ink",
|
|
157
|
+
warning: "border-warning/40 bg-warning/8 text-ink",
|
|
158
|
+
danger: "border-negative/35 bg-negative/8 text-ink"
|
|
159
|
+
};
|
|
160
|
+
const MARKS = {
|
|
161
|
+
info: "bg-ink-soft/15 text-ink-soft",
|
|
162
|
+
success: "bg-positive/15 text-positive",
|
|
163
|
+
warning: "bg-warning/15 text-warning",
|
|
164
|
+
danger: "bg-negative/15 text-negative"
|
|
165
|
+
};
|
|
166
|
+
const skin = computed(() => TONES[__props.tone]);
|
|
167
|
+
const mark = computed(() => MARKS[__props.tone]);
|
|
168
|
+
return (_ctx, _cache) => {
|
|
169
|
+
return openBlock(), createElementBlock("div", {
|
|
170
|
+
class: normalizeClass(["rounded-card flex items-start gap-3 border px-4 py-3.5 text-sm leading-relaxed", skin.value]),
|
|
171
|
+
role: __props.assertive ? "alert" : "status",
|
|
172
|
+
"aria-live": __props.assertive ? "assertive" : "polite"
|
|
173
|
+
}, [
|
|
174
|
+
_ctx.$slots.mark ? (openBlock(), createElementBlock("span", {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: normalizeClass(["mt-px grid size-6 shrink-0 place-items-center rounded-full text-xs font-semibold", mark.value]),
|
|
177
|
+
"aria-hidden": "true"
|
|
178
|
+
}, [renderSlot(_ctx.$slots, "mark")], 2)) : createCommentVNode("", true),
|
|
179
|
+
createElementVNode("div", _hoisted_2$2, [_ctx.$slots.title ? (openBlock(), createElementBlock("p", _hoisted_3$2, [renderSlot(_ctx.$slots, "title")])) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(_ctx.$slots.title ? "mt-1" : "") }, [renderSlot(_ctx.$slots, "default")], 2)]),
|
|
180
|
+
renderSlot(_ctx.$slots, "action")
|
|
181
|
+
], 10, _hoisted_1$5);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/components/FormField.vue?vue&type=script&setup=true&lang.ts
|
|
187
|
+
var _hoisted_1$4 = ["for"];
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/components/FormField.vue
|
|
190
|
+
var FormField_default = /* @__PURE__ */ defineComponent({
|
|
191
|
+
__name: "FormField",
|
|
192
|
+
props: {
|
|
193
|
+
label: {},
|
|
194
|
+
error: { default: "" },
|
|
195
|
+
hint: { default: "" },
|
|
196
|
+
size: { default: "md" },
|
|
197
|
+
labelHidden: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
default: false
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
setup(__props) {
|
|
203
|
+
const id = useId();
|
|
204
|
+
const errorId = `${id}-error`;
|
|
205
|
+
const hintId = `${id}-hint`;
|
|
206
|
+
const describedBy = computed(() => {
|
|
207
|
+
if (__props.error) return errorId;
|
|
208
|
+
if (__props.hint) return hintId;
|
|
209
|
+
});
|
|
210
|
+
return (_ctx, _cache) => {
|
|
211
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(["flex flex-col", __props.size === "sm" ? "gap-1" : "gap-1.5"]) }, [
|
|
212
|
+
createElementVNode("label", {
|
|
213
|
+
for: unref(id),
|
|
214
|
+
class: normalizeClass(["font-medium", [__props.labelHidden ? "sr-only" : "", __props.size === "sm" ? "text-ink-soft text-xs" : "text-ink text-sm"]])
|
|
215
|
+
}, toDisplayString(__props.label), 11, _hoisted_1$4),
|
|
216
|
+
renderSlot(_ctx.$slots, "default", {
|
|
217
|
+
id: unref(id),
|
|
218
|
+
describedBy: describedBy.value,
|
|
219
|
+
invalid: Boolean(__props.error),
|
|
220
|
+
size: __props.size
|
|
221
|
+
}),
|
|
222
|
+
__props.error ? (openBlock(), createElementBlock("p", {
|
|
223
|
+
key: 0,
|
|
224
|
+
id: errorId,
|
|
225
|
+
class: "text-negative text-xs"
|
|
226
|
+
}, toDisplayString(__props.error), 1)) : __props.hint ? (openBlock(), createElementBlock("p", {
|
|
227
|
+
key: 1,
|
|
228
|
+
id: hintId,
|
|
229
|
+
class: "text-ink-soft text-xs"
|
|
230
|
+
}, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)
|
|
231
|
+
], 2);
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/components/BaseInput.vue?vue&type=script&setup=true&lang.ts
|
|
237
|
+
var _hoisted_1$3 = [
|
|
238
|
+
"id",
|
|
239
|
+
"type",
|
|
240
|
+
"aria-invalid",
|
|
241
|
+
"aria-describedby"
|
|
242
|
+
];
|
|
243
|
+
var CONTROL_CLASS = "h-11 text-base";
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/components/BaseInput.vue
|
|
246
|
+
var BaseInput_default = /* @__PURE__ */ defineComponent({
|
|
247
|
+
inheritAttrs: false,
|
|
248
|
+
__name: "BaseInput",
|
|
249
|
+
props: /*@__PURE__*/ mergeModels({
|
|
250
|
+
label: {},
|
|
251
|
+
error: { default: "" },
|
|
252
|
+
hint: { default: "" },
|
|
253
|
+
labelHidden: {
|
|
254
|
+
type: Boolean,
|
|
255
|
+
default: false
|
|
256
|
+
},
|
|
257
|
+
type: { default: "text" },
|
|
258
|
+
size: { default: "md" },
|
|
259
|
+
variant: { default: "default" }
|
|
260
|
+
}, {
|
|
261
|
+
"modelValue": {},
|
|
262
|
+
"modelModifiers": {}
|
|
263
|
+
}),
|
|
264
|
+
emits: ["update:modelValue"],
|
|
265
|
+
setup(__props) {
|
|
266
|
+
const model = useModel(__props, "modelValue");
|
|
267
|
+
return (_ctx, _cache) => {
|
|
268
|
+
return openBlock(), createBlock(FormField_default, {
|
|
269
|
+
label: __props.label,
|
|
270
|
+
error: __props.error,
|
|
271
|
+
hint: __props.hint,
|
|
272
|
+
"label-hidden": __props.labelHidden,
|
|
273
|
+
size: __props.size
|
|
274
|
+
}, {
|
|
275
|
+
default: withCtx(({ id, describedBy, invalid }) => [withDirectives(createElementVNode("input", mergeProps({
|
|
276
|
+
id,
|
|
277
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
278
|
+
type: __props.type,
|
|
279
|
+
"aria-invalid": invalid,
|
|
280
|
+
"aria-describedby": describedBy
|
|
281
|
+
}, _ctx.$attrs, { class: [
|
|
282
|
+
__props.variant === "unstyled" ? "" : "border-hair bg-surface text-ink rounded-card focus-visible:outline-primary border px-3 focus-visible:outline-2 focus-visible:outline-offset-1",
|
|
283
|
+
__props.variant === "unstyled" ? "text-base" : CONTROL_CLASS,
|
|
284
|
+
__props.variant !== "unstyled" && invalid ? "border-negative" : ""
|
|
285
|
+
] }), null, 16, _hoisted_1$3), [[vModelDynamic, model.value]])]),
|
|
286
|
+
_: 1
|
|
287
|
+
}, 8, [
|
|
288
|
+
"label",
|
|
289
|
+
"error",
|
|
290
|
+
"hint",
|
|
291
|
+
"label-hidden",
|
|
292
|
+
"size"
|
|
293
|
+
]);
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/components/BaseSheet.vue?vue&type=script&setup=true&lang.ts
|
|
299
|
+
var _hoisted_1$2 = { class: "shell-frame md:rounded-shell relative flex max-h-full flex-col justify-end overflow-hidden" };
|
|
300
|
+
var _hoisted_2$1 = ["aria-label"];
|
|
301
|
+
var _hoisted_3$1 = { class: "flex shrink-0 items-start gap-3 px-6 pt-4 pb-5" };
|
|
302
|
+
var _hoisted_4 = { class: "min-w-0 flex-1" };
|
|
303
|
+
var _hoisted_5 = { class: "text-ink text-xl leading-tight font-semibold" };
|
|
304
|
+
var _hoisted_6 = {
|
|
305
|
+
key: 0,
|
|
306
|
+
class: "text-ink-soft mt-1 text-sm leading-snug"
|
|
307
|
+
};
|
|
308
|
+
var _hoisted_7 = { class: "min-h-0 flex-1 overflow-y-auto px-6 pb-[calc(2rem+env(safe-area-inset-bottom,0px))]" };
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/components/BaseSheet.vue
|
|
311
|
+
var BaseSheet_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
312
|
+
__name: "BaseSheet",
|
|
313
|
+
props: /*@__PURE__*/ mergeModels({
|
|
314
|
+
title: {},
|
|
315
|
+
subtitle: { default: "" },
|
|
316
|
+
closeLabel: { default: "Close" }
|
|
317
|
+
}, {
|
|
318
|
+
"modelValue": {
|
|
319
|
+
type: Boolean,
|
|
320
|
+
required: true
|
|
321
|
+
},
|
|
322
|
+
"modelModifiers": {}
|
|
323
|
+
}),
|
|
324
|
+
emits: ["update:modelValue"],
|
|
325
|
+
setup(__props) {
|
|
326
|
+
const open = useModel(__props, "modelValue");
|
|
327
|
+
const viewport = useVisualViewport();
|
|
328
|
+
/**
|
|
329
|
+
* Pins the sheet to the area the keyboard has left visible.
|
|
330
|
+
*
|
|
331
|
+
* Only needed where the layout viewport does not shrink on its own — iOS. On
|
|
332
|
+
* Android the numbers already agree, so this is a no-op there rather than a
|
|
333
|
+
* second, competing adjustment.
|
|
334
|
+
*/
|
|
335
|
+
const viewportStyle = computed(() => viewport.value ? {
|
|
336
|
+
height: `${viewport.value.height}px`,
|
|
337
|
+
top: `${viewport.value.offsetTop}px`
|
|
338
|
+
} : void 0);
|
|
339
|
+
const panel = ref(null);
|
|
340
|
+
let lastFocused = null;
|
|
341
|
+
function close() {
|
|
342
|
+
open.value = false;
|
|
343
|
+
}
|
|
344
|
+
function onKeydown(event) {
|
|
345
|
+
if (event.key === "Escape") close();
|
|
346
|
+
}
|
|
347
|
+
watch(open, async (isOpen) => {
|
|
348
|
+
if (isOpen) {
|
|
349
|
+
setBackgroundInert(true);
|
|
350
|
+
lastFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
351
|
+
window.addEventListener("keydown", onKeydown);
|
|
352
|
+
await nextTick();
|
|
353
|
+
panel.value?.focus();
|
|
354
|
+
} else {
|
|
355
|
+
window.removeEventListener("keydown", onKeydown);
|
|
356
|
+
lastFocused?.focus();
|
|
357
|
+
lastFocused = null;
|
|
358
|
+
setBackgroundInert(false);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
/**
|
|
362
|
+
* `inert` takes the whole app out of tab order and pointer events while the
|
|
363
|
+
* sheet is open — a real focus trap without keydown bookkeeping.
|
|
364
|
+
*
|
|
365
|
+
* The sheet itself is teleported to `#sheet-root`, a sibling of `#app`, so it
|
|
366
|
+
* stays interactive.
|
|
367
|
+
*/
|
|
368
|
+
function setBackgroundInert(isInert) {
|
|
369
|
+
document.getElementById("app")?.toggleAttribute("inert", isInert);
|
|
370
|
+
}
|
|
371
|
+
onUnmounted(() => {
|
|
372
|
+
window.removeEventListener("keydown", onKeydown);
|
|
373
|
+
setBackgroundInert(false);
|
|
374
|
+
});
|
|
375
|
+
return (_ctx, _cache) => {
|
|
376
|
+
return openBlock(), createBlock(Teleport, { to: "#sheet-root" }, [createVNode(Transition, { name: "sheet" }, {
|
|
377
|
+
default: withCtx(() => [open.value ? (openBlock(), createElementBlock("div", {
|
|
378
|
+
key: 0,
|
|
379
|
+
class: "fixed inset-x-0 top-0 bottom-0 z-50 flex items-center justify-center",
|
|
380
|
+
style: normalizeStyle(viewportStyle.value)
|
|
381
|
+
}, [createElementVNode("div", _hoisted_1$2, [createElementVNode("div", {
|
|
382
|
+
class: "bg-ink/45 absolute inset-0 backdrop-blur-[2px]",
|
|
383
|
+
onClick: close
|
|
384
|
+
}), createElementVNode("section", {
|
|
385
|
+
ref_key: "panel",
|
|
386
|
+
ref: panel,
|
|
387
|
+
role: "dialog",
|
|
388
|
+
"aria-modal": "true",
|
|
389
|
+
"aria-label": __props.title,
|
|
390
|
+
tabindex: "-1",
|
|
391
|
+
class: "sheet-panel bg-surface relative flex max-h-[94%] min-h-[56dvh] flex-col rounded-t-[28px] shadow-2xl outline-none"
|
|
392
|
+
}, [
|
|
393
|
+
_cache[0] || (_cache[0] = createElementVNode("div", {
|
|
394
|
+
class: "flex shrink-0 justify-center pt-3",
|
|
395
|
+
"aria-hidden": "true"
|
|
396
|
+
}, [createElementVNode("span", { class: "bg-hair h-1.5 w-10 rounded-full" })], -1)),
|
|
397
|
+
createElementVNode("header", _hoisted_3$1, [createElementVNode("div", _hoisted_4, [createElementVNode("h2", _hoisted_5, toDisplayString(__props.title), 1), __props.subtitle ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(__props.subtitle), 1)) : createCommentVNode("", true)]), createVNode(BaseButton_default, {
|
|
398
|
+
variant: "unstyled",
|
|
399
|
+
class: "text-ink-soft hover:bg-muted hover:text-ink -mt-1 flex size-10 shrink-0 items-center justify-center rounded-full transition-colors active:scale-90",
|
|
400
|
+
"aria-label": __props.closeLabel,
|
|
401
|
+
onClick: close
|
|
402
|
+
}, {
|
|
403
|
+
default: withCtx(() => [createVNode(unref(X), { class: "size-5" })]),
|
|
404
|
+
_: 1
|
|
405
|
+
}, 8, ["aria-label"])]),
|
|
406
|
+
createElementVNode("div", _hoisted_7, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])
|
|
407
|
+
], 8, _hoisted_2$1)])], 4)) : createCommentVNode("", true)]),
|
|
408
|
+
_: 3
|
|
409
|
+
})]);
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}), [["__scopeId", "data-v-51709579"]]);
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/components/BaseCheckbox.vue?vue&type=script&setup=true&lang.ts
|
|
415
|
+
var _hoisted_1$1 = { class: "flex flex-col gap-1.5" };
|
|
416
|
+
var _hoisted_2 = ["for"];
|
|
417
|
+
var _hoisted_3 = [
|
|
418
|
+
"id",
|
|
419
|
+
"disabled",
|
|
420
|
+
"aria-invalid",
|
|
421
|
+
"aria-describedby"
|
|
422
|
+
];
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/components/BaseCheckbox.vue
|
|
425
|
+
var BaseCheckbox_default = /* @__PURE__ */ defineComponent({
|
|
426
|
+
__name: "BaseCheckbox",
|
|
427
|
+
props: /*@__PURE__*/ mergeModels({
|
|
428
|
+
label: {},
|
|
429
|
+
error: { default: "" },
|
|
430
|
+
hint: { default: "" },
|
|
431
|
+
disabled: {
|
|
432
|
+
type: Boolean,
|
|
433
|
+
default: false
|
|
434
|
+
},
|
|
435
|
+
size: { default: "md" }
|
|
436
|
+
}, {
|
|
437
|
+
"modelValue": {
|
|
438
|
+
type: Boolean,
|
|
439
|
+
default: false
|
|
440
|
+
},
|
|
441
|
+
"modelModifiers": {}
|
|
442
|
+
}),
|
|
443
|
+
emits: ["update:modelValue"],
|
|
444
|
+
setup(__props) {
|
|
445
|
+
const model = useModel(__props, "modelValue");
|
|
446
|
+
const id = useId();
|
|
447
|
+
const errorId = `${id}-error`;
|
|
448
|
+
const hintId = `${id}-hint`;
|
|
449
|
+
const describedBy = computed(() => {
|
|
450
|
+
if (__props.error) return errorId;
|
|
451
|
+
if (__props.hint) return hintId;
|
|
452
|
+
});
|
|
453
|
+
return (_ctx, _cache) => {
|
|
454
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("label", {
|
|
455
|
+
for: unref(id),
|
|
456
|
+
class: normalizeClass(["flex items-center", [__props.size === "sm" ? "gap-2" : "gap-3", __props.disabled ? "opacity-50" : "cursor-pointer"]])
|
|
457
|
+
}, [withDirectives(createElementVNode("input", {
|
|
458
|
+
id: unref(id),
|
|
459
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
460
|
+
type: "checkbox",
|
|
461
|
+
disabled: __props.disabled,
|
|
462
|
+
"aria-invalid": Boolean(__props.error),
|
|
463
|
+
"aria-describedby": describedBy.value,
|
|
464
|
+
class: "accent-primary focus-visible:outline-primary size-4 shrink-0 focus-visible:outline-2 focus-visible:outline-offset-2"
|
|
465
|
+
}, null, 8, _hoisted_3), [[vModelCheckbox, model.value]]), createElementVNode("span", { class: normalizeClass(["text-sm", __props.size === "sm" ? "text-ink-soft" : "text-ink"]) }, toDisplayString(__props.label), 3)], 10, _hoisted_2), __props.error ? (openBlock(), createElementBlock("p", {
|
|
466
|
+
key: 0,
|
|
467
|
+
id: errorId,
|
|
468
|
+
class: "text-negative text-xs"
|
|
469
|
+
}, toDisplayString(__props.error), 1)) : __props.hint ? (openBlock(), createElementBlock("p", {
|
|
470
|
+
key: 1,
|
|
471
|
+
id: hintId,
|
|
472
|
+
class: "text-ink-soft text-xs"
|
|
473
|
+
}, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)]);
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/components/GoogleButton.vue?vue&type=script&setup=true&lang.ts
|
|
479
|
+
var _hoisted_1 = ["disabled"];
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/components/GoogleButton.vue
|
|
482
|
+
var GoogleButton_default = /* @__PURE__ */ defineComponent({
|
|
483
|
+
__name: "GoogleButton",
|
|
484
|
+
props: {
|
|
485
|
+
label: {},
|
|
486
|
+
disabled: {
|
|
487
|
+
type: Boolean,
|
|
488
|
+
default: false
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
emits: ["click"],
|
|
492
|
+
setup(__props, { emit: __emit }) {
|
|
493
|
+
const emit = __emit;
|
|
494
|
+
return (_ctx, _cache) => {
|
|
495
|
+
return openBlock(), createElementBlock("button", {
|
|
496
|
+
type: "button",
|
|
497
|
+
disabled: __props.disabled,
|
|
498
|
+
class: "border-hair bg-surface text-ink rounded-card hover:bg-muted flex h-11 w-full items-center justify-center gap-2 border text-sm font-medium transition-colors active:scale-95 disabled:pointer-events-none disabled:opacity-50",
|
|
499
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click"))
|
|
500
|
+
}, [_cache[1] || (_cache[1] = createStaticVNode("<svg class=\"size-4\" viewBox=\"0 0 48 48\" aria-hidden=\"true\"><path fill=\"#EA4335\" d=\"M24 9.5c3.5 0 6.6 1.2 9 3.6l6.7-6.7C35.6 2.7 30.2.5 24 .5 14.6.5 6.5 5.9 2.6 13.7l7.8 6.1C12.3 13.7 17.7 9.5 24 9.5z\"></path><path fill=\"#4285F4\" d=\"M46.5 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.7c-.6 3-2.3 5.6-4.9 7.3l7.6 5.9c4.4-4.1 7.1-10.2 7.1-17.7z\"></path><path fill=\"#FBBC05\" d=\"M10.4 28.2a14.6 14.6 0 0 1 0-8.4l-7.8-6.1a24 24 0 0 0 0 20.6l7.8-6.1z\"></path><path fill=\"#34A853\" d=\"M24 47.5c6.2 0 11.5-2 15.4-5.6l-7.6-5.9c-2.1 1.4-4.8 2.3-7.8 2.3-6.3 0-11.7-4.2-13.6-10l-7.8 6.1C6.5 42.1 14.6 47.5 24 47.5z\"></path></svg>", 1)), createTextVNode(" " + toDisplayString(__props.label), 1)], 8, _hoisted_1);
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
//#endregion
|
|
505
|
+
export { FormField_default as a, applyTheme as c, setThemeStorageKey as d, useTheme as f, BaseInput_default as i, isThemePreference as l, BaseCheckbox_default as n, BaseAlert_default as o, BaseSheet_default as r, useVisualViewport as s, GoogleButton_default as t, readStoredTheme as u };
|
|
506
|
+
|
|
507
|
+
//# sourceMappingURL=GoogleButton-BQSsm0hp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoogleButton-BQSsm0hp.js","names":["$slots","$attrs"],"sources":["../src/composables/use-theme.ts","../src/composables/use-visual-viewport.ts","../src/components/BaseAlert.vue","../src/components/BaseAlert.vue","../src/components/FormField.vue","../src/components/FormField.vue","../src/components/BaseInput.vue","../src/components/BaseInput.vue","../src/components/BaseSheet.vue","../src/components/BaseSheet.vue","../src/components/BaseCheckbox.vue","../src/components/BaseCheckbox.vue","../src/components/GoogleButton.vue","../src/components/GoogleButton.vue"],"sourcesContent":["import { ref, watch } from 'vue'\nimport type { Ref } from 'vue'\n\n/** What the user asked for; `system` follows the OS. */\nexport type ThemePreference = 'system' | 'light' | 'dark'\n\n/**\n * Namespaced by the app, not by this package.\n *\n * Two rei-kit apps served from the same origin would otherwise share one theme\n * setting — and during development on localhost, they will be.\n */\nlet storageKey = 'rei-theme'\n\nexport function isThemePreference(value: unknown): value is ThemePreference {\n return value === 'system' || value === 'light' || value === 'dark'\n}\n\n/** Reads the stored preference, falling back to `system`. */\nexport function readStoredTheme(): ThemePreference {\n try {\n const stored = localStorage.getItem(storageKey)\n\n return isThemePreference(stored) ? stored : 'system'\n } catch {\n return 'system'\n }\n}\n\nfunction storeTheme(preference: ThemePreference): void {\n try {\n localStorage.setItem(storageKey, preference)\n } catch {\n // Private mode or blocked storage: the choice just will not persist.\n }\n}\n\n/**\n * Does the environment prefer a dark scheme?\n *\n * `matchMedia` is checked for on its own rather than inferred from `document`.\n * Having one does not imply having the other: jsdom supplies a document and no\n * `matchMedia`, so a consumer's component test that so much as mounts something\n * calling `useTheme` threw — and some embedded webviews are the same. Where\n * there is nothing to ask, the answer is no rather than an exception.\n */\nfunction prefersDarkScheme(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia('(prefers-color-scheme: dark)').matches\n : false\n}\n\n/**\n * Adds or removes `.dark` on `<html>`, resolving `system` against the OS.\n *\n * A no-op without a document. There is no OS preference to read on a server and\n * no `<html>` to write to, so a prerender leaves the class off and the app\n * decides the theme before hydration — see the note in the README.\n */\nexport function applyTheme(preference: ThemePreference): void {\n if (typeof document === 'undefined') return\n\n const isDark = preference === 'dark' || (preference === 'system' && prefersDarkScheme())\n\n document.documentElement.classList.toggle('dark', isDark)\n}\n\n/**\n * The shared preference, created on first use rather than at import.\n *\n * Lazy on purpose: reading storage at import time would lock in the default key\n * before an app had a chance to set its own, leaving the controller reading one\n * key and writing another.\n */\nlet preference: Ref<ThemePreference> | null = null\n\nfunction controller(): Ref<ThemePreference> {\n if (preference) return preference\n\n preference = ref<ThemePreference>(readStoredTheme())\n\n watch(\n preference,\n (next) => {\n storeTheme(next)\n applyTheme(next)\n },\n { immediate: true },\n )\n\n // While on `system`, follow the OS if the user flips it at night. Only where\n // there is something to listen to; see `prefersDarkScheme`.\n if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {\n if (preference?.value === 'system') applyTheme('system')\n })\n }\n\n return preference\n}\n\n/**\n * Sets where the preference is stored.\n *\n * Safe in either order: called before the first `useTheme()` it simply changes\n * the key, and called after it re-reads under the new one, so the controller\n * never reads from one key while writing to another.\n *\n * @example\n * ```ts\n * setThemeStorageKey('hibi-theme') // once, at startup\n * ```\n */\nexport function setThemeStorageKey(key: string): void {\n storageKey = key\n if (preference) preference.value = readStoredTheme()\n}\n\n/** @returns The shared preference ref; assigning to it stores and applies it. */\nexport function useTheme(): Ref<ThemePreference> {\n return controller()\n}\n","import { onScopeDispose, readonly, ref } from 'vue'\n\n/** The visible area, once the on-screen keyboard has taken its share. */\nexport interface VisualViewportRect {\n height: number\n offsetTop: number\n}\n\n/**\n * Tracks the visual viewport.\n *\n * Chrome and Android browsers honour `interactive-widget=resizes-content`, so\n * the layout viewport already shrinks for the keyboard there. Safari on iOS\n * does not implement it: it shrinks only the *visual* viewport, leaving a sheet\n * sized in `dvh` sitting partly underneath the keyboard.\n *\n * `null` means the API is unavailable, which callers should read as \"trust the\n * layout viewport\" rather than as zero. A server has no viewport at all, so it\n * gets that same `null` — this runs during `setup`, and a component using it\n * has to survive being rendered there.\n *\n * @example\n * ```ts\n * const viewport = useVisualViewport()\n * // :style=\"viewport ? { height: `${viewport.height}px` } : undefined\"\n * ```\n */\nexport function useVisualViewport() {\n const rect = ref<VisualViewportRect | null>(null)\n\n const viewport = typeof window === 'undefined' ? undefined : window.visualViewport\n if (!viewport) return readonly(rect)\n\n function read() {\n if (!viewport) return\n\n rect.value = { height: viewport.height, offsetTop: viewport.offsetTop }\n }\n\n read()\n\n // `scroll` matters as much as `resize`: iOS shifts the visual viewport up to\n // keep the focused field visible, without changing its height.\n viewport.addEventListener('resize', read)\n viewport.addEventListener('scroll', read)\n\n onScopeDispose(() => {\n viewport.removeEventListener('resize', read)\n viewport.removeEventListener('scroll', read)\n })\n\n return readonly(rect)\n}\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A message the reader has to take in before carrying on.\n *\n * Roles rather than colours, like everything else here: `info` is neutral,\n * `success` confirms, `warning` is a condition to know about, `danger` is\n * something that went wrong or is about to. A component that took a hex would\n * be a component that ignores the theme, and the theme is the whole reason the\n * kit exists.\n *\n * `assertive` decides how a screen reader treats it: a failed save interrupts,\n * a note about a form field waits its turn. Getting this wrong is invisible on\n * screen and rude in a screen reader, which is why it is a prop and not a\n * guess.\n */\nconst { tone = 'info', assertive = false } = defineProps<{\n tone?: 'info' | 'success' | 'warning' | 'danger' | undefined\n /** Announce immediately, interrupting. For failures the reader must act on. */\n assertive?: boolean | undefined\n}>()\n\nconst TONES = {\n info: 'border-hair bg-muted/40 text-ink',\n success: 'border-positive/35 bg-positive/8 text-ink',\n warning: 'border-warning/40 bg-warning/8 text-ink',\n danger: 'border-negative/35 bg-negative/8 text-ink',\n} as const\n\nconst MARKS = {\n info: 'bg-ink-soft/15 text-ink-soft',\n success: 'bg-positive/15 text-positive',\n warning: 'bg-warning/15 text-warning',\n danger: 'bg-negative/15 text-negative',\n} as const\n\nconst skin = computed(() => TONES[tone])\nconst mark = computed(() => MARKS[tone])\n</script>\n\n<template>\n <div\n class=\"rounded-card flex items-start gap-3 border px-4 py-3.5 text-sm leading-relaxed\"\n :class=\"skin\"\n :role=\"assertive ? 'alert' : 'status'\"\n :aria-live=\"assertive ? 'assertive' : 'polite'\"\n >\n <span\n v-if=\"$slots.mark\"\n class=\"mt-px grid size-6 shrink-0 place-items-center rounded-full text-xs font-semibold\"\n :class=\"mark\"\n aria-hidden=\"true\"\n >\n <slot name=\"mark\" />\n </span>\n\n <div class=\"min-w-0 flex-1\">\n <p v-if=\"$slots.title\" class=\"text-ink font-semibold\">\n <slot name=\"title\" />\n </p>\n <div :class=\"$slots.title ? 'mt-1' : ''\"><slot /></div>\n </div>\n\n <slot name=\"action\" />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A message the reader has to take in before carrying on.\n *\n * Roles rather than colours, like everything else here: `info` is neutral,\n * `success` confirms, `warning` is a condition to know about, `danger` is\n * something that went wrong or is about to. A component that took a hex would\n * be a component that ignores the theme, and the theme is the whole reason the\n * kit exists.\n *\n * `assertive` decides how a screen reader treats it: a failed save interrupts,\n * a note about a form field waits its turn. Getting this wrong is invisible on\n * screen and rude in a screen reader, which is why it is a prop and not a\n * guess.\n */\nconst { tone = 'info', assertive = false } = defineProps<{\n tone?: 'info' | 'success' | 'warning' | 'danger' | undefined\n /** Announce immediately, interrupting. For failures the reader must act on. */\n assertive?: boolean | undefined\n}>()\n\nconst TONES = {\n info: 'border-hair bg-muted/40 text-ink',\n success: 'border-positive/35 bg-positive/8 text-ink',\n warning: 'border-warning/40 bg-warning/8 text-ink',\n danger: 'border-negative/35 bg-negative/8 text-ink',\n} as const\n\nconst MARKS = {\n info: 'bg-ink-soft/15 text-ink-soft',\n success: 'bg-positive/15 text-positive',\n warning: 'bg-warning/15 text-warning',\n danger: 'bg-negative/15 text-negative',\n} as const\n\nconst skin = computed(() => TONES[tone])\nconst mark = computed(() => MARKS[tone])\n</script>\n\n<template>\n <div\n class=\"rounded-card flex items-start gap-3 border px-4 py-3.5 text-sm leading-relaxed\"\n :class=\"skin\"\n :role=\"assertive ? 'alert' : 'status'\"\n :aria-live=\"assertive ? 'assertive' : 'polite'\"\n >\n <span\n v-if=\"$slots.mark\"\n class=\"mt-px grid size-6 shrink-0 place-items-center rounded-full text-xs font-semibold\"\n :class=\"mark\"\n aria-hidden=\"true\"\n >\n <slot name=\"mark\" />\n </span>\n\n <div class=\"min-w-0 flex-1\">\n <p v-if=\"$slots.title\" class=\"text-ink font-semibold\">\n <slot name=\"title\" />\n </p>\n <div :class=\"$slots.title ? 'mt-1' : ''\"><slot /></div>\n </div>\n\n <slot name=\"action\" />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A label, a hint, an error, and the wiring between them.\n *\n * This was inside `BaseInput`, which is why the kit had one form control\n * instead of five. The hard part of a field is not the `<input>` — it is\n * generating an id, pointing the label at it, deciding whether the description\n * is the hint or the error, and telling assistive tech which one to read. That\n * is identical for a select, a textarea and an input, and every app that\n * needed one of the other two wrote the whole thing again.\n *\n * The control comes in through the slot and is handed what it needs to be\n * described. It is a slot rather than a prop so the field never has to know\n * what it is wrapping.\n *\n * @example\n * ```vue\n * <FormField :label=\"t('profile.name')\" :error=\"errors.name\">\n * <template #default=\"{ id, describedBy, invalid }\">\n * <input :id=\"id\" :aria-describedby=\"describedBy\" :aria-invalid=\"invalid\" />\n * </template>\n * </FormField>\n * ```\n */\nconst {\n label,\n error = '',\n hint = '',\n labelHidden = false,\n size = 'md',\n} = defineProps<{\n label: string\n error?: string | undefined\n hint?: string | undefined\n /**\n * `sm` for a control that sits inside something else — a toolbar, a filter\n * row, a settings line — rather than in a form of its own.\n *\n * It exists because every hand-written select in all three apps was the\n * small one, and the kit only had the large one. A part is not reusable if\n * reaching for it costs a size somebody chose on purpose.\n */\n size?: 'sm' | 'md' | undefined\n /**\n * Hides the label visually but keeps it for assistive tech. For fields whose\n * surrounding row already names them — dropping the label entirely would\n * leave the control with no accessible name at all.\n */\n labelHidden?: boolean | undefined\n}>()\n\nconst id = useId()\nconst errorId = `${id}-error`\nconst hintId = `${id}-hint`\n\n/* One description at a time, and the error wins. Announcing the hint as well\n buries the reason the field was rejected under advice the reader has already\n had. */\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n</script>\n\n<template>\n <div class=\"flex flex-col\" :class=\"size === 'sm' ? 'gap-1' : 'gap-1.5'\">\n <label\n :for=\"id\"\n class=\"font-medium\"\n :class=\"[\n labelHidden ? 'sr-only' : '',\n size === 'sm' ? 'text-ink-soft text-xs' : 'text-ink text-sm',\n ]\"\n >\n {{ label }}\n </label>\n\n <slot :id=\"id\" :described-by=\"describedBy\" :invalid=\"Boolean(error)\" :size=\"size\" />\n\n <p v-if=\"error\" :id=\"errorId\" class=\"text-negative text-xs\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft text-xs\">{{ hint }}</p>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A label, a hint, an error, and the wiring between them.\n *\n * This was inside `BaseInput`, which is why the kit had one form control\n * instead of five. The hard part of a field is not the `<input>` — it is\n * generating an id, pointing the label at it, deciding whether the description\n * is the hint or the error, and telling assistive tech which one to read. That\n * is identical for a select, a textarea and an input, and every app that\n * needed one of the other two wrote the whole thing again.\n *\n * The control comes in through the slot and is handed what it needs to be\n * described. It is a slot rather than a prop so the field never has to know\n * what it is wrapping.\n *\n * @example\n * ```vue\n * <FormField :label=\"t('profile.name')\" :error=\"errors.name\">\n * <template #default=\"{ id, describedBy, invalid }\">\n * <input :id=\"id\" :aria-describedby=\"describedBy\" :aria-invalid=\"invalid\" />\n * </template>\n * </FormField>\n * ```\n */\nconst {\n label,\n error = '',\n hint = '',\n labelHidden = false,\n size = 'md',\n} = defineProps<{\n label: string\n error?: string | undefined\n hint?: string | undefined\n /**\n * `sm` for a control that sits inside something else — a toolbar, a filter\n * row, a settings line — rather than in a form of its own.\n *\n * It exists because every hand-written select in all three apps was the\n * small one, and the kit only had the large one. A part is not reusable if\n * reaching for it costs a size somebody chose on purpose.\n */\n size?: 'sm' | 'md' | undefined\n /**\n * Hides the label visually but keeps it for assistive tech. For fields whose\n * surrounding row already names them — dropping the label entirely would\n * leave the control with no accessible name at all.\n */\n labelHidden?: boolean | undefined\n}>()\n\nconst id = useId()\nconst errorId = `${id}-error`\nconst hintId = `${id}-hint`\n\n/* One description at a time, and the error wins. Announcing the hint as well\n buries the reason the field was rejected under advice the reader has already\n had. */\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n</script>\n\n<template>\n <div class=\"flex flex-col\" :class=\"size === 'sm' ? 'gap-1' : 'gap-1.5'\">\n <label\n :for=\"id\"\n class=\"font-medium\"\n :class=\"[\n labelHidden ? 'sr-only' : '',\n size === 'sm' ? 'text-ink-soft text-xs' : 'text-ink text-sm',\n ]\"\n >\n {{ label }}\n </label>\n\n <slot :id=\"id\" :described-by=\"describedBy\" :invalid=\"Boolean(error)\" :size=\"size\" />\n\n <p v-if=\"error\" :id=\"errorId\" class=\"text-negative text-xs\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft text-xs\">{{ hint }}</p>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport FormField from './FormField.vue'\n\ndefineOptions({ inheritAttrs: false })\n\nconst {\n label,\n error = '',\n hint = '',\n type = 'text',\n labelHidden = false,\n size = 'md',\n variant = 'default',\n} = defineProps<{\n label: string\n error?: string | undefined\n hint?: string | undefined\n /**\n * Hides the label visually but keeps it for assistive tech. For fields whose\n * surrounding row already names them — dropping the label entirely would\n * leave the input with no accessible name at all.\n */\n labelHidden?: boolean | undefined\n /**\n * Every type a text field can be, because the ones missing were the ones\n * apps needed: `date` and `search` were hand-written three times each and\n * `url` twice, in files that already imported this component.\n */\n type?:\n | 'text'\n | 'email'\n | 'password'\n | 'number'\n | 'search'\n | 'tel'\n | 'url'\n | 'date'\n | 'time'\n | 'datetime-local'\n | undefined\n /** `sm` for a field inside a row rather than in a form of its own. */\n size?: 'sm' | 'md' | undefined\n /**\n * `unstyled` keeps the wiring and drops the surface.\n *\n * The label, the generated id, `aria-describedby` and the error are what a\n * field is; the border and the height are what it looks like. A search box\n * inside a bordered row, a url field in an editor popover — those places\n * were hand-writing the whole thing to avoid the appearance, and losing the\n * wiring with it.\n *\n * The same reasoning as `BaseButton`'s `unstyled`, and the same test: a\n * primitive is finished when the app can take its behaviour without its\n * paint.\n */\n variant?: 'default' | 'unstyled' | undefined\n}>()\n\n/* The control keeps 16px at every size, and that is not a rounding of the\n scale — it is the rule. iOS zooms the viewport when a text field it is\n focusing has a font-size under 16px, and the page never zooms back. Both\n phone consumers had written `input { font-size: 16px }` into their base\n layer to stop exactly this, and a `text-sm` utility from here would have\n overridden it in every app at once.\n\n So `size` reaches the label and the spacing, through FormField, and leaves\n the typing target alone. `BaseSelect` is free to shrink: a select opens a\n native picker rather than a caret, and does not trigger the zoom. */\nconst CONTROL_CLASS = 'h-11 text-base'\n\n/**\n * A number field's value is a number.\n *\n * Typed to `string` alone, `type=\"number\"` forced the caller to keep a string\n * ref and convert on both sides of it — and a component you have to wrap in\n * order to use is one you write yourself instead, which is exactly what the\n * first numeric field tried to reach for it did.\n */\nconst model = defineModel<string | number | undefined>()\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :label-hidden=\"labelHidden\" :size=\"size\">\n <template #default=\"{ id, describedBy, invalid }\">\n <input\n :id=\"id\"\n v-model=\"model\"\n :type=\"type\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n v-bind=\"$attrs\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'border-hair bg-surface text-ink rounded-card focus-visible:outline-primary border px-3 focus-visible:outline-2 focus-visible:outline-offset-1',\n variant === 'unstyled' ? 'text-base' : CONTROL_CLASS,\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n />\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\">\nimport FormField from './FormField.vue'\n\ndefineOptions({ inheritAttrs: false })\n\nconst {\n label,\n error = '',\n hint = '',\n type = 'text',\n labelHidden = false,\n size = 'md',\n variant = 'default',\n} = defineProps<{\n label: string\n error?: string | undefined\n hint?: string | undefined\n /**\n * Hides the label visually but keeps it for assistive tech. For fields whose\n * surrounding row already names them — dropping the label entirely would\n * leave the input with no accessible name at all.\n */\n labelHidden?: boolean | undefined\n /**\n * Every type a text field can be, because the ones missing were the ones\n * apps needed: `date` and `search` were hand-written three times each and\n * `url` twice, in files that already imported this component.\n */\n type?:\n | 'text'\n | 'email'\n | 'password'\n | 'number'\n | 'search'\n | 'tel'\n | 'url'\n | 'date'\n | 'time'\n | 'datetime-local'\n | undefined\n /** `sm` for a field inside a row rather than in a form of its own. */\n size?: 'sm' | 'md' | undefined\n /**\n * `unstyled` keeps the wiring and drops the surface.\n *\n * The label, the generated id, `aria-describedby` and the error are what a\n * field is; the border and the height are what it looks like. A search box\n * inside a bordered row, a url field in an editor popover — those places\n * were hand-writing the whole thing to avoid the appearance, and losing the\n * wiring with it.\n *\n * The same reasoning as `BaseButton`'s `unstyled`, and the same test: a\n * primitive is finished when the app can take its behaviour without its\n * paint.\n */\n variant?: 'default' | 'unstyled' | undefined\n}>()\n\n/* The control keeps 16px at every size, and that is not a rounding of the\n scale — it is the rule. iOS zooms the viewport when a text field it is\n focusing has a font-size under 16px, and the page never zooms back. Both\n phone consumers had written `input { font-size: 16px }` into their base\n layer to stop exactly this, and a `text-sm` utility from here would have\n overridden it in every app at once.\n\n So `size` reaches the label and the spacing, through FormField, and leaves\n the typing target alone. `BaseSelect` is free to shrink: a select opens a\n native picker rather than a caret, and does not trigger the zoom. */\nconst CONTROL_CLASS = 'h-11 text-base'\n\n/**\n * A number field's value is a number.\n *\n * Typed to `string` alone, `type=\"number\"` forced the caller to keep a string\n * ref and convert on both sides of it — and a component you have to wrap in\n * order to use is one you write yourself instead, which is exactly what the\n * first numeric field tried to reach for it did.\n */\nconst model = defineModel<string | number | undefined>()\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :label-hidden=\"labelHidden\" :size=\"size\">\n <template #default=\"{ id, describedBy, invalid }\">\n <input\n :id=\"id\"\n v-model=\"model\"\n :type=\"type\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n v-bind=\"$attrs\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'border-hair bg-surface text-ink rounded-card focus-visible:outline-primary border px-3 focus-visible:outline-2 focus-visible:outline-offset-1',\n variant === 'unstyled' ? 'text-base' : CONTROL_CLASS,\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n />\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\">\nimport BaseButton from './BaseButton.vue'\nimport { computed, nextTick, onUnmounted, ref, watch } from 'vue'\nimport { X } from 'lucide-vue-next'\n\nimport { useVisualViewport } from '../composables/use-visual-viewport'\n\nconst open = defineModel<boolean>({ required: true })\nconst {\n title,\n subtitle = '',\n closeLabel = 'Close',\n} = defineProps<{\n title: string\n subtitle?: string | undefined\n /**\n * Accessible name for the close button.\n *\n * A prop rather than a translation: a component that calls t() forces every\n * consumer onto one i18n setup, and this is the package's only visible string.\n */\n closeLabel?: string | undefined\n}>()\n\nconst viewport = useVisualViewport()\n\n/**\n * Pins the sheet to the area the keyboard has left visible.\n *\n * Only needed where the layout viewport does not shrink on its own — iOS. On\n * Android the numbers already agree, so this is a no-op there rather than a\n * second, competing adjustment.\n */\nconst viewportStyle = computed(() =>\n viewport.value\n ? { height: `${viewport.value.height}px`, top: `${viewport.value.offsetTop}px` }\n : undefined,\n)\n\nconst panel = ref<HTMLElement | null>(null)\nlet lastFocused: HTMLElement | null = null\n\nfunction close() {\n open.value = false\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key === 'Escape') close()\n}\n\nwatch(open, async (isOpen) => {\n if (isOpen) {\n setBackgroundInert(true)\n lastFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null\n window.addEventListener('keydown', onKeydown)\n await nextTick()\n panel.value?.focus()\n } else {\n window.removeEventListener('keydown', onKeydown)\n lastFocused?.focus()\n lastFocused = null\n setBackgroundInert(false)\n }\n})\n\n/**\n * `inert` takes the whole app out of tab order and pointer events while the\n * sheet is open — a real focus trap without keydown bookkeeping.\n *\n * The sheet itself is teleported to `#sheet-root`, a sibling of `#app`, so it\n * stays interactive.\n */\nfunction setBackgroundInert(isInert: boolean) {\n document.getElementById('app')?.toggleAttribute('inert', isInert)\n}\n\nonUnmounted(() => {\n window.removeEventListener('keydown', onKeydown)\n // Unmounting while open would otherwise leave the whole app inert forever.\n setBackgroundInert(false)\n})\n</script>\n\n<template>\n <Teleport to=\"#sheet-root\">\n <Transition name=\"sheet\">\n <div\n v-if=\"open\"\n class=\"fixed inset-x-0 top-0 bottom-0 z-50 flex items-center justify-center\"\n :style=\"viewportStyle\"\n >\n <div\n class=\"shell-frame md:rounded-shell relative flex max-h-full flex-col justify-end overflow-hidden\"\n >\n <div class=\"bg-ink/45 absolute inset-0 backdrop-blur-[2px]\" @click=\"close\" />\n\n <!-- Header and footer stay put; only the slot scrolls. Sized in dvh so\n the on-screen keyboard shrinks the sheet instead of pushing its\n content out of reach. -->\n <section\n ref=\"panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-label=\"title\"\n tabindex=\"-1\"\n class=\"sheet-panel bg-surface relative flex max-h-[94%] min-h-[56dvh] flex-col rounded-t-[28px] shadow-2xl outline-none\"\n >\n <div class=\"flex shrink-0 justify-center pt-3\" aria-hidden=\"true\">\n <span class=\"bg-hair h-1.5 w-10 rounded-full\" />\n </div>\n\n <header class=\"flex shrink-0 items-start gap-3 px-6 pt-4 pb-5\">\n <div class=\"min-w-0 flex-1\">\n <h2 class=\"text-ink text-xl leading-tight font-semibold\">{{ title }}</h2>\n <p v-if=\"subtitle\" class=\"text-ink-soft mt-1 text-sm leading-snug\">\n {{ subtitle }}\n </p>\n </div>\n\n <!-- `unstyled`, so the sheet keeps the exact button it had. What it\n gains is the focus ring it never had: this was a raw\n `<button>` with no `focus-visible` rule, so closing a sheet\n from the keyboard was invisible. -->\n <BaseButton\n variant=\"unstyled\"\n class=\"text-ink-soft hover:bg-muted hover:text-ink -mt-1 flex size-10 shrink-0 items-center justify-center rounded-full transition-colors active:scale-90\"\n :aria-label=\"closeLabel\"\n @click=\"close\"\n >\n <X class=\"size-5\" />\n </BaseButton>\n </header>\n\n <div\n class=\"min-h-0 flex-1 overflow-y-auto px-6 pb-[calc(2rem+env(safe-area-inset-bottom,0px))]\"\n >\n <slot />\n </div>\n </section>\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.sheet-enter-active,\n.sheet-leave-active {\n transition: opacity 200ms ease;\n}\n.sheet-enter-from,\n.sheet-leave-to {\n opacity: 0;\n}\n\n/* The panel travels further than the scrim fades, which is what makes the\n sheet read as rising rather than appearing. */\n.sheet-enter-active .sheet-panel,\n.sheet-leave-active .sheet-panel {\n transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);\n}\n.sheet-enter-from .sheet-panel,\n.sheet-leave-to .sheet-panel {\n transform: translateY(6%);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .sheet-enter-from .sheet-panel,\n .sheet-leave-to .sheet-panel {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport BaseButton from './BaseButton.vue'\nimport { computed, nextTick, onUnmounted, ref, watch } from 'vue'\nimport { X } from 'lucide-vue-next'\n\nimport { useVisualViewport } from '../composables/use-visual-viewport'\n\nconst open = defineModel<boolean>({ required: true })\nconst {\n title,\n subtitle = '',\n closeLabel = 'Close',\n} = defineProps<{\n title: string\n subtitle?: string | undefined\n /**\n * Accessible name for the close button.\n *\n * A prop rather than a translation: a component that calls t() forces every\n * consumer onto one i18n setup, and this is the package's only visible string.\n */\n closeLabel?: string | undefined\n}>()\n\nconst viewport = useVisualViewport()\n\n/**\n * Pins the sheet to the area the keyboard has left visible.\n *\n * Only needed where the layout viewport does not shrink on its own — iOS. On\n * Android the numbers already agree, so this is a no-op there rather than a\n * second, competing adjustment.\n */\nconst viewportStyle = computed(() =>\n viewport.value\n ? { height: `${viewport.value.height}px`, top: `${viewport.value.offsetTop}px` }\n : undefined,\n)\n\nconst panel = ref<HTMLElement | null>(null)\nlet lastFocused: HTMLElement | null = null\n\nfunction close() {\n open.value = false\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key === 'Escape') close()\n}\n\nwatch(open, async (isOpen) => {\n if (isOpen) {\n setBackgroundInert(true)\n lastFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null\n window.addEventListener('keydown', onKeydown)\n await nextTick()\n panel.value?.focus()\n } else {\n window.removeEventListener('keydown', onKeydown)\n lastFocused?.focus()\n lastFocused = null\n setBackgroundInert(false)\n }\n})\n\n/**\n * `inert` takes the whole app out of tab order and pointer events while the\n * sheet is open — a real focus trap without keydown bookkeeping.\n *\n * The sheet itself is teleported to `#sheet-root`, a sibling of `#app`, so it\n * stays interactive.\n */\nfunction setBackgroundInert(isInert: boolean) {\n document.getElementById('app')?.toggleAttribute('inert', isInert)\n}\n\nonUnmounted(() => {\n window.removeEventListener('keydown', onKeydown)\n // Unmounting while open would otherwise leave the whole app inert forever.\n setBackgroundInert(false)\n})\n</script>\n\n<template>\n <Teleport to=\"#sheet-root\">\n <Transition name=\"sheet\">\n <div\n v-if=\"open\"\n class=\"fixed inset-x-0 top-0 bottom-0 z-50 flex items-center justify-center\"\n :style=\"viewportStyle\"\n >\n <div\n class=\"shell-frame md:rounded-shell relative flex max-h-full flex-col justify-end overflow-hidden\"\n >\n <div class=\"bg-ink/45 absolute inset-0 backdrop-blur-[2px]\" @click=\"close\" />\n\n <!-- Header and footer stay put; only the slot scrolls. Sized in dvh so\n the on-screen keyboard shrinks the sheet instead of pushing its\n content out of reach. -->\n <section\n ref=\"panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n :aria-label=\"title\"\n tabindex=\"-1\"\n class=\"sheet-panel bg-surface relative flex max-h-[94%] min-h-[56dvh] flex-col rounded-t-[28px] shadow-2xl outline-none\"\n >\n <div class=\"flex shrink-0 justify-center pt-3\" aria-hidden=\"true\">\n <span class=\"bg-hair h-1.5 w-10 rounded-full\" />\n </div>\n\n <header class=\"flex shrink-0 items-start gap-3 px-6 pt-4 pb-5\">\n <div class=\"min-w-0 flex-1\">\n <h2 class=\"text-ink text-xl leading-tight font-semibold\">{{ title }}</h2>\n <p v-if=\"subtitle\" class=\"text-ink-soft mt-1 text-sm leading-snug\">\n {{ subtitle }}\n </p>\n </div>\n\n <!-- `unstyled`, so the sheet keeps the exact button it had. What it\n gains is the focus ring it never had: this was a raw\n `<button>` with no `focus-visible` rule, so closing a sheet\n from the keyboard was invisible. -->\n <BaseButton\n variant=\"unstyled\"\n class=\"text-ink-soft hover:bg-muted hover:text-ink -mt-1 flex size-10 shrink-0 items-center justify-center rounded-full transition-colors active:scale-90\"\n :aria-label=\"closeLabel\"\n @click=\"close\"\n >\n <X class=\"size-5\" />\n </BaseButton>\n </header>\n\n <div\n class=\"min-h-0 flex-1 overflow-y-auto px-6 pb-[calc(2rem+env(safe-area-inset-bottom,0px))]\"\n >\n <slot />\n </div>\n </section>\n </div>\n </div>\n </Transition>\n </Teleport>\n</template>\n\n<style scoped>\n.sheet-enter-active,\n.sheet-leave-active {\n transition: opacity 200ms ease;\n}\n.sheet-enter-from,\n.sheet-leave-to {\n opacity: 0;\n}\n\n/* The panel travels further than the scrim fades, which is what makes the\n sheet read as rising rather than appearing. */\n.sheet-enter-active .sheet-panel,\n.sheet-leave-active .sheet-panel {\n transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);\n}\n.sheet-enter-from .sheet-panel,\n.sheet-leave-to .sheet-panel {\n transform: translateY(6%);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .sheet-enter-from .sheet-panel,\n .sheet-leave-to .sheet-panel {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A single checkbox, with its label beside it.\n *\n * Deliberately not built on `FormField`. That component stacks a label above\n * its control, which is right for every field where the control is a box you\n * type into and wrong here: a checkbox is read as one sentence with a mark in\n * front of it, and putting the words above the box breaks the association a\n * sighted reader makes before they get to the accessible name.\n *\n * The whole row is the label, so the words are part of the hit target. On a\n * phone that is the difference between a control and a coin toss.\n */\nconst {\n label,\n error = '',\n hint = '',\n disabled = false,\n size = 'md',\n} = defineProps<{\n label: string\n error?: string | undefined\n hint?: string | undefined\n disabled?: boolean | undefined\n /**\n * `md` is a setting: a line the reader came here to change, in ink.\n * `sm` is an aside — \"remember me\" under a sign-in form, \"show the ones I\n * have learned\" above a list — quieter and tighter.\n *\n * The two are not a guess. Of the five hand-written checkboxes across the\n * three consuming apps, four were the aside and one was the setting, and\n * they differed in exactly these two ways.\n */\n size?: 'sm' | 'md' | undefined\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst errorId = `${id}-error`\nconst hintId = `${id}-hint`\n\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n</script>\n\n<template>\n <div class=\"flex flex-col gap-1.5\">\n <label\n :for=\"id\"\n class=\"flex items-center\"\n :class=\"[size === 'sm' ? 'gap-2' : 'gap-3', disabled ? 'opacity-50' : 'cursor-pointer']\"\n >\n <input\n :id=\"id\"\n v-model=\"model\"\n type=\"checkbox\"\n :disabled=\"disabled\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"describedBy\"\n class=\"accent-primary focus-visible:outline-primary size-4 shrink-0 focus-visible:outline-2 focus-visible:outline-offset-2\"\n />\n <span class=\"text-sm\" :class=\"size === 'sm' ? 'text-ink-soft' : 'text-ink'\">\n {{ label }}\n </span>\n </label>\n\n <p v-if=\"error\" :id=\"errorId\" class=\"text-negative text-xs\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft text-xs\">{{ hint }}</p>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A single checkbox, with its label beside it.\n *\n * Deliberately not built on `FormField`. That component stacks a label above\n * its control, which is right for every field where the control is a box you\n * type into and wrong here: a checkbox is read as one sentence with a mark in\n * front of it, and putting the words above the box breaks the association a\n * sighted reader makes before they get to the accessible name.\n *\n * The whole row is the label, so the words are part of the hit target. On a\n * phone that is the difference between a control and a coin toss.\n */\nconst {\n label,\n error = '',\n hint = '',\n disabled = false,\n size = 'md',\n} = defineProps<{\n label: string\n error?: string | undefined\n hint?: string | undefined\n disabled?: boolean | undefined\n /**\n * `md` is a setting: a line the reader came here to change, in ink.\n * `sm` is an aside — \"remember me\" under a sign-in form, \"show the ones I\n * have learned\" above a list — quieter and tighter.\n *\n * The two are not a guess. Of the five hand-written checkboxes across the\n * three consuming apps, four were the aside and one was the setting, and\n * they differed in exactly these two ways.\n */\n size?: 'sm' | 'md' | undefined\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst errorId = `${id}-error`\nconst hintId = `${id}-hint`\n\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n</script>\n\n<template>\n <div class=\"flex flex-col gap-1.5\">\n <label\n :for=\"id\"\n class=\"flex items-center\"\n :class=\"[size === 'sm' ? 'gap-2' : 'gap-3', disabled ? 'opacity-50' : 'cursor-pointer']\"\n >\n <input\n :id=\"id\"\n v-model=\"model\"\n type=\"checkbox\"\n :disabled=\"disabled\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"describedBy\"\n class=\"accent-primary focus-visible:outline-primary size-4 shrink-0 focus-visible:outline-2 focus-visible:outline-offset-2\"\n />\n <span class=\"text-sm\" :class=\"size === 'sm' ? 'text-ink-soft' : 'text-ink'\">\n {{ label }}\n </span>\n </label>\n\n <p v-if=\"error\" :id=\"errorId\" class=\"text-negative text-xs\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft text-xs\">{{ hint }}</p>\n </div>\n</template>\n","<script setup lang=\"ts\">\nconst { label, disabled = false } = defineProps<{\n label: string\n /**\n * Greyed out and unclickable while a sign-in is already in flight.\n *\n * A real prop rather than a fallthrough attribute: the button needs to look\n * disabled as well as be it, and a bare `disabled` landing on the element by\n * itself gets the second half only.\n */\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ click: [] }>()\n</script>\n\n<template>\n <button\n type=\"button\"\n :disabled=\"disabled\"\n class=\"border-hair bg-surface text-ink rounded-card hover:bg-muted flex h-11 w-full items-center justify-center gap-2 border text-sm font-medium transition-colors active:scale-95 disabled:pointer-events-none disabled:opacity-50\"\n @click=\"emit('click')\"\n >\n <!-- Google asks for its own mark, so it is inlined rather than themed. -->\n <svg class=\"size-4\" viewBox=\"0 0 48 48\" aria-hidden=\"true\">\n <path\n fill=\"#EA4335\"\n d=\"M24 9.5c3.5 0 6.6 1.2 9 3.6l6.7-6.7C35.6 2.7 30.2.5 24 .5 14.6.5 6.5 5.9 2.6 13.7l7.8 6.1C12.3 13.7 17.7 9.5 24 9.5z\"\n />\n <path\n fill=\"#4285F4\"\n d=\"M46.5 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.7c-.6 3-2.3 5.6-4.9 7.3l7.6 5.9c4.4-4.1 7.1-10.2 7.1-17.7z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M10.4 28.2a14.6 14.6 0 0 1 0-8.4l-7.8-6.1a24 24 0 0 0 0 20.6l7.8-6.1z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M24 47.5c6.2 0 11.5-2 15.4-5.6l-7.6-5.9c-2.1 1.4-4.8 2.3-7.8 2.3-6.3 0-11.7-4.2-13.6-10l-7.8 6.1C6.5 42.1 14.6 47.5 24 47.5z\"\n />\n </svg>\n {{ label }}\n </button>\n</template>\n","<script setup lang=\"ts\">\nconst { label, disabled = false } = defineProps<{\n label: string\n /**\n * Greyed out and unclickable while a sign-in is already in flight.\n *\n * A real prop rather than a fallthrough attribute: the button needs to look\n * disabled as well as be it, and a bare `disabled` landing on the element by\n * itself gets the second half only.\n */\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ click: [] }>()\n</script>\n\n<template>\n <button\n type=\"button\"\n :disabled=\"disabled\"\n class=\"border-hair bg-surface text-ink rounded-card hover:bg-muted flex h-11 w-full items-center justify-center gap-2 border text-sm font-medium transition-colors active:scale-95 disabled:pointer-events-none disabled:opacity-50\"\n @click=\"emit('click')\"\n >\n <!-- Google asks for its own mark, so it is inlined rather than themed. -->\n <svg class=\"size-4\" viewBox=\"0 0 48 48\" aria-hidden=\"true\">\n <path\n fill=\"#EA4335\"\n d=\"M24 9.5c3.5 0 6.6 1.2 9 3.6l6.7-6.7C35.6 2.7 30.2.5 24 .5 14.6.5 6.5 5.9 2.6 13.7l7.8 6.1C12.3 13.7 17.7 9.5 24 9.5z\"\n />\n <path\n fill=\"#4285F4\"\n d=\"M46.5 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.7c-.6 3-2.3 5.6-4.9 7.3l7.6 5.9c4.4-4.1 7.1-10.2 7.1-17.7z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M10.4 28.2a14.6 14.6 0 0 1 0-8.4l-7.8-6.1a24 24 0 0 0 0 20.6l7.8-6.1z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M24 47.5c6.2 0 11.5-2 15.4-5.6l-7.6-5.9c-2.1 1.4-4.8 2.3-7.8 2.3-6.3 0-11.7-4.2-13.6-10l-7.8 6.1C6.5 42.1 14.6 47.5 24 47.5z\"\n />\n </svg>\n {{ label }}\n </button>\n</template>\n"],"mappings":";;;;;;;;;;AAYA,IAAI,aAAa;AAEjB,SAAgB,kBAAkB,OAA0C;CAC1E,OAAO,UAAU,YAAY,UAAU,WAAW,UAAU;AAC9D;;AAGA,SAAgB,kBAAmC;CACjD,IAAI;EACF,MAAM,SAAS,aAAa,QAAQ,UAAU;EAE9C,OAAO,kBAAkB,MAAM,IAAI,SAAS;CAC9C,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,WAAW,YAAmC;CACrD,IAAI;EACF,aAAa,QAAQ,YAAY,UAAU;CAC7C,QAAQ,CAER;AACF;;;;;;;;;;AAWA,SAAS,oBAA6B;CACpC,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aACjE,OAAO,WAAW,8BAA8B,CAAC,CAAC,UAClD;AACN;;;;;;;;AASA,SAAgB,WAAW,YAAmC;CAC5D,IAAI,OAAO,aAAa,aAAa;CAErC,MAAM,SAAS,eAAe,UAAW,eAAe,YAAY,kBAAkB;CAEt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