rei-kit 2.6.0 → 2.7.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 +4 -4
- package/dist/components/AvatarStack.vue.d.ts +24 -0
- package/dist/components/BaseChip.vue.d.ts +32 -0
- package/dist/components/BaseKbd.vue.d.ts +21 -0
- package/dist/components/BaseLink.vue.d.ts +33 -0
- package/dist/components/BaseRating.vue.d.ts +35 -0
- package/dist/components/BaseSeparator.vue.d.ts +20 -0
- package/dist/components/BaseSkeleton.vue.d.ts +25 -0
- package/dist/components/CopyButton.vue.d.ts +33 -0
- package/dist/components/FileDrop.vue.d.ts +45 -0
- package/dist/components/TagsInput.vue.d.ts +38 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +833 -166
- package/dist/index.js.map +1 -1
- package/dist/styles.css +452 -0
- package/package.json +2 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["$slots","$attrs","$slots","$slots","$slots"],"sources":["../src/utils/day-label.ts","../src/utils/download.ts","../src/palettes/palettes.generated.json","../src/utils/appearance.ts","../src/composables/use-today.ts","../src/composables/use-debounced-callback.ts","../src/composables/use-drag-scroll.ts","../src/composables/use-media-query.ts","../src/components/BaseAvatar.vue","../src/components/BaseAvatar.vue","../src/components/BaseBadge.vue","../src/components/BaseBadge.vue","../src/components/BaseMenu.vue","../src/components/BaseMenu.vue","../src/components/BaseCard.vue","../src/components/BaseCard.vue","../src/components/BaseCombobox.vue","../src/components/BaseCombobox.vue","../src/components/BaseRadioGroup.vue","../src/components/BaseRadioGroup.vue","../src/components/BaseSelect.vue","../src/components/BaseSelect.vue","../src/components/BaseSlider.vue","../src/components/BaseSlider.vue","../src/components/BaseSpinner.vue","../src/components/BaseSpinner.vue","../src/components/BaseSwitch.vue","../src/components/BaseSwitch.vue","../src/components/BaseTable.vue","../src/components/BaseTable.vue","../src/components/BaseTextarea.vue","../src/components/BaseTextarea.vue","../src/components/EmptyState.vue","../src/components/EmptyState.vue","../src/components/ErrorBoundary.vue","../src/components/ErrorBoundary.vue","../src/components/PageContainer.vue","../src/components/PageContainer.vue","../src/components/PageHeader.vue","../src/components/PageHeader.vue","../src/components/ProgressBar.vue","../src/components/ProgressBar.vue","../src/components/PriceCard.vue","../src/components/PriceCard.vue","../src/components/ToneDot.vue","../src/components/ToneDot.vue","../src/components/SectionHeading.vue","../src/components/SectionHeading.vue","../src/components/SegmentedControl.vue","../src/components/SegmentedControl.vue","../src/components/SkeletonList.vue","../src/components/SkeletonList.vue","../src/components/StatCard.vue","../src/components/StatCard.vue","../src/components/ToastHost.vue","../src/components/ToastHost.vue","../src/components/LocaleLinks.vue","../src/components/LocaleLinks.vue","../src/components/TabBar.vue","../src/components/TabBar.vue","../src/components/BaseCalendar.vue","../src/components/BaseCalendar.vue","../src/components/BasePopover.vue","../src/components/BasePopover.vue","../src/components/BaseDatePicker.vue","../src/components/BaseDatePicker.vue","../src/components/ToggleGroup.vue","../src/components/ToggleGroup.vue","../src/components/NumberInput.vue","../src/components/NumberInput.vue","../src/components/PinInput.vue","../src/components/PinInput.vue","../src/components/CircularProgress.vue","../src/components/CircularProgress.vue","../src/components/BaseStepper.vue","../src/components/BaseStepper.vue","../src/i18n/runtime.ts","../src/index.ts"],"sourcesContent":["import { addDays, fromDateKey } from './date'\nimport { formatDate } from './format'\n\n/** The two days worth naming rather than numbering. */\nexport interface DayLabels {\n today: string\n yesterday: string\n}\n\n/**\n * A short name for a day, relative to today.\n *\n * \"Today\" and \"Yesterday\" are worth spelling out — they are the two a user\n * actually reaches for. Anything older gets its weekday, which inside a\n * five-day window is unambiguous and stays two or three characters in every\n * language.\n *\n * The two words are arguments rather than translated here: a library that calls\n * `t()` forces every consumer onto one i18n setup.\n *\n * @param dateKey - The day to label (`YYYY-MM-DD`).\n * @param today - Today's key, passed in so the caller controls the clock.\n * @param labels - What to call today and yesterday.\n *\n * @example\n * ```ts\n * relativeDayLabel('2026-08-28', '2026-08-31', { today: 'Today', yesterday: 'Yesterday' })\n * // 'Fri'\n * ```\n */\nexport function relativeDayLabel(dateKey: string, today: string, labels: DayLabels): string {\n if (dateKey === today) return labels.today\n if (dateKey === addDays(today, -1)) return labels.yesterday\n\n return formatDate(fromDateKey(dateKey), { weekday: 'short' })\n}\n","/**\n * Hands the user a file without a server round trip.\n *\n * @param data - Anything `JSON.stringify` can serialise.\n * @param filename - Suggested name, e.g. `hibi-export-2026-08-24.json`.\n */\nexport function downloadJson(data: unknown, filename: string): void {\n const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n\n link.href = url\n link.download = filename\n link.click()\n\n URL.revokeObjectURL(url)\n}\n","[\n {\n \"name\": \"rei\",\n \"label\": \"Rei\",\n \"origin\": \"rei-kit\",\n \"light\": {\n \"primary\": \"#26667f\",\n \"accent\": \"#124170\",\n \"positive\": \"#67c090\",\n \"negative\": \"#c9463b\",\n \"warning\": \"#d89a3e\",\n \"canvas\": \"#f4faf8\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#ddf4e7\",\n \"ink\": \"#0f2229\",\n \"inkSoft\": \"#5c7480\",\n \"hair\": \"#e1edea\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#07141a\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#07141a\"\n },\n \"dark\": {\n \"primary\": \"#5fb0c9\",\n \"accent\": \"#8cb8e0\",\n \"positive\": \"#67c090\",\n \"negative\": \"#f07a6f\",\n \"warning\": \"#e6ad58\",\n \"canvas\": \"#07141a\",\n \"surface\": \"#102630\",\n \"muted\": \"#12303a\",\n \"ink\": \"#e6f0ee\",\n \"inkSoft\": \"#8fa8b2\",\n \"hair\": \"#1c3945\",\n \"onPrimary\": \"#07141a\",\n \"onAccent\": \"#07141a\",\n \"onPositive\": \"#07141a\",\n \"onNegative\": \"#07141a\",\n \"onWarning\": \"#07141a\"\n },\n \"swatch\": [\n \"#26667f\",\n \"#124170\",\n \"#67c090\",\n \"#d89a3e\"\n ]\n },\n {\n \"name\": \"nord\",\n \"label\": \"Nord\",\n \"origin\": \"Arctic Ice Studio\",\n \"light\": {\n \"primary\": \"#5e81ac\",\n \"accent\": \"#b48ead\",\n \"positive\": \"#a3be8c\",\n \"negative\": \"#bf616a\",\n \"warning\": \"#ebcb8b\",\n \"canvas\": \"#eceff4\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#e5e9f0\",\n \"ink\": \"#2e3440\",\n \"inkSoft\": \"#4c566a\",\n \"hair\": \"#d8dee9\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#111111\",\n \"onPositive\": \"#2e3440\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#2e3440\"\n },\n \"dark\": {\n \"primary\": \"#88c0d0\",\n \"accent\": \"#b48ead\",\n \"positive\": \"#a3be8c\",\n \"negative\": \"#bf616a\",\n \"warning\": \"#ebcb8b\",\n \"canvas\": \"#2e3440\",\n \"surface\": \"#3b4252\",\n \"muted\": \"#434c5e\",\n \"ink\": \"#eceff4\",\n \"inkSoft\": \"#d8dee9\",\n \"hair\": \"#4c566a\",\n \"onPrimary\": \"#2e3440\",\n \"onAccent\": \"#111111\",\n \"onPositive\": \"#2e3440\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#2e3440\"\n },\n \"swatch\": [\n \"#5e81ac\",\n \"#b48ead\",\n \"#a3be8c\",\n \"#ebcb8b\"\n ]\n },\n {\n \"name\": \"dracula\",\n \"label\": \"Dracula\",\n \"origin\": \"Dracula Theme\",\n \"swatch\": [\n \"#bd93f9\",\n \"#ff79c6\",\n \"#50fa7b\",\n \"#282a36\"\n ],\n \"light\": {\n \"primary\": \"#644ac9\",\n \"accent\": \"#a3144d\",\n \"positive\": \"#14710a\",\n \"negative\": \"#cb3a2a\",\n \"warning\": \"#a34d14\",\n \"canvas\": \"#fffbeb\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#f3eeda\",\n \"ink\": \"#1f1f1f\",\n \"inkSoft\": \"#635d4f\",\n \"hair\": \"#e6e0c8\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#ffffff\"\n },\n \"dark\": {\n \"primary\": \"#bd93f9\",\n \"accent\": \"#ff79c6\",\n \"positive\": \"#50fa7b\",\n \"negative\": \"#ff5555\",\n \"warning\": \"#ffb86c\",\n \"canvas\": \"#21222c\",\n \"surface\": \"#282a36\",\n \"muted\": \"#343746\",\n \"ink\": \"#f8f8f2\",\n \"inkSoft\": \"#b6b9cf\",\n \"hair\": \"#44475a\",\n \"onPrimary\": \"#1f1f1f\",\n \"onAccent\": \"#1f1f1f\",\n \"onPositive\": \"#1f1f1f\",\n \"onNegative\": \"#1f1f1f\",\n \"onWarning\": \"#1f1f1f\"\n }\n },\n {\n \"name\": \"catppuccin\",\n \"label\": \"Catppuccin\",\n \"origin\": \"Catppuccin\",\n \"light\": {\n \"primary\": \"#8839ef\",\n \"accent\": \"#1e66f5\",\n \"positive\": \"#40a02b\",\n \"negative\": \"#d20f39\",\n \"warning\": \"#df8e1d\",\n \"canvas\": \"#eff1f5\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#e6e9ef\",\n \"ink\": \"#4c4f69\",\n \"inkSoft\": \"#5c5f77\",\n \"hair\": \"#ccd0da\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#1e1e2e\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#1e1e2e\"\n },\n \"dark\": {\n \"primary\": \"#cba6f7\",\n \"accent\": \"#89b4fa\",\n \"positive\": \"#a6e3a1\",\n \"negative\": \"#f38ba8\",\n \"warning\": \"#f9e2af\",\n \"canvas\": \"#1e1e2e\",\n \"surface\": \"#24273a\",\n \"muted\": \"#313244\",\n \"ink\": \"#cdd6f4\",\n \"inkSoft\": \"#a6adc8\",\n \"hair\": \"#45475a\",\n \"onPrimary\": \"#1e1e2e\",\n \"onAccent\": \"#1e1e2e\",\n \"onPositive\": \"#1e1e2e\",\n \"onNegative\": \"#1e1e2e\",\n \"onWarning\": \"#1e1e2e\"\n },\n \"swatch\": [\n \"#8839ef\",\n \"#1e66f5\",\n \"#40a02b\",\n \"#df8e1d\"\n ]\n },\n {\n \"name\": \"solarized\",\n \"label\": \"Solarized\",\n \"origin\": \"Ethan Schoonover\",\n \"light\": {\n \"primary\": \"#268bd2\",\n \"accent\": \"#6a6fc0\",\n \"positive\": \"#859900\",\n \"negative\": \"#dc322f\",\n \"warning\": \"#b58900\",\n \"canvas\": \"#fdf6e3\",\n \"surface\": \"#fffcf3\",\n \"muted\": \"#eee8d5\",\n \"ink\": \"#073642\",\n \"inkSoft\": \"#586e75\",\n \"hair\": \"#e4dcc4\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#002b36\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#002b36\"\n },\n \"dark\": {\n \"primary\": \"#268bd2\",\n \"accent\": \"#6a6fc0\",\n \"positive\": \"#859900\",\n \"negative\": \"#dc322f\",\n \"warning\": \"#b58900\",\n \"canvas\": \"#002b36\",\n \"surface\": \"#073642\",\n \"muted\": \"#0b3f4c\",\n \"ink\": \"#eee8d5\",\n \"inkSoft\": \"#93a1a1\",\n \"hair\": \"#16505e\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#002b36\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#002b36\"\n },\n \"swatch\": [\n \"#268bd2\",\n \"#6a6fc0\",\n \"#859900\",\n \"#b58900\"\n ]\n },\n {\n \"name\": \"gruvbox\",\n \"label\": \"Gruvbox\",\n \"origin\": \"morhetz\",\n \"light\": {\n \"primary\": \"#076678\",\n \"accent\": \"#8f3f71\",\n \"positive\": \"#79740e\",\n \"negative\": \"#9d0006\",\n \"warning\": \"#b57614\",\n \"canvas\": \"#fbf1c7\",\n \"surface\": \"#fdf7dd\",\n \"muted\": \"#ebdbb2\",\n \"ink\": \"#3c3836\",\n \"inkSoft\": \"#665c54\",\n \"hair\": \"#e2cfa4\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#111111\"\n },\n \"dark\": {\n \"primary\": \"#83a598\",\n \"accent\": \"#d3869b\",\n \"positive\": \"#b8bb26\",\n \"negative\": \"#fb4934\",\n \"warning\": \"#fabd2f\",\n \"canvas\": \"#282828\",\n \"surface\": \"#32302f\",\n \"muted\": \"#3c3836\",\n \"ink\": \"#ebdbb2\",\n \"inkSoft\": \"#bdae93\",\n \"hair\": \"#504945\",\n \"onPrimary\": \"#282828\",\n \"onAccent\": \"#282828\",\n \"onPositive\": \"#282828\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#282828\"\n },\n \"swatch\": [\n \"#076678\",\n \"#8f3f71\",\n \"#79740e\",\n \"#b57614\"\n ]\n },\n {\n \"name\": \"tokyo-night\",\n \"label\": \"Tokyo Night\",\n \"origin\": \"enkia\",\n \"swatch\": [\n \"#7aa2f7\",\n \"#bb9af7\",\n \"#9ece6a\",\n \"#1a1b26\"\n ],\n \"light\": {\n \"primary\": \"#2e7de9\",\n \"accent\": \"#9351ea\",\n \"positive\": \"#587539\",\n \"negative\": \"#f52a65\",\n \"warning\": \"#8c6c3e\",\n \"canvas\": \"#e1e2e7\",\n \"surface\": \"#f5f5f8\",\n \"muted\": \"#d5d6db\",\n \"ink\": \"#3760bf\",\n \"inkSoft\": \"#536297\",\n \"hair\": \"#c4c8da\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#16161e\",\n \"onWarning\": \"#ffffff\"\n },\n \"dark\": {\n \"primary\": \"#7aa2f7\",\n \"accent\": \"#bb9af7\",\n \"positive\": \"#9ece6a\",\n \"negative\": \"#f7768e\",\n \"warning\": \"#e0af68\",\n \"canvas\": \"#16161e\",\n \"surface\": \"#1a1b26\",\n \"muted\": \"#292e42\",\n \"ink\": \"#c0caf5\",\n \"inkSoft\": \"#a9b1d6\",\n \"hair\": \"#2f3549\",\n \"onPrimary\": \"#16161e\",\n \"onAccent\": \"#16161e\",\n \"onPositive\": \"#16161e\",\n \"onNegative\": \"#16161e\",\n \"onWarning\": \"#16161e\"\n }\n },\n {\n \"name\": \"rose-pine\",\n \"label\": \"Rosé Pine\",\n \"origin\": \"Rosé Pine\",\n \"light\": {\n \"primary\": \"#286983\",\n \"accent\": \"#907aa9\",\n \"positive\": \"#56949f\",\n \"negative\": \"#b4637a\",\n \"warning\": \"#ea9d34\",\n \"canvas\": \"#faf4ed\",\n \"surface\": \"#fffaf3\",\n \"muted\": \"#f2e9e1\",\n \"ink\": \"#575279\",\n \"inkSoft\": \"#716d89\",\n \"hair\": \"#dfdad9\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#191724\",\n \"onPositive\": \"#191724\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#191724\"\n },\n \"dark\": {\n \"primary\": \"#9ccfd8\",\n \"accent\": \"#c4a7e7\",\n \"positive\": \"#31748f\",\n \"negative\": \"#eb6f92\",\n \"warning\": \"#f6c177\",\n \"canvas\": \"#191724\",\n \"surface\": \"#1f1d2e\",\n \"muted\": \"#26233a\",\n \"ink\": \"#e0def4\",\n \"inkSoft\": \"#908caa\",\n \"hair\": \"#403d52\",\n \"onPrimary\": \"#191724\",\n \"onAccent\": \"#191724\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#191724\",\n \"onWarning\": \"#191724\"\n },\n \"swatch\": [\n \"#286983\",\n \"#907aa9\",\n \"#56949f\",\n \"#ea9d34\"\n ]\n },\n {\n \"name\": \"sakura\",\n \"label\": \"Sakura\",\n \"origin\": \"rei-kit\",\n \"light\": {\n \"primary\": \"#c2415d\",\n \"accent\": \"#7a3b4f\",\n \"positive\": \"#3f8f6a\",\n \"negative\": \"#c43d3d\",\n \"warning\": \"#c98a2a\",\n \"canvas\": \"#fdf6f7\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#fbe4e8\",\n \"ink\": \"#2a1b1f\",\n \"inkSoft\": \"#6f5a5f\",\n \"hair\": \"#f0dde1\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#1a1013\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#1a1013\"\n },\n \"dark\": {\n \"primary\": \"#f08aa0\",\n \"accent\": \"#d7a1b3\",\n \"positive\": \"#6fc39a\",\n \"negative\": \"#f07a7a\",\n \"warning\": \"#e6b060\",\n \"canvas\": \"#1a1013\",\n \"surface\": \"#24171b\",\n \"muted\": \"#321f25\",\n \"ink\": \"#f6e8eb\",\n \"inkSoft\": \"#c3a9b0\",\n \"hair\": \"#3d2930\",\n \"onPrimary\": \"#1a1013\",\n \"onAccent\": \"#1a1013\",\n \"onPositive\": \"#1a1013\",\n \"onNegative\": \"#1a1013\",\n \"onWarning\": \"#1a1013\"\n },\n \"swatch\": [\n \"#c2415d\",\n \"#7a3b4f\",\n \"#3f8f6a\",\n \"#c98a2a\"\n ]\n },\n {\n \"name\": \"matcha\",\n \"label\": \"Matcha\",\n \"origin\": \"rei-kit\",\n \"light\": {\n \"primary\": \"#5a7a2e\",\n \"accent\": \"#3d5a3a\",\n \"positive\": \"#4a8a4f\",\n \"negative\": \"#b8473a\",\n \"warning\": \"#b8862c\",\n \"canvas\": \"#f6f7f0\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#e7ecd6\",\n \"ink\": \"#1e2418\",\n \"inkSoft\": \"#5b6450\",\n \"hair\": \"#e1e6d3\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#111111\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#11140d\"\n },\n \"dark\": {\n \"primary\": \"#a8c77a\",\n \"accent\": \"#8fb58a\",\n \"positive\": \"#7cc281\",\n \"negative\": \"#e8826f\",\n \"warning\": \"#e0b35c\",\n \"canvas\": \"#11140d\",\n \"surface\": \"#191d13\",\n \"muted\": \"#242a1b\",\n \"ink\": \"#eef1e6\",\n \"inkSoft\": \"#aab39e\",\n \"hair\": \"#2e3525\",\n \"onPrimary\": \"#11140d\",\n \"onAccent\": \"#11140d\",\n \"onPositive\": \"#11140d\",\n \"onNegative\": \"#11140d\",\n \"onWarning\": \"#11140d\"\n },\n \"swatch\": [\n \"#5a7a2e\",\n \"#3d5a3a\",\n \"#4a8a4f\",\n \"#b8862c\"\n ]\n }\n]\n","import { ref, watch } from 'vue'\nimport type { Ref } from 'vue'\n\nimport generated from '../palettes/palettes.generated.json'\n\n/* ---------------------------------------------------------------------------\n Materials.\n\n How a surface is made — its fill, its edge, its depth — independent of what\n colour it is. The kit's own components never ask which one is active; they\n read the tokens, and the material redefines the tokens.\n --------------------------------------------------------------------------- */\n\nexport const MATERIALS = ['quiet', 'glass', 'brutal', 'soft'] as const\nexport type Material = (typeof MATERIALS)[number]\n\nexport function isMaterial(value: unknown): value is Material {\n return typeof value === 'string' && (MATERIALS as readonly string[]).includes(value)\n}\n\n/**\n * Switches the material for everything under `root`.\n *\n * `quiet` removes the attribute rather than writing it, because quiet is what\n * the tokens already are — there is nothing to override.\n *\n * Needs `rei-kit/materials.css` (or the one material file) imported after\n * `tokens.css`, or the attribute changes nothing.\n */\nexport function applyMaterial(material: Material, root?: HTMLElement): void {\n const el = root ?? (typeof document === 'undefined' ? undefined : document.documentElement)\n if (!el) return\n\n if (material === 'quiet') delete el.dataset['material']\n else el.dataset['material'] = material\n}\n\n/* ---------------------------------------------------------------------------\n Palettes.\n\n Generated from `src/palettes/palettes.source.json`, with the on-colours\n chosen by contrast and every text pairing measured against WCAG AA in both\n modes before a palette is allowed to ship.\n --------------------------------------------------------------------------- */\n\n/** The eleven colour roles plus the five on-colours, for one mode. */\nexport interface PaletteRoles {\n primary: string\n accent: string\n positive: string\n negative: string\n warning: string\n canvas: string\n surface: string\n muted: string\n ink: string\n inkSoft: string\n hair: string\n onPrimary: string\n onAccent: string\n onPositive: string\n onNegative: string\n onWarning: string\n}\n\nexport interface Palette {\n /** The value for `data-palette`. */\n name: string\n /** A display name. */\n label: string\n /** Who made it. Several are well-known open palettes, credited here. */\n origin: string\n /** Four colours for a picker to show at a glance. */\n swatch: readonly [string, string, string, string]\n light: PaletteRoles\n dark: PaletteRoles\n}\n\nexport const PALETTES = generated as unknown as readonly Palette[]\n\nexport type PaletteName = string\n\nexport function isPaletteName(value: unknown): value is PaletteName {\n return typeof value === 'string' && PALETTES.some((p) => p.name === value)\n}\n\n/**\n * Switches the palette for everything under `root`.\n *\n * `rei` is the tokens' own palette, so it removes the attribute. Needs\n * `rei-kit/palettes.css` imported after `tokens.css`.\n */\nexport function applyPalette(name: PaletteName, root?: HTMLElement): void {\n const el = root ?? (typeof document === 'undefined' ? undefined : document.documentElement)\n if (!el) return\n\n if (name === 'rei') delete el.dataset['palette']\n else el.dataset['palette'] = name\n}\n\n/* ---------------------------------------------------------------------------\n Persisted preferences.\n\n The same shape as `useTheme`: a module-level ref, so every caller shares one\n answer, written through to storage and applied on every change.\n --------------------------------------------------------------------------- */\n\nfunction stored<T extends string>(key: string, accept: (v: unknown) => v is T, fallback: T): T {\n try {\n const value = localStorage.getItem(key)\n return accept(value) ? value : fallback\n } catch {\n return fallback\n }\n}\n\nfunction store(key: string, value: string): void {\n try {\n localStorage.setItem(key, value)\n } catch {\n // Private mode or blocked storage: the choice just will not persist.\n }\n}\n\nlet materialKey = 'rei-material'\nlet materialRef: Ref<Material> | null = null\n\n/** Call once at startup, before `useMaterial`, to namespace the stored value. */\nexport function setMaterialStorageKey(key: string): void {\n materialKey = key\n if (materialRef) materialRef.value = stored(key, isMaterial, 'quiet')\n}\n\n/**\n * The active material, as a writable ref. Assigning it stores and applies it.\n *\n * @example\n * ```ts\n * const material = useMaterial()\n * material.value = 'glass'\n * ```\n */\nexport function useMaterial(): Ref<Material> {\n if (materialRef) return materialRef\n\n materialRef = ref<Material>(stored(materialKey, isMaterial, 'quiet'))\n watch(\n materialRef,\n (next) => {\n store(materialKey, next)\n applyMaterial(next)\n },\n { immediate: true },\n )\n\n return materialRef\n}\n\nlet paletteKey = 'rei-palette'\nlet paletteRef: Ref<PaletteName> | null = null\n\n/** Call once at startup, before `usePalette`, to namespace the stored value. */\nexport function setPaletteStorageKey(key: string): void {\n paletteKey = key\n if (paletteRef) paletteRef.value = stored(key, isPaletteName, 'rei')\n}\n\n/** The active palette's name, as a writable ref. Assigning it stores and applies it. */\nexport function usePalette(): Ref<PaletteName> {\n if (paletteRef) return paletteRef\n\n paletteRef = ref<PaletteName>(stored(paletteKey, isPaletteName, 'rei'))\n watch(\n paletteRef,\n (next) => {\n store(paletteKey, next)\n applyPalette(next)\n },\n { immediate: true },\n )\n\n return paletteRef\n}\n","import { readonly, ref } from 'vue'\n\nimport { todayKey } from '../utils/date'\n\n/**\n * Today's date key, kept current while the app stays open.\n *\n * `todayKey()` called once in `setup` freezes the date for the lifetime of the\n * component. Nobody notices in a session that lasts minutes, but a phone left\n * on the Today screen overnight would keep marking yesterday, and the Week grid\n * would disable the column that just became today.\n */\nconst current = ref(todayKey())\n\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet watching = false\n\n/** A second past midnight, so a fast timer cannot fire on the old date. */\nfunction msUntilMidnight(): number {\n const now = new Date()\n const next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 1)\n\n return next.getTime() - now.getTime()\n}\n\nfunction refresh() {\n current.value = todayKey()\n}\n\nfunction schedule() {\n clearTimeout(timer)\n timer = setTimeout(() => {\n refresh()\n schedule()\n }, msUntilMidnight())\n}\n\n/**\n * Starts the clock, once, and only where there is a clock to watch.\n *\n * This used to run at import time, which made the module impossible to load on\n * a server: `document` is not defined there, and a barrel export means one\n * `import { BaseButton } from 'rei-kit'` pulls this file in. Deferring it to\n * the first `useToday()` also means an app that never asks for today never\n * arms a timer.\n */\nfunction watchTheClock() {\n if (watching || typeof document === 'undefined') return\n\n watching = true\n schedule()\n\n // A sleeping phone does not run timers reliably, so the tab also re-checks\n // the moment it comes back — which is when the user would see a stale date.\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState !== 'visible') return\n\n refresh()\n schedule()\n })\n}\n\n/**\n * @returns Read-only ref holding today's `YYYY-MM-DD` key.\n *\n * Rendered on a server this is the *server's* today, which is a different day\n * from the visitor's either side of midnight. Anything prerendered from it\n * would hydrate to a different value; render it on the client.\n *\n * @example\n * ```ts\n * const today = useToday()\n * const isFuture = computed(() => day > today.value)\n * ```\n */\nexport function useToday() {\n watchTheClock()\n\n return readonly(current)\n}\n","import { onScopeDispose } from 'vue'\n\n/**\n * Delays a callback until the caller stops calling it.\n *\n * Used for note autosave: a request per keystroke would be wasteful, but losing\n * the last keystrokes when the user navigates away would be worse — so the\n * pending call is flushed on dispose, and `flush` is exposed for route guards.\n *\n * @param callback - Runs with the arguments of the most recent call.\n * @param delay - Quiet period in milliseconds.\n * @returns `run` to schedule, `flush` to run now, `cancel` to drop.\n *\n * @example\n * ```ts\n * const save = useDebouncedCallback((body: string) => mutate(body), 800)\n * watch(text, (value) => save.run(value))\n * onBeforeRouteLeave(() => save.flush())\n * ```\n */\nexport function useDebouncedCallback<A extends unknown[]>(\n callback: (...args: A) => void,\n delay = 800,\n) {\n let timer: ReturnType<typeof setTimeout> | null = null\n let pending: A | null = null\n\n /** Runs the pending call right now, if there is one. */\n function flush() {\n if (timer !== null) clearTimeout(timer)\n timer = null\n\n if (pending !== null) {\n const args = pending\n pending = null\n callback(...args)\n }\n }\n\n /** Drops the pending call without running it. */\n function cancel() {\n if (timer !== null) clearTimeout(timer)\n timer = null\n pending = null\n }\n\n function run(...args: A) {\n pending = args\n if (timer !== null) clearTimeout(timer)\n timer = setTimeout(flush, delay)\n }\n\n // A closing sheet or an unmounting view must not eat the last keystrokes.\n onScopeDispose(flush)\n\n return { run, flush, cancel }\n}\n","import { onScopeDispose, watch } from 'vue'\nimport type { Ref } from 'vue'\n\n/** Movement before a press counts as a drag rather than a tap. */\nconst DRAG_THRESHOLD_PX = 6\n\n/**\n * Drag-to-scroll for a horizontally scrolling element.\n *\n * The app puts `touch-action: pan-y` on the page content so the tab-swipe\n * gesture keeps its pointer events — the browser never claims a horizontal\n * drag, which also means it never pans this element natively. Rather than give\n * that up, horizontal scrolling is driven here.\n *\n * @param target - The scroll container.\n * @returns `didDrag`, so a click handler can ignore the press that ended a drag.\n *\n * @example\n * ```ts\n * const scroller = ref<HTMLElement | null>(null)\n * const { didDrag } = useDragScroll(scroller)\n *\n * function onClick() {\n * if (didDrag()) return\n * // …treat as a tap\n * }\n * ```\n */\nexport function useDragScroll(target: Ref<HTMLElement | null>) {\n let pointerId: number | null = null\n let startX = 0\n let startScroll = 0\n let dragged = false\n\n function onPointerDown(event: PointerEvent) {\n const element = target.value\n if (!element || event.pointerType === 'mouse') return\n\n pointerId = event.pointerId\n startX = event.clientX\n startScroll = element.scrollLeft\n dragged = false\n }\n\n function onPointerMove(event: PointerEvent) {\n const element = target.value\n if (!element || event.pointerId !== pointerId) return\n\n const dx = event.clientX - startX\n if (!dragged && Math.abs(dx) < DRAG_THRESHOLD_PX) return\n\n // Capture only once the gesture is clearly horizontal, so a vertical scroll\n // that happens to start here still belongs to the page.\n if (!dragged) {\n dragged = true\n element.setPointerCapture(event.pointerId)\n }\n\n element.scrollLeft = startScroll - dx\n }\n\n function onPointerUp(event: PointerEvent) {\n const element = target.value\n if (element?.hasPointerCapture(event.pointerId)) {\n element.releasePointerCapture(event.pointerId)\n }\n\n pointerId = null\n }\n\n function bind(element: HTMLElement) {\n element.addEventListener('pointerdown', onPointerDown)\n element.addEventListener('pointermove', onPointerMove)\n element.addEventListener('pointerup', onPointerUp)\n element.addEventListener('pointercancel', onPointerUp)\n }\n\n function unbind(element: HTMLElement) {\n element.removeEventListener('pointerdown', onPointerDown)\n element.removeEventListener('pointermove', onPointerMove)\n element.removeEventListener('pointerup', onPointerUp)\n element.removeEventListener('pointercancel', onPointerUp)\n }\n\n watch(\n target,\n (element, previous) => {\n if (previous) unbind(previous)\n if (element) bind(element)\n },\n { immediate: true },\n )\n\n onScopeDispose(() => {\n if (target.value) unbind(target.value)\n })\n\n return { didDrag: () => dragged }\n}\n","import { onBeforeUnmount, onMounted, ref } from 'vue'\n\n/**\n * Whether a media query matches, kept up to date.\n *\n * Starts false and resolves on mount, which is deliberate: this is the one\n * place a component is tempted to branch on viewport during render, and doing\n * that under prerendering produces HTML built for a screen the server does not\n * have. Hydration then swaps it and the page jumps. False first, correct a\n * frame later, no jump — and a layout that reads badly at `false` is a layout\n * with a mobile-first bug worth knowing about.\n *\n * Guarded for the server for the same reason the rest of the kit is: this\n * package has to be importable in Node, and `matchMedia` does not exist there.\n *\n * @example\n * ```ts\n * const wide = useMediaQuery('(min-width: 64rem)')\n * ```\n */\nexport function useMediaQuery(query: string) {\n const matches = ref(false)\n\n let list: MediaQueryList | undefined\n\n function update(event: MediaQueryList | MediaQueryListEvent) {\n matches.value = event.matches\n }\n\n onMounted(() => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return\n\n list = window.matchMedia(query)\n update(list)\n list.addEventListener('change', update)\n })\n\n onBeforeUnmount(() => {\n list?.removeEventListener('change', update)\n })\n\n return matches\n}\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\n\n/**\n * The person, in the corner where the account lives.\n *\n * ## Why the default is a glyph and not an initial\n *\n * An initial in a circle reads as a profile picture that failed to load, and it\n * says nothing at all to somebody who has never seen an avatar in that spot\n * before — which is most people, the first time. A drawn person says \"this is\n * you\" without knowing your name. So `fallback` defaults to the figure, and\n * initials are available for the places where the name is the point: a list of\n * members, a comment thread, anywhere several people appear at once and telling\n * them apart is the job.\n *\n * An image that fails is caught and falls back rather than leaving a broken\n * frame, because a missing avatar is normal and a broken image is an error.\n */\nconst {\n name = '',\n src = '',\n size = 'md',\n fallback = 'figure',\n label = '',\n} = defineProps<{\n /** Used for the initials and, failing a `label`, as the accessible name. */\n name?: string | undefined\n src?: string | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n fallback?: 'figure' | 'initials' | undefined\n /** Overrides the accessible name. For \"Your account\" rather than a person's name. */\n label?: string | undefined\n}>()\n\nconst broken = ref(false)\nwatch(\n () => src,\n () => (broken.value = false),\n)\n\nconst showImage = computed(() => Boolean(src) && !broken.value)\n\n/**\n * Two letters at most, from the first and last word.\n *\n * `Array.from` rather than `slice`, so a name written in a script outside the\n * basic plane is cut between characters rather than through one.\n */\nconst initials = computed(() => {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length === 0) return ''\n\n const first = Array.from(words[0]!)[0] ?? ''\n const last = words.length > 1 ? (Array.from(words[words.length - 1]!)[0] ?? '') : ''\n\n return (first + last).toUpperCase()\n})\n\nconst accessibleName = computed(() => label || name)\n</script>\n\n<template>\n <span\n class=\"rk-avatar\"\n :class=\"`is-${size}`\"\n :role=\"accessibleName ? 'img' : undefined\"\n :aria-label=\"accessibleName || undefined\"\n :aria-hidden=\"accessibleName ? undefined : 'true'\"\n >\n <img v-if=\"showImage\" :src=\"src\" alt=\"\" class=\"rk-avatar-img\" @error=\"broken = true\" />\n\n <span v-else-if=\"fallback === 'initials' && initials\" class=\"rk-avatar-initials\">\n {{ initials }}\n </span>\n\n <svg v-else viewBox=\"0 0 20 20\" class=\"rk-avatar-figure\" fill=\"none\" stroke=\"currentColor\">\n <circle cx=\"10\" cy=\"6.75\" r=\"3.25\" stroke-width=\"1.5\" />\n <path\n d=\"M3.75 17c0-3.05 2.8-5.25 6.25-5.25S16.25 13.95 16.25 17\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n />\n </svg>\n </span>\n</template>\n\n<style scoped>\n.rk-avatar {\n display: grid;\n place-items: center;\n flex-shrink: 0;\n overflow: hidden;\n border-radius: var(--radius-cell);\n border: 1px solid color-mix(in srgb, var(--color-hair) 70%, transparent);\n background: var(--color-surface);\n color: var(--color-ink-soft);\n}\n\n.is-sm {\n width: 1.75rem;\n height: 1.75rem;\n}\n\n.is-md {\n width: 2.25rem;\n height: 2.25rem;\n}\n\n.is-lg {\n width: 3rem;\n height: 3rem;\n}\n\n.rk-avatar-img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.rk-avatar-initials {\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1;\n color: var(--color-ink);\n}\n\n.is-lg .rk-avatar-initials {\n font-size: 1rem;\n}\n\n.rk-avatar-figure {\n width: 65%;\n height: 65%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\n\n/**\n * The person, in the corner where the account lives.\n *\n * ## Why the default is a glyph and not an initial\n *\n * An initial in a circle reads as a profile picture that failed to load, and it\n * says nothing at all to somebody who has never seen an avatar in that spot\n * before — which is most people, the first time. A drawn person says \"this is\n * you\" without knowing your name. So `fallback` defaults to the figure, and\n * initials are available for the places where the name is the point: a list of\n * members, a comment thread, anywhere several people appear at once and telling\n * them apart is the job.\n *\n * An image that fails is caught and falls back rather than leaving a broken\n * frame, because a missing avatar is normal and a broken image is an error.\n */\nconst {\n name = '',\n src = '',\n size = 'md',\n fallback = 'figure',\n label = '',\n} = defineProps<{\n /** Used for the initials and, failing a `label`, as the accessible name. */\n name?: string | undefined\n src?: string | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n fallback?: 'figure' | 'initials' | undefined\n /** Overrides the accessible name. For \"Your account\" rather than a person's name. */\n label?: string | undefined\n}>()\n\nconst broken = ref(false)\nwatch(\n () => src,\n () => (broken.value = false),\n)\n\nconst showImage = computed(() => Boolean(src) && !broken.value)\n\n/**\n * Two letters at most, from the first and last word.\n *\n * `Array.from` rather than `slice`, so a name written in a script outside the\n * basic plane is cut between characters rather than through one.\n */\nconst initials = computed(() => {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length === 0) return ''\n\n const first = Array.from(words[0]!)[0] ?? ''\n const last = words.length > 1 ? (Array.from(words[words.length - 1]!)[0] ?? '') : ''\n\n return (first + last).toUpperCase()\n})\n\nconst accessibleName = computed(() => label || name)\n</script>\n\n<template>\n <span\n class=\"rk-avatar\"\n :class=\"`is-${size}`\"\n :role=\"accessibleName ? 'img' : undefined\"\n :aria-label=\"accessibleName || undefined\"\n :aria-hidden=\"accessibleName ? undefined : 'true'\"\n >\n <img v-if=\"showImage\" :src=\"src\" alt=\"\" class=\"rk-avatar-img\" @error=\"broken = true\" />\n\n <span v-else-if=\"fallback === 'initials' && initials\" class=\"rk-avatar-initials\">\n {{ initials }}\n </span>\n\n <svg v-else viewBox=\"0 0 20 20\" class=\"rk-avatar-figure\" fill=\"none\" stroke=\"currentColor\">\n <circle cx=\"10\" cy=\"6.75\" r=\"3.25\" stroke-width=\"1.5\" />\n <path\n d=\"M3.75 17c0-3.05 2.8-5.25 6.25-5.25S16.25 13.95 16.25 17\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n />\n </svg>\n </span>\n</template>\n\n<style scoped>\n.rk-avatar {\n display: grid;\n place-items: center;\n flex-shrink: 0;\n overflow: hidden;\n border-radius: var(--radius-cell);\n border: 1px solid color-mix(in srgb, var(--color-hair) 70%, transparent);\n background: var(--color-surface);\n color: var(--color-ink-soft);\n}\n\n.is-sm {\n width: 1.75rem;\n height: 1.75rem;\n}\n\n.is-md {\n width: 2.25rem;\n height: 2.25rem;\n}\n\n.is-lg {\n width: 3rem;\n height: 3rem;\n}\n\n.rk-avatar-img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.rk-avatar-initials {\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1;\n color: var(--color-ink);\n}\n\n.is-lg .rk-avatar-initials {\n font-size: 1rem;\n}\n\n.rk-avatar-figure {\n width: 65%;\n height: 65%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A small standing label: a level, a state, a count.\n *\n * Not a button and never clickable — the moment one of these needs a click it\n * is a chip, which is a different component with focus, a hit area and a way\n * to be removed. Keeping that line drawn is most of the value.\n */\nconst { tone = 'neutral' } = defineProps<{\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | undefined\n}>()\n\nconst TONES = {\n neutral: 'bg-muted text-ink-soft',\n primary: 'bg-primary/10 text-primary',\n success: 'bg-positive/12 text-positive',\n warning: 'bg-warning/15 text-warning',\n danger: 'bg-negative/12 text-negative',\n} as const\n\nconst skin = computed(() => TONES[tone])\n</script>\n\n<template>\n <span\n class=\"rounded-cell inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium whitespace-nowrap\"\n :class=\"skin\"\n >\n <slot />\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A small standing label: a level, a state, a count.\n *\n * Not a button and never clickable — the moment one of these needs a click it\n * is a chip, which is a different component with focus, a hit area and a way\n * to be removed. Keeping that line drawn is most of the value.\n */\nconst { tone = 'neutral' } = defineProps<{\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | undefined\n}>()\n\nconst TONES = {\n neutral: 'bg-muted text-ink-soft',\n primary: 'bg-primary/10 text-primary',\n success: 'bg-positive/12 text-positive',\n warning: 'bg-warning/15 text-warning',\n danger: 'bg-negative/12 text-negative',\n} as const\n\nconst skin = computed(() => TONES[tone])\n</script>\n\n<template>\n <span\n class=\"rounded-cell inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium whitespace-nowrap\"\n :class=\"skin\"\n >\n <slot />\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A list of actions behind one control.\n *\n * ## `role=\"menu\"` is a promise\n *\n * Declaring it tells a screen reader that the arrow keys move between the\n * items, that Escape closes, and that Tab leaves rather than walking through.\n * A div with `role=\"menu\"` and none of that is worse than a plain list of\n * links: it announces a contract and then breaks it, and the reader is left\n * pressing keys that do nothing.\n *\n * The hand-written menu this replaces declared the role and had none of the\n * behaviour. That is the usual shape of the bug — the roles are the part people\n * remember, because they are the part you can see in the markup.\n *\n * So: focus moves into the menu on open and back to the trigger on close,\n * ArrowUp/ArrowDown move and wrap, Home and End jump, Escape closes, and a\n * click outside closes. Items are found in the DOM rather than declared as\n * data, so a caller can mix links, buttons and separators freely.\n *\n * @example\n * ```vue\n * <BaseMenu :label=\"t('nav.account')\">\n * <template #trigger=\"{ open }\">\n * <BaseAvatar :label=\"t('nav.account')\" />\n * </template>\n *\n * <RouterLink to=\"/profil\" role=\"menuitem\">{{ t('nav.profile') }}</RouterLink>\n * <button type=\"button\" role=\"menuitem\" @click=\"signOut\">{{ t('auth.signOut') }}</button>\n * </BaseMenu>\n * ```\n */\nconst { label, align = 'end' } = defineProps<{\n /** Accessible name for the trigger. Required: the trigger is usually a glyph. */\n label: string\n /** Which edge the panel lines up with. */\n align?: 'start' | 'end' | undefined\n}>()\n\ndefineSlots<{\n /** The control that opens it. Receives the open state for its own styling. */\n trigger?: (props: { open: boolean }) => unknown\n /** The items. Anything with `role=\"menuitem\"` joins the keyboard order. */\n default: () => unknown\n}>()\n\nconst open = defineModel<boolean>({ default: false })\n\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\nconst trigger = ref<HTMLElement | null>(null)\n\nconst id = useId()\n\nfunction items(): HTMLElement[] {\n if (!panel.value) return []\n\n return Array.from(panel.value.querySelectorAll<HTMLElement>('[role=\"menuitem\"]'))\n}\n\nfunction focusAt(index: number) {\n const list = items()\n if (list.length === 0) return\n\n // Wrapping, because a list with no edges is faster than one you fall off.\n const wrapped = (index + list.length) % list.length\n list[wrapped]?.focus()\n}\n\nfunction currentIndex(): number {\n return items().indexOf(document.activeElement as HTMLElement)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!open.value) {\n // The arrows open the menu from the trigger, which is what makes it\n // reachable without a mouse in the first place.\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n open.value = true\n }\n\n return\n }\n\n switch (event.key) {\n case 'Escape':\n event.preventDefault()\n open.value = false\n break\n case 'ArrowDown':\n event.preventDefault()\n focusAt(currentIndex() + 1)\n break\n case 'ArrowUp':\n event.preventDefault()\n focusAt(currentIndex() - 1)\n break\n case 'Home':\n event.preventDefault()\n focusAt(0)\n break\n case 'End':\n event.preventDefault()\n focusAt(items().length - 1)\n break\n case 'Tab':\n // Tab leaves the menu rather than cycling inside it. This is the one\n // place a menu differs from a dialog, and getting it backwards traps\n // somebody in a list of links.\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) open.value = false\n}\n\n/* `immediate`, because a menu can be mounted already open -- a caller driving\n it from a route, or a test. Without it that menu has no outside-click\n listener and never moves focus, and nothing says so: it looks open and\n behaves like a div. The closed case is a no-op, since removing a listener\n that was never added is free and focus is only taken back from inside. */\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) {\n document.addEventListener('pointerdown', onDocumentPointer)\n await nextTick()\n items()[0]?.focus()\n } else {\n document.removeEventListener('pointerdown', onDocumentPointer)\n // Only take focus back if it is still inside the menu; otherwise the menu\n // is closing *because* the reader went somewhere else, and dragging them\n // back is the rudest thing it could do.\n if (root.value?.contains(document.activeElement)) trigger.value?.focus()\n }\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-menu\" @keydown=\"onKeydown\">\n <button\n ref=\"trigger\"\n type=\"button\"\n class=\"rk-menu-trigger\"\n :aria-label=\"label\"\n :aria-expanded=\"open\"\n :aria-haspopup=\"true\"\n :aria-controls=\"open ? id : undefined\"\n @click=\"open = !open\"\n >\n <slot name=\"trigger\" :open=\"open\" />\n </button>\n\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-menu-panel surface-overlay\"\n :class=\"`is-${align}`\"\n role=\"menu\"\n >\n <slot />\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-menu {\n position: relative;\n display: inline-flex;\n}\n\n.rk-menu-trigger {\n display: inline-flex;\n border-radius: var(--radius-cell);\n}\n\n.rk-menu-trigger:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-menu-panel {\n position: absolute;\n top: calc(100% + 0.5rem);\n z-index: 50;\n min-width: 12rem;\n overflow: hidden;\n border-radius: var(--radius-card);\n padding: 0.375rem;\n}\n\n.rk-menu-panel.is-end {\n right: 0;\n}\n\n.rk-menu-panel.is-start {\n left: 0;\n}\n\n/* The items belong to the caller, so this styles them by role rather than by\n class: whatever they render, it lines up. */\n.rk-menu-panel :deep([role='menuitem']) {\n display: block;\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.75rem;\n text-align: left;\n font-size: 0.875rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast);\n}\n\n.rk-menu-panel :deep([role='menuitem']:hover) {\n background: var(--color-muted);\n}\n\n.rk-menu-panel :deep([role='menuitem']:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n.rk-menu-panel :deep(hr) {\n margin: 0.375rem 0;\n height: 1px;\n border: 0;\n background: color-mix(in srgb, var(--color-hair) 70%, transparent);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A list of actions behind one control.\n *\n * ## `role=\"menu\"` is a promise\n *\n * Declaring it tells a screen reader that the arrow keys move between the\n * items, that Escape closes, and that Tab leaves rather than walking through.\n * A div with `role=\"menu\"` and none of that is worse than a plain list of\n * links: it announces a contract and then breaks it, and the reader is left\n * pressing keys that do nothing.\n *\n * The hand-written menu this replaces declared the role and had none of the\n * behaviour. That is the usual shape of the bug — the roles are the part people\n * remember, because they are the part you can see in the markup.\n *\n * So: focus moves into the menu on open and back to the trigger on close,\n * ArrowUp/ArrowDown move and wrap, Home and End jump, Escape closes, and a\n * click outside closes. Items are found in the DOM rather than declared as\n * data, so a caller can mix links, buttons and separators freely.\n *\n * @example\n * ```vue\n * <BaseMenu :label=\"t('nav.account')\">\n * <template #trigger=\"{ open }\">\n * <BaseAvatar :label=\"t('nav.account')\" />\n * </template>\n *\n * <RouterLink to=\"/profil\" role=\"menuitem\">{{ t('nav.profile') }}</RouterLink>\n * <button type=\"button\" role=\"menuitem\" @click=\"signOut\">{{ t('auth.signOut') }}</button>\n * </BaseMenu>\n * ```\n */\nconst { label, align = 'end' } = defineProps<{\n /** Accessible name for the trigger. Required: the trigger is usually a glyph. */\n label: string\n /** Which edge the panel lines up with. */\n align?: 'start' | 'end' | undefined\n}>()\n\ndefineSlots<{\n /** The control that opens it. Receives the open state for its own styling. */\n trigger?: (props: { open: boolean }) => unknown\n /** The items. Anything with `role=\"menuitem\"` joins the keyboard order. */\n default: () => unknown\n}>()\n\nconst open = defineModel<boolean>({ default: false })\n\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\nconst trigger = ref<HTMLElement | null>(null)\n\nconst id = useId()\n\nfunction items(): HTMLElement[] {\n if (!panel.value) return []\n\n return Array.from(panel.value.querySelectorAll<HTMLElement>('[role=\"menuitem\"]'))\n}\n\nfunction focusAt(index: number) {\n const list = items()\n if (list.length === 0) return\n\n // Wrapping, because a list with no edges is faster than one you fall off.\n const wrapped = (index + list.length) % list.length\n list[wrapped]?.focus()\n}\n\nfunction currentIndex(): number {\n return items().indexOf(document.activeElement as HTMLElement)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!open.value) {\n // The arrows open the menu from the trigger, which is what makes it\n // reachable without a mouse in the first place.\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n open.value = true\n }\n\n return\n }\n\n switch (event.key) {\n case 'Escape':\n event.preventDefault()\n open.value = false\n break\n case 'ArrowDown':\n event.preventDefault()\n focusAt(currentIndex() + 1)\n break\n case 'ArrowUp':\n event.preventDefault()\n focusAt(currentIndex() - 1)\n break\n case 'Home':\n event.preventDefault()\n focusAt(0)\n break\n case 'End':\n event.preventDefault()\n focusAt(items().length - 1)\n break\n case 'Tab':\n // Tab leaves the menu rather than cycling inside it. This is the one\n // place a menu differs from a dialog, and getting it backwards traps\n // somebody in a list of links.\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) open.value = false\n}\n\n/* `immediate`, because a menu can be mounted already open -- a caller driving\n it from a route, or a test. Without it that menu has no outside-click\n listener and never moves focus, and nothing says so: it looks open and\n behaves like a div. The closed case is a no-op, since removing a listener\n that was never added is free and focus is only taken back from inside. */\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) {\n document.addEventListener('pointerdown', onDocumentPointer)\n await nextTick()\n items()[0]?.focus()\n } else {\n document.removeEventListener('pointerdown', onDocumentPointer)\n // Only take focus back if it is still inside the menu; otherwise the menu\n // is closing *because* the reader went somewhere else, and dragging them\n // back is the rudest thing it could do.\n if (root.value?.contains(document.activeElement)) trigger.value?.focus()\n }\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-menu\" @keydown=\"onKeydown\">\n <button\n ref=\"trigger\"\n type=\"button\"\n class=\"rk-menu-trigger\"\n :aria-label=\"label\"\n :aria-expanded=\"open\"\n :aria-haspopup=\"true\"\n :aria-controls=\"open ? id : undefined\"\n @click=\"open = !open\"\n >\n <slot name=\"trigger\" :open=\"open\" />\n </button>\n\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-menu-panel surface-overlay\"\n :class=\"`is-${align}`\"\n role=\"menu\"\n >\n <slot />\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-menu {\n position: relative;\n display: inline-flex;\n}\n\n.rk-menu-trigger {\n display: inline-flex;\n border-radius: var(--radius-cell);\n}\n\n.rk-menu-trigger:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-menu-panel {\n position: absolute;\n top: calc(100% + 0.5rem);\n z-index: 50;\n min-width: 12rem;\n overflow: hidden;\n border-radius: var(--radius-card);\n padding: 0.375rem;\n}\n\n.rk-menu-panel.is-end {\n right: 0;\n}\n\n.rk-menu-panel.is-start {\n left: 0;\n}\n\n/* The items belong to the caller, so this styles them by role rather than by\n class: whatever they render, it lines up. */\n.rk-menu-panel :deep([role='menuitem']) {\n display: block;\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.75rem;\n text-align: left;\n font-size: 0.875rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast);\n}\n\n.rk-menu-panel :deep([role='menuitem']:hover) {\n background: var(--color-muted);\n}\n\n.rk-menu-panel :deep([role='menuitem']:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n.rk-menu-panel :deep(hr) {\n margin: 0.375rem 0;\n height: 1px;\n border: 0;\n background: color-mix(in srgb, var(--color-hair) 70%, transparent);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A surface with a border, and optionally a head and a foot.\n *\n * Every app here had written this div. That is not a crisis on its own — it is\n * four classes — but it is four classes that were slightly different in each,\n * so a card on one screen had a heavier border than a card on the next and\n * nobody could say why.\n *\n * With no head and no foot there is no wrapper div: the padding lands on the\n * card itself and the card *is* the element. That matters more than a saved\n * node — most cards in the apps lay their contents out (`flex items-center\n * gap-4`, `flex flex-col gap-3`), and with a wrapper in the way those classes\n * reach the border and not the content, so the app has to add back the div\n * this component exists to remove. One that makes you do that is one you skip.\n *\n * `interactive` is for a card that is a link or a button: it adds the lift and\n * the press, and it is opt-in because a card holding a form should not move\n * when the pointer crosses it.\n */\nconst {\n interactive = false,\n as = 'div',\n padding = 'md',\n} = defineProps<{\n interactive?: boolean | undefined\n as?: string | undefined\n /**\n * How much room the card gives its contents.\n *\n * This component shipped with `px-5 py-4` baked in and was then used by\n * nobody, across three apps and thirty-five hand-written card surfaces —\n * which used `p-3` six times, `p-4` six times, `p-5` five times and `p-1`\n * four times, and not once the pair this insisted on. A card that fixes its\n * padding cannot be reached for, which is the same mistake `PageContainer`\n * made with its width and `size=\"sm\"` made with its height.\n *\n * `none` is for a card that holds a list: the rows own the padding, and the\n * dividers have to reach the border.\n */\n padding?: 'none' | 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst BODY = {\n none: '',\n sm: 'p-3',\n md: 'p-4',\n lg: 'p-5',\n} as const\n\n/* The head and the foot follow the body, so a card cannot be tight around its\n contents and loose around its title. */\nconst HEAD = {\n none: '',\n sm: 'px-3 py-2.5',\n md: 'px-4 py-3',\n lg: 'px-5 py-4',\n} as const\n</script>\n\n<template>\n <component\n :is=\"as\"\n class=\"surface rounded-card\"\n :class=\"[\n interactive\n ? 'ease-standard transition-[transform,box-shadow] duration-(--duration-slow) hover:-translate-y-0.5 hover:[--surface-shadow:var(--shadow-raised)] active:translate-y-0 active:[--surface-shadow:var(--shadow-card)]'\n : '',\n $slots.head || $slots.foot ? '' : BODY[padding],\n ]\"\n >\n <div v-if=\"$slots.head\" class=\"border-hair/70 border-b\" :class=\"HEAD[padding]\">\n <slot name=\"head\" />\n </div>\n\n <div v-if=\"$slots.head || $slots.foot\" :class=\"BODY[padding]\"><slot /></div>\n <slot v-else />\n\n <div v-if=\"$slots.foot\" class=\"border-hair/70 bg-muted/30 border-t\" :class=\"HEAD[padding]\">\n <slot name=\"foot\" />\n </div>\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A surface with a border, and optionally a head and a foot.\n *\n * Every app here had written this div. That is not a crisis on its own — it is\n * four classes — but it is four classes that were slightly different in each,\n * so a card on one screen had a heavier border than a card on the next and\n * nobody could say why.\n *\n * With no head and no foot there is no wrapper div: the padding lands on the\n * card itself and the card *is* the element. That matters more than a saved\n * node — most cards in the apps lay their contents out (`flex items-center\n * gap-4`, `flex flex-col gap-3`), and with a wrapper in the way those classes\n * reach the border and not the content, so the app has to add back the div\n * this component exists to remove. One that makes you do that is one you skip.\n *\n * `interactive` is for a card that is a link or a button: it adds the lift and\n * the press, and it is opt-in because a card holding a form should not move\n * when the pointer crosses it.\n */\nconst {\n interactive = false,\n as = 'div',\n padding = 'md',\n} = defineProps<{\n interactive?: boolean | undefined\n as?: string | undefined\n /**\n * How much room the card gives its contents.\n *\n * This component shipped with `px-5 py-4` baked in and was then used by\n * nobody, across three apps and thirty-five hand-written card surfaces —\n * which used `p-3` six times, `p-4` six times, `p-5` five times and `p-1`\n * four times, and not once the pair this insisted on. A card that fixes its\n * padding cannot be reached for, which is the same mistake `PageContainer`\n * made with its width and `size=\"sm\"` made with its height.\n *\n * `none` is for a card that holds a list: the rows own the padding, and the\n * dividers have to reach the border.\n */\n padding?: 'none' | 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst BODY = {\n none: '',\n sm: 'p-3',\n md: 'p-4',\n lg: 'p-5',\n} as const\n\n/* The head and the foot follow the body, so a card cannot be tight around its\n contents and loose around its title. */\nconst HEAD = {\n none: '',\n sm: 'px-3 py-2.5',\n md: 'px-4 py-3',\n lg: 'px-5 py-4',\n} as const\n</script>\n\n<template>\n <component\n :is=\"as\"\n class=\"surface rounded-card\"\n :class=\"[\n interactive\n ? 'ease-standard transition-[transform,box-shadow] duration-(--duration-slow) hover:-translate-y-0.5 hover:[--surface-shadow:var(--shadow-raised)] active:translate-y-0 active:[--surface-shadow:var(--shadow-card)]'\n : '',\n $slots.head || $slots.foot ? '' : BODY[padding],\n ]\"\n >\n <div v-if=\"$slots.head\" class=\"border-hair/70 border-b\" :class=\"HEAD[padding]\">\n <slot name=\"head\" />\n </div>\n\n <div v-if=\"$slots.head || $slots.foot\" :class=\"BODY[padding]\"><slot /></div>\n <slot v-else />\n\n <div v-if=\"$slots.foot\" class=\"border-hair/70 bg-muted/30 border-t\" :class=\"HEAD[padding]\">\n <slot name=\"foot\" />\n </div>\n </component>\n</template>\n","<script setup lang=\"ts\" generic=\"V extends string\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\nexport interface ComboboxOption<V extends string> {\n value: V\n /** Already translated. */\n label: string\n}\n\n/**\n * A field you type into to narrow a list, then choose from it.\n *\n * ## When to reach for this instead of `BaseSelect`\n *\n * A native select is better up to a few dozen options: it uses the platform's\n * own picker, which on a phone is a wheel the reader already knows and which no\n * web control can match. This is for when the list is long enough that reading\n * it is the problem — a country, a currency, a course — and typing three\n * letters beats scrolling.\n *\n * ## What the pattern requires\n *\n * The ARIA combobox is prescribed down to which element owns which attribute,\n * and hand-written ones get the same three things wrong:\n *\n * - **`aria-activedescendant`, not focus.** Focus stays in the text field while\n * the arrows move a highlight through the list. Moving real focus into the\n * list means typing stops working, which is the entire point of the control.\n * - **`aria-expanded` on the input**, not the wrapper. A screen reader looks for\n * it on the element with `role=\"combobox\"`.\n * - **Escape closes before it clears.** One press shuts the list, a second\n * empties the field. Clearing on the first press throws away what was typed\n * when somebody only wanted the list out of the way.\n *\n * The highlighted option is scrolled into view, because a highlight below the\n * fold is a selection nobody can see.\n */\nconst {\n label,\n options,\n placeholder = '',\n hint = '',\n error = '',\n disabled = false,\n emptyLabel,\n} = defineProps<{\n label: string\n options: readonly ComboboxOption<V>[]\n placeholder?: string | undefined\n hint?: string | undefined\n error?: string | undefined\n disabled?: boolean | undefined\n /** Shown when nothing matches. Already translated. */\n emptyLabel: string\n}>()\n\nconst model = defineModel<V | ''>({ default: '' })\n\nconst id = useId()\nconst listId = `${id}-list`\nconst hintId = `${id}-hint`\nconst errorId = `${id}-error`\nconst optionId = (index: number) => `${id}-opt-${index}`\n\nconst open = ref(false)\nconst query = ref('')\nconst highlighted = ref(0)\nconst root = ref<HTMLElement | null>(null)\nconst list = ref<HTMLElement | null>(null)\n\nconst selected = computed(() => options.find((option) => option.value === model.value))\n\n/** What the input shows: the query while typing, the chosen label otherwise. */\nconst text = computed({\n get: () => (open.value ? query.value : (selected.value?.label ?? '')),\n set: (value: string) => {\n query.value = value\n open.value = true\n highlighted.value = 0\n },\n})\n\nconst matches = computed(() => {\n const needle = query.value.trim().toLowerCase()\n if (!open.value || needle === '') return options\n\n return options.filter((option) => option.label.toLowerCase().includes(needle))\n})\n\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n\nfunction choose(option: ComboboxOption<V> | undefined) {\n if (!option) return\n\n model.value = option.value\n query.value = ''\n open.value = false\n}\n\nfunction move(delta: number) {\n const count = matches.value.length\n if (count === 0) return\n\n open.value = true\n highlighted.value = (highlighted.value + delta + count) % count\n void scrollHighlightIntoView()\n}\n\nasync function scrollHighlightIntoView() {\n await nextTick()\n const el = list.value?.children[highlighted.value] as HTMLElement | undefined\n // A highlight below the fold is a selection nobody can see. Feature-detected\n // rather than called: `scrollIntoView` is missing in jsdom and in more than\n // one embedded webview, and a keyboard that throws is worse than a list that\n // does not scroll.\n el?.scrollIntoView?.({ block: 'nearest' })\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n move(1)\n break\n case 'ArrowUp':\n event.preventDefault()\n move(-1)\n break\n case 'Enter':\n if (!open.value) return\n event.preventDefault()\n choose(matches.value[highlighted.value])\n break\n case 'Escape':\n // Close first, clear second. One press to get the list out of the way\n // without losing what was typed.\n event.preventDefault()\n if (open.value) {\n open.value = false\n query.value = ''\n } else {\n model.value = ''\n }\n break\n case 'Tab':\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) {\n open.value = false\n query.value = ''\n }\n}\n\nwatch(\n open,\n (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) document.addEventListener('pointerdown', onDocumentPointer)\n else document.removeEventListener('pointerdown', onDocumentPointer)\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-combo\">\n <label :for=\"id\" class=\"rk-combo-label\">{{ label }}</label>\n\n <div class=\"rk-combo-field\">\n <input\n :id=\"id\"\n v-model=\"text\"\n type=\"text\"\n role=\"combobox\"\n class=\"rk-combo-input control\"\n autocomplete=\"off\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :aria-expanded=\"open\"\n :aria-controls=\"listId\"\n aria-autocomplete=\"list\"\n :aria-activedescendant=\"open ? optionId(highlighted) : undefined\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"describedBy\"\n @keydown=\"onKeydown\"\n @focus=\"open = true\"\n />\n\n <button\n type=\"button\"\n class=\"rk-combo-toggle\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :disabled=\"disabled\"\n @click=\"open = !open\"\n >\n ▾\n </button>\n </div>\n\n <ul\n v-show=\"open\"\n :id=\"listId\"\n ref=\"list\"\n role=\"listbox\"\n class=\"rk-combo-list surface-overlay\"\n :aria-label=\"label\"\n >\n <li\n v-for=\"(option, index) in matches\"\n :id=\"optionId(index)\"\n :key=\"option.value\"\n role=\"option\"\n class=\"rk-combo-option\"\n :class=\"{\n 'is-highlighted': index === highlighted,\n 'is-selected': option.value === model,\n }\"\n :aria-selected=\"option.value === model\"\n @pointerdown.prevent=\"choose(option)\"\n @pointermove=\"highlighted = index\"\n >\n {{ option.label }}\n </li>\n\n <li v-if=\"matches.length === 0\" class=\"rk-combo-empty\">{{ emptyLabel }}</li>\n </ul>\n\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-combo-error\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"rk-combo-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-combo {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n}\n\n.rk-combo-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-combo-field {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n/* 16px, like every other text control here: iOS zooms the viewport when it\n focuses a field under 16px and never zooms back. */\n.rk-combo-input {\n width: 100%;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 2rem 0 0.75rem;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-combo-input:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -1px;\n}\n\n.rk-combo-input:disabled {\n opacity: 0.5;\n}\n\n.rk-combo-toggle {\n position: absolute;\n right: 0.5rem;\n color: var(--color-ink-soft);\n font-size: 0.75rem;\n}\n\n.rk-combo-list {\n position: absolute;\n top: calc(100% - 1.25rem);\n z-index: 50;\n max-height: 14rem;\n width: 100%;\n overflow-y: auto;\n border-radius: var(--radius-card);\n padding: 0.25rem;\n}\n\n.rk-combo-option {\n cursor: pointer;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink);\n}\n\n.rk-combo-option.is-highlighted {\n background: var(--color-muted);\n}\n\n.rk-combo-option.is-selected {\n font-weight: 600;\n}\n\n.rk-combo-empty {\n padding: 0.75rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n}\n\n.rk-combo-error {\n font-size: 0.75rem;\n color: var(--color-negative);\n}\n\n.rk-combo-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"V extends string\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\nexport interface ComboboxOption<V extends string> {\n value: V\n /** Already translated. */\n label: string\n}\n\n/**\n * A field you type into to narrow a list, then choose from it.\n *\n * ## When to reach for this instead of `BaseSelect`\n *\n * A native select is better up to a few dozen options: it uses the platform's\n * own picker, which on a phone is a wheel the reader already knows and which no\n * web control can match. This is for when the list is long enough that reading\n * it is the problem — a country, a currency, a course — and typing three\n * letters beats scrolling.\n *\n * ## What the pattern requires\n *\n * The ARIA combobox is prescribed down to which element owns which attribute,\n * and hand-written ones get the same three things wrong:\n *\n * - **`aria-activedescendant`, not focus.** Focus stays in the text field while\n * the arrows move a highlight through the list. Moving real focus into the\n * list means typing stops working, which is the entire point of the control.\n * - **`aria-expanded` on the input**, not the wrapper. A screen reader looks for\n * it on the element with `role=\"combobox\"`.\n * - **Escape closes before it clears.** One press shuts the list, a second\n * empties the field. Clearing on the first press throws away what was typed\n * when somebody only wanted the list out of the way.\n *\n * The highlighted option is scrolled into view, because a highlight below the\n * fold is a selection nobody can see.\n */\nconst {\n label,\n options,\n placeholder = '',\n hint = '',\n error = '',\n disabled = false,\n emptyLabel,\n} = defineProps<{\n label: string\n options: readonly ComboboxOption<V>[]\n placeholder?: string | undefined\n hint?: string | undefined\n error?: string | undefined\n disabled?: boolean | undefined\n /** Shown when nothing matches. Already translated. */\n emptyLabel: string\n}>()\n\nconst model = defineModel<V | ''>({ default: '' })\n\nconst id = useId()\nconst listId = `${id}-list`\nconst hintId = `${id}-hint`\nconst errorId = `${id}-error`\nconst optionId = (index: number) => `${id}-opt-${index}`\n\nconst open = ref(false)\nconst query = ref('')\nconst highlighted = ref(0)\nconst root = ref<HTMLElement | null>(null)\nconst list = ref<HTMLElement | null>(null)\n\nconst selected = computed(() => options.find((option) => option.value === model.value))\n\n/** What the input shows: the query while typing, the chosen label otherwise. */\nconst text = computed({\n get: () => (open.value ? query.value : (selected.value?.label ?? '')),\n set: (value: string) => {\n query.value = value\n open.value = true\n highlighted.value = 0\n },\n})\n\nconst matches = computed(() => {\n const needle = query.value.trim().toLowerCase()\n if (!open.value || needle === '') return options\n\n return options.filter((option) => option.label.toLowerCase().includes(needle))\n})\n\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n\nfunction choose(option: ComboboxOption<V> | undefined) {\n if (!option) return\n\n model.value = option.value\n query.value = ''\n open.value = false\n}\n\nfunction move(delta: number) {\n const count = matches.value.length\n if (count === 0) return\n\n open.value = true\n highlighted.value = (highlighted.value + delta + count) % count\n void scrollHighlightIntoView()\n}\n\nasync function scrollHighlightIntoView() {\n await nextTick()\n const el = list.value?.children[highlighted.value] as HTMLElement | undefined\n // A highlight below the fold is a selection nobody can see. Feature-detected\n // rather than called: `scrollIntoView` is missing in jsdom and in more than\n // one embedded webview, and a keyboard that throws is worse than a list that\n // does not scroll.\n el?.scrollIntoView?.({ block: 'nearest' })\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n move(1)\n break\n case 'ArrowUp':\n event.preventDefault()\n move(-1)\n break\n case 'Enter':\n if (!open.value) return\n event.preventDefault()\n choose(matches.value[highlighted.value])\n break\n case 'Escape':\n // Close first, clear second. One press to get the list out of the way\n // without losing what was typed.\n event.preventDefault()\n if (open.value) {\n open.value = false\n query.value = ''\n } else {\n model.value = ''\n }\n break\n case 'Tab':\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) {\n open.value = false\n query.value = ''\n }\n}\n\nwatch(\n open,\n (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) document.addEventListener('pointerdown', onDocumentPointer)\n else document.removeEventListener('pointerdown', onDocumentPointer)\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-combo\">\n <label :for=\"id\" class=\"rk-combo-label\">{{ label }}</label>\n\n <div class=\"rk-combo-field\">\n <input\n :id=\"id\"\n v-model=\"text\"\n type=\"text\"\n role=\"combobox\"\n class=\"rk-combo-input control\"\n autocomplete=\"off\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :aria-expanded=\"open\"\n :aria-controls=\"listId\"\n aria-autocomplete=\"list\"\n :aria-activedescendant=\"open ? optionId(highlighted) : undefined\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"describedBy\"\n @keydown=\"onKeydown\"\n @focus=\"open = true\"\n />\n\n <button\n type=\"button\"\n class=\"rk-combo-toggle\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :disabled=\"disabled\"\n @click=\"open = !open\"\n >\n ▾\n </button>\n </div>\n\n <ul\n v-show=\"open\"\n :id=\"listId\"\n ref=\"list\"\n role=\"listbox\"\n class=\"rk-combo-list surface-overlay\"\n :aria-label=\"label\"\n >\n <li\n v-for=\"(option, index) in matches\"\n :id=\"optionId(index)\"\n :key=\"option.value\"\n role=\"option\"\n class=\"rk-combo-option\"\n :class=\"{\n 'is-highlighted': index === highlighted,\n 'is-selected': option.value === model,\n }\"\n :aria-selected=\"option.value === model\"\n @pointerdown.prevent=\"choose(option)\"\n @pointermove=\"highlighted = index\"\n >\n {{ option.label }}\n </li>\n\n <li v-if=\"matches.length === 0\" class=\"rk-combo-empty\">{{ emptyLabel }}</li>\n </ul>\n\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-combo-error\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"rk-combo-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-combo {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n}\n\n.rk-combo-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-combo-field {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n/* 16px, like every other text control here: iOS zooms the viewport when it\n focuses a field under 16px and never zooms back. */\n.rk-combo-input {\n width: 100%;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 2rem 0 0.75rem;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-combo-input:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -1px;\n}\n\n.rk-combo-input:disabled {\n opacity: 0.5;\n}\n\n.rk-combo-toggle {\n position: absolute;\n right: 0.5rem;\n color: var(--color-ink-soft);\n font-size: 0.75rem;\n}\n\n.rk-combo-list {\n position: absolute;\n top: calc(100% - 1.25rem);\n z-index: 50;\n max-height: 14rem;\n width: 100%;\n overflow-y: auto;\n border-radius: var(--radius-card);\n padding: 0.25rem;\n}\n\n.rk-combo-option {\n cursor: pointer;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink);\n}\n\n.rk-combo-option.is-highlighted {\n background: var(--color-muted);\n}\n\n.rk-combo-option.is-selected {\n font-weight: 600;\n}\n\n.rk-combo-empty {\n padding: 0.75rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n}\n\n.rk-combo-error {\n font-size: 0.75rem;\n color: var(--color-negative);\n}\n\n.rk-combo-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\nimport { useBoundValue } from '../composables/use-bound-value'\n\n/**\n * A set of radios, and the reason there is no `BaseRadio`.\n *\n * One radio on its own is not a control — it is half of a choice that cannot\n * be unmade, and every real use is a group. So the group is the component.\n *\n * `fieldset` and `legend` rather than a label: a label points at one element,\n * and the thing being named here is the question, not any single answer. Left\n * as a plain label, a screen reader reads the options with no idea what they\n * are options for.\n */\nconst {\n modelValue = undefined,\n legend,\n options,\n error = '',\n hint = '',\n legendHidden = false,\n} = defineProps<{\n /** The chosen option's value, with `v-model`. */\n modelValue?: string | undefined\n legend: string\n options: readonly { value: string; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n legendHidden?: boolean | undefined\n}>()\n\n/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <fieldset class=\"flex flex-col gap-1.5\" :aria-describedby=\"describedBy\">\n <legend class=\"text-ink mb-1.5 text-sm font-medium\" :class=\"legendHidden ? 'sr-only' : ''\">\n {{ legend }}\n </legend>\n\n <label\n v-for=\"option in options\"\n :key=\"option.value\"\n class=\"flex items-center gap-3\"\n :class=\"option.disabled ? 'opacity-50' : 'cursor-pointer'\"\n >\n <input\n v-model=\"model\"\n type=\"radio\"\n :name=\"id\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\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-ink text-sm\">{{ option.label }}</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 </fieldset>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\nimport { useBoundValue } from '../composables/use-bound-value'\n\n/**\n * A set of radios, and the reason there is no `BaseRadio`.\n *\n * One radio on its own is not a control — it is half of a choice that cannot\n * be unmade, and every real use is a group. So the group is the component.\n *\n * `fieldset` and `legend` rather than a label: a label points at one element,\n * and the thing being named here is the question, not any single answer. Left\n * as a plain label, a screen reader reads the options with no idea what they\n * are options for.\n */\nconst {\n modelValue = undefined,\n legend,\n options,\n error = '',\n hint = '',\n legendHidden = false,\n} = defineProps<{\n /** The chosen option's value, with `v-model`. */\n modelValue?: string | undefined\n legend: string\n options: readonly { value: string; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n legendHidden?: boolean | undefined\n}>()\n\n/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <fieldset class=\"flex flex-col gap-1.5\" :aria-describedby=\"describedBy\">\n <legend class=\"text-ink mb-1.5 text-sm font-medium\" :class=\"legendHidden ? 'sr-only' : ''\">\n {{ legend }}\n </legend>\n\n <label\n v-for=\"option in options\"\n :key=\"option.value\"\n class=\"flex items-center gap-3\"\n :class=\"option.disabled ? 'opacity-50' : 'cursor-pointer'\"\n >\n <input\n v-model=\"model\"\n type=\"radio\"\n :name=\"id\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\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-ink text-sm\">{{ option.label }}</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 </fieldset>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { ChevronDown } from 'lucide-vue-next'\n\nimport FormField from './FormField.vue'\n\n/**\n * A native `<select>`, wearing the kit's field.\n *\n * Native on purpose. A custom listbox has to reimplement typeahead, the\n * keyboard, and the way a phone lifts the options into its own picker — and it\n * gets one of them wrong. What is worth replacing is the chrome, so the arrow\n * is drawn and the browser's own is removed.\n *\n * Options are passed rather than slotted so the label can be a translated\n * string the kit never sees.\n *\n * Generic over the value, because a select whose value must be a string makes\n * every consumer with numbered options write conversion glue on both sides of\n * it — and a component you have to wrap to use is one you write yourself\n * instead. A day of the month is a number.\n */\nconst {\n label,\n options,\n error = '',\n hint = '',\n labelHidden = false,\n placeholder = '',\n size = 'md',\n variant = 'default',\n} = defineProps<{\n label: string\n options: readonly { value: T; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n /**\n * An unselectable first row, for a field with no sensible default.\n *\n * Disabled rather than merely empty: an empty option that can be chosen lets\n * someone go back to having answered nothing, which no form wants.\n */\n placeholder?: string | undefined\n /**\n * `sm` for a select that filters or sorts rather than answers a form.\n *\n * Every hand-written select across the three consuming apps was this one.\n */\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 scale is typographic, not dimensional. Both sizes keep the 44px touch\n target — of the five hand-written controls this replaces, none was shorter\n than 40px and two were exactly 44, and a select that filters a list is\n pressed with the same thumb as one that answers a form. What changes is the\n type, and with it how loudly the field asks to be read. */\nconst SIZE_CLASS = {\n sm: 'h-11 text-sm',\n md: 'h-11 text-base',\n} as const\n\nconst model = defineModel<T | 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 <div class=\"relative\">\n <select\n :id=\"id\"\n v-model=\"model\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n class=\"w-full appearance-none\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary py-0 pr-10 pl-3 focus-visible:outline-2 focus-visible:outline-offset-1',\n variant === 'unstyled' ? '' : SIZE_CLASS[size],\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n >\n <option v-if=\"placeholder\" :value=\"undefined\" disabled>{{ placeholder }}</option>\n <option\n v-for=\"option in options\"\n :key=\"option.value\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <ChevronDown\n class=\"text-ink-soft pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2\"\n aria-hidden=\"true\"\n />\n </div>\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { ChevronDown } from 'lucide-vue-next'\n\nimport FormField from './FormField.vue'\n\n/**\n * A native `<select>`, wearing the kit's field.\n *\n * Native on purpose. A custom listbox has to reimplement typeahead, the\n * keyboard, and the way a phone lifts the options into its own picker — and it\n * gets one of them wrong. What is worth replacing is the chrome, so the arrow\n * is drawn and the browser's own is removed.\n *\n * Options are passed rather than slotted so the label can be a translated\n * string the kit never sees.\n *\n * Generic over the value, because a select whose value must be a string makes\n * every consumer with numbered options write conversion glue on both sides of\n * it — and a component you have to wrap to use is one you write yourself\n * instead. A day of the month is a number.\n */\nconst {\n label,\n options,\n error = '',\n hint = '',\n labelHidden = false,\n placeholder = '',\n size = 'md',\n variant = 'default',\n} = defineProps<{\n label: string\n options: readonly { value: T; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n /**\n * An unselectable first row, for a field with no sensible default.\n *\n * Disabled rather than merely empty: an empty option that can be chosen lets\n * someone go back to having answered nothing, which no form wants.\n */\n placeholder?: string | undefined\n /**\n * `sm` for a select that filters or sorts rather than answers a form.\n *\n * Every hand-written select across the three consuming apps was this one.\n */\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 scale is typographic, not dimensional. Both sizes keep the 44px touch\n target — of the five hand-written controls this replaces, none was shorter\n than 40px and two were exactly 44, and a select that filters a list is\n pressed with the same thumb as one that answers a form. What changes is the\n type, and with it how loudly the field asks to be read. */\nconst SIZE_CLASS = {\n sm: 'h-11 text-sm',\n md: 'h-11 text-base',\n} as const\n\nconst model = defineModel<T | 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 <div class=\"relative\">\n <select\n :id=\"id\"\n v-model=\"model\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n class=\"w-full appearance-none\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary py-0 pr-10 pl-3 focus-visible:outline-2 focus-visible:outline-offset-1',\n variant === 'unstyled' ? '' : SIZE_CLASS[size],\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n >\n <option v-if=\"placeholder\" :value=\"undefined\" disabled>{{ placeholder }}</option>\n <option\n v-for=\"option in options\"\n :key=\"option.value\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <ChevronDown\n class=\"text-ink-soft pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2\"\n aria-hidden=\"true\"\n />\n </div>\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A value picked from a range, where roughly right is the point.\n *\n * A native `input[type=\"range\"]`, painted. That is deliberate: the native\n * control already has the keyboard (arrows, Page Up/Down, Home/End), the\n * pointer, the touch target and the correct announcements, and every\n * hand-rolled slider gives some of that up. What it does not have is a look\n * that matches the rest of the kit, so the look is all that is replaced.\n *\n * `aria-valuetext` is the part worth stopping on. Without it a screen reader\n * reads the number alone — \"45\" — and a number with no unit is not an answer to\n * anything. Pass `format` and it reads \"45 minutes\".\n */\nconst {\n label,\n min = 0,\n max = 100,\n step = 1,\n hint = '',\n disabled = false,\n format,\n showValue = true,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n step?: number | undefined\n hint?: string | undefined\n disabled?: boolean | undefined\n /**\n * Turns the number into something a person would say — \"45 minutes\", \"₺12\".\n *\n * Used for the visible readout and for `aria-valuetext`, so both say the same\n * thing and neither is a bare number.\n */\n format?: ((value: number) => string) | undefined\n showValue?: boolean | undefined\n}>()\n\nconst model = defineModel<number>({ default: 0 })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst text = computed(() => (format ? format(model.value) : String(model.value)))\n/** Where the fill stops, as a percentage of the track. */\nconst filled = computed(() => {\n const span = max - min\n return span <= 0 ? 0 : ((model.value - min) / span) * 100\n})\n</script>\n\n<template>\n <div class=\"rk-slider\">\n <div class=\"rk-slider-head\">\n <label :for=\"id\" class=\"rk-slider-label\">{{ label }}</label>\n <output v-if=\"showValue\" :for=\"id\" class=\"rk-slider-value\">{{ text }}</output>\n </div>\n\n <input\n :id=\"id\"\n v-model.number=\"model\"\n type=\"range\"\n class=\"rk-slider-input\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"disabled\"\n :aria-valuetext=\"text\"\n :aria-describedby=\"hint ? hintId : undefined\"\n :style=\"{ '--rk-slider-filled': `${filled}%` }\"\n />\n\n <p v-if=\"hint\" :id=\"hintId\" class=\"rk-slider-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-slider {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-slider-head {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 1rem;\n}\n\n.rk-slider-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-slider-value {\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n font-variant-numeric: tabular-nums;\n}\n\n.rk-slider-input {\n width: 100%;\n height: 1.25rem;\n appearance: none;\n background: transparent;\n cursor: pointer;\n}\n\n.rk-slider-input:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n/* The two engines will not accept these in one rule: an unknown pseudo-element\n invalidates the whole selector, so WebKit and Firefox are written twice. */\n.rk-slider-input::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: linear-gradient(\n to right,\n var(--color-primary) var(--rk-slider-filled, 0%),\n var(--color-hair) var(--rk-slider-filled, 0%)\n );\n}\n\n.rk-slider-input::-moz-range-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-hair);\n}\n\n.rk-slider-input::-moz-range-progress {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-primary);\n}\n\n.rk-slider-input::-webkit-slider-thumb {\n appearance: none;\n margin-top: -0.4375rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n background: var(--color-surface);\n border: 2px solid var(--color-primary);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input::-moz-range-thumb {\n width: 1.25rem;\n height: 1.25rem;\n border: 2px solid var(--color-primary);\n border-radius: 9999px;\n background: var(--color-surface);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input:focus-visible::-webkit-slider-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-input:focus-visible::-moz-range-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A value picked from a range, where roughly right is the point.\n *\n * A native `input[type=\"range\"]`, painted. That is deliberate: the native\n * control already has the keyboard (arrows, Page Up/Down, Home/End), the\n * pointer, the touch target and the correct announcements, and every\n * hand-rolled slider gives some of that up. What it does not have is a look\n * that matches the rest of the kit, so the look is all that is replaced.\n *\n * `aria-valuetext` is the part worth stopping on. Without it a screen reader\n * reads the number alone — \"45\" — and a number with no unit is not an answer to\n * anything. Pass `format` and it reads \"45 minutes\".\n */\nconst {\n label,\n min = 0,\n max = 100,\n step = 1,\n hint = '',\n disabled = false,\n format,\n showValue = true,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n step?: number | undefined\n hint?: string | undefined\n disabled?: boolean | undefined\n /**\n * Turns the number into something a person would say — \"45 minutes\", \"₺12\".\n *\n * Used for the visible readout and for `aria-valuetext`, so both say the same\n * thing and neither is a bare number.\n */\n format?: ((value: number) => string) | undefined\n showValue?: boolean | undefined\n}>()\n\nconst model = defineModel<number>({ default: 0 })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst text = computed(() => (format ? format(model.value) : String(model.value)))\n/** Where the fill stops, as a percentage of the track. */\nconst filled = computed(() => {\n const span = max - min\n return span <= 0 ? 0 : ((model.value - min) / span) * 100\n})\n</script>\n\n<template>\n <div class=\"rk-slider\">\n <div class=\"rk-slider-head\">\n <label :for=\"id\" class=\"rk-slider-label\">{{ label }}</label>\n <output v-if=\"showValue\" :for=\"id\" class=\"rk-slider-value\">{{ text }}</output>\n </div>\n\n <input\n :id=\"id\"\n v-model.number=\"model\"\n type=\"range\"\n class=\"rk-slider-input\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"disabled\"\n :aria-valuetext=\"text\"\n :aria-describedby=\"hint ? hintId : undefined\"\n :style=\"{ '--rk-slider-filled': `${filled}%` }\"\n />\n\n <p v-if=\"hint\" :id=\"hintId\" class=\"rk-slider-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-slider {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-slider-head {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 1rem;\n}\n\n.rk-slider-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-slider-value {\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n font-variant-numeric: tabular-nums;\n}\n\n.rk-slider-input {\n width: 100%;\n height: 1.25rem;\n appearance: none;\n background: transparent;\n cursor: pointer;\n}\n\n.rk-slider-input:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n/* The two engines will not accept these in one rule: an unknown pseudo-element\n invalidates the whole selector, so WebKit and Firefox are written twice. */\n.rk-slider-input::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: linear-gradient(\n to right,\n var(--color-primary) var(--rk-slider-filled, 0%),\n var(--color-hair) var(--rk-slider-filled, 0%)\n );\n}\n\n.rk-slider-input::-moz-range-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-hair);\n}\n\n.rk-slider-input::-moz-range-progress {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-primary);\n}\n\n.rk-slider-input::-webkit-slider-thumb {\n appearance: none;\n margin-top: -0.4375rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n background: var(--color-surface);\n border: 2px solid var(--color-primary);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input::-moz-range-thumb {\n width: 1.25rem;\n height: 1.25rem;\n border: 2px solid var(--color-primary);\n border-radius: 9999px;\n background: var(--color-surface);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input:focus-visible::-webkit-slider-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-input:focus-visible::-moz-range-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * Work in progress, with no idea how much is left.\n *\n * `ProgressBar` is the one to reach for when the amount is known; this is for\n * when it is not. Showing a bar that cannot move is worse than a spinner,\n * because a bar is a promise about how long.\n *\n * `role=\"status\"` and a label, so a screen reader says what is happening. A\n * spinner with no accessible name is a decoration that happens to be the only\n * thing on screen — which is why `label` is required and not defaulted to\n * \"Loading\" in a language the app may not speak.\n */\nconst { label, size = 'md' } = defineProps<{\n /** What is being waited for. Already translated. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst SIZES = { sm: '1rem', md: '1.5rem', lg: '2.5rem' } as const\n</script>\n\n<template>\n <span class=\"rk-spin-wrap\" role=\"status\">\n <span class=\"rk-spin\" :style=\"{ width: SIZES[size], height: SIZES[size] }\" aria-hidden=\"true\" />\n <!-- Off screen rather than hidden: `display: none` is not announced. -->\n <span class=\"rk-spin-label\">{{ label }}</span>\n </span>\n</template>\n\n<style scoped>\n.rk-spin-wrap {\n display: inline-flex;\n align-items: center;\n}\n\n.rk-spin {\n display: block;\n border-radius: 9999px;\n border: 2px solid color-mix(in srgb, currentColor 20%, transparent);\n border-top-color: currentColor;\n animation: rk-spin 700ms linear infinite;\n}\n\n.rk-spin-label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n@keyframes rk-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Still moving, because a spinner that does not move says the app has hung --\n but a slow fade rather than a fast rotation. */\n@media (prefers-reduced-motion: reduce) {\n .rk-spin {\n animation: rk-pulse 1.4s ease-in-out infinite;\n }\n\n @keyframes rk-pulse {\n 50% {\n opacity: 0.35;\n }\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * Work in progress, with no idea how much is left.\n *\n * `ProgressBar` is the one to reach for when the amount is known; this is for\n * when it is not. Showing a bar that cannot move is worse than a spinner,\n * because a bar is a promise about how long.\n *\n * `role=\"status\"` and a label, so a screen reader says what is happening. A\n * spinner with no accessible name is a decoration that happens to be the only\n * thing on screen — which is why `label` is required and not defaulted to\n * \"Loading\" in a language the app may not speak.\n */\nconst { label, size = 'md' } = defineProps<{\n /** What is being waited for. Already translated. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst SIZES = { sm: '1rem', md: '1.5rem', lg: '2.5rem' } as const\n</script>\n\n<template>\n <span class=\"rk-spin-wrap\" role=\"status\">\n <span class=\"rk-spin\" :style=\"{ width: SIZES[size], height: SIZES[size] }\" aria-hidden=\"true\" />\n <!-- Off screen rather than hidden: `display: none` is not announced. -->\n <span class=\"rk-spin-label\">{{ label }}</span>\n </span>\n</template>\n\n<style scoped>\n.rk-spin-wrap {\n display: inline-flex;\n align-items: center;\n}\n\n.rk-spin {\n display: block;\n border-radius: 9999px;\n border: 2px solid color-mix(in srgb, currentColor 20%, transparent);\n border-top-color: currentColor;\n animation: rk-spin 700ms linear infinite;\n}\n\n.rk-spin-label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n@keyframes rk-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Still moving, because a spinner that does not move says the app has hung --\n but a slow fade rather than a fast rotation. */\n@media (prefers-reduced-motion: reduce) {\n .rk-spin {\n animation: rk-pulse 1.4s ease-in-out infinite;\n }\n\n @keyframes rk-pulse {\n 50% {\n opacity: 0.35;\n }\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A setting that takes effect the moment it is touched.\n *\n * Not `BaseCheckbox` with a rounder skin, and the difference is not visual. A\n * checkbox states an intention that something else commits — a form is\n * submitted, a dialog is confirmed. A switch *is* the commit: there is no Save\n * after it, which is why it belongs in a settings row and why a form full of\n * them is usually a form of checkboxes drawn wrong.\n *\n * `role=\"switch\"` rather than a styled checkbox, because a screen reader\n * announces \"on\"/\"off\" for a switch and \"checked\"/\"unchecked\" for a checkbox,\n * and those are different sentences about different things.\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 hint = '',\n disabled = false,\n labelHidden = false,\n} = defineProps<{\n label: string\n hint?: string | undefined\n disabled?: boolean | undefined\n /** For a switch inside a row that already names it — it keeps its accessible name. */\n labelHidden?: boolean | undefined\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst describedBy = computed(() => (hint ? hintId : undefined))\n\nfunction toggle() {\n if (!disabled) model.value = !model.value\n}\n</script>\n\n<template>\n <div class=\"flex items-center justify-between gap-4\">\n <span v-if=\"!labelHidden\" class=\"min-w-0\">\n <span :id=\"id\" class=\"text-ink block text-sm\">{{ label }}</span>\n <span v-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft mt-0.5 block text-xs\">{{ hint }}</span>\n </span>\n\n <!--\n A button, not an <input type=\"checkbox\">. The native control cannot carry\n `role=\"switch\"` in every engine that matters, and the track has to be\n painted anyway; what a native input would have bought is the label\n association, and `aria-labelledby` buys that outright.\n -->\n <button\n type=\"button\"\n role=\"switch\"\n class=\"rk-switch\"\n :class=\"{ 'is-on': model }\"\n :aria-checked=\"model\"\n :aria-labelledby=\"labelHidden ? undefined : id\"\n :aria-label=\"labelHidden ? label : undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @click=\"toggle\"\n >\n <span class=\"rk-switch-knob\" aria-hidden=\"true\" />\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-switch {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n width: 2.75rem;\n height: 1.625rem;\n border-radius: 9999px;\n background: var(--color-hair);\n transition: background-color var(--duration-base) ease;\n}\n\n.rk-switch.is-on {\n background: var(--color-primary);\n}\n\n.rk-switch:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-switch:disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n\n.rk-switch-knob {\n position: absolute;\n left: 0.1875rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n /* The on-colour, because the knob sits on the primary track when it is on,\n and that is exactly the pairing `on-primary` is tuned for. */\n background: var(--color-on-primary);\n box-shadow: var(--shadow-control);\n transition: transform var(--duration-base) var(--ease-sheet);\n}\n\n.rk-switch.is-on .rk-switch-knob {\n transform: translateX(1.125rem);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-switch,\n .rk-switch-knob {\n transition: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A setting that takes effect the moment it is touched.\n *\n * Not `BaseCheckbox` with a rounder skin, and the difference is not visual. A\n * checkbox states an intention that something else commits — a form is\n * submitted, a dialog is confirmed. A switch *is* the commit: there is no Save\n * after it, which is why it belongs in a settings row and why a form full of\n * them is usually a form of checkboxes drawn wrong.\n *\n * `role=\"switch\"` rather than a styled checkbox, because a screen reader\n * announces \"on\"/\"off\" for a switch and \"checked\"/\"unchecked\" for a checkbox,\n * and those are different sentences about different things.\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 hint = '',\n disabled = false,\n labelHidden = false,\n} = defineProps<{\n label: string\n hint?: string | undefined\n disabled?: boolean | undefined\n /** For a switch inside a row that already names it — it keeps its accessible name. */\n labelHidden?: boolean | undefined\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst describedBy = computed(() => (hint ? hintId : undefined))\n\nfunction toggle() {\n if (!disabled) model.value = !model.value\n}\n</script>\n\n<template>\n <div class=\"flex items-center justify-between gap-4\">\n <span v-if=\"!labelHidden\" class=\"min-w-0\">\n <span :id=\"id\" class=\"text-ink block text-sm\">{{ label }}</span>\n <span v-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft mt-0.5 block text-xs\">{{ hint }}</span>\n </span>\n\n <!--\n A button, not an <input type=\"checkbox\">. The native control cannot carry\n `role=\"switch\"` in every engine that matters, and the track has to be\n painted anyway; what a native input would have bought is the label\n association, and `aria-labelledby` buys that outright.\n -->\n <button\n type=\"button\"\n role=\"switch\"\n class=\"rk-switch\"\n :class=\"{ 'is-on': model }\"\n :aria-checked=\"model\"\n :aria-labelledby=\"labelHidden ? undefined : id\"\n :aria-label=\"labelHidden ? label : undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @click=\"toggle\"\n >\n <span class=\"rk-switch-knob\" aria-hidden=\"true\" />\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-switch {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n width: 2.75rem;\n height: 1.625rem;\n border-radius: 9999px;\n background: var(--color-hair);\n transition: background-color var(--duration-base) ease;\n}\n\n.rk-switch.is-on {\n background: var(--color-primary);\n}\n\n.rk-switch:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-switch:disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n\n.rk-switch-knob {\n position: absolute;\n left: 0.1875rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n /* The on-colour, because the knob sits on the primary track when it is on,\n and that is exactly the pairing `on-primary` is tuned for. */\n background: var(--color-on-primary);\n box-shadow: var(--shadow-control);\n transition: transform var(--duration-base) var(--ease-sheet);\n}\n\n.rk-switch.is-on .rk-switch-knob {\n transform: translateX(1.125rem);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-switch,\n .rk-switch-knob {\n transition: none;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"Row extends Record<string, unknown>\">\nexport interface Column<Row> {\n /** Key into the row, and the slot name for a custom cell. */\n key: string & keyof Row\n /** Column heading. Already translated. */\n label: string\n /** `end` for money and counts, which are read by their last digit. */\n align?: 'start' | 'end' | undefined\n /** Stops a column wrapping — dates, short codes. */\n nowrap?: boolean | undefined\n}\n\n/**\n * Rows of data, with the parts a hand-written `<table>` leaves out.\n *\n * ## The caption is required, and it is not a heading\n *\n * A table with no caption is announced as \"table\" and nothing else, so a screen\n * reader user landing in one has no idea what they are in. `captionHidden`\n * exists because the page usually already says it in a heading above — but the\n * table still has to carry its own name, because a heading is not attached to\n * anything.\n *\n * ## Scrolling belongs to the table, not the page\n *\n * A wide table inside a narrow column either overflows the page sideways —\n * which takes every other element with it — or is clipped. So the table sits in\n * its own scroller, and the scroller is focusable: a region you can only reach\n * by dragging is a region a keyboard cannot read at all. That is one line of\n * markup and it is the line everyone forgets.\n *\n * Headers carry `scope=\"col\"`, which is what lets a screen reader say the\n * column name before each cell instead of reading a wall of numbers.\n */\nconst {\n columns,\n rows,\n caption,\n captionHidden = false,\n rowKey,\n} = defineProps<{\n columns: readonly Column<Row>[]\n rows: readonly Row[]\n /** What this table is. Required — an unnamed table is a box of numbers. */\n caption: string\n /** Keeps the caption for assistive tech when the page already shows a heading. */\n captionHidden?: boolean | undefined\n /** Which field identifies a row. Falls back to the index. */\n rowKey?: (string & keyof Row) | undefined\n}>()\n\ndefineSlots<{\n /** Per-column cell override, named for the column key. */\n [key: string]: (props: { row: Row; value: unknown }) => unknown\n /** Shown instead of the body when there are no rows. */\n empty?: () => unknown\n}>()\n\nconst keyFor = (row: Row, index: number) => (rowKey ? String(row[rowKey]) : index)\n</script>\n\n<template>\n <div class=\"rk-table-scroll\" tabindex=\"0\" role=\"region\" :aria-label=\"caption\">\n <table class=\"rk-table\">\n <caption :class=\"captionHidden ? 'rk-table-caption-hidden' : 'rk-table-caption'\">\n {{\n caption\n }}\n </caption>\n\n <thead>\n <tr>\n <th\n v-for=\"column in columns\"\n :key=\"column.key\"\n scope=\"col\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n {{ column.label }}\n </th>\n </tr>\n </thead>\n\n <tbody v-if=\"rows.length > 0\">\n <tr v-for=\"(row, index) in rows\" :key=\"keyFor(row, index)\">\n <td\n v-for=\"column in columns\"\n :key=\"column.key\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n <slot :name=\"column.key\" :row=\"row\" :value=\"row[column.key]\">\n {{ row[column.key] }}\n </slot>\n </td>\n </tr>\n </tbody>\n\n <tbody v-else>\n <tr>\n <td :colspan=\"columns.length\" class=\"rk-table-empty\">\n <slot name=\"empty\" />\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n\n<style scoped>\n.rk-table-scroll {\n overflow-x: auto;\n}\n\n.rk-table-scroll:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n border-radius: var(--radius-cell);\n}\n\n.rk-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 0.875rem;\n}\n\n.rk-table-caption {\n padding-bottom: 0.75rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink-soft);\n}\n\n/* Off screen rather than `display: none`, which is not announced at all. */\n.rk-table-caption-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n.rk-table th {\n border-bottom: 1px solid var(--color-hair);\n padding: 0.625rem 0.75rem;\n text-align: left;\n font-weight: 500;\n color: var(--color-ink-soft);\n white-space: nowrap;\n}\n\n.rk-table td {\n border-bottom: 1px solid color-mix(in srgb, var(--color-hair) 50%, transparent);\n padding: 0.75rem;\n color: var(--color-ink);\n vertical-align: top;\n}\n\n.rk-table tbody tr:last-child td {\n border-bottom: 0;\n}\n\n/* Numbers line up on their last digit, which is the one being compared. */\n.is-end {\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\n\n.is-nowrap {\n white-space: nowrap;\n}\n\n.rk-table-empty {\n padding: 2rem 0.75rem;\n text-align: center;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"Row extends Record<string, unknown>\">\nexport interface Column<Row> {\n /** Key into the row, and the slot name for a custom cell. */\n key: string & keyof Row\n /** Column heading. Already translated. */\n label: string\n /** `end` for money and counts, which are read by their last digit. */\n align?: 'start' | 'end' | undefined\n /** Stops a column wrapping — dates, short codes. */\n nowrap?: boolean | undefined\n}\n\n/**\n * Rows of data, with the parts a hand-written `<table>` leaves out.\n *\n * ## The caption is required, and it is not a heading\n *\n * A table with no caption is announced as \"table\" and nothing else, so a screen\n * reader user landing in one has no idea what they are in. `captionHidden`\n * exists because the page usually already says it in a heading above — but the\n * table still has to carry its own name, because a heading is not attached to\n * anything.\n *\n * ## Scrolling belongs to the table, not the page\n *\n * A wide table inside a narrow column either overflows the page sideways —\n * which takes every other element with it — or is clipped. So the table sits in\n * its own scroller, and the scroller is focusable: a region you can only reach\n * by dragging is a region a keyboard cannot read at all. That is one line of\n * markup and it is the line everyone forgets.\n *\n * Headers carry `scope=\"col\"`, which is what lets a screen reader say the\n * column name before each cell instead of reading a wall of numbers.\n */\nconst {\n columns,\n rows,\n caption,\n captionHidden = false,\n rowKey,\n} = defineProps<{\n columns: readonly Column<Row>[]\n rows: readonly Row[]\n /** What this table is. Required — an unnamed table is a box of numbers. */\n caption: string\n /** Keeps the caption for assistive tech when the page already shows a heading. */\n captionHidden?: boolean | undefined\n /** Which field identifies a row. Falls back to the index. */\n rowKey?: (string & keyof Row) | undefined\n}>()\n\ndefineSlots<{\n /** Per-column cell override, named for the column key. */\n [key: string]: (props: { row: Row; value: unknown }) => unknown\n /** Shown instead of the body when there are no rows. */\n empty?: () => unknown\n}>()\n\nconst keyFor = (row: Row, index: number) => (rowKey ? String(row[rowKey]) : index)\n</script>\n\n<template>\n <div class=\"rk-table-scroll\" tabindex=\"0\" role=\"region\" :aria-label=\"caption\">\n <table class=\"rk-table\">\n <caption :class=\"captionHidden ? 'rk-table-caption-hidden' : 'rk-table-caption'\">\n {{\n caption\n }}\n </caption>\n\n <thead>\n <tr>\n <th\n v-for=\"column in columns\"\n :key=\"column.key\"\n scope=\"col\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n {{ column.label }}\n </th>\n </tr>\n </thead>\n\n <tbody v-if=\"rows.length > 0\">\n <tr v-for=\"(row, index) in rows\" :key=\"keyFor(row, index)\">\n <td\n v-for=\"column in columns\"\n :key=\"column.key\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n <slot :name=\"column.key\" :row=\"row\" :value=\"row[column.key]\">\n {{ row[column.key] }}\n </slot>\n </td>\n </tr>\n </tbody>\n\n <tbody v-else>\n <tr>\n <td :colspan=\"columns.length\" class=\"rk-table-empty\">\n <slot name=\"empty\" />\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n\n<style scoped>\n.rk-table-scroll {\n overflow-x: auto;\n}\n\n.rk-table-scroll:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n border-radius: var(--radius-cell);\n}\n\n.rk-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 0.875rem;\n}\n\n.rk-table-caption {\n padding-bottom: 0.75rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink-soft);\n}\n\n/* Off screen rather than `display: none`, which is not announced at all. */\n.rk-table-caption-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n.rk-table th {\n border-bottom: 1px solid var(--color-hair);\n padding: 0.625rem 0.75rem;\n text-align: left;\n font-weight: 500;\n color: var(--color-ink-soft);\n white-space: nowrap;\n}\n\n.rk-table td {\n border-bottom: 1px solid color-mix(in srgb, var(--color-hair) 50%, transparent);\n padding: 0.75rem;\n color: var(--color-ink);\n vertical-align: top;\n}\n\n.rk-table tbody tr:last-child td {\n border-bottom: 0;\n}\n\n/* Numbers line up on their last digit, which is the one being compared. */\n.is-end {\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\n\n.is-nowrap {\n white-space: nowrap;\n}\n\n.rk-table-empty {\n padding: 2rem 0.75rem;\n text-align: center;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useBoundValue } from '../composables/use-bound-value'\nimport FormField from './FormField.vue'\n\n/**\n * A multi-line field.\n *\n * `rows` rather than an auto-growing box: a textarea that resizes as it is\n * typed into moves everything below it, and in a form that means the button\n * the writer is heading for keeps sliding away. Growth is left to the browser's\n * own resize handle, which the writer controls.\n */\ndefineOptions({ inheritAttrs: false })\n\nconst {\n modelValue = undefined,\n label,\n error = '',\n hint = '',\n labelHidden = false,\n rows = 4,\n size = 'md',\n variant = 'default',\n} = defineProps<{\n /** The text, with `v-model`. */\n modelValue?: string | undefined\n label: string\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n rows?: number | undefined\n /**\n * `sm` tightens the label and the spacing. It does **not** shrink the text:\n * iOS zooms the viewport when it focuses a field under 16px and never zooms\n * back, which is why both phone apps force 16px on form elements in their\n * base layer.\n */\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/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <textarea\n :id=\"id\"\n v-model=\"model\"\n :rows=\"rows\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n v-bind=\"$attrs\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary resize-y px-3 py-2 leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-1',\n 'text-base',\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n />\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\">\nimport { useBoundValue } from '../composables/use-bound-value'\nimport FormField from './FormField.vue'\n\n/**\n * A multi-line field.\n *\n * `rows` rather than an auto-growing box: a textarea that resizes as it is\n * typed into moves everything below it, and in a form that means the button\n * the writer is heading for keeps sliding away. Growth is left to the browser's\n * own resize handle, which the writer controls.\n */\ndefineOptions({ inheritAttrs: false })\n\nconst {\n modelValue = undefined,\n label,\n error = '',\n hint = '',\n labelHidden = false,\n rows = 4,\n size = 'md',\n variant = 'default',\n} = defineProps<{\n /** The text, with `v-model`. */\n modelValue?: string | undefined\n label: string\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n rows?: number | undefined\n /**\n * `sm` tightens the label and the spacing. It does **not** shrink the text:\n * iOS zooms the viewport when it focuses a field under 16px and never zooms\n * back, which is why both phone apps force 16px on form elements in their\n * base layer.\n */\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/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <textarea\n :id=\"id\"\n v-model=\"model\"\n :rows=\"rows\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n v-bind=\"$attrs\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary resize-y px-3 py-2 leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-1',\n 'text-base',\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n />\n </template>\n </FormField>\n</template>\n","<script lang=\"ts\" setup>\n/**\n * A list with nothing in it yet, said kindly.\n *\n * A blank area reads as a page that failed to load, and the reader's first\n * thought is that something is broken rather than that they have not started.\n * So there is always a sentence, and the slot below it is where the way out\n * goes — the button that creates the first one.\n */\nconst { title, description = '' } = defineProps<{\n title: string\n description?: string | undefined\n}>()\n</script>\n\n<template>\n <div class=\"flex flex-col items-center gap-3 px-6 py-10 text-center\">\n <div\n v-if=\"$slots.icon\"\n class=\"bg-muted text-primary rounded-card flex size-12 items-center justify-center\"\n >\n <slot name=\"icon\" />\n </div>\n\n <h3 class=\"text-ink text-base font-semibold\">{{ title }}</h3>\n <p v-if=\"description\" class=\"text-ink-soft max-w-[36ch] text-sm\">\n {{ description }}\n </p>\n\n <div v-if=\"$slots.action\" class=\"mt-2 flex w-full flex-col gap-2\">\n <slot name=\"action\" />\n </div>\n </div>\n</template>\n\n<style></style>\n","<script lang=\"ts\" setup>\n/**\n * A list with nothing in it yet, said kindly.\n *\n * A blank area reads as a page that failed to load, and the reader's first\n * thought is that something is broken rather than that they have not started.\n * So there is always a sentence, and the slot below it is where the way out\n * goes — the button that creates the first one.\n */\nconst { title, description = '' } = defineProps<{\n title: string\n description?: string | undefined\n}>()\n</script>\n\n<template>\n <div class=\"flex flex-col items-center gap-3 px-6 py-10 text-center\">\n <div\n v-if=\"$slots.icon\"\n class=\"bg-muted text-primary rounded-card flex size-12 items-center justify-center\"\n >\n <slot name=\"icon\" />\n </div>\n\n <h3 class=\"text-ink text-base font-semibold\">{{ title }}</h3>\n <p v-if=\"description\" class=\"text-ink-soft max-w-[36ch] text-sm\">\n {{ description }}\n </p>\n\n <div v-if=\"$slots.action\" class=\"mt-2 flex w-full flex-col gap-2\">\n <slot name=\"action\" />\n </div>\n </div>\n</template>\n\n<style></style>\n","<script setup lang=\"ts\">\nimport { onErrorCaptured, ref, watch } from 'vue'\n\n/**\n * Keeps one broken screen from taking the whole app down.\n *\n * An error thrown while a component renders unmounts the tree above it, and a\n * single-page app has nothing underneath — the tab goes white and whoever was\n * using it loses what they were in the middle of.\n *\n * What it does *not* do is decide what that looks like. All three apps in this\n * workshop had written this component, and the parts they had in common were\n * the mechanism — catch, report, reset when the route changes — while the\n * parts that differed were the ones that should: an icon, a sentence, a way\n * back. So the fallback is a slot, and the kit stays out of the wording.\n *\n * Only errors thrown while rendering a descendant reach `onErrorCaptured`.\n * Rejected promises and failed queries do not, and should not: those belong to\n * the code that owns the request.\n *\n * @example\n * ```vue\n * <ErrorBoundary :resetKey=\"route.fullPath\" @error=\"reportError\">\n * <template #fallback=\"{ reset }\">\n * <EmptyState :title=\"t('error.title')\">\n * <BaseButton @click=\"reset\">{{ t('error.retry') }}</BaseButton>\n * </EmptyState>\n * </template>\n * <RouterView />\n * </ErrorBoundary>\n * ```\n */\nconst { resetKey } = defineProps<{\n /**\n * Clears the error whenever it changes — a route path, usually.\n *\n * An error on one screen should not follow somebody to the next one, and\n * without this the boundary stays broken until a full reload.\n */\n resetKey?: string | number | undefined\n}>()\n\nconst emit = defineEmits<{ error: [cause: unknown] }>()\n\nconst failed = ref<unknown>(null)\n\nfunction reset() {\n failed.value = null\n}\n\nonErrorCaptured((cause) => {\n failed.value = cause\n emit('error', cause)\n\n // Swallowed on purpose: the fallback is now showing, and letting it travel\n // further up would unmount the boundary along with everything else.\n return false\n})\n\nwatch(\n () => resetKey,\n () => reset(),\n)\n</script>\n\n<template>\n <slot v-if=\"failed\" name=\"fallback\" :error=\"failed\" :reset=\"reset\" />\n <slot v-else />\n</template>\n","<script setup lang=\"ts\">\nimport { onErrorCaptured, ref, watch } from 'vue'\n\n/**\n * Keeps one broken screen from taking the whole app down.\n *\n * An error thrown while a component renders unmounts the tree above it, and a\n * single-page app has nothing underneath — the tab goes white and whoever was\n * using it loses what they were in the middle of.\n *\n * What it does *not* do is decide what that looks like. All three apps in this\n * workshop had written this component, and the parts they had in common were\n * the mechanism — catch, report, reset when the route changes — while the\n * parts that differed were the ones that should: an icon, a sentence, a way\n * back. So the fallback is a slot, and the kit stays out of the wording.\n *\n * Only errors thrown while rendering a descendant reach `onErrorCaptured`.\n * Rejected promises and failed queries do not, and should not: those belong to\n * the code that owns the request.\n *\n * @example\n * ```vue\n * <ErrorBoundary :resetKey=\"route.fullPath\" @error=\"reportError\">\n * <template #fallback=\"{ reset }\">\n * <EmptyState :title=\"t('error.title')\">\n * <BaseButton @click=\"reset\">{{ t('error.retry') }}</BaseButton>\n * </EmptyState>\n * </template>\n * <RouterView />\n * </ErrorBoundary>\n * ```\n */\nconst { resetKey } = defineProps<{\n /**\n * Clears the error whenever it changes — a route path, usually.\n *\n * An error on one screen should not follow somebody to the next one, and\n * without this the boundary stays broken until a full reload.\n */\n resetKey?: string | number | undefined\n}>()\n\nconst emit = defineEmits<{ error: [cause: unknown] }>()\n\nconst failed = ref<unknown>(null)\n\nfunction reset() {\n failed.value = null\n}\n\nonErrorCaptured((cause) => {\n failed.value = cause\n emit('error', cause)\n\n // Swallowed on purpose: the fallback is now showing, and letting it travel\n // further up would unmount the boundary along with everything else.\n return false\n})\n\nwatch(\n () => resetKey,\n () => reset(),\n)\n</script>\n\n<template>\n <slot v-if=\"failed\" name=\"fallback\" :error=\"failed\" :reset=\"reset\" />\n <slot v-else />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One measure, centred, with the page's gutters.\n *\n * The first thing a desktop app needs and the last thing a kit built for\n * phones thinks to provide — a 430 px shell has no use for a maximum width, so\n * this was missing, and the consuming app wrote `max-w-[1200px] mx-auto px-6`\n * into every layout instead. Written once it costs nothing; written eleven\n * times it is eleven chances for one page to be forty pixels narrower than the\n * rest, which is the kind of thing nobody can name and everybody can see.\n *\n * Two widths rather than one, because a page and a passage are different\n * problems: `wide` is the page, `reading` is a column of prose at the width\n * type wants to be read at. Both come from tokens, so an app that measures its\n * page at 1120 rather than 1200 can still use this.\n */\nconst { width = 'wide', as = 'div' } = defineProps<{\n /** `wide` for a page, `reading` for prose, `full` to opt out. */\n width?: 'wide' | 'reading' | 'full' | undefined\n /** The element to render. `main`, `section` and `article` all belong here. */\n as?: string | undefined\n}>()\n\n/**\n * From tokens, not from literals.\n *\n * A width is a role the same way a colour is, and baking one in makes the\n * component unusable by any app that measured its own page differently — which\n * the first consumer had, deliberately. Override `--measure-page` and\n * `--measure-reading` in the app's `@theme` and every container follows.\n */\nconst WIDTHS = {\n wide: 'var(--measure-page)',\n reading: 'var(--measure-reading)',\n full: 'none',\n} as const\n\nconst measure = computed(() => WIDTHS[width])\n</script>\n\n<template>\n <component :is=\"as\" class=\"mx-auto w-full px-5 sm:px-8\" :style=\"{ maxWidth: measure }\">\n <slot />\n </component>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One measure, centred, with the page's gutters.\n *\n * The first thing a desktop app needs and the last thing a kit built for\n * phones thinks to provide — a 430 px shell has no use for a maximum width, so\n * this was missing, and the consuming app wrote `max-w-[1200px] mx-auto px-6`\n * into every layout instead. Written once it costs nothing; written eleven\n * times it is eleven chances for one page to be forty pixels narrower than the\n * rest, which is the kind of thing nobody can name and everybody can see.\n *\n * Two widths rather than one, because a page and a passage are different\n * problems: `wide` is the page, `reading` is a column of prose at the width\n * type wants to be read at. Both come from tokens, so an app that measures its\n * page at 1120 rather than 1200 can still use this.\n */\nconst { width = 'wide', as = 'div' } = defineProps<{\n /** `wide` for a page, `reading` for prose, `full` to opt out. */\n width?: 'wide' | 'reading' | 'full' | undefined\n /** The element to render. `main`, `section` and `article` all belong here. */\n as?: string | undefined\n}>()\n\n/**\n * From tokens, not from literals.\n *\n * A width is a role the same way a colour is, and baking one in makes the\n * component unusable by any app that measured its own page differently — which\n * the first consumer had, deliberately. Override `--measure-page` and\n * `--measure-reading` in the app's `@theme` and every container follows.\n */\nconst WIDTHS = {\n wide: 'var(--measure-page)',\n reading: 'var(--measure-reading)',\n full: 'none',\n} as const\n\nconst measure = computed(() => WIDTHS[width])\n</script>\n\n<template>\n <component :is=\"as\" class=\"mx-auto w-full px-5 sm:px-8\" :style=\"{ maxWidth: measure }\">\n <slot />\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The bar at the top of a screen: a title with room either side of it.\n *\n * Three fixed columns rather than a flex row, so the title is centred on the\n * screen rather than centred on what is left after the buttons. A back arrow on\n * one side and nothing on the other would otherwise push every title off centre\n * by exactly half a button, which is visible the moment two screens sit next to\n * each other.\n */\nconst { title } = defineProps<{ title: string }>()\n</script>\n\n<template>\n <header class=\"grid h-12 shrink-0 grid-cols-[2.5rem_1fr_2.5rem] items-center\">\n <div class=\"justify-self-start\"><slot name=\"left\" /></div>\n\n <h1 class=\"text-ink flex min-w-0 justify-center text-base font-semibold tabular-nums\">\n <slot name=\"title\">\n <span class=\"truncate\">{{ title }}</span>\n </slot>\n </h1>\n\n <div class=\"justify-self-end\"><slot name=\"right\" /></div>\n </header>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The bar at the top of a screen: a title with room either side of it.\n *\n * Three fixed columns rather than a flex row, so the title is centred on the\n * screen rather than centred on what is left after the buttons. A back arrow on\n * one side and nothing on the other would otherwise push every title off centre\n * by exactly half a button, which is visible the moment two screens sit next to\n * each other.\n */\nconst { title } = defineProps<{ title: string }>()\n</script>\n\n<template>\n <header class=\"grid h-12 shrink-0 grid-cols-[2.5rem_1fr_2.5rem] items-center\">\n <div class=\"justify-self-start\"><slot name=\"left\" /></div>\n\n <h1 class=\"text-ink flex min-w-0 justify-center text-base font-semibold tabular-nums\">\n <slot name=\"title\">\n <span class=\"truncate\">{{ title }}</span>\n </slot>\n </h1>\n\n <div class=\"justify-self-end\"><slot name=\"right\" /></div>\n </header>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * How far through something somebody is.\n *\n * Clamped rather than trusted. A progress bar is always fed a computed number,\n * and computed numbers arrive as 101, as -0, and as NaN when the denominator\n * is zero — which is the ordinary state of a course nobody has started. Any of\n * those renders a bar that runs past its own track, and it is the sort of\n * thing that ships because the happy path was the only one anybody looked at.\n */\nconst {\n value,\n max = 100,\n label,\n size = 'md',\n} = defineProps<{\n value: number\n max?: number | undefined\n /**\n * How thick the track is. `sm` for a bar under a step counter, where it is a\n * hint rather than the subject; `lg` where the progress is the point.\n *\n * It shipped at one thickness and the two bars anybody wanted were `h-1`.\n */\n size?: 'sm' | 'md' | 'lg' | undefined\n /** For screen readers. Without it this is a rectangle that means nothing. */\n label?: string | undefined\n}>()\n\nconst TRACK = {\n sm: 'h-1',\n md: 'h-1.5',\n lg: 'h-2',\n} as const\n\nconst portion = computed(() => {\n if (!Number.isFinite(value) || !Number.isFinite(max) || max <= 0) return 0\n\n return Math.min(100, Math.max(0, (value / max) * 100))\n})\n</script>\n\n<template>\n <div\n class=\"bg-muted w-full overflow-hidden rounded-full\"\n :class=\"TRACK[size]\"\n role=\"progressbar\"\n :aria-valuenow=\"Math.round(portion)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-label=\"label\"\n >\n <div\n class=\"bg-primary h-full rounded-full transition-[width] duration-700 ease-out\"\n :style=\"{ width: `${portion}%` }\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * How far through something somebody is.\n *\n * Clamped rather than trusted. A progress bar is always fed a computed number,\n * and computed numbers arrive as 101, as -0, and as NaN when the denominator\n * is zero — which is the ordinary state of a course nobody has started. Any of\n * those renders a bar that runs past its own track, and it is the sort of\n * thing that ships because the happy path was the only one anybody looked at.\n */\nconst {\n value,\n max = 100,\n label,\n size = 'md',\n} = defineProps<{\n value: number\n max?: number | undefined\n /**\n * How thick the track is. `sm` for a bar under a step counter, where it is a\n * hint rather than the subject; `lg` where the progress is the point.\n *\n * It shipped at one thickness and the two bars anybody wanted were `h-1`.\n */\n size?: 'sm' | 'md' | 'lg' | undefined\n /** For screen readers. Without it this is a rectangle that means nothing. */\n label?: string | undefined\n}>()\n\nconst TRACK = {\n sm: 'h-1',\n md: 'h-1.5',\n lg: 'h-2',\n} as const\n\nconst portion = computed(() => {\n if (!Number.isFinite(value) || !Number.isFinite(max) || max <= 0) return 0\n\n return Math.min(100, Math.max(0, (value / max) * 100))\n})\n</script>\n\n<template>\n <div\n class=\"bg-muted w-full overflow-hidden rounded-full\"\n :class=\"TRACK[size]\"\n role=\"progressbar\"\n :aria-valuenow=\"Math.round(portion)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-label=\"label\"\n >\n <div\n class=\"bg-primary h-full rounded-full transition-[width] duration-700 ease-out\"\n :style=\"{ width: `${portion}%` }\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One plan in a pricing table.\n *\n * Every string arrives as a prop. A component in a kit that reaches for its\n * consumer's translations is not shared, it is one app's furniture parked\n * somewhere else — and the second app to want it would have to fork it.\n *\n * The tone is semantic rather than named after a colour. \"Gold\" and \"diamond\"\n * are one product's tiers; `warm` and `cool` are what a pricing table actually\n * needs, which is for three columns to be distinguishable at a glance without\n * any of them shouting. A table where every column is a different hue reads as\n * three products from three companies.\n */\nconst {\n name,\n lead,\n price,\n period,\n note,\n features,\n tone = 'neutral',\n badge,\n chip,\n recommended = false,\n} = defineProps<{\n name: string\n lead?: string | undefined\n /** Already formatted, or whatever stands in while there is no price. */\n price: string\n period?: string | undefined\n note?: string | undefined\n features: readonly string[]\n tone?: 'neutral' | 'warm' | 'cool' | undefined\n /** Rides on the card's edge, e.g. \"Recommended\". */\n badge?: string | undefined\n /** Sits inside, e.g. \"30% cheaper\" or \"Your plan\". */\n chip?: string | undefined\n /** Raises the card and lets the badge show. */\n recommended?: boolean | undefined\n}>()\n\n/* Roles, not hex values. This used to carry `#b8862c` and `#4a86a8` with\n hand-picked darker shades for text, which is the one thing the kit's rules\n forbid: a colour in a component cannot follow a palette, so a pricing table\n stayed amber and blue whatever the app had rebranded to.\n\n The ring is handed to the surface as a variable rather than set as a\n `border-color` class. The surface draws its own border, and two utilities\n setting the same property would be decided by stylesheet order. */\nconst TONE = {\n neutral: {\n ring: '',\n soft: 'bg-muted text-ink-soft',\n icon: 'bg-primary/10 text-primary',\n },\n warm: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-warning)_40%,transparent)]',\n soft: 'bg-warning/15 text-ink',\n icon: 'bg-warning/15 text-warning',\n },\n cool: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-accent)_38%,transparent)]',\n soft: 'bg-accent/12 text-ink',\n icon: 'bg-accent/12 text-accent',\n },\n} as const\n\nconst palette = computed(() => TONE[tone])\n</script>\n\n<template>\n <article\n class=\"surface rounded-card ease-standard relative flex h-full flex-col p-7 transition-[border-color,box-shadow,transform] duration-(--duration-slower) hover:[--surface-border-color:color-mix(in_oklab,var(--color-primary)_60%,transparent)] hover:[--surface-shadow:var(--shadow-raised)] sm:p-8\"\n :class=\"[\n palette.ring,\n recommended ? '[--surface-shadow:var(--shadow-raised)]' : 'hover:-translate-y-0.5',\n ]\"\n >\n <!-- On the edge rather than inside, so it cannot be mistaken for one of\n the plan's own features. -->\n <span\n v-if=\"badge && recommended\"\n class=\"bg-primary rounded-cell text-on-primary absolute -top-3 left-7 px-3 py-1 text-[0.7rem] font-semibold\"\n >\n {{ badge }}\n </span>\n\n <div class=\"flex items-start justify-between gap-4\">\n <span\n v-if=\"$slots.icon\"\n class=\"rounded-card grid size-11 place-items-center text-xl\"\n :class=\"palette.icon\"\n >\n <slot name=\"icon\" />\n </span>\n\n <span\n v-if=\"chip\"\n class=\"rounded-cell ml-auto px-2.5 py-1 text-[0.7rem] font-medium\"\n :class=\"palette.soft\"\n >\n {{ chip }}\n </span>\n </div>\n\n <h3 class=\"text-ink mt-5 text-lg font-semibold\">{{ name }}</h3>\n <p v-if=\"lead\" class=\"text-ink-soft mt-1.5 text-sm leading-relaxed\">{{ lead }}</p>\n\n <p class=\"mt-6 flex items-baseline gap-1.5\">\n <span class=\"text-ink text-3xl font-semibold tracking-tight tabular-nums\">{{ price }}</span>\n <span v-if=\"period\" class=\"text-ink-soft text-sm\">{{ period }}</span>\n </p>\n <p v-if=\"note\" class=\"text-ink-soft mt-1 text-xs\">{{ note }}</p>\n\n <ul class=\"mt-7 flex-1 space-y-3\">\n <li v-for=\"feature in features\" :key=\"feature\" class=\"flex gap-3 text-sm\">\n <!-- The marker is a slot because a pricing table often uses it to say\n something the tone cannot: on the tier you already have, these are\n things you hold rather than things you would get. A consumer that\n had drawn that distinction should not have to give it up to reach\n for this component. -->\n <span v-if=\"$slots.bullet\" class=\"mt-[0.45rem] shrink-0\"><slot name=\"bullet\" /></span>\n <span\n v-else\n class=\"bg-primary/45 mt-[0.45rem] size-1.5 shrink-0 rounded-full\"\n aria-hidden=\"true\"\n />\n <span class=\"text-ink-soft leading-relaxed\">{{ feature }}</span>\n </li>\n </ul>\n\n <div v-if=\"$slots.action\" class=\"mt-8\"><slot name=\"action\" /></div>\n </article>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One plan in a pricing table.\n *\n * Every string arrives as a prop. A component in a kit that reaches for its\n * consumer's translations is not shared, it is one app's furniture parked\n * somewhere else — and the second app to want it would have to fork it.\n *\n * The tone is semantic rather than named after a colour. \"Gold\" and \"diamond\"\n * are one product's tiers; `warm` and `cool` are what a pricing table actually\n * needs, which is for three columns to be distinguishable at a glance without\n * any of them shouting. A table where every column is a different hue reads as\n * three products from three companies.\n */\nconst {\n name,\n lead,\n price,\n period,\n note,\n features,\n tone = 'neutral',\n badge,\n chip,\n recommended = false,\n} = defineProps<{\n name: string\n lead?: string | undefined\n /** Already formatted, or whatever stands in while there is no price. */\n price: string\n period?: string | undefined\n note?: string | undefined\n features: readonly string[]\n tone?: 'neutral' | 'warm' | 'cool' | undefined\n /** Rides on the card's edge, e.g. \"Recommended\". */\n badge?: string | undefined\n /** Sits inside, e.g. \"30% cheaper\" or \"Your plan\". */\n chip?: string | undefined\n /** Raises the card and lets the badge show. */\n recommended?: boolean | undefined\n}>()\n\n/* Roles, not hex values. This used to carry `#b8862c` and `#4a86a8` with\n hand-picked darker shades for text, which is the one thing the kit's rules\n forbid: a colour in a component cannot follow a palette, so a pricing table\n stayed amber and blue whatever the app had rebranded to.\n\n The ring is handed to the surface as a variable rather than set as a\n `border-color` class. The surface draws its own border, and two utilities\n setting the same property would be decided by stylesheet order. */\nconst TONE = {\n neutral: {\n ring: '',\n soft: 'bg-muted text-ink-soft',\n icon: 'bg-primary/10 text-primary',\n },\n warm: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-warning)_40%,transparent)]',\n soft: 'bg-warning/15 text-ink',\n icon: 'bg-warning/15 text-warning',\n },\n cool: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-accent)_38%,transparent)]',\n soft: 'bg-accent/12 text-ink',\n icon: 'bg-accent/12 text-accent',\n },\n} as const\n\nconst palette = computed(() => TONE[tone])\n</script>\n\n<template>\n <article\n class=\"surface rounded-card ease-standard relative flex h-full flex-col p-7 transition-[border-color,box-shadow,transform] duration-(--duration-slower) hover:[--surface-border-color:color-mix(in_oklab,var(--color-primary)_60%,transparent)] hover:[--surface-shadow:var(--shadow-raised)] sm:p-8\"\n :class=\"[\n palette.ring,\n recommended ? '[--surface-shadow:var(--shadow-raised)]' : 'hover:-translate-y-0.5',\n ]\"\n >\n <!-- On the edge rather than inside, so it cannot be mistaken for one of\n the plan's own features. -->\n <span\n v-if=\"badge && recommended\"\n class=\"bg-primary rounded-cell text-on-primary absolute -top-3 left-7 px-3 py-1 text-[0.7rem] font-semibold\"\n >\n {{ badge }}\n </span>\n\n <div class=\"flex items-start justify-between gap-4\">\n <span\n v-if=\"$slots.icon\"\n class=\"rounded-card grid size-11 place-items-center text-xl\"\n :class=\"palette.icon\"\n >\n <slot name=\"icon\" />\n </span>\n\n <span\n v-if=\"chip\"\n class=\"rounded-cell ml-auto px-2.5 py-1 text-[0.7rem] font-medium\"\n :class=\"palette.soft\"\n >\n {{ chip }}\n </span>\n </div>\n\n <h3 class=\"text-ink mt-5 text-lg font-semibold\">{{ name }}</h3>\n <p v-if=\"lead\" class=\"text-ink-soft mt-1.5 text-sm leading-relaxed\">{{ lead }}</p>\n\n <p class=\"mt-6 flex items-baseline gap-1.5\">\n <span class=\"text-ink text-3xl font-semibold tracking-tight tabular-nums\">{{ price }}</span>\n <span v-if=\"period\" class=\"text-ink-soft text-sm\">{{ period }}</span>\n </p>\n <p v-if=\"note\" class=\"text-ink-soft mt-1 text-xs\">{{ note }}</p>\n\n <ul class=\"mt-7 flex-1 space-y-3\">\n <li v-for=\"feature in features\" :key=\"feature\" class=\"flex gap-3 text-sm\">\n <!-- The marker is a slot because a pricing table often uses it to say\n something the tone cannot: on the tier you already have, these are\n things you hold rather than things you would get. A consumer that\n had drawn that distinction should not have to give it up to reach\n for this component. -->\n <span v-if=\"$slots.bullet\" class=\"mt-[0.45rem] shrink-0\"><slot name=\"bullet\" /></span>\n <span\n v-else\n class=\"bg-primary/45 mt-[0.45rem] size-1.5 shrink-0 rounded-full\"\n aria-hidden=\"true\"\n />\n <span class=\"text-ink-soft leading-relaxed\">{{ feature }}</span>\n </li>\n </ul>\n\n <div v-if=\"$slots.action\" class=\"mt-8\"><slot name=\"action\" /></div>\n </article>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A small coloured dot, optionally labelled.\n *\n * Takes the colour as a class rather than a category, so an app can key it off\n * whatever its own domain calls a category — habit kinds, expense types,\n * priorities — without this component knowing about any of them.\n */\nconst { fill, label = '' } = defineProps<{\n /** Background utility for the dot, e.g. `bg-positive`. */\n fill: string\n /** Optional text after the dot. Omit for a bare marker. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <span class=\"inline-flex items-center gap-1.5\">\n <span class=\"size-2 rounded-full\" :class=\"fill\" />\n <span v-if=\"label\" class=\"text-ink-soft text-xs font-medium\">{{ label }}</span>\n </span>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A small coloured dot, optionally labelled.\n *\n * Takes the colour as a class rather than a category, so an app can key it off\n * whatever its own domain calls a category — habit kinds, expense types,\n * priorities — without this component knowing about any of them.\n */\nconst { fill, label = '' } = defineProps<{\n /** Background utility for the dot, e.g. `bg-positive`. */\n fill: string\n /** Optional text after the dot. Omit for a bare marker. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <span class=\"inline-flex items-center gap-1.5\">\n <span class=\"size-2 rounded-full\" :class=\"fill\" />\n <span v-if=\"label\" class=\"text-ink-soft text-xs font-medium\">{{ label }}</span>\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport ToneDot from './ToneDot.vue'\n\n/** The three classes a category needs to colour a heading. */\nexport interface Tone {\n /** Solid background for the dot, e.g. `bg-positive`. */\n fill: string\n /** Tinted surface for the pill, e.g. `bg-positive/5 border-positive/25`. */\n card: string\n /** Foreground that pairs with the surface, e.g. `text-positive`. */\n text: string\n}\n\n/**\n * A pill heading for a group of things.\n *\n * The tone arrives as three class strings rather than a category name: Tailwind\n * reads source files as plain text, so a class assembled at runtime never\n * reaches the stylesheet — the app has to write them out, and it is the app\n * that knows its own categories anyway.\n */\nconst {\n tone,\n label,\n count = 0,\n} = defineProps<{\n tone: Tone\n label: string\n /** Hidden when zero, so an empty group's heading stays quiet. */\n count?: number | undefined\n}>()\n</script>\n\n<template>\n <h2\n class=\"flex w-fit items-center gap-2 self-start rounded-full border px-3 py-1\"\n :class=\"tone.card\"\n >\n <ToneDot :fill=\"tone.fill\" />\n <span class=\"text-xs font-semibold tracking-wide uppercase\" :class=\"tone.text\">\n {{ label }}\n </span>\n <span v-if=\"count > 0\" class=\"text-ink-soft text-xs tabular-nums\">{{ count }}</span>\n </h2>\n</template>\n","<script setup lang=\"ts\">\nimport ToneDot from './ToneDot.vue'\n\n/** The three classes a category needs to colour a heading. */\nexport interface Tone {\n /** Solid background for the dot, e.g. `bg-positive`. */\n fill: string\n /** Tinted surface for the pill, e.g. `bg-positive/5 border-positive/25`. */\n card: string\n /** Foreground that pairs with the surface, e.g. `text-positive`. */\n text: string\n}\n\n/**\n * A pill heading for a group of things.\n *\n * The tone arrives as three class strings rather than a category name: Tailwind\n * reads source files as plain text, so a class assembled at runtime never\n * reaches the stylesheet — the app has to write them out, and it is the app\n * that knows its own categories anyway.\n */\nconst {\n tone,\n label,\n count = 0,\n} = defineProps<{\n tone: Tone\n label: string\n /** Hidden when zero, so an empty group's heading stays quiet. */\n count?: number | undefined\n}>()\n</script>\n\n<template>\n <h2\n class=\"flex w-fit items-center gap-2 self-start rounded-full border px-3 py-1\"\n :class=\"tone.card\"\n >\n <ToneDot :fill=\"tone.fill\" />\n <span class=\"text-xs font-semibold tracking-wide uppercase\" :class=\"tone.text\">\n {{ label }}\n </span>\n <span v-if=\"count > 0\" class=\"text-ink-soft text-xs tabular-nums\">{{ count }}</span>\n </h2>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { useId } from 'vue'\n\n/**\n * A row of mutually exclusive choices.\n *\n * Radio inputs rather than buttons: it is a single choice out of a small set,\n * so arrow-key navigation and the \"one of N selected\" announcement come free.\n */\nconst { options } = defineProps<{\n options: readonly { value: T; label: string }[]\n}>()\n\nconst model = defineModel<T>({ required: true })\n\nconst name = useId()\n</script>\n\n<template>\n <div class=\"bg-muted rounded-card flex w-full gap-1 p-1\">\n <label v-for=\"option in options\" :key=\"String(option.value)\" class=\"flex-1 cursor-pointer\">\n <input v-model=\"model\" type=\"radio\" :value=\"option.value\" :name=\"name\" class=\"peer sr-only\" />\n <span\n class=\"peer-focus-visible:outline-primary flex h-10 items-center justify-center rounded-xl px-2 text-sm font-medium transition-colors select-none peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2\"\n :class=\"\n model === option.value ? 'bg-surface text-ink shadow-(--shadow-control)' : 'text-ink-soft'\n \"\n >\n {{ option.label }}\n </span>\n </label>\n </div>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { useId } from 'vue'\n\n/**\n * A row of mutually exclusive choices.\n *\n * Radio inputs rather than buttons: it is a single choice out of a small set,\n * so arrow-key navigation and the \"one of N selected\" announcement come free.\n */\nconst { options } = defineProps<{\n options: readonly { value: T; label: string }[]\n}>()\n\nconst model = defineModel<T>({ required: true })\n\nconst name = useId()\n</script>\n\n<template>\n <div class=\"bg-muted rounded-card flex w-full gap-1 p-1\">\n <label v-for=\"option in options\" :key=\"String(option.value)\" class=\"flex-1 cursor-pointer\">\n <input v-model=\"model\" type=\"radio\" :value=\"option.value\" :name=\"name\" class=\"peer sr-only\" />\n <span\n class=\"peer-focus-visible:outline-primary flex h-10 items-center justify-center rounded-xl px-2 text-sm font-medium transition-colors select-none peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2\"\n :class=\"\n model === option.value ? 'bg-surface text-ink shadow-(--shadow-control)' : 'text-ink-soft'\n \"\n >\n {{ option.label }}\n </span>\n </label>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nconst {\n rows = 3,\n rowHeight = 'h-14',\n label = 'Loading…',\n} = defineProps<{\n rows?: number | undefined\n /**\n * How tall each row is, as either a utility class (`h-20`) or a CSS length\n * (`5rem`, `72px`, `var(--row)`).\n *\n * Both are accepted because the class-only version failed silently: a length\n * passed here landed in `class` as `5rem`, which is not a class, so the rows\n * had no height and the placeholder rendered as nothing at all. A loading\n * state that shows an empty page is worse than no loading state, because it\n * looks like the page is finished and empty.\n */\n rowHeight?: string | undefined\n label?: string | undefined\n}>()\n\n/** A length starts with a digit, a dot, or opens a CSS function. */\nconst isLength = computed(() => /^(?:[.\\d]|calc\\(|var\\(|clamp\\(|min\\(|max\\()/.test(rowHeight))\n</script>\n\n<template>\n <div role=\"status\" class=\"flex flex-col gap-1\">\n <span class=\"sr-only\">{{ label }}</span>\n\n <div\n v-for=\"row in rows\"\n :key=\"row\"\n class=\"bg-muted rounded-card animate-pulse\"\n :class=\"isLength ? undefined : rowHeight\"\n :style=\"isLength ? { height: rowHeight } : undefined\"\n aria-hidden=\"true\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nconst {\n rows = 3,\n rowHeight = 'h-14',\n label = 'Loading…',\n} = defineProps<{\n rows?: number | undefined\n /**\n * How tall each row is, as either a utility class (`h-20`) or a CSS length\n * (`5rem`, `72px`, `var(--row)`).\n *\n * Both are accepted because the class-only version failed silently: a length\n * passed here landed in `class` as `5rem`, which is not a class, so the rows\n * had no height and the placeholder rendered as nothing at all. A loading\n * state that shows an empty page is worse than no loading state, because it\n * looks like the page is finished and empty.\n */\n rowHeight?: string | undefined\n label?: string | undefined\n}>()\n\n/** A length starts with a digit, a dot, or opens a CSS function. */\nconst isLength = computed(() => /^(?:[.\\d]|calc\\(|var\\(|clamp\\(|min\\(|max\\()/.test(rowHeight))\n</script>\n\n<template>\n <div role=\"status\" class=\"flex flex-col gap-1\">\n <span class=\"sr-only\">{{ label }}</span>\n\n <div\n v-for=\"row in rows\"\n :key=\"row\"\n class=\"bg-muted rounded-card animate-pulse\"\n :class=\"isLength ? undefined : rowHeight\"\n :style=\"isLength ? { height: rowHeight } : undefined\"\n aria-hidden=\"true\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ArrowDown, ArrowRight, ArrowUp } from 'lucide-vue-next'\n\n/**\n * One number, with what it means and which way it is going.\n *\n * The trend is an arrow and a colour, and neither is allowed to be the whole\n * message: the direction is also in the arrow's shape, so it survives a reader\n * who cannot separate the kit's positive and negative hues. `null` is a real\n * state rather than a missing one — a figure with no comparison yet is not a\n * flat figure.\n */\nconst {\n value,\n label,\n trend = null,\n} = defineProps<{\n value: string\n label: string\n trend?: 'up' | 'down' | 'flat' | null | undefined\n}>()\n\nconst TREND_ICON = { up: ArrowUp, down: ArrowDown, flat: ArrowRight } as const\n</script>\n\n<template>\n <div class=\"surface rounded-card flex flex-1 flex-col gap-0.5 p-3\">\n <div class=\"flex items-baseline gap-1\">\n <span class=\"text-ink text-xl font-semibold tabular-nums\">{{ value }}</span>\n <component :is=\"TREND_ICON[trend]\" v-if=\"trend\" class=\"text-ink-soft size-3\" />\n </div>\n <span class=\"text-ink-soft text-xs\">{{ label }}</span>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ArrowDown, ArrowRight, ArrowUp } from 'lucide-vue-next'\n\n/**\n * One number, with what it means and which way it is going.\n *\n * The trend is an arrow and a colour, and neither is allowed to be the whole\n * message: the direction is also in the arrow's shape, so it survives a reader\n * who cannot separate the kit's positive and negative hues. `null` is a real\n * state rather than a missing one — a figure with no comparison yet is not a\n * flat figure.\n */\nconst {\n value,\n label,\n trend = null,\n} = defineProps<{\n value: string\n label: string\n trend?: 'up' | 'down' | 'flat' | null | undefined\n}>()\n\nconst TREND_ICON = { up: ArrowUp, down: ArrowDown, flat: ArrowRight } as const\n</script>\n\n<template>\n <div class=\"surface rounded-card flex flex-1 flex-col gap-0.5 p-3\">\n <div class=\"flex items-baseline gap-1\">\n <span class=\"text-ink text-xl font-semibold tabular-nums\">{{ value }}</span>\n <component :is=\"TREND_ICON[trend]\" v-if=\"trend\" class=\"text-ink-soft size-3\" />\n </div>\n <span class=\"text-ink-soft text-xs\">{{ label }}</span>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted, ref } from 'vue'\nimport { CheckCircle2, Info, TriangleAlert, X, XCircle } from 'lucide-vue-next'\n\nimport BaseButton from './BaseButton.vue'\nimport { useToast } from '../composables/use-toast'\nimport type { ToastTone } from '../composables/use-toast'\n\n/**\n * Where the toasts land. One of these, at the app root.\n *\n * @example\n * ```vue\n * <!-- App.vue -->\n * <ToastHost :close-label=\"$t('common.close')\" />\n * ```\n */\nconst { closeLabel, bottom = false } = defineProps<{\n /**\n * The accessible name of each dismiss button. Required, because the button\n * is an X and an X has no name — and the kit does not know the language.\n */\n closeLabel: string\n /**\n * Stack from the bottom instead of the top. For a phone shell, where the top\n * is a status bar and a header and the thumb is nowhere near it.\n */\n bottom?: boolean | undefined\n}>()\n\nconst { toasts, dismiss, pause, resume } = useToast()\n\n/* Dismissed first, so a handler that throws cannot leave the button on\n screen to be pressed twice. */\nfunction runAction(id: number, onClick: () => void) {\n dismiss(id)\n onClick()\n}\n\n/**\n * Teleport needs a `body`, and a server has none.\n *\n * Rendering nothing until mounted is also correct rather than merely safe: a\n * prerendered page has no toasts in it, so there is nothing to hydrate and\n * nothing to flash.\n */\nconst mounted = ref(false)\nonMounted(() => (mounted.value = true))\n\nconst ICON = {\n info: Info,\n success: CheckCircle2,\n warning: TriangleAlert,\n danger: XCircle,\n} as const satisfies Record<ToastTone, unknown>\n\n/* Roles, never colours. The app repaints these by redefining the token. */\nconst TONE_CLASS = {\n info: 'text-primary',\n success: 'text-positive',\n warning: 'text-warning',\n danger: 'text-negative',\n} as const satisfies Record<ToastTone, string>\n</script>\n\n<template>\n <Teleport v-if=\"mounted\" to=\"body\">\n <!--\n `polite`, not `assertive`, and it is a considered choice: a toast reports\n something that already happened, and interrupting a screen reader\n mid-sentence to say \"saved\" is ruder than waiting. A failure the reader\n must act on belongs in a `BaseAlert` beside the thing that failed.\n\n `role=\"status\"` rather than `role=\"log\"` so the whole region is read when\n it changes, not only the appended line.\n -->\n <div\n class=\"pointer-events-none fixed inset-x-0 z-[100] flex flex-col items-center gap-2 px-4\"\n :class=\"bottom ? 'bottom-0 pb-[max(1rem,env(safe-area-inset-bottom))]' : 'top-0 pt-4'\"\n role=\"status\"\n aria-live=\"polite\"\n >\n <TransitionGroup name=\"toast\">\n <div\n v-for=\"toast in toasts\"\n :key=\"toast.id\"\n class=\"surface-raised text-ink rounded-card pointer-events-auto flex w-full max-w-sm items-start gap-3 p-3\"\n @mouseenter=\"pause(toast.id)\"\n @mouseleave=\"resume(toast.id)\"\n @focusin=\"pause(toast.id)\"\n @focusout=\"resume(toast.id)\"\n >\n <component\n :is=\"ICON[toast.tone]\"\n class=\"mt-0.5 size-5 shrink-0\"\n :class=\"TONE_CLASS[toast.tone]\"\n aria-hidden=\"true\"\n />\n\n <p class=\"flex-1 text-sm leading-snug\">{{ toast.message }}</p>\n\n <BaseButton\n v-if=\"toast.action\"\n variant=\"link\"\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n @click=\"runAction(toast.id, toast.action.onClick)\"\n >\n {{ toast.action.label }}\n </BaseButton>\n\n <BaseButton\n variant=\"quiet\"\n icon\n pill\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n :aria-label=\"closeLabel\"\n @click=\"dismiss(toast.id)\"\n >\n <X class=\"size-4\" />\n </BaseButton>\n </div>\n </TransitionGroup>\n </div>\n </Teleport>\n</template>\n\n<style scoped>\n/* Movement is small and downward from the top, upward from the bottom — the\n direction it came from either way. */\n.toast-enter-active,\n.toast-leave-active {\n transition:\n opacity var(--duration-base) ease-out,\n transform var(--duration-base) ease-out;\n}\n\n.toast-enter-from,\n.toast-leave-to {\n opacity: 0;\n transform: translateY(-0.5rem);\n}\n\n/* Leaving is taken out of flow so the ones below close the gap smoothly\n instead of jumping when it unmounts. */\n.toast-leave-active {\n position: absolute;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast-enter-active,\n .toast-leave-active {\n transition-duration: 1ms;\n }\n\n .toast-enter-from,\n .toast-leave-to {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { onMounted, ref } from 'vue'\nimport { CheckCircle2, Info, TriangleAlert, X, XCircle } from 'lucide-vue-next'\n\nimport BaseButton from './BaseButton.vue'\nimport { useToast } from '../composables/use-toast'\nimport type { ToastTone } from '../composables/use-toast'\n\n/**\n * Where the toasts land. One of these, at the app root.\n *\n * @example\n * ```vue\n * <!-- App.vue -->\n * <ToastHost :close-label=\"$t('common.close')\" />\n * ```\n */\nconst { closeLabel, bottom = false } = defineProps<{\n /**\n * The accessible name of each dismiss button. Required, because the button\n * is an X and an X has no name — and the kit does not know the language.\n */\n closeLabel: string\n /**\n * Stack from the bottom instead of the top. For a phone shell, where the top\n * is a status bar and a header and the thumb is nowhere near it.\n */\n bottom?: boolean | undefined\n}>()\n\nconst { toasts, dismiss, pause, resume } = useToast()\n\n/* Dismissed first, so a handler that throws cannot leave the button on\n screen to be pressed twice. */\nfunction runAction(id: number, onClick: () => void) {\n dismiss(id)\n onClick()\n}\n\n/**\n * Teleport needs a `body`, and a server has none.\n *\n * Rendering nothing until mounted is also correct rather than merely safe: a\n * prerendered page has no toasts in it, so there is nothing to hydrate and\n * nothing to flash.\n */\nconst mounted = ref(false)\nonMounted(() => (mounted.value = true))\n\nconst ICON = {\n info: Info,\n success: CheckCircle2,\n warning: TriangleAlert,\n danger: XCircle,\n} as const satisfies Record<ToastTone, unknown>\n\n/* Roles, never colours. The app repaints these by redefining the token. */\nconst TONE_CLASS = {\n info: 'text-primary',\n success: 'text-positive',\n warning: 'text-warning',\n danger: 'text-negative',\n} as const satisfies Record<ToastTone, string>\n</script>\n\n<template>\n <Teleport v-if=\"mounted\" to=\"body\">\n <!--\n `polite`, not `assertive`, and it is a considered choice: a toast reports\n something that already happened, and interrupting a screen reader\n mid-sentence to say \"saved\" is ruder than waiting. A failure the reader\n must act on belongs in a `BaseAlert` beside the thing that failed.\n\n `role=\"status\"` rather than `role=\"log\"` so the whole region is read when\n it changes, not only the appended line.\n -->\n <div\n class=\"pointer-events-none fixed inset-x-0 z-[100] flex flex-col items-center gap-2 px-4\"\n :class=\"bottom ? 'bottom-0 pb-[max(1rem,env(safe-area-inset-bottom))]' : 'top-0 pt-4'\"\n role=\"status\"\n aria-live=\"polite\"\n >\n <TransitionGroup name=\"toast\">\n <div\n v-for=\"toast in toasts\"\n :key=\"toast.id\"\n class=\"surface-raised text-ink rounded-card pointer-events-auto flex w-full max-w-sm items-start gap-3 p-3\"\n @mouseenter=\"pause(toast.id)\"\n @mouseleave=\"resume(toast.id)\"\n @focusin=\"pause(toast.id)\"\n @focusout=\"resume(toast.id)\"\n >\n <component\n :is=\"ICON[toast.tone]\"\n class=\"mt-0.5 size-5 shrink-0\"\n :class=\"TONE_CLASS[toast.tone]\"\n aria-hidden=\"true\"\n />\n\n <p class=\"flex-1 text-sm leading-snug\">{{ toast.message }}</p>\n\n <BaseButton\n v-if=\"toast.action\"\n variant=\"link\"\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n @click=\"runAction(toast.id, toast.action.onClick)\"\n >\n {{ toast.action.label }}\n </BaseButton>\n\n <BaseButton\n variant=\"quiet\"\n icon\n pill\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n :aria-label=\"closeLabel\"\n @click=\"dismiss(toast.id)\"\n >\n <X class=\"size-4\" />\n </BaseButton>\n </div>\n </TransitionGroup>\n </div>\n </Teleport>\n</template>\n\n<style scoped>\n/* Movement is small and downward from the top, upward from the bottom — the\n direction it came from either way. */\n.toast-enter-active,\n.toast-leave-active {\n transition:\n opacity var(--duration-base) ease-out,\n transform var(--duration-base) ease-out;\n}\n\n.toast-enter-from,\n.toast-leave-to {\n opacity: 0;\n transform: translateY(-0.5rem);\n}\n\n/* Leaving is taken out of flow so the ones below close the gap smoothly\n instead of jumping when it unmounts. */\n.toast-leave-active {\n position: absolute;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast-enter-active,\n .toast-leave-active {\n transition-duration: 1ms;\n }\n\n .toast-enter-from,\n .toast-leave-to {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"L extends string\">\n/**\n * A flat language switcher for screens with no Settings behind them.\n *\n * The list and the labels are props: only the app knows which languages it\n * ships, and endonyms — each language written in itself — are what make the\n * right option legible to someone who cannot read the current interface.\n */\nconst {\n locales,\n labels,\n label = '',\n} = defineProps<{\n locales: readonly L[]\n /** Endonyms, e.g. `{ en: 'English', tr: 'Türkçe' }`. */\n labels: Record<L, string>\n /** Accessible name for the group. */\n label?: string | undefined\n}>()\n\n/**\n * Two-way bound rather than taking the runtime's ref as a prop: props are not\n * unwrapped in a template and cannot be assigned to, so the ref would compare\n * against itself and the click handler would not compile.\n */\nconst preference = defineModel<'system' | L>({ required: true })\n</script>\n\n<template>\n <nav class=\"flex flex-wrap items-center justify-center gap-1\" :aria-label=\"label || undefined\">\n <button\n v-for=\"locale in locales\"\n :key=\"locale\"\n type=\"button\"\n :lang=\"locale\"\n class=\"focus-ring rounded-full px-2.5 py-1.5 text-xs transition-colors\"\n :class=\"\n preference === locale ? 'bg-muted text-ink font-semibold' : 'text-ink-soft hover:text-ink'\n \"\n :aria-pressed=\"preference === locale\"\n @click=\"preference = locale\"\n >\n {{ labels[locale] }}\n </button>\n </nav>\n</template>\n","<script setup lang=\"ts\" generic=\"L extends string\">\n/**\n * A flat language switcher for screens with no Settings behind them.\n *\n * The list and the labels are props: only the app knows which languages it\n * ships, and endonyms — each language written in itself — are what make the\n * right option legible to someone who cannot read the current interface.\n */\nconst {\n locales,\n labels,\n label = '',\n} = defineProps<{\n locales: readonly L[]\n /** Endonyms, e.g. `{ en: 'English', tr: 'Türkçe' }`. */\n labels: Record<L, string>\n /** Accessible name for the group. */\n label?: string | undefined\n}>()\n\n/**\n * Two-way bound rather than taking the runtime's ref as a prop: props are not\n * unwrapped in a template and cannot be assigned to, so the ref would compare\n * against itself and the click handler would not compile.\n */\nconst preference = defineModel<'system' | L>({ required: true })\n</script>\n\n<template>\n <nav class=\"flex flex-wrap items-center justify-center gap-1\" :aria-label=\"label || undefined\">\n <button\n v-for=\"locale in locales\"\n :key=\"locale\"\n type=\"button\"\n :lang=\"locale\"\n class=\"focus-ring rounded-full px-2.5 py-1.5 text-xs transition-colors\"\n :class=\"\n preference === locale ? 'bg-muted text-ink font-semibold' : 'text-ink-soft hover:text-ink'\n \"\n :aria-pressed=\"preference === locale\"\n @click=\"preference = locale\"\n >\n {{ labels[locale] }}\n </button>\n </nav>\n</template>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { RouterLink } from 'vue-router'\nimport type { Component } from 'vue'\n\nimport { tapFeedback } from '../utils/haptics'\n\nexport interface TabItem<K extends string> {\n /** Identity, compared against `active`. */\n key: K\n /** Router destination. */\n to: string\n /** Text under the icon. Already translated. */\n label: string\n icon: Component\n}\n\n/**\n * The floating bottom bar.\n *\n * Items and the active key are props: the package has no opinion about how an\n * app names its screens, and reading `route.meta` here would force one.\n */\nconst {\n items,\n active,\n label = '',\n} = defineProps<{\n items: readonly TabItem<K>[]\n /** Which item is current. Usually from `route.meta`. */\n active?: K | undefined\n /** Accessible name for the navigation landmark. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <header class=\"tab-bar\">\n <nav class=\"tab-bar-inner\" :aria-label=\"label || undefined\">\n <RouterLink\n v-for=\"item in items\"\n :key=\"item.key\"\n :to=\"item.to\"\n class=\"tab-link\"\n :class=\"{ 'is-active': item.key === active }\"\n :aria-current=\"item.key === active ? 'page' : undefined\"\n @click=\"tapFeedback()\"\n >\n <span class=\"tab-icon-slot\">\n <component :is=\"item.icon\" class=\"tab-icon\" />\n </span>\n <span class=\"tab-label\">{{ item.label }}</span>\n </RouterLink>\n </nav>\n </header>\n</template>\n\n<style scoped>\n@reference \"../styles/_reference.css\";\n\n/* absolute, not fixed: the bar hangs inside the app shell. Fixed would pin it\n to the browser window, which on a desktop is nowhere near the app. */\n.tab-bar {\n @apply absolute left-1/2 z-40 w-full max-w-[360px] -translate-x-1/2 px-4;\n bottom: calc(1rem + env(safe-area-inset-bottom, 0px));\n}\n\n.tab-bar-inner {\n /* A raised surface that is always a little translucent: it floats over the\n content it navigates, and a solid bar would read as a wall at the bottom of\n the page. The material decides how much — glass makes it far more so. */\n @apply surface-raised flex items-center justify-between gap-1 p-1.5;\n background-color: color-mix(\n in oklab,\n var(--color-surface) min(var(--surface-opacity), 88%),\n transparent\n );\n backdrop-filter: var(--surface-backdrop, blur(12px));\n -webkit-backdrop-filter: var(--surface-backdrop, blur(12px));\n border-radius: var(--radius-shell);\n}\n\n.tab-link {\n @apply text-ink-soft focus-ring flex min-h-[52px] flex-1 cursor-pointer flex-col items-center justify-center gap-1 py-1.5;\n border-radius: calc(var(--radius-shell) - 6px);\n /* Only the icon reacts to a press. Scaling the whole link drags the label and\n the pill with it, which reads as the bar wobbling. */\n transition: color var(--duration-base) ease;\n}\n\n.tab-link:hover {\n @apply text-ink;\n}\n\n/* The pill sits behind the icon rather than the link, so the active tab grows a\n marker instead of the row changing shape. */\n.tab-icon-slot {\n @apply flex h-7 w-12 items-center justify-center rounded-full transition-all duration-(--duration-base) ease-out;\n}\n\n.tab-link:active .tab-icon-slot {\n transform: scale(0.88);\n}\n\n.is-active {\n @apply text-primary;\n}\n\n.is-active .tab-icon-slot {\n @apply bg-muted;\n}\n\n.tab-icon {\n @apply size-[18px] stroke-2 transition-transform duration-(--duration-base);\n}\n\n.is-active .tab-icon {\n @apply scale-110 stroke-[2.5px];\n}\n\n.tab-label {\n @apply text-[10px] leading-none font-medium;\n}\n\n.is-active .tab-label {\n @apply font-semibold;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tab-icon-slot,\n .tab-icon {\n transition: none;\n }\n .tab-link:active .tab-icon-slot {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { RouterLink } from 'vue-router'\nimport type { Component } from 'vue'\n\nimport { tapFeedback } from '../utils/haptics'\n\nexport interface TabItem<K extends string> {\n /** Identity, compared against `active`. */\n key: K\n /** Router destination. */\n to: string\n /** Text under the icon. Already translated. */\n label: string\n icon: Component\n}\n\n/**\n * The floating bottom bar.\n *\n * Items and the active key are props: the package has no opinion about how an\n * app names its screens, and reading `route.meta` here would force one.\n */\nconst {\n items,\n active,\n label = '',\n} = defineProps<{\n items: readonly TabItem<K>[]\n /** Which item is current. Usually from `route.meta`. */\n active?: K | undefined\n /** Accessible name for the navigation landmark. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <header class=\"tab-bar\">\n <nav class=\"tab-bar-inner\" :aria-label=\"label || undefined\">\n <RouterLink\n v-for=\"item in items\"\n :key=\"item.key\"\n :to=\"item.to\"\n class=\"tab-link\"\n :class=\"{ 'is-active': item.key === active }\"\n :aria-current=\"item.key === active ? 'page' : undefined\"\n @click=\"tapFeedback()\"\n >\n <span class=\"tab-icon-slot\">\n <component :is=\"item.icon\" class=\"tab-icon\" />\n </span>\n <span class=\"tab-label\">{{ item.label }}</span>\n </RouterLink>\n </nav>\n </header>\n</template>\n\n<style scoped>\n@reference \"../styles/_reference.css\";\n\n/* absolute, not fixed: the bar hangs inside the app shell. Fixed would pin it\n to the browser window, which on a desktop is nowhere near the app. */\n.tab-bar {\n @apply absolute left-1/2 z-40 w-full max-w-[360px] -translate-x-1/2 px-4;\n bottom: calc(1rem + env(safe-area-inset-bottom, 0px));\n}\n\n.tab-bar-inner {\n /* A raised surface that is always a little translucent: it floats over the\n content it navigates, and a solid bar would read as a wall at the bottom of\n the page. The material decides how much — glass makes it far more so. */\n @apply surface-raised flex items-center justify-between gap-1 p-1.5;\n background-color: color-mix(\n in oklab,\n var(--color-surface) min(var(--surface-opacity), 88%),\n transparent\n );\n backdrop-filter: var(--surface-backdrop, blur(12px));\n -webkit-backdrop-filter: var(--surface-backdrop, blur(12px));\n border-radius: var(--radius-shell);\n}\n\n.tab-link {\n @apply text-ink-soft focus-ring flex min-h-[52px] flex-1 cursor-pointer flex-col items-center justify-center gap-1 py-1.5;\n border-radius: calc(var(--radius-shell) - 6px);\n /* Only the icon reacts to a press. Scaling the whole link drags the label and\n the pill with it, which reads as the bar wobbling. */\n transition: color var(--duration-base) ease;\n}\n\n.tab-link:hover {\n @apply text-ink;\n}\n\n/* The pill sits behind the icon rather than the link, so the active tab grows a\n marker instead of the row changing shape. */\n.tab-icon-slot {\n @apply flex h-7 w-12 items-center justify-center rounded-full transition-all duration-(--duration-base) ease-out;\n}\n\n.tab-link:active .tab-icon-slot {\n transform: scale(0.88);\n}\n\n.is-active {\n @apply text-primary;\n}\n\n.is-active .tab-icon-slot {\n @apply bg-muted;\n}\n\n.tab-icon {\n @apply size-[18px] stroke-2 transition-transform duration-(--duration-base);\n}\n\n.is-active .tab-icon {\n @apply scale-110 stroke-[2.5px];\n}\n\n.tab-label {\n @apply text-[10px] leading-none font-medium;\n}\n\n.is-active .tab-label {\n @apply font-semibold;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tab-icon-slot,\n .tab-icon {\n transition: none;\n }\n .tab-link:active .tab-icon-slot {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { ChevronLeft, ChevronRight } from 'lucide-vue-next'\nimport { computed, nextTick, ref, useTemplateRef, watch } from 'vue'\n\nimport { addDays, fromDateKey, toDateKey, todayKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DateRange {\n /** `YYYY-MM-DD`, always local. */\n start: string\n end: string\n}\n\n/**\n * A month of days, for choosing one or a stretch of them.\n *\n * Dates are the kit's date keys — `YYYY-MM-DD`, always local — and never\n * `Date` objects across the boundary. `toISOString()` on a late evening in\n * Istanbul is tomorrow, which is the bug `toDateKey` exists to prevent, and\n * a component that handed back `Date`s would hand that bug to every app.\n *\n * The keyboard is the date-grid pattern: the arrows move a day and a week,\n * Home and End go to the ends of the week, Page Up and Down change the\n * month, and with Shift, the year. Only one day is in the Tab order at a\n * time, so a calendar is one stop rather than thirty-one.\n *\n * Every name a screen reader reads — the month, the weekdays, each day —\n * comes from `Intl` in the app's own locale. The two arrows are the only\n * words the app has to pass, because \"previous\" has no date to build it\n * from.\n */\nconst {\n mode = 'single' as M,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = todayKey(),\n} = defineProps<{\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** The earliest day that can be chosen, as `YYYY-MM-DD`. */\n min?: string | undefined\n max?: string | undefined\n /** Days to rule out inside the range — weekends, days already booked. */\n isDisabled?: ((key: string) => boolean) | undefined\n /** `1` Monday, `0` Sunday. */\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the back arrow, e.g. \"Previous month\". */\n previousLabel: string\n /** Accessible name of the forward arrow. */\n nextLabel: string\n /** Which day is marked as today. Given, so a test or a demo can fix it. */\n today?: string | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or the chosen range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst single = computed(() => (mode === 'single' ? (model.value as string | undefined) : undefined))\nconst range = computed(() =>\n mode === 'range' ? (model.value as DateRange | undefined) : undefined,\n)\n\n/* Which month is on screen, and which day the keyboard is on. They move\n together: stepping off the edge of a month turns the page. */\nconst focused = ref(single.value ?? range.value?.start ?? today)\nconst view = ref<'days' | 'months' | 'years'>('days')\nconst grid = useTemplateRef<HTMLElement>('grid')\n\n/** Set while a range is half chosen, to paint what hovering would take. */\nconst pendingStart = ref<string | null>(null)\nconst hovered = ref<string | null>(null)\n\nconst focusedDate = computed(() => fromDateKey(focused.value))\nconst year = computed(() => focusedDate.value.getFullYear())\nconst month = computed(() => focusedDate.value.getMonth())\n\nconst monthTitle = computed(() => formatDate(focusedDate.value, { month: 'long', year: 'numeric' }))\n\n/** The weekday headings, in the app's locale, starting on the chosen day. */\nconst weekdays = computed(() => {\n // 2024-01-07 was a Sunday, so this walks a real week in the right order.\n const sunday = new Date(2024, 0, 7)\n return Array.from({ length: 7 }, (_, i) => {\n const date = new Date(sunday)\n date.setDate(sunday.getDate() + ((i + weekStartsOn) % 7))\n return {\n short: formatDate(date, { weekday: 'short' }),\n long: formatDate(date, { weekday: 'long' }),\n }\n })\n})\n\n/** Six weeks, always: a calendar that changes height as you page it jumps. */\nconst weeks = computed(() => {\n const first = new Date(year.value, month.value, 1)\n const offset = (first.getDay() - weekStartsOn + 7) % 7\n let cursor = addDays(toDateKey(first), -offset)\n\n return Array.from({ length: 6 }, () =>\n Array.from({ length: 7 }, () => {\n const key = cursor\n cursor = addDays(cursor, 1)\n return key\n }),\n )\n})\n\nconst months = computed(() =>\n Array.from({ length: 12 }, (_, i) => ({\n index: i,\n label: formatDate(new Date(year.value, i, 1), { month: 'short' }),\n long: formatDate(new Date(year.value, i, 1), { month: 'long' }),\n })),\n)\n\n/** A block of twelve years, the one the focused year falls in. */\nconst years = computed(() => {\n const start = Math.floor(year.value / 12) * 12\n return Array.from({ length: 12 }, (_, i) => start + i)\n})\n\nconst outside = (key: string) => fromDateKey(key).getMonth() !== month.value\n\nfunction disabled(key: string) {\n if (min !== undefined && key < min) return true\n if (max !== undefined && key > max) return true\n return isDisabled?.(key) ?? false\n}\n\n/* What a day looks like: chosen, an end of the range, or inside it —\n including the stretch the pointer is hovering over while a range is half\n made, which is what makes the second click land where it looks like it\n will. */\nconst edges = computed(() => {\n if (mode !== 'range') return null\n if (pendingStart.value) {\n const other = hovered.value ?? pendingStart.value\n return pendingStart.value <= other\n ? { start: pendingStart.value, end: other }\n : { start: other, end: pendingStart.value }\n }\n return range.value ?? null\n})\n\nfunction stateOf(key: string) {\n if (mode === 'single') return single.value === key ? 'selected' : ''\n const span = edges.value\n if (!span) return ''\n if (key === span.start || key === span.end) return 'selected'\n return key > span.start && key < span.end ? 'inside' : ''\n}\n\nfunction choose(key: string) {\n if (disabled(key)) return\n focused.value = key\n\n if (mode === 'single') {\n model.value = key as Value\n return\n }\n\n if (!pendingStart.value) {\n pendingStart.value = key\n return\n }\n\n const start = pendingStart.value <= key ? pendingStart.value : key\n const end = pendingStart.value <= key ? key : pendingStart.value\n pendingStart.value = null\n hovered.value = null\n model.value = { start, end } as Value\n}\n\nasync function moveTo(key: string) {\n focused.value = key\n await nextTick()\n grid.value?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus()\n}\n\nfunction shiftMonths(count: number) {\n const date = new Date(year.value, month.value + count, 1)\n // The same day of the month where it exists: the 31st of a 30-day month\n // lands on the 30th rather than spilling into the next one.\n const last = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate()\n date.setDate(Math.min(focusedDate.value.getDate(), last))\n return toDateKey(date)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const key = event.key\n const jumps: Record<string, () => string> = {\n ArrowLeft: () => addDays(focused.value, -1),\n ArrowRight: () => addDays(focused.value, 1),\n ArrowUp: () => addDays(focused.value, -7),\n ArrowDown: () => addDays(focused.value, 7),\n Home: () =>\n addDays(focused.value, -((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n End: () =>\n addDays(focused.value, 6 - ((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n PageUp: () => shiftMonths(event.shiftKey ? -12 : -1),\n PageDown: () => shiftMonths(event.shiftKey ? 12 : 1),\n }\n\n const next = jumps[key]\n if (!next) return\n\n event.preventDefault()\n void moveTo(next())\n}\n\n/** The arrows move a month, a year, or twelve years — whatever is on screen. */\nfunction step(direction: 1 | -1) {\n if (view.value === 'days') return moveTo(shiftMonths(direction))\n const years = view.value === 'months' ? 1 : 12\n return moveTo(toDateKey(new Date(year.value + direction * years, month.value, 1)))\n}\n\n/** Down one view: years pick a year, months pick a month and land on days. */\nfunction chooseYear(value: number) {\n void moveTo(toDateKey(new Date(value, month.value, 1)))\n view.value = 'months'\n}\n\nfunction chooseMonth(index: number) {\n void moveTo(toDateKey(new Date(year.value, index, 1)))\n view.value = 'days'\n}\n\nfunction cycleView() {\n view.value = view.value === 'days' ? 'months' : view.value === 'months' ? 'years' : 'days'\n}\n\n/* Following the value: a date chosen elsewhere — a preset, a text field —\n turns the page to it. */\nwatch(\n () => [single.value, range.value?.start] as const,\n ([day, start]) => {\n const next = day ?? start\n if (next) focused.value = next\n },\n)\n</script>\n\n<template>\n <div class=\"rk-cal\">\n <div class=\"rk-cal-head\">\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"previousLabel\"\n @click=\"step(-1)\"\n >\n <ChevronLeft class=\"size-4\" aria-hidden=\"true\" />\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-title focus-ring\"\n :aria-expanded=\"view !== 'days'\"\n @click=\"cycleView\"\n >\n {{ view === 'years' ? `${years[0]} – ${years[11]}` : monthTitle }}\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"nextLabel\"\n @click=\"step(1)\"\n >\n <ChevronRight class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- Days -->\n <div v-if=\"view === 'days'\" class=\"rk-cal-weekdays\" aria-hidden=\"true\">\n <span v-for=\"day in weekdays\" :key=\"day.long\">{{ day.short }}</span>\n </div>\n\n <div\n v-if=\"view === 'days'\"\n ref=\"grid\"\n class=\"rk-cal-grid\"\n role=\"grid\"\n :aria-label=\"monthTitle\"\n @keydown=\"onKeydown\"\n @pointerleave=\"hovered = null\"\n >\n <div v-for=\"(week, index) in weeks\" :key=\"index\" class=\"rk-cal-week\" role=\"row\">\n <div v-for=\"key in week\" :key=\"key\" role=\"gridcell\" class=\"rk-cal-cell\">\n <button\n type=\"button\"\n class=\"rk-cal-day\"\n :class=\"[stateOf(key) && `is-${stateOf(key)}`, { 'is-outside': outside(key) }]\"\n :tabindex=\"key === focused ? 0 : -1\"\n :disabled=\"disabled(key)\"\n :aria-label=\"formatDate(fromDateKey(key), { dateStyle: 'full' })\"\n :aria-selected=\"stateOf(key) === 'selected'\"\n :aria-current=\"key === today ? 'date' : undefined\"\n @click=\"choose(key)\"\n @pointerenter=\"hovered = key\"\n >\n {{ fromDateKey(key).getDate() }}\n </button>\n </div>\n </div>\n </div>\n\n <!-- Months and years: the way to a date two years out without paging. -->\n <div v-else-if=\"view === 'months'\" class=\"rk-cal-blocks\">\n <button\n v-for=\"entry in months\"\n :key=\"entry.index\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n :aria-label=\"entry.long\"\n @click=\"chooseMonth(entry.index)\"\n >\n {{ entry.label }}\n </button>\n </div>\n\n <div v-else class=\"rk-cal-blocks\">\n <button\n v-for=\"value in years\"\n :key=\"value\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n @click=\"chooseYear(value)\"\n >\n {{ value }}\n </button>\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-cal {\n display: flex;\n width: 100%;\n max-width: 19rem;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-cal-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n}\n\n.rk-cal-arrow {\n display: grid;\n width: 2rem;\n height: 2rem;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-arrow:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-title {\n border-radius: var(--radius-cell);\n padding: 0.25rem 0.625rem;\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--color-ink);\n}\n\n.rk-cal-title:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-weekdays,\n.rk-cal-week {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n}\n\n.rk-cal-weekdays {\n gap: 2px;\n font-size: 0.6875rem;\n font-weight: 600;\n text-align: center;\n color: var(--color-ink-soft);\n}\n\n.rk-cal-grid {\n display: grid;\n gap: 2px;\n}\n\n.rk-cal-cell {\n display: grid;\n place-items: center;\n}\n\n.rk-cal-day {\n display: grid;\n width: 100%;\n height: 2.25rem;\n place-items: center;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-day:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-cal-day:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n/* A day from the month either side: still reachable, visibly not this month. */\n.rk-cal-day.is-outside {\n color: var(--color-ink-soft);\n opacity: 0.55;\n}\n\n.rk-cal-day.is-inside {\n background: color-mix(in oklab, var(--color-primary) 14%, transparent);\n border-radius: 0;\n}\n\n.rk-cal-day.is-selected {\n background: var(--color-primary);\n color: var(--color-on-primary);\n font-weight: 600;\n opacity: 1;\n}\n\n.rk-cal-day[aria-current='date']:not(.is-selected) {\n box-shadow: inset 0 0 0 1px var(--color-primary);\n}\n\n.rk-cal-day:disabled {\n cursor: not-allowed;\n opacity: 0.3;\n}\n\n.rk-cal-blocks {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 0.375rem;\n}\n\n.rk-cal-block {\n height: 2.5rem;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-block:hover {\n background: var(--color-muted);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { ChevronLeft, ChevronRight } from 'lucide-vue-next'\nimport { computed, nextTick, ref, useTemplateRef, watch } from 'vue'\n\nimport { addDays, fromDateKey, toDateKey, todayKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DateRange {\n /** `YYYY-MM-DD`, always local. */\n start: string\n end: string\n}\n\n/**\n * A month of days, for choosing one or a stretch of them.\n *\n * Dates are the kit's date keys — `YYYY-MM-DD`, always local — and never\n * `Date` objects across the boundary. `toISOString()` on a late evening in\n * Istanbul is tomorrow, which is the bug `toDateKey` exists to prevent, and\n * a component that handed back `Date`s would hand that bug to every app.\n *\n * The keyboard is the date-grid pattern: the arrows move a day and a week,\n * Home and End go to the ends of the week, Page Up and Down change the\n * month, and with Shift, the year. Only one day is in the Tab order at a\n * time, so a calendar is one stop rather than thirty-one.\n *\n * Every name a screen reader reads — the month, the weekdays, each day —\n * comes from `Intl` in the app's own locale. The two arrows are the only\n * words the app has to pass, because \"previous\" has no date to build it\n * from.\n */\nconst {\n mode = 'single' as M,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = todayKey(),\n} = defineProps<{\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** The earliest day that can be chosen, as `YYYY-MM-DD`. */\n min?: string | undefined\n max?: string | undefined\n /** Days to rule out inside the range — weekends, days already booked. */\n isDisabled?: ((key: string) => boolean) | undefined\n /** `1` Monday, `0` Sunday. */\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the back arrow, e.g. \"Previous month\". */\n previousLabel: string\n /** Accessible name of the forward arrow. */\n nextLabel: string\n /** Which day is marked as today. Given, so a test or a demo can fix it. */\n today?: string | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or the chosen range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst single = computed(() => (mode === 'single' ? (model.value as string | undefined) : undefined))\nconst range = computed(() =>\n mode === 'range' ? (model.value as DateRange | undefined) : undefined,\n)\n\n/* Which month is on screen, and which day the keyboard is on. They move\n together: stepping off the edge of a month turns the page. */\nconst focused = ref(single.value ?? range.value?.start ?? today)\nconst view = ref<'days' | 'months' | 'years'>('days')\nconst grid = useTemplateRef<HTMLElement>('grid')\n\n/** Set while a range is half chosen, to paint what hovering would take. */\nconst pendingStart = ref<string | null>(null)\nconst hovered = ref<string | null>(null)\n\nconst focusedDate = computed(() => fromDateKey(focused.value))\nconst year = computed(() => focusedDate.value.getFullYear())\nconst month = computed(() => focusedDate.value.getMonth())\n\nconst monthTitle = computed(() => formatDate(focusedDate.value, { month: 'long', year: 'numeric' }))\n\n/** The weekday headings, in the app's locale, starting on the chosen day. */\nconst weekdays = computed(() => {\n // 2024-01-07 was a Sunday, so this walks a real week in the right order.\n const sunday = new Date(2024, 0, 7)\n return Array.from({ length: 7 }, (_, i) => {\n const date = new Date(sunday)\n date.setDate(sunday.getDate() + ((i + weekStartsOn) % 7))\n return {\n short: formatDate(date, { weekday: 'short' }),\n long: formatDate(date, { weekday: 'long' }),\n }\n })\n})\n\n/** Six weeks, always: a calendar that changes height as you page it jumps. */\nconst weeks = computed(() => {\n const first = new Date(year.value, month.value, 1)\n const offset = (first.getDay() - weekStartsOn + 7) % 7\n let cursor = addDays(toDateKey(first), -offset)\n\n return Array.from({ length: 6 }, () =>\n Array.from({ length: 7 }, () => {\n const key = cursor\n cursor = addDays(cursor, 1)\n return key\n }),\n )\n})\n\nconst months = computed(() =>\n Array.from({ length: 12 }, (_, i) => ({\n index: i,\n label: formatDate(new Date(year.value, i, 1), { month: 'short' }),\n long: formatDate(new Date(year.value, i, 1), { month: 'long' }),\n })),\n)\n\n/** A block of twelve years, the one the focused year falls in. */\nconst years = computed(() => {\n const start = Math.floor(year.value / 12) * 12\n return Array.from({ length: 12 }, (_, i) => start + i)\n})\n\nconst outside = (key: string) => fromDateKey(key).getMonth() !== month.value\n\nfunction disabled(key: string) {\n if (min !== undefined && key < min) return true\n if (max !== undefined && key > max) return true\n return isDisabled?.(key) ?? false\n}\n\n/* What a day looks like: chosen, an end of the range, or inside it —\n including the stretch the pointer is hovering over while a range is half\n made, which is what makes the second click land where it looks like it\n will. */\nconst edges = computed(() => {\n if (mode !== 'range') return null\n if (pendingStart.value) {\n const other = hovered.value ?? pendingStart.value\n return pendingStart.value <= other\n ? { start: pendingStart.value, end: other }\n : { start: other, end: pendingStart.value }\n }\n return range.value ?? null\n})\n\nfunction stateOf(key: string) {\n if (mode === 'single') return single.value === key ? 'selected' : ''\n const span = edges.value\n if (!span) return ''\n if (key === span.start || key === span.end) return 'selected'\n return key > span.start && key < span.end ? 'inside' : ''\n}\n\nfunction choose(key: string) {\n if (disabled(key)) return\n focused.value = key\n\n if (mode === 'single') {\n model.value = key as Value\n return\n }\n\n if (!pendingStart.value) {\n pendingStart.value = key\n return\n }\n\n const start = pendingStart.value <= key ? pendingStart.value : key\n const end = pendingStart.value <= key ? key : pendingStart.value\n pendingStart.value = null\n hovered.value = null\n model.value = { start, end } as Value\n}\n\nasync function moveTo(key: string) {\n focused.value = key\n await nextTick()\n grid.value?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus()\n}\n\nfunction shiftMonths(count: number) {\n const date = new Date(year.value, month.value + count, 1)\n // The same day of the month where it exists: the 31st of a 30-day month\n // lands on the 30th rather than spilling into the next one.\n const last = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate()\n date.setDate(Math.min(focusedDate.value.getDate(), last))\n return toDateKey(date)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const key = event.key\n const jumps: Record<string, () => string> = {\n ArrowLeft: () => addDays(focused.value, -1),\n ArrowRight: () => addDays(focused.value, 1),\n ArrowUp: () => addDays(focused.value, -7),\n ArrowDown: () => addDays(focused.value, 7),\n Home: () =>\n addDays(focused.value, -((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n End: () =>\n addDays(focused.value, 6 - ((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n PageUp: () => shiftMonths(event.shiftKey ? -12 : -1),\n PageDown: () => shiftMonths(event.shiftKey ? 12 : 1),\n }\n\n const next = jumps[key]\n if (!next) return\n\n event.preventDefault()\n void moveTo(next())\n}\n\n/** The arrows move a month, a year, or twelve years — whatever is on screen. */\nfunction step(direction: 1 | -1) {\n if (view.value === 'days') return moveTo(shiftMonths(direction))\n const years = view.value === 'months' ? 1 : 12\n return moveTo(toDateKey(new Date(year.value + direction * years, month.value, 1)))\n}\n\n/** Down one view: years pick a year, months pick a month and land on days. */\nfunction chooseYear(value: number) {\n void moveTo(toDateKey(new Date(value, month.value, 1)))\n view.value = 'months'\n}\n\nfunction chooseMonth(index: number) {\n void moveTo(toDateKey(new Date(year.value, index, 1)))\n view.value = 'days'\n}\n\nfunction cycleView() {\n view.value = view.value === 'days' ? 'months' : view.value === 'months' ? 'years' : 'days'\n}\n\n/* Following the value: a date chosen elsewhere — a preset, a text field —\n turns the page to it. */\nwatch(\n () => [single.value, range.value?.start] as const,\n ([day, start]) => {\n const next = day ?? start\n if (next) focused.value = next\n },\n)\n</script>\n\n<template>\n <div class=\"rk-cal\">\n <div class=\"rk-cal-head\">\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"previousLabel\"\n @click=\"step(-1)\"\n >\n <ChevronLeft class=\"size-4\" aria-hidden=\"true\" />\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-title focus-ring\"\n :aria-expanded=\"view !== 'days'\"\n @click=\"cycleView\"\n >\n {{ view === 'years' ? `${years[0]} – ${years[11]}` : monthTitle }}\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"nextLabel\"\n @click=\"step(1)\"\n >\n <ChevronRight class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- Days -->\n <div v-if=\"view === 'days'\" class=\"rk-cal-weekdays\" aria-hidden=\"true\">\n <span v-for=\"day in weekdays\" :key=\"day.long\">{{ day.short }}</span>\n </div>\n\n <div\n v-if=\"view === 'days'\"\n ref=\"grid\"\n class=\"rk-cal-grid\"\n role=\"grid\"\n :aria-label=\"monthTitle\"\n @keydown=\"onKeydown\"\n @pointerleave=\"hovered = null\"\n >\n <div v-for=\"(week, index) in weeks\" :key=\"index\" class=\"rk-cal-week\" role=\"row\">\n <div v-for=\"key in week\" :key=\"key\" role=\"gridcell\" class=\"rk-cal-cell\">\n <button\n type=\"button\"\n class=\"rk-cal-day\"\n :class=\"[stateOf(key) && `is-${stateOf(key)}`, { 'is-outside': outside(key) }]\"\n :tabindex=\"key === focused ? 0 : -1\"\n :disabled=\"disabled(key)\"\n :aria-label=\"formatDate(fromDateKey(key), { dateStyle: 'full' })\"\n :aria-selected=\"stateOf(key) === 'selected'\"\n :aria-current=\"key === today ? 'date' : undefined\"\n @click=\"choose(key)\"\n @pointerenter=\"hovered = key\"\n >\n {{ fromDateKey(key).getDate() }}\n </button>\n </div>\n </div>\n </div>\n\n <!-- Months and years: the way to a date two years out without paging. -->\n <div v-else-if=\"view === 'months'\" class=\"rk-cal-blocks\">\n <button\n v-for=\"entry in months\"\n :key=\"entry.index\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n :aria-label=\"entry.long\"\n @click=\"chooseMonth(entry.index)\"\n >\n {{ entry.label }}\n </button>\n </div>\n\n <div v-else class=\"rk-cal-blocks\">\n <button\n v-for=\"value in years\"\n :key=\"value\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n @click=\"chooseYear(value)\"\n >\n {{ value }}\n </button>\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-cal {\n display: flex;\n width: 100%;\n max-width: 19rem;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-cal-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n}\n\n.rk-cal-arrow {\n display: grid;\n width: 2rem;\n height: 2rem;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-arrow:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-title {\n border-radius: var(--radius-cell);\n padding: 0.25rem 0.625rem;\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--color-ink);\n}\n\n.rk-cal-title:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-weekdays,\n.rk-cal-week {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n}\n\n.rk-cal-weekdays {\n gap: 2px;\n font-size: 0.6875rem;\n font-weight: 600;\n text-align: center;\n color: var(--color-ink-soft);\n}\n\n.rk-cal-grid {\n display: grid;\n gap: 2px;\n}\n\n.rk-cal-cell {\n display: grid;\n place-items: center;\n}\n\n.rk-cal-day {\n display: grid;\n width: 100%;\n height: 2.25rem;\n place-items: center;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-day:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-cal-day:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n/* A day from the month either side: still reachable, visibly not this month. */\n.rk-cal-day.is-outside {\n color: var(--color-ink-soft);\n opacity: 0.55;\n}\n\n.rk-cal-day.is-inside {\n background: color-mix(in oklab, var(--color-primary) 14%, transparent);\n border-radius: 0;\n}\n\n.rk-cal-day.is-selected {\n background: var(--color-primary);\n color: var(--color-on-primary);\n font-weight: 600;\n opacity: 1;\n}\n\n.rk-cal-day[aria-current='date']:not(.is-selected) {\n box-shadow: inset 0 0 0 1px var(--color-primary);\n}\n\n.rk-cal-day:disabled {\n cursor: not-allowed;\n opacity: 0.3;\n}\n\n.rk-cal-blocks {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 0.375rem;\n}\n\n.rk-cal-block {\n height: 2.5rem;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-block:hover {\n background: var(--color-muted);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A panel of anything — a form, a picker, a few settings — anchored to the\n * control that opened it.\n *\n * Not a menu and not a modal. A menu is a list of actions and moves with the\n * arrow keys; a modal takes the whole page. A popover is a small non-modal\n * dialog: focus moves into it on open and back to the trigger on Escape, a\n * click outside or a Tab out of it closes it, and the page behind stays\n * usable.\n *\n * The trigger is yours. The `trigger` slot hands you the attributes and the\n * click handler to bind on whatever you render — usually a `BaseButton` —\n * instead of wrapping it in a button of the kit's, which would nest one\n * button inside another.\n *\n * It opens below the trigger and flips above when there is no room below,\n * and slides sideways rather than off the edge of the screen.\n */\nconst {\n label,\n side = 'bottom',\n align = 'start',\n} = defineProps<{\n /** The panel's accessible name — what a screen reader announces on open. */\n label: string\n /** Where it prefers to open. It flips when there is no room there. */\n side?: 'bottom' | 'top' | undefined\n /** Which edge of the trigger the panel lines up with. */\n align?: 'start' | 'center' | 'end' | undefined\n}>()\n\nexport interface PopoverTriggerProps {\n 'aria-expanded': boolean\n 'aria-controls': string\n 'aria-haspopup': 'dialog'\n 'data-rk-popover-trigger': ''\n onClick: () => void\n}\n\ndefineSlots<{\n /** The control that opens it. Bind `props` on it: `v-bind=\"props\"`. */\n trigger: (props: { open: boolean; props: PopoverTriggerProps }) => unknown\n /** The panel's content. `close` for a Done or Apply button inside it. */\n default: (props: { close: () => void }) => unknown\n}>()\n\n/** Open or closed, with `v-model`. Optional: it manages itself. */\nconst open = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\n\n/** Where it actually opened, after measuring. */\nconst placed = ref(side)\n/** Pixels slid sideways to stay on screen. */\nconst shift = ref(0)\n\nconst triggerProps = computed<PopoverTriggerProps>(() => ({\n 'aria-expanded': open.value,\n 'aria-controls': id,\n 'aria-haspopup': 'dialog',\n 'data-rk-popover-trigger': '',\n onClick: () => (open.value = !open.value),\n}))\n\nfunction close() {\n open.value = false\n}\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\nfunction trigger(): HTMLElement | null {\n return root.value?.querySelector<HTMLElement>('[data-rk-popover-trigger]') ?? null\n}\n\n/**\n * Measured once it is on screen, because only then is there a size to\n * measure. Flips first, then slides: a panel that fits neither above nor\n * below keeps the side it asked for, where it is at least attached.\n */\nfunction place() {\n if (!panel.value || typeof window === 'undefined') return\n\n const rect = panel.value.getBoundingClientRect()\n const anchor = root.value!.getBoundingClientRect()\n const below = window.innerHeight - anchor.bottom\n const above = anchor.top\n\n if (side === 'bottom' && rect.height > below && above > below) placed.value = 'top'\n if (side === 'top' && rect.height > above && below > above) placed.value = 'bottom'\n\n const margin = 8\n if (rect.right > window.innerWidth - margin) shift.value = window.innerWidth - margin - rect.right\n if (rect.left + shift.value < margin) shift.value = margin - rect.left\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape' || !open.value) return\n\n event.preventDefault()\n close()\n trigger()?.focus()\n}\n\n/* Tab out of it, and it closes — it is not a trap. Focus that moved to\n nowhere (a click on empty page) is left to the pointer handler. */\nfunction onFocusout(event: FocusEvent) {\n const next = event.relatedTarget as Node | null\n if (next && root.value && !root.value.contains(next)) close()\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) close()\n}\n\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (!isOpen) {\n document.removeEventListener('pointerdown', onDocumentPointer)\n return\n }\n\n document.addEventListener('pointerdown', onDocumentPointer)\n // Reset before it renders, so it is measured where it asked to be rather\n // than where it ended up last time.\n placed.value = side\n shift.value = 0\n await nextTick()\n place()\n const first = panel.value?.querySelector<HTMLElement>(FOCUSABLE)\n ;(first ?? panel.value)?.focus()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-popover\" @keydown=\"onKeydown\" @focusout=\"onFocusout\">\n <slot name=\"trigger\" :open=\"open\" :props=\"triggerProps\" />\n\n <Transition name=\"rk-popover\">\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-popover-panel surface-overlay\"\n :class=\"[`is-${placed}`, `is-${align}`]\"\n :style=\"shift ? { '--rk-popover-shift': `${shift}px` } : undefined\"\n role=\"dialog\"\n :aria-label=\"label\"\n tabindex=\"-1\"\n >\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<style scoped>\n.rk-popover {\n position: relative;\n display: inline-flex;\n}\n\n.rk-popover-panel {\n position: absolute;\n z-index: 50;\n min-width: 14rem;\n max-width: min(24rem, calc(100vw - 1rem));\n border-radius: var(--radius-card);\n padding: 0.75rem;\n translate: var(--rk-popover-shift, 0) 0;\n}\n\n.rk-popover-panel:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-popover-panel.is-bottom {\n top: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-top {\n bottom: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-start {\n left: 0;\n}\n\n.rk-popover-panel.is-end {\n right: 0;\n}\n\n.rk-popover-panel.is-center {\n left: 50%;\n translate: calc(-50% + var(--rk-popover-shift, 0px)) 0;\n}\n\n.rk-popover-enter-active,\n.rk-popover-leave-active {\n transition:\n opacity var(--duration-fast) var(--ease-standard),\n transform var(--duration-fast) var(--ease-standard);\n}\n\n.rk-popover-enter-from,\n.rk-popover-leave-to {\n opacity: 0;\n transform: translateY(-4px) scale(0.98);\n}\n\n.rk-popover-panel.is-top.rk-popover-enter-from,\n.rk-popover-panel.is-top.rk-popover-leave-to {\n transform: translateY(4px) scale(0.98);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A panel of anything — a form, a picker, a few settings — anchored to the\n * control that opened it.\n *\n * Not a menu and not a modal. A menu is a list of actions and moves with the\n * arrow keys; a modal takes the whole page. A popover is a small non-modal\n * dialog: focus moves into it on open and back to the trigger on Escape, a\n * click outside or a Tab out of it closes it, and the page behind stays\n * usable.\n *\n * The trigger is yours. The `trigger` slot hands you the attributes and the\n * click handler to bind on whatever you render — usually a `BaseButton` —\n * instead of wrapping it in a button of the kit's, which would nest one\n * button inside another.\n *\n * It opens below the trigger and flips above when there is no room below,\n * and slides sideways rather than off the edge of the screen.\n */\nconst {\n label,\n side = 'bottom',\n align = 'start',\n} = defineProps<{\n /** The panel's accessible name — what a screen reader announces on open. */\n label: string\n /** Where it prefers to open. It flips when there is no room there. */\n side?: 'bottom' | 'top' | undefined\n /** Which edge of the trigger the panel lines up with. */\n align?: 'start' | 'center' | 'end' | undefined\n}>()\n\nexport interface PopoverTriggerProps {\n 'aria-expanded': boolean\n 'aria-controls': string\n 'aria-haspopup': 'dialog'\n 'data-rk-popover-trigger': ''\n onClick: () => void\n}\n\ndefineSlots<{\n /** The control that opens it. Bind `props` on it: `v-bind=\"props\"`. */\n trigger: (props: { open: boolean; props: PopoverTriggerProps }) => unknown\n /** The panel's content. `close` for a Done or Apply button inside it. */\n default: (props: { close: () => void }) => unknown\n}>()\n\n/** Open or closed, with `v-model`. Optional: it manages itself. */\nconst open = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\n\n/** Where it actually opened, after measuring. */\nconst placed = ref(side)\n/** Pixels slid sideways to stay on screen. */\nconst shift = ref(0)\n\nconst triggerProps = computed<PopoverTriggerProps>(() => ({\n 'aria-expanded': open.value,\n 'aria-controls': id,\n 'aria-haspopup': 'dialog',\n 'data-rk-popover-trigger': '',\n onClick: () => (open.value = !open.value),\n}))\n\nfunction close() {\n open.value = false\n}\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\nfunction trigger(): HTMLElement | null {\n return root.value?.querySelector<HTMLElement>('[data-rk-popover-trigger]') ?? null\n}\n\n/**\n * Measured once it is on screen, because only then is there a size to\n * measure. Flips first, then slides: a panel that fits neither above nor\n * below keeps the side it asked for, where it is at least attached.\n */\nfunction place() {\n if (!panel.value || typeof window === 'undefined') return\n\n const rect = panel.value.getBoundingClientRect()\n const anchor = root.value!.getBoundingClientRect()\n const below = window.innerHeight - anchor.bottom\n const above = anchor.top\n\n if (side === 'bottom' && rect.height > below && above > below) placed.value = 'top'\n if (side === 'top' && rect.height > above && below > above) placed.value = 'bottom'\n\n const margin = 8\n if (rect.right > window.innerWidth - margin) shift.value = window.innerWidth - margin - rect.right\n if (rect.left + shift.value < margin) shift.value = margin - rect.left\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape' || !open.value) return\n\n event.preventDefault()\n close()\n trigger()?.focus()\n}\n\n/* Tab out of it, and it closes — it is not a trap. Focus that moved to\n nowhere (a click on empty page) is left to the pointer handler. */\nfunction onFocusout(event: FocusEvent) {\n const next = event.relatedTarget as Node | null\n if (next && root.value && !root.value.contains(next)) close()\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) close()\n}\n\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (!isOpen) {\n document.removeEventListener('pointerdown', onDocumentPointer)\n return\n }\n\n document.addEventListener('pointerdown', onDocumentPointer)\n // Reset before it renders, so it is measured where it asked to be rather\n // than where it ended up last time.\n placed.value = side\n shift.value = 0\n await nextTick()\n place()\n const first = panel.value?.querySelector<HTMLElement>(FOCUSABLE)\n ;(first ?? panel.value)?.focus()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-popover\" @keydown=\"onKeydown\" @focusout=\"onFocusout\">\n <slot name=\"trigger\" :open=\"open\" :props=\"triggerProps\" />\n\n <Transition name=\"rk-popover\">\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-popover-panel surface-overlay\"\n :class=\"[`is-${placed}`, `is-${align}`]\"\n :style=\"shift ? { '--rk-popover-shift': `${shift}px` } : undefined\"\n role=\"dialog\"\n :aria-label=\"label\"\n tabindex=\"-1\"\n >\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<style scoped>\n.rk-popover {\n position: relative;\n display: inline-flex;\n}\n\n.rk-popover-panel {\n position: absolute;\n z-index: 50;\n min-width: 14rem;\n max-width: min(24rem, calc(100vw - 1rem));\n border-radius: var(--radius-card);\n padding: 0.75rem;\n translate: var(--rk-popover-shift, 0) 0;\n}\n\n.rk-popover-panel:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-popover-panel.is-bottom {\n top: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-top {\n bottom: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-start {\n left: 0;\n}\n\n.rk-popover-panel.is-end {\n right: 0;\n}\n\n.rk-popover-panel.is-center {\n left: 50%;\n translate: calc(-50% + var(--rk-popover-shift, 0px)) 0;\n}\n\n.rk-popover-enter-active,\n.rk-popover-leave-active {\n transition:\n opacity var(--duration-fast) var(--ease-standard),\n transform var(--duration-fast) var(--ease-standard);\n}\n\n.rk-popover-enter-from,\n.rk-popover-leave-to {\n opacity: 0;\n transform: translateY(-4px) scale(0.98);\n}\n\n.rk-popover-panel.is-top.rk-popover-enter-from,\n.rk-popover-panel.is-top.rk-popover-leave-to {\n transform: translateY(4px) scale(0.98);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { CalendarDays, X } from 'lucide-vue-next'\nimport { computed, ref } from 'vue'\n\nimport BaseCalendar from './BaseCalendar.vue'\nimport type { DateRange } from './BaseCalendar.vue'\nimport BasePopover from './BasePopover.vue'\nimport FormField from './FormField.vue'\nimport { fromDateKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DatePreset {\n /** Already translated: \"Last 7 days\", \"This month\". */\n label: string\n /** The days it stands for, built when it is pressed — so \"today\" is today. */\n value: () => string | DateRange\n}\n\n/**\n * A date, or a stretch of dates, chosen from a calendar in a popover.\n *\n * The field is a button rather than a text input: a typed date is a parsing\n * problem in every locale at once — \"03/04\" is two different days either\n * side of the Atlantic — and the calendar is the part people reach for\n * anyway. What it shows is `Intl` in the app's locale; what it hands back\n * is the kit's date keys.\n *\n * `presets` are the ready-made answers a report offers: last seven days,\n * this month. They are the app's words and the app's arithmetic, built when\n * pressed so that \"today\" is today.\n */\nconst {\n label,\n mode = 'single' as M,\n placeholder = '',\n format = { dateStyle: 'medium' },\n presets = undefined,\n clearLabel = undefined,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = undefined,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** What the field shows while nothing is chosen. */\n placeholder?: string | undefined\n /** How the chosen date reads, through `Intl.DateTimeFormat`. */\n format?: Intl.DateTimeFormatOptions | undefined\n /** Ready-made answers beside the calendar: \"Last 7 days\", \"This month\". */\n presets?: readonly DatePreset[] | undefined\n /** Given, the field grows a button that empties it. Its accessible name. */\n clearLabel?: string | undefined\n min?: string | undefined\n max?: string | undefined\n isDisabled?: ((key: string) => boolean) | undefined\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the calendar's back arrow. */\n previousLabel: string\n /** Accessible name of the calendar's forward arrow. */\n nextLabel: string\n /** Which day the calendar marks as today. Given, so a demo or a test can fix it. */\n today?: string | undefined\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst open = ref(false)\n\nconst shown = computed(() => {\n const value = model.value\n if (value === undefined) return ''\n if (typeof value === 'string') return formatDate(fromDateKey(value), format)\n\n const start = formatDate(fromDateKey(value.start), format)\n if (value.start === value.end) return start\n\n // An en dash, not a hyphen: it is a span, and it reads as one.\n return `${start} – ${formatDate(fromDateKey(value.end), format)}`\n})\n\nfunction onPicked(next: Value | undefined) {\n model.value = next as Value\n // Single: chosen is done. Range: only once both ends are in, which is the\n // only time the calendar reports one.\n if (mode === 'single' || (next && typeof next === 'object')) open.value = false\n}\n\nfunction applyPreset(preset: DatePreset) {\n model.value = preset.value() as Value\n open.value = false\n}\n\nfunction clear() {\n model.value = undefined as Value\n open.value = false\n}\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <BasePopover v-model=\"open\" class=\"rk-date\" :label=\"label\">\n <!-- Two buttons side by side rather than one inside the other: a\n button nested in a button is not a control a browser or a screen\n reader can make sense of. -->\n <template #trigger=\"{ props }\">\n <div class=\"rk-date-wrap control\" :class=\"{ 'is-invalid': invalid }\">\n <button\n :id=\"id\"\n type=\"button\"\n class=\"rk-date-field focus-ring\"\n :class=\"{ 'is-empty': !shown }\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n v-bind=\"props\"\n >\n <CalendarDays class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ shown || placeholder }}</span>\n </button>\n\n <button\n v-if=\"clearLabel && shown\"\n type=\"button\"\n class=\"rk-date-clear focus-ring\"\n :aria-label=\"clearLabel\"\n :disabled=\"disabled\"\n @click=\"clear\"\n >\n <X class=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n\n <div class=\"rk-date-panel\">\n <ul v-if=\"presets?.length\" class=\"rk-date-presets\">\n <li v-for=\"preset in presets\" :key=\"preset.label\">\n <button type=\"button\" class=\"rk-date-preset focus-ring\" @click=\"applyPreset(preset)\">\n {{ preset.label }}\n </button>\n </li>\n </ul>\n\n <BaseCalendar\n :model-value=\"model\"\n :mode=\"mode\"\n :min=\"min\"\n :max=\"max\"\n :is-disabled=\"isDisabled\"\n :week-starts-on=\"weekStartsOn\"\n :previous-label=\"previousLabel\"\n :next-label=\"nextLabel\"\n v-bind=\"today ? { today } : {}\"\n @update:model-value=\"onPicked\"\n />\n </div>\n </BasePopover>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n.rk-date {\n display: block;\n}\n\n/* Wider than a popover's default: a calendar and a column of presets side by\n side do not fit in 24rem, and the month title wraps in two. */\n.rk-date :deep(.rk-popover-panel) {\n max-width: min(34rem, calc(100vw - 1rem));\n}\n\n.rk-date-wrap {\n display: flex;\n width: 100%;\n height: 2.75rem;\n align-items: center;\n border-radius: var(--radius-card);\n padding-right: 0.375rem;\n}\n\n.rk-date-field {\n display: flex;\n min-width: 0;\n flex: 1;\n height: 100%;\n align-items: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0 0.75rem;\n text-align: left;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-date-field.is-empty {\n color: var(--color-ink-soft);\n}\n\n.rk-date-wrap.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-date-field:disabled {\n opacity: 0.5;\n}\n\n.rk-date-clear {\n display: grid;\n width: 1.375rem;\n height: 1.375rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink-soft);\n}\n\n.rk-date-clear:hover {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-date-clear:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n/* As wide as its contents rather than as narrow as they will go: in a flex\n panel the calendar shrinks, and a squeezed month title wraps in two. */\n.rk-date-panel {\n display: flex;\n width: max-content;\n max-width: 100%;\n gap: 0.75rem;\n}\n\n.rk-date-panel :deep(.rk-cal) {\n width: 17rem;\n}\n\n.rk-date-presets {\n display: flex;\n min-width: 8rem;\n flex-direction: column;\n gap: 2px;\n border-right: 1px solid var(--surface-border-color);\n padding-right: 0.75rem;\n}\n\n.rk-date-preset {\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.375rem 0.5rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-date-preset:hover {\n background: var(--color-muted);\n}\n\n@media (max-width: 30rem) {\n .rk-date-panel {\n flex-direction: column;\n }\n\n .rk-date-presets {\n flex-direction: row;\n flex-wrap: wrap;\n border-right: 0;\n border-bottom: 1px solid var(--surface-border-color);\n padding-right: 0;\n padding-bottom: 0.5rem;\n }\n\n .rk-date-preset {\n width: auto;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { CalendarDays, X } from 'lucide-vue-next'\nimport { computed, ref } from 'vue'\n\nimport BaseCalendar from './BaseCalendar.vue'\nimport type { DateRange } from './BaseCalendar.vue'\nimport BasePopover from './BasePopover.vue'\nimport FormField from './FormField.vue'\nimport { fromDateKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DatePreset {\n /** Already translated: \"Last 7 days\", \"This month\". */\n label: string\n /** The days it stands for, built when it is pressed — so \"today\" is today. */\n value: () => string | DateRange\n}\n\n/**\n * A date, or a stretch of dates, chosen from a calendar in a popover.\n *\n * The field is a button rather than a text input: a typed date is a parsing\n * problem in every locale at once — \"03/04\" is two different days either\n * side of the Atlantic — and the calendar is the part people reach for\n * anyway. What it shows is `Intl` in the app's locale; what it hands back\n * is the kit's date keys.\n *\n * `presets` are the ready-made answers a report offers: last seven days,\n * this month. They are the app's words and the app's arithmetic, built when\n * pressed so that \"today\" is today.\n */\nconst {\n label,\n mode = 'single' as M,\n placeholder = '',\n format = { dateStyle: 'medium' },\n presets = undefined,\n clearLabel = undefined,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = undefined,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** What the field shows while nothing is chosen. */\n placeholder?: string | undefined\n /** How the chosen date reads, through `Intl.DateTimeFormat`. */\n format?: Intl.DateTimeFormatOptions | undefined\n /** Ready-made answers beside the calendar: \"Last 7 days\", \"This month\". */\n presets?: readonly DatePreset[] | undefined\n /** Given, the field grows a button that empties it. Its accessible name. */\n clearLabel?: string | undefined\n min?: string | undefined\n max?: string | undefined\n isDisabled?: ((key: string) => boolean) | undefined\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the calendar's back arrow. */\n previousLabel: string\n /** Accessible name of the calendar's forward arrow. */\n nextLabel: string\n /** Which day the calendar marks as today. Given, so a demo or a test can fix it. */\n today?: string | undefined\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst open = ref(false)\n\nconst shown = computed(() => {\n const value = model.value\n if (value === undefined) return ''\n if (typeof value === 'string') return formatDate(fromDateKey(value), format)\n\n const start = formatDate(fromDateKey(value.start), format)\n if (value.start === value.end) return start\n\n // An en dash, not a hyphen: it is a span, and it reads as one.\n return `${start} – ${formatDate(fromDateKey(value.end), format)}`\n})\n\nfunction onPicked(next: Value | undefined) {\n model.value = next as Value\n // Single: chosen is done. Range: only once both ends are in, which is the\n // only time the calendar reports one.\n if (mode === 'single' || (next && typeof next === 'object')) open.value = false\n}\n\nfunction applyPreset(preset: DatePreset) {\n model.value = preset.value() as Value\n open.value = false\n}\n\nfunction clear() {\n model.value = undefined as Value\n open.value = false\n}\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <BasePopover v-model=\"open\" class=\"rk-date\" :label=\"label\">\n <!-- Two buttons side by side rather than one inside the other: a\n button nested in a button is not a control a browser or a screen\n reader can make sense of. -->\n <template #trigger=\"{ props }\">\n <div class=\"rk-date-wrap control\" :class=\"{ 'is-invalid': invalid }\">\n <button\n :id=\"id\"\n type=\"button\"\n class=\"rk-date-field focus-ring\"\n :class=\"{ 'is-empty': !shown }\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n v-bind=\"props\"\n >\n <CalendarDays class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ shown || placeholder }}</span>\n </button>\n\n <button\n v-if=\"clearLabel && shown\"\n type=\"button\"\n class=\"rk-date-clear focus-ring\"\n :aria-label=\"clearLabel\"\n :disabled=\"disabled\"\n @click=\"clear\"\n >\n <X class=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n\n <div class=\"rk-date-panel\">\n <ul v-if=\"presets?.length\" class=\"rk-date-presets\">\n <li v-for=\"preset in presets\" :key=\"preset.label\">\n <button type=\"button\" class=\"rk-date-preset focus-ring\" @click=\"applyPreset(preset)\">\n {{ preset.label }}\n </button>\n </li>\n </ul>\n\n <BaseCalendar\n :model-value=\"model\"\n :mode=\"mode\"\n :min=\"min\"\n :max=\"max\"\n :is-disabled=\"isDisabled\"\n :week-starts-on=\"weekStartsOn\"\n :previous-label=\"previousLabel\"\n :next-label=\"nextLabel\"\n v-bind=\"today ? { today } : {}\"\n @update:model-value=\"onPicked\"\n />\n </div>\n </BasePopover>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n.rk-date {\n display: block;\n}\n\n/* Wider than a popover's default: a calendar and a column of presets side by\n side do not fit in 24rem, and the month title wraps in two. */\n.rk-date :deep(.rk-popover-panel) {\n max-width: min(34rem, calc(100vw - 1rem));\n}\n\n.rk-date-wrap {\n display: flex;\n width: 100%;\n height: 2.75rem;\n align-items: center;\n border-radius: var(--radius-card);\n padding-right: 0.375rem;\n}\n\n.rk-date-field {\n display: flex;\n min-width: 0;\n flex: 1;\n height: 100%;\n align-items: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0 0.75rem;\n text-align: left;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-date-field.is-empty {\n color: var(--color-ink-soft);\n}\n\n.rk-date-wrap.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-date-field:disabled {\n opacity: 0.5;\n}\n\n.rk-date-clear {\n display: grid;\n width: 1.375rem;\n height: 1.375rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink-soft);\n}\n\n.rk-date-clear:hover {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-date-clear:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n/* As wide as its contents rather than as narrow as they will go: in a flex\n panel the calendar shrinks, and a squeezed month title wraps in two. */\n.rk-date-panel {\n display: flex;\n width: max-content;\n max-width: 100%;\n gap: 0.75rem;\n}\n\n.rk-date-panel :deep(.rk-cal) {\n width: 17rem;\n}\n\n.rk-date-presets {\n display: flex;\n min-width: 8rem;\n flex-direction: column;\n gap: 2px;\n border-right: 1px solid var(--surface-border-color);\n padding-right: 0.75rem;\n}\n\n.rk-date-preset {\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.375rem 0.5rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-date-preset:hover {\n background: var(--color-muted);\n}\n\n@media (max-width: 30rem) {\n .rk-date-panel {\n flex-direction: column;\n }\n\n .rk-date-presets {\n flex-direction: row;\n flex-wrap: wrap;\n border-right: 0;\n border-bottom: 1px solid var(--surface-border-color);\n padding-right: 0;\n padding-bottom: 0.5rem;\n }\n\n .rk-date-preset {\n width: auto;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"V extends string, M extends 'single' | 'multiple' = 'single'\">\nimport { computed, ref } from 'vue'\nimport type { Component } from 'vue'\n\n/**\n * A row of buttons that stay pressed — one at a time, or several at once.\n *\n * Next to `SegmentedControl` on purpose, and not the same thing. A segmented\n * control is a set of radios: there is always exactly one answer, and it is\n * a form value. A toggle group is pressed and unpressed buttons: in `single`\n * mode pressing the pressed one lets go (a filter that can be off), in\n * `multiple` mode any number can be down at once (bold and italic, or three\n * categories out of five).\n *\n * One Tab stop for the whole group, and the arrow keys move between the\n * buttons — the toolbar pattern, so a row of twelve does not cost twelve\n * presses of Tab to get past.\n */\nconst {\n options,\n label,\n mode = 'single' as M,\n required = false,\n size = 'md',\n} = defineProps<{\n options: readonly {\n value: V\n /** Visible text — or, with an icon and `iconOnly`, the accessible name. */\n label: string\n icon?: Component | undefined\n /** Show the icon alone. The label becomes the button's accessible name. */\n iconOnly?: boolean | undefined\n disabled?: boolean | undefined\n }[]\n /** The group's accessible name. */\n label: string\n /** `single`: at most one pressed. `multiple`: any number. */\n mode?: M | undefined\n /** In `single` mode, never let the last pressed button go. */\n required?: boolean | undefined\n size?: 'sm' | 'md' | undefined\n}>()\n\n/** The pressed value — or, in `multiple` mode, the pressed values. */\nconst model = defineModel<M extends 'multiple' ? V[] : V | undefined>()\n\nconst buttons = ref<HTMLButtonElement[]>([])\n\nconst pressed = computed(() => {\n const value = model.value\n if (Array.isArray(value)) return new Set<V>(value)\n return new Set<V>(value === undefined ? [] : [value as V])\n})\n\nfunction toggle(value: V) {\n if (mode === 'multiple') {\n const next = new Set(pressed.value)\n if (next.has(value)) next.delete(value)\n else next.add(value)\n // In the order of the options, not the order of the presses, so the\n // value reads the same however the reader got there.\n model.value = options\n .map((option) => option.value)\n .filter((v) => next.has(v)) as typeof model.value\n return\n }\n\n const isPressed = pressed.value.has(value)\n if (isPressed && required) return\n model.value = (isPressed ? undefined : value) as typeof model.value\n}\n\n/* The one button Tab lands on: the first pressed one, else the first that\n can be pressed at all. */\nconst tabStop = computed(() => {\n const enabled = options.filter((option) => !option.disabled)\n return (enabled.find((option) => pressed.value.has(option.value)) ?? enabled[0])?.value\n})\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n const step = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[event.key]\n const enabled = buttons.value.filter((button) => !button.disabled)\n let target: HTMLButtonElement | undefined\n\n if (step !== undefined) {\n const at = enabled.indexOf(buttons.value[index]!)\n target = enabled[(at + step + enabled.length) % enabled.length]\n } else if (event.key === 'Home') target = enabled[0]\n else if (event.key === 'End') target = enabled[enabled.length - 1]\n else return\n\n event.preventDefault()\n target?.focus()\n}\n</script>\n\n<template>\n <div class=\"rk-toggles control\" :class=\"`is-${size}`\" role=\"group\" :aria-label=\"label\">\n <button\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n ref=\"buttons\"\n type=\"button\"\n class=\"rk-toggle focus-ring\"\n :aria-pressed=\"pressed.has(option.value)\"\n :aria-label=\"option.iconOnly ? option.label : undefined\"\n :disabled=\"option.disabled\"\n :tabindex=\"option.value === tabStop ? 0 : -1\"\n @click=\"toggle(option.value)\"\n @keydown=\"onKeydown($event, index)\"\n >\n <component :is=\"option.icon\" v-if=\"option.icon\" class=\"rk-toggle-icon\" aria-hidden=\"true\" />\n <span v-if=\"!option.iconOnly\">{{ option.label }}</span>\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-toggles {\n display: inline-flex;\n flex-wrap: wrap;\n gap: 2px;\n border-radius: var(--radius-card);\n padding: 3px;\n}\n\n.rk-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n min-width: 2.25rem;\n height: 2.25rem;\n border-radius: calc(var(--radius-card) - 3px);\n padding: 0 0.75rem;\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.is-sm .rk-toggle {\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.625rem;\n font-size: 0.8125rem;\n}\n\n.rk-toggle:hover:not(:disabled) {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-toggle[aria-pressed='true'] {\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.rk-toggle:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n}\n\n.rk-toggle-icon {\n width: 1rem;\n height: 1rem;\n}\n</style>\n","<script setup lang=\"ts\" generic=\"V extends string, M extends 'single' | 'multiple' = 'single'\">\nimport { computed, ref } from 'vue'\nimport type { Component } from 'vue'\n\n/**\n * A row of buttons that stay pressed — one at a time, or several at once.\n *\n * Next to `SegmentedControl` on purpose, and not the same thing. A segmented\n * control is a set of radios: there is always exactly one answer, and it is\n * a form value. A toggle group is pressed and unpressed buttons: in `single`\n * mode pressing the pressed one lets go (a filter that can be off), in\n * `multiple` mode any number can be down at once (bold and italic, or three\n * categories out of five).\n *\n * One Tab stop for the whole group, and the arrow keys move between the\n * buttons — the toolbar pattern, so a row of twelve does not cost twelve\n * presses of Tab to get past.\n */\nconst {\n options,\n label,\n mode = 'single' as M,\n required = false,\n size = 'md',\n} = defineProps<{\n options: readonly {\n value: V\n /** Visible text — or, with an icon and `iconOnly`, the accessible name. */\n label: string\n icon?: Component | undefined\n /** Show the icon alone. The label becomes the button's accessible name. */\n iconOnly?: boolean | undefined\n disabled?: boolean | undefined\n }[]\n /** The group's accessible name. */\n label: string\n /** `single`: at most one pressed. `multiple`: any number. */\n mode?: M | undefined\n /** In `single` mode, never let the last pressed button go. */\n required?: boolean | undefined\n size?: 'sm' | 'md' | undefined\n}>()\n\n/** The pressed value — or, in `multiple` mode, the pressed values. */\nconst model = defineModel<M extends 'multiple' ? V[] : V | undefined>()\n\nconst buttons = ref<HTMLButtonElement[]>([])\n\nconst pressed = computed(() => {\n const value = model.value\n if (Array.isArray(value)) return new Set<V>(value)\n return new Set<V>(value === undefined ? [] : [value as V])\n})\n\nfunction toggle(value: V) {\n if (mode === 'multiple') {\n const next = new Set(pressed.value)\n if (next.has(value)) next.delete(value)\n else next.add(value)\n // In the order of the options, not the order of the presses, so the\n // value reads the same however the reader got there.\n model.value = options\n .map((option) => option.value)\n .filter((v) => next.has(v)) as typeof model.value\n return\n }\n\n const isPressed = pressed.value.has(value)\n if (isPressed && required) return\n model.value = (isPressed ? undefined : value) as typeof model.value\n}\n\n/* The one button Tab lands on: the first pressed one, else the first that\n can be pressed at all. */\nconst tabStop = computed(() => {\n const enabled = options.filter((option) => !option.disabled)\n return (enabled.find((option) => pressed.value.has(option.value)) ?? enabled[0])?.value\n})\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n const step = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[event.key]\n const enabled = buttons.value.filter((button) => !button.disabled)\n let target: HTMLButtonElement | undefined\n\n if (step !== undefined) {\n const at = enabled.indexOf(buttons.value[index]!)\n target = enabled[(at + step + enabled.length) % enabled.length]\n } else if (event.key === 'Home') target = enabled[0]\n else if (event.key === 'End') target = enabled[enabled.length - 1]\n else return\n\n event.preventDefault()\n target?.focus()\n}\n</script>\n\n<template>\n <div class=\"rk-toggles control\" :class=\"`is-${size}`\" role=\"group\" :aria-label=\"label\">\n <button\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n ref=\"buttons\"\n type=\"button\"\n class=\"rk-toggle focus-ring\"\n :aria-pressed=\"pressed.has(option.value)\"\n :aria-label=\"option.iconOnly ? option.label : undefined\"\n :disabled=\"option.disabled\"\n :tabindex=\"option.value === tabStop ? 0 : -1\"\n @click=\"toggle(option.value)\"\n @keydown=\"onKeydown($event, index)\"\n >\n <component :is=\"option.icon\" v-if=\"option.icon\" class=\"rk-toggle-icon\" aria-hidden=\"true\" />\n <span v-if=\"!option.iconOnly\">{{ option.label }}</span>\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-toggles {\n display: inline-flex;\n flex-wrap: wrap;\n gap: 2px;\n border-radius: var(--radius-card);\n padding: 3px;\n}\n\n.rk-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n min-width: 2.25rem;\n height: 2.25rem;\n border-radius: calc(var(--radius-card) - 3px);\n padding: 0 0.75rem;\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.is-sm .rk-toggle {\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.625rem;\n font-size: 0.8125rem;\n}\n\n.rk-toggle:hover:not(:disabled) {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-toggle[aria-pressed='true'] {\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.rk-toggle:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n}\n\n.rk-toggle-icon {\n width: 1rem;\n height: 1rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Minus, Plus } from 'lucide-vue-next'\nimport { computed, ref, watch } from 'vue'\n\nimport FormField from './FormField.vue'\n\n/**\n * A number, typed or stepped — a quantity, a price, a count of minutes.\n *\n * `<input type=\"number\">` is what everyone reaches for and nearly everyone\n * regrets: it accepts \"e\", scrolls the value when the page is scrolled over\n * it, and hands back an empty string for anything it does not like. This is\n * a text field that only settles on numbers, with a minus and a plus beside\n * it, and the spin-button keyboard: arrows step, Page Up and Down step ten\n * at a time, Home and End go to the limits.\n *\n * Typing is free while the field has focus — \"-\", \"1.\" and \"\" are all fine\n * halfway through a number. On leaving it, the value is clamped to `min` and\n * `max` and rounded to the precision of `step`, so 0.1 + 0.2 lands on 0.3.\n */\nconst {\n label,\n min = -Infinity,\n max = Infinity,\n step = 1,\n decrementLabel,\n incrementLabel,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n /** One press of a button or an arrow key. Its decimals set the rounding. */\n step?: number | undefined\n /** Accessible name of the minus button, e.g. \"Decrease\". */\n decrementLabel: string\n /** Accessible name of the plus button, e.g. \"Increase\". */\n incrementLabel: string\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/** The number, with `v-model`. `undefined` while the field is empty. */\nconst model = defineModel<number | undefined>()\n\nconst places = computed(() => (String(step).split('.')[1] ?? '').length)\n\nconst settle = (value: number) =>\n Number(Math.min(max, Math.max(min, value)).toFixed(Math.min(places.value, 20)))\n\n/* What the field shows. Kept apart from the model so a half-typed \"1.\" is\n not rewritten to \"1\" under the reader's cursor. */\nconst draft = ref(model.value === undefined ? '' : String(model.value))\n\nwatch(model, (value) => {\n const shown = draft.value === '' ? undefined : Number(draft.value)\n if (shown !== value) draft.value = value === undefined ? '' : String(value)\n})\n\nfunction onInput(event: Event) {\n const text = (event.target as HTMLInputElement).value.replace(',', '.')\n draft.value = text\n if (text.trim() === '') {\n model.value = undefined\n return\n }\n\n const value = Number(text)\n if (Number.isFinite(value)) model.value = value\n}\n\nfunction commit() {\n if (model.value === undefined) {\n draft.value = ''\n return\n }\n setTo(model.value)\n}\n\nfunction setTo(value: number) {\n model.value = settle(value)\n draft.value = String(model.value)\n}\n\nfunction stepBy(times: number) {\n if (disabled) return\n const start = model.value ?? (Number.isFinite(min) ? min : 0)\n setTo(start + step * times)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(10),\n PageDown: () => stepBy(-10),\n Home: () => {\n if (Number.isFinite(min)) setTo(min)\n },\n End: () => {\n if (Number.isFinite(max)) setTo(max)\n },\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n}\n\nconst atMin = computed(() => model.value !== undefined && model.value <= min)\nconst atMax = computed(() => model.value !== undefined && model.value >= max)\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <div class=\"rk-number control\" :class=\"{ 'is-invalid': invalid, 'is-disabled': disabled }\">\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"decrementLabel\"\n :disabled=\"disabled || atMin\"\n tabindex=\"-1\"\n @click=\"stepBy(-1)\"\n >\n <Minus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n <input\n :id=\"id\"\n :value=\"draft\"\n type=\"text\"\n inputmode=\"decimal\"\n role=\"spinbutton\"\n autocomplete=\"off\"\n class=\"rk-number-field\"\n :aria-valuenow=\"model\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @input=\"onInput\"\n @blur=\"commit\"\n @keydown=\"onKeydown\"\n />\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"incrementLabel\"\n :disabled=\"disabled || atMax\"\n tabindex=\"-1\"\n @click=\"stepBy(1)\"\n >\n <Plus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n/* The buttons are out of the Tab order: the keyboard already has the arrows,\n and three stops for one number is two too many. They stay reachable by\n pointer and by touch, which is who they are for. */\n.rk-number {\n display: flex;\n align-items: center;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 0.25rem;\n}\n\n.rk-number:focus-within {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n.rk-number.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-number.is-disabled {\n opacity: 0.5;\n}\n\n.rk-number-field {\n min-width: 0;\n flex: 1;\n background: transparent;\n text-align: center;\n font-size: 1rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n outline: none;\n}\n\n.rk-number-step {\n display: grid;\n width: 2.25rem;\n height: 2.25rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: calc(var(--radius-card) - 4px);\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-number-step:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-number-step:disabled {\n opacity: 0.35;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Minus, Plus } from 'lucide-vue-next'\nimport { computed, ref, watch } from 'vue'\n\nimport FormField from './FormField.vue'\n\n/**\n * A number, typed or stepped — a quantity, a price, a count of minutes.\n *\n * `<input type=\"number\">` is what everyone reaches for and nearly everyone\n * regrets: it accepts \"e\", scrolls the value when the page is scrolled over\n * it, and hands back an empty string for anything it does not like. This is\n * a text field that only settles on numbers, with a minus and a plus beside\n * it, and the spin-button keyboard: arrows step, Page Up and Down step ten\n * at a time, Home and End go to the limits.\n *\n * Typing is free while the field has focus — \"-\", \"1.\" and \"\" are all fine\n * halfway through a number. On leaving it, the value is clamped to `min` and\n * `max` and rounded to the precision of `step`, so 0.1 + 0.2 lands on 0.3.\n */\nconst {\n label,\n min = -Infinity,\n max = Infinity,\n step = 1,\n decrementLabel,\n incrementLabel,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n /** One press of a button or an arrow key. Its decimals set the rounding. */\n step?: number | undefined\n /** Accessible name of the minus button, e.g. \"Decrease\". */\n decrementLabel: string\n /** Accessible name of the plus button, e.g. \"Increase\". */\n incrementLabel: string\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/** The number, with `v-model`. `undefined` while the field is empty. */\nconst model = defineModel<number | undefined>()\n\nconst places = computed(() => (String(step).split('.')[1] ?? '').length)\n\nconst settle = (value: number) =>\n Number(Math.min(max, Math.max(min, value)).toFixed(Math.min(places.value, 20)))\n\n/* What the field shows. Kept apart from the model so a half-typed \"1.\" is\n not rewritten to \"1\" under the reader's cursor. */\nconst draft = ref(model.value === undefined ? '' : String(model.value))\n\nwatch(model, (value) => {\n const shown = draft.value === '' ? undefined : Number(draft.value)\n if (shown !== value) draft.value = value === undefined ? '' : String(value)\n})\n\nfunction onInput(event: Event) {\n const text = (event.target as HTMLInputElement).value.replace(',', '.')\n draft.value = text\n if (text.trim() === '') {\n model.value = undefined\n return\n }\n\n const value = Number(text)\n if (Number.isFinite(value)) model.value = value\n}\n\nfunction commit() {\n if (model.value === undefined) {\n draft.value = ''\n return\n }\n setTo(model.value)\n}\n\nfunction setTo(value: number) {\n model.value = settle(value)\n draft.value = String(model.value)\n}\n\nfunction stepBy(times: number) {\n if (disabled) return\n const start = model.value ?? (Number.isFinite(min) ? min : 0)\n setTo(start + step * times)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(10),\n PageDown: () => stepBy(-10),\n Home: () => {\n if (Number.isFinite(min)) setTo(min)\n },\n End: () => {\n if (Number.isFinite(max)) setTo(max)\n },\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n}\n\nconst atMin = computed(() => model.value !== undefined && model.value <= min)\nconst atMax = computed(() => model.value !== undefined && model.value >= max)\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <div class=\"rk-number control\" :class=\"{ 'is-invalid': invalid, 'is-disabled': disabled }\">\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"decrementLabel\"\n :disabled=\"disabled || atMin\"\n tabindex=\"-1\"\n @click=\"stepBy(-1)\"\n >\n <Minus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n <input\n :id=\"id\"\n :value=\"draft\"\n type=\"text\"\n inputmode=\"decimal\"\n role=\"spinbutton\"\n autocomplete=\"off\"\n class=\"rk-number-field\"\n :aria-valuenow=\"model\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @input=\"onInput\"\n @blur=\"commit\"\n @keydown=\"onKeydown\"\n />\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"incrementLabel\"\n :disabled=\"disabled || atMax\"\n tabindex=\"-1\"\n @click=\"stepBy(1)\"\n >\n <Plus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n/* The buttons are out of the Tab order: the keyboard already has the arrows,\n and three stops for one number is two too many. They stay reachable by\n pointer and by touch, which is who they are for. */\n.rk-number {\n display: flex;\n align-items: center;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 0.25rem;\n}\n\n.rk-number:focus-within {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n.rk-number.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-number.is-disabled {\n opacity: 0.5;\n}\n\n.rk-number-field {\n min-width: 0;\n flex: 1;\n background: transparent;\n text-align: center;\n font-size: 1rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n outline: none;\n}\n\n.rk-number-step {\n display: grid;\n width: 2.25rem;\n height: 2.25rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: calc(var(--radius-card) - 4px);\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-number-step:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-number-step:disabled {\n opacity: 0.35;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, useId } from 'vue'\n\n/**\n * A short code typed one character per box — a sign-in code, a PIN.\n *\n * No `maxlength` on the boxes: iOS fills a one-time code into the first box\n * in one go, and a limit of one would cut it to its first digit.\n *\n * The boxes are a way of showing the length, not of splitting the work:\n * typing moves to the next box on its own, Backspace on an empty box goes\n * back and clears, the arrows move, and pasting \"482913\" anywhere fills all\n * six. The first box carries `autocomplete=\"one-time-code\"`, so a phone\n * offers the code from the message it just received.\n *\n * `complete` fires once when the last box is filled — the moment to submit,\n * so nobody has to find a button after typing six digits.\n */\nconst {\n length = 6,\n label,\n cellLabel,\n type = 'numeric',\n mask = false,\n error = '',\n disabled = false,\n} = defineProps<{\n /** How many characters. */\n length?: number | undefined\n /** The group's accessible name, e.g. \"Verification code\". */\n label: string\n /** Each box's accessible name, from its 1-based position: `(n, total) => \\`Digit ${n} of ${total}\\``. */\n cellLabel: (position: number, total: number) => string\n /** `numeric` takes digits and opens the number pad; `alphanumeric` takes letters too. */\n type?: 'numeric' | 'alphanumeric' | undefined\n /** Show dots instead of the characters, for a PIN. */\n mask?: boolean | undefined\n /** A message under the boxes; also marks them invalid. */\n error?: string | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ complete: [code: string] }>()\n\n/** The code so far, with `v-model`. Always shorter than or as long as `length`. */\nconst model = defineModel<string>({ default: '' })\n\nconst cells = ref<HTMLInputElement[]>([])\nconst errorId = useId()\n\nconst allowed = computed(() => (type === 'numeric' ? /[0-9]/ : /[0-9a-z]/i))\nconst chars = computed(() => Array.from({ length }, (_, i) => model.value[i] ?? ''))\n\nfunction clean(text: string) {\n return Array.from(text)\n .filter((char) => allowed.value.test(char))\n .join('')\n}\n\nfunction write(next: string) {\n const code = next.slice(0, length)\n const wasComplete = model.value.length === length\n model.value = code\n if (code.length === length && !wasComplete) emit('complete', code)\n}\n\nfunction focusCell(index: number) {\n const cell = cells.value[Math.max(0, Math.min(length - 1, index))]\n cell?.focus()\n cell?.select()\n}\n\nfunction onInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement\n const typed = clean(input.value)\n\n // More than one character arrived: autofill or a paste the browser routed\n // through input. Either way it is the code, from this box on.\n if (typed.length > 1) {\n write(model.value.slice(0, index) + typed)\n focusCell(index + typed.length)\n return\n }\n\n input.value = typed\n if (!typed) return\n\n // The code has no gaps: a character typed into a box past the end lands at\n // the end, and focus follows it.\n const at = Math.min(index, model.value.length)\n write(model.value.slice(0, at) + typed + model.value.slice(at + 1))\n focusCell(at + 1)\n}\n\nfunction onPaste(event: ClipboardEvent, index: number) {\n const text = clean(event.clipboardData?.getData('text') ?? '')\n if (!text) return\n\n event.preventDefault()\n write(model.value.slice(0, index) + text)\n focusCell(index + text.length)\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (event.key === 'Backspace') {\n event.preventDefault()\n const target = chars.value[index] ? index : index - 1\n if (target < 0) return\n write(model.value.slice(0, target) + model.value.slice(target + 1))\n focusCell(target)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusCell(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusCell(index + 1)\n }\n}\n</script>\n\n<template>\n <div class=\"rk-pin\">\n <div class=\"rk-pin-cells\" role=\"group\" :aria-label=\"label\">\n <input\n v-for=\"(char, index) in chars\"\n :key=\"index\"\n ref=\"cells\"\n class=\"rk-pin-cell control focus-ring\"\n :class=\"{ 'is-invalid': error }\"\n :value=\"char\"\n :type=\"mask ? 'password' : 'text'\"\n :inputmode=\"type === 'numeric' ? 'numeric' : 'text'\"\n :autocomplete=\"index === 0 ? 'one-time-code' : 'off'\"\n :aria-label=\"cellLabel(index + 1, length)\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"error ? errorId : undefined\"\n :disabled=\"disabled\"\n @input=\"onInput($event, index)\"\n @paste=\"onPaste($event, index)\"\n @keydown=\"onKeydown($event, index)\"\n @focus=\"($event.target as HTMLInputElement).select()\"\n />\n </div>\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-pin-error\" role=\"alert\">{{ error }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-pin-cells {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-pin-cell {\n width: 2.75rem;\n height: 3.25rem;\n border-radius: var(--radius-card);\n text-align: center;\n font-size: 1.375rem;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n caret-color: var(--color-primary);\n}\n\n.rk-pin-cell.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-pin-cell:disabled {\n opacity: 0.5;\n}\n\n.rk-pin-error {\n margin-top: 0.5rem;\n font-size: 0.8125rem;\n color: var(--color-negative);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, useId } from 'vue'\n\n/**\n * A short code typed one character per box — a sign-in code, a PIN.\n *\n * No `maxlength` on the boxes: iOS fills a one-time code into the first box\n * in one go, and a limit of one would cut it to its first digit.\n *\n * The boxes are a way of showing the length, not of splitting the work:\n * typing moves to the next box on its own, Backspace on an empty box goes\n * back and clears, the arrows move, and pasting \"482913\" anywhere fills all\n * six. The first box carries `autocomplete=\"one-time-code\"`, so a phone\n * offers the code from the message it just received.\n *\n * `complete` fires once when the last box is filled — the moment to submit,\n * so nobody has to find a button after typing six digits.\n */\nconst {\n length = 6,\n label,\n cellLabel,\n type = 'numeric',\n mask = false,\n error = '',\n disabled = false,\n} = defineProps<{\n /** How many characters. */\n length?: number | undefined\n /** The group's accessible name, e.g. \"Verification code\". */\n label: string\n /** Each box's accessible name, from its 1-based position: `(n, total) => \\`Digit ${n} of ${total}\\``. */\n cellLabel: (position: number, total: number) => string\n /** `numeric` takes digits and opens the number pad; `alphanumeric` takes letters too. */\n type?: 'numeric' | 'alphanumeric' | undefined\n /** Show dots instead of the characters, for a PIN. */\n mask?: boolean | undefined\n /** A message under the boxes; also marks them invalid. */\n error?: string | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ complete: [code: string] }>()\n\n/** The code so far, with `v-model`. Always shorter than or as long as `length`. */\nconst model = defineModel<string>({ default: '' })\n\nconst cells = ref<HTMLInputElement[]>([])\nconst errorId = useId()\n\nconst allowed = computed(() => (type === 'numeric' ? /[0-9]/ : /[0-9a-z]/i))\nconst chars = computed(() => Array.from({ length }, (_, i) => model.value[i] ?? ''))\n\nfunction clean(text: string) {\n return Array.from(text)\n .filter((char) => allowed.value.test(char))\n .join('')\n}\n\nfunction write(next: string) {\n const code = next.slice(0, length)\n const wasComplete = model.value.length === length\n model.value = code\n if (code.length === length && !wasComplete) emit('complete', code)\n}\n\nfunction focusCell(index: number) {\n const cell = cells.value[Math.max(0, Math.min(length - 1, index))]\n cell?.focus()\n cell?.select()\n}\n\nfunction onInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement\n const typed = clean(input.value)\n\n // More than one character arrived: autofill or a paste the browser routed\n // through input. Either way it is the code, from this box on.\n if (typed.length > 1) {\n write(model.value.slice(0, index) + typed)\n focusCell(index + typed.length)\n return\n }\n\n input.value = typed\n if (!typed) return\n\n // The code has no gaps: a character typed into a box past the end lands at\n // the end, and focus follows it.\n const at = Math.min(index, model.value.length)\n write(model.value.slice(0, at) + typed + model.value.slice(at + 1))\n focusCell(at + 1)\n}\n\nfunction onPaste(event: ClipboardEvent, index: number) {\n const text = clean(event.clipboardData?.getData('text') ?? '')\n if (!text) return\n\n event.preventDefault()\n write(model.value.slice(0, index) + text)\n focusCell(index + text.length)\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (event.key === 'Backspace') {\n event.preventDefault()\n const target = chars.value[index] ? index : index - 1\n if (target < 0) return\n write(model.value.slice(0, target) + model.value.slice(target + 1))\n focusCell(target)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusCell(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusCell(index + 1)\n }\n}\n</script>\n\n<template>\n <div class=\"rk-pin\">\n <div class=\"rk-pin-cells\" role=\"group\" :aria-label=\"label\">\n <input\n v-for=\"(char, index) in chars\"\n :key=\"index\"\n ref=\"cells\"\n class=\"rk-pin-cell control focus-ring\"\n :class=\"{ 'is-invalid': error }\"\n :value=\"char\"\n :type=\"mask ? 'password' : 'text'\"\n :inputmode=\"type === 'numeric' ? 'numeric' : 'text'\"\n :autocomplete=\"index === 0 ? 'one-time-code' : 'off'\"\n :aria-label=\"cellLabel(index + 1, length)\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"error ? errorId : undefined\"\n :disabled=\"disabled\"\n @input=\"onInput($event, index)\"\n @paste=\"onPaste($event, index)\"\n @keydown=\"onKeydown($event, index)\"\n @focus=\"($event.target as HTMLInputElement).select()\"\n />\n </div>\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-pin-error\" role=\"alert\">{{ error }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-pin-cells {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-pin-cell {\n width: 2.75rem;\n height: 3.25rem;\n border-radius: var(--radius-card);\n text-align: center;\n font-size: 1.375rem;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n caret-color: var(--color-primary);\n}\n\n.rk-pin-cell.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-pin-cell:disabled {\n opacity: 0.5;\n}\n\n.rk-pin-error {\n margin-top: 0.5rem;\n font-size: 0.8125rem;\n color: var(--color-negative);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * Progress as a ring — for a small space, a card's corner, a goal.\n *\n * With a `value`, a promise about how far: the ring fills and, with\n * `showValue`, the percentage sits inside it. Without one, it says only\n * \"working\" and turns — the same distinction as `ProgressBar` and\n * `BaseSpinner`, in one shape. For a reader who asked for less motion the\n * turning ring breathes instead of spinning.\n *\n * The inside is a slot, so a ring can hold \"3/7\", an icon or nothing.\n */\nconst {\n value = undefined,\n max = 100,\n label,\n size = 'md',\n showValue = false,\n tone = 'primary',\n} = defineProps<{\n /** How far. Leave it out while there is nothing to measure. */\n value?: number | undefined\n max?: number | undefined\n /** The accessible name, e.g. \"Upload\". Required: a ring says nothing aloud on its own. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n /** The rounded percentage inside the ring. */\n showValue?: boolean | undefined\n tone?: 'primary' | 'accent' | 'positive' | 'warning' | 'negative' | undefined\n}>()\n\ndefineSlots<{\n /** Inside the ring, instead of the percentage. */\n default?: () => unknown\n}>()\n\nconst RADIUS = 20\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nconst indeterminate = computed(() => value === undefined)\n\n/* Clamped like ProgressBar: a negative, an overshoot and a zero `max` all\n stay inside the ring. */\nconst portion = computed(() => {\n if (value === undefined || max <= 0) return 0\n return Math.min(1, Math.max(0, value / max))\n})\n\nconst percent = computed(() => Math.round(portion.value * 100))\nconst offset = computed(() => CIRCUMFERENCE * (1 - (indeterminate.value ? 0.28 : portion.value)))\n</script>\n\n<template>\n <div\n class=\"rk-ring\"\n :class=\"[`is-${size}`, `is-${tone}`, { 'is-indeterminate': indeterminate }]\"\n role=\"progressbar\"\n :aria-label=\"label\"\n :aria-valuenow=\"indeterminate ? undefined : percent\"\n :aria-valuemin=\"indeterminate ? undefined : 0\"\n :aria-valuemax=\"indeterminate ? undefined : 100\"\n >\n <svg viewBox=\"0 0 48 48\" aria-hidden=\"true\">\n <circle class=\"rk-ring-track\" cx=\"24\" cy=\"24\" :r=\"RADIUS\" />\n <circle\n class=\"rk-ring-bar\"\n cx=\"24\"\n cy=\"24\"\n :r=\"RADIUS\"\n :stroke-dasharray=\"CIRCUMFERENCE\"\n :stroke-dashoffset=\"offset\"\n />\n </svg>\n <span v-if=\"$slots.default || (showValue && !indeterminate)\" class=\"rk-ring-inside\">\n <slot>{{ percent }}%</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n.rk-ring {\n position: relative;\n display: inline-grid;\n place-items: center;\n width: var(--rk-ring-size);\n height: var(--rk-ring-size);\n --rk-ring-size: 3rem;\n --rk-ring-colour: var(--color-primary);\n}\n\n.rk-ring.is-sm {\n --rk-ring-size: 1.75rem;\n}\n\n.rk-ring.is-lg {\n --rk-ring-size: 5rem;\n}\n\n.rk-ring.is-accent {\n --rk-ring-colour: var(--color-accent);\n}\n\n.rk-ring.is-positive {\n --rk-ring-colour: var(--color-positive);\n}\n\n.rk-ring.is-warning {\n --rk-ring-colour: var(--color-warning);\n}\n\n.rk-ring.is-negative {\n --rk-ring-colour: var(--color-negative);\n}\n\n.rk-ring svg {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n /* The ring starts at twelve o'clock, like a clock face, not at three. */\n rotate: -90deg;\n}\n\n.rk-ring-track,\n.rk-ring-bar {\n fill: none;\n stroke-width: 4;\n}\n\n.rk-ring-track {\n stroke: var(--color-muted);\n}\n\n.rk-ring-bar {\n stroke: var(--rk-ring-colour);\n stroke-linecap: round;\n transition: stroke-dashoffset var(--duration-slow) var(--ease-standard);\n}\n\n.rk-ring.is-indeterminate svg {\n animation: rk-ring-spin 0.9s linear infinite;\n}\n\n.rk-ring-inside {\n position: relative;\n font-size: calc(var(--rk-ring-size) * 0.26);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n}\n\n@keyframes rk-ring-spin {\n from {\n rotate: -90deg;\n }\n to {\n rotate: 270deg;\n }\n}\n\n@keyframes rk-ring-breathe {\n 50% {\n opacity: 0.4;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-ring.is-indeterminate svg {\n animation: rk-ring-breathe 1.6s ease-in-out infinite;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * Progress as a ring — for a small space, a card's corner, a goal.\n *\n * With a `value`, a promise about how far: the ring fills and, with\n * `showValue`, the percentage sits inside it. Without one, it says only\n * \"working\" and turns — the same distinction as `ProgressBar` and\n * `BaseSpinner`, in one shape. For a reader who asked for less motion the\n * turning ring breathes instead of spinning.\n *\n * The inside is a slot, so a ring can hold \"3/7\", an icon or nothing.\n */\nconst {\n value = undefined,\n max = 100,\n label,\n size = 'md',\n showValue = false,\n tone = 'primary',\n} = defineProps<{\n /** How far. Leave it out while there is nothing to measure. */\n value?: number | undefined\n max?: number | undefined\n /** The accessible name, e.g. \"Upload\". Required: a ring says nothing aloud on its own. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n /** The rounded percentage inside the ring. */\n showValue?: boolean | undefined\n tone?: 'primary' | 'accent' | 'positive' | 'warning' | 'negative' | undefined\n}>()\n\ndefineSlots<{\n /** Inside the ring, instead of the percentage. */\n default?: () => unknown\n}>()\n\nconst RADIUS = 20\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nconst indeterminate = computed(() => value === undefined)\n\n/* Clamped like ProgressBar: a negative, an overshoot and a zero `max` all\n stay inside the ring. */\nconst portion = computed(() => {\n if (value === undefined || max <= 0) return 0\n return Math.min(1, Math.max(0, value / max))\n})\n\nconst percent = computed(() => Math.round(portion.value * 100))\nconst offset = computed(() => CIRCUMFERENCE * (1 - (indeterminate.value ? 0.28 : portion.value)))\n</script>\n\n<template>\n <div\n class=\"rk-ring\"\n :class=\"[`is-${size}`, `is-${tone}`, { 'is-indeterminate': indeterminate }]\"\n role=\"progressbar\"\n :aria-label=\"label\"\n :aria-valuenow=\"indeterminate ? undefined : percent\"\n :aria-valuemin=\"indeterminate ? undefined : 0\"\n :aria-valuemax=\"indeterminate ? undefined : 100\"\n >\n <svg viewBox=\"0 0 48 48\" aria-hidden=\"true\">\n <circle class=\"rk-ring-track\" cx=\"24\" cy=\"24\" :r=\"RADIUS\" />\n <circle\n class=\"rk-ring-bar\"\n cx=\"24\"\n cy=\"24\"\n :r=\"RADIUS\"\n :stroke-dasharray=\"CIRCUMFERENCE\"\n :stroke-dashoffset=\"offset\"\n />\n </svg>\n <span v-if=\"$slots.default || (showValue && !indeterminate)\" class=\"rk-ring-inside\">\n <slot>{{ percent }}%</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n.rk-ring {\n position: relative;\n display: inline-grid;\n place-items: center;\n width: var(--rk-ring-size);\n height: var(--rk-ring-size);\n --rk-ring-size: 3rem;\n --rk-ring-colour: var(--color-primary);\n}\n\n.rk-ring.is-sm {\n --rk-ring-size: 1.75rem;\n}\n\n.rk-ring.is-lg {\n --rk-ring-size: 5rem;\n}\n\n.rk-ring.is-accent {\n --rk-ring-colour: var(--color-accent);\n}\n\n.rk-ring.is-positive {\n --rk-ring-colour: var(--color-positive);\n}\n\n.rk-ring.is-warning {\n --rk-ring-colour: var(--color-warning);\n}\n\n.rk-ring.is-negative {\n --rk-ring-colour: var(--color-negative);\n}\n\n.rk-ring svg {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n /* The ring starts at twelve o'clock, like a clock face, not at three. */\n rotate: -90deg;\n}\n\n.rk-ring-track,\n.rk-ring-bar {\n fill: none;\n stroke-width: 4;\n}\n\n.rk-ring-track {\n stroke: var(--color-muted);\n}\n\n.rk-ring-bar {\n stroke: var(--rk-ring-colour);\n stroke-linecap: round;\n transition: stroke-dashoffset var(--duration-slow) var(--ease-standard);\n}\n\n.rk-ring.is-indeterminate svg {\n animation: rk-ring-spin 0.9s linear infinite;\n}\n\n.rk-ring-inside {\n position: relative;\n font-size: calc(var(--rk-ring-size) * 0.26);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n}\n\n@keyframes rk-ring-spin {\n from {\n rotate: -90deg;\n }\n to {\n rotate: 270deg;\n }\n}\n\n@keyframes rk-ring-breathe {\n 50% {\n opacity: 0.4;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-ring.is-indeterminate svg {\n animation: rk-ring-breathe 1.6s ease-in-out infinite;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { Check, X } from 'lucide-vue-next'\nimport { computed } from 'vue'\n\nexport interface StepperStep<K extends string> {\n key: K\n /** Already translated. */\n label: string\n /** A line under the label: what the step asks for. */\n description?: string | undefined\n /** Marks a step that needs fixing — a form page with errors on it. */\n error?: boolean | undefined\n}\n\n/**\n * Where someone is in a process of several steps — a sign-up, a checkout, a\n * form split into pages.\n *\n * It shows the way, it does not drive it: the current step is a `v-model`,\n * and the pages and the Next and Back buttons are the app's. With\n * `interactive`, a step already done can be clicked to go back to it; steps\n * ahead never can, because skipping ahead is how a form arrives half filled.\n *\n * An ordered list, with `aria-current=\"step\"` on the step in progress, so a\n * screen reader hears \"step 2 of 4, current\" without the kit inventing a\n * sentence. The words for done and needs-fixing are the app's, passed in\n * `stateLabels`, and read only to assistive tech.\n */\nconst {\n steps,\n label,\n orientation = 'horizontal',\n interactive = false,\n stateLabels = undefined,\n} = defineProps<{\n steps: readonly StepperStep<K>[]\n /** The list's accessible name, e.g. \"Checkout\". */\n label: string\n orientation?: 'horizontal' | 'vertical' | undefined\n /** Completed steps become buttons that go back to them. */\n interactive?: boolean | undefined\n /** Read to a screen reader after a step's label: `{ complete: 'done', error: 'needs attention' }`. */\n stateLabels?: { complete: string; error: string } | undefined\n}>()\n\n/** The step in progress, by key, with `v-model`. */\nconst current = defineModel<K>({ required: true })\n\nconst currentIndex = computed(() => steps.findIndex((step) => step.key === current.value))\n\n/* Only back: a step ahead is never a way in, or a form arrives half filled. */\nconst canGoTo = (index: number) => interactive && index < currentIndex.value\n\nfunction goTo(index: number) {\n if (canGoTo(index)) current.value = steps[index]!.key\n}\n\nfunction state(index: number) {\n const step = steps[index]!\n if (step.error) return 'error'\n if (index < currentIndex.value) return 'complete'\n if (index === currentIndex.value) return 'current'\n return 'upcoming'\n}\n</script>\n\n<template>\n <nav :aria-label=\"label\">\n <ol class=\"rk-steps\" :class=\"`is-${orientation}`\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"step.key\"\n class=\"rk-step\"\n :class=\"`is-${state(index)}`\"\n :aria-current=\"index === currentIndex ? 'step' : undefined\"\n >\n <component\n :is=\"canGoTo(index) ? 'button' : 'div'\"\n :type=\"canGoTo(index) ? 'button' : undefined\"\n class=\"rk-step-body\"\n :class=\"{ 'focus-ring is-clickable': canGoTo(index) }\"\n @click=\"goTo(index)\"\n >\n <span class=\"rk-step-mark\" aria-hidden=\"true\">\n <X v-if=\"state(index) === 'error'\" class=\"size-3.5\" />\n <Check v-else-if=\"state(index) === 'complete'\" class=\"size-3.5\" />\n <template v-else>{{ index + 1 }}</template>\n </span>\n <span class=\"rk-step-text\">\n <span class=\"rk-step-label\">{{ step.label }}</span>\n <span v-if=\"step.description\" class=\"rk-step-description\">{{ step.description }}</span>\n <span\n v-if=\"stateLabels && (state(index) === 'complete' || state(index) === 'error')\"\n class=\"sr-only\"\n >\n — {{ state(index) === 'error' ? stateLabels.error : stateLabels.complete }}\n </span>\n </span>\n </component>\n </li>\n </ol>\n </nav>\n</template>\n\n<style scoped>\n.rk-steps {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-steps.is-horizontal {\n align-items: flex-start;\n}\n\n.rk-steps.is-vertical {\n flex-direction: column;\n gap: 0;\n}\n\n.rk-step {\n position: relative;\n flex: 1;\n min-width: 0;\n}\n\n/* The connecting line, drawn from each step to the next. */\n.rk-step:not(:last-child)::after {\n content: '';\n position: absolute;\n background: var(--color-hair);\n transition: background-color var(--duration-base) var(--ease-standard);\n}\n\n.is-horizontal .rk-step:not(:last-child)::after {\n top: 0.875rem;\n left: calc(1.75rem + 0.5rem);\n right: 0.5rem;\n height: 2px;\n}\n\n.is-vertical .rk-step:not(:last-child)::after {\n top: 2.125rem;\n bottom: 0.25rem;\n left: 0.8125rem;\n width: 2px;\n}\n\n.rk-step.is-complete::after {\n background: var(--color-primary);\n}\n\n.rk-step-body {\n display: flex;\n align-items: flex-start;\n gap: 0.625rem;\n width: 100%;\n border-radius: var(--radius-cell);\n text-align: left;\n}\n\n.is-horizontal .rk-step-body {\n flex-direction: column;\n}\n\n.is-vertical .rk-step-body {\n padding-bottom: 1.5rem;\n}\n\n.rk-step-body.is-clickable {\n cursor: pointer;\n}\n\n.rk-step-mark {\n position: relative;\n z-index: 1;\n display: grid;\n width: 1.75rem;\n height: 1.75rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n border: 2px solid var(--color-hair);\n background: var(--color-surface);\n font-size: 0.75rem;\n font-weight: 700;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-base) var(--ease-standard),\n border-color var(--duration-base) var(--ease-standard),\n color var(--duration-base) var(--ease-standard);\n}\n\n.is-current .rk-step-mark {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n\n.is-complete .rk-step-mark {\n border-color: var(--color-primary);\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.is-error .rk-step-mark {\n border-color: var(--color-negative);\n background: var(--color-negative);\n color: var(--color-on-negative);\n}\n\n.is-clickable:hover .rk-step-mark {\n box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-primary) 18%, transparent);\n}\n\n.rk-step-text {\n display: flex;\n min-width: 0;\n flex-direction: column;\n gap: 0.125rem;\n padding-top: 0.25rem;\n}\n\n.rk-step-label {\n font-size: 0.8125rem;\n font-weight: 600;\n color: var(--color-ink-soft);\n}\n\n.is-current .rk-step-label,\n.is-complete .rk-step-label {\n color: var(--color-ink);\n}\n\n.is-error .rk-step-label {\n color: var(--color-negative);\n}\n\n.rk-step-description {\n font-size: 0.75rem;\n line-height: 1.4;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { Check, X } from 'lucide-vue-next'\nimport { computed } from 'vue'\n\nexport interface StepperStep<K extends string> {\n key: K\n /** Already translated. */\n label: string\n /** A line under the label: what the step asks for. */\n description?: string | undefined\n /** Marks a step that needs fixing — a form page with errors on it. */\n error?: boolean | undefined\n}\n\n/**\n * Where someone is in a process of several steps — a sign-up, a checkout, a\n * form split into pages.\n *\n * It shows the way, it does not drive it: the current step is a `v-model`,\n * and the pages and the Next and Back buttons are the app's. With\n * `interactive`, a step already done can be clicked to go back to it; steps\n * ahead never can, because skipping ahead is how a form arrives half filled.\n *\n * An ordered list, with `aria-current=\"step\"` on the step in progress, so a\n * screen reader hears \"step 2 of 4, current\" without the kit inventing a\n * sentence. The words for done and needs-fixing are the app's, passed in\n * `stateLabels`, and read only to assistive tech.\n */\nconst {\n steps,\n label,\n orientation = 'horizontal',\n interactive = false,\n stateLabels = undefined,\n} = defineProps<{\n steps: readonly StepperStep<K>[]\n /** The list's accessible name, e.g. \"Checkout\". */\n label: string\n orientation?: 'horizontal' | 'vertical' | undefined\n /** Completed steps become buttons that go back to them. */\n interactive?: boolean | undefined\n /** Read to a screen reader after a step's label: `{ complete: 'done', error: 'needs attention' }`. */\n stateLabels?: { complete: string; error: string } | undefined\n}>()\n\n/** The step in progress, by key, with `v-model`. */\nconst current = defineModel<K>({ required: true })\n\nconst currentIndex = computed(() => steps.findIndex((step) => step.key === current.value))\n\n/* Only back: a step ahead is never a way in, or a form arrives half filled. */\nconst canGoTo = (index: number) => interactive && index < currentIndex.value\n\nfunction goTo(index: number) {\n if (canGoTo(index)) current.value = steps[index]!.key\n}\n\nfunction state(index: number) {\n const step = steps[index]!\n if (step.error) return 'error'\n if (index < currentIndex.value) return 'complete'\n if (index === currentIndex.value) return 'current'\n return 'upcoming'\n}\n</script>\n\n<template>\n <nav :aria-label=\"label\">\n <ol class=\"rk-steps\" :class=\"`is-${orientation}`\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"step.key\"\n class=\"rk-step\"\n :class=\"`is-${state(index)}`\"\n :aria-current=\"index === currentIndex ? 'step' : undefined\"\n >\n <component\n :is=\"canGoTo(index) ? 'button' : 'div'\"\n :type=\"canGoTo(index) ? 'button' : undefined\"\n class=\"rk-step-body\"\n :class=\"{ 'focus-ring is-clickable': canGoTo(index) }\"\n @click=\"goTo(index)\"\n >\n <span class=\"rk-step-mark\" aria-hidden=\"true\">\n <X v-if=\"state(index) === 'error'\" class=\"size-3.5\" />\n <Check v-else-if=\"state(index) === 'complete'\" class=\"size-3.5\" />\n <template v-else>{{ index + 1 }}</template>\n </span>\n <span class=\"rk-step-text\">\n <span class=\"rk-step-label\">{{ step.label }}</span>\n <span v-if=\"step.description\" class=\"rk-step-description\">{{ step.description }}</span>\n <span\n v-if=\"stateLabels && (state(index) === 'complete' || state(index) === 'error')\"\n class=\"sr-only\"\n >\n — {{ state(index) === 'error' ? stateLabels.error : stateLabels.complete }}\n </span>\n </span>\n </component>\n </li>\n </ol>\n </nav>\n</template>\n\n<style scoped>\n.rk-steps {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-steps.is-horizontal {\n align-items: flex-start;\n}\n\n.rk-steps.is-vertical {\n flex-direction: column;\n gap: 0;\n}\n\n.rk-step {\n position: relative;\n flex: 1;\n min-width: 0;\n}\n\n/* The connecting line, drawn from each step to the next. */\n.rk-step:not(:last-child)::after {\n content: '';\n position: absolute;\n background: var(--color-hair);\n transition: background-color var(--duration-base) var(--ease-standard);\n}\n\n.is-horizontal .rk-step:not(:last-child)::after {\n top: 0.875rem;\n left: calc(1.75rem + 0.5rem);\n right: 0.5rem;\n height: 2px;\n}\n\n.is-vertical .rk-step:not(:last-child)::after {\n top: 2.125rem;\n bottom: 0.25rem;\n left: 0.8125rem;\n width: 2px;\n}\n\n.rk-step.is-complete::after {\n background: var(--color-primary);\n}\n\n.rk-step-body {\n display: flex;\n align-items: flex-start;\n gap: 0.625rem;\n width: 100%;\n border-radius: var(--radius-cell);\n text-align: left;\n}\n\n.is-horizontal .rk-step-body {\n flex-direction: column;\n}\n\n.is-vertical .rk-step-body {\n padding-bottom: 1.5rem;\n}\n\n.rk-step-body.is-clickable {\n cursor: pointer;\n}\n\n.rk-step-mark {\n position: relative;\n z-index: 1;\n display: grid;\n width: 1.75rem;\n height: 1.75rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n border: 2px solid var(--color-hair);\n background: var(--color-surface);\n font-size: 0.75rem;\n font-weight: 700;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-base) var(--ease-standard),\n border-color var(--duration-base) var(--ease-standard),\n color var(--duration-base) var(--ease-standard);\n}\n\n.is-current .rk-step-mark {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n\n.is-complete .rk-step-mark {\n border-color: var(--color-primary);\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.is-error .rk-step-mark {\n border-color: var(--color-negative);\n background: var(--color-negative);\n color: var(--color-on-negative);\n}\n\n.is-clickable:hover .rk-step-mark {\n box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-primary) 18%, transparent);\n}\n\n.rk-step-text {\n display: flex;\n min-width: 0;\n flex-direction: column;\n gap: 0.125rem;\n padding-top: 0.25rem;\n}\n\n.rk-step-label {\n font-size: 0.8125rem;\n font-weight: 600;\n color: var(--color-ink-soft);\n}\n\n.is-current .rk-step-label,\n.is-complete .rk-step-label {\n color: var(--color-ink);\n}\n\n.is-error .rk-step-label {\n color: var(--color-negative);\n}\n\n.rk-step-description {\n font-size: 0.75rem;\n line-height: 1.4;\n color: var(--color-ink-soft);\n}\n</style>\n","import { computed, ref, watchEffect } from 'vue'\nimport { createI18n } from 'vue-i18n'\n\nimport { setFormatLocale } from '../utils/format'\n\n/** What the user picked. `system` re-reads the browser on every launch. */\nexport type LocalePreference<L extends string> = 'system' | L\n\nexport interface I18nRuntimeOptions<L extends string, Schema> {\n /** Languages the app ships, in no particular order. */\n locales: readonly L[]\n /** The one that is always loaded, and the fallback when a load fails. */\n fallback: L\n /**\n * BCP 47 tag per locale, for `Intl`.\n *\n * Message lookup only needs the base language, but dates and numbers need a\n * region to be right — `zh` alone would leave the formatter to guess.\n */\n intlTags: Record<L, string>\n /** The fallback's messages, bundled. */\n messages: Schema\n /** The rest, fetched only when they are the one in use. */\n loaders?: Partial<Record<L, () => Promise<{ default: Schema }>>>\n /** Where the choice is stored. Namespace it per app. */\n storageKey?: string\n}\n\n/**\n * Builds an i18n runtime around an app's own catalogue.\n *\n * A factory rather than a module singleton because the schema is the app's:\n * typing every locale as `typeof en` is what makes a missing key a build error,\n * and this package has no `en` of its own to type against.\n *\n * @example\n * ```ts\n * export const { i18n, t, useLocalePreference, loadActiveLocale } =\n * createI18nRuntime({\n * locales: ['en', 'tr'] as const,\n * fallback: 'en',\n * intlTags: { en: 'en-GB', tr: 'tr-TR' },\n * messages: en,\n * loaders: { tr: () => import('./locales/tr') },\n * storageKey: 'myapp-locale',\n * })\n * ```\n */\nexport function createI18nRuntime<L extends string, Schema extends Record<string, unknown>>(\n options: I18nRuntimeOptions<L, Schema>,\n) {\n const { locales, fallback, intlTags, messages, storageKey = 'rei-locale' } = options\n\n // Typed rather than defaulted to `{}`, which erases the locale keys and makes\n // `loaders[locale]` an index into an empty object.\n const loaders: Partial<Record<L, () => Promise<{ default: Schema }>>> = options.loaders ?? {}\n\n function isSupported(value: string): value is L {\n return (locales as readonly string[]).includes(value)\n }\n\n /**\n * First browser language the app can actually speak.\n *\n * `navigator.languages` is ordered by the user's own preference, so the first\n * match is the best one — not simply the first entry.\n */\n function detectSystemLocale(): L {\n // No browser to ask. The fallback is the right answer on a server: it is\n // the locale whose messages are bundled, so it is the only one that could\n // render without a load.\n //\n // The test is `document`, not `navigator`. Node has shipped a global\n // `navigator` since v21, so `typeof navigator === 'undefined'` is false on\n // a server and this would read the *build machine's* language and bake it\n // into every prerendered page. `document` is the only one of the two that\n // still means \"a browser\".\n if (typeof document === 'undefined') return fallback\n\n for (const tag of navigator.languages ?? [navigator.language]) {\n const base = tag.split('-')[0]?.toLowerCase()\n if (base && isSupported(base)) return base\n }\n\n return fallback\n }\n\n function readStored(): LocalePreference<L> {\n try {\n const stored = localStorage.getItem(storageKey)\n if (stored === 'system' || (stored && isSupported(stored))) return stored\n } catch {\n // Storage blocked; fall through to the system language.\n }\n\n return 'system'\n }\n\n const preference = ref<LocalePreference<L>>(readStored())\n\n const activeLocale = computed<L>(() =>\n preference.value === 'system' ? detectSystemLocale() : (preference.value as L),\n )\n\n const intlLocale = computed(() => intlTags[activeLocale.value])\n\n // Only the fallback at construction; the rest arrive through\n // setLocaleMessage.\n const initial = { [fallback]: messages } as Record<string, Record<string, unknown>>\n\n const i18n = createI18n({\n legacy: false,\n locale: activeLocale.value as string,\n fallbackLocale: fallback as string,\n messages: initial,\n } as unknown as Parameters<typeof createI18n>[0])\n\n /**\n * A narrow view of the instance.\n *\n * vue-i18n infers its own generics from the messages it is handed, which\n * fights a runtime that is generic over the app's schema. Casting once, here,\n * keeps that fight out of every call site — and the surface below is the\n * whole of what this runtime uses.\n */\n const core = i18n.global as unknown as {\n locale: { value: string }\n setLocaleMessage: (locale: string, messages: Schema) => void\n t: (key: string, named?: Record<string, unknown>) => string\n }\n\n const loaded = new Set<L>([fallback])\n\n /**\n * Makes sure a locale's messages are in place before it becomes active.\n *\n * Awaited rather than fired and forgotten: setting the locale first paints one\n * frame of the fallback at every other user, which is the flash a fallback\n * exists to prevent, not cause.\n */\n async function ensureMessages(locale: L): Promise<void> {\n if (loaded.has(locale)) return\n\n const load = loaders[locale]\n if (!load) return\n\n try {\n const module = await load()\n core.setLocaleMessage(locale, module.default)\n loaded.add(locale)\n } catch {\n // Offline, or a stale chunk after a deploy. The fallback is loaded and\n // will carry the UI, which beats a blank screen.\n }\n }\n\n /** Loads whatever the stored preference resolves to. Call before mounting. */\n function loadActiveLocale(): Promise<void> {\n return ensureMessages(activeLocale.value)\n }\n\n // Keeps vue-i18n, `Intl` and the document in step. `lang` matters beyond\n // tidiness: it drives hyphenation, font fallback and screen readers.\n watchEffect(() => {\n core.locale.value = activeLocale.value\n setFormatLocale(intlLocale.value)\n\n if (typeof document !== 'undefined') {\n document.documentElement.lang = activeLocale.value\n }\n })\n\n /** Read and write the language preference. */\n function useLocalePreference() {\n return computed<LocalePreference<L>>({\n get: () => preference.value,\n set: (next) => {\n const resolved = next === 'system' ? detectSystemLocale() : (next as L)\n\n // Messages first, then the switch — the other order shows the fallback\n // for a frame on the way to the language the user just picked.\n void ensureMessages(resolved).then(() => {\n preference.value = next\n })\n\n try {\n localStorage.setItem(storageKey, next)\n } catch {\n // Storage blocked; the choice lasts for this session only.\n }\n },\n })\n }\n\n return {\n i18n,\n /** `t` for code outside a component. Tracks the locale inside a computed. */\n t: core.t,\n activeLocale,\n intlLocale,\n ensureMessages,\n loadActiveLocale,\n useLocalePreference,\n }\n}\n","/**\n * rei-kit — the layer every app starts from.\n *\n * Everything here is free of any backend, router or i18n choice. Components\n * take strings rather than calling a translator, and utilities take the clock\n * rather than reading it, so nothing in this package can force a decision on\n * the app that installs it.\n *\n * @see https://github.com/ramazandogna/rei-kit\n */\n\n/**\n * The published version, replaced at build time from `package.json`.\n *\n * It was a literal `'0.0.0'` and nothing ever rewrote it, so every consumer\n * that imported this — and the showcase, which is how it was noticed — was\n * told the kit was at 0.0.0 whatever it actually was. A symbol in a public API\n * that reports something false is worse than one that is missing: nobody\n * checks a value that looks like it works.\n *\n * The fallback keeps `vitest` and `vite dev` honest, where no define runs.\n */\nexport const VERSION: string =\n typeof __REI_KIT_VERSION__ === 'string' ? __REI_KIT_VERSION__ : '0.0.0-dev'\n\n// ── Utilities ──────────────────────────────────────────────────────────────\nexport {\n addDays,\n eachDayOfYear,\n fromDateKey,\n lastNDays,\n leadingBlanks,\n startOfWeek,\n toDateKey,\n todayKey,\n} from './utils/date'\nexport type { WeekStart } from './utils/date'\n\nexport { formatDate, formatNumber, setFormatLocale } from './utils/format'\nexport { relativeDayLabel } from './utils/day-label'\nexport type { DayLabels } from './utils/day-label'\n\nexport { downloadJson } from './utils/download'\nexport {\n MATERIALS,\n PALETTES,\n applyMaterial,\n applyPalette,\n isMaterial,\n isPaletteName,\n setMaterialStorageKey,\n setPaletteStorageKey,\n useMaterial,\n usePalette,\n} from './utils/appearance'\nexport type { Material, Palette, PaletteName, PaletteRoles } from './utils/appearance'\nexport { ensureSheetRoot, SHEET_ROOT_ID } from './utils/sheet-root'\nexport { safeRedirect, toRedirectPath } from './utils/redirect'\nexport type { QueryValue } from './utils/redirect'\nexport { tapFeedback } from './utils/haptics'\nexport { isApplePortable, isInstalled, needsIosInstall } from './utils/platform'\n\nexport { AppError, registerErrorMapper, toAppError } from './utils/app-error'\nexport type { AppErrorKind, ErrorMapper } from './utils/app-error'\n\n// ── Composables ────────────────────────────────────────────────────────────\nexport {\n applyTheme,\n isThemePreference,\n readStoredTheme,\n setThemeStorageKey,\n useTheme,\n} from './composables/use-theme'\nexport type { ThemePreference } from './composables/use-theme'\n\nexport { useToday } from './composables/use-today'\nexport { useOnline } from './composables/use-online'\nexport { useDebouncedCallback } from './composables/use-debounced-callback'\nexport { useDragScroll } from './composables/use-drag-scroll'\nexport { useMediaQuery } from './composables/use-media-query'\nexport { useVisualViewport } from './composables/use-visual-viewport'\nexport { useToast } from './composables/use-toast'\nexport type { Toast, ToastAction, ToastOptions, ToastTone } from './composables/use-toast'\nexport type { VisualViewportRect } from './composables/use-visual-viewport'\n\n// ── Components ─────────────────────────────────────────────────────────────\nexport { default as BaseAvatar } from './components/BaseAvatar.vue'\nexport { default as BaseAlert } from './components/BaseAlert.vue'\nexport { default as BaseBadge } from './components/BaseBadge.vue'\nexport { default as BaseButton } from './components/BaseButton.vue'\nexport { default as BaseInput } from './components/BaseInput.vue'\nexport { default as BaseMenu } from './components/BaseMenu.vue'\nexport { default as BaseSheet } from './components/BaseSheet.vue'\nexport { default as BaseCard } from './components/BaseCard.vue'\nexport { default as BaseCombobox } from './components/BaseCombobox.vue'\nexport type { ComboboxOption } from './components/BaseCombobox.vue'\nexport { default as BaseCheckbox } from './components/BaseCheckbox.vue'\nexport { default as BaseRadioGroup } from './components/BaseRadioGroup.vue'\nexport { default as BaseSelect } from './components/BaseSelect.vue'\nexport { default as BaseSlider } from './components/BaseSlider.vue'\nexport { default as BaseSpinner } from './components/BaseSpinner.vue'\nexport { default as BaseSwitch } from './components/BaseSwitch.vue'\nexport { default as BaseTable } from './components/BaseTable.vue'\nexport type { Column } from './components/BaseTable.vue'\nexport { default as BaseTextarea } from './components/BaseTextarea.vue'\nexport { default as EmptyState } from './components/EmptyState.vue'\nexport { default as FormField } from './components/FormField.vue'\nexport { default as ErrorBoundary } from './components/ErrorBoundary.vue'\nexport { default as PageContainer } from './components/PageContainer.vue'\nexport { default as PageHeader } from './components/PageHeader.vue'\nexport { default as ProgressBar } from './components/ProgressBar.vue'\nexport { default as PriceCard } from './components/PriceCard.vue'\nexport { default as SectionHeading } from './components/SectionHeading.vue'\nexport { default as SegmentedControl } from './components/SegmentedControl.vue'\nexport { default as SettingsGroup } from './components/SettingsGroup.vue'\nexport { default as SettingsRow } from './components/SettingsRow.vue'\nexport { default as SkeletonList } from './components/SkeletonList.vue'\nexport { default as StatCard } from './components/StatCard.vue'\nexport { default as ToastHost } from './components/ToastHost.vue'\nexport { default as ToneDot } from './components/ToneDot.vue'\nexport type { Tone } from './components/SectionHeading.vue'\nexport { default as LocaleLinks } from './components/LocaleLinks.vue'\nexport { default as GoogleButton } from './components/GoogleButton.vue'\nexport { default as TabBar } from './components/TabBar.vue'\nexport type { TabItem } from './components/TabBar.vue'\nexport { default as BaseCalendar } from './components/BaseCalendar.vue'\nexport type { DateRange } from './components/BaseCalendar.vue'\nexport { default as BaseDatePicker } from './components/BaseDatePicker.vue'\nexport type { DatePreset } from './components/BaseDatePicker.vue'\nexport { default as BasePopover } from './components/BasePopover.vue'\nexport type { PopoverTriggerProps } from './components/BasePopover.vue'\nexport { default as ToggleGroup } from './components/ToggleGroup.vue'\nexport { default as NumberInput } from './components/NumberInput.vue'\nexport { default as PinInput } from './components/PinInput.vue'\nexport { default as CircularProgress } from './components/CircularProgress.vue'\nexport { default as BaseStepper } from './components/BaseStepper.vue'\nexport type { StepperStep } from './components/BaseStepper.vue'\n\n// ── i18n ───────────────────────────────────────────────────────────────────\nexport { createI18nRuntime } from './i18n/runtime'\nexport type { I18nRuntimeOptions, LocalePreference } from './i18n/runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,iBAAiB,SAAiB,OAAe,QAA2B;CAC1F,IAAI,YAAY,OAAO,OAAO,OAAO;CACrC,IAAI,YAAY,QAAQ,OAAO,EAAE,GAAG,OAAO,OAAO;CAElD,OAAO,WAAW,YAAY,OAAO,GAAG,EAAE,SAAS,QAAQ,CAAC;AAC9D;;;;;;;;;AC7BA,SAAgB,aAAa,MAAe,UAAwB;CAClE,MAAM,OAAO,IAAI,KAAK,CAAC,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,mBAAmB,CAAC;CAC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AO,QAAQ,aAAa;EACjC,gBAAgB,WAAW,KAAK;EAEhC,IAAI,OAAO,aAAa,aACtB,SAAS,gBAAgB,OAAO,aAAa;CAEjD,CAAC;;CAGD,SAAS,sBAAsB;EAC7B,OAAO,SAA8B;GACnC,WAAW,WAAW;GACtB,MAAM,SAAS;IAKb,eAJiB,SAAS,WAAW,mBAAmB,IAAK,IAIjC,CAAC,CAAC,WAAW;KACvC,WAAW,QAAQ;IACrB,CAAC;IAED,IAAI;KACF,aAAa,QAAQ,YAAY,IAAI;IACvC,QAAQ,CAER;GACF;EACF,CAAC;CACH;CAEA,OAAO;EACL;;EAEA,GAAG,KAAK;EACR;EACA;EACA;EACA;EACA;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;ACtLA,IAAa,UAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["$slots","$attrs","$slots","$slots","$el","$slots"],"sources":["../src/utils/day-label.ts","../src/utils/download.ts","../src/palettes/palettes.generated.json","../src/utils/appearance.ts","../src/composables/use-today.ts","../src/composables/use-debounced-callback.ts","../src/composables/use-drag-scroll.ts","../src/composables/use-media-query.ts","../src/components/BaseAvatar.vue","../src/components/BaseAvatar.vue","../src/components/BaseBadge.vue","../src/components/BaseBadge.vue","../src/components/BaseMenu.vue","../src/components/BaseMenu.vue","../src/components/BaseCard.vue","../src/components/BaseCard.vue","../src/components/BaseCombobox.vue","../src/components/BaseCombobox.vue","../src/components/BaseRadioGroup.vue","../src/components/BaseRadioGroup.vue","../src/components/BaseSelect.vue","../src/components/BaseSelect.vue","../src/components/BaseSlider.vue","../src/components/BaseSlider.vue","../src/components/BaseSpinner.vue","../src/components/BaseSpinner.vue","../src/components/BaseSwitch.vue","../src/components/BaseSwitch.vue","../src/components/BaseTable.vue","../src/components/BaseTable.vue","../src/components/BaseTextarea.vue","../src/components/BaseTextarea.vue","../src/components/EmptyState.vue","../src/components/EmptyState.vue","../src/components/ErrorBoundary.vue","../src/components/ErrorBoundary.vue","../src/components/PageContainer.vue","../src/components/PageContainer.vue","../src/components/PageHeader.vue","../src/components/PageHeader.vue","../src/components/ProgressBar.vue","../src/components/ProgressBar.vue","../src/components/PriceCard.vue","../src/components/PriceCard.vue","../src/components/ToneDot.vue","../src/components/ToneDot.vue","../src/components/SectionHeading.vue","../src/components/SectionHeading.vue","../src/components/SegmentedControl.vue","../src/components/SegmentedControl.vue","../src/components/SkeletonList.vue","../src/components/SkeletonList.vue","../src/components/StatCard.vue","../src/components/StatCard.vue","../src/components/ToastHost.vue","../src/components/ToastHost.vue","../src/components/LocaleLinks.vue","../src/components/LocaleLinks.vue","../src/components/TabBar.vue","../src/components/TabBar.vue","../src/components/AvatarStack.vue","../src/components/AvatarStack.vue","../src/components/BaseCalendar.vue","../src/components/BaseCalendar.vue","../src/components/BaseChip.vue","../src/components/BaseChip.vue","../src/components/BaseKbd.vue","../src/components/BaseKbd.vue","../src/components/BaseLink.vue","../src/components/BaseLink.vue","../src/components/BaseRating.vue","../src/components/BaseRating.vue","../src/components/BaseSeparator.vue","../src/components/BaseSeparator.vue","../src/components/BaseSkeleton.vue","../src/components/BaseSkeleton.vue","../src/components/CopyButton.vue","../src/components/CopyButton.vue","../src/components/FileDrop.vue","../src/components/FileDrop.vue","../src/components/TagsInput.vue","../src/components/TagsInput.vue","../src/components/BasePopover.vue","../src/components/BasePopover.vue","../src/components/BaseDatePicker.vue","../src/components/BaseDatePicker.vue","../src/components/ToggleGroup.vue","../src/components/ToggleGroup.vue","../src/components/NumberInput.vue","../src/components/NumberInput.vue","../src/components/PinInput.vue","../src/components/PinInput.vue","../src/components/CircularProgress.vue","../src/components/CircularProgress.vue","../src/components/BaseStepper.vue","../src/components/BaseStepper.vue","../src/i18n/runtime.ts","../src/index.ts"],"sourcesContent":["import { addDays, fromDateKey } from './date'\nimport { formatDate } from './format'\n\n/** The two days worth naming rather than numbering. */\nexport interface DayLabels {\n today: string\n yesterday: string\n}\n\n/**\n * A short name for a day, relative to today.\n *\n * \"Today\" and \"Yesterday\" are worth spelling out — they are the two a user\n * actually reaches for. Anything older gets its weekday, which inside a\n * five-day window is unambiguous and stays two or three characters in every\n * language.\n *\n * The two words are arguments rather than translated here: a library that calls\n * `t()` forces every consumer onto one i18n setup.\n *\n * @param dateKey - The day to label (`YYYY-MM-DD`).\n * @param today - Today's key, passed in so the caller controls the clock.\n * @param labels - What to call today and yesterday.\n *\n * @example\n * ```ts\n * relativeDayLabel('2026-08-28', '2026-08-31', { today: 'Today', yesterday: 'Yesterday' })\n * // 'Fri'\n * ```\n */\nexport function relativeDayLabel(dateKey: string, today: string, labels: DayLabels): string {\n if (dateKey === today) return labels.today\n if (dateKey === addDays(today, -1)) return labels.yesterday\n\n return formatDate(fromDateKey(dateKey), { weekday: 'short' })\n}\n","/**\n * Hands the user a file without a server round trip.\n *\n * @param data - Anything `JSON.stringify` can serialise.\n * @param filename - Suggested name, e.g. `hibi-export-2026-08-24.json`.\n */\nexport function downloadJson(data: unknown, filename: string): void {\n const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n\n link.href = url\n link.download = filename\n link.click()\n\n URL.revokeObjectURL(url)\n}\n","[\n {\n \"name\": \"rei\",\n \"label\": \"Rei\",\n \"origin\": \"rei-kit\",\n \"light\": {\n \"primary\": \"#26667f\",\n \"accent\": \"#124170\",\n \"positive\": \"#67c090\",\n \"negative\": \"#c9463b\",\n \"warning\": \"#d89a3e\",\n \"canvas\": \"#f4faf8\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#ddf4e7\",\n \"ink\": \"#0f2229\",\n \"inkSoft\": \"#5c7480\",\n \"hair\": \"#e1edea\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#07141a\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#07141a\"\n },\n \"dark\": {\n \"primary\": \"#5fb0c9\",\n \"accent\": \"#8cb8e0\",\n \"positive\": \"#67c090\",\n \"negative\": \"#f07a6f\",\n \"warning\": \"#e6ad58\",\n \"canvas\": \"#07141a\",\n \"surface\": \"#102630\",\n \"muted\": \"#12303a\",\n \"ink\": \"#e6f0ee\",\n \"inkSoft\": \"#8fa8b2\",\n \"hair\": \"#1c3945\",\n \"onPrimary\": \"#07141a\",\n \"onAccent\": \"#07141a\",\n \"onPositive\": \"#07141a\",\n \"onNegative\": \"#07141a\",\n \"onWarning\": \"#07141a\"\n },\n \"swatch\": [\n \"#26667f\",\n \"#124170\",\n \"#67c090\",\n \"#d89a3e\"\n ]\n },\n {\n \"name\": \"nord\",\n \"label\": \"Nord\",\n \"origin\": \"Arctic Ice Studio\",\n \"light\": {\n \"primary\": \"#5e81ac\",\n \"accent\": \"#b48ead\",\n \"positive\": \"#a3be8c\",\n \"negative\": \"#bf616a\",\n \"warning\": \"#ebcb8b\",\n \"canvas\": \"#eceff4\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#e5e9f0\",\n \"ink\": \"#2e3440\",\n \"inkSoft\": \"#4c566a\",\n \"hair\": \"#d8dee9\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#111111\",\n \"onPositive\": \"#2e3440\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#2e3440\"\n },\n \"dark\": {\n \"primary\": \"#88c0d0\",\n \"accent\": \"#b48ead\",\n \"positive\": \"#a3be8c\",\n \"negative\": \"#bf616a\",\n \"warning\": \"#ebcb8b\",\n \"canvas\": \"#2e3440\",\n \"surface\": \"#3b4252\",\n \"muted\": \"#434c5e\",\n \"ink\": \"#eceff4\",\n \"inkSoft\": \"#d8dee9\",\n \"hair\": \"#4c566a\",\n \"onPrimary\": \"#2e3440\",\n \"onAccent\": \"#111111\",\n \"onPositive\": \"#2e3440\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#2e3440\"\n },\n \"swatch\": [\n \"#5e81ac\",\n \"#b48ead\",\n \"#a3be8c\",\n \"#ebcb8b\"\n ]\n },\n {\n \"name\": \"dracula\",\n \"label\": \"Dracula\",\n \"origin\": \"Dracula Theme\",\n \"swatch\": [\n \"#bd93f9\",\n \"#ff79c6\",\n \"#50fa7b\",\n \"#282a36\"\n ],\n \"light\": {\n \"primary\": \"#644ac9\",\n \"accent\": \"#a3144d\",\n \"positive\": \"#14710a\",\n \"negative\": \"#cb3a2a\",\n \"warning\": \"#a34d14\",\n \"canvas\": \"#fffbeb\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#f3eeda\",\n \"ink\": \"#1f1f1f\",\n \"inkSoft\": \"#635d4f\",\n \"hair\": \"#e6e0c8\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#ffffff\"\n },\n \"dark\": {\n \"primary\": \"#bd93f9\",\n \"accent\": \"#ff79c6\",\n \"positive\": \"#50fa7b\",\n \"negative\": \"#ff5555\",\n \"warning\": \"#ffb86c\",\n \"canvas\": \"#21222c\",\n \"surface\": \"#282a36\",\n \"muted\": \"#343746\",\n \"ink\": \"#f8f8f2\",\n \"inkSoft\": \"#b6b9cf\",\n \"hair\": \"#44475a\",\n \"onPrimary\": \"#1f1f1f\",\n \"onAccent\": \"#1f1f1f\",\n \"onPositive\": \"#1f1f1f\",\n \"onNegative\": \"#1f1f1f\",\n \"onWarning\": \"#1f1f1f\"\n }\n },\n {\n \"name\": \"catppuccin\",\n \"label\": \"Catppuccin\",\n \"origin\": \"Catppuccin\",\n \"light\": {\n \"primary\": \"#8839ef\",\n \"accent\": \"#1e66f5\",\n \"positive\": \"#40a02b\",\n \"negative\": \"#d20f39\",\n \"warning\": \"#df8e1d\",\n \"canvas\": \"#eff1f5\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#e6e9ef\",\n \"ink\": \"#4c4f69\",\n \"inkSoft\": \"#5c5f77\",\n \"hair\": \"#ccd0da\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#1e1e2e\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#1e1e2e\"\n },\n \"dark\": {\n \"primary\": \"#cba6f7\",\n \"accent\": \"#89b4fa\",\n \"positive\": \"#a6e3a1\",\n \"negative\": \"#f38ba8\",\n \"warning\": \"#f9e2af\",\n \"canvas\": \"#1e1e2e\",\n \"surface\": \"#24273a\",\n \"muted\": \"#313244\",\n \"ink\": \"#cdd6f4\",\n \"inkSoft\": \"#a6adc8\",\n \"hair\": \"#45475a\",\n \"onPrimary\": \"#1e1e2e\",\n \"onAccent\": \"#1e1e2e\",\n \"onPositive\": \"#1e1e2e\",\n \"onNegative\": \"#1e1e2e\",\n \"onWarning\": \"#1e1e2e\"\n },\n \"swatch\": [\n \"#8839ef\",\n \"#1e66f5\",\n \"#40a02b\",\n \"#df8e1d\"\n ]\n },\n {\n \"name\": \"solarized\",\n \"label\": \"Solarized\",\n \"origin\": \"Ethan Schoonover\",\n \"light\": {\n \"primary\": \"#268bd2\",\n \"accent\": \"#6a6fc0\",\n \"positive\": \"#859900\",\n \"negative\": \"#dc322f\",\n \"warning\": \"#b58900\",\n \"canvas\": \"#fdf6e3\",\n \"surface\": \"#fffcf3\",\n \"muted\": \"#eee8d5\",\n \"ink\": \"#073642\",\n \"inkSoft\": \"#586e75\",\n \"hair\": \"#e4dcc4\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#002b36\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#002b36\"\n },\n \"dark\": {\n \"primary\": \"#268bd2\",\n \"accent\": \"#6a6fc0\",\n \"positive\": \"#859900\",\n \"negative\": \"#dc322f\",\n \"warning\": \"#b58900\",\n \"canvas\": \"#002b36\",\n \"surface\": \"#073642\",\n \"muted\": \"#0b3f4c\",\n \"ink\": \"#eee8d5\",\n \"inkSoft\": \"#93a1a1\",\n \"hair\": \"#16505e\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#002b36\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#002b36\"\n },\n \"swatch\": [\n \"#268bd2\",\n \"#6a6fc0\",\n \"#859900\",\n \"#b58900\"\n ]\n },\n {\n \"name\": \"gruvbox\",\n \"label\": \"Gruvbox\",\n \"origin\": \"morhetz\",\n \"light\": {\n \"primary\": \"#076678\",\n \"accent\": \"#8f3f71\",\n \"positive\": \"#79740e\",\n \"negative\": \"#9d0006\",\n \"warning\": \"#b57614\",\n \"canvas\": \"#fbf1c7\",\n \"surface\": \"#fdf7dd\",\n \"muted\": \"#ebdbb2\",\n \"ink\": \"#3c3836\",\n \"inkSoft\": \"#665c54\",\n \"hair\": \"#e2cfa4\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#111111\"\n },\n \"dark\": {\n \"primary\": \"#83a598\",\n \"accent\": \"#d3869b\",\n \"positive\": \"#b8bb26\",\n \"negative\": \"#fb4934\",\n \"warning\": \"#fabd2f\",\n \"canvas\": \"#282828\",\n \"surface\": \"#32302f\",\n \"muted\": \"#3c3836\",\n \"ink\": \"#ebdbb2\",\n \"inkSoft\": \"#bdae93\",\n \"hair\": \"#504945\",\n \"onPrimary\": \"#282828\",\n \"onAccent\": \"#282828\",\n \"onPositive\": \"#282828\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#282828\"\n },\n \"swatch\": [\n \"#076678\",\n \"#8f3f71\",\n \"#79740e\",\n \"#b57614\"\n ]\n },\n {\n \"name\": \"tokyo-night\",\n \"label\": \"Tokyo Night\",\n \"origin\": \"enkia\",\n \"swatch\": [\n \"#7aa2f7\",\n \"#bb9af7\",\n \"#9ece6a\",\n \"#1a1b26\"\n ],\n \"light\": {\n \"primary\": \"#2e7de9\",\n \"accent\": \"#9351ea\",\n \"positive\": \"#587539\",\n \"negative\": \"#f52a65\",\n \"warning\": \"#8c6c3e\",\n \"canvas\": \"#e1e2e7\",\n \"surface\": \"#f5f5f8\",\n \"muted\": \"#d5d6db\",\n \"ink\": \"#3760bf\",\n \"inkSoft\": \"#536297\",\n \"hair\": \"#c4c8da\",\n \"onPrimary\": \"#111111\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#16161e\",\n \"onWarning\": \"#ffffff\"\n },\n \"dark\": {\n \"primary\": \"#7aa2f7\",\n \"accent\": \"#bb9af7\",\n \"positive\": \"#9ece6a\",\n \"negative\": \"#f7768e\",\n \"warning\": \"#e0af68\",\n \"canvas\": \"#16161e\",\n \"surface\": \"#1a1b26\",\n \"muted\": \"#292e42\",\n \"ink\": \"#c0caf5\",\n \"inkSoft\": \"#a9b1d6\",\n \"hair\": \"#2f3549\",\n \"onPrimary\": \"#16161e\",\n \"onAccent\": \"#16161e\",\n \"onPositive\": \"#16161e\",\n \"onNegative\": \"#16161e\",\n \"onWarning\": \"#16161e\"\n }\n },\n {\n \"name\": \"rose-pine\",\n \"label\": \"Rosé Pine\",\n \"origin\": \"Rosé Pine\",\n \"light\": {\n \"primary\": \"#286983\",\n \"accent\": \"#907aa9\",\n \"positive\": \"#56949f\",\n \"negative\": \"#b4637a\",\n \"warning\": \"#ea9d34\",\n \"canvas\": \"#faf4ed\",\n \"surface\": \"#fffaf3\",\n \"muted\": \"#f2e9e1\",\n \"ink\": \"#575279\",\n \"inkSoft\": \"#716d89\",\n \"hair\": \"#dfdad9\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#191724\",\n \"onPositive\": \"#191724\",\n \"onNegative\": \"#111111\",\n \"onWarning\": \"#191724\"\n },\n \"dark\": {\n \"primary\": \"#9ccfd8\",\n \"accent\": \"#c4a7e7\",\n \"positive\": \"#31748f\",\n \"negative\": \"#eb6f92\",\n \"warning\": \"#f6c177\",\n \"canvas\": \"#191724\",\n \"surface\": \"#1f1d2e\",\n \"muted\": \"#26233a\",\n \"ink\": \"#e0def4\",\n \"inkSoft\": \"#908caa\",\n \"hair\": \"#403d52\",\n \"onPrimary\": \"#191724\",\n \"onAccent\": \"#191724\",\n \"onPositive\": \"#ffffff\",\n \"onNegative\": \"#191724\",\n \"onWarning\": \"#191724\"\n },\n \"swatch\": [\n \"#286983\",\n \"#907aa9\",\n \"#56949f\",\n \"#ea9d34\"\n ]\n },\n {\n \"name\": \"sakura\",\n \"label\": \"Sakura\",\n \"origin\": \"rei-kit\",\n \"light\": {\n \"primary\": \"#c2415d\",\n \"accent\": \"#7a3b4f\",\n \"positive\": \"#3f8f6a\",\n \"negative\": \"#c43d3d\",\n \"warning\": \"#c98a2a\",\n \"canvas\": \"#fdf6f7\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#fbe4e8\",\n \"ink\": \"#2a1b1f\",\n \"inkSoft\": \"#6f5a5f\",\n \"hair\": \"#f0dde1\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#1a1013\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#1a1013\"\n },\n \"dark\": {\n \"primary\": \"#f08aa0\",\n \"accent\": \"#d7a1b3\",\n \"positive\": \"#6fc39a\",\n \"negative\": \"#f07a7a\",\n \"warning\": \"#e6b060\",\n \"canvas\": \"#1a1013\",\n \"surface\": \"#24171b\",\n \"muted\": \"#321f25\",\n \"ink\": \"#f6e8eb\",\n \"inkSoft\": \"#c3a9b0\",\n \"hair\": \"#3d2930\",\n \"onPrimary\": \"#1a1013\",\n \"onAccent\": \"#1a1013\",\n \"onPositive\": \"#1a1013\",\n \"onNegative\": \"#1a1013\",\n \"onWarning\": \"#1a1013\"\n },\n \"swatch\": [\n \"#c2415d\",\n \"#7a3b4f\",\n \"#3f8f6a\",\n \"#c98a2a\"\n ]\n },\n {\n \"name\": \"matcha\",\n \"label\": \"Matcha\",\n \"origin\": \"rei-kit\",\n \"light\": {\n \"primary\": \"#5a7a2e\",\n \"accent\": \"#3d5a3a\",\n \"positive\": \"#4a8a4f\",\n \"negative\": \"#b8473a\",\n \"warning\": \"#b8862c\",\n \"canvas\": \"#f6f7f0\",\n \"surface\": \"#ffffff\",\n \"muted\": \"#e7ecd6\",\n \"ink\": \"#1e2418\",\n \"inkSoft\": \"#5b6450\",\n \"hair\": \"#e1e6d3\",\n \"onPrimary\": \"#ffffff\",\n \"onAccent\": \"#ffffff\",\n \"onPositive\": \"#111111\",\n \"onNegative\": \"#ffffff\",\n \"onWarning\": \"#11140d\"\n },\n \"dark\": {\n \"primary\": \"#a8c77a\",\n \"accent\": \"#8fb58a\",\n \"positive\": \"#7cc281\",\n \"negative\": \"#e8826f\",\n \"warning\": \"#e0b35c\",\n \"canvas\": \"#11140d\",\n \"surface\": \"#191d13\",\n \"muted\": \"#242a1b\",\n \"ink\": \"#eef1e6\",\n \"inkSoft\": \"#aab39e\",\n \"hair\": \"#2e3525\",\n \"onPrimary\": \"#11140d\",\n \"onAccent\": \"#11140d\",\n \"onPositive\": \"#11140d\",\n \"onNegative\": \"#11140d\",\n \"onWarning\": \"#11140d\"\n },\n \"swatch\": [\n \"#5a7a2e\",\n \"#3d5a3a\",\n \"#4a8a4f\",\n \"#b8862c\"\n ]\n }\n]\n","import { ref, watch } from 'vue'\nimport type { Ref } from 'vue'\n\nimport generated from '../palettes/palettes.generated.json'\n\n/* ---------------------------------------------------------------------------\n Materials.\n\n How a surface is made — its fill, its edge, its depth — independent of what\n colour it is. The kit's own components never ask which one is active; they\n read the tokens, and the material redefines the tokens.\n --------------------------------------------------------------------------- */\n\nexport const MATERIALS = ['quiet', 'glass', 'brutal', 'soft'] as const\nexport type Material = (typeof MATERIALS)[number]\n\nexport function isMaterial(value: unknown): value is Material {\n return typeof value === 'string' && (MATERIALS as readonly string[]).includes(value)\n}\n\n/**\n * Switches the material for everything under `root`.\n *\n * `quiet` removes the attribute rather than writing it, because quiet is what\n * the tokens already are — there is nothing to override.\n *\n * Needs `rei-kit/materials.css` (or the one material file) imported after\n * `tokens.css`, or the attribute changes nothing.\n */\nexport function applyMaterial(material: Material, root?: HTMLElement): void {\n const el = root ?? (typeof document === 'undefined' ? undefined : document.documentElement)\n if (!el) return\n\n if (material === 'quiet') delete el.dataset['material']\n else el.dataset['material'] = material\n}\n\n/* ---------------------------------------------------------------------------\n Palettes.\n\n Generated from `src/palettes/palettes.source.json`, with the on-colours\n chosen by contrast and every text pairing measured against WCAG AA in both\n modes before a palette is allowed to ship.\n --------------------------------------------------------------------------- */\n\n/** The eleven colour roles plus the five on-colours, for one mode. */\nexport interface PaletteRoles {\n primary: string\n accent: string\n positive: string\n negative: string\n warning: string\n canvas: string\n surface: string\n muted: string\n ink: string\n inkSoft: string\n hair: string\n onPrimary: string\n onAccent: string\n onPositive: string\n onNegative: string\n onWarning: string\n}\n\nexport interface Palette {\n /** The value for `data-palette`. */\n name: string\n /** A display name. */\n label: string\n /** Who made it. Several are well-known open palettes, credited here. */\n origin: string\n /** Four colours for a picker to show at a glance. */\n swatch: readonly [string, string, string, string]\n light: PaletteRoles\n dark: PaletteRoles\n}\n\nexport const PALETTES = generated as unknown as readonly Palette[]\n\nexport type PaletteName = string\n\nexport function isPaletteName(value: unknown): value is PaletteName {\n return typeof value === 'string' && PALETTES.some((p) => p.name === value)\n}\n\n/**\n * Switches the palette for everything under `root`.\n *\n * `rei` is the tokens' own palette, so it removes the attribute. Needs\n * `rei-kit/palettes.css` imported after `tokens.css`.\n */\nexport function applyPalette(name: PaletteName, root?: HTMLElement): void {\n const el = root ?? (typeof document === 'undefined' ? undefined : document.documentElement)\n if (!el) return\n\n if (name === 'rei') delete el.dataset['palette']\n else el.dataset['palette'] = name\n}\n\n/* ---------------------------------------------------------------------------\n Persisted preferences.\n\n The same shape as `useTheme`: a module-level ref, so every caller shares one\n answer, written through to storage and applied on every change.\n --------------------------------------------------------------------------- */\n\nfunction stored<T extends string>(key: string, accept: (v: unknown) => v is T, fallback: T): T {\n try {\n const value = localStorage.getItem(key)\n return accept(value) ? value : fallback\n } catch {\n return fallback\n }\n}\n\nfunction store(key: string, value: string): void {\n try {\n localStorage.setItem(key, value)\n } catch {\n // Private mode or blocked storage: the choice just will not persist.\n }\n}\n\nlet materialKey = 'rei-material'\nlet materialRef: Ref<Material> | null = null\n\n/** Call once at startup, before `useMaterial`, to namespace the stored value. */\nexport function setMaterialStorageKey(key: string): void {\n materialKey = key\n if (materialRef) materialRef.value = stored(key, isMaterial, 'quiet')\n}\n\n/**\n * The active material, as a writable ref. Assigning it stores and applies it.\n *\n * @example\n * ```ts\n * const material = useMaterial()\n * material.value = 'glass'\n * ```\n */\nexport function useMaterial(): Ref<Material> {\n if (materialRef) return materialRef\n\n materialRef = ref<Material>(stored(materialKey, isMaterial, 'quiet'))\n watch(\n materialRef,\n (next) => {\n store(materialKey, next)\n applyMaterial(next)\n },\n { immediate: true },\n )\n\n return materialRef\n}\n\nlet paletteKey = 'rei-palette'\nlet paletteRef: Ref<PaletteName> | null = null\n\n/** Call once at startup, before `usePalette`, to namespace the stored value. */\nexport function setPaletteStorageKey(key: string): void {\n paletteKey = key\n if (paletteRef) paletteRef.value = stored(key, isPaletteName, 'rei')\n}\n\n/** The active palette's name, as a writable ref. Assigning it stores and applies it. */\nexport function usePalette(): Ref<PaletteName> {\n if (paletteRef) return paletteRef\n\n paletteRef = ref<PaletteName>(stored(paletteKey, isPaletteName, 'rei'))\n watch(\n paletteRef,\n (next) => {\n store(paletteKey, next)\n applyPalette(next)\n },\n { immediate: true },\n )\n\n return paletteRef\n}\n","import { readonly, ref } from 'vue'\n\nimport { todayKey } from '../utils/date'\n\n/**\n * Today's date key, kept current while the app stays open.\n *\n * `todayKey()` called once in `setup` freezes the date for the lifetime of the\n * component. Nobody notices in a session that lasts minutes, but a phone left\n * on the Today screen overnight would keep marking yesterday, and the Week grid\n * would disable the column that just became today.\n */\nconst current = ref(todayKey())\n\nlet timer: ReturnType<typeof setTimeout> | undefined\nlet watching = false\n\n/** A second past midnight, so a fast timer cannot fire on the old date. */\nfunction msUntilMidnight(): number {\n const now = new Date()\n const next = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 1)\n\n return next.getTime() - now.getTime()\n}\n\nfunction refresh() {\n current.value = todayKey()\n}\n\nfunction schedule() {\n clearTimeout(timer)\n timer = setTimeout(() => {\n refresh()\n schedule()\n }, msUntilMidnight())\n}\n\n/**\n * Starts the clock, once, and only where there is a clock to watch.\n *\n * This used to run at import time, which made the module impossible to load on\n * a server: `document` is not defined there, and a barrel export means one\n * `import { BaseButton } from 'rei-kit'` pulls this file in. Deferring it to\n * the first `useToday()` also means an app that never asks for today never\n * arms a timer.\n */\nfunction watchTheClock() {\n if (watching || typeof document === 'undefined') return\n\n watching = true\n schedule()\n\n // A sleeping phone does not run timers reliably, so the tab also re-checks\n // the moment it comes back — which is when the user would see a stale date.\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState !== 'visible') return\n\n refresh()\n schedule()\n })\n}\n\n/**\n * @returns Read-only ref holding today's `YYYY-MM-DD` key.\n *\n * Rendered on a server this is the *server's* today, which is a different day\n * from the visitor's either side of midnight. Anything prerendered from it\n * would hydrate to a different value; render it on the client.\n *\n * @example\n * ```ts\n * const today = useToday()\n * const isFuture = computed(() => day > today.value)\n * ```\n */\nexport function useToday() {\n watchTheClock()\n\n return readonly(current)\n}\n","import { onScopeDispose } from 'vue'\n\n/**\n * Delays a callback until the caller stops calling it.\n *\n * Used for note autosave: a request per keystroke would be wasteful, but losing\n * the last keystrokes when the user navigates away would be worse — so the\n * pending call is flushed on dispose, and `flush` is exposed for route guards.\n *\n * @param callback - Runs with the arguments of the most recent call.\n * @param delay - Quiet period in milliseconds.\n * @returns `run` to schedule, `flush` to run now, `cancel` to drop.\n *\n * @example\n * ```ts\n * const save = useDebouncedCallback((body: string) => mutate(body), 800)\n * watch(text, (value) => save.run(value))\n * onBeforeRouteLeave(() => save.flush())\n * ```\n */\nexport function useDebouncedCallback<A extends unknown[]>(\n callback: (...args: A) => void,\n delay = 800,\n) {\n let timer: ReturnType<typeof setTimeout> | null = null\n let pending: A | null = null\n\n /** Runs the pending call right now, if there is one. */\n function flush() {\n if (timer !== null) clearTimeout(timer)\n timer = null\n\n if (pending !== null) {\n const args = pending\n pending = null\n callback(...args)\n }\n }\n\n /** Drops the pending call without running it. */\n function cancel() {\n if (timer !== null) clearTimeout(timer)\n timer = null\n pending = null\n }\n\n function run(...args: A) {\n pending = args\n if (timer !== null) clearTimeout(timer)\n timer = setTimeout(flush, delay)\n }\n\n // A closing sheet or an unmounting view must not eat the last keystrokes.\n onScopeDispose(flush)\n\n return { run, flush, cancel }\n}\n","import { onScopeDispose, watch } from 'vue'\nimport type { Ref } from 'vue'\n\n/** Movement before a press counts as a drag rather than a tap. */\nconst DRAG_THRESHOLD_PX = 6\n\n/**\n * Drag-to-scroll for a horizontally scrolling element.\n *\n * The app puts `touch-action: pan-y` on the page content so the tab-swipe\n * gesture keeps its pointer events — the browser never claims a horizontal\n * drag, which also means it never pans this element natively. Rather than give\n * that up, horizontal scrolling is driven here.\n *\n * @param target - The scroll container.\n * @returns `didDrag`, so a click handler can ignore the press that ended a drag.\n *\n * @example\n * ```ts\n * const scroller = ref<HTMLElement | null>(null)\n * const { didDrag } = useDragScroll(scroller)\n *\n * function onClick() {\n * if (didDrag()) return\n * // …treat as a tap\n * }\n * ```\n */\nexport function useDragScroll(target: Ref<HTMLElement | null>) {\n let pointerId: number | null = null\n let startX = 0\n let startScroll = 0\n let dragged = false\n\n function onPointerDown(event: PointerEvent) {\n const element = target.value\n if (!element || event.pointerType === 'mouse') return\n\n pointerId = event.pointerId\n startX = event.clientX\n startScroll = element.scrollLeft\n dragged = false\n }\n\n function onPointerMove(event: PointerEvent) {\n const element = target.value\n if (!element || event.pointerId !== pointerId) return\n\n const dx = event.clientX - startX\n if (!dragged && Math.abs(dx) < DRAG_THRESHOLD_PX) return\n\n // Capture only once the gesture is clearly horizontal, so a vertical scroll\n // that happens to start here still belongs to the page.\n if (!dragged) {\n dragged = true\n element.setPointerCapture(event.pointerId)\n }\n\n element.scrollLeft = startScroll - dx\n }\n\n function onPointerUp(event: PointerEvent) {\n const element = target.value\n if (element?.hasPointerCapture(event.pointerId)) {\n element.releasePointerCapture(event.pointerId)\n }\n\n pointerId = null\n }\n\n function bind(element: HTMLElement) {\n element.addEventListener('pointerdown', onPointerDown)\n element.addEventListener('pointermove', onPointerMove)\n element.addEventListener('pointerup', onPointerUp)\n element.addEventListener('pointercancel', onPointerUp)\n }\n\n function unbind(element: HTMLElement) {\n element.removeEventListener('pointerdown', onPointerDown)\n element.removeEventListener('pointermove', onPointerMove)\n element.removeEventListener('pointerup', onPointerUp)\n element.removeEventListener('pointercancel', onPointerUp)\n }\n\n watch(\n target,\n (element, previous) => {\n if (previous) unbind(previous)\n if (element) bind(element)\n },\n { immediate: true },\n )\n\n onScopeDispose(() => {\n if (target.value) unbind(target.value)\n })\n\n return { didDrag: () => dragged }\n}\n","import { onBeforeUnmount, onMounted, ref } from 'vue'\n\n/**\n * Whether a media query matches, kept up to date.\n *\n * Starts false and resolves on mount, which is deliberate: this is the one\n * place a component is tempted to branch on viewport during render, and doing\n * that under prerendering produces HTML built for a screen the server does not\n * have. Hydration then swaps it and the page jumps. False first, correct a\n * frame later, no jump — and a layout that reads badly at `false` is a layout\n * with a mobile-first bug worth knowing about.\n *\n * Guarded for the server for the same reason the rest of the kit is: this\n * package has to be importable in Node, and `matchMedia` does not exist there.\n *\n * @example\n * ```ts\n * const wide = useMediaQuery('(min-width: 64rem)')\n * ```\n */\nexport function useMediaQuery(query: string) {\n const matches = ref(false)\n\n let list: MediaQueryList | undefined\n\n function update(event: MediaQueryList | MediaQueryListEvent) {\n matches.value = event.matches\n }\n\n onMounted(() => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return\n\n list = window.matchMedia(query)\n update(list)\n list.addEventListener('change', update)\n })\n\n onBeforeUnmount(() => {\n list?.removeEventListener('change', update)\n })\n\n return matches\n}\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\n\n/**\n * The person, in the corner where the account lives.\n *\n * ## Why the default is a glyph and not an initial\n *\n * An initial in a circle reads as a profile picture that failed to load, and it\n * says nothing at all to somebody who has never seen an avatar in that spot\n * before — which is most people, the first time. A drawn person says \"this is\n * you\" without knowing your name. So `fallback` defaults to the figure, and\n * initials are available for the places where the name is the point: a list of\n * members, a comment thread, anywhere several people appear at once and telling\n * them apart is the job.\n *\n * An image that fails is caught and falls back rather than leaving a broken\n * frame, because a missing avatar is normal and a broken image is an error.\n */\nconst {\n name = '',\n src = '',\n size = 'md',\n fallback = 'figure',\n label = '',\n} = defineProps<{\n /** Used for the initials and, failing a `label`, as the accessible name. */\n name?: string | undefined\n src?: string | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n fallback?: 'figure' | 'initials' | undefined\n /** Overrides the accessible name. For \"Your account\" rather than a person's name. */\n label?: string | undefined\n}>()\n\nconst broken = ref(false)\nwatch(\n () => src,\n () => (broken.value = false),\n)\n\nconst showImage = computed(() => Boolean(src) && !broken.value)\n\n/**\n * Two letters at most, from the first and last word.\n *\n * `Array.from` rather than `slice`, so a name written in a script outside the\n * basic plane is cut between characters rather than through one.\n */\nconst initials = computed(() => {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length === 0) return ''\n\n const first = Array.from(words[0]!)[0] ?? ''\n const last = words.length > 1 ? (Array.from(words[words.length - 1]!)[0] ?? '') : ''\n\n return (first + last).toUpperCase()\n})\n\nconst accessibleName = computed(() => label || name)\n</script>\n\n<template>\n <span\n class=\"rk-avatar\"\n :class=\"`is-${size}`\"\n :role=\"accessibleName ? 'img' : undefined\"\n :aria-label=\"accessibleName || undefined\"\n :aria-hidden=\"accessibleName ? undefined : 'true'\"\n >\n <img v-if=\"showImage\" :src=\"src\" alt=\"\" class=\"rk-avatar-img\" @error=\"broken = true\" />\n\n <span v-else-if=\"fallback === 'initials' && initials\" class=\"rk-avatar-initials\">\n {{ initials }}\n </span>\n\n <svg v-else viewBox=\"0 0 20 20\" class=\"rk-avatar-figure\" fill=\"none\" stroke=\"currentColor\">\n <circle cx=\"10\" cy=\"6.75\" r=\"3.25\" stroke-width=\"1.5\" />\n <path\n d=\"M3.75 17c0-3.05 2.8-5.25 6.25-5.25S16.25 13.95 16.25 17\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n />\n </svg>\n </span>\n</template>\n\n<style scoped>\n.rk-avatar {\n display: grid;\n place-items: center;\n flex-shrink: 0;\n overflow: hidden;\n border-radius: var(--radius-cell);\n border: 1px solid color-mix(in srgb, var(--color-hair) 70%, transparent);\n background: var(--color-surface);\n color: var(--color-ink-soft);\n}\n\n.is-sm {\n width: 1.75rem;\n height: 1.75rem;\n}\n\n.is-md {\n width: 2.25rem;\n height: 2.25rem;\n}\n\n.is-lg {\n width: 3rem;\n height: 3rem;\n}\n\n.rk-avatar-img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.rk-avatar-initials {\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1;\n color: var(--color-ink);\n}\n\n.is-lg .rk-avatar-initials {\n font-size: 1rem;\n}\n\n.rk-avatar-figure {\n width: 65%;\n height: 65%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\n\n/**\n * The person, in the corner where the account lives.\n *\n * ## Why the default is a glyph and not an initial\n *\n * An initial in a circle reads as a profile picture that failed to load, and it\n * says nothing at all to somebody who has never seen an avatar in that spot\n * before — which is most people, the first time. A drawn person says \"this is\n * you\" without knowing your name. So `fallback` defaults to the figure, and\n * initials are available for the places where the name is the point: a list of\n * members, a comment thread, anywhere several people appear at once and telling\n * them apart is the job.\n *\n * An image that fails is caught and falls back rather than leaving a broken\n * frame, because a missing avatar is normal and a broken image is an error.\n */\nconst {\n name = '',\n src = '',\n size = 'md',\n fallback = 'figure',\n label = '',\n} = defineProps<{\n /** Used for the initials and, failing a `label`, as the accessible name. */\n name?: string | undefined\n src?: string | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n fallback?: 'figure' | 'initials' | undefined\n /** Overrides the accessible name. For \"Your account\" rather than a person's name. */\n label?: string | undefined\n}>()\n\nconst broken = ref(false)\nwatch(\n () => src,\n () => (broken.value = false),\n)\n\nconst showImage = computed(() => Boolean(src) && !broken.value)\n\n/**\n * Two letters at most, from the first and last word.\n *\n * `Array.from` rather than `slice`, so a name written in a script outside the\n * basic plane is cut between characters rather than through one.\n */\nconst initials = computed(() => {\n const words = name.trim().split(/\\s+/).filter(Boolean)\n if (words.length === 0) return ''\n\n const first = Array.from(words[0]!)[0] ?? ''\n const last = words.length > 1 ? (Array.from(words[words.length - 1]!)[0] ?? '') : ''\n\n return (first + last).toUpperCase()\n})\n\nconst accessibleName = computed(() => label || name)\n</script>\n\n<template>\n <span\n class=\"rk-avatar\"\n :class=\"`is-${size}`\"\n :role=\"accessibleName ? 'img' : undefined\"\n :aria-label=\"accessibleName || undefined\"\n :aria-hidden=\"accessibleName ? undefined : 'true'\"\n >\n <img v-if=\"showImage\" :src=\"src\" alt=\"\" class=\"rk-avatar-img\" @error=\"broken = true\" />\n\n <span v-else-if=\"fallback === 'initials' && initials\" class=\"rk-avatar-initials\">\n {{ initials }}\n </span>\n\n <svg v-else viewBox=\"0 0 20 20\" class=\"rk-avatar-figure\" fill=\"none\" stroke=\"currentColor\">\n <circle cx=\"10\" cy=\"6.75\" r=\"3.25\" stroke-width=\"1.5\" />\n <path\n d=\"M3.75 17c0-3.05 2.8-5.25 6.25-5.25S16.25 13.95 16.25 17\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n />\n </svg>\n </span>\n</template>\n\n<style scoped>\n.rk-avatar {\n display: grid;\n place-items: center;\n flex-shrink: 0;\n overflow: hidden;\n border-radius: var(--radius-cell);\n border: 1px solid color-mix(in srgb, var(--color-hair) 70%, transparent);\n background: var(--color-surface);\n color: var(--color-ink-soft);\n}\n\n.is-sm {\n width: 1.75rem;\n height: 1.75rem;\n}\n\n.is-md {\n width: 2.25rem;\n height: 2.25rem;\n}\n\n.is-lg {\n width: 3rem;\n height: 3rem;\n}\n\n.rk-avatar-img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.rk-avatar-initials {\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1;\n color: var(--color-ink);\n}\n\n.is-lg .rk-avatar-initials {\n font-size: 1rem;\n}\n\n.rk-avatar-figure {\n width: 65%;\n height: 65%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A small standing label: a level, a state, a count.\n *\n * Not a button and never clickable — the moment one of these needs a click it\n * is a chip, which is a different component with focus, a hit area and a way\n * to be removed. Keeping that line drawn is most of the value.\n */\nconst { tone = 'neutral' } = defineProps<{\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | undefined\n}>()\n\nconst TONES = {\n neutral: 'bg-muted text-ink-soft',\n primary: 'bg-primary/10 text-primary',\n success: 'bg-positive/12 text-positive',\n warning: 'bg-warning/15 text-warning',\n danger: 'bg-negative/12 text-negative',\n} as const\n\nconst skin = computed(() => TONES[tone])\n</script>\n\n<template>\n <span\n class=\"rounded-cell inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium whitespace-nowrap\"\n :class=\"skin\"\n >\n <slot />\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A small standing label: a level, a state, a count.\n *\n * Not a button and never clickable — the moment one of these needs a click it\n * is a chip, which is a different component with focus, a hit area and a way\n * to be removed. Keeping that line drawn is most of the value.\n */\nconst { tone = 'neutral' } = defineProps<{\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | undefined\n}>()\n\nconst TONES = {\n neutral: 'bg-muted text-ink-soft',\n primary: 'bg-primary/10 text-primary',\n success: 'bg-positive/12 text-positive',\n warning: 'bg-warning/15 text-warning',\n danger: 'bg-negative/12 text-negative',\n} as const\n\nconst skin = computed(() => TONES[tone])\n</script>\n\n<template>\n <span\n class=\"rounded-cell inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium whitespace-nowrap\"\n :class=\"skin\"\n >\n <slot />\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport { nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A list of actions behind one control.\n *\n * ## `role=\"menu\"` is a promise\n *\n * Declaring it tells a screen reader that the arrow keys move between the\n * items, that Escape closes, and that Tab leaves rather than walking through.\n * A div with `role=\"menu\"` and none of that is worse than a plain list of\n * links: it announces a contract and then breaks it, and the reader is left\n * pressing keys that do nothing.\n *\n * The hand-written menu this replaces declared the role and had none of the\n * behaviour. That is the usual shape of the bug — the roles are the part people\n * remember, because they are the part you can see in the markup.\n *\n * So: focus moves into the menu on open and back to the trigger on close,\n * ArrowUp/ArrowDown move and wrap, Home and End jump, Escape closes, and a\n * click outside closes. Items are found in the DOM rather than declared as\n * data, so a caller can mix links, buttons and separators freely.\n *\n * @example\n * ```vue\n * <BaseMenu :label=\"t('nav.account')\">\n * <template #trigger=\"{ open }\">\n * <BaseAvatar :label=\"t('nav.account')\" />\n * </template>\n *\n * <RouterLink to=\"/profil\" role=\"menuitem\">{{ t('nav.profile') }}</RouterLink>\n * <button type=\"button\" role=\"menuitem\" @click=\"signOut\">{{ t('auth.signOut') }}</button>\n * </BaseMenu>\n * ```\n */\nconst { label, align = 'end' } = defineProps<{\n /** Accessible name for the trigger. Required: the trigger is usually a glyph. */\n label: string\n /** Which edge the panel lines up with. */\n align?: 'start' | 'end' | undefined\n}>()\n\ndefineSlots<{\n /** The control that opens it. Receives the open state for its own styling. */\n trigger?: (props: { open: boolean }) => unknown\n /** The items. Anything with `role=\"menuitem\"` joins the keyboard order. */\n default: () => unknown\n}>()\n\nconst open = defineModel<boolean>({ default: false })\n\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\nconst trigger = ref<HTMLElement | null>(null)\n\nconst id = useId()\n\nfunction items(): HTMLElement[] {\n if (!panel.value) return []\n\n return Array.from(panel.value.querySelectorAll<HTMLElement>('[role=\"menuitem\"]'))\n}\n\nfunction focusAt(index: number) {\n const list = items()\n if (list.length === 0) return\n\n // Wrapping, because a list with no edges is faster than one you fall off.\n const wrapped = (index + list.length) % list.length\n list[wrapped]?.focus()\n}\n\nfunction currentIndex(): number {\n return items().indexOf(document.activeElement as HTMLElement)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!open.value) {\n // The arrows open the menu from the trigger, which is what makes it\n // reachable without a mouse in the first place.\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n open.value = true\n }\n\n return\n }\n\n switch (event.key) {\n case 'Escape':\n event.preventDefault()\n open.value = false\n break\n case 'ArrowDown':\n event.preventDefault()\n focusAt(currentIndex() + 1)\n break\n case 'ArrowUp':\n event.preventDefault()\n focusAt(currentIndex() - 1)\n break\n case 'Home':\n event.preventDefault()\n focusAt(0)\n break\n case 'End':\n event.preventDefault()\n focusAt(items().length - 1)\n break\n case 'Tab':\n // Tab leaves the menu rather than cycling inside it. This is the one\n // place a menu differs from a dialog, and getting it backwards traps\n // somebody in a list of links.\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) open.value = false\n}\n\n/* `immediate`, because a menu can be mounted already open -- a caller driving\n it from a route, or a test. Without it that menu has no outside-click\n listener and never moves focus, and nothing says so: it looks open and\n behaves like a div. The closed case is a no-op, since removing a listener\n that was never added is free and focus is only taken back from inside. */\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) {\n document.addEventListener('pointerdown', onDocumentPointer)\n await nextTick()\n items()[0]?.focus()\n } else {\n document.removeEventListener('pointerdown', onDocumentPointer)\n // Only take focus back if it is still inside the menu; otherwise the menu\n // is closing *because* the reader went somewhere else, and dragging them\n // back is the rudest thing it could do.\n if (root.value?.contains(document.activeElement)) trigger.value?.focus()\n }\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-menu\" @keydown=\"onKeydown\">\n <button\n ref=\"trigger\"\n type=\"button\"\n class=\"rk-menu-trigger\"\n :aria-label=\"label\"\n :aria-expanded=\"open\"\n :aria-haspopup=\"true\"\n :aria-controls=\"open ? id : undefined\"\n @click=\"open = !open\"\n >\n <slot name=\"trigger\" :open=\"open\" />\n </button>\n\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-menu-panel surface-overlay\"\n :class=\"`is-${align}`\"\n role=\"menu\"\n >\n <slot />\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-menu {\n position: relative;\n display: inline-flex;\n}\n\n.rk-menu-trigger {\n display: inline-flex;\n border-radius: var(--radius-cell);\n}\n\n.rk-menu-trigger:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-menu-panel {\n position: absolute;\n top: calc(100% + 0.5rem);\n z-index: 50;\n min-width: 12rem;\n overflow: hidden;\n border-radius: var(--radius-card);\n padding: 0.375rem;\n}\n\n.rk-menu-panel.is-end {\n right: 0;\n}\n\n.rk-menu-panel.is-start {\n left: 0;\n}\n\n/* The items belong to the caller, so this styles them by role rather than by\n class: whatever they render, it lines up. */\n.rk-menu-panel :deep([role='menuitem']) {\n display: block;\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.75rem;\n text-align: left;\n font-size: 0.875rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast);\n}\n\n.rk-menu-panel :deep([role='menuitem']:hover) {\n background: var(--color-muted);\n}\n\n.rk-menu-panel :deep([role='menuitem']:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n.rk-menu-panel :deep(hr) {\n margin: 0.375rem 0;\n height: 1px;\n border: 0;\n background: color-mix(in srgb, var(--color-hair) 70%, transparent);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A list of actions behind one control.\n *\n * ## `role=\"menu\"` is a promise\n *\n * Declaring it tells a screen reader that the arrow keys move between the\n * items, that Escape closes, and that Tab leaves rather than walking through.\n * A div with `role=\"menu\"` and none of that is worse than a plain list of\n * links: it announces a contract and then breaks it, and the reader is left\n * pressing keys that do nothing.\n *\n * The hand-written menu this replaces declared the role and had none of the\n * behaviour. That is the usual shape of the bug — the roles are the part people\n * remember, because they are the part you can see in the markup.\n *\n * So: focus moves into the menu on open and back to the trigger on close,\n * ArrowUp/ArrowDown move and wrap, Home and End jump, Escape closes, and a\n * click outside closes. Items are found in the DOM rather than declared as\n * data, so a caller can mix links, buttons and separators freely.\n *\n * @example\n * ```vue\n * <BaseMenu :label=\"t('nav.account')\">\n * <template #trigger=\"{ open }\">\n * <BaseAvatar :label=\"t('nav.account')\" />\n * </template>\n *\n * <RouterLink to=\"/profil\" role=\"menuitem\">{{ t('nav.profile') }}</RouterLink>\n * <button type=\"button\" role=\"menuitem\" @click=\"signOut\">{{ t('auth.signOut') }}</button>\n * </BaseMenu>\n * ```\n */\nconst { label, align = 'end' } = defineProps<{\n /** Accessible name for the trigger. Required: the trigger is usually a glyph. */\n label: string\n /** Which edge the panel lines up with. */\n align?: 'start' | 'end' | undefined\n}>()\n\ndefineSlots<{\n /** The control that opens it. Receives the open state for its own styling. */\n trigger?: (props: { open: boolean }) => unknown\n /** The items. Anything with `role=\"menuitem\"` joins the keyboard order. */\n default: () => unknown\n}>()\n\nconst open = defineModel<boolean>({ default: false })\n\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\nconst trigger = ref<HTMLElement | null>(null)\n\nconst id = useId()\n\nfunction items(): HTMLElement[] {\n if (!panel.value) return []\n\n return Array.from(panel.value.querySelectorAll<HTMLElement>('[role=\"menuitem\"]'))\n}\n\nfunction focusAt(index: number) {\n const list = items()\n if (list.length === 0) return\n\n // Wrapping, because a list with no edges is faster than one you fall off.\n const wrapped = (index + list.length) % list.length\n list[wrapped]?.focus()\n}\n\nfunction currentIndex(): number {\n return items().indexOf(document.activeElement as HTMLElement)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (!open.value) {\n // The arrows open the menu from the trigger, which is what makes it\n // reachable without a mouse in the first place.\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n open.value = true\n }\n\n return\n }\n\n switch (event.key) {\n case 'Escape':\n event.preventDefault()\n open.value = false\n break\n case 'ArrowDown':\n event.preventDefault()\n focusAt(currentIndex() + 1)\n break\n case 'ArrowUp':\n event.preventDefault()\n focusAt(currentIndex() - 1)\n break\n case 'Home':\n event.preventDefault()\n focusAt(0)\n break\n case 'End':\n event.preventDefault()\n focusAt(items().length - 1)\n break\n case 'Tab':\n // Tab leaves the menu rather than cycling inside it. This is the one\n // place a menu differs from a dialog, and getting it backwards traps\n // somebody in a list of links.\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) open.value = false\n}\n\n/* `immediate`, because a menu can be mounted already open -- a caller driving\n it from a route, or a test. Without it that menu has no outside-click\n listener and never moves focus, and nothing says so: it looks open and\n behaves like a div. The closed case is a no-op, since removing a listener\n that was never added is free and focus is only taken back from inside. */\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) {\n document.addEventListener('pointerdown', onDocumentPointer)\n await nextTick()\n items()[0]?.focus()\n } else {\n document.removeEventListener('pointerdown', onDocumentPointer)\n // Only take focus back if it is still inside the menu; otherwise the menu\n // is closing *because* the reader went somewhere else, and dragging them\n // back is the rudest thing it could do.\n if (root.value?.contains(document.activeElement)) trigger.value?.focus()\n }\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-menu\" @keydown=\"onKeydown\">\n <button\n ref=\"trigger\"\n type=\"button\"\n class=\"rk-menu-trigger\"\n :aria-label=\"label\"\n :aria-expanded=\"open\"\n :aria-haspopup=\"true\"\n :aria-controls=\"open ? id : undefined\"\n @click=\"open = !open\"\n >\n <slot name=\"trigger\" :open=\"open\" />\n </button>\n\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-menu-panel surface-overlay\"\n :class=\"`is-${align}`\"\n role=\"menu\"\n >\n <slot />\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-menu {\n position: relative;\n display: inline-flex;\n}\n\n.rk-menu-trigger {\n display: inline-flex;\n border-radius: var(--radius-cell);\n}\n\n.rk-menu-trigger:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-menu-panel {\n position: absolute;\n top: calc(100% + 0.5rem);\n z-index: 50;\n min-width: 12rem;\n overflow: hidden;\n border-radius: var(--radius-card);\n padding: 0.375rem;\n}\n\n.rk-menu-panel.is-end {\n right: 0;\n}\n\n.rk-menu-panel.is-start {\n left: 0;\n}\n\n/* The items belong to the caller, so this styles them by role rather than by\n class: whatever they render, it lines up. */\n.rk-menu-panel :deep([role='menuitem']) {\n display: block;\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.75rem;\n text-align: left;\n font-size: 0.875rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast);\n}\n\n.rk-menu-panel :deep([role='menuitem']:hover) {\n background: var(--color-muted);\n}\n\n.rk-menu-panel :deep([role='menuitem']:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n.rk-menu-panel :deep(hr) {\n margin: 0.375rem 0;\n height: 1px;\n border: 0;\n background: color-mix(in srgb, var(--color-hair) 70%, transparent);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A surface with a border, and optionally a head and a foot.\n *\n * Every app here had written this div. That is not a crisis on its own — it is\n * four classes — but it is four classes that were slightly different in each,\n * so a card on one screen had a heavier border than a card on the next and\n * nobody could say why.\n *\n * With no head and no foot there is no wrapper div: the padding lands on the\n * card itself and the card *is* the element. That matters more than a saved\n * node — most cards in the apps lay their contents out (`flex items-center\n * gap-4`, `flex flex-col gap-3`), and with a wrapper in the way those classes\n * reach the border and not the content, so the app has to add back the div\n * this component exists to remove. One that makes you do that is one you skip.\n *\n * `interactive` is for a card that is a link or a button: it adds the lift and\n * the press, and it is opt-in because a card holding a form should not move\n * when the pointer crosses it.\n */\nconst {\n interactive = false,\n as = 'div',\n padding = 'md',\n} = defineProps<{\n interactive?: boolean | undefined\n as?: string | undefined\n /**\n * How much room the card gives its contents.\n *\n * This component shipped with `px-5 py-4` baked in and was then used by\n * nobody, across three apps and thirty-five hand-written card surfaces —\n * which used `p-3` six times, `p-4` six times, `p-5` five times and `p-1`\n * four times, and not once the pair this insisted on. A card that fixes its\n * padding cannot be reached for, which is the same mistake `PageContainer`\n * made with its width and `size=\"sm\"` made with its height.\n *\n * `none` is for a card that holds a list: the rows own the padding, and the\n * dividers have to reach the border.\n */\n padding?: 'none' | 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst BODY = {\n none: '',\n sm: 'p-3',\n md: 'p-4',\n lg: 'p-5',\n} as const\n\n/* The head and the foot follow the body, so a card cannot be tight around its\n contents and loose around its title. */\nconst HEAD = {\n none: '',\n sm: 'px-3 py-2.5',\n md: 'px-4 py-3',\n lg: 'px-5 py-4',\n} as const\n</script>\n\n<template>\n <component\n :is=\"as\"\n class=\"surface rounded-card\"\n :class=\"[\n interactive\n ? 'ease-standard transition-[transform,box-shadow] duration-(--duration-slow) hover:-translate-y-0.5 hover:[--surface-shadow:var(--shadow-raised)] active:translate-y-0 active:[--surface-shadow:var(--shadow-card)]'\n : '',\n $slots.head || $slots.foot ? '' : BODY[padding],\n ]\"\n >\n <div v-if=\"$slots.head\" class=\"border-hair/70 border-b\" :class=\"HEAD[padding]\">\n <slot name=\"head\" />\n </div>\n\n <div v-if=\"$slots.head || $slots.foot\" :class=\"BODY[padding]\"><slot /></div>\n <slot v-else />\n\n <div v-if=\"$slots.foot\" class=\"border-hair/70 bg-muted/30 border-t\" :class=\"HEAD[padding]\">\n <slot name=\"foot\" />\n </div>\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A surface with a border, and optionally a head and a foot.\n *\n * Every app here had written this div. That is not a crisis on its own — it is\n * four classes — but it is four classes that were slightly different in each,\n * so a card on one screen had a heavier border than a card on the next and\n * nobody could say why.\n *\n * With no head and no foot there is no wrapper div: the padding lands on the\n * card itself and the card *is* the element. That matters more than a saved\n * node — most cards in the apps lay their contents out (`flex items-center\n * gap-4`, `flex flex-col gap-3`), and with a wrapper in the way those classes\n * reach the border and not the content, so the app has to add back the div\n * this component exists to remove. One that makes you do that is one you skip.\n *\n * `interactive` is for a card that is a link or a button: it adds the lift and\n * the press, and it is opt-in because a card holding a form should not move\n * when the pointer crosses it.\n */\nconst {\n interactive = false,\n as = 'div',\n padding = 'md',\n} = defineProps<{\n interactive?: boolean | undefined\n as?: string | undefined\n /**\n * How much room the card gives its contents.\n *\n * This component shipped with `px-5 py-4` baked in and was then used by\n * nobody, across three apps and thirty-five hand-written card surfaces —\n * which used `p-3` six times, `p-4` six times, `p-5` five times and `p-1`\n * four times, and not once the pair this insisted on. A card that fixes its\n * padding cannot be reached for, which is the same mistake `PageContainer`\n * made with its width and `size=\"sm\"` made with its height.\n *\n * `none` is for a card that holds a list: the rows own the padding, and the\n * dividers have to reach the border.\n */\n padding?: 'none' | 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst BODY = {\n none: '',\n sm: 'p-3',\n md: 'p-4',\n lg: 'p-5',\n} as const\n\n/* The head and the foot follow the body, so a card cannot be tight around its\n contents and loose around its title. */\nconst HEAD = {\n none: '',\n sm: 'px-3 py-2.5',\n md: 'px-4 py-3',\n lg: 'px-5 py-4',\n} as const\n</script>\n\n<template>\n <component\n :is=\"as\"\n class=\"surface rounded-card\"\n :class=\"[\n interactive\n ? 'ease-standard transition-[transform,box-shadow] duration-(--duration-slow) hover:-translate-y-0.5 hover:[--surface-shadow:var(--shadow-raised)] active:translate-y-0 active:[--surface-shadow:var(--shadow-card)]'\n : '',\n $slots.head || $slots.foot ? '' : BODY[padding],\n ]\"\n >\n <div v-if=\"$slots.head\" class=\"border-hair/70 border-b\" :class=\"HEAD[padding]\">\n <slot name=\"head\" />\n </div>\n\n <div v-if=\"$slots.head || $slots.foot\" :class=\"BODY[padding]\"><slot /></div>\n <slot v-else />\n\n <div v-if=\"$slots.foot\" class=\"border-hair/70 bg-muted/30 border-t\" :class=\"HEAD[padding]\">\n <slot name=\"foot\" />\n </div>\n </component>\n</template>\n","<script setup lang=\"ts\" generic=\"V extends string\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\nexport interface ComboboxOption<V extends string> {\n value: V\n /** Already translated. */\n label: string\n}\n\n/**\n * A field you type into to narrow a list, then choose from it.\n *\n * ## When to reach for this instead of `BaseSelect`\n *\n * A native select is better up to a few dozen options: it uses the platform's\n * own picker, which on a phone is a wheel the reader already knows and which no\n * web control can match. This is for when the list is long enough that reading\n * it is the problem — a country, a currency, a course — and typing three\n * letters beats scrolling.\n *\n * ## What the pattern requires\n *\n * The ARIA combobox is prescribed down to which element owns which attribute,\n * and hand-written ones get the same three things wrong:\n *\n * - **`aria-activedescendant`, not focus.** Focus stays in the text field while\n * the arrows move a highlight through the list. Moving real focus into the\n * list means typing stops working, which is the entire point of the control.\n * - **`aria-expanded` on the input**, not the wrapper. A screen reader looks for\n * it on the element with `role=\"combobox\"`.\n * - **Escape closes before it clears.** One press shuts the list, a second\n * empties the field. Clearing on the first press throws away what was typed\n * when somebody only wanted the list out of the way.\n *\n * The highlighted option is scrolled into view, because a highlight below the\n * fold is a selection nobody can see.\n */\nconst {\n label,\n options,\n placeholder = '',\n hint = '',\n error = '',\n disabled = false,\n emptyLabel,\n} = defineProps<{\n label: string\n options: readonly ComboboxOption<V>[]\n placeholder?: string | undefined\n hint?: string | undefined\n error?: string | undefined\n disabled?: boolean | undefined\n /** Shown when nothing matches. Already translated. */\n emptyLabel: string\n}>()\n\nconst model = defineModel<V | ''>({ default: '' })\n\nconst id = useId()\nconst listId = `${id}-list`\nconst hintId = `${id}-hint`\nconst errorId = `${id}-error`\nconst optionId = (index: number) => `${id}-opt-${index}`\n\nconst open = ref(false)\nconst query = ref('')\nconst highlighted = ref(0)\nconst root = ref<HTMLElement | null>(null)\nconst list = ref<HTMLElement | null>(null)\n\nconst selected = computed(() => options.find((option) => option.value === model.value))\n\n/** What the input shows: the query while typing, the chosen label otherwise. */\nconst text = computed({\n get: () => (open.value ? query.value : (selected.value?.label ?? '')),\n set: (value: string) => {\n query.value = value\n open.value = true\n highlighted.value = 0\n },\n})\n\nconst matches = computed(() => {\n const needle = query.value.trim().toLowerCase()\n if (!open.value || needle === '') return options\n\n return options.filter((option) => option.label.toLowerCase().includes(needle))\n})\n\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n\nfunction choose(option: ComboboxOption<V> | undefined) {\n if (!option) return\n\n model.value = option.value\n query.value = ''\n open.value = false\n}\n\nfunction move(delta: number) {\n const count = matches.value.length\n if (count === 0) return\n\n open.value = true\n highlighted.value = (highlighted.value + delta + count) % count\n void scrollHighlightIntoView()\n}\n\nasync function scrollHighlightIntoView() {\n await nextTick()\n const el = list.value?.children[highlighted.value] as HTMLElement | undefined\n // A highlight below the fold is a selection nobody can see. Feature-detected\n // rather than called: `scrollIntoView` is missing in jsdom and in more than\n // one embedded webview, and a keyboard that throws is worse than a list that\n // does not scroll.\n el?.scrollIntoView?.({ block: 'nearest' })\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n move(1)\n break\n case 'ArrowUp':\n event.preventDefault()\n move(-1)\n break\n case 'Enter':\n if (!open.value) return\n event.preventDefault()\n choose(matches.value[highlighted.value])\n break\n case 'Escape':\n // Close first, clear second. One press to get the list out of the way\n // without losing what was typed.\n event.preventDefault()\n if (open.value) {\n open.value = false\n query.value = ''\n } else {\n model.value = ''\n }\n break\n case 'Tab':\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) {\n open.value = false\n query.value = ''\n }\n}\n\nwatch(\n open,\n (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) document.addEventListener('pointerdown', onDocumentPointer)\n else document.removeEventListener('pointerdown', onDocumentPointer)\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-combo\">\n <label :for=\"id\" class=\"rk-combo-label\">{{ label }}</label>\n\n <div class=\"rk-combo-field\">\n <input\n :id=\"id\"\n v-model=\"text\"\n type=\"text\"\n role=\"combobox\"\n class=\"rk-combo-input control\"\n autocomplete=\"off\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :aria-expanded=\"open\"\n :aria-controls=\"listId\"\n aria-autocomplete=\"list\"\n :aria-activedescendant=\"open ? optionId(highlighted) : undefined\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"describedBy\"\n @keydown=\"onKeydown\"\n @focus=\"open = true\"\n />\n\n <button\n type=\"button\"\n class=\"rk-combo-toggle\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :disabled=\"disabled\"\n @click=\"open = !open\"\n >\n ▾\n </button>\n </div>\n\n <ul\n v-show=\"open\"\n :id=\"listId\"\n ref=\"list\"\n role=\"listbox\"\n class=\"rk-combo-list surface-overlay\"\n :aria-label=\"label\"\n >\n <li\n v-for=\"(option, index) in matches\"\n :id=\"optionId(index)\"\n :key=\"option.value\"\n role=\"option\"\n class=\"rk-combo-option\"\n :class=\"{\n 'is-highlighted': index === highlighted,\n 'is-selected': option.value === model,\n }\"\n :aria-selected=\"option.value === model\"\n @pointerdown.prevent=\"choose(option)\"\n @pointermove=\"highlighted = index\"\n >\n {{ option.label }}\n </li>\n\n <li v-if=\"matches.length === 0\" class=\"rk-combo-empty\">{{ emptyLabel }}</li>\n </ul>\n\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-combo-error\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"rk-combo-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-combo {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n}\n\n.rk-combo-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-combo-field {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n/* 16px, like every other text control here: iOS zooms the viewport when it\n focuses a field under 16px and never zooms back. */\n.rk-combo-input {\n width: 100%;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 2rem 0 0.75rem;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-combo-input:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -1px;\n}\n\n.rk-combo-input:disabled {\n opacity: 0.5;\n}\n\n.rk-combo-toggle {\n position: absolute;\n right: 0.5rem;\n color: var(--color-ink-soft);\n font-size: 0.75rem;\n}\n\n.rk-combo-list {\n position: absolute;\n top: calc(100% - 1.25rem);\n z-index: 50;\n max-height: 14rem;\n width: 100%;\n overflow-y: auto;\n border-radius: var(--radius-card);\n padding: 0.25rem;\n}\n\n.rk-combo-option {\n cursor: pointer;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink);\n}\n\n.rk-combo-option.is-highlighted {\n background: var(--color-muted);\n}\n\n.rk-combo-option.is-selected {\n font-weight: 600;\n}\n\n.rk-combo-empty {\n padding: 0.75rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n}\n\n.rk-combo-error {\n font-size: 0.75rem;\n color: var(--color-negative);\n}\n\n.rk-combo-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"V extends string\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\nexport interface ComboboxOption<V extends string> {\n value: V\n /** Already translated. */\n label: string\n}\n\n/**\n * A field you type into to narrow a list, then choose from it.\n *\n * ## When to reach for this instead of `BaseSelect`\n *\n * A native select is better up to a few dozen options: it uses the platform's\n * own picker, which on a phone is a wheel the reader already knows and which no\n * web control can match. This is for when the list is long enough that reading\n * it is the problem — a country, a currency, a course — and typing three\n * letters beats scrolling.\n *\n * ## What the pattern requires\n *\n * The ARIA combobox is prescribed down to which element owns which attribute,\n * and hand-written ones get the same three things wrong:\n *\n * - **`aria-activedescendant`, not focus.** Focus stays in the text field while\n * the arrows move a highlight through the list. Moving real focus into the\n * list means typing stops working, which is the entire point of the control.\n * - **`aria-expanded` on the input**, not the wrapper. A screen reader looks for\n * it on the element with `role=\"combobox\"`.\n * - **Escape closes before it clears.** One press shuts the list, a second\n * empties the field. Clearing on the first press throws away what was typed\n * when somebody only wanted the list out of the way.\n *\n * The highlighted option is scrolled into view, because a highlight below the\n * fold is a selection nobody can see.\n */\nconst {\n label,\n options,\n placeholder = '',\n hint = '',\n error = '',\n disabled = false,\n emptyLabel,\n} = defineProps<{\n label: string\n options: readonly ComboboxOption<V>[]\n placeholder?: string | undefined\n hint?: string | undefined\n error?: string | undefined\n disabled?: boolean | undefined\n /** Shown when nothing matches. Already translated. */\n emptyLabel: string\n}>()\n\nconst model = defineModel<V | ''>({ default: '' })\n\nconst id = useId()\nconst listId = `${id}-list`\nconst hintId = `${id}-hint`\nconst errorId = `${id}-error`\nconst optionId = (index: number) => `${id}-opt-${index}`\n\nconst open = ref(false)\nconst query = ref('')\nconst highlighted = ref(0)\nconst root = ref<HTMLElement | null>(null)\nconst list = ref<HTMLElement | null>(null)\n\nconst selected = computed(() => options.find((option) => option.value === model.value))\n\n/** What the input shows: the query while typing, the chosen label otherwise. */\nconst text = computed({\n get: () => (open.value ? query.value : (selected.value?.label ?? '')),\n set: (value: string) => {\n query.value = value\n open.value = true\n highlighted.value = 0\n },\n})\n\nconst matches = computed(() => {\n const needle = query.value.trim().toLowerCase()\n if (!open.value || needle === '') return options\n\n return options.filter((option) => option.label.toLowerCase().includes(needle))\n})\n\nconst describedBy = computed(() => {\n if (error) return errorId\n if (hint) return hintId\n return undefined\n})\n\nfunction choose(option: ComboboxOption<V> | undefined) {\n if (!option) return\n\n model.value = option.value\n query.value = ''\n open.value = false\n}\n\nfunction move(delta: number) {\n const count = matches.value.length\n if (count === 0) return\n\n open.value = true\n highlighted.value = (highlighted.value + delta + count) % count\n void scrollHighlightIntoView()\n}\n\nasync function scrollHighlightIntoView() {\n await nextTick()\n const el = list.value?.children[highlighted.value] as HTMLElement | undefined\n // A highlight below the fold is a selection nobody can see. Feature-detected\n // rather than called: `scrollIntoView` is missing in jsdom and in more than\n // one embedded webview, and a keyboard that throws is worse than a list that\n // does not scroll.\n el?.scrollIntoView?.({ block: 'nearest' })\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n move(1)\n break\n case 'ArrowUp':\n event.preventDefault()\n move(-1)\n break\n case 'Enter':\n if (!open.value) return\n event.preventDefault()\n choose(matches.value[highlighted.value])\n break\n case 'Escape':\n // Close first, clear second. One press to get the list out of the way\n // without losing what was typed.\n event.preventDefault()\n if (open.value) {\n open.value = false\n query.value = ''\n } else {\n model.value = ''\n }\n break\n case 'Tab':\n open.value = false\n break\n }\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) {\n open.value = false\n query.value = ''\n }\n}\n\nwatch(\n open,\n (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (isOpen) document.addEventListener('pointerdown', onDocumentPointer)\n else document.removeEventListener('pointerdown', onDocumentPointer)\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-combo\">\n <label :for=\"id\" class=\"rk-combo-label\">{{ label }}</label>\n\n <div class=\"rk-combo-field\">\n <input\n :id=\"id\"\n v-model=\"text\"\n type=\"text\"\n role=\"combobox\"\n class=\"rk-combo-input control\"\n autocomplete=\"off\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :aria-expanded=\"open\"\n :aria-controls=\"listId\"\n aria-autocomplete=\"list\"\n :aria-activedescendant=\"open ? optionId(highlighted) : undefined\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"describedBy\"\n @keydown=\"onKeydown\"\n @focus=\"open = true\"\n />\n\n <button\n type=\"button\"\n class=\"rk-combo-toggle\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n :disabled=\"disabled\"\n @click=\"open = !open\"\n >\n ▾\n </button>\n </div>\n\n <ul\n v-show=\"open\"\n :id=\"listId\"\n ref=\"list\"\n role=\"listbox\"\n class=\"rk-combo-list surface-overlay\"\n :aria-label=\"label\"\n >\n <li\n v-for=\"(option, index) in matches\"\n :id=\"optionId(index)\"\n :key=\"option.value\"\n role=\"option\"\n class=\"rk-combo-option\"\n :class=\"{\n 'is-highlighted': index === highlighted,\n 'is-selected': option.value === model,\n }\"\n :aria-selected=\"option.value === model\"\n @pointerdown.prevent=\"choose(option)\"\n @pointermove=\"highlighted = index\"\n >\n {{ option.label }}\n </li>\n\n <li v-if=\"matches.length === 0\" class=\"rk-combo-empty\">{{ emptyLabel }}</li>\n </ul>\n\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-combo-error\">{{ error }}</p>\n <p v-else-if=\"hint\" :id=\"hintId\" class=\"rk-combo-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-combo {\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n}\n\n.rk-combo-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-combo-field {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n/* 16px, like every other text control here: iOS zooms the viewport when it\n focuses a field under 16px and never zooms back. */\n.rk-combo-input {\n width: 100%;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 2rem 0 0.75rem;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-combo-input:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -1px;\n}\n\n.rk-combo-input:disabled {\n opacity: 0.5;\n}\n\n.rk-combo-toggle {\n position: absolute;\n right: 0.5rem;\n color: var(--color-ink-soft);\n font-size: 0.75rem;\n}\n\n.rk-combo-list {\n position: absolute;\n top: calc(100% - 1.25rem);\n z-index: 50;\n max-height: 14rem;\n width: 100%;\n overflow-y: auto;\n border-radius: var(--radius-card);\n padding: 0.25rem;\n}\n\n.rk-combo-option {\n cursor: pointer;\n border-radius: var(--radius-cell);\n padding: 0.5rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink);\n}\n\n.rk-combo-option.is-highlighted {\n background: var(--color-muted);\n}\n\n.rk-combo-option.is-selected {\n font-weight: 600;\n}\n\n.rk-combo-empty {\n padding: 0.75rem 0.625rem;\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n}\n\n.rk-combo-error {\n font-size: 0.75rem;\n color: var(--color-negative);\n}\n\n.rk-combo-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\nimport { useBoundValue } from '../composables/use-bound-value'\n\n/**\n * A set of radios, and the reason there is no `BaseRadio`.\n *\n * One radio on its own is not a control — it is half of a choice that cannot\n * be unmade, and every real use is a group. So the group is the component.\n *\n * `fieldset` and `legend` rather than a label: a label points at one element,\n * and the thing being named here is the question, not any single answer. Left\n * as a plain label, a screen reader reads the options with no idea what they\n * are options for.\n */\nconst {\n modelValue = undefined,\n legend,\n options,\n error = '',\n hint = '',\n legendHidden = false,\n} = defineProps<{\n /** The chosen option's value, with `v-model`. */\n modelValue?: string | undefined\n legend: string\n options: readonly { value: string; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n legendHidden?: boolean | undefined\n}>()\n\n/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <fieldset class=\"flex flex-col gap-1.5\" :aria-describedby=\"describedBy\">\n <legend class=\"text-ink mb-1.5 text-sm font-medium\" :class=\"legendHidden ? 'sr-only' : ''\">\n {{ legend }}\n </legend>\n\n <label\n v-for=\"option in options\"\n :key=\"option.value\"\n class=\"flex items-center gap-3\"\n :class=\"option.disabled ? 'opacity-50' : 'cursor-pointer'\"\n >\n <input\n v-model=\"model\"\n type=\"radio\"\n :name=\"id\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\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-ink text-sm\">{{ option.label }}</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 </fieldset>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\nimport { useBoundValue } from '../composables/use-bound-value'\n\n/**\n * A set of radios, and the reason there is no `BaseRadio`.\n *\n * One radio on its own is not a control — it is half of a choice that cannot\n * be unmade, and every real use is a group. So the group is the component.\n *\n * `fieldset` and `legend` rather than a label: a label points at one element,\n * and the thing being named here is the question, not any single answer. Left\n * as a plain label, a screen reader reads the options with no idea what they\n * are options for.\n */\nconst {\n modelValue = undefined,\n legend,\n options,\n error = '',\n hint = '',\n legendHidden = false,\n} = defineProps<{\n /** The chosen option's value, with `v-model`. */\n modelValue?: string | undefined\n legend: string\n options: readonly { value: string; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n legendHidden?: boolean | undefined\n}>()\n\n/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <fieldset class=\"flex flex-col gap-1.5\" :aria-describedby=\"describedBy\">\n <legend class=\"text-ink mb-1.5 text-sm font-medium\" :class=\"legendHidden ? 'sr-only' : ''\">\n {{ legend }}\n </legend>\n\n <label\n v-for=\"option in options\"\n :key=\"option.value\"\n class=\"flex items-center gap-3\"\n :class=\"option.disabled ? 'opacity-50' : 'cursor-pointer'\"\n >\n <input\n v-model=\"model\"\n type=\"radio\"\n :name=\"id\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\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-ink text-sm\">{{ option.label }}</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 </fieldset>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { ChevronDown } from 'lucide-vue-next'\n\nimport FormField from './FormField.vue'\n\n/**\n * A native `<select>`, wearing the kit's field.\n *\n * Native on purpose. A custom listbox has to reimplement typeahead, the\n * keyboard, and the way a phone lifts the options into its own picker — and it\n * gets one of them wrong. What is worth replacing is the chrome, so the arrow\n * is drawn and the browser's own is removed.\n *\n * Options are passed rather than slotted so the label can be a translated\n * string the kit never sees.\n *\n * Generic over the value, because a select whose value must be a string makes\n * every consumer with numbered options write conversion glue on both sides of\n * it — and a component you have to wrap to use is one you write yourself\n * instead. A day of the month is a number.\n */\nconst {\n label,\n options,\n error = '',\n hint = '',\n labelHidden = false,\n placeholder = '',\n size = 'md',\n variant = 'default',\n} = defineProps<{\n label: string\n options: readonly { value: T; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n /**\n * An unselectable first row, for a field with no sensible default.\n *\n * Disabled rather than merely empty: an empty option that can be chosen lets\n * someone go back to having answered nothing, which no form wants.\n */\n placeholder?: string | undefined\n /**\n * `sm` for a select that filters or sorts rather than answers a form.\n *\n * Every hand-written select across the three consuming apps was this one.\n */\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 scale is typographic, not dimensional. Both sizes keep the 44px touch\n target — of the five hand-written controls this replaces, none was shorter\n than 40px and two were exactly 44, and a select that filters a list is\n pressed with the same thumb as one that answers a form. What changes is the\n type, and with it how loudly the field asks to be read. */\nconst SIZE_CLASS = {\n sm: 'h-11 text-sm',\n md: 'h-11 text-base',\n} as const\n\nconst model = defineModel<T | 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 <div class=\"relative\">\n <select\n :id=\"id\"\n v-model=\"model\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n class=\"w-full appearance-none\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary py-0 pr-10 pl-3 focus-visible:outline-2 focus-visible:outline-offset-1',\n variant === 'unstyled' ? '' : SIZE_CLASS[size],\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n >\n <option v-if=\"placeholder\" :value=\"undefined\" disabled>{{ placeholder }}</option>\n <option\n v-for=\"option in options\"\n :key=\"option.value\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <ChevronDown\n class=\"text-ink-soft pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2\"\n aria-hidden=\"true\"\n />\n </div>\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { ChevronDown } from 'lucide-vue-next'\n\nimport FormField from './FormField.vue'\n\n/**\n * A native `<select>`, wearing the kit's field.\n *\n * Native on purpose. A custom listbox has to reimplement typeahead, the\n * keyboard, and the way a phone lifts the options into its own picker — and it\n * gets one of them wrong. What is worth replacing is the chrome, so the arrow\n * is drawn and the browser's own is removed.\n *\n * Options are passed rather than slotted so the label can be a translated\n * string the kit never sees.\n *\n * Generic over the value, because a select whose value must be a string makes\n * every consumer with numbered options write conversion glue on both sides of\n * it — and a component you have to wrap to use is one you write yourself\n * instead. A day of the month is a number.\n */\nconst {\n label,\n options,\n error = '',\n hint = '',\n labelHidden = false,\n placeholder = '',\n size = 'md',\n variant = 'default',\n} = defineProps<{\n label: string\n options: readonly { value: T; label: string; disabled?: boolean | undefined }[]\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n /**\n * An unselectable first row, for a field with no sensible default.\n *\n * Disabled rather than merely empty: an empty option that can be chosen lets\n * someone go back to having answered nothing, which no form wants.\n */\n placeholder?: string | undefined\n /**\n * `sm` for a select that filters or sorts rather than answers a form.\n *\n * Every hand-written select across the three consuming apps was this one.\n */\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 scale is typographic, not dimensional. Both sizes keep the 44px touch\n target — of the five hand-written controls this replaces, none was shorter\n than 40px and two were exactly 44, and a select that filters a list is\n pressed with the same thumb as one that answers a form. What changes is the\n type, and with it how loudly the field asks to be read. */\nconst SIZE_CLASS = {\n sm: 'h-11 text-sm',\n md: 'h-11 text-base',\n} as const\n\nconst model = defineModel<T | 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 <div class=\"relative\">\n <select\n :id=\"id\"\n v-model=\"model\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n class=\"w-full appearance-none\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary py-0 pr-10 pl-3 focus-visible:outline-2 focus-visible:outline-offset-1',\n variant === 'unstyled' ? '' : SIZE_CLASS[size],\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n >\n <option v-if=\"placeholder\" :value=\"undefined\" disabled>{{ placeholder }}</option>\n <option\n v-for=\"option in options\"\n :key=\"option.value\"\n :value=\"option.value\"\n :disabled=\"option.disabled\"\n >\n {{ option.label }}\n </option>\n </select>\n\n <ChevronDown\n class=\"text-ink-soft pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2\"\n aria-hidden=\"true\"\n />\n </div>\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A value picked from a range, where roughly right is the point.\n *\n * A native `input[type=\"range\"]`, painted. That is deliberate: the native\n * control already has the keyboard (arrows, Page Up/Down, Home/End), the\n * pointer, the touch target and the correct announcements, and every\n * hand-rolled slider gives some of that up. What it does not have is a look\n * that matches the rest of the kit, so the look is all that is replaced.\n *\n * `aria-valuetext` is the part worth stopping on. Without it a screen reader\n * reads the number alone — \"45\" — and a number with no unit is not an answer to\n * anything. Pass `format` and it reads \"45 minutes\".\n */\nconst {\n label,\n min = 0,\n max = 100,\n step = 1,\n hint = '',\n disabled = false,\n format,\n showValue = true,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n step?: number | undefined\n hint?: string | undefined\n disabled?: boolean | undefined\n /**\n * Turns the number into something a person would say — \"45 minutes\", \"₺12\".\n *\n * Used for the visible readout and for `aria-valuetext`, so both say the same\n * thing and neither is a bare number.\n */\n format?: ((value: number) => string) | undefined\n showValue?: boolean | undefined\n}>()\n\nconst model = defineModel<number>({ default: 0 })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst text = computed(() => (format ? format(model.value) : String(model.value)))\n/** Where the fill stops, as a percentage of the track. */\nconst filled = computed(() => {\n const span = max - min\n return span <= 0 ? 0 : ((model.value - min) / span) * 100\n})\n</script>\n\n<template>\n <div class=\"rk-slider\">\n <div class=\"rk-slider-head\">\n <label :for=\"id\" class=\"rk-slider-label\">{{ label }}</label>\n <output v-if=\"showValue\" :for=\"id\" class=\"rk-slider-value\">{{ text }}</output>\n </div>\n\n <input\n :id=\"id\"\n v-model.number=\"model\"\n type=\"range\"\n class=\"rk-slider-input\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"disabled\"\n :aria-valuetext=\"text\"\n :aria-describedby=\"hint ? hintId : undefined\"\n :style=\"{ '--rk-slider-filled': `${filled}%` }\"\n />\n\n <p v-if=\"hint\" :id=\"hintId\" class=\"rk-slider-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-slider {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-slider-head {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 1rem;\n}\n\n.rk-slider-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-slider-value {\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n font-variant-numeric: tabular-nums;\n}\n\n.rk-slider-input {\n width: 100%;\n height: 1.25rem;\n appearance: none;\n background: transparent;\n cursor: pointer;\n}\n\n.rk-slider-input:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n/* The two engines will not accept these in one rule: an unknown pseudo-element\n invalidates the whole selector, so WebKit and Firefox are written twice. */\n.rk-slider-input::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: linear-gradient(\n to right,\n var(--color-primary) var(--rk-slider-filled, 0%),\n var(--color-hair) var(--rk-slider-filled, 0%)\n );\n}\n\n.rk-slider-input::-moz-range-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-hair);\n}\n\n.rk-slider-input::-moz-range-progress {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-primary);\n}\n\n.rk-slider-input::-webkit-slider-thumb {\n appearance: none;\n margin-top: -0.4375rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n background: var(--color-surface);\n border: 2px solid var(--color-primary);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input::-moz-range-thumb {\n width: 1.25rem;\n height: 1.25rem;\n border: 2px solid var(--color-primary);\n border-radius: 9999px;\n background: var(--color-surface);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input:focus-visible::-webkit-slider-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-input:focus-visible::-moz-range-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A value picked from a range, where roughly right is the point.\n *\n * A native `input[type=\"range\"]`, painted. That is deliberate: the native\n * control already has the keyboard (arrows, Page Up/Down, Home/End), the\n * pointer, the touch target and the correct announcements, and every\n * hand-rolled slider gives some of that up. What it does not have is a look\n * that matches the rest of the kit, so the look is all that is replaced.\n *\n * `aria-valuetext` is the part worth stopping on. Without it a screen reader\n * reads the number alone — \"45\" — and a number with no unit is not an answer to\n * anything. Pass `format` and it reads \"45 minutes\".\n */\nconst {\n label,\n min = 0,\n max = 100,\n step = 1,\n hint = '',\n disabled = false,\n format,\n showValue = true,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n step?: number | undefined\n hint?: string | undefined\n disabled?: boolean | undefined\n /**\n * Turns the number into something a person would say — \"45 minutes\", \"₺12\".\n *\n * Used for the visible readout and for `aria-valuetext`, so both say the same\n * thing and neither is a bare number.\n */\n format?: ((value: number) => string) | undefined\n showValue?: boolean | undefined\n}>()\n\nconst model = defineModel<number>({ default: 0 })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst text = computed(() => (format ? format(model.value) : String(model.value)))\n/** Where the fill stops, as a percentage of the track. */\nconst filled = computed(() => {\n const span = max - min\n return span <= 0 ? 0 : ((model.value - min) / span) * 100\n})\n</script>\n\n<template>\n <div class=\"rk-slider\">\n <div class=\"rk-slider-head\">\n <label :for=\"id\" class=\"rk-slider-label\">{{ label }}</label>\n <output v-if=\"showValue\" :for=\"id\" class=\"rk-slider-value\">{{ text }}</output>\n </div>\n\n <input\n :id=\"id\"\n v-model.number=\"model\"\n type=\"range\"\n class=\"rk-slider-input\"\n :min=\"min\"\n :max=\"max\"\n :step=\"step\"\n :disabled=\"disabled\"\n :aria-valuetext=\"text\"\n :aria-describedby=\"hint ? hintId : undefined\"\n :style=\"{ '--rk-slider-filled': `${filled}%` }\"\n />\n\n <p v-if=\"hint\" :id=\"hintId\" class=\"rk-slider-hint\">{{ hint }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-slider {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-slider-head {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 1rem;\n}\n\n.rk-slider-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-slider-value {\n font-size: 0.875rem;\n color: var(--color-ink-soft);\n font-variant-numeric: tabular-nums;\n}\n\n.rk-slider-input {\n width: 100%;\n height: 1.25rem;\n appearance: none;\n background: transparent;\n cursor: pointer;\n}\n\n.rk-slider-input:disabled {\n opacity: 0.5;\n cursor: default;\n}\n\n/* The two engines will not accept these in one rule: an unknown pseudo-element\n invalidates the whole selector, so WebKit and Firefox are written twice. */\n.rk-slider-input::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: linear-gradient(\n to right,\n var(--color-primary) var(--rk-slider-filled, 0%),\n var(--color-hair) var(--rk-slider-filled, 0%)\n );\n}\n\n.rk-slider-input::-moz-range-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-hair);\n}\n\n.rk-slider-input::-moz-range-progress {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--color-primary);\n}\n\n.rk-slider-input::-webkit-slider-thumb {\n appearance: none;\n margin-top: -0.4375rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n background: var(--color-surface);\n border: 2px solid var(--color-primary);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input::-moz-range-thumb {\n width: 1.25rem;\n height: 1.25rem;\n border: 2px solid var(--color-primary);\n border-radius: 9999px;\n background: var(--color-surface);\n box-shadow: var(--shadow-control);\n}\n\n.rk-slider-input:focus-visible::-webkit-slider-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-input:focus-visible::-moz-range-thumb {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-slider-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * Work in progress, with no idea how much is left.\n *\n * `ProgressBar` is the one to reach for when the amount is known; this is for\n * when it is not. Showing a bar that cannot move is worse than a spinner,\n * because a bar is a promise about how long.\n *\n * `role=\"status\"` and a label, so a screen reader says what is happening. A\n * spinner with no accessible name is a decoration that happens to be the only\n * thing on screen — which is why `label` is required and not defaulted to\n * \"Loading\" in a language the app may not speak.\n */\nconst { label, size = 'md' } = defineProps<{\n /** What is being waited for. Already translated. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst SIZES = { sm: '1rem', md: '1.5rem', lg: '2.5rem' } as const\n</script>\n\n<template>\n <span class=\"rk-spin-wrap\" role=\"status\">\n <span class=\"rk-spin\" :style=\"{ width: SIZES[size], height: SIZES[size] }\" aria-hidden=\"true\" />\n <!-- Off screen rather than hidden: `display: none` is not announced. -->\n <span class=\"rk-spin-label\">{{ label }}</span>\n </span>\n</template>\n\n<style scoped>\n.rk-spin-wrap {\n display: inline-flex;\n align-items: center;\n}\n\n.rk-spin {\n display: block;\n border-radius: 9999px;\n border: 2px solid color-mix(in srgb, currentColor 20%, transparent);\n border-top-color: currentColor;\n animation: rk-spin 700ms linear infinite;\n}\n\n.rk-spin-label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n@keyframes rk-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Still moving, because a spinner that does not move says the app has hung --\n but a slow fade rather than a fast rotation. */\n@media (prefers-reduced-motion: reduce) {\n .rk-spin {\n animation: rk-pulse 1.4s ease-in-out infinite;\n }\n\n @keyframes rk-pulse {\n 50% {\n opacity: 0.35;\n }\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * Work in progress, with no idea how much is left.\n *\n * `ProgressBar` is the one to reach for when the amount is known; this is for\n * when it is not. Showing a bar that cannot move is worse than a spinner,\n * because a bar is a promise about how long.\n *\n * `role=\"status\"` and a label, so a screen reader says what is happening. A\n * spinner with no accessible name is a decoration that happens to be the only\n * thing on screen — which is why `label` is required and not defaulted to\n * \"Loading\" in a language the app may not speak.\n */\nconst { label, size = 'md' } = defineProps<{\n /** What is being waited for. Already translated. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst SIZES = { sm: '1rem', md: '1.5rem', lg: '2.5rem' } as const\n</script>\n\n<template>\n <span class=\"rk-spin-wrap\" role=\"status\">\n <span class=\"rk-spin\" :style=\"{ width: SIZES[size], height: SIZES[size] }\" aria-hidden=\"true\" />\n <!-- Off screen rather than hidden: `display: none` is not announced. -->\n <span class=\"rk-spin-label\">{{ label }}</span>\n </span>\n</template>\n\n<style scoped>\n.rk-spin-wrap {\n display: inline-flex;\n align-items: center;\n}\n\n.rk-spin {\n display: block;\n border-radius: 9999px;\n border: 2px solid color-mix(in srgb, currentColor 20%, transparent);\n border-top-color: currentColor;\n animation: rk-spin 700ms linear infinite;\n}\n\n.rk-spin-label {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n@keyframes rk-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n/* Still moving, because a spinner that does not move says the app has hung --\n but a slow fade rather than a fast rotation. */\n@media (prefers-reduced-motion: reduce) {\n .rk-spin {\n animation: rk-pulse 1.4s ease-in-out infinite;\n }\n\n @keyframes rk-pulse {\n 50% {\n opacity: 0.35;\n }\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A setting that takes effect the moment it is touched.\n *\n * Not `BaseCheckbox` with a rounder skin, and the difference is not visual. A\n * checkbox states an intention that something else commits — a form is\n * submitted, a dialog is confirmed. A switch *is* the commit: there is no Save\n * after it, which is why it belongs in a settings row and why a form full of\n * them is usually a form of checkboxes drawn wrong.\n *\n * `role=\"switch\"` rather than a styled checkbox, because a screen reader\n * announces \"on\"/\"off\" for a switch and \"checked\"/\"unchecked\" for a checkbox,\n * and those are different sentences about different things.\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 hint = '',\n disabled = false,\n labelHidden = false,\n} = defineProps<{\n label: string\n hint?: string | undefined\n disabled?: boolean | undefined\n /** For a switch inside a row that already names it — it keeps its accessible name. */\n labelHidden?: boolean | undefined\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst describedBy = computed(() => (hint ? hintId : undefined))\n\nfunction toggle() {\n if (!disabled) model.value = !model.value\n}\n</script>\n\n<template>\n <div class=\"flex items-center justify-between gap-4\">\n <span v-if=\"!labelHidden\" class=\"min-w-0\">\n <span :id=\"id\" class=\"text-ink block text-sm\">{{ label }}</span>\n <span v-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft mt-0.5 block text-xs\">{{ hint }}</span>\n </span>\n\n <!--\n A button, not an <input type=\"checkbox\">. The native control cannot carry\n `role=\"switch\"` in every engine that matters, and the track has to be\n painted anyway; what a native input would have bought is the label\n association, and `aria-labelledby` buys that outright.\n -->\n <button\n type=\"button\"\n role=\"switch\"\n class=\"rk-switch\"\n :class=\"{ 'is-on': model }\"\n :aria-checked=\"model\"\n :aria-labelledby=\"labelHidden ? undefined : id\"\n :aria-label=\"labelHidden ? label : undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @click=\"toggle\"\n >\n <span class=\"rk-switch-knob\" aria-hidden=\"true\" />\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-switch {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n width: 2.75rem;\n height: 1.625rem;\n border-radius: 9999px;\n background: var(--color-hair);\n transition: background-color var(--duration-base) ease;\n}\n\n.rk-switch.is-on {\n background: var(--color-primary);\n}\n\n.rk-switch:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-switch:disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n\n.rk-switch-knob {\n position: absolute;\n left: 0.1875rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n /* The on-colour, because the knob sits on the primary track when it is on,\n and that is exactly the pairing `on-primary` is tuned for. */\n background: var(--color-on-primary);\n box-shadow: var(--shadow-control);\n transition: transform var(--duration-base) var(--ease-sheet);\n}\n\n.rk-switch.is-on .rk-switch-knob {\n transform: translateX(1.125rem);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-switch,\n .rk-switch-knob {\n transition: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\n\n/**\n * A setting that takes effect the moment it is touched.\n *\n * Not `BaseCheckbox` with a rounder skin, and the difference is not visual. A\n * checkbox states an intention that something else commits — a form is\n * submitted, a dialog is confirmed. A switch *is* the commit: there is no Save\n * after it, which is why it belongs in a settings row and why a form full of\n * them is usually a form of checkboxes drawn wrong.\n *\n * `role=\"switch\"` rather than a styled checkbox, because a screen reader\n * announces \"on\"/\"off\" for a switch and \"checked\"/\"unchecked\" for a checkbox,\n * and those are different sentences about different things.\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 hint = '',\n disabled = false,\n labelHidden = false,\n} = defineProps<{\n label: string\n hint?: string | undefined\n disabled?: boolean | undefined\n /** For a switch inside a row that already names it — it keeps its accessible name. */\n labelHidden?: boolean | undefined\n}>()\n\nconst model = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst hintId = `${id}-hint`\n\nconst describedBy = computed(() => (hint ? hintId : undefined))\n\nfunction toggle() {\n if (!disabled) model.value = !model.value\n}\n</script>\n\n<template>\n <div class=\"flex items-center justify-between gap-4\">\n <span v-if=\"!labelHidden\" class=\"min-w-0\">\n <span :id=\"id\" class=\"text-ink block text-sm\">{{ label }}</span>\n <span v-if=\"hint\" :id=\"hintId\" class=\"text-ink-soft mt-0.5 block text-xs\">{{ hint }}</span>\n </span>\n\n <!--\n A button, not an <input type=\"checkbox\">. The native control cannot carry\n `role=\"switch\"` in every engine that matters, and the track has to be\n painted anyway; what a native input would have bought is the label\n association, and `aria-labelledby` buys that outright.\n -->\n <button\n type=\"button\"\n role=\"switch\"\n class=\"rk-switch\"\n :class=\"{ 'is-on': model }\"\n :aria-checked=\"model\"\n :aria-labelledby=\"labelHidden ? undefined : id\"\n :aria-label=\"labelHidden ? label : undefined\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @click=\"toggle\"\n >\n <span class=\"rk-switch-knob\" aria-hidden=\"true\" />\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-switch {\n position: relative;\n display: inline-flex;\n flex-shrink: 0;\n align-items: center;\n width: 2.75rem;\n height: 1.625rem;\n border-radius: 9999px;\n background: var(--color-hair);\n transition: background-color var(--duration-base) ease;\n}\n\n.rk-switch.is-on {\n background: var(--color-primary);\n}\n\n.rk-switch:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-switch:disabled {\n opacity: 0.5;\n pointer-events: none;\n}\n\n.rk-switch-knob {\n position: absolute;\n left: 0.1875rem;\n width: 1.25rem;\n height: 1.25rem;\n border-radius: 9999px;\n /* The on-colour, because the knob sits on the primary track when it is on,\n and that is exactly the pairing `on-primary` is tuned for. */\n background: var(--color-on-primary);\n box-shadow: var(--shadow-control);\n transition: transform var(--duration-base) var(--ease-sheet);\n}\n\n.rk-switch.is-on .rk-switch-knob {\n transform: translateX(1.125rem);\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-switch,\n .rk-switch-knob {\n transition: none;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"Row extends Record<string, unknown>\">\nexport interface Column<Row> {\n /** Key into the row, and the slot name for a custom cell. */\n key: string & keyof Row\n /** Column heading. Already translated. */\n label: string\n /** `end` for money and counts, which are read by their last digit. */\n align?: 'start' | 'end' | undefined\n /** Stops a column wrapping — dates, short codes. */\n nowrap?: boolean | undefined\n}\n\n/**\n * Rows of data, with the parts a hand-written `<table>` leaves out.\n *\n * ## The caption is required, and it is not a heading\n *\n * A table with no caption is announced as \"table\" and nothing else, so a screen\n * reader user landing in one has no idea what they are in. `captionHidden`\n * exists because the page usually already says it in a heading above — but the\n * table still has to carry its own name, because a heading is not attached to\n * anything.\n *\n * ## Scrolling belongs to the table, not the page\n *\n * A wide table inside a narrow column either overflows the page sideways —\n * which takes every other element with it — or is clipped. So the table sits in\n * its own scroller, and the scroller is focusable: a region you can only reach\n * by dragging is a region a keyboard cannot read at all. That is one line of\n * markup and it is the line everyone forgets.\n *\n * Headers carry `scope=\"col\"`, which is what lets a screen reader say the\n * column name before each cell instead of reading a wall of numbers.\n */\nconst {\n columns,\n rows,\n caption,\n captionHidden = false,\n rowKey,\n} = defineProps<{\n columns: readonly Column<Row>[]\n rows: readonly Row[]\n /** What this table is. Required — an unnamed table is a box of numbers. */\n caption: string\n /** Keeps the caption for assistive tech when the page already shows a heading. */\n captionHidden?: boolean | undefined\n /** Which field identifies a row. Falls back to the index. */\n rowKey?: (string & keyof Row) | undefined\n}>()\n\ndefineSlots<{\n /** Per-column cell override, named for the column key. */\n [key: string]: (props: { row: Row; value: unknown }) => unknown\n /** Shown instead of the body when there are no rows. */\n empty?: () => unknown\n}>()\n\nconst keyFor = (row: Row, index: number) => (rowKey ? String(row[rowKey]) : index)\n</script>\n\n<template>\n <div class=\"rk-table-scroll\" tabindex=\"0\" role=\"region\" :aria-label=\"caption\">\n <table class=\"rk-table\">\n <caption :class=\"captionHidden ? 'rk-table-caption-hidden' : 'rk-table-caption'\">\n {{\n caption\n }}\n </caption>\n\n <thead>\n <tr>\n <th\n v-for=\"column in columns\"\n :key=\"column.key\"\n scope=\"col\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n {{ column.label }}\n </th>\n </tr>\n </thead>\n\n <tbody v-if=\"rows.length > 0\">\n <tr v-for=\"(row, index) in rows\" :key=\"keyFor(row, index)\">\n <td\n v-for=\"column in columns\"\n :key=\"column.key\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n <slot :name=\"column.key\" :row=\"row\" :value=\"row[column.key]\">\n {{ row[column.key] }}\n </slot>\n </td>\n </tr>\n </tbody>\n\n <tbody v-else>\n <tr>\n <td :colspan=\"columns.length\" class=\"rk-table-empty\">\n <slot name=\"empty\" />\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n\n<style scoped>\n.rk-table-scroll {\n overflow-x: auto;\n}\n\n.rk-table-scroll:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n border-radius: var(--radius-cell);\n}\n\n.rk-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 0.875rem;\n}\n\n.rk-table-caption {\n padding-bottom: 0.75rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink-soft);\n}\n\n/* Off screen rather than `display: none`, which is not announced at all. */\n.rk-table-caption-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n.rk-table th {\n border-bottom: 1px solid var(--color-hair);\n padding: 0.625rem 0.75rem;\n text-align: left;\n font-weight: 500;\n color: var(--color-ink-soft);\n white-space: nowrap;\n}\n\n.rk-table td {\n border-bottom: 1px solid color-mix(in srgb, var(--color-hair) 50%, transparent);\n padding: 0.75rem;\n color: var(--color-ink);\n vertical-align: top;\n}\n\n.rk-table tbody tr:last-child td {\n border-bottom: 0;\n}\n\n/* Numbers line up on their last digit, which is the one being compared. */\n.is-end {\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\n\n.is-nowrap {\n white-space: nowrap;\n}\n\n.rk-table-empty {\n padding: 2rem 0.75rem;\n text-align: center;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"Row extends Record<string, unknown>\">\nexport interface Column<Row> {\n /** Key into the row, and the slot name for a custom cell. */\n key: string & keyof Row\n /** Column heading. Already translated. */\n label: string\n /** `end` for money and counts, which are read by their last digit. */\n align?: 'start' | 'end' | undefined\n /** Stops a column wrapping — dates, short codes. */\n nowrap?: boolean | undefined\n}\n\n/**\n * Rows of data, with the parts a hand-written `<table>` leaves out.\n *\n * ## The caption is required, and it is not a heading\n *\n * A table with no caption is announced as \"table\" and nothing else, so a screen\n * reader user landing in one has no idea what they are in. `captionHidden`\n * exists because the page usually already says it in a heading above — but the\n * table still has to carry its own name, because a heading is not attached to\n * anything.\n *\n * ## Scrolling belongs to the table, not the page\n *\n * A wide table inside a narrow column either overflows the page sideways —\n * which takes every other element with it — or is clipped. So the table sits in\n * its own scroller, and the scroller is focusable: a region you can only reach\n * by dragging is a region a keyboard cannot read at all. That is one line of\n * markup and it is the line everyone forgets.\n *\n * Headers carry `scope=\"col\"`, which is what lets a screen reader say the\n * column name before each cell instead of reading a wall of numbers.\n */\nconst {\n columns,\n rows,\n caption,\n captionHidden = false,\n rowKey,\n} = defineProps<{\n columns: readonly Column<Row>[]\n rows: readonly Row[]\n /** What this table is. Required — an unnamed table is a box of numbers. */\n caption: string\n /** Keeps the caption for assistive tech when the page already shows a heading. */\n captionHidden?: boolean | undefined\n /** Which field identifies a row. Falls back to the index. */\n rowKey?: (string & keyof Row) | undefined\n}>()\n\ndefineSlots<{\n /** Per-column cell override, named for the column key. */\n [key: string]: (props: { row: Row; value: unknown }) => unknown\n /** Shown instead of the body when there are no rows. */\n empty?: () => unknown\n}>()\n\nconst keyFor = (row: Row, index: number) => (rowKey ? String(row[rowKey]) : index)\n</script>\n\n<template>\n <div class=\"rk-table-scroll\" tabindex=\"0\" role=\"region\" :aria-label=\"caption\">\n <table class=\"rk-table\">\n <caption :class=\"captionHidden ? 'rk-table-caption-hidden' : 'rk-table-caption'\">\n {{\n caption\n }}\n </caption>\n\n <thead>\n <tr>\n <th\n v-for=\"column in columns\"\n :key=\"column.key\"\n scope=\"col\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n {{ column.label }}\n </th>\n </tr>\n </thead>\n\n <tbody v-if=\"rows.length > 0\">\n <tr v-for=\"(row, index) in rows\" :key=\"keyFor(row, index)\">\n <td\n v-for=\"column in columns\"\n :key=\"column.key\"\n :class=\"[column.align === 'end' && 'is-end', column.nowrap && 'is-nowrap']\"\n >\n <slot :name=\"column.key\" :row=\"row\" :value=\"row[column.key]\">\n {{ row[column.key] }}\n </slot>\n </td>\n </tr>\n </tbody>\n\n <tbody v-else>\n <tr>\n <td :colspan=\"columns.length\" class=\"rk-table-empty\">\n <slot name=\"empty\" />\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n\n<style scoped>\n.rk-table-scroll {\n overflow-x: auto;\n}\n\n.rk-table-scroll:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n border-radius: var(--radius-cell);\n}\n\n.rk-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 0.875rem;\n}\n\n.rk-table-caption {\n padding-bottom: 0.75rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink-soft);\n}\n\n/* Off screen rather than `display: none`, which is not announced at all. */\n.rk-table-caption-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n.rk-table th {\n border-bottom: 1px solid var(--color-hair);\n padding: 0.625rem 0.75rem;\n text-align: left;\n font-weight: 500;\n color: var(--color-ink-soft);\n white-space: nowrap;\n}\n\n.rk-table td {\n border-bottom: 1px solid color-mix(in srgb, var(--color-hair) 50%, transparent);\n padding: 0.75rem;\n color: var(--color-ink);\n vertical-align: top;\n}\n\n.rk-table tbody tr:last-child td {\n border-bottom: 0;\n}\n\n/* Numbers line up on their last digit, which is the one being compared. */\n.is-end {\n text-align: right;\n font-variant-numeric: tabular-nums;\n}\n\n.is-nowrap {\n white-space: nowrap;\n}\n\n.rk-table-empty {\n padding: 2rem 0.75rem;\n text-align: center;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { useBoundValue } from '../composables/use-bound-value'\nimport FormField from './FormField.vue'\n\n/**\n * A multi-line field.\n *\n * `rows` rather than an auto-growing box: a textarea that resizes as it is\n * typed into moves everything below it, and in a form that means the button\n * the writer is heading for keeps sliding away. Growth is left to the browser's\n * own resize handle, which the writer controls.\n */\ndefineOptions({ inheritAttrs: false })\n\nconst {\n modelValue = undefined,\n label,\n error = '',\n hint = '',\n labelHidden = false,\n rows = 4,\n size = 'md',\n variant = 'default',\n} = defineProps<{\n /** The text, with `v-model`. */\n modelValue?: string | undefined\n label: string\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n rows?: number | undefined\n /**\n * `sm` tightens the label and the spacing. It does **not** shrink the text:\n * iOS zooms the viewport when it focuses a field under 16px and never zooms\n * back, which is why both phone apps force 16px on form elements in their\n * base layer.\n */\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/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <textarea\n :id=\"id\"\n v-model=\"model\"\n :rows=\"rows\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n v-bind=\"$attrs\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary resize-y px-3 py-2 leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-1',\n 'text-base',\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n />\n </template>\n </FormField>\n</template>\n","<script setup lang=\"ts\">\nimport { useBoundValue } from '../composables/use-bound-value'\nimport FormField from './FormField.vue'\n\n/**\n * A multi-line field.\n *\n * `rows` rather than an auto-growing box: a textarea that resizes as it is\n * typed into moves everything below it, and in a form that means the button\n * the writer is heading for keeps sliding away. Growth is left to the browser's\n * own resize handle, which the writer controls.\n */\ndefineOptions({ inheritAttrs: false })\n\nconst {\n modelValue = undefined,\n label,\n error = '',\n hint = '',\n labelHidden = false,\n rows = 4,\n size = 'md',\n variant = 'default',\n} = defineProps<{\n /** The text, with `v-model`. */\n modelValue?: string | undefined\n label: string\n error?: string | undefined\n hint?: string | undefined\n labelHidden?: boolean | undefined\n rows?: number | undefined\n /**\n * `sm` tightens the label and the spacing. It does **not** shrink the text:\n * iOS zooms the viewport when it focuses a field under 16px and never zooms\n * back, which is why both phone apps force 16px on form elements in their\n * base layer.\n */\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/* Declared by hand rather than with defineModel: it accepts `undefined` and\n emits only strings, which defineModel cannot type both ways. See\n `use-bound-value.ts`. */\nconst emit = defineEmits<{ 'update:modelValue': [value: string] }>()\nconst model = useBoundValue(\n () => modelValue,\n (value) => emit('update:modelValue', value),\n)\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 <textarea\n :id=\"id\"\n v-model=\"model\"\n :rows=\"rows\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n v-bind=\"$attrs\"\n :class=\"[\n variant === 'unstyled'\n ? ''\n : 'control text-ink rounded-card focus-visible:outline-primary resize-y px-3 py-2 leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-1',\n 'text-base',\n variant !== 'unstyled' && invalid ? 'border-negative' : '',\n ]\"\n />\n </template>\n </FormField>\n</template>\n","<script lang=\"ts\" setup>\n/**\n * A list with nothing in it yet, said kindly.\n *\n * A blank area reads as a page that failed to load, and the reader's first\n * thought is that something is broken rather than that they have not started.\n * So there is always a sentence, and the slot below it is where the way out\n * goes — the button that creates the first one.\n */\nconst { title, description = '' } = defineProps<{\n title: string\n description?: string | undefined\n}>()\n</script>\n\n<template>\n <div class=\"flex flex-col items-center gap-3 px-6 py-10 text-center\">\n <div\n v-if=\"$slots.icon\"\n class=\"bg-muted text-primary rounded-card flex size-12 items-center justify-center\"\n >\n <slot name=\"icon\" />\n </div>\n\n <h3 class=\"text-ink text-base font-semibold\">{{ title }}</h3>\n <p v-if=\"description\" class=\"text-ink-soft max-w-[36ch] text-sm\">\n {{ description }}\n </p>\n\n <div v-if=\"$slots.action\" class=\"mt-2 flex w-full flex-col gap-2\">\n <slot name=\"action\" />\n </div>\n </div>\n</template>\n\n<style></style>\n","<script lang=\"ts\" setup>\n/**\n * A list with nothing in it yet, said kindly.\n *\n * A blank area reads as a page that failed to load, and the reader's first\n * thought is that something is broken rather than that they have not started.\n * So there is always a sentence, and the slot below it is where the way out\n * goes — the button that creates the first one.\n */\nconst { title, description = '' } = defineProps<{\n title: string\n description?: string | undefined\n}>()\n</script>\n\n<template>\n <div class=\"flex flex-col items-center gap-3 px-6 py-10 text-center\">\n <div\n v-if=\"$slots.icon\"\n class=\"bg-muted text-primary rounded-card flex size-12 items-center justify-center\"\n >\n <slot name=\"icon\" />\n </div>\n\n <h3 class=\"text-ink text-base font-semibold\">{{ title }}</h3>\n <p v-if=\"description\" class=\"text-ink-soft max-w-[36ch] text-sm\">\n {{ description }}\n </p>\n\n <div v-if=\"$slots.action\" class=\"mt-2 flex w-full flex-col gap-2\">\n <slot name=\"action\" />\n </div>\n </div>\n</template>\n\n<style></style>\n","<script setup lang=\"ts\">\nimport { onErrorCaptured, ref, watch } from 'vue'\n\n/**\n * Keeps one broken screen from taking the whole app down.\n *\n * An error thrown while a component renders unmounts the tree above it, and a\n * single-page app has nothing underneath — the tab goes white and whoever was\n * using it loses what they were in the middle of.\n *\n * What it does *not* do is decide what that looks like. All three apps in this\n * workshop had written this component, and the parts they had in common were\n * the mechanism — catch, report, reset when the route changes — while the\n * parts that differed were the ones that should: an icon, a sentence, a way\n * back. So the fallback is a slot, and the kit stays out of the wording.\n *\n * Only errors thrown while rendering a descendant reach `onErrorCaptured`.\n * Rejected promises and failed queries do not, and should not: those belong to\n * the code that owns the request.\n *\n * @example\n * ```vue\n * <ErrorBoundary :resetKey=\"route.fullPath\" @error=\"reportError\">\n * <template #fallback=\"{ reset }\">\n * <EmptyState :title=\"t('error.title')\">\n * <BaseButton @click=\"reset\">{{ t('error.retry') }}</BaseButton>\n * </EmptyState>\n * </template>\n * <RouterView />\n * </ErrorBoundary>\n * ```\n */\nconst { resetKey } = defineProps<{\n /**\n * Clears the error whenever it changes — a route path, usually.\n *\n * An error on one screen should not follow somebody to the next one, and\n * without this the boundary stays broken until a full reload.\n */\n resetKey?: string | number | undefined\n}>()\n\nconst emit = defineEmits<{ error: [cause: unknown] }>()\n\nconst failed = ref<unknown>(null)\n\nfunction reset() {\n failed.value = null\n}\n\nonErrorCaptured((cause) => {\n failed.value = cause\n emit('error', cause)\n\n // Swallowed on purpose: the fallback is now showing, and letting it travel\n // further up would unmount the boundary along with everything else.\n return false\n})\n\nwatch(\n () => resetKey,\n () => reset(),\n)\n</script>\n\n<template>\n <slot v-if=\"failed\" name=\"fallback\" :error=\"failed\" :reset=\"reset\" />\n <slot v-else />\n</template>\n","<script setup lang=\"ts\">\nimport { onErrorCaptured, ref, watch } from 'vue'\n\n/**\n * Keeps one broken screen from taking the whole app down.\n *\n * An error thrown while a component renders unmounts the tree above it, and a\n * single-page app has nothing underneath — the tab goes white and whoever was\n * using it loses what they were in the middle of.\n *\n * What it does *not* do is decide what that looks like. All three apps in this\n * workshop had written this component, and the parts they had in common were\n * the mechanism — catch, report, reset when the route changes — while the\n * parts that differed were the ones that should: an icon, a sentence, a way\n * back. So the fallback is a slot, and the kit stays out of the wording.\n *\n * Only errors thrown while rendering a descendant reach `onErrorCaptured`.\n * Rejected promises and failed queries do not, and should not: those belong to\n * the code that owns the request.\n *\n * @example\n * ```vue\n * <ErrorBoundary :resetKey=\"route.fullPath\" @error=\"reportError\">\n * <template #fallback=\"{ reset }\">\n * <EmptyState :title=\"t('error.title')\">\n * <BaseButton @click=\"reset\">{{ t('error.retry') }}</BaseButton>\n * </EmptyState>\n * </template>\n * <RouterView />\n * </ErrorBoundary>\n * ```\n */\nconst { resetKey } = defineProps<{\n /**\n * Clears the error whenever it changes — a route path, usually.\n *\n * An error on one screen should not follow somebody to the next one, and\n * without this the boundary stays broken until a full reload.\n */\n resetKey?: string | number | undefined\n}>()\n\nconst emit = defineEmits<{ error: [cause: unknown] }>()\n\nconst failed = ref<unknown>(null)\n\nfunction reset() {\n failed.value = null\n}\n\nonErrorCaptured((cause) => {\n failed.value = cause\n emit('error', cause)\n\n // Swallowed on purpose: the fallback is now showing, and letting it travel\n // further up would unmount the boundary along with everything else.\n return false\n})\n\nwatch(\n () => resetKey,\n () => reset(),\n)\n</script>\n\n<template>\n <slot v-if=\"failed\" name=\"fallback\" :error=\"failed\" :reset=\"reset\" />\n <slot v-else />\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One measure, centred, with the page's gutters.\n *\n * The first thing a desktop app needs and the last thing a kit built for\n * phones thinks to provide — a 430 px shell has no use for a maximum width, so\n * this was missing, and the consuming app wrote `max-w-[1200px] mx-auto px-6`\n * into every layout instead. Written once it costs nothing; written eleven\n * times it is eleven chances for one page to be forty pixels narrower than the\n * rest, which is the kind of thing nobody can name and everybody can see.\n *\n * Two widths rather than one, because a page and a passage are different\n * problems: `wide` is the page, `reading` is a column of prose at the width\n * type wants to be read at. Both come from tokens, so an app that measures its\n * page at 1120 rather than 1200 can still use this.\n */\nconst { width = 'wide', as = 'div' } = defineProps<{\n /** `wide` for a page, `reading` for prose, `full` to opt out. */\n width?: 'wide' | 'reading' | 'full' | undefined\n /** The element to render. `main`, `section` and `article` all belong here. */\n as?: string | undefined\n}>()\n\n/**\n * From tokens, not from literals.\n *\n * A width is a role the same way a colour is, and baking one in makes the\n * component unusable by any app that measured its own page differently — which\n * the first consumer had, deliberately. Override `--measure-page` and\n * `--measure-reading` in the app's `@theme` and every container follows.\n */\nconst WIDTHS = {\n wide: 'var(--measure-page)',\n reading: 'var(--measure-reading)',\n full: 'none',\n} as const\n\nconst measure = computed(() => WIDTHS[width])\n</script>\n\n<template>\n <component :is=\"as\" class=\"mx-auto w-full px-5 sm:px-8\" :style=\"{ maxWidth: measure }\">\n <slot />\n </component>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One measure, centred, with the page's gutters.\n *\n * The first thing a desktop app needs and the last thing a kit built for\n * phones thinks to provide — a 430 px shell has no use for a maximum width, so\n * this was missing, and the consuming app wrote `max-w-[1200px] mx-auto px-6`\n * into every layout instead. Written once it costs nothing; written eleven\n * times it is eleven chances for one page to be forty pixels narrower than the\n * rest, which is the kind of thing nobody can name and everybody can see.\n *\n * Two widths rather than one, because a page and a passage are different\n * problems: `wide` is the page, `reading` is a column of prose at the width\n * type wants to be read at. Both come from tokens, so an app that measures its\n * page at 1120 rather than 1200 can still use this.\n */\nconst { width = 'wide', as = 'div' } = defineProps<{\n /** `wide` for a page, `reading` for prose, `full` to opt out. */\n width?: 'wide' | 'reading' | 'full' | undefined\n /** The element to render. `main`, `section` and `article` all belong here. */\n as?: string | undefined\n}>()\n\n/**\n * From tokens, not from literals.\n *\n * A width is a role the same way a colour is, and baking one in makes the\n * component unusable by any app that measured its own page differently — which\n * the first consumer had, deliberately. Override `--measure-page` and\n * `--measure-reading` in the app's `@theme` and every container follows.\n */\nconst WIDTHS = {\n wide: 'var(--measure-page)',\n reading: 'var(--measure-reading)',\n full: 'none',\n} as const\n\nconst measure = computed(() => WIDTHS[width])\n</script>\n\n<template>\n <component :is=\"as\" class=\"mx-auto w-full px-5 sm:px-8\" :style=\"{ maxWidth: measure }\">\n <slot />\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The bar at the top of a screen: a title with room either side of it.\n *\n * Three fixed columns rather than a flex row, so the title is centred on the\n * screen rather than centred on what is left after the buttons. A back arrow on\n * one side and nothing on the other would otherwise push every title off centre\n * by exactly half a button, which is visible the moment two screens sit next to\n * each other.\n */\nconst { title } = defineProps<{ title: string }>()\n</script>\n\n<template>\n <header class=\"grid h-12 shrink-0 grid-cols-[2.5rem_1fr_2.5rem] items-center\">\n <div class=\"justify-self-start\"><slot name=\"left\" /></div>\n\n <h1 class=\"text-ink flex min-w-0 justify-center text-base font-semibold tabular-nums\">\n <slot name=\"title\">\n <span class=\"truncate\">{{ title }}</span>\n </slot>\n </h1>\n\n <div class=\"justify-self-end\"><slot name=\"right\" /></div>\n </header>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The bar at the top of a screen: a title with room either side of it.\n *\n * Three fixed columns rather than a flex row, so the title is centred on the\n * screen rather than centred on what is left after the buttons. A back arrow on\n * one side and nothing on the other would otherwise push every title off centre\n * by exactly half a button, which is visible the moment two screens sit next to\n * each other.\n */\nconst { title } = defineProps<{ title: string }>()\n</script>\n\n<template>\n <header class=\"grid h-12 shrink-0 grid-cols-[2.5rem_1fr_2.5rem] items-center\">\n <div class=\"justify-self-start\"><slot name=\"left\" /></div>\n\n <h1 class=\"text-ink flex min-w-0 justify-center text-base font-semibold tabular-nums\">\n <slot name=\"title\">\n <span class=\"truncate\">{{ title }}</span>\n </slot>\n </h1>\n\n <div class=\"justify-self-end\"><slot name=\"right\" /></div>\n </header>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * How far through something somebody is.\n *\n * Clamped rather than trusted. A progress bar is always fed a computed number,\n * and computed numbers arrive as 101, as -0, and as NaN when the denominator\n * is zero — which is the ordinary state of a course nobody has started. Any of\n * those renders a bar that runs past its own track, and it is the sort of\n * thing that ships because the happy path was the only one anybody looked at.\n */\nconst {\n value,\n max = 100,\n label,\n size = 'md',\n} = defineProps<{\n value: number\n max?: number | undefined\n /**\n * How thick the track is. `sm` for a bar under a step counter, where it is a\n * hint rather than the subject; `lg` where the progress is the point.\n *\n * It shipped at one thickness and the two bars anybody wanted were `h-1`.\n */\n size?: 'sm' | 'md' | 'lg' | undefined\n /** For screen readers. Without it this is a rectangle that means nothing. */\n label?: string | undefined\n}>()\n\nconst TRACK = {\n sm: 'h-1',\n md: 'h-1.5',\n lg: 'h-2',\n} as const\n\nconst portion = computed(() => {\n if (!Number.isFinite(value) || !Number.isFinite(max) || max <= 0) return 0\n\n return Math.min(100, Math.max(0, (value / max) * 100))\n})\n</script>\n\n<template>\n <div\n class=\"bg-muted w-full overflow-hidden rounded-full\"\n :class=\"TRACK[size]\"\n role=\"progressbar\"\n :aria-valuenow=\"Math.round(portion)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-label=\"label\"\n >\n <div\n class=\"bg-primary h-full rounded-full transition-[width] duration-700 ease-out\"\n :style=\"{ width: `${portion}%` }\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * How far through something somebody is.\n *\n * Clamped rather than trusted. A progress bar is always fed a computed number,\n * and computed numbers arrive as 101, as -0, and as NaN when the denominator\n * is zero — which is the ordinary state of a course nobody has started. Any of\n * those renders a bar that runs past its own track, and it is the sort of\n * thing that ships because the happy path was the only one anybody looked at.\n */\nconst {\n value,\n max = 100,\n label,\n size = 'md',\n} = defineProps<{\n value: number\n max?: number | undefined\n /**\n * How thick the track is. `sm` for a bar under a step counter, where it is a\n * hint rather than the subject; `lg` where the progress is the point.\n *\n * It shipped at one thickness and the two bars anybody wanted were `h-1`.\n */\n size?: 'sm' | 'md' | 'lg' | undefined\n /** For screen readers. Without it this is a rectangle that means nothing. */\n label?: string | undefined\n}>()\n\nconst TRACK = {\n sm: 'h-1',\n md: 'h-1.5',\n lg: 'h-2',\n} as const\n\nconst portion = computed(() => {\n if (!Number.isFinite(value) || !Number.isFinite(max) || max <= 0) return 0\n\n return Math.min(100, Math.max(0, (value / max) * 100))\n})\n</script>\n\n<template>\n <div\n class=\"bg-muted w-full overflow-hidden rounded-full\"\n :class=\"TRACK[size]\"\n role=\"progressbar\"\n :aria-valuenow=\"Math.round(portion)\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n :aria-label=\"label\"\n >\n <div\n class=\"bg-primary h-full rounded-full transition-[width] duration-700 ease-out\"\n :style=\"{ width: `${portion}%` }\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One plan in a pricing table.\n *\n * Every string arrives as a prop. A component in a kit that reaches for its\n * consumer's translations is not shared, it is one app's furniture parked\n * somewhere else — and the second app to want it would have to fork it.\n *\n * The tone is semantic rather than named after a colour. \"Gold\" and \"diamond\"\n * are one product's tiers; `warm` and `cool` are what a pricing table actually\n * needs, which is for three columns to be distinguishable at a glance without\n * any of them shouting. A table where every column is a different hue reads as\n * three products from three companies.\n */\nconst {\n name,\n lead,\n price,\n period,\n note,\n features,\n tone = 'neutral',\n badge,\n chip,\n recommended = false,\n} = defineProps<{\n name: string\n lead?: string | undefined\n /** Already formatted, or whatever stands in while there is no price. */\n price: string\n period?: string | undefined\n note?: string | undefined\n features: readonly string[]\n tone?: 'neutral' | 'warm' | 'cool' | undefined\n /** Rides on the card's edge, e.g. \"Recommended\". */\n badge?: string | undefined\n /** Sits inside, e.g. \"30% cheaper\" or \"Your plan\". */\n chip?: string | undefined\n /** Raises the card and lets the badge show. */\n recommended?: boolean | undefined\n}>()\n\n/* Roles, not hex values. This used to carry `#b8862c` and `#4a86a8` with\n hand-picked darker shades for text, which is the one thing the kit's rules\n forbid: a colour in a component cannot follow a palette, so a pricing table\n stayed amber and blue whatever the app had rebranded to.\n\n The ring is handed to the surface as a variable rather than set as a\n `border-color` class. The surface draws its own border, and two utilities\n setting the same property would be decided by stylesheet order. */\nconst TONE = {\n neutral: {\n ring: '',\n soft: 'bg-muted text-ink-soft',\n icon: 'bg-primary/10 text-primary',\n },\n warm: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-warning)_40%,transparent)]',\n soft: 'bg-warning/15 text-ink',\n icon: 'bg-warning/15 text-warning',\n },\n cool: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-accent)_38%,transparent)]',\n soft: 'bg-accent/12 text-ink',\n icon: 'bg-accent/12 text-accent',\n },\n} as const\n\nconst palette = computed(() => TONE[tone])\n</script>\n\n<template>\n <article\n class=\"surface rounded-card ease-standard relative flex h-full flex-col p-7 transition-[border-color,box-shadow,transform] duration-(--duration-slower) hover:[--surface-border-color:color-mix(in_oklab,var(--color-primary)_60%,transparent)] hover:[--surface-shadow:var(--shadow-raised)] sm:p-8\"\n :class=\"[\n palette.ring,\n recommended ? '[--surface-shadow:var(--shadow-raised)]' : 'hover:-translate-y-0.5',\n ]\"\n >\n <!-- On the edge rather than inside, so it cannot be mistaken for one of\n the plan's own features. -->\n <span\n v-if=\"badge && recommended\"\n class=\"bg-primary rounded-cell text-on-primary absolute -top-3 left-7 px-3 py-1 text-[0.7rem] font-semibold\"\n >\n {{ badge }}\n </span>\n\n <div class=\"flex items-start justify-between gap-4\">\n <span\n v-if=\"$slots.icon\"\n class=\"rounded-card grid size-11 place-items-center text-xl\"\n :class=\"palette.icon\"\n >\n <slot name=\"icon\" />\n </span>\n\n <span\n v-if=\"chip\"\n class=\"rounded-cell ml-auto px-2.5 py-1 text-[0.7rem] font-medium\"\n :class=\"palette.soft\"\n >\n {{ chip }}\n </span>\n </div>\n\n <h3 class=\"text-ink mt-5 text-lg font-semibold\">{{ name }}</h3>\n <p v-if=\"lead\" class=\"text-ink-soft mt-1.5 text-sm leading-relaxed\">{{ lead }}</p>\n\n <p class=\"mt-6 flex items-baseline gap-1.5\">\n <span class=\"text-ink text-3xl font-semibold tracking-tight tabular-nums\">{{ price }}</span>\n <span v-if=\"period\" class=\"text-ink-soft text-sm\">{{ period }}</span>\n </p>\n <p v-if=\"note\" class=\"text-ink-soft mt-1 text-xs\">{{ note }}</p>\n\n <ul class=\"mt-7 flex-1 space-y-3\">\n <li v-for=\"feature in features\" :key=\"feature\" class=\"flex gap-3 text-sm\">\n <!-- The marker is a slot because a pricing table often uses it to say\n something the tone cannot: on the tier you already have, these are\n things you hold rather than things you would get. A consumer that\n had drawn that distinction should not have to give it up to reach\n for this component. -->\n <span v-if=\"$slots.bullet\" class=\"mt-[0.45rem] shrink-0\"><slot name=\"bullet\" /></span>\n <span\n v-else\n class=\"bg-primary/45 mt-[0.45rem] size-1.5 shrink-0 rounded-full\"\n aria-hidden=\"true\"\n />\n <span class=\"text-ink-soft leading-relaxed\">{{ feature }}</span>\n </li>\n </ul>\n\n <div v-if=\"$slots.action\" class=\"mt-8\"><slot name=\"action\" /></div>\n </article>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * One plan in a pricing table.\n *\n * Every string arrives as a prop. A component in a kit that reaches for its\n * consumer's translations is not shared, it is one app's furniture parked\n * somewhere else — and the second app to want it would have to fork it.\n *\n * The tone is semantic rather than named after a colour. \"Gold\" and \"diamond\"\n * are one product's tiers; `warm` and `cool` are what a pricing table actually\n * needs, which is for three columns to be distinguishable at a glance without\n * any of them shouting. A table where every column is a different hue reads as\n * three products from three companies.\n */\nconst {\n name,\n lead,\n price,\n period,\n note,\n features,\n tone = 'neutral',\n badge,\n chip,\n recommended = false,\n} = defineProps<{\n name: string\n lead?: string | undefined\n /** Already formatted, or whatever stands in while there is no price. */\n price: string\n period?: string | undefined\n note?: string | undefined\n features: readonly string[]\n tone?: 'neutral' | 'warm' | 'cool' | undefined\n /** Rides on the card's edge, e.g. \"Recommended\". */\n badge?: string | undefined\n /** Sits inside, e.g. \"30% cheaper\" or \"Your plan\". */\n chip?: string | undefined\n /** Raises the card and lets the badge show. */\n recommended?: boolean | undefined\n}>()\n\n/* Roles, not hex values. This used to carry `#b8862c` and `#4a86a8` with\n hand-picked darker shades for text, which is the one thing the kit's rules\n forbid: a colour in a component cannot follow a palette, so a pricing table\n stayed amber and blue whatever the app had rebranded to.\n\n The ring is handed to the surface as a variable rather than set as a\n `border-color` class. The surface draws its own border, and two utilities\n setting the same property would be decided by stylesheet order. */\nconst TONE = {\n neutral: {\n ring: '',\n soft: 'bg-muted text-ink-soft',\n icon: 'bg-primary/10 text-primary',\n },\n warm: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-warning)_40%,transparent)]',\n soft: 'bg-warning/15 text-ink',\n icon: 'bg-warning/15 text-warning',\n },\n cool: {\n ring: '[--surface-border-color:color-mix(in_oklab,var(--color-accent)_38%,transparent)]',\n soft: 'bg-accent/12 text-ink',\n icon: 'bg-accent/12 text-accent',\n },\n} as const\n\nconst palette = computed(() => TONE[tone])\n</script>\n\n<template>\n <article\n class=\"surface rounded-card ease-standard relative flex h-full flex-col p-7 transition-[border-color,box-shadow,transform] duration-(--duration-slower) hover:[--surface-border-color:color-mix(in_oklab,var(--color-primary)_60%,transparent)] hover:[--surface-shadow:var(--shadow-raised)] sm:p-8\"\n :class=\"[\n palette.ring,\n recommended ? '[--surface-shadow:var(--shadow-raised)]' : 'hover:-translate-y-0.5',\n ]\"\n >\n <!-- On the edge rather than inside, so it cannot be mistaken for one of\n the plan's own features. -->\n <span\n v-if=\"badge && recommended\"\n class=\"bg-primary rounded-cell text-on-primary absolute -top-3 left-7 px-3 py-1 text-[0.7rem] font-semibold\"\n >\n {{ badge }}\n </span>\n\n <div class=\"flex items-start justify-between gap-4\">\n <span\n v-if=\"$slots.icon\"\n class=\"rounded-card grid size-11 place-items-center text-xl\"\n :class=\"palette.icon\"\n >\n <slot name=\"icon\" />\n </span>\n\n <span\n v-if=\"chip\"\n class=\"rounded-cell ml-auto px-2.5 py-1 text-[0.7rem] font-medium\"\n :class=\"palette.soft\"\n >\n {{ chip }}\n </span>\n </div>\n\n <h3 class=\"text-ink mt-5 text-lg font-semibold\">{{ name }}</h3>\n <p v-if=\"lead\" class=\"text-ink-soft mt-1.5 text-sm leading-relaxed\">{{ lead }}</p>\n\n <p class=\"mt-6 flex items-baseline gap-1.5\">\n <span class=\"text-ink text-3xl font-semibold tracking-tight tabular-nums\">{{ price }}</span>\n <span v-if=\"period\" class=\"text-ink-soft text-sm\">{{ period }}</span>\n </p>\n <p v-if=\"note\" class=\"text-ink-soft mt-1 text-xs\">{{ note }}</p>\n\n <ul class=\"mt-7 flex-1 space-y-3\">\n <li v-for=\"feature in features\" :key=\"feature\" class=\"flex gap-3 text-sm\">\n <!-- The marker is a slot because a pricing table often uses it to say\n something the tone cannot: on the tier you already have, these are\n things you hold rather than things you would get. A consumer that\n had drawn that distinction should not have to give it up to reach\n for this component. -->\n <span v-if=\"$slots.bullet\" class=\"mt-[0.45rem] shrink-0\"><slot name=\"bullet\" /></span>\n <span\n v-else\n class=\"bg-primary/45 mt-[0.45rem] size-1.5 shrink-0 rounded-full\"\n aria-hidden=\"true\"\n />\n <span class=\"text-ink-soft leading-relaxed\">{{ feature }}</span>\n </li>\n </ul>\n\n <div v-if=\"$slots.action\" class=\"mt-8\"><slot name=\"action\" /></div>\n </article>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A small coloured dot, optionally labelled.\n *\n * Takes the colour as a class rather than a category, so an app can key it off\n * whatever its own domain calls a category — habit kinds, expense types,\n * priorities — without this component knowing about any of them.\n */\nconst { fill, label = '' } = defineProps<{\n /** Background utility for the dot, e.g. `bg-positive`. */\n fill: string\n /** Optional text after the dot. Omit for a bare marker. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <span class=\"inline-flex items-center gap-1.5\">\n <span class=\"size-2 rounded-full\" :class=\"fill\" />\n <span v-if=\"label\" class=\"text-ink-soft text-xs font-medium\">{{ label }}</span>\n </span>\n</template>\n","<script setup lang=\"ts\">\n/**\n * A small coloured dot, optionally labelled.\n *\n * Takes the colour as a class rather than a category, so an app can key it off\n * whatever its own domain calls a category — habit kinds, expense types,\n * priorities — without this component knowing about any of them.\n */\nconst { fill, label = '' } = defineProps<{\n /** Background utility for the dot, e.g. `bg-positive`. */\n fill: string\n /** Optional text after the dot. Omit for a bare marker. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <span class=\"inline-flex items-center gap-1.5\">\n <span class=\"size-2 rounded-full\" :class=\"fill\" />\n <span v-if=\"label\" class=\"text-ink-soft text-xs font-medium\">{{ label }}</span>\n </span>\n</template>\n","<script setup lang=\"ts\">\nimport ToneDot from './ToneDot.vue'\n\n/** The three classes a category needs to colour a heading. */\nexport interface Tone {\n /** Solid background for the dot, e.g. `bg-positive`. */\n fill: string\n /** Tinted surface for the pill, e.g. `bg-positive/5 border-positive/25`. */\n card: string\n /** Foreground that pairs with the surface, e.g. `text-positive`. */\n text: string\n}\n\n/**\n * A pill heading for a group of things.\n *\n * The tone arrives as three class strings rather than a category name: Tailwind\n * reads source files as plain text, so a class assembled at runtime never\n * reaches the stylesheet — the app has to write them out, and it is the app\n * that knows its own categories anyway.\n */\nconst {\n tone,\n label,\n count = 0,\n} = defineProps<{\n tone: Tone\n label: string\n /** Hidden when zero, so an empty group's heading stays quiet. */\n count?: number | undefined\n}>()\n</script>\n\n<template>\n <h2\n class=\"flex w-fit items-center gap-2 self-start rounded-full border px-3 py-1\"\n :class=\"tone.card\"\n >\n <ToneDot :fill=\"tone.fill\" />\n <span class=\"text-xs font-semibold tracking-wide uppercase\" :class=\"tone.text\">\n {{ label }}\n </span>\n <span v-if=\"count > 0\" class=\"text-ink-soft text-xs tabular-nums\">{{ count }}</span>\n </h2>\n</template>\n","<script setup lang=\"ts\">\nimport ToneDot from './ToneDot.vue'\n\n/** The three classes a category needs to colour a heading. */\nexport interface Tone {\n /** Solid background for the dot, e.g. `bg-positive`. */\n fill: string\n /** Tinted surface for the pill, e.g. `bg-positive/5 border-positive/25`. */\n card: string\n /** Foreground that pairs with the surface, e.g. `text-positive`. */\n text: string\n}\n\n/**\n * A pill heading for a group of things.\n *\n * The tone arrives as three class strings rather than a category name: Tailwind\n * reads source files as plain text, so a class assembled at runtime never\n * reaches the stylesheet — the app has to write them out, and it is the app\n * that knows its own categories anyway.\n */\nconst {\n tone,\n label,\n count = 0,\n} = defineProps<{\n tone: Tone\n label: string\n /** Hidden when zero, so an empty group's heading stays quiet. */\n count?: number | undefined\n}>()\n</script>\n\n<template>\n <h2\n class=\"flex w-fit items-center gap-2 self-start rounded-full border px-3 py-1\"\n :class=\"tone.card\"\n >\n <ToneDot :fill=\"tone.fill\" />\n <span class=\"text-xs font-semibold tracking-wide uppercase\" :class=\"tone.text\">\n {{ label }}\n </span>\n <span v-if=\"count > 0\" class=\"text-ink-soft text-xs tabular-nums\">{{ count }}</span>\n </h2>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { useId } from 'vue'\n\n/**\n * A row of mutually exclusive choices.\n *\n * Radio inputs rather than buttons: it is a single choice out of a small set,\n * so arrow-key navigation and the \"one of N selected\" announcement come free.\n */\nconst { options } = defineProps<{\n options: readonly { value: T; label: string }[]\n}>()\n\nconst model = defineModel<T>({ required: true })\n\nconst name = useId()\n</script>\n\n<template>\n <div class=\"bg-muted rounded-card flex w-full gap-1 p-1\">\n <label v-for=\"option in options\" :key=\"String(option.value)\" class=\"flex-1 cursor-pointer\">\n <input v-model=\"model\" type=\"radio\" :value=\"option.value\" :name=\"name\" class=\"peer sr-only\" />\n <span\n class=\"peer-focus-visible:outline-primary flex h-10 items-center justify-center rounded-xl px-2 text-sm font-medium transition-colors select-none peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2\"\n :class=\"\n model === option.value ? 'bg-surface text-ink shadow-(--shadow-control)' : 'text-ink-soft'\n \"\n >\n {{ option.label }}\n </span>\n </label>\n </div>\n</template>\n","<script setup lang=\"ts\" generic=\"T extends string | number\">\nimport { useId } from 'vue'\n\n/**\n * A row of mutually exclusive choices.\n *\n * Radio inputs rather than buttons: it is a single choice out of a small set,\n * so arrow-key navigation and the \"one of N selected\" announcement come free.\n */\nconst { options } = defineProps<{\n options: readonly { value: T; label: string }[]\n}>()\n\nconst model = defineModel<T>({ required: true })\n\nconst name = useId()\n</script>\n\n<template>\n <div class=\"bg-muted rounded-card flex w-full gap-1 p-1\">\n <label v-for=\"option in options\" :key=\"String(option.value)\" class=\"flex-1 cursor-pointer\">\n <input v-model=\"model\" type=\"radio\" :value=\"option.value\" :name=\"name\" class=\"peer sr-only\" />\n <span\n class=\"peer-focus-visible:outline-primary flex h-10 items-center justify-center rounded-xl px-2 text-sm font-medium transition-colors select-none peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2\"\n :class=\"\n model === option.value ? 'bg-surface text-ink shadow-(--shadow-control)' : 'text-ink-soft'\n \"\n >\n {{ option.label }}\n </span>\n </label>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nconst {\n rows = 3,\n rowHeight = 'h-14',\n label = 'Loading…',\n} = defineProps<{\n rows?: number | undefined\n /**\n * How tall each row is, as either a utility class (`h-20`) or a CSS length\n * (`5rem`, `72px`, `var(--row)`).\n *\n * Both are accepted because the class-only version failed silently: a length\n * passed here landed in `class` as `5rem`, which is not a class, so the rows\n * had no height and the placeholder rendered as nothing at all. A loading\n * state that shows an empty page is worse than no loading state, because it\n * looks like the page is finished and empty.\n */\n rowHeight?: string | undefined\n label?: string | undefined\n}>()\n\n/** A length starts with a digit, a dot, or opens a CSS function. */\nconst isLength = computed(() => /^(?:[.\\d]|calc\\(|var\\(|clamp\\(|min\\(|max\\()/.test(rowHeight))\n</script>\n\n<template>\n <div role=\"status\" class=\"flex flex-col gap-1\">\n <span class=\"sr-only\">{{ label }}</span>\n\n <div\n v-for=\"row in rows\"\n :key=\"row\"\n class=\"bg-muted rounded-card animate-pulse\"\n :class=\"isLength ? undefined : rowHeight\"\n :style=\"isLength ? { height: rowHeight } : undefined\"\n aria-hidden=\"true\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nconst {\n rows = 3,\n rowHeight = 'h-14',\n label = 'Loading…',\n} = defineProps<{\n rows?: number | undefined\n /**\n * How tall each row is, as either a utility class (`h-20`) or a CSS length\n * (`5rem`, `72px`, `var(--row)`).\n *\n * Both are accepted because the class-only version failed silently: a length\n * passed here landed in `class` as `5rem`, which is not a class, so the rows\n * had no height and the placeholder rendered as nothing at all. A loading\n * state that shows an empty page is worse than no loading state, because it\n * looks like the page is finished and empty.\n */\n rowHeight?: string | undefined\n label?: string | undefined\n}>()\n\n/** A length starts with a digit, a dot, or opens a CSS function. */\nconst isLength = computed(() => /^(?:[.\\d]|calc\\(|var\\(|clamp\\(|min\\(|max\\()/.test(rowHeight))\n</script>\n\n<template>\n <div role=\"status\" class=\"flex flex-col gap-1\">\n <span class=\"sr-only\">{{ label }}</span>\n\n <div\n v-for=\"row in rows\"\n :key=\"row\"\n class=\"bg-muted rounded-card animate-pulse\"\n :class=\"isLength ? undefined : rowHeight\"\n :style=\"isLength ? { height: rowHeight } : undefined\"\n aria-hidden=\"true\"\n />\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ArrowDown, ArrowRight, ArrowUp } from 'lucide-vue-next'\n\n/**\n * One number, with what it means and which way it is going.\n *\n * The trend is an arrow and a colour, and neither is allowed to be the whole\n * message: the direction is also in the arrow's shape, so it survives a reader\n * who cannot separate the kit's positive and negative hues. `null` is a real\n * state rather than a missing one — a figure with no comparison yet is not a\n * flat figure.\n */\nconst {\n value,\n label,\n trend = null,\n} = defineProps<{\n value: string\n label: string\n trend?: 'up' | 'down' | 'flat' | null | undefined\n}>()\n\nconst TREND_ICON = { up: ArrowUp, down: ArrowDown, flat: ArrowRight } as const\n</script>\n\n<template>\n <div class=\"surface rounded-card flex flex-1 flex-col gap-0.5 p-3\">\n <div class=\"flex items-baseline gap-1\">\n <span class=\"text-ink text-xl font-semibold tabular-nums\">{{ value }}</span>\n <component :is=\"TREND_ICON[trend]\" v-if=\"trend\" class=\"text-ink-soft size-3\" />\n </div>\n <span class=\"text-ink-soft text-xs\">{{ label }}</span>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { ArrowDown, ArrowRight, ArrowUp } from 'lucide-vue-next'\n\n/**\n * One number, with what it means and which way it is going.\n *\n * The trend is an arrow and a colour, and neither is allowed to be the whole\n * message: the direction is also in the arrow's shape, so it survives a reader\n * who cannot separate the kit's positive and negative hues. `null` is a real\n * state rather than a missing one — a figure with no comparison yet is not a\n * flat figure.\n */\nconst {\n value,\n label,\n trend = null,\n} = defineProps<{\n value: string\n label: string\n trend?: 'up' | 'down' | 'flat' | null | undefined\n}>()\n\nconst TREND_ICON = { up: ArrowUp, down: ArrowDown, flat: ArrowRight } as const\n</script>\n\n<template>\n <div class=\"surface rounded-card flex flex-1 flex-col gap-0.5 p-3\">\n <div class=\"flex items-baseline gap-1\">\n <span class=\"text-ink text-xl font-semibold tabular-nums\">{{ value }}</span>\n <component :is=\"TREND_ICON[trend]\" v-if=\"trend\" class=\"text-ink-soft size-3\" />\n </div>\n <span class=\"text-ink-soft text-xs\">{{ label }}</span>\n </div>\n</template>\n","<script setup lang=\"ts\">\nimport { onMounted, ref } from 'vue'\nimport { CheckCircle2, Info, TriangleAlert, X, XCircle } from 'lucide-vue-next'\n\nimport BaseButton from './BaseButton.vue'\nimport { useToast } from '../composables/use-toast'\nimport type { ToastTone } from '../composables/use-toast'\n\n/**\n * Where the toasts land. One of these, at the app root.\n *\n * @example\n * ```vue\n * <!-- App.vue -->\n * <ToastHost :close-label=\"$t('common.close')\" />\n * ```\n */\nconst { closeLabel, bottom = false } = defineProps<{\n /**\n * The accessible name of each dismiss button. Required, because the button\n * is an X and an X has no name — and the kit does not know the language.\n */\n closeLabel: string\n /**\n * Stack from the bottom instead of the top. For a phone shell, where the top\n * is a status bar and a header and the thumb is nowhere near it.\n */\n bottom?: boolean | undefined\n}>()\n\nconst { toasts, dismiss, pause, resume } = useToast()\n\n/* Dismissed first, so a handler that throws cannot leave the button on\n screen to be pressed twice. */\nfunction runAction(id: number, onClick: () => void) {\n dismiss(id)\n onClick()\n}\n\n/**\n * Teleport needs a `body`, and a server has none.\n *\n * Rendering nothing until mounted is also correct rather than merely safe: a\n * prerendered page has no toasts in it, so there is nothing to hydrate and\n * nothing to flash.\n */\nconst mounted = ref(false)\nonMounted(() => (mounted.value = true))\n\nconst ICON = {\n info: Info,\n success: CheckCircle2,\n warning: TriangleAlert,\n danger: XCircle,\n} as const satisfies Record<ToastTone, unknown>\n\n/* Roles, never colours. The app repaints these by redefining the token. */\nconst TONE_CLASS = {\n info: 'text-primary',\n success: 'text-positive',\n warning: 'text-warning',\n danger: 'text-negative',\n} as const satisfies Record<ToastTone, string>\n</script>\n\n<template>\n <Teleport v-if=\"mounted\" to=\"body\">\n <!--\n `polite`, not `assertive`, and it is a considered choice: a toast reports\n something that already happened, and interrupting a screen reader\n mid-sentence to say \"saved\" is ruder than waiting. A failure the reader\n must act on belongs in a `BaseAlert` beside the thing that failed.\n\n `role=\"status\"` rather than `role=\"log\"` so the whole region is read when\n it changes, not only the appended line.\n -->\n <div\n class=\"pointer-events-none fixed inset-x-0 z-[100] flex flex-col items-center gap-2 px-4\"\n :class=\"bottom ? 'bottom-0 pb-[max(1rem,env(safe-area-inset-bottom))]' : 'top-0 pt-4'\"\n role=\"status\"\n aria-live=\"polite\"\n >\n <TransitionGroup name=\"toast\">\n <div\n v-for=\"toast in toasts\"\n :key=\"toast.id\"\n class=\"surface-raised text-ink rounded-card pointer-events-auto flex w-full max-w-sm items-start gap-3 p-3\"\n @mouseenter=\"pause(toast.id)\"\n @mouseleave=\"resume(toast.id)\"\n @focusin=\"pause(toast.id)\"\n @focusout=\"resume(toast.id)\"\n >\n <component\n :is=\"ICON[toast.tone]\"\n class=\"mt-0.5 size-5 shrink-0\"\n :class=\"TONE_CLASS[toast.tone]\"\n aria-hidden=\"true\"\n />\n\n <p class=\"flex-1 text-sm leading-snug\">{{ toast.message }}</p>\n\n <BaseButton\n v-if=\"toast.action\"\n variant=\"link\"\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n @click=\"runAction(toast.id, toast.action.onClick)\"\n >\n {{ toast.action.label }}\n </BaseButton>\n\n <BaseButton\n variant=\"quiet\"\n icon\n pill\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n :aria-label=\"closeLabel\"\n @click=\"dismiss(toast.id)\"\n >\n <X class=\"size-4\" />\n </BaseButton>\n </div>\n </TransitionGroup>\n </div>\n </Teleport>\n</template>\n\n<style scoped>\n/* Movement is small and downward from the top, upward from the bottom — the\n direction it came from either way. */\n.toast-enter-active,\n.toast-leave-active {\n transition:\n opacity var(--duration-base) ease-out,\n transform var(--duration-base) ease-out;\n}\n\n.toast-enter-from,\n.toast-leave-to {\n opacity: 0;\n transform: translateY(-0.5rem);\n}\n\n/* Leaving is taken out of flow so the ones below close the gap smoothly\n instead of jumping when it unmounts. */\n.toast-leave-active {\n position: absolute;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast-enter-active,\n .toast-leave-active {\n transition-duration: 1ms;\n }\n\n .toast-enter-from,\n .toast-leave-to {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { onMounted, ref } from 'vue'\nimport { CheckCircle2, Info, TriangleAlert, X, XCircle } from 'lucide-vue-next'\n\nimport BaseButton from './BaseButton.vue'\nimport { useToast } from '../composables/use-toast'\nimport type { ToastTone } from '../composables/use-toast'\n\n/**\n * Where the toasts land. One of these, at the app root.\n *\n * @example\n * ```vue\n * <!-- App.vue -->\n * <ToastHost :close-label=\"$t('common.close')\" />\n * ```\n */\nconst { closeLabel, bottom = false } = defineProps<{\n /**\n * The accessible name of each dismiss button. Required, because the button\n * is an X and an X has no name — and the kit does not know the language.\n */\n closeLabel: string\n /**\n * Stack from the bottom instead of the top. For a phone shell, where the top\n * is a status bar and a header and the thumb is nowhere near it.\n */\n bottom?: boolean | undefined\n}>()\n\nconst { toasts, dismiss, pause, resume } = useToast()\n\n/* Dismissed first, so a handler that throws cannot leave the button on\n screen to be pressed twice. */\nfunction runAction(id: number, onClick: () => void) {\n dismiss(id)\n onClick()\n}\n\n/**\n * Teleport needs a `body`, and a server has none.\n *\n * Rendering nothing until mounted is also correct rather than merely safe: a\n * prerendered page has no toasts in it, so there is nothing to hydrate and\n * nothing to flash.\n */\nconst mounted = ref(false)\nonMounted(() => (mounted.value = true))\n\nconst ICON = {\n info: Info,\n success: CheckCircle2,\n warning: TriangleAlert,\n danger: XCircle,\n} as const satisfies Record<ToastTone, unknown>\n\n/* Roles, never colours. The app repaints these by redefining the token. */\nconst TONE_CLASS = {\n info: 'text-primary',\n success: 'text-positive',\n warning: 'text-warning',\n danger: 'text-negative',\n} as const satisfies Record<ToastTone, string>\n</script>\n\n<template>\n <Teleport v-if=\"mounted\" to=\"body\">\n <!--\n `polite`, not `assertive`, and it is a considered choice: a toast reports\n something that already happened, and interrupting a screen reader\n mid-sentence to say \"saved\" is ruder than waiting. A failure the reader\n must act on belongs in a `BaseAlert` beside the thing that failed.\n\n `role=\"status\"` rather than `role=\"log\"` so the whole region is read when\n it changes, not only the appended line.\n -->\n <div\n class=\"pointer-events-none fixed inset-x-0 z-[100] flex flex-col items-center gap-2 px-4\"\n :class=\"bottom ? 'bottom-0 pb-[max(1rem,env(safe-area-inset-bottom))]' : 'top-0 pt-4'\"\n role=\"status\"\n aria-live=\"polite\"\n >\n <TransitionGroup name=\"toast\">\n <div\n v-for=\"toast in toasts\"\n :key=\"toast.id\"\n class=\"surface-raised text-ink rounded-card pointer-events-auto flex w-full max-w-sm items-start gap-3 p-3\"\n @mouseenter=\"pause(toast.id)\"\n @mouseleave=\"resume(toast.id)\"\n @focusin=\"pause(toast.id)\"\n @focusout=\"resume(toast.id)\"\n >\n <component\n :is=\"ICON[toast.tone]\"\n class=\"mt-0.5 size-5 shrink-0\"\n :class=\"TONE_CLASS[toast.tone]\"\n aria-hidden=\"true\"\n />\n\n <p class=\"flex-1 text-sm leading-snug\">{{ toast.message }}</p>\n\n <BaseButton\n v-if=\"toast.action\"\n variant=\"link\"\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n @click=\"runAction(toast.id, toast.action.onClick)\"\n >\n {{ toast.action.label }}\n </BaseButton>\n\n <BaseButton\n variant=\"quiet\"\n icon\n pill\n size=\"sm\"\n class=\"-my-1 shrink-0\"\n :aria-label=\"closeLabel\"\n @click=\"dismiss(toast.id)\"\n >\n <X class=\"size-4\" />\n </BaseButton>\n </div>\n </TransitionGroup>\n </div>\n </Teleport>\n</template>\n\n<style scoped>\n/* Movement is small and downward from the top, upward from the bottom — the\n direction it came from either way. */\n.toast-enter-active,\n.toast-leave-active {\n transition:\n opacity var(--duration-base) ease-out,\n transform var(--duration-base) ease-out;\n}\n\n.toast-enter-from,\n.toast-leave-to {\n opacity: 0;\n transform: translateY(-0.5rem);\n}\n\n/* Leaving is taken out of flow so the ones below close the gap smoothly\n instead of jumping when it unmounts. */\n.toast-leave-active {\n position: absolute;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .toast-enter-active,\n .toast-leave-active {\n transition-duration: 1ms;\n }\n\n .toast-enter-from,\n .toast-leave-to {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"L extends string\">\n/**\n * A flat language switcher for screens with no Settings behind them.\n *\n * The list and the labels are props: only the app knows which languages it\n * ships, and endonyms — each language written in itself — are what make the\n * right option legible to someone who cannot read the current interface.\n */\nconst {\n locales,\n labels,\n label = '',\n} = defineProps<{\n locales: readonly L[]\n /** Endonyms, e.g. `{ en: 'English', tr: 'Türkçe' }`. */\n labels: Record<L, string>\n /** Accessible name for the group. */\n label?: string | undefined\n}>()\n\n/**\n * Two-way bound rather than taking the runtime's ref as a prop: props are not\n * unwrapped in a template and cannot be assigned to, so the ref would compare\n * against itself and the click handler would not compile.\n */\nconst preference = defineModel<'system' | L>({ required: true })\n</script>\n\n<template>\n <nav class=\"flex flex-wrap items-center justify-center gap-1\" :aria-label=\"label || undefined\">\n <button\n v-for=\"locale in locales\"\n :key=\"locale\"\n type=\"button\"\n :lang=\"locale\"\n class=\"focus-ring rounded-full px-2.5 py-1.5 text-xs transition-colors\"\n :class=\"\n preference === locale ? 'bg-muted text-ink font-semibold' : 'text-ink-soft hover:text-ink'\n \"\n :aria-pressed=\"preference === locale\"\n @click=\"preference = locale\"\n >\n {{ labels[locale] }}\n </button>\n </nav>\n</template>\n","<script setup lang=\"ts\" generic=\"L extends string\">\n/**\n * A flat language switcher for screens with no Settings behind them.\n *\n * The list and the labels are props: only the app knows which languages it\n * ships, and endonyms — each language written in itself — are what make the\n * right option legible to someone who cannot read the current interface.\n */\nconst {\n locales,\n labels,\n label = '',\n} = defineProps<{\n locales: readonly L[]\n /** Endonyms, e.g. `{ en: 'English', tr: 'Türkçe' }`. */\n labels: Record<L, string>\n /** Accessible name for the group. */\n label?: string | undefined\n}>()\n\n/**\n * Two-way bound rather than taking the runtime's ref as a prop: props are not\n * unwrapped in a template and cannot be assigned to, so the ref would compare\n * against itself and the click handler would not compile.\n */\nconst preference = defineModel<'system' | L>({ required: true })\n</script>\n\n<template>\n <nav class=\"flex flex-wrap items-center justify-center gap-1\" :aria-label=\"label || undefined\">\n <button\n v-for=\"locale in locales\"\n :key=\"locale\"\n type=\"button\"\n :lang=\"locale\"\n class=\"focus-ring rounded-full px-2.5 py-1.5 text-xs transition-colors\"\n :class=\"\n preference === locale ? 'bg-muted text-ink font-semibold' : 'text-ink-soft hover:text-ink'\n \"\n :aria-pressed=\"preference === locale\"\n @click=\"preference = locale\"\n >\n {{ labels[locale] }}\n </button>\n </nav>\n</template>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { RouterLink } from 'vue-router'\nimport type { Component } from 'vue'\n\nimport { tapFeedback } from '../utils/haptics'\n\nexport interface TabItem<K extends string> {\n /** Identity, compared against `active`. */\n key: K\n /** Router destination. */\n to: string\n /** Text under the icon. Already translated. */\n label: string\n icon: Component\n}\n\n/**\n * The floating bottom bar.\n *\n * Items and the active key are props: the package has no opinion about how an\n * app names its screens, and reading `route.meta` here would force one.\n */\nconst {\n items,\n active,\n label = '',\n} = defineProps<{\n items: readonly TabItem<K>[]\n /** Which item is current. Usually from `route.meta`. */\n active?: K | undefined\n /** Accessible name for the navigation landmark. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <header class=\"tab-bar\">\n <nav class=\"tab-bar-inner\" :aria-label=\"label || undefined\">\n <RouterLink\n v-for=\"item in items\"\n :key=\"item.key\"\n :to=\"item.to\"\n class=\"tab-link\"\n :class=\"{ 'is-active': item.key === active }\"\n :aria-current=\"item.key === active ? 'page' : undefined\"\n @click=\"tapFeedback()\"\n >\n <span class=\"tab-icon-slot\">\n <component :is=\"item.icon\" class=\"tab-icon\" />\n </span>\n <span class=\"tab-label\">{{ item.label }}</span>\n </RouterLink>\n </nav>\n </header>\n</template>\n\n<style scoped>\n@reference \"../styles/_reference.css\";\n\n/* absolute, not fixed: the bar hangs inside the app shell. Fixed would pin it\n to the browser window, which on a desktop is nowhere near the app. */\n.tab-bar {\n @apply absolute left-1/2 z-40 w-full max-w-[360px] -translate-x-1/2 px-4;\n bottom: calc(1rem + env(safe-area-inset-bottom, 0px));\n}\n\n.tab-bar-inner {\n /* A raised surface that is always a little translucent: it floats over the\n content it navigates, and a solid bar would read as a wall at the bottom of\n the page. The material decides how much — glass makes it far more so. */\n @apply surface-raised flex items-center justify-between gap-1 p-1.5;\n background-color: color-mix(\n in oklab,\n var(--color-surface) min(var(--surface-opacity), 88%),\n transparent\n );\n backdrop-filter: var(--surface-backdrop, blur(12px));\n -webkit-backdrop-filter: var(--surface-backdrop, blur(12px));\n border-radius: var(--radius-shell);\n}\n\n.tab-link {\n @apply text-ink-soft focus-ring flex min-h-[52px] flex-1 cursor-pointer flex-col items-center justify-center gap-1 py-1.5;\n border-radius: calc(var(--radius-shell) - 6px);\n /* Only the icon reacts to a press. Scaling the whole link drags the label and\n the pill with it, which reads as the bar wobbling. */\n transition: color var(--duration-base) ease;\n}\n\n.tab-link:hover {\n @apply text-ink;\n}\n\n/* The pill sits behind the icon rather than the link, so the active tab grows a\n marker instead of the row changing shape. */\n.tab-icon-slot {\n @apply flex h-7 w-12 items-center justify-center rounded-full transition-all duration-(--duration-base) ease-out;\n}\n\n.tab-link:active .tab-icon-slot {\n transform: scale(0.88);\n}\n\n.is-active {\n @apply text-primary;\n}\n\n.is-active .tab-icon-slot {\n @apply bg-muted;\n}\n\n.tab-icon {\n @apply size-[18px] stroke-2 transition-transform duration-(--duration-base);\n}\n\n.is-active .tab-icon {\n @apply scale-110 stroke-[2.5px];\n}\n\n.tab-label {\n @apply text-[10px] leading-none font-medium;\n}\n\n.is-active .tab-label {\n @apply font-semibold;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tab-icon-slot,\n .tab-icon {\n transition: none;\n }\n .tab-link:active .tab-icon-slot {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { RouterLink } from 'vue-router'\nimport type { Component } from 'vue'\n\nimport { tapFeedback } from '../utils/haptics'\n\nexport interface TabItem<K extends string> {\n /** Identity, compared against `active`. */\n key: K\n /** Router destination. */\n to: string\n /** Text under the icon. Already translated. */\n label: string\n icon: Component\n}\n\n/**\n * The floating bottom bar.\n *\n * Items and the active key are props: the package has no opinion about how an\n * app names its screens, and reading `route.meta` here would force one.\n */\nconst {\n items,\n active,\n label = '',\n} = defineProps<{\n items: readonly TabItem<K>[]\n /** Which item is current. Usually from `route.meta`. */\n active?: K | undefined\n /** Accessible name for the navigation landmark. */\n label?: string | undefined\n}>()\n</script>\n\n<template>\n <header class=\"tab-bar\">\n <nav class=\"tab-bar-inner\" :aria-label=\"label || undefined\">\n <RouterLink\n v-for=\"item in items\"\n :key=\"item.key\"\n :to=\"item.to\"\n class=\"tab-link\"\n :class=\"{ 'is-active': item.key === active }\"\n :aria-current=\"item.key === active ? 'page' : undefined\"\n @click=\"tapFeedback()\"\n >\n <span class=\"tab-icon-slot\">\n <component :is=\"item.icon\" class=\"tab-icon\" />\n </span>\n <span class=\"tab-label\">{{ item.label }}</span>\n </RouterLink>\n </nav>\n </header>\n</template>\n\n<style scoped>\n@reference \"../styles/_reference.css\";\n\n/* absolute, not fixed: the bar hangs inside the app shell. Fixed would pin it\n to the browser window, which on a desktop is nowhere near the app. */\n.tab-bar {\n @apply absolute left-1/2 z-40 w-full max-w-[360px] -translate-x-1/2 px-4;\n bottom: calc(1rem + env(safe-area-inset-bottom, 0px));\n}\n\n.tab-bar-inner {\n /* A raised surface that is always a little translucent: it floats over the\n content it navigates, and a solid bar would read as a wall at the bottom of\n the page. The material decides how much — glass makes it far more so. */\n @apply surface-raised flex items-center justify-between gap-1 p-1.5;\n background-color: color-mix(\n in oklab,\n var(--color-surface) min(var(--surface-opacity), 88%),\n transparent\n );\n backdrop-filter: var(--surface-backdrop, blur(12px));\n -webkit-backdrop-filter: var(--surface-backdrop, blur(12px));\n border-radius: var(--radius-shell);\n}\n\n.tab-link {\n @apply text-ink-soft focus-ring flex min-h-[52px] flex-1 cursor-pointer flex-col items-center justify-center gap-1 py-1.5;\n border-radius: calc(var(--radius-shell) - 6px);\n /* Only the icon reacts to a press. Scaling the whole link drags the label and\n the pill with it, which reads as the bar wobbling. */\n transition: color var(--duration-base) ease;\n}\n\n.tab-link:hover {\n @apply text-ink;\n}\n\n/* The pill sits behind the icon rather than the link, so the active tab grows a\n marker instead of the row changing shape. */\n.tab-icon-slot {\n @apply flex h-7 w-12 items-center justify-center rounded-full transition-all duration-(--duration-base) ease-out;\n}\n\n.tab-link:active .tab-icon-slot {\n transform: scale(0.88);\n}\n\n.is-active {\n @apply text-primary;\n}\n\n.is-active .tab-icon-slot {\n @apply bg-muted;\n}\n\n.tab-icon {\n @apply size-[18px] stroke-2 transition-transform duration-(--duration-base);\n}\n\n.is-active .tab-icon {\n @apply scale-110 stroke-[2.5px];\n}\n\n.tab-label {\n @apply text-[10px] leading-none font-medium;\n}\n\n.is-active .tab-label {\n @apply font-semibold;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tab-icon-slot,\n .tab-icon {\n transition: none;\n }\n .tab-link:active .tab-icon-slot {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport BaseAvatar from './BaseAvatar.vue'\n\n/**\n * The people on a thing, overlapped: who is in a conversation, who shares a\n * list.\n *\n * Past `max` it stops drawing faces and says how many are left, because ten\n * overlapping circles are neither ten faces nor a number. The whole stack is\n * one thing to a screen reader — `label` names it, usually with the count in\n * it, which is what somebody listening actually needs.\n */\nconst {\n people,\n label,\n max = 4,\n size = 'md',\n} = defineProps<{\n /** Each person's name, and a picture where there is one. */\n people: readonly { name: string; src?: string | undefined }[]\n /** The stack's accessible name: \"Shared with 6 people\". Already translated. */\n label: string\n /** How many faces before the rest become a number. */\n max?: number | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst shown = computed(() => people.slice(0, max))\nconst rest = computed(() => Math.max(0, people.length - shown.value.length))\n</script>\n\n<template>\n <div class=\"rk-stack\" :class=\"`is-${size}`\" role=\"img\" :aria-label=\"label\">\n <span v-for=\"person in shown\" :key=\"person.name\" class=\"rk-stack-item\" aria-hidden=\"true\">\n <BaseAvatar :name=\"person.name\" :src=\"person.src\" :size=\"size\" fallback=\"initials\" />\n </span>\n <span v-if=\"rest\" class=\"rk-stack-item rk-stack-rest\" aria-hidden=\"true\">+{{ rest }}</span>\n </div>\n</template>\n\n<style scoped>\n.rk-stack {\n display: inline-flex;\n align-items: center;\n}\n\n/* Overlapped by a third, with a ring in the page's own colour so each face\n keeps an edge against the one under it — on any material. */\n.rk-stack-item + .rk-stack-item {\n margin-left: -0.5rem;\n}\n\n.rk-stack.is-sm .rk-stack-item + .rk-stack-item {\n margin-left: -0.5rem;\n}\n\n.rk-stack.is-lg .rk-stack-item + .rk-stack-item {\n margin-left: -0.875rem;\n}\n\n.rk-stack-item {\n display: inline-flex;\n border-radius: 9999px;\n box-shadow: 0 0 0 2px var(--color-surface);\n}\n\n.rk-stack-rest {\n display: inline-grid;\n width: 2.25rem;\n height: 2.25rem;\n place-items: center;\n background: var(--color-muted);\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--color-ink-soft);\n font-variant-numeric: tabular-nums;\n}\n\n.rk-stack.is-sm .rk-stack-rest {\n width: 1.75rem;\n height: 1.75rem;\n font-size: 0.6875rem;\n}\n\n.rk-stack.is-lg .rk-stack-rest {\n width: 3rem;\n height: 3rem;\n font-size: 0.8125rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\nimport BaseAvatar from './BaseAvatar.vue'\n\n/**\n * The people on a thing, overlapped: who is in a conversation, who shares a\n * list.\n *\n * Past `max` it stops drawing faces and says how many are left, because ten\n * overlapping circles are neither ten faces nor a number. The whole stack is\n * one thing to a screen reader — `label` names it, usually with the count in\n * it, which is what somebody listening actually needs.\n */\nconst {\n people,\n label,\n max = 4,\n size = 'md',\n} = defineProps<{\n /** Each person's name, and a picture where there is one. */\n people: readonly { name: string; src?: string | undefined }[]\n /** The stack's accessible name: \"Shared with 6 people\". Already translated. */\n label: string\n /** How many faces before the rest become a number. */\n max?: number | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n}>()\n\nconst shown = computed(() => people.slice(0, max))\nconst rest = computed(() => Math.max(0, people.length - shown.value.length))\n</script>\n\n<template>\n <div class=\"rk-stack\" :class=\"`is-${size}`\" role=\"img\" :aria-label=\"label\">\n <span v-for=\"person in shown\" :key=\"person.name\" class=\"rk-stack-item\" aria-hidden=\"true\">\n <BaseAvatar :name=\"person.name\" :src=\"person.src\" :size=\"size\" fallback=\"initials\" />\n </span>\n <span v-if=\"rest\" class=\"rk-stack-item rk-stack-rest\" aria-hidden=\"true\">+{{ rest }}</span>\n </div>\n</template>\n\n<style scoped>\n.rk-stack {\n display: inline-flex;\n align-items: center;\n}\n\n/* Overlapped by a third, with a ring in the page's own colour so each face\n keeps an edge against the one under it — on any material. */\n.rk-stack-item + .rk-stack-item {\n margin-left: -0.5rem;\n}\n\n.rk-stack.is-sm .rk-stack-item + .rk-stack-item {\n margin-left: -0.5rem;\n}\n\n.rk-stack.is-lg .rk-stack-item + .rk-stack-item {\n margin-left: -0.875rem;\n}\n\n.rk-stack-item {\n display: inline-flex;\n border-radius: 9999px;\n box-shadow: 0 0 0 2px var(--color-surface);\n}\n\n.rk-stack-rest {\n display: inline-grid;\n width: 2.25rem;\n height: 2.25rem;\n place-items: center;\n background: var(--color-muted);\n font-size: 0.75rem;\n font-weight: 600;\n color: var(--color-ink-soft);\n font-variant-numeric: tabular-nums;\n}\n\n.rk-stack.is-sm .rk-stack-rest {\n width: 1.75rem;\n height: 1.75rem;\n font-size: 0.6875rem;\n}\n\n.rk-stack.is-lg .rk-stack-rest {\n width: 3rem;\n height: 3rem;\n font-size: 0.8125rem;\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { ChevronLeft, ChevronRight } from 'lucide-vue-next'\nimport { computed, nextTick, ref, useTemplateRef, watch } from 'vue'\n\nimport { addDays, fromDateKey, toDateKey, todayKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DateRange {\n /** `YYYY-MM-DD`, always local. */\n start: string\n end: string\n}\n\n/**\n * A month of days, for choosing one or a stretch of them.\n *\n * Dates are the kit's date keys — `YYYY-MM-DD`, always local — and never\n * `Date` objects across the boundary. `toISOString()` on a late evening in\n * Istanbul is tomorrow, which is the bug `toDateKey` exists to prevent, and\n * a component that handed back `Date`s would hand that bug to every app.\n *\n * The keyboard is the date-grid pattern: the arrows move a day and a week,\n * Home and End go to the ends of the week, Page Up and Down change the\n * month, and with Shift, the year. Only one day is in the Tab order at a\n * time, so a calendar is one stop rather than thirty-one.\n *\n * Every name a screen reader reads — the month, the weekdays, each day —\n * comes from `Intl` in the app's own locale. The two arrows are the only\n * words the app has to pass, because \"previous\" has no date to build it\n * from.\n */\nconst {\n mode = 'single' as M,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = todayKey(),\n} = defineProps<{\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** The earliest day that can be chosen, as `YYYY-MM-DD`. */\n min?: string | undefined\n max?: string | undefined\n /** Days to rule out inside the range — weekends, days already booked. */\n isDisabled?: ((key: string) => boolean) | undefined\n /** `1` Monday, `0` Sunday. */\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the back arrow, e.g. \"Previous month\". */\n previousLabel: string\n /** Accessible name of the forward arrow. */\n nextLabel: string\n /** Which day is marked as today. Given, so a test or a demo can fix it. */\n today?: string | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or the chosen range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst single = computed(() => (mode === 'single' ? (model.value as string | undefined) : undefined))\nconst range = computed(() =>\n mode === 'range' ? (model.value as DateRange | undefined) : undefined,\n)\n\n/* Which month is on screen, and which day the keyboard is on. They move\n together: stepping off the edge of a month turns the page. */\nconst focused = ref(single.value ?? range.value?.start ?? today)\nconst view = ref<'days' | 'months' | 'years'>('days')\nconst grid = useTemplateRef<HTMLElement>('grid')\n\n/** Set while a range is half chosen, to paint what hovering would take. */\nconst pendingStart = ref<string | null>(null)\nconst hovered = ref<string | null>(null)\n\nconst focusedDate = computed(() => fromDateKey(focused.value))\nconst year = computed(() => focusedDate.value.getFullYear())\nconst month = computed(() => focusedDate.value.getMonth())\n\nconst monthTitle = computed(() => formatDate(focusedDate.value, { month: 'long', year: 'numeric' }))\n\n/** The weekday headings, in the app's locale, starting on the chosen day. */\nconst weekdays = computed(() => {\n // 2024-01-07 was a Sunday, so this walks a real week in the right order.\n const sunday = new Date(2024, 0, 7)\n return Array.from({ length: 7 }, (_, i) => {\n const date = new Date(sunday)\n date.setDate(sunday.getDate() + ((i + weekStartsOn) % 7))\n return {\n short: formatDate(date, { weekday: 'short' }),\n long: formatDate(date, { weekday: 'long' }),\n }\n })\n})\n\n/** Six weeks, always: a calendar that changes height as you page it jumps. */\nconst weeks = computed(() => {\n const first = new Date(year.value, month.value, 1)\n const offset = (first.getDay() - weekStartsOn + 7) % 7\n let cursor = addDays(toDateKey(first), -offset)\n\n return Array.from({ length: 6 }, () =>\n Array.from({ length: 7 }, () => {\n const key = cursor\n cursor = addDays(cursor, 1)\n return key\n }),\n )\n})\n\nconst months = computed(() =>\n Array.from({ length: 12 }, (_, i) => ({\n index: i,\n label: formatDate(new Date(year.value, i, 1), { month: 'short' }),\n long: formatDate(new Date(year.value, i, 1), { month: 'long' }),\n })),\n)\n\n/** A block of twelve years, the one the focused year falls in. */\nconst years = computed(() => {\n const start = Math.floor(year.value / 12) * 12\n return Array.from({ length: 12 }, (_, i) => start + i)\n})\n\nconst outside = (key: string) => fromDateKey(key).getMonth() !== month.value\n\nfunction disabled(key: string) {\n if (min !== undefined && key < min) return true\n if (max !== undefined && key > max) return true\n return isDisabled?.(key) ?? false\n}\n\n/* What a day looks like: chosen, an end of the range, or inside it —\n including the stretch the pointer is hovering over while a range is half\n made, which is what makes the second click land where it looks like it\n will. */\nconst edges = computed(() => {\n if (mode !== 'range') return null\n if (pendingStart.value) {\n const other = hovered.value ?? pendingStart.value\n return pendingStart.value <= other\n ? { start: pendingStart.value, end: other }\n : { start: other, end: pendingStart.value }\n }\n return range.value ?? null\n})\n\nfunction stateOf(key: string) {\n if (mode === 'single') return single.value === key ? 'selected' : ''\n const span = edges.value\n if (!span) return ''\n if (key === span.start || key === span.end) return 'selected'\n return key > span.start && key < span.end ? 'inside' : ''\n}\n\nfunction choose(key: string) {\n if (disabled(key)) return\n focused.value = key\n\n if (mode === 'single') {\n model.value = key as Value\n return\n }\n\n if (!pendingStart.value) {\n pendingStart.value = key\n return\n }\n\n const start = pendingStart.value <= key ? pendingStart.value : key\n const end = pendingStart.value <= key ? key : pendingStart.value\n pendingStart.value = null\n hovered.value = null\n model.value = { start, end } as Value\n}\n\nasync function moveTo(key: string) {\n focused.value = key\n await nextTick()\n grid.value?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus()\n}\n\nfunction shiftMonths(count: number) {\n const date = new Date(year.value, month.value + count, 1)\n // The same day of the month where it exists: the 31st of a 30-day month\n // lands on the 30th rather than spilling into the next one.\n const last = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate()\n date.setDate(Math.min(focusedDate.value.getDate(), last))\n return toDateKey(date)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const key = event.key\n const jumps: Record<string, () => string> = {\n ArrowLeft: () => addDays(focused.value, -1),\n ArrowRight: () => addDays(focused.value, 1),\n ArrowUp: () => addDays(focused.value, -7),\n ArrowDown: () => addDays(focused.value, 7),\n Home: () =>\n addDays(focused.value, -((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n End: () =>\n addDays(focused.value, 6 - ((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n PageUp: () => shiftMonths(event.shiftKey ? -12 : -1),\n PageDown: () => shiftMonths(event.shiftKey ? 12 : 1),\n }\n\n const next = jumps[key]\n if (!next) return\n\n event.preventDefault()\n void moveTo(next())\n}\n\n/** The arrows move a month, a year, or twelve years — whatever is on screen. */\nfunction step(direction: 1 | -1) {\n if (view.value === 'days') return moveTo(shiftMonths(direction))\n const years = view.value === 'months' ? 1 : 12\n return moveTo(toDateKey(new Date(year.value + direction * years, month.value, 1)))\n}\n\n/** Down one view: years pick a year, months pick a month and land on days. */\nfunction chooseYear(value: number) {\n void moveTo(toDateKey(new Date(value, month.value, 1)))\n view.value = 'months'\n}\n\nfunction chooseMonth(index: number) {\n void moveTo(toDateKey(new Date(year.value, index, 1)))\n view.value = 'days'\n}\n\nfunction cycleView() {\n view.value = view.value === 'days' ? 'months' : view.value === 'months' ? 'years' : 'days'\n}\n\n/* Following the value: a date chosen elsewhere — a preset, a text field —\n turns the page to it. */\nwatch(\n () => [single.value, range.value?.start] as const,\n ([day, start]) => {\n const next = day ?? start\n if (next) focused.value = next\n },\n)\n</script>\n\n<template>\n <div class=\"rk-cal\">\n <div class=\"rk-cal-head\">\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"previousLabel\"\n @click=\"step(-1)\"\n >\n <ChevronLeft class=\"size-4\" aria-hidden=\"true\" />\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-title focus-ring\"\n :aria-expanded=\"view !== 'days'\"\n @click=\"cycleView\"\n >\n {{ view === 'years' ? `${years[0]} – ${years[11]}` : monthTitle }}\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"nextLabel\"\n @click=\"step(1)\"\n >\n <ChevronRight class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- Days -->\n <div v-if=\"view === 'days'\" class=\"rk-cal-weekdays\" aria-hidden=\"true\">\n <span v-for=\"day in weekdays\" :key=\"day.long\">{{ day.short }}</span>\n </div>\n\n <div\n v-if=\"view === 'days'\"\n ref=\"grid\"\n class=\"rk-cal-grid\"\n role=\"grid\"\n :aria-label=\"monthTitle\"\n @keydown=\"onKeydown\"\n @pointerleave=\"hovered = null\"\n >\n <div v-for=\"(week, index) in weeks\" :key=\"index\" class=\"rk-cal-week\" role=\"row\">\n <div v-for=\"key in week\" :key=\"key\" role=\"gridcell\" class=\"rk-cal-cell\">\n <button\n type=\"button\"\n class=\"rk-cal-day\"\n :class=\"[stateOf(key) && `is-${stateOf(key)}`, { 'is-outside': outside(key) }]\"\n :tabindex=\"key === focused ? 0 : -1\"\n :disabled=\"disabled(key)\"\n :aria-label=\"formatDate(fromDateKey(key), { dateStyle: 'full' })\"\n :aria-selected=\"stateOf(key) === 'selected'\"\n :aria-current=\"key === today ? 'date' : undefined\"\n @click=\"choose(key)\"\n @pointerenter=\"hovered = key\"\n >\n {{ fromDateKey(key).getDate() }}\n </button>\n </div>\n </div>\n </div>\n\n <!-- Months and years: the way to a date two years out without paging. -->\n <div v-else-if=\"view === 'months'\" class=\"rk-cal-blocks\">\n <button\n v-for=\"entry in months\"\n :key=\"entry.index\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n :aria-label=\"entry.long\"\n @click=\"chooseMonth(entry.index)\"\n >\n {{ entry.label }}\n </button>\n </div>\n\n <div v-else class=\"rk-cal-blocks\">\n <button\n v-for=\"value in years\"\n :key=\"value\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n @click=\"chooseYear(value)\"\n >\n {{ value }}\n </button>\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-cal {\n display: flex;\n width: 100%;\n max-width: 19rem;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-cal-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n}\n\n.rk-cal-arrow {\n display: grid;\n width: 2rem;\n height: 2rem;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-arrow:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-title {\n border-radius: var(--radius-cell);\n padding: 0.25rem 0.625rem;\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--color-ink);\n}\n\n.rk-cal-title:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-weekdays,\n.rk-cal-week {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n}\n\n.rk-cal-weekdays {\n gap: 2px;\n font-size: 0.6875rem;\n font-weight: 600;\n text-align: center;\n color: var(--color-ink-soft);\n}\n\n.rk-cal-grid {\n display: grid;\n gap: 2px;\n}\n\n.rk-cal-cell {\n display: grid;\n place-items: center;\n}\n\n.rk-cal-day {\n display: grid;\n width: 100%;\n height: 2.25rem;\n place-items: center;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-day:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-cal-day:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n/* A day from the month either side: still reachable, visibly not this month. */\n.rk-cal-day.is-outside {\n color: var(--color-ink-soft);\n opacity: 0.55;\n}\n\n.rk-cal-day.is-inside {\n background: color-mix(in oklab, var(--color-primary) 14%, transparent);\n border-radius: 0;\n}\n\n.rk-cal-day.is-selected {\n background: var(--color-primary);\n color: var(--color-on-primary);\n font-weight: 600;\n opacity: 1;\n}\n\n.rk-cal-day[aria-current='date']:not(.is-selected) {\n box-shadow: inset 0 0 0 1px var(--color-primary);\n}\n\n.rk-cal-day:disabled {\n cursor: not-allowed;\n opacity: 0.3;\n}\n\n.rk-cal-blocks {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 0.375rem;\n}\n\n.rk-cal-block {\n height: 2.5rem;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-block:hover {\n background: var(--color-muted);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { ChevronLeft, ChevronRight } from 'lucide-vue-next'\nimport { computed, nextTick, ref, useTemplateRef, watch } from 'vue'\n\nimport { addDays, fromDateKey, toDateKey, todayKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DateRange {\n /** `YYYY-MM-DD`, always local. */\n start: string\n end: string\n}\n\n/**\n * A month of days, for choosing one or a stretch of them.\n *\n * Dates are the kit's date keys — `YYYY-MM-DD`, always local — and never\n * `Date` objects across the boundary. `toISOString()` on a late evening in\n * Istanbul is tomorrow, which is the bug `toDateKey` exists to prevent, and\n * a component that handed back `Date`s would hand that bug to every app.\n *\n * The keyboard is the date-grid pattern: the arrows move a day and a week,\n * Home and End go to the ends of the week, Page Up and Down change the\n * month, and with Shift, the year. Only one day is in the Tab order at a\n * time, so a calendar is one stop rather than thirty-one.\n *\n * Every name a screen reader reads — the month, the weekdays, each day —\n * comes from `Intl` in the app's own locale. The two arrows are the only\n * words the app has to pass, because \"previous\" has no date to build it\n * from.\n */\nconst {\n mode = 'single' as M,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = todayKey(),\n} = defineProps<{\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** The earliest day that can be chosen, as `YYYY-MM-DD`. */\n min?: string | undefined\n max?: string | undefined\n /** Days to rule out inside the range — weekends, days already booked. */\n isDisabled?: ((key: string) => boolean) | undefined\n /** `1` Monday, `0` Sunday. */\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the back arrow, e.g. \"Previous month\". */\n previousLabel: string\n /** Accessible name of the forward arrow. */\n nextLabel: string\n /** Which day is marked as today. Given, so a test or a demo can fix it. */\n today?: string | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or the chosen range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst single = computed(() => (mode === 'single' ? (model.value as string | undefined) : undefined))\nconst range = computed(() =>\n mode === 'range' ? (model.value as DateRange | undefined) : undefined,\n)\n\n/* Which month is on screen, and which day the keyboard is on. They move\n together: stepping off the edge of a month turns the page. */\nconst focused = ref(single.value ?? range.value?.start ?? today)\nconst view = ref<'days' | 'months' | 'years'>('days')\nconst grid = useTemplateRef<HTMLElement>('grid')\n\n/** Set while a range is half chosen, to paint what hovering would take. */\nconst pendingStart = ref<string | null>(null)\nconst hovered = ref<string | null>(null)\n\nconst focusedDate = computed(() => fromDateKey(focused.value))\nconst year = computed(() => focusedDate.value.getFullYear())\nconst month = computed(() => focusedDate.value.getMonth())\n\nconst monthTitle = computed(() => formatDate(focusedDate.value, { month: 'long', year: 'numeric' }))\n\n/** The weekday headings, in the app's locale, starting on the chosen day. */\nconst weekdays = computed(() => {\n // 2024-01-07 was a Sunday, so this walks a real week in the right order.\n const sunday = new Date(2024, 0, 7)\n return Array.from({ length: 7 }, (_, i) => {\n const date = new Date(sunday)\n date.setDate(sunday.getDate() + ((i + weekStartsOn) % 7))\n return {\n short: formatDate(date, { weekday: 'short' }),\n long: formatDate(date, { weekday: 'long' }),\n }\n })\n})\n\n/** Six weeks, always: a calendar that changes height as you page it jumps. */\nconst weeks = computed(() => {\n const first = new Date(year.value, month.value, 1)\n const offset = (first.getDay() - weekStartsOn + 7) % 7\n let cursor = addDays(toDateKey(first), -offset)\n\n return Array.from({ length: 6 }, () =>\n Array.from({ length: 7 }, () => {\n const key = cursor\n cursor = addDays(cursor, 1)\n return key\n }),\n )\n})\n\nconst months = computed(() =>\n Array.from({ length: 12 }, (_, i) => ({\n index: i,\n label: formatDate(new Date(year.value, i, 1), { month: 'short' }),\n long: formatDate(new Date(year.value, i, 1), { month: 'long' }),\n })),\n)\n\n/** A block of twelve years, the one the focused year falls in. */\nconst years = computed(() => {\n const start = Math.floor(year.value / 12) * 12\n return Array.from({ length: 12 }, (_, i) => start + i)\n})\n\nconst outside = (key: string) => fromDateKey(key).getMonth() !== month.value\n\nfunction disabled(key: string) {\n if (min !== undefined && key < min) return true\n if (max !== undefined && key > max) return true\n return isDisabled?.(key) ?? false\n}\n\n/* What a day looks like: chosen, an end of the range, or inside it —\n including the stretch the pointer is hovering over while a range is half\n made, which is what makes the second click land where it looks like it\n will. */\nconst edges = computed(() => {\n if (mode !== 'range') return null\n if (pendingStart.value) {\n const other = hovered.value ?? pendingStart.value\n return pendingStart.value <= other\n ? { start: pendingStart.value, end: other }\n : { start: other, end: pendingStart.value }\n }\n return range.value ?? null\n})\n\nfunction stateOf(key: string) {\n if (mode === 'single') return single.value === key ? 'selected' : ''\n const span = edges.value\n if (!span) return ''\n if (key === span.start || key === span.end) return 'selected'\n return key > span.start && key < span.end ? 'inside' : ''\n}\n\nfunction choose(key: string) {\n if (disabled(key)) return\n focused.value = key\n\n if (mode === 'single') {\n model.value = key as Value\n return\n }\n\n if (!pendingStart.value) {\n pendingStart.value = key\n return\n }\n\n const start = pendingStart.value <= key ? pendingStart.value : key\n const end = pendingStart.value <= key ? key : pendingStart.value\n pendingStart.value = null\n hovered.value = null\n model.value = { start, end } as Value\n}\n\nasync function moveTo(key: string) {\n focused.value = key\n await nextTick()\n grid.value?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus()\n}\n\nfunction shiftMonths(count: number) {\n const date = new Date(year.value, month.value + count, 1)\n // The same day of the month where it exists: the 31st of a 30-day month\n // lands on the 30th rather than spilling into the next one.\n const last = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate()\n date.setDate(Math.min(focusedDate.value.getDate(), last))\n return toDateKey(date)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const key = event.key\n const jumps: Record<string, () => string> = {\n ArrowLeft: () => addDays(focused.value, -1),\n ArrowRight: () => addDays(focused.value, 1),\n ArrowUp: () => addDays(focused.value, -7),\n ArrowDown: () => addDays(focused.value, 7),\n Home: () =>\n addDays(focused.value, -((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n End: () =>\n addDays(focused.value, 6 - ((fromDateKey(focused.value).getDay() - weekStartsOn + 7) % 7)),\n PageUp: () => shiftMonths(event.shiftKey ? -12 : -1),\n PageDown: () => shiftMonths(event.shiftKey ? 12 : 1),\n }\n\n const next = jumps[key]\n if (!next) return\n\n event.preventDefault()\n void moveTo(next())\n}\n\n/** The arrows move a month, a year, or twelve years — whatever is on screen. */\nfunction step(direction: 1 | -1) {\n if (view.value === 'days') return moveTo(shiftMonths(direction))\n const years = view.value === 'months' ? 1 : 12\n return moveTo(toDateKey(new Date(year.value + direction * years, month.value, 1)))\n}\n\n/** Down one view: years pick a year, months pick a month and land on days. */\nfunction chooseYear(value: number) {\n void moveTo(toDateKey(new Date(value, month.value, 1)))\n view.value = 'months'\n}\n\nfunction chooseMonth(index: number) {\n void moveTo(toDateKey(new Date(year.value, index, 1)))\n view.value = 'days'\n}\n\nfunction cycleView() {\n view.value = view.value === 'days' ? 'months' : view.value === 'months' ? 'years' : 'days'\n}\n\n/* Following the value: a date chosen elsewhere — a preset, a text field —\n turns the page to it. */\nwatch(\n () => [single.value, range.value?.start] as const,\n ([day, start]) => {\n const next = day ?? start\n if (next) focused.value = next\n },\n)\n</script>\n\n<template>\n <div class=\"rk-cal\">\n <div class=\"rk-cal-head\">\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"previousLabel\"\n @click=\"step(-1)\"\n >\n <ChevronLeft class=\"size-4\" aria-hidden=\"true\" />\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-title focus-ring\"\n :aria-expanded=\"view !== 'days'\"\n @click=\"cycleView\"\n >\n {{ view === 'years' ? `${years[0]} – ${years[11]}` : monthTitle }}\n </button>\n\n <button\n type=\"button\"\n class=\"rk-cal-arrow focus-ring\"\n :aria-label=\"nextLabel\"\n @click=\"step(1)\"\n >\n <ChevronRight class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n\n <!-- Days -->\n <div v-if=\"view === 'days'\" class=\"rk-cal-weekdays\" aria-hidden=\"true\">\n <span v-for=\"day in weekdays\" :key=\"day.long\">{{ day.short }}</span>\n </div>\n\n <div\n v-if=\"view === 'days'\"\n ref=\"grid\"\n class=\"rk-cal-grid\"\n role=\"grid\"\n :aria-label=\"monthTitle\"\n @keydown=\"onKeydown\"\n @pointerleave=\"hovered = null\"\n >\n <div v-for=\"(week, index) in weeks\" :key=\"index\" class=\"rk-cal-week\" role=\"row\">\n <div v-for=\"key in week\" :key=\"key\" role=\"gridcell\" class=\"rk-cal-cell\">\n <button\n type=\"button\"\n class=\"rk-cal-day\"\n :class=\"[stateOf(key) && `is-${stateOf(key)}`, { 'is-outside': outside(key) }]\"\n :tabindex=\"key === focused ? 0 : -1\"\n :disabled=\"disabled(key)\"\n :aria-label=\"formatDate(fromDateKey(key), { dateStyle: 'full' })\"\n :aria-selected=\"stateOf(key) === 'selected'\"\n :aria-current=\"key === today ? 'date' : undefined\"\n @click=\"choose(key)\"\n @pointerenter=\"hovered = key\"\n >\n {{ fromDateKey(key).getDate() }}\n </button>\n </div>\n </div>\n </div>\n\n <!-- Months and years: the way to a date two years out without paging. -->\n <div v-else-if=\"view === 'months'\" class=\"rk-cal-blocks\">\n <button\n v-for=\"entry in months\"\n :key=\"entry.index\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n :aria-label=\"entry.long\"\n @click=\"chooseMonth(entry.index)\"\n >\n {{ entry.label }}\n </button>\n </div>\n\n <div v-else class=\"rk-cal-blocks\">\n <button\n v-for=\"value in years\"\n :key=\"value\"\n type=\"button\"\n class=\"rk-cal-block focus-ring\"\n @click=\"chooseYear(value)\"\n >\n {{ value }}\n </button>\n </div>\n </div>\n</template>\n\n<style scoped>\n.rk-cal {\n display: flex;\n width: 100%;\n max-width: 19rem;\n flex-direction: column;\n gap: 0.5rem;\n}\n\n.rk-cal-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.25rem;\n}\n\n.rk-cal-arrow {\n display: grid;\n width: 2rem;\n height: 2rem;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-arrow:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-title {\n border-radius: var(--radius-cell);\n padding: 0.25rem 0.625rem;\n font-size: 0.875rem;\n font-weight: 600;\n color: var(--color-ink);\n}\n\n.rk-cal-title:hover {\n background: var(--color-muted);\n}\n\n.rk-cal-weekdays,\n.rk-cal-week {\n display: grid;\n grid-template-columns: repeat(7, minmax(0, 1fr));\n}\n\n.rk-cal-weekdays {\n gap: 2px;\n font-size: 0.6875rem;\n font-weight: 600;\n text-align: center;\n color: var(--color-ink-soft);\n}\n\n.rk-cal-grid {\n display: grid;\n gap: 2px;\n}\n\n.rk-cal-cell {\n display: grid;\n place-items: center;\n}\n\n.rk-cal-day {\n display: grid;\n width: 100%;\n height: 2.25rem;\n place-items: center;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-day:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-cal-day:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: -2px;\n}\n\n/* A day from the month either side: still reachable, visibly not this month. */\n.rk-cal-day.is-outside {\n color: var(--color-ink-soft);\n opacity: 0.55;\n}\n\n.rk-cal-day.is-inside {\n background: color-mix(in oklab, var(--color-primary) 14%, transparent);\n border-radius: 0;\n}\n\n.rk-cal-day.is-selected {\n background: var(--color-primary);\n color: var(--color-on-primary);\n font-weight: 600;\n opacity: 1;\n}\n\n.rk-cal-day[aria-current='date']:not(.is-selected) {\n box-shadow: inset 0 0 0 1px var(--color-primary);\n}\n\n.rk-cal-day:disabled {\n cursor: not-allowed;\n opacity: 0.3;\n}\n\n.rk-cal-blocks {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 0.375rem;\n}\n\n.rk-cal-block {\n height: 2.5rem;\n border-radius: var(--radius-cell);\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-cal-block:hover {\n background: var(--color-muted);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { X } from 'lucide-vue-next'\nimport type { Component } from 'vue'\n\n/**\n * A short label with, when it is one of a set someone assembled, a way to\n * take it off: a filter, a recipient, a tag.\n *\n * Next to `BaseBadge`, which is a standing label and never a control. A chip\n * is removable, or selectable, or both. If it neither removes nor selects,\n * reach for the badge.\n *\n * `removeLabel` is required when it can be removed, because \"×\" alone is a\n * button a screen reader reads as \"times\".\n */\nconst {\n label,\n icon = undefined,\n tone = 'neutral',\n removeLabel = undefined,\n selected = undefined,\n disabled = false,\n} = defineProps<{\n /** The text. Already translated. */\n label: string\n icon?: Component | undefined\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | undefined\n /** Given, the chip grows a remove button. Its accessible name. */\n removeLabel?: string | undefined\n /** Given, the whole chip is a toggle and this is its state. */\n selected?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ remove: []; select: [] }>()\n</script>\n\n<template>\n <component\n :is=\"selected === undefined ? 'span' : 'button'\"\n :type=\"selected === undefined ? undefined : 'button'\"\n class=\"rk-chip\"\n :class=\"[`tone-${tone}`, { 'is-selected': selected, 'is-button': selected !== undefined }]\"\n :aria-pressed=\"selected\"\n :disabled=\"selected === undefined ? undefined : disabled\"\n @click=\"selected === undefined ? undefined : emit('select')\"\n >\n <component :is=\"icon\" v-if=\"icon\" class=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ label }}</span>\n\n <button\n v-if=\"removeLabel\"\n type=\"button\"\n class=\"rk-chip-remove focus-ring\"\n :aria-label=\"removeLabel\"\n :disabled=\"disabled\"\n @click.stop=\"emit('remove')\"\n >\n <X class=\"size-3\" aria-hidden=\"true\" />\n </button>\n </component>\n</template>\n\n<style scoped>\n.rk-chip {\n display: inline-flex;\n max-width: 100%;\n align-items: center;\n gap: 0.375rem;\n border-radius: 9999px;\n border: 1px solid transparent;\n padding: 0.1875rem 0.5rem 0.1875rem 0.625rem;\n font-size: 0.8125rem;\n font-weight: 500;\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-chip.is-button {\n cursor: pointer;\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-chip.is-button:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-chip.is-selected {\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.rk-chip:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n/* The tones tint rather than fill: a row of chips in five solid colours is a\n row where nothing stands out. The selected one fills, and that is the point\n of it. */\n.rk-chip.tone-primary {\n background: color-mix(in oklab, var(--color-primary) 12%, transparent);\n border-color: color-mix(in oklab, var(--color-primary) 25%, transparent);\n color: var(--color-primary);\n}\n\n.rk-chip.tone-success {\n background: color-mix(in oklab, var(--color-positive) 14%, transparent);\n border-color: color-mix(in oklab, var(--color-positive) 28%, transparent);\n color: color-mix(in oklab, var(--color-positive) 80%, var(--color-ink));\n}\n\n.rk-chip.tone-warning {\n background: color-mix(in oklab, var(--color-warning) 16%, transparent);\n border-color: color-mix(in oklab, var(--color-warning) 30%, transparent);\n color: color-mix(in oklab, var(--color-warning) 75%, var(--color-ink));\n}\n\n.rk-chip.tone-danger {\n background: color-mix(in oklab, var(--color-negative) 12%, transparent);\n border-color: color-mix(in oklab, var(--color-negative) 26%, transparent);\n color: var(--color-negative);\n}\n\n.rk-chip-remove {\n display: grid;\n width: 1.125rem;\n height: 1.125rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: currentColor;\n opacity: 0.7;\n transition: opacity var(--duration-fast) var(--ease-standard);\n}\n\n.rk-chip-remove:hover {\n opacity: 1;\n background: color-mix(in oklab, currentColor 15%, transparent);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { X } from 'lucide-vue-next'\nimport type { Component } from 'vue'\n\n/**\n * A short label with, when it is one of a set someone assembled, a way to\n * take it off: a filter, a recipient, a tag.\n *\n * Next to `BaseBadge`, which is a standing label and never a control. A chip\n * is removable, or selectable, or both. If it neither removes nor selects,\n * reach for the badge.\n *\n * `removeLabel` is required when it can be removed, because \"×\" alone is a\n * button a screen reader reads as \"times\".\n */\nconst {\n label,\n icon = undefined,\n tone = 'neutral',\n removeLabel = undefined,\n selected = undefined,\n disabled = false,\n} = defineProps<{\n /** The text. Already translated. */\n label: string\n icon?: Component | undefined\n tone?: 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | undefined\n /** Given, the chip grows a remove button. Its accessible name. */\n removeLabel?: string | undefined\n /** Given, the whole chip is a toggle and this is its state. */\n selected?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ remove: []; select: [] }>()\n</script>\n\n<template>\n <component\n :is=\"selected === undefined ? 'span' : 'button'\"\n :type=\"selected === undefined ? undefined : 'button'\"\n class=\"rk-chip\"\n :class=\"[`tone-${tone}`, { 'is-selected': selected, 'is-button': selected !== undefined }]\"\n :aria-pressed=\"selected\"\n :disabled=\"selected === undefined ? undefined : disabled\"\n @click=\"selected === undefined ? undefined : emit('select')\"\n >\n <component :is=\"icon\" v-if=\"icon\" class=\"size-3.5 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ label }}</span>\n\n <button\n v-if=\"removeLabel\"\n type=\"button\"\n class=\"rk-chip-remove focus-ring\"\n :aria-label=\"removeLabel\"\n :disabled=\"disabled\"\n @click.stop=\"emit('remove')\"\n >\n <X class=\"size-3\" aria-hidden=\"true\" />\n </button>\n </component>\n</template>\n\n<style scoped>\n.rk-chip {\n display: inline-flex;\n max-width: 100%;\n align-items: center;\n gap: 0.375rem;\n border-radius: 9999px;\n border: 1px solid transparent;\n padding: 0.1875rem 0.5rem 0.1875rem 0.625rem;\n font-size: 0.8125rem;\n font-weight: 500;\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-chip.is-button {\n cursor: pointer;\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-chip.is-button:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-chip.is-selected {\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.rk-chip:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n/* The tones tint rather than fill: a row of chips in five solid colours is a\n row where nothing stands out. The selected one fills, and that is the point\n of it. */\n.rk-chip.tone-primary {\n background: color-mix(in oklab, var(--color-primary) 12%, transparent);\n border-color: color-mix(in oklab, var(--color-primary) 25%, transparent);\n color: var(--color-primary);\n}\n\n.rk-chip.tone-success {\n background: color-mix(in oklab, var(--color-positive) 14%, transparent);\n border-color: color-mix(in oklab, var(--color-positive) 28%, transparent);\n color: color-mix(in oklab, var(--color-positive) 80%, var(--color-ink));\n}\n\n.rk-chip.tone-warning {\n background: color-mix(in oklab, var(--color-warning) 16%, transparent);\n border-color: color-mix(in oklab, var(--color-warning) 30%, transparent);\n color: color-mix(in oklab, var(--color-warning) 75%, var(--color-ink));\n}\n\n.rk-chip.tone-danger {\n background: color-mix(in oklab, var(--color-negative) 12%, transparent);\n border-color: color-mix(in oklab, var(--color-negative) 26%, transparent);\n color: var(--color-negative);\n}\n\n.rk-chip-remove {\n display: grid;\n width: 1.125rem;\n height: 1.125rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: currentColor;\n opacity: 0.7;\n transition: opacity var(--duration-fast) var(--ease-standard);\n}\n\n.rk-chip-remove:hover {\n opacity: 1;\n background: color-mix(in oklab, currentColor 15%, transparent);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A keyboard key, or a chord of them: `⌘ K`, `Ctrl Shift P`.\n *\n * `<kbd>` is the element the browser and assistive tech already understand,\n * so this is that element with the kit's surface on it. A chord is separate\n * keys with a joiner between them rather than one long key, which is how a\n * screen reader reads it as three things to press.\n *\n * The keys are the app's words — `⌘` on a Mac and `Ctrl` elsewhere is a\n * decision about the reader's machine, not about this component.\n */\nconst {\n keys,\n joiner = '',\n size = 'md',\n} = defineProps<{\n /** One key, or the keys of a chord: `['⌘', 'K']`. */\n keys: string | readonly string[]\n /** Drawn between the keys — \"+\", \"then\". Empty, they simply sit apart. */\n joiner?: string | undefined\n size?: 'sm' | 'md' | undefined\n}>()\n\nconst list = computed(() => (typeof keys === 'string' ? [keys] : keys))\n</script>\n\n<template>\n <span class=\"rk-kbd\" :class=\"`is-${size}`\">\n <template v-for=\"(key, index) in list\" :key=\"key\">\n <span v-if=\"index > 0 && joiner\" class=\"rk-kbd-joiner\" aria-hidden=\"true\">{{ joiner }}</span>\n <kbd class=\"rk-kbd-key control\">{{ key }}</kbd>\n </template>\n </span>\n</template>\n\n<style scoped>\n.rk-kbd {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n}\n\n.rk-kbd-key {\n display: inline-grid;\n min-width: 1.5rem;\n height: 1.5rem;\n place-items: center;\n border-radius: var(--radius-cell);\n padding: 0 0.375rem;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1;\n color: var(--color-ink-soft);\n}\n\n.is-sm .rk-kbd-key {\n min-width: 1.25rem;\n height: 1.25rem;\n padding: 0 0.25rem;\n font-size: 0.6875rem;\n}\n\n.rk-kbd-joiner {\n font-size: 0.6875rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * A keyboard key, or a chord of them: `⌘ K`, `Ctrl Shift P`.\n *\n * `<kbd>` is the element the browser and assistive tech already understand,\n * so this is that element with the kit's surface on it. A chord is separate\n * keys with a joiner between them rather than one long key, which is how a\n * screen reader reads it as three things to press.\n *\n * The keys are the app's words — `⌘` on a Mac and `Ctrl` elsewhere is a\n * decision about the reader's machine, not about this component.\n */\nconst {\n keys,\n joiner = '',\n size = 'md',\n} = defineProps<{\n /** One key, or the keys of a chord: `['⌘', 'K']`. */\n keys: string | readonly string[]\n /** Drawn between the keys — \"+\", \"then\". Empty, they simply sit apart. */\n joiner?: string | undefined\n size?: 'sm' | 'md' | undefined\n}>()\n\nconst list = computed(() => (typeof keys === 'string' ? [keys] : keys))\n</script>\n\n<template>\n <span class=\"rk-kbd\" :class=\"`is-${size}`\">\n <template v-for=\"(key, index) in list\" :key=\"key\">\n <span v-if=\"index > 0 && joiner\" class=\"rk-kbd-joiner\" aria-hidden=\"true\">{{ joiner }}</span>\n <kbd class=\"rk-kbd-key control\">{{ key }}</kbd>\n </template>\n </span>\n</template>\n\n<style scoped>\n.rk-kbd {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n}\n\n.rk-kbd-key {\n display: inline-grid;\n min-width: 1.5rem;\n height: 1.5rem;\n place-items: center;\n border-radius: var(--radius-cell);\n padding: 0 0.375rem;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 600;\n line-height: 1;\n color: var(--color-ink-soft);\n}\n\n.is-sm .rk-kbd-key {\n min-width: 1.25rem;\n height: 1.25rem;\n padding: 0 0.25rem;\n font-size: 0.6875rem;\n}\n\n.rk-kbd-joiner {\n font-size: 0.6875rem;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ArrowUpRight } from 'lucide-vue-next'\nimport { computed } from 'vue'\nimport { RouterLink } from 'vue-router'\n\n/**\n * A link in a sentence — the one thing a button is not.\n *\n * `BaseButton` has a `link` variant for an action that should read as text;\n * this is the other way round: a real link, to a real place, that navigates.\n * If pressing it does something rather than goes somewhere, it is a button.\n *\n * `to` routes and `href` leaves. A link that leaves in a new tab carries the\n * mark that says so, and `rel=\"noopener\"`, which is not a nicety: without it\n * the page that opens can reach back through `window.opener`.\n */\nconst {\n to = undefined,\n href = undefined,\n external = undefined,\n tone = 'primary',\n underline = 'hover',\n} = defineProps<{\n /** A route. Uses `RouterLink`, so the app needs vue-router. */\n to?: string | Record<string, unknown> | undefined\n /** A URL. Anything not on this site should be `external`. */\n href?: string | undefined\n /** Opens in a new tab, with the mark and the `rel` that belong to that. */\n external?: boolean | undefined\n tone?: 'primary' | 'ink' | undefined\n underline?: 'always' | 'hover' | 'none' | undefined\n}>()\n\ndefineSlots<{ default: () => unknown }>()\n\nconst is = computed(() => (to !== undefined ? RouterLink : 'a'))\n</script>\n\n<template>\n <component\n :is=\"is\"\n class=\"rk-link focus-ring\"\n :class=\"[`tone-${tone}`, `underline-${underline}`]\"\n v-bind=\"\n to !== undefined\n ? { to }\n : {\n href,\n target: external ? '_blank' : undefined,\n rel: external ? 'noopener noreferrer' : undefined,\n }\n \"\n >\n <slot />\n <ArrowUpRight v-if=\"external\" class=\"rk-link-mark\" aria-hidden=\"true\" />\n </component>\n</template>\n\n<style scoped>\n.rk-link {\n display: inline;\n border-radius: var(--radius-cell);\n font-weight: 500;\n text-underline-offset: 0.2em;\n transition: color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-link.tone-primary {\n color: var(--color-primary);\n}\n\n.rk-link.tone-ink {\n color: var(--color-ink);\n}\n\n.rk-link.underline-always {\n text-decoration: underline;\n}\n\n.rk-link.underline-hover:hover,\n.rk-link.underline-none:hover {\n text-decoration: underline;\n}\n\n.rk-link.underline-none:hover {\n text-decoration: none;\n}\n\n.rk-link-mark {\n display: inline-block;\n width: 0.875em;\n height: 0.875em;\n vertical-align: -0.1em;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ArrowUpRight } from 'lucide-vue-next'\nimport { computed } from 'vue'\nimport { RouterLink } from 'vue-router'\n\n/**\n * A link in a sentence — the one thing a button is not.\n *\n * `BaseButton` has a `link` variant for an action that should read as text;\n * this is the other way round: a real link, to a real place, that navigates.\n * If pressing it does something rather than goes somewhere, it is a button.\n *\n * `to` routes and `href` leaves. A link that leaves in a new tab carries the\n * mark that says so, and `rel=\"noopener\"`, which is not a nicety: without it\n * the page that opens can reach back through `window.opener`.\n */\nconst {\n to = undefined,\n href = undefined,\n external = undefined,\n tone = 'primary',\n underline = 'hover',\n} = defineProps<{\n /** A route. Uses `RouterLink`, so the app needs vue-router. */\n to?: string | Record<string, unknown> | undefined\n /** A URL. Anything not on this site should be `external`. */\n href?: string | undefined\n /** Opens in a new tab, with the mark and the `rel` that belong to that. */\n external?: boolean | undefined\n tone?: 'primary' | 'ink' | undefined\n underline?: 'always' | 'hover' | 'none' | undefined\n}>()\n\ndefineSlots<{ default: () => unknown }>()\n\nconst is = computed(() => (to !== undefined ? RouterLink : 'a'))\n</script>\n\n<template>\n <component\n :is=\"is\"\n class=\"rk-link focus-ring\"\n :class=\"[`tone-${tone}`, `underline-${underline}`]\"\n v-bind=\"\n to !== undefined\n ? { to }\n : {\n href,\n target: external ? '_blank' : undefined,\n rel: external ? 'noopener noreferrer' : undefined,\n }\n \"\n >\n <slot />\n <ArrowUpRight v-if=\"external\" class=\"rk-link-mark\" aria-hidden=\"true\" />\n </component>\n</template>\n\n<style scoped>\n.rk-link {\n display: inline;\n border-radius: var(--radius-cell);\n font-weight: 500;\n text-underline-offset: 0.2em;\n transition: color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-link.tone-primary {\n color: var(--color-primary);\n}\n\n.rk-link.tone-ink {\n color: var(--color-ink);\n}\n\n.rk-link.underline-always {\n text-decoration: underline;\n}\n\n.rk-link.underline-hover:hover,\n.rk-link.underline-none:hover {\n text-decoration: underline;\n}\n\n.rk-link.underline-none:hover {\n text-decoration: none;\n}\n\n.rk-link-mark {\n display: inline-block;\n width: 0.875em;\n height: 0.875em;\n vertical-align: -0.1em;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Star } from 'lucide-vue-next'\nimport { computed, ref } from 'vue'\n\n/**\n * A score out of five, given or shown.\n *\n * Two components in one, and the difference is `readonly`: given, it is a\n * slider you can drag with the arrow keys; read-only, it is an image with\n * the score as its name, and nothing to Tab into. A row of five buttons that\n * do nothing is five stops in the tab order for a number.\n *\n * `valueLabel` builds the spoken name — \"4 out of 5\" — because the words and\n * their order are the app's language, not the kit's.\n */\nconst {\n max = 5,\n label,\n valueLabel,\n readonly = false,\n size = 'md',\n allowClear = true,\n} = defineProps<{\n max?: number | undefined\n /** What is being rated: \"Difficulty\", \"Your rating\". Already translated. */\n label: string\n /** The spoken value: `(value, max) => \\`${value} out of ${max}\\`.` */\n valueLabel: (value: number, max: number) => string\n /** Shows a score rather than asks for one. */\n readonly?: boolean | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n /** Pressing the current score again clears it. */\n allowClear?: boolean | undefined\n}>()\n\n/** The score, with `v-model`. `0` is none given. */\nconst model = defineModel<number>({ default: 0 })\n\nconst hovered = ref(0)\nconst shown = computed(() => hovered.value || model.value)\nconst stars = computed(() => Array.from({ length: max }, (_, i) => i + 1))\n\nfunction pick(value: number) {\n if (readonly) return\n model.value = allowClear && model.value === value ? 0 : value\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const moves: Record<string, number> = {\n ArrowRight: model.value + 1,\n ArrowUp: model.value + 1,\n ArrowLeft: model.value - 1,\n ArrowDown: model.value - 1,\n Home: 0,\n End: max,\n }\n const next = moves[event.key]\n if (next === undefined) return\n\n event.preventDefault()\n model.value = Math.min(max, Math.max(0, next))\n}\n</script>\n\n<template>\n <div\n class=\"rk-rating\"\n :class=\"[`is-${size}`, { 'is-readonly': readonly }]\"\n :role=\"readonly ? 'img' : 'slider'\"\n :aria-label=\"`${label}: ${valueLabel(model, max)}`\"\n :tabindex=\"readonly ? undefined : 0\"\n :aria-valuenow=\"readonly ? undefined : model\"\n :aria-valuemin=\"readonly ? undefined : 0\"\n :aria-valuemax=\"readonly ? undefined : max\"\n :aria-valuetext=\"readonly ? undefined : valueLabel(model, max)\"\n @keydown=\"readonly ? undefined : onKeydown($event)\"\n @pointerleave=\"hovered = 0\"\n >\n <component\n :is=\"readonly ? 'span' : 'button'\"\n v-for=\"star in stars\"\n :key=\"star\"\n :type=\"readonly ? undefined : 'button'\"\n class=\"rk-rating-star\"\n :class=\"{ 'is-on': star <= shown }\"\n :tabindex=\"readonly ? undefined : -1\"\n :aria-hidden=\"true\"\n @click=\"pick(star)\"\n @pointerenter=\"readonly ? undefined : (hovered = star)\"\n >\n <Star class=\"rk-rating-icon\" />\n </component>\n </div>\n</template>\n\n<style scoped>\n.rk-rating {\n display: inline-flex;\n align-items: center;\n gap: 0.125rem;\n border-radius: var(--radius-cell);\n}\n\n.rk-rating:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-rating-star {\n display: grid;\n place-items: center;\n padding: 0.125rem;\n color: var(--color-hair);\n transition:\n color var(--duration-fast) var(--ease-standard),\n transform var(--duration-fast) var(--ease-standard);\n}\n\n.rk-rating:not(.is-readonly) .rk-rating-star {\n cursor: pointer;\n}\n\n.rk-rating-star.is-on {\n color: var(--color-warning);\n}\n\n.rk-rating:not(.is-readonly) .rk-rating-star:hover {\n transform: scale(1.12);\n}\n\n.rk-rating-icon {\n width: 1.25rem;\n height: 1.25rem;\n fill: currentColor;\n stroke-width: 1.25;\n}\n\n.is-sm .rk-rating-icon {\n width: 1rem;\n height: 1rem;\n}\n\n.is-lg .rk-rating-icon {\n width: 1.75rem;\n height: 1.75rem;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-rating-star {\n transition: none;\n }\n\n .rk-rating:not(.is-readonly) .rk-rating-star:hover {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Star } from 'lucide-vue-next'\nimport { computed, ref } from 'vue'\n\n/**\n * A score out of five, given or shown.\n *\n * Two components in one, and the difference is `readonly`: given, it is a\n * slider you can drag with the arrow keys; read-only, it is an image with\n * the score as its name, and nothing to Tab into. A row of five buttons that\n * do nothing is five stops in the tab order for a number.\n *\n * `valueLabel` builds the spoken name — \"4 out of 5\" — because the words and\n * their order are the app's language, not the kit's.\n */\nconst {\n max = 5,\n label,\n valueLabel,\n readonly = false,\n size = 'md',\n allowClear = true,\n} = defineProps<{\n max?: number | undefined\n /** What is being rated: \"Difficulty\", \"Your rating\". Already translated. */\n label: string\n /** The spoken value: `(value, max) => \\`${value} out of ${max}\\`.` */\n valueLabel: (value: number, max: number) => string\n /** Shows a score rather than asks for one. */\n readonly?: boolean | undefined\n size?: 'sm' | 'md' | 'lg' | undefined\n /** Pressing the current score again clears it. */\n allowClear?: boolean | undefined\n}>()\n\n/** The score, with `v-model`. `0` is none given. */\nconst model = defineModel<number>({ default: 0 })\n\nconst hovered = ref(0)\nconst shown = computed(() => hovered.value || model.value)\nconst stars = computed(() => Array.from({ length: max }, (_, i) => i + 1))\n\nfunction pick(value: number) {\n if (readonly) return\n model.value = allowClear && model.value === value ? 0 : value\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const moves: Record<string, number> = {\n ArrowRight: model.value + 1,\n ArrowUp: model.value + 1,\n ArrowLeft: model.value - 1,\n ArrowDown: model.value - 1,\n Home: 0,\n End: max,\n }\n const next = moves[event.key]\n if (next === undefined) return\n\n event.preventDefault()\n model.value = Math.min(max, Math.max(0, next))\n}\n</script>\n\n<template>\n <div\n class=\"rk-rating\"\n :class=\"[`is-${size}`, { 'is-readonly': readonly }]\"\n :role=\"readonly ? 'img' : 'slider'\"\n :aria-label=\"`${label}: ${valueLabel(model, max)}`\"\n :tabindex=\"readonly ? undefined : 0\"\n :aria-valuenow=\"readonly ? undefined : model\"\n :aria-valuemin=\"readonly ? undefined : 0\"\n :aria-valuemax=\"readonly ? undefined : max\"\n :aria-valuetext=\"readonly ? undefined : valueLabel(model, max)\"\n @keydown=\"readonly ? undefined : onKeydown($event)\"\n @pointerleave=\"hovered = 0\"\n >\n <component\n :is=\"readonly ? 'span' : 'button'\"\n v-for=\"star in stars\"\n :key=\"star\"\n :type=\"readonly ? undefined : 'button'\"\n class=\"rk-rating-star\"\n :class=\"{ 'is-on': star <= shown }\"\n :tabindex=\"readonly ? undefined : -1\"\n :aria-hidden=\"true\"\n @click=\"pick(star)\"\n @pointerenter=\"readonly ? undefined : (hovered = star)\"\n >\n <Star class=\"rk-rating-icon\" />\n </component>\n </div>\n</template>\n\n<style scoped>\n.rk-rating {\n display: inline-flex;\n align-items: center;\n gap: 0.125rem;\n border-radius: var(--radius-cell);\n}\n\n.rk-rating:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-rating-star {\n display: grid;\n place-items: center;\n padding: 0.125rem;\n color: var(--color-hair);\n transition:\n color var(--duration-fast) var(--ease-standard),\n transform var(--duration-fast) var(--ease-standard);\n}\n\n.rk-rating:not(.is-readonly) .rk-rating-star {\n cursor: pointer;\n}\n\n.rk-rating-star.is-on {\n color: var(--color-warning);\n}\n\n.rk-rating:not(.is-readonly) .rk-rating-star:hover {\n transform: scale(1.12);\n}\n\n.rk-rating-icon {\n width: 1.25rem;\n height: 1.25rem;\n fill: currentColor;\n stroke-width: 1.25;\n}\n\n.is-sm .rk-rating-icon {\n width: 1rem;\n height: 1rem;\n}\n\n.is-lg .rk-rating-icon {\n width: 1.75rem;\n height: 1.75rem;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-rating-star {\n transition: none;\n }\n\n .rk-rating:not(.is-readonly) .rk-rating-star:hover {\n transform: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A line between things — with, when it helps, a word on it.\n *\n * `role=\"separator\"` when it only divides, and nothing at all to assistive\n * tech when it carries a label, because then the text is the point and the\n * line is decoration around it.\n *\n * Vertical needs a height from its parent: inside a flex row, that is\n * `align-items: stretch`, which is the default.\n */\nconst {\n orientation = 'horizontal',\n label = '',\n spacing = 'md',\n} = defineProps<{\n orientation?: 'horizontal' | 'vertical' | undefined\n /** A word in the middle of the line: \"or\", \"Today\". Already translated. */\n label?: string | undefined\n /** Room around it. `none` for a divider inside a list that has its own. */\n spacing?: 'none' | 'sm' | 'md' | undefined\n}>()\n</script>\n\n<template>\n <div\n v-if=\"label\"\n class=\"rk-sep-labelled\"\n :class=\"[`is-${orientation}`, `space-${spacing}`]\"\n aria-hidden=\"true\"\n >\n <span class=\"rk-sep-line\" />\n <span class=\"rk-sep-label\">{{ label }}</span>\n <span class=\"rk-sep-line\" />\n </div>\n\n <div\n v-else\n class=\"rk-sep\"\n :class=\"[`is-${orientation}`, `space-${spacing}`]\"\n role=\"separator\"\n :aria-orientation=\"orientation\"\n />\n</template>\n\n<style scoped>\n.rk-sep,\n.rk-sep-labelled {\n --rk-sep-space: 1rem;\n}\n\n.space-sm {\n --rk-sep-space: 0.5rem;\n}\n\n.space-none {\n --rk-sep-space: 0px;\n}\n\n.rk-sep.is-horizontal {\n height: 1px;\n width: 100%;\n margin-block: var(--rk-sep-space);\n background: var(--color-hair);\n}\n\n.rk-sep.is-vertical {\n width: 1px;\n align-self: stretch;\n min-height: 1rem;\n margin-inline: var(--rk-sep-space);\n background: var(--color-hair);\n}\n\n.rk-sep-labelled {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n margin-block: var(--rk-sep-space);\n}\n\n.rk-sep-labelled.is-vertical {\n flex-direction: column;\n align-self: stretch;\n margin-block: 0;\n margin-inline: var(--rk-sep-space);\n}\n\n.rk-sep-line {\n flex: 1;\n background: var(--color-hair);\n}\n\n.is-horizontal .rk-sep-line {\n height: 1px;\n}\n\n.is-vertical .rk-sep-line {\n width: 1px;\n}\n\n.rk-sep-label {\n font-size: 0.75rem;\n font-weight: 500;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * A line between things — with, when it helps, a word on it.\n *\n * `role=\"separator\"` when it only divides, and nothing at all to assistive\n * tech when it carries a label, because then the text is the point and the\n * line is decoration around it.\n *\n * Vertical needs a height from its parent: inside a flex row, that is\n * `align-items: stretch`, which is the default.\n */\nconst {\n orientation = 'horizontal',\n label = '',\n spacing = 'md',\n} = defineProps<{\n orientation?: 'horizontal' | 'vertical' | undefined\n /** A word in the middle of the line: \"or\", \"Today\". Already translated. */\n label?: string | undefined\n /** Room around it. `none` for a divider inside a list that has its own. */\n spacing?: 'none' | 'sm' | 'md' | undefined\n}>()\n</script>\n\n<template>\n <div\n v-if=\"label\"\n class=\"rk-sep-labelled\"\n :class=\"[`is-${orientation}`, `space-${spacing}`]\"\n aria-hidden=\"true\"\n >\n <span class=\"rk-sep-line\" />\n <span class=\"rk-sep-label\">{{ label }}</span>\n <span class=\"rk-sep-line\" />\n </div>\n\n <div\n v-else\n class=\"rk-sep\"\n :class=\"[`is-${orientation}`, `space-${spacing}`]\"\n role=\"separator\"\n :aria-orientation=\"orientation\"\n />\n</template>\n\n<style scoped>\n.rk-sep,\n.rk-sep-labelled {\n --rk-sep-space: 1rem;\n}\n\n.space-sm {\n --rk-sep-space: 0.5rem;\n}\n\n.space-none {\n --rk-sep-space: 0px;\n}\n\n.rk-sep.is-horizontal {\n height: 1px;\n width: 100%;\n margin-block: var(--rk-sep-space);\n background: var(--color-hair);\n}\n\n.rk-sep.is-vertical {\n width: 1px;\n align-self: stretch;\n min-height: 1rem;\n margin-inline: var(--rk-sep-space);\n background: var(--color-hair);\n}\n\n.rk-sep-labelled {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n margin-block: var(--rk-sep-space);\n}\n\n.rk-sep-labelled.is-vertical {\n flex-direction: column;\n align-self: stretch;\n margin-block: 0;\n margin-inline: var(--rk-sep-space);\n}\n\n.rk-sep-line {\n flex: 1;\n background: var(--color-hair);\n}\n\n.is-horizontal .rk-sep-line {\n height: 1px;\n}\n\n.is-vertical .rk-sep-line {\n width: 1px;\n}\n\n.rk-sep-label {\n font-size: 0.75rem;\n font-weight: 500;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * One grey box standing in for content that has not arrived.\n *\n * `SkeletonList` is rows of these for a list; this is the primitive, for the\n * shapes a list does not cover — an avatar, a heading, a chart.\n *\n * A height is a CSS length, never a class: `h-4` inside a component the app\n * does not control would render at zero the day that utility is not in the\n * app's stylesheet, which is exactly how every skeleton in one app came out\n * invisible.\n *\n * It is hidden from assistive tech. The thing that is loading says so —\n * through `aria-busy`, or a status message — and a screen reader reading\n * \"blank, blank, blank\" helps nobody.\n */\nconst {\n width = '100%',\n height = '1rem',\n shape = 'block',\n} = defineProps<{\n /** Any CSS length: `12rem`, `60%`, `8ch`. */\n width?: string | undefined\n height?: string | undefined\n /** `circle` makes a round one and squares the width to the height. */\n shape?: 'block' | 'text' | 'circle' | undefined\n}>()\n</script>\n\n<template>\n <span\n class=\"rk-skeleton\"\n :class=\"`is-${shape}`\"\n :style=\"{ width: shape === 'circle' ? height : width, height }\"\n aria-hidden=\"true\"\n />\n</template>\n\n<style scoped>\n.rk-skeleton {\n display: block;\n flex-shrink: 0;\n background: var(--color-muted);\n animation: rk-skeleton-pulse 1.6s ease-in-out infinite;\n}\n\n.rk-skeleton.is-block {\n border-radius: var(--radius-cell);\n}\n\n/* A line of text, rounded like one and a little short of its box. */\n.rk-skeleton.is-text {\n border-radius: 9999px;\n}\n\n.rk-skeleton.is-circle {\n border-radius: 9999px;\n}\n\n@keyframes rk-skeleton-pulse {\n 50% {\n opacity: 0.55;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-skeleton {\n animation: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\n/**\n * One grey box standing in for content that has not arrived.\n *\n * `SkeletonList` is rows of these for a list; this is the primitive, for the\n * shapes a list does not cover — an avatar, a heading, a chart.\n *\n * A height is a CSS length, never a class: `h-4` inside a component the app\n * does not control would render at zero the day that utility is not in the\n * app's stylesheet, which is exactly how every skeleton in one app came out\n * invisible.\n *\n * It is hidden from assistive tech. The thing that is loading says so —\n * through `aria-busy`, or a status message — and a screen reader reading\n * \"blank, blank, blank\" helps nobody.\n */\nconst {\n width = '100%',\n height = '1rem',\n shape = 'block',\n} = defineProps<{\n /** Any CSS length: `12rem`, `60%`, `8ch`. */\n width?: string | undefined\n height?: string | undefined\n /** `circle` makes a round one and squares the width to the height. */\n shape?: 'block' | 'text' | 'circle' | undefined\n}>()\n</script>\n\n<template>\n <span\n class=\"rk-skeleton\"\n :class=\"`is-${shape}`\"\n :style=\"{ width: shape === 'circle' ? height : width, height }\"\n aria-hidden=\"true\"\n />\n</template>\n\n<style scoped>\n.rk-skeleton {\n display: block;\n flex-shrink: 0;\n background: var(--color-muted);\n animation: rk-skeleton-pulse 1.6s ease-in-out infinite;\n}\n\n.rk-skeleton.is-block {\n border-radius: var(--radius-cell);\n}\n\n/* A line of text, rounded like one and a little short of its box. */\n.rk-skeleton.is-text {\n border-radius: 9999px;\n}\n\n.rk-skeleton.is-circle {\n border-radius: 9999px;\n}\n\n@keyframes rk-skeleton-pulse {\n 50% {\n opacity: 0.55;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-skeleton {\n animation: none;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Check, Copy } from 'lucide-vue-next'\nimport { onBeforeUnmount, ref } from 'vue'\n\n/**\n * Copies a piece of text, and says that it did.\n *\n * The saying is the part that is usually missing: a copy button that changes\n * nothing leaves the reader pressing it twice. This swaps its icon and its\n * accessible name for two seconds, and announces the change politely — which\n * is what tells somebody who cannot see the tick.\n *\n * A refusal is reported too, through `error`: a browser without clipboard\n * permission fails silently otherwise, and the next paste is whatever was\n * there before.\n */\nconst {\n text,\n copyLabel,\n copiedLabel,\n errorLabel = undefined,\n withText = false,\n} = defineProps<{\n /** What lands on the clipboard. */\n text: string\n /** The button's name at rest, e.g. \"Copy the key\". */\n copyLabel: string\n /** Its name for the two seconds after, e.g. \"Copied\". */\n copiedLabel: string\n /** Said when the browser refuses. Unset, a refusal only leaves it unchanged. */\n errorLabel?: string | undefined\n /** Show the label beside the icon, rather than only to assistive tech. */\n withText?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ copied: []; failed: [] }>()\n\nconst state = ref<'idle' | 'copied' | 'failed'>('idle')\nlet timer: ReturnType<typeof setTimeout> | null = null\n\nasync function copy() {\n if (timer) clearTimeout(timer)\n\n try {\n await navigator.clipboard.writeText(text)\n state.value = 'copied'\n emit('copied')\n } catch {\n state.value = 'failed'\n emit('failed')\n }\n\n timer = setTimeout(() => (state.value = 'idle'), 2000)\n}\n\nonBeforeUnmount(() => {\n if (timer) clearTimeout(timer)\n})\n</script>\n\n<template>\n <button\n type=\"button\"\n class=\"rk-copy control focus-ring\"\n :class=\"{ 'is-copied': state === 'copied', 'with-text': withText }\"\n :aria-label=\"withText ? undefined : state === 'copied' ? copiedLabel : copyLabel\"\n @click=\"copy\"\n >\n <Check v-if=\"state === 'copied'\" class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <Copy v-else class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span v-if=\"withText\">{{ state === 'copied' ? copiedLabel : copyLabel }}</span>\n\n <!-- Said once, when it changes: a live region the button itself owns. -->\n <span class=\"sr-only\" role=\"status\" aria-live=\"polite\">\n {{ state === 'copied' ? copiedLabel : state === 'failed' ? (errorLabel ?? '') : '' }}\n </span>\n </button>\n</template>\n\n<style scoped>\n.rk-copy {\n display: inline-flex;\n height: 2.25rem;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0 0.625rem;\n font-size: 0.8125rem;\n font-weight: 500;\n color: var(--color-ink);\n transition:\n color var(--duration-fast) var(--ease-standard),\n background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-copy:hover {\n background: var(--color-muted);\n}\n\n.rk-copy.is-copied {\n color: var(--color-positive);\n}\n\n.rk-copy:not(.with-text) {\n width: 2.25rem;\n padding: 0;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Check, Copy } from 'lucide-vue-next'\nimport { onBeforeUnmount, ref } from 'vue'\n\n/**\n * Copies a piece of text, and says that it did.\n *\n * The saying is the part that is usually missing: a copy button that changes\n * nothing leaves the reader pressing it twice. This swaps its icon and its\n * accessible name for two seconds, and announces the change politely — which\n * is what tells somebody who cannot see the tick.\n *\n * A refusal is reported too, through `error`: a browser without clipboard\n * permission fails silently otherwise, and the next paste is whatever was\n * there before.\n */\nconst {\n text,\n copyLabel,\n copiedLabel,\n errorLabel = undefined,\n withText = false,\n} = defineProps<{\n /** What lands on the clipboard. */\n text: string\n /** The button's name at rest, e.g. \"Copy the key\". */\n copyLabel: string\n /** Its name for the two seconds after, e.g. \"Copied\". */\n copiedLabel: string\n /** Said when the browser refuses. Unset, a refusal only leaves it unchanged. */\n errorLabel?: string | undefined\n /** Show the label beside the icon, rather than only to assistive tech. */\n withText?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ copied: []; failed: [] }>()\n\nconst state = ref<'idle' | 'copied' | 'failed'>('idle')\nlet timer: ReturnType<typeof setTimeout> | null = null\n\nasync function copy() {\n if (timer) clearTimeout(timer)\n\n try {\n await navigator.clipboard.writeText(text)\n state.value = 'copied'\n emit('copied')\n } catch {\n state.value = 'failed'\n emit('failed')\n }\n\n timer = setTimeout(() => (state.value = 'idle'), 2000)\n}\n\nonBeforeUnmount(() => {\n if (timer) clearTimeout(timer)\n})\n</script>\n\n<template>\n <button\n type=\"button\"\n class=\"rk-copy control focus-ring\"\n :class=\"{ 'is-copied': state === 'copied', 'with-text': withText }\"\n :aria-label=\"withText ? undefined : state === 'copied' ? copiedLabel : copyLabel\"\n @click=\"copy\"\n >\n <Check v-if=\"state === 'copied'\" class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <Copy v-else class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span v-if=\"withText\">{{ state === 'copied' ? copiedLabel : copyLabel }}</span>\n\n <!-- Said once, when it changes: a live region the button itself owns. -->\n <span class=\"sr-only\" role=\"status\" aria-live=\"polite\">\n {{ state === 'copied' ? copiedLabel : state === 'failed' ? (errorLabel ?? '') : '' }}\n </span>\n </button>\n</template>\n\n<style scoped>\n.rk-copy {\n display: inline-flex;\n height: 2.25rem;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0 0.625rem;\n font-size: 0.8125rem;\n font-weight: 500;\n color: var(--color-ink);\n transition:\n color var(--duration-fast) var(--ease-standard),\n background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-copy:hover {\n background: var(--color-muted);\n}\n\n.rk-copy.is-copied {\n color: var(--color-positive);\n}\n\n.rk-copy:not(.with-text) {\n width: 2.25rem;\n padding: 0;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Paperclip, Upload, X } from 'lucide-vue-next'\nimport { computed, ref, useId } from 'vue'\n\n/**\n * Files, dropped on or chosen from a real file input.\n *\n * The input is the control; the box around it is a label. That is not a\n * detail: a `<div>` with a click handler cannot be reached with Tab, opened\n * with Enter, or announced as \"choose file\", and dragging is a pointer\n * gesture that a keyboard has no version of. Everything here works without a\n * drag.\n *\n * It holds files, not uploads. Sending them, the progress and the failures\n * are the app's — the kit does not know your endpoint, and a component that\n * guessed it would be wrong everywhere.\n */\nconst {\n label,\n hint = '',\n browseLabel,\n removeLabel,\n accept = undefined,\n multiple = false,\n maxSize = undefined,\n tooLargeLabel = undefined,\n disabled = false,\n} = defineProps<{\n /** The instruction in the box: \"Drop a receipt here\". Already translated. */\n label: string\n /** A line under it: what is accepted, how big. */\n hint?: string | undefined\n /** The button inside the box, e.g. \"Browse\". */\n browseLabel: string\n /** Accessible name of each file's remove button. */\n removeLabel: string\n /** Passed to the input: `image/*`, `.pdf`. */\n accept?: string | undefined\n multiple?: boolean | undefined\n /** In bytes. Anything larger is refused and reported through `rejected`. */\n maxSize?: number | undefined\n /** Shown under the box when a file was too large. */\n tooLargeLabel?: string | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{\n /** Files that were too large, so the app can say more than the kit can. */\n rejected: [files: File[]]\n}>()\n\n/** The files held, with `v-model`. */\nconst model = defineModel<File[]>({ default: () => [] })\n\nconst id = useId()\nconst over = ref(false)\nconst refused = ref(false)\n\nconst tooBig = (file: File) => maxSize !== undefined && file.size > maxSize\n\nfunction take(list: FileList | null) {\n if (!list || disabled) return\n\n const incoming = Array.from(list)\n const rejected = incoming.filter(tooBig)\n const accepted = incoming.filter((file) => !tooBig(file))\n\n refused.value = rejected.length > 0\n if (rejected.length) emit('rejected', rejected)\n\n model.value = multiple ? [...model.value, ...accepted] : accepted.slice(0, 1)\n}\n\nfunction onDrop(event: DragEvent) {\n over.value = false\n take(event.dataTransfer?.files ?? null)\n}\n\nfunction onInput(event: Event) {\n const input = event.target as HTMLInputElement\n take(input.files)\n // Cleared, so choosing the same file twice in a row still fires.\n input.value = ''\n}\n\nfunction remove(index: number) {\n model.value = model.value.filter((_, at) => at !== index)\n}\n\n/** KB and MB by hand: `Intl` has no file sizes, and the unit is not a word. */\nconst size = (bytes: number) =>\n bytes >= 1024 * 1024\n ? `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n : `${Math.max(1, Math.round(bytes / 1024))} KB`\n\nconst count = computed(() => model.value.length)\n</script>\n\n<template>\n <div class=\"rk-drop\">\n <label\n class=\"rk-drop-box control\"\n :class=\"{ 'is-over': over, 'is-disabled': disabled }\"\n :for=\"id\"\n @dragover.prevent=\"over = !disabled\"\n @dragleave=\"over = false\"\n @drop.prevent=\"onDrop\"\n >\n <input\n :id=\"id\"\n type=\"file\"\n class=\"sr-only\"\n :accept=\"accept\"\n :multiple=\"multiple\"\n :disabled=\"disabled\"\n @change=\"onInput\"\n />\n <Upload class=\"text-ink-soft size-6\" aria-hidden=\"true\" />\n <span class=\"rk-drop-label\">{{ label }}</span>\n <span v-if=\"hint\" class=\"rk-drop-hint\">{{ hint }}</span>\n <span class=\"rk-drop-browse\">{{ browseLabel }}</span>\n </label>\n\n <p v-if=\"refused && tooLargeLabel\" class=\"rk-drop-error\" role=\"alert\">{{ tooLargeLabel }}</p>\n\n <ul v-if=\"count\" class=\"rk-drop-files\">\n <li\n v-for=\"(file, index) in model\"\n :key=\"`${file.name}-${index}`\"\n class=\"rk-drop-file control\"\n >\n <Paperclip class=\"text-ink-soft size-4 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ file.name }}</span>\n <span class=\"rk-drop-size\">{{ size(file.size) }}</span>\n <button\n type=\"button\"\n class=\"rk-drop-remove focus-ring\"\n :aria-label=\"`${removeLabel}: ${file.name}`\"\n :disabled=\"disabled\"\n @click=\"remove(index)\"\n >\n <X class=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<style scoped>\n.rk-drop-box {\n display: flex;\n cursor: pointer;\n flex-direction: column;\n align-items: center;\n gap: 0.375rem;\n border-radius: var(--radius-card);\n border-style: dashed;\n border-width: 2px;\n padding: 1.5rem 1rem;\n text-align: center;\n transition:\n border-color var(--duration-fast) var(--ease-standard),\n background-color var(--duration-fast) var(--ease-standard);\n}\n\n/* The box is a label, so the ring belongs to the input it names. */\n.rk-drop-box:has(input:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-drop-box.is-over {\n border-color: var(--color-primary);\n background: color-mix(in oklab, var(--color-primary) 8%, transparent);\n}\n\n.rk-drop-box.is-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.rk-drop-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-drop-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n\n.rk-drop-browse {\n margin-top: 0.25rem;\n border-radius: 9999px;\n background: var(--color-muted);\n padding: 0.25rem 0.75rem;\n font-size: 0.8125rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-drop-error {\n margin-top: 0.5rem;\n font-size: 0.8125rem;\n color: var(--color-negative);\n}\n\n.rk-drop-files {\n margin-top: 0.75rem;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n}\n\n.rk-drop-file {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0.5rem 0.5rem 0.5rem 0.75rem;\n font-size: 0.8125rem;\n color: var(--color-ink);\n}\n\n.rk-drop-size {\n margin-left: auto;\n flex-shrink: 0;\n font-size: 0.75rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink-soft);\n}\n\n.rk-drop-remove {\n display: grid;\n width: 1.5rem;\n height: 1.5rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink-soft);\n}\n\n.rk-drop-remove:hover {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Paperclip, Upload, X } from 'lucide-vue-next'\nimport { computed, ref, useId } from 'vue'\n\n/**\n * Files, dropped on or chosen from a real file input.\n *\n * The input is the control; the box around it is a label. That is not a\n * detail: a `<div>` with a click handler cannot be reached with Tab, opened\n * with Enter, or announced as \"choose file\", and dragging is a pointer\n * gesture that a keyboard has no version of. Everything here works without a\n * drag.\n *\n * It holds files, not uploads. Sending them, the progress and the failures\n * are the app's — the kit does not know your endpoint, and a component that\n * guessed it would be wrong everywhere.\n */\nconst {\n label,\n hint = '',\n browseLabel,\n removeLabel,\n accept = undefined,\n multiple = false,\n maxSize = undefined,\n tooLargeLabel = undefined,\n disabled = false,\n} = defineProps<{\n /** The instruction in the box: \"Drop a receipt here\". Already translated. */\n label: string\n /** A line under it: what is accepted, how big. */\n hint?: string | undefined\n /** The button inside the box, e.g. \"Browse\". */\n browseLabel: string\n /** Accessible name of each file's remove button. */\n removeLabel: string\n /** Passed to the input: `image/*`, `.pdf`. */\n accept?: string | undefined\n multiple?: boolean | undefined\n /** In bytes. Anything larger is refused and reported through `rejected`. */\n maxSize?: number | undefined\n /** Shown under the box when a file was too large. */\n tooLargeLabel?: string | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{\n /** Files that were too large, so the app can say more than the kit can. */\n rejected: [files: File[]]\n}>()\n\n/** The files held, with `v-model`. */\nconst model = defineModel<File[]>({ default: () => [] })\n\nconst id = useId()\nconst over = ref(false)\nconst refused = ref(false)\n\nconst tooBig = (file: File) => maxSize !== undefined && file.size > maxSize\n\nfunction take(list: FileList | null) {\n if (!list || disabled) return\n\n const incoming = Array.from(list)\n const rejected = incoming.filter(tooBig)\n const accepted = incoming.filter((file) => !tooBig(file))\n\n refused.value = rejected.length > 0\n if (rejected.length) emit('rejected', rejected)\n\n model.value = multiple ? [...model.value, ...accepted] : accepted.slice(0, 1)\n}\n\nfunction onDrop(event: DragEvent) {\n over.value = false\n take(event.dataTransfer?.files ?? null)\n}\n\nfunction onInput(event: Event) {\n const input = event.target as HTMLInputElement\n take(input.files)\n // Cleared, so choosing the same file twice in a row still fires.\n input.value = ''\n}\n\nfunction remove(index: number) {\n model.value = model.value.filter((_, at) => at !== index)\n}\n\n/** KB and MB by hand: `Intl` has no file sizes, and the unit is not a word. */\nconst size = (bytes: number) =>\n bytes >= 1024 * 1024\n ? `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n : `${Math.max(1, Math.round(bytes / 1024))} KB`\n\nconst count = computed(() => model.value.length)\n</script>\n\n<template>\n <div class=\"rk-drop\">\n <label\n class=\"rk-drop-box control\"\n :class=\"{ 'is-over': over, 'is-disabled': disabled }\"\n :for=\"id\"\n @dragover.prevent=\"over = !disabled\"\n @dragleave=\"over = false\"\n @drop.prevent=\"onDrop\"\n >\n <input\n :id=\"id\"\n type=\"file\"\n class=\"sr-only\"\n :accept=\"accept\"\n :multiple=\"multiple\"\n :disabled=\"disabled\"\n @change=\"onInput\"\n />\n <Upload class=\"text-ink-soft size-6\" aria-hidden=\"true\" />\n <span class=\"rk-drop-label\">{{ label }}</span>\n <span v-if=\"hint\" class=\"rk-drop-hint\">{{ hint }}</span>\n <span class=\"rk-drop-browse\">{{ browseLabel }}</span>\n </label>\n\n <p v-if=\"refused && tooLargeLabel\" class=\"rk-drop-error\" role=\"alert\">{{ tooLargeLabel }}</p>\n\n <ul v-if=\"count\" class=\"rk-drop-files\">\n <li\n v-for=\"(file, index) in model\"\n :key=\"`${file.name}-${index}`\"\n class=\"rk-drop-file control\"\n >\n <Paperclip class=\"text-ink-soft size-4 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ file.name }}</span>\n <span class=\"rk-drop-size\">{{ size(file.size) }}</span>\n <button\n type=\"button\"\n class=\"rk-drop-remove focus-ring\"\n :aria-label=\"`${removeLabel}: ${file.name}`\"\n :disabled=\"disabled\"\n @click=\"remove(index)\"\n >\n <X class=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </li>\n </ul>\n </div>\n</template>\n\n<style scoped>\n.rk-drop-box {\n display: flex;\n cursor: pointer;\n flex-direction: column;\n align-items: center;\n gap: 0.375rem;\n border-radius: var(--radius-card);\n border-style: dashed;\n border-width: 2px;\n padding: 1.5rem 1rem;\n text-align: center;\n transition:\n border-color var(--duration-fast) var(--ease-standard),\n background-color var(--duration-fast) var(--ease-standard);\n}\n\n/* The box is a label, so the ring belongs to the input it names. */\n.rk-drop-box:has(input:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-drop-box.is-over {\n border-color: var(--color-primary);\n background: color-mix(in oklab, var(--color-primary) 8%, transparent);\n}\n\n.rk-drop-box.is-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.rk-drop-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-drop-hint {\n font-size: 0.75rem;\n color: var(--color-ink-soft);\n}\n\n.rk-drop-browse {\n margin-top: 0.25rem;\n border-radius: 9999px;\n background: var(--color-muted);\n padding: 0.25rem 0.75rem;\n font-size: 0.8125rem;\n font-weight: 500;\n color: var(--color-ink);\n}\n\n.rk-drop-error {\n margin-top: 0.5rem;\n font-size: 0.8125rem;\n color: var(--color-negative);\n}\n\n.rk-drop-files {\n margin-top: 0.75rem;\n display: flex;\n flex-direction: column;\n gap: 0.375rem;\n}\n\n.rk-drop-file {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0.5rem 0.5rem 0.5rem 0.75rem;\n font-size: 0.8125rem;\n color: var(--color-ink);\n}\n\n.rk-drop-size {\n margin-left: auto;\n flex-shrink: 0;\n font-size: 0.75rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink-soft);\n}\n\n.rk-drop-remove {\n display: grid;\n width: 1.5rem;\n height: 1.5rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink-soft);\n}\n\n.rk-drop-remove:hover {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref } from 'vue'\n\nimport BaseChip from './BaseChip.vue'\nimport FormField from './FormField.vue'\n\n/**\n * A field that holds several short values: recipients, labels, skills.\n *\n * Enter and a comma commit what has been typed; Backspace on an empty field\n * takes the last one back, which is the shortcut everybody tries. The chips\n * are before the field rather than beside it, so the caret is always at the\n * end of the line the way it is in a mail client.\n *\n * `removeLabel` builds each chip's remove button name from the tag, so a\n * screen reader hears \"Remove: design\" rather than five buttons called \"×\".\n */\nconst {\n label,\n removeLabel,\n placeholder = '',\n hint = '',\n error = '',\n max = undefined,\n allowDuplicates = false,\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n /** `(tag) => \\`Remove ${tag}\\`` — already translated. */\n removeLabel: (tag: string) => string\n placeholder?: string | undefined\n hint?: string | undefined\n error?: string | undefined\n /** How many tags at most. The field stops taking them at the limit. */\n max?: number | undefined\n /** By default the same tag twice is ignored. */\n allowDuplicates?: boolean | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/** The tags, with `v-model`. */\nconst model = defineModel<string[]>({ default: () => [] })\n\nconst draft = ref('')\n\nfunction add() {\n const value = draft.value.trim()\n draft.value = ''\n if (!value) return\n if (max !== undefined && model.value.length >= max) return\n if (!allowDuplicates && model.value.includes(value)) return\n\n model.value = [...model.value, value]\n}\n\nfunction remove(index: number) {\n model.value = model.value.filter((_, at) => at !== index)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key === 'Enter' || event.key === ',') {\n // Enter here commits a tag; it must not also submit the form around it.\n event.preventDefault()\n add()\n return\n }\n\n if (event.key === 'Backspace' && draft.value === '' && model.value.length) {\n event.preventDefault()\n remove(model.value.length - 1)\n }\n}\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <div\n class=\"rk-tags control\"\n :class=\"{ 'is-invalid': invalid, 'is-disabled': disabled }\"\n @click=\"!disabled && ($el as HTMLElement).querySelector('input')?.focus()\"\n >\n <BaseChip\n v-for=\"(tag, index) in model\"\n :key=\"`${tag}-${index}`\"\n :label=\"tag\"\n :remove-label=\"removeLabel(tag)\"\n :disabled=\"disabled\"\n @remove=\"remove(index)\"\n />\n\n <input\n :id=\"id\"\n v-model=\"draft\"\n type=\"text\"\n class=\"rk-tags-field\"\n autocomplete=\"off\"\n :placeholder=\"model.length ? '' : placeholder\"\n :aria-describedby=\"describedBy\"\n :aria-invalid=\"invalid\"\n :disabled=\"disabled || (max !== undefined && model.length >= max)\"\n @keydown=\"onKeydown\"\n @blur=\"add\"\n />\n </div>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n.rk-tags {\n display: flex;\n min-height: 2.75rem;\n cursor: text;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.375rem;\n border-radius: var(--radius-card);\n padding: 0.375rem 0.5rem;\n}\n\n/* `:has(input:focus-visible)` rather than `:focus-within`: the ring belongs\n to the field, not to the chips' remove buttons, which carry their own. */\n.rk-tags:has(.rk-tags-field:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n.rk-tags.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-tags.is-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.rk-tags-field {\n min-width: 6rem;\n flex: 1;\n background: transparent;\n /* 16px, like every other field: below it iOS zooms the page in on focus\n and never zooms back. */\n font-size: 1rem;\n color: var(--color-ink);\n outline: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { ref } from 'vue'\n\nimport BaseChip from './BaseChip.vue'\nimport FormField from './FormField.vue'\n\n/**\n * A field that holds several short values: recipients, labels, skills.\n *\n * Enter and a comma commit what has been typed; Backspace on an empty field\n * takes the last one back, which is the shortcut everybody tries. The chips\n * are before the field rather than beside it, so the caret is always at the\n * end of the line the way it is in a mail client.\n *\n * `removeLabel` builds each chip's remove button name from the tag, so a\n * screen reader hears \"Remove: design\" rather than five buttons called \"×\".\n */\nconst {\n label,\n removeLabel,\n placeholder = '',\n hint = '',\n error = '',\n max = undefined,\n allowDuplicates = false,\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n /** `(tag) => \\`Remove ${tag}\\`` — already translated. */\n removeLabel: (tag: string) => string\n placeholder?: string | undefined\n hint?: string | undefined\n error?: string | undefined\n /** How many tags at most. The field stops taking them at the limit. */\n max?: number | undefined\n /** By default the same tag twice is ignored. */\n allowDuplicates?: boolean | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/** The tags, with `v-model`. */\nconst model = defineModel<string[]>({ default: () => [] })\n\nconst draft = ref('')\n\nfunction add() {\n const value = draft.value.trim()\n draft.value = ''\n if (!value) return\n if (max !== undefined && model.value.length >= max) return\n if (!allowDuplicates && model.value.includes(value)) return\n\n model.value = [...model.value, value]\n}\n\nfunction remove(index: number) {\n model.value = model.value.filter((_, at) => at !== index)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key === 'Enter' || event.key === ',') {\n // Enter here commits a tag; it must not also submit the form around it.\n event.preventDefault()\n add()\n return\n }\n\n if (event.key === 'Backspace' && draft.value === '' && model.value.length) {\n event.preventDefault()\n remove(model.value.length - 1)\n }\n}\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <div\n class=\"rk-tags control\"\n :class=\"{ 'is-invalid': invalid, 'is-disabled': disabled }\"\n @click=\"!disabled && ($el as HTMLElement).querySelector('input')?.focus()\"\n >\n <BaseChip\n v-for=\"(tag, index) in model\"\n :key=\"`${tag}-${index}`\"\n :label=\"tag\"\n :remove-label=\"removeLabel(tag)\"\n :disabled=\"disabled\"\n @remove=\"remove(index)\"\n />\n\n <input\n :id=\"id\"\n v-model=\"draft\"\n type=\"text\"\n class=\"rk-tags-field\"\n autocomplete=\"off\"\n :placeholder=\"model.length ? '' : placeholder\"\n :aria-describedby=\"describedBy\"\n :aria-invalid=\"invalid\"\n :disabled=\"disabled || (max !== undefined && model.length >= max)\"\n @keydown=\"onKeydown\"\n @blur=\"add\"\n />\n </div>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n.rk-tags {\n display: flex;\n min-height: 2.75rem;\n cursor: text;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.375rem;\n border-radius: var(--radius-card);\n padding: 0.375rem 0.5rem;\n}\n\n/* `:has(input:focus-visible)` rather than `:focus-within`: the ring belongs\n to the field, not to the chips' remove buttons, which carry their own. */\n.rk-tags:has(.rk-tags-field:focus-visible) {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n.rk-tags.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-tags.is-disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.rk-tags-field {\n min-width: 6rem;\n flex: 1;\n background: transparent;\n /* 16px, like every other field: below it iOS zooms the page in on focus\n and never zooms back. */\n font-size: 1rem;\n color: var(--color-ink);\n outline: none;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A panel of anything — a form, a picker, a few settings — anchored to the\n * control that opened it.\n *\n * Not a menu and not a modal. A menu is a list of actions and moves with the\n * arrow keys; a modal takes the whole page. A popover is a small non-modal\n * dialog: focus moves into it on open and back to the trigger on Escape, a\n * click outside or a Tab out of it closes it, and the page behind stays\n * usable.\n *\n * The trigger is yours. The `trigger` slot hands you the attributes and the\n * click handler to bind on whatever you render — usually a `BaseButton` —\n * instead of wrapping it in a button of the kit's, which would nest one\n * button inside another.\n *\n * It opens below the trigger and flips above when there is no room below,\n * and slides sideways rather than off the edge of the screen.\n */\nconst {\n label,\n side = 'bottom',\n align = 'start',\n} = defineProps<{\n /** The panel's accessible name — what a screen reader announces on open. */\n label: string\n /** Where it prefers to open. It flips when there is no room there. */\n side?: 'bottom' | 'top' | undefined\n /** Which edge of the trigger the panel lines up with. */\n align?: 'start' | 'center' | 'end' | undefined\n}>()\n\nexport interface PopoverTriggerProps {\n 'aria-expanded': boolean\n 'aria-controls': string\n 'aria-haspopup': 'dialog'\n 'data-rk-popover-trigger': ''\n onClick: () => void\n}\n\ndefineSlots<{\n /** The control that opens it. Bind `props` on it: `v-bind=\"props\"`. */\n trigger: (props: { open: boolean; props: PopoverTriggerProps }) => unknown\n /** The panel's content. `close` for a Done or Apply button inside it. */\n default: (props: { close: () => void }) => unknown\n}>()\n\n/** Open or closed, with `v-model`. Optional: it manages itself. */\nconst open = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\n\n/** Where it actually opened, after measuring. */\nconst placed = ref(side)\n/** Pixels slid sideways to stay on screen. */\nconst shift = ref(0)\n\nconst triggerProps = computed<PopoverTriggerProps>(() => ({\n 'aria-expanded': open.value,\n 'aria-controls': id,\n 'aria-haspopup': 'dialog',\n 'data-rk-popover-trigger': '',\n onClick: () => (open.value = !open.value),\n}))\n\nfunction close() {\n open.value = false\n}\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\nfunction trigger(): HTMLElement | null {\n return root.value?.querySelector<HTMLElement>('[data-rk-popover-trigger]') ?? null\n}\n\n/**\n * Measured once it is on screen, because only then is there a size to\n * measure. Flips first, then slides: a panel that fits neither above nor\n * below keeps the side it asked for, where it is at least attached.\n */\nfunction place() {\n if (!panel.value || typeof window === 'undefined') return\n\n const rect = panel.value.getBoundingClientRect()\n const anchor = root.value!.getBoundingClientRect()\n const below = window.innerHeight - anchor.bottom\n const above = anchor.top\n\n if (side === 'bottom' && rect.height > below && above > below) placed.value = 'top'\n if (side === 'top' && rect.height > above && below > above) placed.value = 'bottom'\n\n const margin = 8\n if (rect.right > window.innerWidth - margin) shift.value = window.innerWidth - margin - rect.right\n if (rect.left + shift.value < margin) shift.value = margin - rect.left\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape' || !open.value) return\n\n event.preventDefault()\n close()\n trigger()?.focus()\n}\n\n/* Tab out of it, and it closes — it is not a trap. Focus that moved to\n nowhere (a click on empty page) is left to the pointer handler. */\nfunction onFocusout(event: FocusEvent) {\n const next = event.relatedTarget as Node | null\n if (next && root.value && !root.value.contains(next)) close()\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) close()\n}\n\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (!isOpen) {\n document.removeEventListener('pointerdown', onDocumentPointer)\n return\n }\n\n document.addEventListener('pointerdown', onDocumentPointer)\n // Reset before it renders, so it is measured where it asked to be rather\n // than where it ended up last time.\n placed.value = side\n shift.value = 0\n await nextTick()\n place()\n const first = panel.value?.querySelector<HTMLElement>(FOCUSABLE)\n ;(first ?? panel.value)?.focus()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-popover\" @keydown=\"onKeydown\" @focusout=\"onFocusout\">\n <slot name=\"trigger\" :open=\"open\" :props=\"triggerProps\" />\n\n <Transition name=\"rk-popover\">\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-popover-panel surface-overlay\"\n :class=\"[`is-${placed}`, `is-${align}`]\"\n :style=\"shift ? { '--rk-popover-shift': `${shift}px` } : undefined\"\n role=\"dialog\"\n :aria-label=\"label\"\n tabindex=\"-1\"\n >\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<style scoped>\n.rk-popover {\n position: relative;\n display: inline-flex;\n}\n\n.rk-popover-panel {\n position: absolute;\n z-index: 50;\n min-width: 14rem;\n max-width: min(24rem, calc(100vw - 1rem));\n border-radius: var(--radius-card);\n padding: 0.75rem;\n translate: var(--rk-popover-shift, 0) 0;\n}\n\n.rk-popover-panel:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-popover-panel.is-bottom {\n top: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-top {\n bottom: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-start {\n left: 0;\n}\n\n.rk-popover-panel.is-end {\n right: 0;\n}\n\n.rk-popover-panel.is-center {\n left: 50%;\n translate: calc(-50% + var(--rk-popover-shift, 0px)) 0;\n}\n\n.rk-popover-enter-active,\n.rk-popover-leave-active {\n transition:\n opacity var(--duration-fast) var(--ease-standard),\n transform var(--duration-fast) var(--ease-standard);\n}\n\n.rk-popover-enter-from,\n.rk-popover-leave-to {\n opacity: 0;\n transform: translateY(-4px) scale(0.98);\n}\n\n.rk-popover-panel.is-top.rk-popover-enter-from,\n.rk-popover-panel.is-top.rk-popover-leave-to {\n transform: translateY(4px) scale(0.98);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\n\n/**\n * A panel of anything — a form, a picker, a few settings — anchored to the\n * control that opened it.\n *\n * Not a menu and not a modal. A menu is a list of actions and moves with the\n * arrow keys; a modal takes the whole page. A popover is a small non-modal\n * dialog: focus moves into it on open and back to the trigger on Escape, a\n * click outside or a Tab out of it closes it, and the page behind stays\n * usable.\n *\n * The trigger is yours. The `trigger` slot hands you the attributes and the\n * click handler to bind on whatever you render — usually a `BaseButton` —\n * instead of wrapping it in a button of the kit's, which would nest one\n * button inside another.\n *\n * It opens below the trigger and flips above when there is no room below,\n * and slides sideways rather than off the edge of the screen.\n */\nconst {\n label,\n side = 'bottom',\n align = 'start',\n} = defineProps<{\n /** The panel's accessible name — what a screen reader announces on open. */\n label: string\n /** Where it prefers to open. It flips when there is no room there. */\n side?: 'bottom' | 'top' | undefined\n /** Which edge of the trigger the panel lines up with. */\n align?: 'start' | 'center' | 'end' | undefined\n}>()\n\nexport interface PopoverTriggerProps {\n 'aria-expanded': boolean\n 'aria-controls': string\n 'aria-haspopup': 'dialog'\n 'data-rk-popover-trigger': ''\n onClick: () => void\n}\n\ndefineSlots<{\n /** The control that opens it. Bind `props` on it: `v-bind=\"props\"`. */\n trigger: (props: { open: boolean; props: PopoverTriggerProps }) => unknown\n /** The panel's content. `close` for a Done or Apply button inside it. */\n default: (props: { close: () => void }) => unknown\n}>()\n\n/** Open or closed, with `v-model`. Optional: it manages itself. */\nconst open = defineModel<boolean>({ default: false })\n\nconst id = useId()\nconst root = ref<HTMLElement | null>(null)\nconst panel = ref<HTMLElement | null>(null)\n\n/** Where it actually opened, after measuring. */\nconst placed = ref(side)\n/** Pixels slid sideways to stay on screen. */\nconst shift = ref(0)\n\nconst triggerProps = computed<PopoverTriggerProps>(() => ({\n 'aria-expanded': open.value,\n 'aria-controls': id,\n 'aria-haspopup': 'dialog',\n 'data-rk-popover-trigger': '',\n onClick: () => (open.value = !open.value),\n}))\n\nfunction close() {\n open.value = false\n}\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\nfunction trigger(): HTMLElement | null {\n return root.value?.querySelector<HTMLElement>('[data-rk-popover-trigger]') ?? null\n}\n\n/**\n * Measured once it is on screen, because only then is there a size to\n * measure. Flips first, then slides: a panel that fits neither above nor\n * below keeps the side it asked for, where it is at least attached.\n */\nfunction place() {\n if (!panel.value || typeof window === 'undefined') return\n\n const rect = panel.value.getBoundingClientRect()\n const anchor = root.value!.getBoundingClientRect()\n const below = window.innerHeight - anchor.bottom\n const above = anchor.top\n\n if (side === 'bottom' && rect.height > below && above > below) placed.value = 'top'\n if (side === 'top' && rect.height > above && below > above) placed.value = 'bottom'\n\n const margin = 8\n if (rect.right > window.innerWidth - margin) shift.value = window.innerWidth - margin - rect.right\n if (rect.left + shift.value < margin) shift.value = margin - rect.left\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape' || !open.value) return\n\n event.preventDefault()\n close()\n trigger()?.focus()\n}\n\n/* Tab out of it, and it closes — it is not a trap. Focus that moved to\n nowhere (a click on empty page) is left to the pointer handler. */\nfunction onFocusout(event: FocusEvent) {\n const next = event.relatedTarget as Node | null\n if (next && root.value && !root.value.contains(next)) close()\n}\n\nfunction onDocumentPointer(event: Event) {\n if (root.value && !root.value.contains(event.target as Node)) close()\n}\n\nwatch(\n open,\n async (isOpen) => {\n if (typeof document === 'undefined') return\n\n if (!isOpen) {\n document.removeEventListener('pointerdown', onDocumentPointer)\n return\n }\n\n document.addEventListener('pointerdown', onDocumentPointer)\n // Reset before it renders, so it is measured where it asked to be rather\n // than where it ended up last time.\n placed.value = side\n shift.value = 0\n await nextTick()\n place()\n const first = panel.value?.querySelector<HTMLElement>(FOCUSABLE)\n ;(first ?? panel.value)?.focus()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n if (typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', onDocumentPointer)\n }\n})\n</script>\n\n<template>\n <div ref=\"root\" class=\"rk-popover\" @keydown=\"onKeydown\" @focusout=\"onFocusout\">\n <slot name=\"trigger\" :open=\"open\" :props=\"triggerProps\" />\n\n <Transition name=\"rk-popover\">\n <div\n v-if=\"open\"\n :id=\"id\"\n ref=\"panel\"\n class=\"rk-popover-panel surface-overlay\"\n :class=\"[`is-${placed}`, `is-${align}`]\"\n :style=\"shift ? { '--rk-popover-shift': `${shift}px` } : undefined\"\n role=\"dialog\"\n :aria-label=\"label\"\n tabindex=\"-1\"\n >\n <slot :close=\"close\" />\n </div>\n </Transition>\n </div>\n</template>\n\n<style scoped>\n.rk-popover {\n position: relative;\n display: inline-flex;\n}\n\n.rk-popover-panel {\n position: absolute;\n z-index: 50;\n min-width: 14rem;\n max-width: min(24rem, calc(100vw - 1rem));\n border-radius: var(--radius-card);\n padding: 0.75rem;\n translate: var(--rk-popover-shift, 0) 0;\n}\n\n.rk-popover-panel:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 2px;\n}\n\n.rk-popover-panel.is-bottom {\n top: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-top {\n bottom: calc(100% + 0.5rem);\n}\n\n.rk-popover-panel.is-start {\n left: 0;\n}\n\n.rk-popover-panel.is-end {\n right: 0;\n}\n\n.rk-popover-panel.is-center {\n left: 50%;\n translate: calc(-50% + var(--rk-popover-shift, 0px)) 0;\n}\n\n.rk-popover-enter-active,\n.rk-popover-leave-active {\n transition:\n opacity var(--duration-fast) var(--ease-standard),\n transform var(--duration-fast) var(--ease-standard);\n}\n\n.rk-popover-enter-from,\n.rk-popover-leave-to {\n opacity: 0;\n transform: translateY(-4px) scale(0.98);\n}\n\n.rk-popover-panel.is-top.rk-popover-enter-from,\n.rk-popover-panel.is-top.rk-popover-leave-to {\n transform: translateY(4px) scale(0.98);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { CalendarDays, X } from 'lucide-vue-next'\nimport { computed, ref } from 'vue'\n\nimport BaseCalendar from './BaseCalendar.vue'\nimport type { DateRange } from './BaseCalendar.vue'\nimport BasePopover from './BasePopover.vue'\nimport FormField from './FormField.vue'\nimport { fromDateKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DatePreset {\n /** Already translated: \"Last 7 days\", \"This month\". */\n label: string\n /** The days it stands for, built when it is pressed — so \"today\" is today. */\n value: () => string | DateRange\n}\n\n/**\n * A date, or a stretch of dates, chosen from a calendar in a popover.\n *\n * The field is a button rather than a text input: a typed date is a parsing\n * problem in every locale at once — \"03/04\" is two different days either\n * side of the Atlantic — and the calendar is the part people reach for\n * anyway. What it shows is `Intl` in the app's locale; what it hands back\n * is the kit's date keys.\n *\n * `presets` are the ready-made answers a report offers: last seven days,\n * this month. They are the app's words and the app's arithmetic, built when\n * pressed so that \"today\" is today.\n */\nconst {\n label,\n mode = 'single' as M,\n placeholder = '',\n format = { dateStyle: 'medium' },\n presets = undefined,\n clearLabel = undefined,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = undefined,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** What the field shows while nothing is chosen. */\n placeholder?: string | undefined\n /** How the chosen date reads, through `Intl.DateTimeFormat`. */\n format?: Intl.DateTimeFormatOptions | undefined\n /** Ready-made answers beside the calendar: \"Last 7 days\", \"This month\". */\n presets?: readonly DatePreset[] | undefined\n /** Given, the field grows a button that empties it. Its accessible name. */\n clearLabel?: string | undefined\n min?: string | undefined\n max?: string | undefined\n isDisabled?: ((key: string) => boolean) | undefined\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the calendar's back arrow. */\n previousLabel: string\n /** Accessible name of the calendar's forward arrow. */\n nextLabel: string\n /** Which day the calendar marks as today. Given, so a demo or a test can fix it. */\n today?: string | undefined\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst open = ref(false)\n\nconst shown = computed(() => {\n const value = model.value\n if (value === undefined) return ''\n if (typeof value === 'string') return formatDate(fromDateKey(value), format)\n\n const start = formatDate(fromDateKey(value.start), format)\n if (value.start === value.end) return start\n\n // An en dash, not a hyphen: it is a span, and it reads as one.\n return `${start} – ${formatDate(fromDateKey(value.end), format)}`\n})\n\nfunction onPicked(next: Value | undefined) {\n model.value = next as Value\n // Single: chosen is done. Range: only once both ends are in, which is the\n // only time the calendar reports one.\n if (mode === 'single' || (next && typeof next === 'object')) open.value = false\n}\n\nfunction applyPreset(preset: DatePreset) {\n model.value = preset.value() as Value\n open.value = false\n}\n\nfunction clear() {\n model.value = undefined as Value\n open.value = false\n}\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <BasePopover v-model=\"open\" class=\"rk-date\" :label=\"label\">\n <!-- Two buttons side by side rather than one inside the other: a\n button nested in a button is not a control a browser or a screen\n reader can make sense of. -->\n <template #trigger=\"{ props }\">\n <div class=\"rk-date-wrap control\" :class=\"{ 'is-invalid': invalid }\">\n <button\n :id=\"id\"\n type=\"button\"\n class=\"rk-date-field focus-ring\"\n :class=\"{ 'is-empty': !shown }\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n v-bind=\"props\"\n >\n <CalendarDays class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ shown || placeholder }}</span>\n </button>\n\n <button\n v-if=\"clearLabel && shown\"\n type=\"button\"\n class=\"rk-date-clear focus-ring\"\n :aria-label=\"clearLabel\"\n :disabled=\"disabled\"\n @click=\"clear\"\n >\n <X class=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n\n <div class=\"rk-date-panel\">\n <ul v-if=\"presets?.length\" class=\"rk-date-presets\">\n <li v-for=\"preset in presets\" :key=\"preset.label\">\n <button type=\"button\" class=\"rk-date-preset focus-ring\" @click=\"applyPreset(preset)\">\n {{ preset.label }}\n </button>\n </li>\n </ul>\n\n <BaseCalendar\n :model-value=\"model\"\n :mode=\"mode\"\n :min=\"min\"\n :max=\"max\"\n :is-disabled=\"isDisabled\"\n :week-starts-on=\"weekStartsOn\"\n :previous-label=\"previousLabel\"\n :next-label=\"nextLabel\"\n v-bind=\"today ? { today } : {}\"\n @update:model-value=\"onPicked\"\n />\n </div>\n </BasePopover>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n.rk-date {\n display: block;\n}\n\n/* Wider than a popover's default: a calendar and a column of presets side by\n side do not fit in 24rem, and the month title wraps in two. */\n.rk-date :deep(.rk-popover-panel) {\n max-width: min(34rem, calc(100vw - 1rem));\n}\n\n.rk-date-wrap {\n display: flex;\n width: 100%;\n height: 2.75rem;\n align-items: center;\n border-radius: var(--radius-card);\n padding-right: 0.375rem;\n}\n\n.rk-date-field {\n display: flex;\n min-width: 0;\n flex: 1;\n height: 100%;\n align-items: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0 0.75rem;\n text-align: left;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-date-field.is-empty {\n color: var(--color-ink-soft);\n}\n\n.rk-date-wrap.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-date-field:disabled {\n opacity: 0.5;\n}\n\n.rk-date-clear {\n display: grid;\n width: 1.375rem;\n height: 1.375rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink-soft);\n}\n\n.rk-date-clear:hover {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-date-clear:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n/* As wide as its contents rather than as narrow as they will go: in a flex\n panel the calendar shrinks, and a squeezed month title wraps in two. */\n.rk-date-panel {\n display: flex;\n width: max-content;\n max-width: 100%;\n gap: 0.75rem;\n}\n\n.rk-date-panel :deep(.rk-cal) {\n width: 17rem;\n}\n\n.rk-date-presets {\n display: flex;\n min-width: 8rem;\n flex-direction: column;\n gap: 2px;\n border-right: 1px solid var(--surface-border-color);\n padding-right: 0.75rem;\n}\n\n.rk-date-preset {\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.375rem 0.5rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-date-preset:hover {\n background: var(--color-muted);\n}\n\n@media (max-width: 30rem) {\n .rk-date-panel {\n flex-direction: column;\n }\n\n .rk-date-presets {\n flex-direction: row;\n flex-wrap: wrap;\n border-right: 0;\n border-bottom: 1px solid var(--surface-border-color);\n padding-right: 0;\n padding-bottom: 0.5rem;\n }\n\n .rk-date-preset {\n width: auto;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"M extends 'single' | 'range' = 'single'\">\nimport { CalendarDays, X } from 'lucide-vue-next'\nimport { computed, ref } from 'vue'\n\nimport BaseCalendar from './BaseCalendar.vue'\nimport type { DateRange } from './BaseCalendar.vue'\nimport BasePopover from './BasePopover.vue'\nimport FormField from './FormField.vue'\nimport { fromDateKey } from '../utils/date'\nimport type { WeekStart } from '../utils/date'\nimport { formatDate } from '../utils/format'\n\nexport interface DatePreset {\n /** Already translated: \"Last 7 days\", \"This month\". */\n label: string\n /** The days it stands for, built when it is pressed — so \"today\" is today. */\n value: () => string | DateRange\n}\n\n/**\n * A date, or a stretch of dates, chosen from a calendar in a popover.\n *\n * The field is a button rather than a text input: a typed date is a parsing\n * problem in every locale at once — \"03/04\" is two different days either\n * side of the Atlantic — and the calendar is the part people reach for\n * anyway. What it shows is `Intl` in the app's locale; what it hands back\n * is the kit's date keys.\n *\n * `presets` are the ready-made answers a report offers: last seven days,\n * this month. They are the app's words and the app's arithmetic, built when\n * pressed so that \"today\" is today.\n */\nconst {\n label,\n mode = 'single' as M,\n placeholder = '',\n format = { dateStyle: 'medium' },\n presets = undefined,\n clearLabel = undefined,\n min = undefined,\n max = undefined,\n isDisabled = undefined,\n weekStartsOn = 1,\n previousLabel,\n nextLabel,\n today = undefined,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n /** One day, or a stretch from one day to another. */\n mode?: M | undefined\n /** What the field shows while nothing is chosen. */\n placeholder?: string | undefined\n /** How the chosen date reads, through `Intl.DateTimeFormat`. */\n format?: Intl.DateTimeFormatOptions | undefined\n /** Ready-made answers beside the calendar: \"Last 7 days\", \"This month\". */\n presets?: readonly DatePreset[] | undefined\n /** Given, the field grows a button that empties it. Its accessible name. */\n clearLabel?: string | undefined\n min?: string | undefined\n max?: string | undefined\n isDisabled?: ((key: string) => boolean) | undefined\n weekStartsOn?: WeekStart | undefined\n /** Accessible name of the calendar's back arrow. */\n previousLabel: string\n /** Accessible name of the calendar's forward arrow. */\n nextLabel: string\n /** Which day the calendar marks as today. Given, so a demo or a test can fix it. */\n today?: string | undefined\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/* `| undefined` outside the condition, not inside each branch: TypeScript\n can then see that `Value | undefined` is `Value`, which it cannot while\n `M` is still open. */\ntype Value = (M extends 'range' ? DateRange : string) | undefined\n\n/** The chosen day, or range, with `v-model`. */\nconst model = defineModel<Value>()\n\nconst open = ref(false)\n\nconst shown = computed(() => {\n const value = model.value\n if (value === undefined) return ''\n if (typeof value === 'string') return formatDate(fromDateKey(value), format)\n\n const start = formatDate(fromDateKey(value.start), format)\n if (value.start === value.end) return start\n\n // An en dash, not a hyphen: it is a span, and it reads as one.\n return `${start} – ${formatDate(fromDateKey(value.end), format)}`\n})\n\nfunction onPicked(next: Value | undefined) {\n model.value = next as Value\n // Single: chosen is done. Range: only once both ends are in, which is the\n // only time the calendar reports one.\n if (mode === 'single' || (next && typeof next === 'object')) open.value = false\n}\n\nfunction applyPreset(preset: DatePreset) {\n model.value = preset.value() as Value\n open.value = false\n}\n\nfunction clear() {\n model.value = undefined as Value\n open.value = false\n}\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <BasePopover v-model=\"open\" class=\"rk-date\" :label=\"label\">\n <!-- Two buttons side by side rather than one inside the other: a\n button nested in a button is not a control a browser or a screen\n reader can make sense of. -->\n <template #trigger=\"{ props }\">\n <div class=\"rk-date-wrap control\" :class=\"{ 'is-invalid': invalid }\">\n <button\n :id=\"id\"\n type=\"button\"\n class=\"rk-date-field focus-ring\"\n :class=\"{ 'is-empty': !shown }\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n v-bind=\"props\"\n >\n <CalendarDays class=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span class=\"truncate\">{{ shown || placeholder }}</span>\n </button>\n\n <button\n v-if=\"clearLabel && shown\"\n type=\"button\"\n class=\"rk-date-clear focus-ring\"\n :aria-label=\"clearLabel\"\n :disabled=\"disabled\"\n @click=\"clear\"\n >\n <X class=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n\n <div class=\"rk-date-panel\">\n <ul v-if=\"presets?.length\" class=\"rk-date-presets\">\n <li v-for=\"preset in presets\" :key=\"preset.label\">\n <button type=\"button\" class=\"rk-date-preset focus-ring\" @click=\"applyPreset(preset)\">\n {{ preset.label }}\n </button>\n </li>\n </ul>\n\n <BaseCalendar\n :model-value=\"model\"\n :mode=\"mode\"\n :min=\"min\"\n :max=\"max\"\n :is-disabled=\"isDisabled\"\n :week-starts-on=\"weekStartsOn\"\n :previous-label=\"previousLabel\"\n :next-label=\"nextLabel\"\n v-bind=\"today ? { today } : {}\"\n @update:model-value=\"onPicked\"\n />\n </div>\n </BasePopover>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n.rk-date {\n display: block;\n}\n\n/* Wider than a popover's default: a calendar and a column of presets side by\n side do not fit in 24rem, and the month title wraps in two. */\n.rk-date :deep(.rk-popover-panel) {\n max-width: min(34rem, calc(100vw - 1rem));\n}\n\n.rk-date-wrap {\n display: flex;\n width: 100%;\n height: 2.75rem;\n align-items: center;\n border-radius: var(--radius-card);\n padding-right: 0.375rem;\n}\n\n.rk-date-field {\n display: flex;\n min-width: 0;\n flex: 1;\n height: 100%;\n align-items: center;\n gap: 0.5rem;\n border-radius: var(--radius-card);\n padding: 0 0.75rem;\n text-align: left;\n font-size: 1rem;\n color: var(--color-ink);\n}\n\n.rk-date-field.is-empty {\n color: var(--color-ink-soft);\n}\n\n.rk-date-wrap.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-date-field:disabled {\n opacity: 0.5;\n}\n\n.rk-date-clear {\n display: grid;\n width: 1.375rem;\n height: 1.375rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n color: var(--color-ink-soft);\n}\n\n.rk-date-clear:hover {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-date-clear:focus-visible {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n/* As wide as its contents rather than as narrow as they will go: in a flex\n panel the calendar shrinks, and a squeezed month title wraps in two. */\n.rk-date-panel {\n display: flex;\n width: max-content;\n max-width: 100%;\n gap: 0.75rem;\n}\n\n.rk-date-panel :deep(.rk-cal) {\n width: 17rem;\n}\n\n.rk-date-presets {\n display: flex;\n min-width: 8rem;\n flex-direction: column;\n gap: 2px;\n border-right: 1px solid var(--surface-border-color);\n padding-right: 0.75rem;\n}\n\n.rk-date-preset {\n width: 100%;\n border-radius: var(--radius-cell);\n padding: 0.375rem 0.5rem;\n text-align: left;\n font-size: 0.8125rem;\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-date-preset:hover {\n background: var(--color-muted);\n}\n\n@media (max-width: 30rem) {\n .rk-date-panel {\n flex-direction: column;\n }\n\n .rk-date-presets {\n flex-direction: row;\n flex-wrap: wrap;\n border-right: 0;\n border-bottom: 1px solid var(--surface-border-color);\n padding-right: 0;\n padding-bottom: 0.5rem;\n }\n\n .rk-date-preset {\n width: auto;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"V extends string, M extends 'single' | 'multiple' = 'single'\">\nimport { computed, ref } from 'vue'\nimport type { Component } from 'vue'\n\n/**\n * A row of buttons that stay pressed — one at a time, or several at once.\n *\n * Next to `SegmentedControl` on purpose, and not the same thing. A segmented\n * control is a set of radios: there is always exactly one answer, and it is\n * a form value. A toggle group is pressed and unpressed buttons: in `single`\n * mode pressing the pressed one lets go (a filter that can be off), in\n * `multiple` mode any number can be down at once (bold and italic, or three\n * categories out of five).\n *\n * One Tab stop for the whole group, and the arrow keys move between the\n * buttons — the toolbar pattern, so a row of twelve does not cost twelve\n * presses of Tab to get past.\n */\nconst {\n options,\n label,\n mode = 'single' as M,\n required = false,\n size = 'md',\n} = defineProps<{\n options: readonly {\n value: V\n /** Visible text — or, with an icon and `iconOnly`, the accessible name. */\n label: string\n icon?: Component | undefined\n /** Show the icon alone. The label becomes the button's accessible name. */\n iconOnly?: boolean | undefined\n disabled?: boolean | undefined\n }[]\n /** The group's accessible name. */\n label: string\n /** `single`: at most one pressed. `multiple`: any number. */\n mode?: M | undefined\n /** In `single` mode, never let the last pressed button go. */\n required?: boolean | undefined\n size?: 'sm' | 'md' | undefined\n}>()\n\n/** The pressed value — or, in `multiple` mode, the pressed values. */\nconst model = defineModel<M extends 'multiple' ? V[] : V | undefined>()\n\nconst buttons = ref<HTMLButtonElement[]>([])\n\nconst pressed = computed(() => {\n const value = model.value\n if (Array.isArray(value)) return new Set<V>(value)\n return new Set<V>(value === undefined ? [] : [value as V])\n})\n\nfunction toggle(value: V) {\n if (mode === 'multiple') {\n const next = new Set(pressed.value)\n if (next.has(value)) next.delete(value)\n else next.add(value)\n // In the order of the options, not the order of the presses, so the\n // value reads the same however the reader got there.\n model.value = options\n .map((option) => option.value)\n .filter((v) => next.has(v)) as typeof model.value\n return\n }\n\n const isPressed = pressed.value.has(value)\n if (isPressed && required) return\n model.value = (isPressed ? undefined : value) as typeof model.value\n}\n\n/* The one button Tab lands on: the first pressed one, else the first that\n can be pressed at all. */\nconst tabStop = computed(() => {\n const enabled = options.filter((option) => !option.disabled)\n return (enabled.find((option) => pressed.value.has(option.value)) ?? enabled[0])?.value\n})\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n const step = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[event.key]\n const enabled = buttons.value.filter((button) => !button.disabled)\n let target: HTMLButtonElement | undefined\n\n if (step !== undefined) {\n const at = enabled.indexOf(buttons.value[index]!)\n target = enabled[(at + step + enabled.length) % enabled.length]\n } else if (event.key === 'Home') target = enabled[0]\n else if (event.key === 'End') target = enabled[enabled.length - 1]\n else return\n\n event.preventDefault()\n target?.focus()\n}\n</script>\n\n<template>\n <div class=\"rk-toggles control\" :class=\"`is-${size}`\" role=\"group\" :aria-label=\"label\">\n <button\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n ref=\"buttons\"\n type=\"button\"\n class=\"rk-toggle focus-ring\"\n :aria-pressed=\"pressed.has(option.value)\"\n :aria-label=\"option.iconOnly ? option.label : undefined\"\n :disabled=\"option.disabled\"\n :tabindex=\"option.value === tabStop ? 0 : -1\"\n @click=\"toggle(option.value)\"\n @keydown=\"onKeydown($event, index)\"\n >\n <component :is=\"option.icon\" v-if=\"option.icon\" class=\"rk-toggle-icon\" aria-hidden=\"true\" />\n <span v-if=\"!option.iconOnly\">{{ option.label }}</span>\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-toggles {\n display: inline-flex;\n flex-wrap: wrap;\n gap: 2px;\n border-radius: var(--radius-card);\n padding: 3px;\n}\n\n.rk-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n min-width: 2.25rem;\n height: 2.25rem;\n border-radius: calc(var(--radius-card) - 3px);\n padding: 0 0.75rem;\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.is-sm .rk-toggle {\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.625rem;\n font-size: 0.8125rem;\n}\n\n.rk-toggle:hover:not(:disabled) {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-toggle[aria-pressed='true'] {\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.rk-toggle:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n}\n\n.rk-toggle-icon {\n width: 1rem;\n height: 1rem;\n}\n</style>\n","<script setup lang=\"ts\" generic=\"V extends string, M extends 'single' | 'multiple' = 'single'\">\nimport { computed, ref } from 'vue'\nimport type { Component } from 'vue'\n\n/**\n * A row of buttons that stay pressed — one at a time, or several at once.\n *\n * Next to `SegmentedControl` on purpose, and not the same thing. A segmented\n * control is a set of radios: there is always exactly one answer, and it is\n * a form value. A toggle group is pressed and unpressed buttons: in `single`\n * mode pressing the pressed one lets go (a filter that can be off), in\n * `multiple` mode any number can be down at once (bold and italic, or three\n * categories out of five).\n *\n * One Tab stop for the whole group, and the arrow keys move between the\n * buttons — the toolbar pattern, so a row of twelve does not cost twelve\n * presses of Tab to get past.\n */\nconst {\n options,\n label,\n mode = 'single' as M,\n required = false,\n size = 'md',\n} = defineProps<{\n options: readonly {\n value: V\n /** Visible text — or, with an icon and `iconOnly`, the accessible name. */\n label: string\n icon?: Component | undefined\n /** Show the icon alone. The label becomes the button's accessible name. */\n iconOnly?: boolean | undefined\n disabled?: boolean | undefined\n }[]\n /** The group's accessible name. */\n label: string\n /** `single`: at most one pressed. `multiple`: any number. */\n mode?: M | undefined\n /** In `single` mode, never let the last pressed button go. */\n required?: boolean | undefined\n size?: 'sm' | 'md' | undefined\n}>()\n\n/** The pressed value — or, in `multiple` mode, the pressed values. */\nconst model = defineModel<M extends 'multiple' ? V[] : V | undefined>()\n\nconst buttons = ref<HTMLButtonElement[]>([])\n\nconst pressed = computed(() => {\n const value = model.value\n if (Array.isArray(value)) return new Set<V>(value)\n return new Set<V>(value === undefined ? [] : [value as V])\n})\n\nfunction toggle(value: V) {\n if (mode === 'multiple') {\n const next = new Set(pressed.value)\n if (next.has(value)) next.delete(value)\n else next.add(value)\n // In the order of the options, not the order of the presses, so the\n // value reads the same however the reader got there.\n model.value = options\n .map((option) => option.value)\n .filter((v) => next.has(v)) as typeof model.value\n return\n }\n\n const isPressed = pressed.value.has(value)\n if (isPressed && required) return\n model.value = (isPressed ? undefined : value) as typeof model.value\n}\n\n/* The one button Tab lands on: the first pressed one, else the first that\n can be pressed at all. */\nconst tabStop = computed(() => {\n const enabled = options.filter((option) => !option.disabled)\n return (enabled.find((option) => pressed.value.has(option.value)) ?? enabled[0])?.value\n})\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n const step = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[event.key]\n const enabled = buttons.value.filter((button) => !button.disabled)\n let target: HTMLButtonElement | undefined\n\n if (step !== undefined) {\n const at = enabled.indexOf(buttons.value[index]!)\n target = enabled[(at + step + enabled.length) % enabled.length]\n } else if (event.key === 'Home') target = enabled[0]\n else if (event.key === 'End') target = enabled[enabled.length - 1]\n else return\n\n event.preventDefault()\n target?.focus()\n}\n</script>\n\n<template>\n <div class=\"rk-toggles control\" :class=\"`is-${size}`\" role=\"group\" :aria-label=\"label\">\n <button\n v-for=\"(option, index) in options\"\n :key=\"option.value\"\n ref=\"buttons\"\n type=\"button\"\n class=\"rk-toggle focus-ring\"\n :aria-pressed=\"pressed.has(option.value)\"\n :aria-label=\"option.iconOnly ? option.label : undefined\"\n :disabled=\"option.disabled\"\n :tabindex=\"option.value === tabStop ? 0 : -1\"\n @click=\"toggle(option.value)\"\n @keydown=\"onKeydown($event, index)\"\n >\n <component :is=\"option.icon\" v-if=\"option.icon\" class=\"rk-toggle-icon\" aria-hidden=\"true\" />\n <span v-if=\"!option.iconOnly\">{{ option.label }}</span>\n </button>\n </div>\n</template>\n\n<style scoped>\n.rk-toggles {\n display: inline-flex;\n flex-wrap: wrap;\n gap: 2px;\n border-radius: var(--radius-card);\n padding: 3px;\n}\n\n.rk-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n min-width: 2.25rem;\n height: 2.25rem;\n border-radius: calc(var(--radius-card) - 3px);\n padding: 0 0.75rem;\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-fast) var(--ease-standard),\n color var(--duration-fast) var(--ease-standard);\n}\n\n.is-sm .rk-toggle {\n min-width: 2rem;\n height: 2rem;\n padding: 0 0.625rem;\n font-size: 0.8125rem;\n}\n\n.rk-toggle:hover:not(:disabled) {\n background: var(--color-muted);\n color: var(--color-ink);\n}\n\n.rk-toggle[aria-pressed='true'] {\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.rk-toggle:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n}\n\n.rk-toggle-icon {\n width: 1rem;\n height: 1rem;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Minus, Plus } from 'lucide-vue-next'\nimport { computed, ref, watch } from 'vue'\n\nimport FormField from './FormField.vue'\n\n/**\n * A number, typed or stepped — a quantity, a price, a count of minutes.\n *\n * `<input type=\"number\">` is what everyone reaches for and nearly everyone\n * regrets: it accepts \"e\", scrolls the value when the page is scrolled over\n * it, and hands back an empty string for anything it does not like. This is\n * a text field that only settles on numbers, with a minus and a plus beside\n * it, and the spin-button keyboard: arrows step, Page Up and Down step ten\n * at a time, Home and End go to the limits.\n *\n * Typing is free while the field has focus — \"-\", \"1.\" and \"\" are all fine\n * halfway through a number. On leaving it, the value is clamped to `min` and\n * `max` and rounded to the precision of `step`, so 0.1 + 0.2 lands on 0.3.\n */\nconst {\n label,\n min = -Infinity,\n max = Infinity,\n step = 1,\n decrementLabel,\n incrementLabel,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n /** One press of a button or an arrow key. Its decimals set the rounding. */\n step?: number | undefined\n /** Accessible name of the minus button, e.g. \"Decrease\". */\n decrementLabel: string\n /** Accessible name of the plus button, e.g. \"Increase\". */\n incrementLabel: string\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/** The number, with `v-model`. `undefined` while the field is empty. */\nconst model = defineModel<number | undefined>()\n\nconst places = computed(() => (String(step).split('.')[1] ?? '').length)\n\nconst settle = (value: number) =>\n Number(Math.min(max, Math.max(min, value)).toFixed(Math.min(places.value, 20)))\n\n/* What the field shows. Kept apart from the model so a half-typed \"1.\" is\n not rewritten to \"1\" under the reader's cursor. */\nconst draft = ref(model.value === undefined ? '' : String(model.value))\n\nwatch(model, (value) => {\n const shown = draft.value === '' ? undefined : Number(draft.value)\n if (shown !== value) draft.value = value === undefined ? '' : String(value)\n})\n\nfunction onInput(event: Event) {\n const text = (event.target as HTMLInputElement).value.replace(',', '.')\n draft.value = text\n if (text.trim() === '') {\n model.value = undefined\n return\n }\n\n const value = Number(text)\n if (Number.isFinite(value)) model.value = value\n}\n\nfunction commit() {\n if (model.value === undefined) {\n draft.value = ''\n return\n }\n setTo(model.value)\n}\n\nfunction setTo(value: number) {\n model.value = settle(value)\n draft.value = String(model.value)\n}\n\nfunction stepBy(times: number) {\n if (disabled) return\n const start = model.value ?? (Number.isFinite(min) ? min : 0)\n setTo(start + step * times)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(10),\n PageDown: () => stepBy(-10),\n Home: () => {\n if (Number.isFinite(min)) setTo(min)\n },\n End: () => {\n if (Number.isFinite(max)) setTo(max)\n },\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n}\n\nconst atMin = computed(() => model.value !== undefined && model.value <= min)\nconst atMax = computed(() => model.value !== undefined && model.value >= max)\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <div class=\"rk-number control\" :class=\"{ 'is-invalid': invalid, 'is-disabled': disabled }\">\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"decrementLabel\"\n :disabled=\"disabled || atMin\"\n tabindex=\"-1\"\n @click=\"stepBy(-1)\"\n >\n <Minus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n <input\n :id=\"id\"\n :value=\"draft\"\n type=\"text\"\n inputmode=\"decimal\"\n role=\"spinbutton\"\n autocomplete=\"off\"\n class=\"rk-number-field\"\n :aria-valuenow=\"model\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @input=\"onInput\"\n @blur=\"commit\"\n @keydown=\"onKeydown\"\n />\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"incrementLabel\"\n :disabled=\"disabled || atMax\"\n tabindex=\"-1\"\n @click=\"stepBy(1)\"\n >\n <Plus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n/* The buttons are out of the Tab order: the keyboard already has the arrows,\n and three stops for one number is two too many. They stay reachable by\n pointer and by touch, which is who they are for. */\n.rk-number {\n display: flex;\n align-items: center;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 0.25rem;\n}\n\n.rk-number:focus-within {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n.rk-number.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-number.is-disabled {\n opacity: 0.5;\n}\n\n.rk-number-field {\n min-width: 0;\n flex: 1;\n background: transparent;\n text-align: center;\n font-size: 1rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n outline: none;\n}\n\n.rk-number-step {\n display: grid;\n width: 2.25rem;\n height: 2.25rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: calc(var(--radius-card) - 4px);\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-number-step:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-number-step:disabled {\n opacity: 0.35;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { Minus, Plus } from 'lucide-vue-next'\nimport { computed, ref, watch } from 'vue'\n\nimport FormField from './FormField.vue'\n\n/**\n * A number, typed or stepped — a quantity, a price, a count of minutes.\n *\n * `<input type=\"number\">` is what everyone reaches for and nearly everyone\n * regrets: it accepts \"e\", scrolls the value when the page is scrolled over\n * it, and hands back an empty string for anything it does not like. This is\n * a text field that only settles on numbers, with a minus and a plus beside\n * it, and the spin-button keyboard: arrows step, Page Up and Down step ten\n * at a time, Home and End go to the limits.\n *\n * Typing is free while the field has focus — \"-\", \"1.\" and \"\" are all fine\n * halfway through a number. On leaving it, the value is clamped to `min` and\n * `max` and rounded to the precision of `step`, so 0.1 + 0.2 lands on 0.3.\n */\nconst {\n label,\n min = -Infinity,\n max = Infinity,\n step = 1,\n decrementLabel,\n incrementLabel,\n error = '',\n hint = '',\n size = 'md',\n labelHidden = false,\n disabled = false,\n} = defineProps<{\n label: string\n min?: number | undefined\n max?: number | undefined\n /** One press of a button or an arrow key. Its decimals set the rounding. */\n step?: number | undefined\n /** Accessible name of the minus button, e.g. \"Decrease\". */\n decrementLabel: string\n /** Accessible name of the plus button, e.g. \"Increase\". */\n incrementLabel: string\n error?: string | undefined\n hint?: string | undefined\n size?: 'sm' | 'md' | undefined\n labelHidden?: boolean | undefined\n disabled?: boolean | undefined\n}>()\n\n/** The number, with `v-model`. `undefined` while the field is empty. */\nconst model = defineModel<number | undefined>()\n\nconst places = computed(() => (String(step).split('.')[1] ?? '').length)\n\nconst settle = (value: number) =>\n Number(Math.min(max, Math.max(min, value)).toFixed(Math.min(places.value, 20)))\n\n/* What the field shows. Kept apart from the model so a half-typed \"1.\" is\n not rewritten to \"1\" under the reader's cursor. */\nconst draft = ref(model.value === undefined ? '' : String(model.value))\n\nwatch(model, (value) => {\n const shown = draft.value === '' ? undefined : Number(draft.value)\n if (shown !== value) draft.value = value === undefined ? '' : String(value)\n})\n\nfunction onInput(event: Event) {\n const text = (event.target as HTMLInputElement).value.replace(',', '.')\n draft.value = text\n if (text.trim() === '') {\n model.value = undefined\n return\n }\n\n const value = Number(text)\n if (Number.isFinite(value)) model.value = value\n}\n\nfunction commit() {\n if (model.value === undefined) {\n draft.value = ''\n return\n }\n setTo(model.value)\n}\n\nfunction setTo(value: number) {\n model.value = settle(value)\n draft.value = String(model.value)\n}\n\nfunction stepBy(times: number) {\n if (disabled) return\n const start = model.value ?? (Number.isFinite(min) ? min : 0)\n setTo(start + step * times)\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(10),\n PageDown: () => stepBy(-10),\n Home: () => {\n if (Number.isFinite(min)) setTo(min)\n },\n End: () => {\n if (Number.isFinite(max)) setTo(max)\n },\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n}\n\nconst atMin = computed(() => model.value !== undefined && model.value <= min)\nconst atMax = computed(() => model.value !== undefined && model.value >= max)\n</script>\n\n<template>\n <FormField :label=\"label\" :error=\"error\" :hint=\"hint\" :size=\"size\" :label-hidden=\"labelHidden\">\n <template #default=\"{ id, describedBy, invalid }\">\n <div class=\"rk-number control\" :class=\"{ 'is-invalid': invalid, 'is-disabled': disabled }\">\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"decrementLabel\"\n :disabled=\"disabled || atMin\"\n tabindex=\"-1\"\n @click=\"stepBy(-1)\"\n >\n <Minus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n <input\n :id=\"id\"\n :value=\"draft\"\n type=\"text\"\n inputmode=\"decimal\"\n role=\"spinbutton\"\n autocomplete=\"off\"\n class=\"rk-number-field\"\n :aria-valuenow=\"model\"\n :aria-valuemin=\"Number.isFinite(min) ? min : undefined\"\n :aria-valuemax=\"Number.isFinite(max) ? max : undefined\"\n :aria-invalid=\"invalid\"\n :aria-describedby=\"describedBy\"\n :disabled=\"disabled\"\n @input=\"onInput\"\n @blur=\"commit\"\n @keydown=\"onKeydown\"\n />\n <button\n type=\"button\"\n class=\"rk-number-step focus-ring\"\n :aria-label=\"incrementLabel\"\n :disabled=\"disabled || atMax\"\n tabindex=\"-1\"\n @click=\"stepBy(1)\"\n >\n <Plus class=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n </template>\n </FormField>\n</template>\n\n<style scoped>\n/* The buttons are out of the Tab order: the keyboard already has the arrows,\n and three stops for one number is two too many. They stay reachable by\n pointer and by touch, which is who they are for. */\n.rk-number {\n display: flex;\n align-items: center;\n height: 2.75rem;\n border-radius: var(--radius-card);\n padding: 0 0.25rem;\n}\n\n.rk-number:focus-within {\n outline: 2px solid var(--color-primary);\n outline-offset: 1px;\n}\n\n.rk-number.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-number.is-disabled {\n opacity: 0.5;\n}\n\n.rk-number-field {\n min-width: 0;\n flex: 1;\n background: transparent;\n text-align: center;\n font-size: 1rem;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n outline: none;\n}\n\n.rk-number-step {\n display: grid;\n width: 2.25rem;\n height: 2.25rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: calc(var(--radius-card) - 4px);\n color: var(--color-ink);\n transition: background-color var(--duration-fast) var(--ease-standard);\n}\n\n.rk-number-step:hover:not(:disabled) {\n background: var(--color-muted);\n}\n\n.rk-number-step:disabled {\n opacity: 0.35;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, useId } from 'vue'\n\n/**\n * A short code typed one character per box — a sign-in code, a PIN.\n *\n * No `maxlength` on the boxes: iOS fills a one-time code into the first box\n * in one go, and a limit of one would cut it to its first digit.\n *\n * The boxes are a way of showing the length, not of splitting the work:\n * typing moves to the next box on its own, Backspace on an empty box goes\n * back and clears, the arrows move, and pasting \"482913\" anywhere fills all\n * six. The first box carries `autocomplete=\"one-time-code\"`, so a phone\n * offers the code from the message it just received.\n *\n * `complete` fires once when the last box is filled — the moment to submit,\n * so nobody has to find a button after typing six digits.\n */\nconst {\n length = 6,\n label,\n cellLabel,\n type = 'numeric',\n mask = false,\n error = '',\n disabled = false,\n} = defineProps<{\n /** How many characters. */\n length?: number | undefined\n /** The group's accessible name, e.g. \"Verification code\". */\n label: string\n /** Each box's accessible name, from its 1-based position: `(n, total) => \\`Digit ${n} of ${total}\\``. */\n cellLabel: (position: number, total: number) => string\n /** `numeric` takes digits and opens the number pad; `alphanumeric` takes letters too. */\n type?: 'numeric' | 'alphanumeric' | undefined\n /** Show dots instead of the characters, for a PIN. */\n mask?: boolean | undefined\n /** A message under the boxes; also marks them invalid. */\n error?: string | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ complete: [code: string] }>()\n\n/** The code so far, with `v-model`. Always shorter than or as long as `length`. */\nconst model = defineModel<string>({ default: '' })\n\nconst cells = ref<HTMLInputElement[]>([])\nconst errorId = useId()\n\nconst allowed = computed(() => (type === 'numeric' ? /[0-9]/ : /[0-9a-z]/i))\nconst chars = computed(() => Array.from({ length }, (_, i) => model.value[i] ?? ''))\n\nfunction clean(text: string) {\n return Array.from(text)\n .filter((char) => allowed.value.test(char))\n .join('')\n}\n\nfunction write(next: string) {\n const code = next.slice(0, length)\n const wasComplete = model.value.length === length\n model.value = code\n if (code.length === length && !wasComplete) emit('complete', code)\n}\n\nfunction focusCell(index: number) {\n const cell = cells.value[Math.max(0, Math.min(length - 1, index))]\n cell?.focus()\n cell?.select()\n}\n\nfunction onInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement\n const typed = clean(input.value)\n\n // More than one character arrived: autofill or a paste the browser routed\n // through input. Either way it is the code, from this box on.\n if (typed.length > 1) {\n write(model.value.slice(0, index) + typed)\n focusCell(index + typed.length)\n return\n }\n\n input.value = typed\n if (!typed) return\n\n // The code has no gaps: a character typed into a box past the end lands at\n // the end, and focus follows it.\n const at = Math.min(index, model.value.length)\n write(model.value.slice(0, at) + typed + model.value.slice(at + 1))\n focusCell(at + 1)\n}\n\nfunction onPaste(event: ClipboardEvent, index: number) {\n const text = clean(event.clipboardData?.getData('text') ?? '')\n if (!text) return\n\n event.preventDefault()\n write(model.value.slice(0, index) + text)\n focusCell(index + text.length)\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (event.key === 'Backspace') {\n event.preventDefault()\n const target = chars.value[index] ? index : index - 1\n if (target < 0) return\n write(model.value.slice(0, target) + model.value.slice(target + 1))\n focusCell(target)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusCell(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusCell(index + 1)\n }\n}\n</script>\n\n<template>\n <div class=\"rk-pin\">\n <div class=\"rk-pin-cells\" role=\"group\" :aria-label=\"label\">\n <input\n v-for=\"(char, index) in chars\"\n :key=\"index\"\n ref=\"cells\"\n class=\"rk-pin-cell control focus-ring\"\n :class=\"{ 'is-invalid': error }\"\n :value=\"char\"\n :type=\"mask ? 'password' : 'text'\"\n :inputmode=\"type === 'numeric' ? 'numeric' : 'text'\"\n :autocomplete=\"index === 0 ? 'one-time-code' : 'off'\"\n :aria-label=\"cellLabel(index + 1, length)\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"error ? errorId : undefined\"\n :disabled=\"disabled\"\n @input=\"onInput($event, index)\"\n @paste=\"onPaste($event, index)\"\n @keydown=\"onKeydown($event, index)\"\n @focus=\"($event.target as HTMLInputElement).select()\"\n />\n </div>\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-pin-error\" role=\"alert\">{{ error }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-pin-cells {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-pin-cell {\n width: 2.75rem;\n height: 3.25rem;\n border-radius: var(--radius-card);\n text-align: center;\n font-size: 1.375rem;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n caret-color: var(--color-primary);\n}\n\n.rk-pin-cell.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-pin-cell:disabled {\n opacity: 0.5;\n}\n\n.rk-pin-error {\n margin-top: 0.5rem;\n font-size: 0.8125rem;\n color: var(--color-negative);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, ref, useId } from 'vue'\n\n/**\n * A short code typed one character per box — a sign-in code, a PIN.\n *\n * No `maxlength` on the boxes: iOS fills a one-time code into the first box\n * in one go, and a limit of one would cut it to its first digit.\n *\n * The boxes are a way of showing the length, not of splitting the work:\n * typing moves to the next box on its own, Backspace on an empty box goes\n * back and clears, the arrows move, and pasting \"482913\" anywhere fills all\n * six. The first box carries `autocomplete=\"one-time-code\"`, so a phone\n * offers the code from the message it just received.\n *\n * `complete` fires once when the last box is filled — the moment to submit,\n * so nobody has to find a button after typing six digits.\n */\nconst {\n length = 6,\n label,\n cellLabel,\n type = 'numeric',\n mask = false,\n error = '',\n disabled = false,\n} = defineProps<{\n /** How many characters. */\n length?: number | undefined\n /** The group's accessible name, e.g. \"Verification code\". */\n label: string\n /** Each box's accessible name, from its 1-based position: `(n, total) => \\`Digit ${n} of ${total}\\``. */\n cellLabel: (position: number, total: number) => string\n /** `numeric` takes digits and opens the number pad; `alphanumeric` takes letters too. */\n type?: 'numeric' | 'alphanumeric' | undefined\n /** Show dots instead of the characters, for a PIN. */\n mask?: boolean | undefined\n /** A message under the boxes; also marks them invalid. */\n error?: string | undefined\n disabled?: boolean | undefined\n}>()\n\nconst emit = defineEmits<{ complete: [code: string] }>()\n\n/** The code so far, with `v-model`. Always shorter than or as long as `length`. */\nconst model = defineModel<string>({ default: '' })\n\nconst cells = ref<HTMLInputElement[]>([])\nconst errorId = useId()\n\nconst allowed = computed(() => (type === 'numeric' ? /[0-9]/ : /[0-9a-z]/i))\nconst chars = computed(() => Array.from({ length }, (_, i) => model.value[i] ?? ''))\n\nfunction clean(text: string) {\n return Array.from(text)\n .filter((char) => allowed.value.test(char))\n .join('')\n}\n\nfunction write(next: string) {\n const code = next.slice(0, length)\n const wasComplete = model.value.length === length\n model.value = code\n if (code.length === length && !wasComplete) emit('complete', code)\n}\n\nfunction focusCell(index: number) {\n const cell = cells.value[Math.max(0, Math.min(length - 1, index))]\n cell?.focus()\n cell?.select()\n}\n\nfunction onInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement\n const typed = clean(input.value)\n\n // More than one character arrived: autofill or a paste the browser routed\n // through input. Either way it is the code, from this box on.\n if (typed.length > 1) {\n write(model.value.slice(0, index) + typed)\n focusCell(index + typed.length)\n return\n }\n\n input.value = typed\n if (!typed) return\n\n // The code has no gaps: a character typed into a box past the end lands at\n // the end, and focus follows it.\n const at = Math.min(index, model.value.length)\n write(model.value.slice(0, at) + typed + model.value.slice(at + 1))\n focusCell(at + 1)\n}\n\nfunction onPaste(event: ClipboardEvent, index: number) {\n const text = clean(event.clipboardData?.getData('text') ?? '')\n if (!text) return\n\n event.preventDefault()\n write(model.value.slice(0, index) + text)\n focusCell(index + text.length)\n}\n\nfunction onKeydown(event: KeyboardEvent, index: number) {\n if (event.key === 'Backspace') {\n event.preventDefault()\n const target = chars.value[index] ? index : index - 1\n if (target < 0) return\n write(model.value.slice(0, target) + model.value.slice(target + 1))\n focusCell(target)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusCell(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusCell(index + 1)\n }\n}\n</script>\n\n<template>\n <div class=\"rk-pin\">\n <div class=\"rk-pin-cells\" role=\"group\" :aria-label=\"label\">\n <input\n v-for=\"(char, index) in chars\"\n :key=\"index\"\n ref=\"cells\"\n class=\"rk-pin-cell control focus-ring\"\n :class=\"{ 'is-invalid': error }\"\n :value=\"char\"\n :type=\"mask ? 'password' : 'text'\"\n :inputmode=\"type === 'numeric' ? 'numeric' : 'text'\"\n :autocomplete=\"index === 0 ? 'one-time-code' : 'off'\"\n :aria-label=\"cellLabel(index + 1, length)\"\n :aria-invalid=\"Boolean(error)\"\n :aria-describedby=\"error ? errorId : undefined\"\n :disabled=\"disabled\"\n @input=\"onInput($event, index)\"\n @paste=\"onPaste($event, index)\"\n @keydown=\"onKeydown($event, index)\"\n @focus=\"($event.target as HTMLInputElement).select()\"\n />\n </div>\n <p v-if=\"error\" :id=\"errorId\" class=\"rk-pin-error\" role=\"alert\">{{ error }}</p>\n </div>\n</template>\n\n<style scoped>\n.rk-pin-cells {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-pin-cell {\n width: 2.75rem;\n height: 3.25rem;\n border-radius: var(--radius-card);\n text-align: center;\n font-size: 1.375rem;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n caret-color: var(--color-primary);\n}\n\n.rk-pin-cell.is-invalid {\n --surface-border-color: var(--color-negative);\n}\n\n.rk-pin-cell:disabled {\n opacity: 0.5;\n}\n\n.rk-pin-error {\n margin-top: 0.5rem;\n font-size: 0.8125rem;\n color: var(--color-negative);\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * Progress as a ring — for a small space, a card's corner, a goal.\n *\n * With a `value`, a promise about how far: the ring fills and, with\n * `showValue`, the percentage sits inside it. Without one, it says only\n * \"working\" and turns — the same distinction as `ProgressBar` and\n * `BaseSpinner`, in one shape. For a reader who asked for less motion the\n * turning ring breathes instead of spinning.\n *\n * The inside is a slot, so a ring can hold \"3/7\", an icon or nothing.\n */\nconst {\n value = undefined,\n max = 100,\n label,\n size = 'md',\n showValue = false,\n tone = 'primary',\n} = defineProps<{\n /** How far. Leave it out while there is nothing to measure. */\n value?: number | undefined\n max?: number | undefined\n /** The accessible name, e.g. \"Upload\". Required: a ring says nothing aloud on its own. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n /** The rounded percentage inside the ring. */\n showValue?: boolean | undefined\n tone?: 'primary' | 'accent' | 'positive' | 'warning' | 'negative' | undefined\n}>()\n\ndefineSlots<{\n /** Inside the ring, instead of the percentage. */\n default?: () => unknown\n}>()\n\nconst RADIUS = 20\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nconst indeterminate = computed(() => value === undefined)\n\n/* Clamped like ProgressBar: a negative, an overshoot and a zero `max` all\n stay inside the ring. */\nconst portion = computed(() => {\n if (value === undefined || max <= 0) return 0\n return Math.min(1, Math.max(0, value / max))\n})\n\nconst percent = computed(() => Math.round(portion.value * 100))\nconst offset = computed(() => CIRCUMFERENCE * (1 - (indeterminate.value ? 0.28 : portion.value)))\n</script>\n\n<template>\n <div\n class=\"rk-ring\"\n :class=\"[`is-${size}`, `is-${tone}`, { 'is-indeterminate': indeterminate }]\"\n role=\"progressbar\"\n :aria-label=\"label\"\n :aria-valuenow=\"indeterminate ? undefined : percent\"\n :aria-valuemin=\"indeterminate ? undefined : 0\"\n :aria-valuemax=\"indeterminate ? undefined : 100\"\n >\n <svg viewBox=\"0 0 48 48\" aria-hidden=\"true\">\n <circle class=\"rk-ring-track\" cx=\"24\" cy=\"24\" :r=\"RADIUS\" />\n <circle\n class=\"rk-ring-bar\"\n cx=\"24\"\n cy=\"24\"\n :r=\"RADIUS\"\n :stroke-dasharray=\"CIRCUMFERENCE\"\n :stroke-dashoffset=\"offset\"\n />\n </svg>\n <span v-if=\"$slots.default || (showValue && !indeterminate)\" class=\"rk-ring-inside\">\n <slot>{{ percent }}%</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n.rk-ring {\n position: relative;\n display: inline-grid;\n place-items: center;\n width: var(--rk-ring-size);\n height: var(--rk-ring-size);\n --rk-ring-size: 3rem;\n --rk-ring-colour: var(--color-primary);\n}\n\n.rk-ring.is-sm {\n --rk-ring-size: 1.75rem;\n}\n\n.rk-ring.is-lg {\n --rk-ring-size: 5rem;\n}\n\n.rk-ring.is-accent {\n --rk-ring-colour: var(--color-accent);\n}\n\n.rk-ring.is-positive {\n --rk-ring-colour: var(--color-positive);\n}\n\n.rk-ring.is-warning {\n --rk-ring-colour: var(--color-warning);\n}\n\n.rk-ring.is-negative {\n --rk-ring-colour: var(--color-negative);\n}\n\n.rk-ring svg {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n /* The ring starts at twelve o'clock, like a clock face, not at three. */\n rotate: -90deg;\n}\n\n.rk-ring-track,\n.rk-ring-bar {\n fill: none;\n stroke-width: 4;\n}\n\n.rk-ring-track {\n stroke: var(--color-muted);\n}\n\n.rk-ring-bar {\n stroke: var(--rk-ring-colour);\n stroke-linecap: round;\n transition: stroke-dashoffset var(--duration-slow) var(--ease-standard);\n}\n\n.rk-ring.is-indeterminate svg {\n animation: rk-ring-spin 0.9s linear infinite;\n}\n\n.rk-ring-inside {\n position: relative;\n font-size: calc(var(--rk-ring-size) * 0.26);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n}\n\n@keyframes rk-ring-spin {\n from {\n rotate: -90deg;\n }\n to {\n rotate: 270deg;\n }\n}\n\n@keyframes rk-ring-breathe {\n 50% {\n opacity: 0.4;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-ring.is-indeterminate svg {\n animation: rk-ring-breathe 1.6s ease-in-out infinite;\n }\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed } from 'vue'\n\n/**\n * Progress as a ring — for a small space, a card's corner, a goal.\n *\n * With a `value`, a promise about how far: the ring fills and, with\n * `showValue`, the percentage sits inside it. Without one, it says only\n * \"working\" and turns — the same distinction as `ProgressBar` and\n * `BaseSpinner`, in one shape. For a reader who asked for less motion the\n * turning ring breathes instead of spinning.\n *\n * The inside is a slot, so a ring can hold \"3/7\", an icon or nothing.\n */\nconst {\n value = undefined,\n max = 100,\n label,\n size = 'md',\n showValue = false,\n tone = 'primary',\n} = defineProps<{\n /** How far. Leave it out while there is nothing to measure. */\n value?: number | undefined\n max?: number | undefined\n /** The accessible name, e.g. \"Upload\". Required: a ring says nothing aloud on its own. */\n label: string\n size?: 'sm' | 'md' | 'lg' | undefined\n /** The rounded percentage inside the ring. */\n showValue?: boolean | undefined\n tone?: 'primary' | 'accent' | 'positive' | 'warning' | 'negative' | undefined\n}>()\n\ndefineSlots<{\n /** Inside the ring, instead of the percentage. */\n default?: () => unknown\n}>()\n\nconst RADIUS = 20\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nconst indeterminate = computed(() => value === undefined)\n\n/* Clamped like ProgressBar: a negative, an overshoot and a zero `max` all\n stay inside the ring. */\nconst portion = computed(() => {\n if (value === undefined || max <= 0) return 0\n return Math.min(1, Math.max(0, value / max))\n})\n\nconst percent = computed(() => Math.round(portion.value * 100))\nconst offset = computed(() => CIRCUMFERENCE * (1 - (indeterminate.value ? 0.28 : portion.value)))\n</script>\n\n<template>\n <div\n class=\"rk-ring\"\n :class=\"[`is-${size}`, `is-${tone}`, { 'is-indeterminate': indeterminate }]\"\n role=\"progressbar\"\n :aria-label=\"label\"\n :aria-valuenow=\"indeterminate ? undefined : percent\"\n :aria-valuemin=\"indeterminate ? undefined : 0\"\n :aria-valuemax=\"indeterminate ? undefined : 100\"\n >\n <svg viewBox=\"0 0 48 48\" aria-hidden=\"true\">\n <circle class=\"rk-ring-track\" cx=\"24\" cy=\"24\" :r=\"RADIUS\" />\n <circle\n class=\"rk-ring-bar\"\n cx=\"24\"\n cy=\"24\"\n :r=\"RADIUS\"\n :stroke-dasharray=\"CIRCUMFERENCE\"\n :stroke-dashoffset=\"offset\"\n />\n </svg>\n <span v-if=\"$slots.default || (showValue && !indeterminate)\" class=\"rk-ring-inside\">\n <slot>{{ percent }}%</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n.rk-ring {\n position: relative;\n display: inline-grid;\n place-items: center;\n width: var(--rk-ring-size);\n height: var(--rk-ring-size);\n --rk-ring-size: 3rem;\n --rk-ring-colour: var(--color-primary);\n}\n\n.rk-ring.is-sm {\n --rk-ring-size: 1.75rem;\n}\n\n.rk-ring.is-lg {\n --rk-ring-size: 5rem;\n}\n\n.rk-ring.is-accent {\n --rk-ring-colour: var(--color-accent);\n}\n\n.rk-ring.is-positive {\n --rk-ring-colour: var(--color-positive);\n}\n\n.rk-ring.is-warning {\n --rk-ring-colour: var(--color-warning);\n}\n\n.rk-ring.is-negative {\n --rk-ring-colour: var(--color-negative);\n}\n\n.rk-ring svg {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n /* The ring starts at twelve o'clock, like a clock face, not at three. */\n rotate: -90deg;\n}\n\n.rk-ring-track,\n.rk-ring-bar {\n fill: none;\n stroke-width: 4;\n}\n\n.rk-ring-track {\n stroke: var(--color-muted);\n}\n\n.rk-ring-bar {\n stroke: var(--rk-ring-colour);\n stroke-linecap: round;\n transition: stroke-dashoffset var(--duration-slow) var(--ease-standard);\n}\n\n.rk-ring.is-indeterminate svg {\n animation: rk-ring-spin 0.9s linear infinite;\n}\n\n.rk-ring-inside {\n position: relative;\n font-size: calc(var(--rk-ring-size) * 0.26);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--color-ink);\n}\n\n@keyframes rk-ring-spin {\n from {\n rotate: -90deg;\n }\n to {\n rotate: 270deg;\n }\n}\n\n@keyframes rk-ring-breathe {\n 50% {\n opacity: 0.4;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .rk-ring.is-indeterminate svg {\n animation: rk-ring-breathe 1.6s ease-in-out infinite;\n }\n}\n</style>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { Check, X } from 'lucide-vue-next'\nimport { computed } from 'vue'\n\nexport interface StepperStep<K extends string> {\n key: K\n /** Already translated. */\n label: string\n /** A line under the label: what the step asks for. */\n description?: string | undefined\n /** Marks a step that needs fixing — a form page with errors on it. */\n error?: boolean | undefined\n}\n\n/**\n * Where someone is in a process of several steps — a sign-up, a checkout, a\n * form split into pages.\n *\n * It shows the way, it does not drive it: the current step is a `v-model`,\n * and the pages and the Next and Back buttons are the app's. With\n * `interactive`, a step already done can be clicked to go back to it; steps\n * ahead never can, because skipping ahead is how a form arrives half filled.\n *\n * An ordered list, with `aria-current=\"step\"` on the step in progress, so a\n * screen reader hears \"step 2 of 4, current\" without the kit inventing a\n * sentence. The words for done and needs-fixing are the app's, passed in\n * `stateLabels`, and read only to assistive tech.\n */\nconst {\n steps,\n label,\n orientation = 'horizontal',\n interactive = false,\n stateLabels = undefined,\n} = defineProps<{\n steps: readonly StepperStep<K>[]\n /** The list's accessible name, e.g. \"Checkout\". */\n label: string\n orientation?: 'horizontal' | 'vertical' | undefined\n /** Completed steps become buttons that go back to them. */\n interactive?: boolean | undefined\n /** Read to a screen reader after a step's label: `{ complete: 'done', error: 'needs attention' }`. */\n stateLabels?: { complete: string; error: string } | undefined\n}>()\n\n/** The step in progress, by key, with `v-model`. */\nconst current = defineModel<K>({ required: true })\n\nconst currentIndex = computed(() => steps.findIndex((step) => step.key === current.value))\n\n/* Only back: a step ahead is never a way in, or a form arrives half filled. */\nconst canGoTo = (index: number) => interactive && index < currentIndex.value\n\nfunction goTo(index: number) {\n if (canGoTo(index)) current.value = steps[index]!.key\n}\n\nfunction state(index: number) {\n const step = steps[index]!\n if (step.error) return 'error'\n if (index < currentIndex.value) return 'complete'\n if (index === currentIndex.value) return 'current'\n return 'upcoming'\n}\n</script>\n\n<template>\n <nav :aria-label=\"label\">\n <ol class=\"rk-steps\" :class=\"`is-${orientation}`\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"step.key\"\n class=\"rk-step\"\n :class=\"`is-${state(index)}`\"\n :aria-current=\"index === currentIndex ? 'step' : undefined\"\n >\n <component\n :is=\"canGoTo(index) ? 'button' : 'div'\"\n :type=\"canGoTo(index) ? 'button' : undefined\"\n class=\"rk-step-body\"\n :class=\"{ 'focus-ring is-clickable': canGoTo(index) }\"\n @click=\"goTo(index)\"\n >\n <span class=\"rk-step-mark\" aria-hidden=\"true\">\n <X v-if=\"state(index) === 'error'\" class=\"size-3.5\" />\n <Check v-else-if=\"state(index) === 'complete'\" class=\"size-3.5\" />\n <template v-else>{{ index + 1 }}</template>\n </span>\n <span class=\"rk-step-text\">\n <span class=\"rk-step-label\">{{ step.label }}</span>\n <span v-if=\"step.description\" class=\"rk-step-description\">{{ step.description }}</span>\n <span\n v-if=\"stateLabels && (state(index) === 'complete' || state(index) === 'error')\"\n class=\"sr-only\"\n >\n — {{ state(index) === 'error' ? stateLabels.error : stateLabels.complete }}\n </span>\n </span>\n </component>\n </li>\n </ol>\n </nav>\n</template>\n\n<style scoped>\n.rk-steps {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-steps.is-horizontal {\n align-items: flex-start;\n}\n\n.rk-steps.is-vertical {\n flex-direction: column;\n gap: 0;\n}\n\n.rk-step {\n position: relative;\n flex: 1;\n min-width: 0;\n}\n\n/* The connecting line, drawn from each step to the next. */\n.rk-step:not(:last-child)::after {\n content: '';\n position: absolute;\n background: var(--color-hair);\n transition: background-color var(--duration-base) var(--ease-standard);\n}\n\n.is-horizontal .rk-step:not(:last-child)::after {\n top: 0.875rem;\n left: calc(1.75rem + 0.5rem);\n right: 0.5rem;\n height: 2px;\n}\n\n.is-vertical .rk-step:not(:last-child)::after {\n top: 2.125rem;\n bottom: 0.25rem;\n left: 0.8125rem;\n width: 2px;\n}\n\n.rk-step.is-complete::after {\n background: var(--color-primary);\n}\n\n.rk-step-body {\n display: flex;\n align-items: flex-start;\n gap: 0.625rem;\n width: 100%;\n border-radius: var(--radius-cell);\n text-align: left;\n}\n\n.is-horizontal .rk-step-body {\n flex-direction: column;\n}\n\n.is-vertical .rk-step-body {\n padding-bottom: 1.5rem;\n}\n\n.rk-step-body.is-clickable {\n cursor: pointer;\n}\n\n.rk-step-mark {\n position: relative;\n z-index: 1;\n display: grid;\n width: 1.75rem;\n height: 1.75rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n border: 2px solid var(--color-hair);\n background: var(--color-surface);\n font-size: 0.75rem;\n font-weight: 700;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-base) var(--ease-standard),\n border-color var(--duration-base) var(--ease-standard),\n color var(--duration-base) var(--ease-standard);\n}\n\n.is-current .rk-step-mark {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n\n.is-complete .rk-step-mark {\n border-color: var(--color-primary);\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.is-error .rk-step-mark {\n border-color: var(--color-negative);\n background: var(--color-negative);\n color: var(--color-on-negative);\n}\n\n.is-clickable:hover .rk-step-mark {\n box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-primary) 18%, transparent);\n}\n\n.rk-step-text {\n display: flex;\n min-width: 0;\n flex-direction: column;\n gap: 0.125rem;\n padding-top: 0.25rem;\n}\n\n.rk-step-label {\n font-size: 0.8125rem;\n font-weight: 600;\n color: var(--color-ink-soft);\n}\n\n.is-current .rk-step-label,\n.is-complete .rk-step-label {\n color: var(--color-ink);\n}\n\n.is-error .rk-step-label {\n color: var(--color-negative);\n}\n\n.rk-step-description {\n font-size: 0.75rem;\n line-height: 1.4;\n color: var(--color-ink-soft);\n}\n</style>\n","<script setup lang=\"ts\" generic=\"K extends string\">\nimport { Check, X } from 'lucide-vue-next'\nimport { computed } from 'vue'\n\nexport interface StepperStep<K extends string> {\n key: K\n /** Already translated. */\n label: string\n /** A line under the label: what the step asks for. */\n description?: string | undefined\n /** Marks a step that needs fixing — a form page with errors on it. */\n error?: boolean | undefined\n}\n\n/**\n * Where someone is in a process of several steps — a sign-up, a checkout, a\n * form split into pages.\n *\n * It shows the way, it does not drive it: the current step is a `v-model`,\n * and the pages and the Next and Back buttons are the app's. With\n * `interactive`, a step already done can be clicked to go back to it; steps\n * ahead never can, because skipping ahead is how a form arrives half filled.\n *\n * An ordered list, with `aria-current=\"step\"` on the step in progress, so a\n * screen reader hears \"step 2 of 4, current\" without the kit inventing a\n * sentence. The words for done and needs-fixing are the app's, passed in\n * `stateLabels`, and read only to assistive tech.\n */\nconst {\n steps,\n label,\n orientation = 'horizontal',\n interactive = false,\n stateLabels = undefined,\n} = defineProps<{\n steps: readonly StepperStep<K>[]\n /** The list's accessible name, e.g. \"Checkout\". */\n label: string\n orientation?: 'horizontal' | 'vertical' | undefined\n /** Completed steps become buttons that go back to them. */\n interactive?: boolean | undefined\n /** Read to a screen reader after a step's label: `{ complete: 'done', error: 'needs attention' }`. */\n stateLabels?: { complete: string; error: string } | undefined\n}>()\n\n/** The step in progress, by key, with `v-model`. */\nconst current = defineModel<K>({ required: true })\n\nconst currentIndex = computed(() => steps.findIndex((step) => step.key === current.value))\n\n/* Only back: a step ahead is never a way in, or a form arrives half filled. */\nconst canGoTo = (index: number) => interactive && index < currentIndex.value\n\nfunction goTo(index: number) {\n if (canGoTo(index)) current.value = steps[index]!.key\n}\n\nfunction state(index: number) {\n const step = steps[index]!\n if (step.error) return 'error'\n if (index < currentIndex.value) return 'complete'\n if (index === currentIndex.value) return 'current'\n return 'upcoming'\n}\n</script>\n\n<template>\n <nav :aria-label=\"label\">\n <ol class=\"rk-steps\" :class=\"`is-${orientation}`\">\n <li\n v-for=\"(step, index) in steps\"\n :key=\"step.key\"\n class=\"rk-step\"\n :class=\"`is-${state(index)}`\"\n :aria-current=\"index === currentIndex ? 'step' : undefined\"\n >\n <component\n :is=\"canGoTo(index) ? 'button' : 'div'\"\n :type=\"canGoTo(index) ? 'button' : undefined\"\n class=\"rk-step-body\"\n :class=\"{ 'focus-ring is-clickable': canGoTo(index) }\"\n @click=\"goTo(index)\"\n >\n <span class=\"rk-step-mark\" aria-hidden=\"true\">\n <X v-if=\"state(index) === 'error'\" class=\"size-3.5\" />\n <Check v-else-if=\"state(index) === 'complete'\" class=\"size-3.5\" />\n <template v-else>{{ index + 1 }}</template>\n </span>\n <span class=\"rk-step-text\">\n <span class=\"rk-step-label\">{{ step.label }}</span>\n <span v-if=\"step.description\" class=\"rk-step-description\">{{ step.description }}</span>\n <span\n v-if=\"stateLabels && (state(index) === 'complete' || state(index) === 'error')\"\n class=\"sr-only\"\n >\n — {{ state(index) === 'error' ? stateLabels.error : stateLabels.complete }}\n </span>\n </span>\n </component>\n </li>\n </ol>\n </nav>\n</template>\n\n<style scoped>\n.rk-steps {\n display: flex;\n gap: 0.5rem;\n}\n\n.rk-steps.is-horizontal {\n align-items: flex-start;\n}\n\n.rk-steps.is-vertical {\n flex-direction: column;\n gap: 0;\n}\n\n.rk-step {\n position: relative;\n flex: 1;\n min-width: 0;\n}\n\n/* The connecting line, drawn from each step to the next. */\n.rk-step:not(:last-child)::after {\n content: '';\n position: absolute;\n background: var(--color-hair);\n transition: background-color var(--duration-base) var(--ease-standard);\n}\n\n.is-horizontal .rk-step:not(:last-child)::after {\n top: 0.875rem;\n left: calc(1.75rem + 0.5rem);\n right: 0.5rem;\n height: 2px;\n}\n\n.is-vertical .rk-step:not(:last-child)::after {\n top: 2.125rem;\n bottom: 0.25rem;\n left: 0.8125rem;\n width: 2px;\n}\n\n.rk-step.is-complete::after {\n background: var(--color-primary);\n}\n\n.rk-step-body {\n display: flex;\n align-items: flex-start;\n gap: 0.625rem;\n width: 100%;\n border-radius: var(--radius-cell);\n text-align: left;\n}\n\n.is-horizontal .rk-step-body {\n flex-direction: column;\n}\n\n.is-vertical .rk-step-body {\n padding-bottom: 1.5rem;\n}\n\n.rk-step-body.is-clickable {\n cursor: pointer;\n}\n\n.rk-step-mark {\n position: relative;\n z-index: 1;\n display: grid;\n width: 1.75rem;\n height: 1.75rem;\n flex-shrink: 0;\n place-items: center;\n border-radius: 9999px;\n border: 2px solid var(--color-hair);\n background: var(--color-surface);\n font-size: 0.75rem;\n font-weight: 700;\n color: var(--color-ink-soft);\n transition:\n background-color var(--duration-base) var(--ease-standard),\n border-color var(--duration-base) var(--ease-standard),\n color var(--duration-base) var(--ease-standard);\n}\n\n.is-current .rk-step-mark {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n\n.is-complete .rk-step-mark {\n border-color: var(--color-primary);\n background: var(--color-primary);\n color: var(--color-on-primary);\n}\n\n.is-error .rk-step-mark {\n border-color: var(--color-negative);\n background: var(--color-negative);\n color: var(--color-on-negative);\n}\n\n.is-clickable:hover .rk-step-mark {\n box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-primary) 18%, transparent);\n}\n\n.rk-step-text {\n display: flex;\n min-width: 0;\n flex-direction: column;\n gap: 0.125rem;\n padding-top: 0.25rem;\n}\n\n.rk-step-label {\n font-size: 0.8125rem;\n font-weight: 600;\n color: var(--color-ink-soft);\n}\n\n.is-current .rk-step-label,\n.is-complete .rk-step-label {\n color: var(--color-ink);\n}\n\n.is-error .rk-step-label {\n color: var(--color-negative);\n}\n\n.rk-step-description {\n font-size: 0.75rem;\n line-height: 1.4;\n color: var(--color-ink-soft);\n}\n</style>\n","import { computed, ref, watchEffect } from 'vue'\nimport { createI18n } from 'vue-i18n'\n\nimport { setFormatLocale } from '../utils/format'\n\n/** What the user picked. `system` re-reads the browser on every launch. */\nexport type LocalePreference<L extends string> = 'system' | L\n\nexport interface I18nRuntimeOptions<L extends string, Schema> {\n /** Languages the app ships, in no particular order. */\n locales: readonly L[]\n /** The one that is always loaded, and the fallback when a load fails. */\n fallback: L\n /**\n * BCP 47 tag per locale, for `Intl`.\n *\n * Message lookup only needs the base language, but dates and numbers need a\n * region to be right — `zh` alone would leave the formatter to guess.\n */\n intlTags: Record<L, string>\n /** The fallback's messages, bundled. */\n messages: Schema\n /** The rest, fetched only when they are the one in use. */\n loaders?: Partial<Record<L, () => Promise<{ default: Schema }>>>\n /** Where the choice is stored. Namespace it per app. */\n storageKey?: string\n}\n\n/**\n * Builds an i18n runtime around an app's own catalogue.\n *\n * A factory rather than a module singleton because the schema is the app's:\n * typing every locale as `typeof en` is what makes a missing key a build error,\n * and this package has no `en` of its own to type against.\n *\n * @example\n * ```ts\n * export const { i18n, t, useLocalePreference, loadActiveLocale } =\n * createI18nRuntime({\n * locales: ['en', 'tr'] as const,\n * fallback: 'en',\n * intlTags: { en: 'en-GB', tr: 'tr-TR' },\n * messages: en,\n * loaders: { tr: () => import('./locales/tr') },\n * storageKey: 'myapp-locale',\n * })\n * ```\n */\nexport function createI18nRuntime<L extends string, Schema extends Record<string, unknown>>(\n options: I18nRuntimeOptions<L, Schema>,\n) {\n const { locales, fallback, intlTags, messages, storageKey = 'rei-locale' } = options\n\n // Typed rather than defaulted to `{}`, which erases the locale keys and makes\n // `loaders[locale]` an index into an empty object.\n const loaders: Partial<Record<L, () => Promise<{ default: Schema }>>> = options.loaders ?? {}\n\n function isSupported(value: string): value is L {\n return (locales as readonly string[]).includes(value)\n }\n\n /**\n * First browser language the app can actually speak.\n *\n * `navigator.languages` is ordered by the user's own preference, so the first\n * match is the best one — not simply the first entry.\n */\n function detectSystemLocale(): L {\n // No browser to ask. The fallback is the right answer on a server: it is\n // the locale whose messages are bundled, so it is the only one that could\n // render without a load.\n //\n // The test is `document`, not `navigator`. Node has shipped a global\n // `navigator` since v21, so `typeof navigator === 'undefined'` is false on\n // a server and this would read the *build machine's* language and bake it\n // into every prerendered page. `document` is the only one of the two that\n // still means \"a browser\".\n if (typeof document === 'undefined') return fallback\n\n for (const tag of navigator.languages ?? [navigator.language]) {\n const base = tag.split('-')[0]?.toLowerCase()\n if (base && isSupported(base)) return base\n }\n\n return fallback\n }\n\n function readStored(): LocalePreference<L> {\n try {\n const stored = localStorage.getItem(storageKey)\n if (stored === 'system' || (stored && isSupported(stored))) return stored\n } catch {\n // Storage blocked; fall through to the system language.\n }\n\n return 'system'\n }\n\n const preference = ref<LocalePreference<L>>(readStored())\n\n const activeLocale = computed<L>(() =>\n preference.value === 'system' ? detectSystemLocale() : (preference.value as L),\n )\n\n const intlLocale = computed(() => intlTags[activeLocale.value])\n\n // Only the fallback at construction; the rest arrive through\n // setLocaleMessage.\n const initial = { [fallback]: messages } as Record<string, Record<string, unknown>>\n\n const i18n = createI18n({\n legacy: false,\n locale: activeLocale.value as string,\n fallbackLocale: fallback as string,\n messages: initial,\n } as unknown as Parameters<typeof createI18n>[0])\n\n /**\n * A narrow view of the instance.\n *\n * vue-i18n infers its own generics from the messages it is handed, which\n * fights a runtime that is generic over the app's schema. Casting once, here,\n * keeps that fight out of every call site — and the surface below is the\n * whole of what this runtime uses.\n */\n const core = i18n.global as unknown as {\n locale: { value: string }\n setLocaleMessage: (locale: string, messages: Schema) => void\n t: (key: string, named?: Record<string, unknown>) => string\n }\n\n const loaded = new Set<L>([fallback])\n\n /**\n * Makes sure a locale's messages are in place before it becomes active.\n *\n * Awaited rather than fired and forgotten: setting the locale first paints one\n * frame of the fallback at every other user, which is the flash a fallback\n * exists to prevent, not cause.\n */\n async function ensureMessages(locale: L): Promise<void> {\n if (loaded.has(locale)) return\n\n const load = loaders[locale]\n if (!load) return\n\n try {\n const module = await load()\n core.setLocaleMessage(locale, module.default)\n loaded.add(locale)\n } catch {\n // Offline, or a stale chunk after a deploy. The fallback is loaded and\n // will carry the UI, which beats a blank screen.\n }\n }\n\n /** Loads whatever the stored preference resolves to. Call before mounting. */\n function loadActiveLocale(): Promise<void> {\n return ensureMessages(activeLocale.value)\n }\n\n // Keeps vue-i18n, `Intl` and the document in step. `lang` matters beyond\n // tidiness: it drives hyphenation, font fallback and screen readers.\n watchEffect(() => {\n core.locale.value = activeLocale.value\n setFormatLocale(intlLocale.value)\n\n if (typeof document !== 'undefined') {\n document.documentElement.lang = activeLocale.value\n }\n })\n\n /** Read and write the language preference. */\n function useLocalePreference() {\n return computed<LocalePreference<L>>({\n get: () => preference.value,\n set: (next) => {\n const resolved = next === 'system' ? detectSystemLocale() : (next as L)\n\n // Messages first, then the switch — the other order shows the fallback\n // for a frame on the way to the language the user just picked.\n void ensureMessages(resolved).then(() => {\n preference.value = next\n })\n\n try {\n localStorage.setItem(storageKey, next)\n } catch {\n // Storage blocked; the choice lasts for this session only.\n }\n },\n })\n }\n\n return {\n i18n,\n /** `t` for code outside a component. Tracks the locale inside a computed. */\n t: core.t,\n activeLocale,\n intlLocale,\n ensureMessages,\n loadActiveLocale,\n useLocalePreference,\n }\n}\n","/**\n * rei-kit — the layer every app starts from.\n *\n * Everything here is free of any backend, router or i18n choice. Components\n * take strings rather than calling a translator, and utilities take the clock\n * rather than reading it, so nothing in this package can force a decision on\n * the app that installs it.\n *\n * @see https://github.com/ramazandogna/rei-kit\n */\n\n/**\n * The published version, replaced at build time from `package.json`.\n *\n * It was a literal `'0.0.0'` and nothing ever rewrote it, so every consumer\n * that imported this — and the showcase, which is how it was noticed — was\n * told the kit was at 0.0.0 whatever it actually was. A symbol in a public API\n * that reports something false is worse than one that is missing: nobody\n * checks a value that looks like it works.\n *\n * The fallback keeps `vitest` and `vite dev` honest, where no define runs.\n */\nexport const VERSION: string =\n typeof __REI_KIT_VERSION__ === 'string' ? __REI_KIT_VERSION__ : '0.0.0-dev'\n\n// ── Utilities ──────────────────────────────────────────────────────────────\nexport {\n addDays,\n eachDayOfYear,\n fromDateKey,\n lastNDays,\n leadingBlanks,\n startOfWeek,\n toDateKey,\n todayKey,\n} from './utils/date'\nexport type { WeekStart } from './utils/date'\n\nexport { formatDate, formatNumber, setFormatLocale } from './utils/format'\nexport { relativeDayLabel } from './utils/day-label'\nexport type { DayLabels } from './utils/day-label'\n\nexport { downloadJson } from './utils/download'\nexport {\n MATERIALS,\n PALETTES,\n applyMaterial,\n applyPalette,\n isMaterial,\n isPaletteName,\n setMaterialStorageKey,\n setPaletteStorageKey,\n useMaterial,\n usePalette,\n} from './utils/appearance'\nexport type { Material, Palette, PaletteName, PaletteRoles } from './utils/appearance'\nexport { ensureSheetRoot, SHEET_ROOT_ID } from './utils/sheet-root'\nexport { safeRedirect, toRedirectPath } from './utils/redirect'\nexport type { QueryValue } from './utils/redirect'\nexport { tapFeedback } from './utils/haptics'\nexport { isApplePortable, isInstalled, needsIosInstall } from './utils/platform'\n\nexport { AppError, registerErrorMapper, toAppError } from './utils/app-error'\nexport type { AppErrorKind, ErrorMapper } from './utils/app-error'\n\n// ── Composables ────────────────────────────────────────────────────────────\nexport {\n applyTheme,\n isThemePreference,\n readStoredTheme,\n setThemeStorageKey,\n useTheme,\n} from './composables/use-theme'\nexport type { ThemePreference } from './composables/use-theme'\n\nexport { useToday } from './composables/use-today'\nexport { useOnline } from './composables/use-online'\nexport { useDebouncedCallback } from './composables/use-debounced-callback'\nexport { useDragScroll } from './composables/use-drag-scroll'\nexport { useMediaQuery } from './composables/use-media-query'\nexport { useVisualViewport } from './composables/use-visual-viewport'\nexport { useToast } from './composables/use-toast'\nexport type { Toast, ToastAction, ToastOptions, ToastTone } from './composables/use-toast'\nexport type { VisualViewportRect } from './composables/use-visual-viewport'\n\n// ── Components ─────────────────────────────────────────────────────────────\nexport { default as BaseAvatar } from './components/BaseAvatar.vue'\nexport { default as BaseAlert } from './components/BaseAlert.vue'\nexport { default as BaseBadge } from './components/BaseBadge.vue'\nexport { default as BaseButton } from './components/BaseButton.vue'\nexport { default as BaseInput } from './components/BaseInput.vue'\nexport { default as BaseMenu } from './components/BaseMenu.vue'\nexport { default as BaseSheet } from './components/BaseSheet.vue'\nexport { default as BaseCard } from './components/BaseCard.vue'\nexport { default as BaseCombobox } from './components/BaseCombobox.vue'\nexport type { ComboboxOption } from './components/BaseCombobox.vue'\nexport { default as BaseCheckbox } from './components/BaseCheckbox.vue'\nexport { default as BaseRadioGroup } from './components/BaseRadioGroup.vue'\nexport { default as BaseSelect } from './components/BaseSelect.vue'\nexport { default as BaseSlider } from './components/BaseSlider.vue'\nexport { default as BaseSpinner } from './components/BaseSpinner.vue'\nexport { default as BaseSwitch } from './components/BaseSwitch.vue'\nexport { default as BaseTable } from './components/BaseTable.vue'\nexport type { Column } from './components/BaseTable.vue'\nexport { default as BaseTextarea } from './components/BaseTextarea.vue'\nexport { default as EmptyState } from './components/EmptyState.vue'\nexport { default as FormField } from './components/FormField.vue'\nexport { default as ErrorBoundary } from './components/ErrorBoundary.vue'\nexport { default as PageContainer } from './components/PageContainer.vue'\nexport { default as PageHeader } from './components/PageHeader.vue'\nexport { default as ProgressBar } from './components/ProgressBar.vue'\nexport { default as PriceCard } from './components/PriceCard.vue'\nexport { default as SectionHeading } from './components/SectionHeading.vue'\nexport { default as SegmentedControl } from './components/SegmentedControl.vue'\nexport { default as SettingsGroup } from './components/SettingsGroup.vue'\nexport { default as SettingsRow } from './components/SettingsRow.vue'\nexport { default as SkeletonList } from './components/SkeletonList.vue'\nexport { default as StatCard } from './components/StatCard.vue'\nexport { default as ToastHost } from './components/ToastHost.vue'\nexport { default as ToneDot } from './components/ToneDot.vue'\nexport type { Tone } from './components/SectionHeading.vue'\nexport { default as LocaleLinks } from './components/LocaleLinks.vue'\nexport { default as GoogleButton } from './components/GoogleButton.vue'\nexport { default as TabBar } from './components/TabBar.vue'\nexport type { TabItem } from './components/TabBar.vue'\nexport { default as AvatarStack } from './components/AvatarStack.vue'\nexport { default as BaseCalendar } from './components/BaseCalendar.vue'\nexport { default as BaseChip } from './components/BaseChip.vue'\nexport { default as BaseKbd } from './components/BaseKbd.vue'\nexport { default as BaseLink } from './components/BaseLink.vue'\nexport { default as BaseRating } from './components/BaseRating.vue'\nexport { default as BaseSeparator } from './components/BaseSeparator.vue'\nexport { default as BaseSkeleton } from './components/BaseSkeleton.vue'\nexport { default as CopyButton } from './components/CopyButton.vue'\nexport { default as FileDrop } from './components/FileDrop.vue'\nexport { default as TagsInput } from './components/TagsInput.vue'\nexport type { DateRange } from './components/BaseCalendar.vue'\nexport { default as BaseDatePicker } from './components/BaseDatePicker.vue'\nexport type { DatePreset } from './components/BaseDatePicker.vue'\nexport { default as BasePopover } from './components/BasePopover.vue'\nexport type { PopoverTriggerProps } from './components/BasePopover.vue'\nexport { default as ToggleGroup } from './components/ToggleGroup.vue'\nexport { default as NumberInput } from './components/NumberInput.vue'\nexport { default as PinInput } from './components/PinInput.vue'\nexport { default as CircularProgress } from './components/CircularProgress.vue'\nexport { default as BaseStepper } from './components/BaseStepper.vue'\nexport type { StepperStep } from './components/BaseStepper.vue'\n\n// ── i18n ───────────────────────────────────────────────────────────────────\nexport { createI18nRuntime } from './i18n/runtime'\nexport type { I18nRuntimeOptions, LocalePreference } from './i18n/runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,iBAAiB,SAAiB,OAAe,QAA2B;CAC1F,IAAI,YAAY,OAAO,OAAO,OAAO;CACrC,IAAI,YAAY,QAAQ,OAAO,EAAE,GAAG,OAAO,OAAO;CAElD,OAAO,WAAW,YAAY,OAAO,GAAG,EAAE,SAAS,QAAQ,CAAC;AAC9D;;;;;;;;;AC7BA,SAAgB,aAAa,MAAe,UAAwB;CAClE,MAAM,OAAO,IAAI,KAAK,CAAC,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,mBAAmB,CAAC;CACnF,MAAM,MAAM,IAAI,gBAAgB,IAAI;CACpC,MAAM,OAAO,SAAS,cAAc,GAAG;CAEvC,KAAK,OAAO;CACZ,KAAK,WAAW;CAChB,KAAK,MAAM;CAEX,IAAI,gBAAgB,GAAG;AACzB;;;;;;AEHA,IAAa,YAAY;CAAC;CAAS;CAAS;CAAU;AAAM;AAG5D,SAAgB,WAAW,OAAmC;CAC5D,OAAO,OAAO,UAAU,YAAa,UAAgC,SAAS,KAAK;AACrF;;;;;;;;;;AAWA,SAAgB,cAAc,UAAoB,MAA0B;CAC1E,MAAM,KAAK,SAAS,OAAO,aAAa,cAAc,KAAA,IAAY,SAAS;CAC3E,IAAI,CAAC,IAAI;CAET,IAAI,aAAa,SAAS,OAAO,GAAG,QAAQ;MACvC,GAAG,QAAQ,cAAc;AAChC;AA2CA,IAAa,WAAW;AAIxB,SAAgB,cAAc,OAAsC;CAClE,OAAO,OAAO,UAAU,YAAY,SAAS,MAAM,MAAM,EAAE,SAAS,KAAK;AAC3E;;;;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