@thekestongroup/ui 0.14.0 → 0.16.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.
Files changed (124) hide show
  1. package/dist/components/ActionList/ActionList.vue.d.ts +63 -0
  2. package/dist/components/Alert/Alert.vue.d.ts +55 -0
  3. package/dist/components/AvatarGroup/AvatarGroup.vue.d.ts +1 -1
  4. package/dist/components/BarChart/BarChart.vue.d.ts +37 -0
  5. package/dist/components/BarChart/ChartData.vue.d.ts +20 -0
  6. package/dist/components/Button/Button.vue.d.ts +1 -1
  7. package/dist/components/Collapsible/Collapsible.vue.d.ts +48 -0
  8. package/dist/components/FileUpload/FileUpload.vue.d.ts +55 -0
  9. package/dist/components/Footer/Footer.vue.d.ts +11 -1
  10. package/dist/components/Header/Header.vue.d.ts +1 -1
  11. package/dist/components/LineChart/LineChart.vue.d.ts +37 -0
  12. package/dist/components/Notification/Notification.vue.d.ts +2 -2
  13. package/dist/components/Popover/popover.d.ts +3 -2
  14. package/dist/components/Progress/Progress.vue.d.ts +14 -1
  15. package/dist/components/Slideover/Slideover.vue.d.ts +7 -5
  16. package/dist/components/Spinner/Spinner.vue.d.ts +2 -2
  17. package/dist/components/ThemeSwitcher/ThemeSwitcher.vue.d.ts +18 -0
  18. package/dist/i18n/en.d.ts +27 -0
  19. package/dist/index.d.ts +17 -0
  20. package/dist/keston-ui.js +4369 -3509
  21. package/dist/lib/chart.d.ts +32 -0
  22. package/dist/lib/theme.d.ts +23 -0
  23. package/package.json +8 -3
  24. package/src/components/ActionList/ActionList.stories.ts +59 -0
  25. package/src/components/ActionList/ActionList.vue +116 -0
  26. package/src/components/Alert/Alert.stories.ts +65 -0
  27. package/src/components/Alert/Alert.vue +110 -0
  28. package/src/components/AppLauncher/AppLauncher.vue +3 -3
  29. package/src/components/AppShell/AppShell.stories.ts +2 -2
  30. package/src/components/AppShell/AppShell.vue +2 -2
  31. package/src/components/Avatar/Avatar.vue +3 -3
  32. package/src/components/AvatarGroup/AvatarGroup.vue +4 -4
  33. package/src/components/Badge/Badge.vue +2 -2
  34. package/src/components/BarChart/BarChart.stories.ts +62 -0
  35. package/src/components/BarChart/BarChart.vue +153 -0
  36. package/src/components/BarChart/ChartData.vue +64 -0
  37. package/src/components/Breadcrumb/Breadcrumb.vue +5 -5
  38. package/src/components/Button/Button.stories.ts +1 -1
  39. package/src/components/Button/Button.vue +12 -9
  40. package/src/components/Calendar/Calendar.stories.ts +2 -2
  41. package/src/components/Calendar/Calendar.vue +11 -10
  42. package/src/components/Card/Card.stories.ts +5 -5
  43. package/src/components/Card/Card.vue +3 -3
  44. package/src/components/CardSelect/CardSelect.vue +10 -7
  45. package/src/components/ChangeIndicator/ChangeIndicator.vue +2 -2
  46. package/src/components/Checkbox/Checkbox.vue +5 -5
  47. package/src/components/CheckboxGroup/CheckboxGroup.stories.ts +1 -1
  48. package/src/components/CheckboxGroup/CheckboxGroup.vue +2 -2
  49. package/src/components/Checklist/Checklist.vue +3 -3
  50. package/src/components/Chip/Chip.stories.ts +1 -1
  51. package/src/components/Chip/Chip.vue +2 -2
  52. package/src/components/Collapsible/Collapsible.stories.ts +32 -0
  53. package/src/components/Collapsible/Collapsible.vue +68 -0
  54. package/src/components/Divider/Divider.vue +4 -4
  55. package/src/components/EmptyState/EmptyState.vue +3 -3
  56. package/src/components/FileUpload/FileUpload.stories.ts +38 -0
  57. package/src/components/FileUpload/FileUpload.vue +150 -0
  58. package/src/components/Footer/Footer.stories.ts +10 -2
  59. package/src/components/Footer/Footer.vue +26 -8
  60. package/src/components/FormField/FieldMessage.vue +3 -3
  61. package/src/components/FormField/FormField.stories.ts +1 -1
  62. package/src/components/FormField/FormField.vue +8 -3
  63. package/src/components/Header/Header.stories.ts +28 -8
  64. package/src/components/Header/Header.vue +6 -6
  65. package/src/components/InfoTip/InfoTip.stories.ts +1 -1
  66. package/src/components/InfoTip/InfoTip.vue +1 -1
  67. package/src/components/Input/Input.vue +1 -1
  68. package/src/components/InputCode/InputCode.stories.ts +1 -1
  69. package/src/components/InputCode/InputCode.vue +4 -4
  70. package/src/components/InputDate/InputDate.stories.ts +1 -1
  71. package/src/components/InputDate/InputDate.vue +5 -5
  72. package/src/components/InputNumber/InputNumber.stories.ts +1 -1
  73. package/src/components/InputNumber/InputNumber.vue +6 -6
  74. package/src/components/InputPassword/InputPassword.vue +4 -4
  75. package/src/components/InputRichText/InputRichText.stories.ts +1 -1
  76. package/src/components/InputRichText/InputRichText.vue +3 -3
  77. package/src/components/InputTextArea/InputTextArea.vue +1 -1
  78. package/src/components/LineChart/LineChart.stories.ts +47 -0
  79. package/src/components/LineChart/LineChart.vue +173 -0
  80. package/src/components/Link/Link.stories.ts +4 -4
  81. package/src/components/Link/Link.vue +1 -1
  82. package/src/components/Menu/Menu.vue +6 -5
  83. package/src/components/Notification/Notification.stories.ts +3 -3
  84. package/src/components/Notification/Notification.vue +9 -9
  85. package/src/components/Notification/NotificationPane.vue +3 -3
  86. package/src/components/Notification/Toaster.vue +1 -1
  87. package/src/components/PageHeader/PageHeader.vue +2 -2
  88. package/src/components/Popover/Popover.stories.ts +2 -2
  89. package/src/components/Popover/popover.ts +4 -3
  90. package/src/components/Progress/Progress.stories.ts +18 -0
  91. package/src/components/Progress/Progress.vue +58 -1
  92. package/src/components/RadioGroup/RadioGroup.vue +7 -7
  93. package/src/components/RelativeTime/RelativeTime.stories.ts +1 -1
  94. package/src/components/Select/Select.stories.ts +1 -1
  95. package/src/components/Select/Select.vue +26 -20
  96. package/src/components/SettingsRow/SettingsRow.vue +1 -1
  97. package/src/components/Sidebar/Sidebar.stories.ts +2 -2
  98. package/src/components/Sidebar/Sidebar.vue +9 -9
  99. package/src/components/Slideover/Slideover.stories.ts +5 -5
  100. package/src/components/Slideover/Slideover.vue +111 -35
  101. package/src/components/Spinner/Spinner.stories.ts +7 -7
  102. package/src/components/Spinner/Spinner.vue +1 -1
  103. package/src/components/StatTile/StatTile.stories.ts +2 -2
  104. package/src/components/StatTile/StatTile.vue +6 -6
  105. package/src/components/Steps/Steps.vue +2 -2
  106. package/src/components/SummaryList/SummaryList.vue +8 -8
  107. package/src/components/Switch/Switch.vue +3 -3
  108. package/src/components/Table/Table.vue +12 -12
  109. package/src/components/Tabs/Tabs.vue +4 -4
  110. package/src/components/ThemeSwitcher/ThemeSwitcher.stories.ts +22 -0
  111. package/src/components/ThemeSwitcher/ThemeSwitcher.vue +48 -0
  112. package/src/components/Tooltip/Tooltip.stories.ts +1 -1
  113. package/src/components/Tooltip/Tooltip.vue +1 -1
  114. package/src/components/UnsavedChangesBar/UnsavedChangesBar.stories.ts +1 -1
  115. package/src/components/UnsavedChangesBar/UnsavedChangesBar.vue +1 -1
  116. package/src/examples/AppPages.stories.ts +3 -3
  117. package/src/examples/FormLayout.stories.ts +3 -3
  118. package/src/examples/KestonIdPages.stories.ts +18 -18
  119. package/src/examples/SchoolPages.stories.ts +5 -5
  120. package/src/i18n/en.ts +16 -4
  121. package/src/index.ts +17 -0
  122. package/src/lib/chart.ts +47 -0
  123. package/src/lib/theme.ts +75 -0
  124. package/src/styles/theme.css +117 -5
@@ -0,0 +1,153 @@
1
+ <script setup lang="ts">
2
+ import { computed, type HTMLAttributes } from 'vue'
3
+ import { useI18n } from 'vue-i18n'
4
+ import { cn } from '../../lib/cn'
5
+ import { niceScale, seriesColor, valueOf, type ChartPoint, type ChartSeries } from '../../lib/chart'
6
+ import ChartData from './ChartData.vue'
7
+
8
+ /**
9
+ * Amounts compared across a few categories or days, as columns: sign-ins per
10
+ * day, applications per year group. One series, or several stacked (the
11
+ * parts of a whole, e.g. succeeded and failed) or side by side.
12
+ *
13
+ * Every chart carries its numbers as a table: always there for screen
14
+ * readers, and shown to anyone with "Show as table". Hovering a column shows
15
+ * its values. Put it in a Card whose title says what it shows.
16
+ *
17
+ * Colours come from the chart palette (chart-1 to chart-8), in order unless a
18
+ * series sets its own `color`.
19
+ */
20
+ export interface BarChartProps {
21
+ /** What the chart shows, e.g. "Sign-ins this week". The table's caption; not shown (the Card's title says it). */
22
+ label: string
23
+ /** One point per column, in order. */
24
+ data: ChartPoint[]
25
+ /** The numbers in each point. One series needs no legend; two or more get one. */
26
+ series: ChartSeries[]
27
+ /** With several series: stack them in one column (default), or put them side by side. */
28
+ stacked?: boolean
29
+ /** Heading of the table's first column, e.g. "Date". Default "Category". */
30
+ categoryLabel?: string
31
+ /** Height of the plot in px. */
32
+ height?: number
33
+ /** How values are written on the axis, in tooltips and the table. Default: whole numbers in the app's language. */
34
+ format?: (value: number) => string
35
+ class?: HTMLAttributes['class']
36
+ }
37
+
38
+ const { t, locale } = useI18n()
39
+ const props = withDefaults(defineProps<BarChartProps>(), {
40
+ stacked: true,
41
+ height: 160
42
+ })
43
+
44
+ const numberFormat = computed(() => new Intl.NumberFormat(locale.value))
45
+ const fmt = (value: number) => (props.format ? props.format(value) : numberFormat.value.format(value))
46
+
47
+ // The tallest column decides the axis: the stack's total, or the biggest bar.
48
+ const largest = computed(() =>
49
+ Math.max(
50
+ 0,
51
+ ...props.data.map((point) =>
52
+ props.stacked
53
+ ? props.series.reduce((sum, s) => sum + valueOf(point, s.key), 0)
54
+ : Math.max(0, ...props.series.map((s) => valueOf(point, s.key)))
55
+ )
56
+ )
57
+ )
58
+ const scale = computed(() => niceScale(largest.value))
59
+ const percent = (value: number) => (value / scale.value.max) * 100
60
+
61
+ // Each column's bars (or stacked parts), bottom first, leaving out zeros.
62
+ const columns = computed(() =>
63
+ props.data.map((point) => ({
64
+ point,
65
+ parts: props.series
66
+ .map((s, i) => ({ series: s, value: valueOf(point, s.key), color: seriesColor(s, i) }))
67
+ .filter((part) => part.value > 0)
68
+ }))
69
+ )
70
+
71
+ const total = (parts: { value: number }[]) => parts.reduce((sum, p) => sum + p.value, 0)
72
+ </script>
73
+
74
+ <template>
75
+ <div :class="cn('flex flex-col gap-3', props.class)">
76
+ <!-- The plot, hidden from screen readers: ChartData's table has the same numbers. -->
77
+ <div class="flex gap-2" aria-hidden="true">
78
+ <!-- Value axis: clean ticks, right-aligned, level with their gridlines. -->
79
+ <div class="relative w-8 shrink-0 text-right text-xs text-ink/65 tabular-nums" :style="{ height: `${height}px` }">
80
+ <span
81
+ v-for="tick in scale.ticks"
82
+ :key="tick"
83
+ class="absolute right-0 translate-y-1/2 leading-none"
84
+ :style="{ bottom: `${percent(tick)}%` }"
85
+ >{{ fmt(tick) }}</span>
86
+ </div>
87
+
88
+ <div class="flex min-w-0 flex-1 flex-col gap-1.5">
89
+ <div class="relative" :style="{ height: `${height}px` }">
90
+ <!-- Gridlines: hairlines, recessive. -->
91
+ <div
92
+ v-for="tick in scale.ticks"
93
+ :key="tick"
94
+ class="absolute inset-x-0 h-px bg-ink/10"
95
+ :style="{ bottom: `${percent(tick)}%` }"
96
+ />
97
+ <div class="absolute inset-0 flex">
98
+ <!-- A column: the whole slot is the hover target; the bars sit in its middle. -->
99
+ <div
100
+ v-for="(column, c) in columns"
101
+ :key="c"
102
+ class="group/column relative isolate hover:z-20 flex h-full min-w-0 flex-1 items-end justify-center px-0.5"
103
+ >
104
+ <!-- Stacked: one bar, parts 2px apart (the surface showing through). -->
105
+ <div v-if="stacked" class="flex w-full max-w-6 flex-col-reverse gap-0.5" :style="{ height: `${percent(total(column.parts))}%` }">
106
+ <div
107
+ v-for="(part, p) in column.parts"
108
+ :key="part.series.key"
109
+ :class="cn('w-full min-h-px', p === column.parts.length - 1 && 'rounded-t-sm')"
110
+ :style="{ flexGrow: part.value, flexBasis: 0, background: part.color }"
111
+ />
112
+ </div>
113
+ <!-- Side by side: a bar each, 2px apart. -->
114
+ <div v-else class="flex h-full w-full items-end justify-center gap-0.5">
115
+ <div
116
+ v-for="part in column.parts"
117
+ :key="part.series.key"
118
+ class="w-full max-w-6 rounded-t-sm"
119
+ :style="{ height: `${percent(part.value)}%`, background: part.color }"
120
+ />
121
+ </div>
122
+
123
+ <!-- Tooltip on hover: the full label and every series' value. -->
124
+ <div
125
+ class="pointer-events-none absolute bottom-full left-1/2 z-10 mb-1 hidden w-max max-w-56 -translate-x-1/2 flex-col gap-1 rounded-md border border-ink/10 bg-surface-elevated px-2.5 py-1.5 text-xs text-ink shadow-md group-hover/column:flex"
126
+ >
127
+ <span class="font-bold">{{ column.point.fullLabel ?? column.point.label }}</span>
128
+ <span v-for="(s, i) in series" :key="s.key" class="flex items-center gap-1.5">
129
+ <span class="size-2 rounded-sm" :style="{ background: seriesColor(s, i) }" />
130
+ {{ s.label }}<span class="ml-auto pl-3 tabular-nums">{{ fmt(valueOf(column.point, s.key)) }}</span>
131
+ </span>
132
+ </div>
133
+ <!-- Hover highlight behind the bars. -->
134
+ <div class="absolute inset-0 -z-10 rounded-sm group-hover/column:bg-hover" />
135
+ </div>
136
+ </div>
137
+ </div>
138
+ <!-- Category labels under their columns. -->
139
+ <div class="flex text-xs text-ink/65">
140
+ <span v-for="(column, c) in columns" :key="c" class="min-w-0 flex-1 truncate px-0.5 text-center">{{ column.point.label }}</span>
141
+ </div>
142
+ </div>
143
+ </div>
144
+
145
+ <ChartData
146
+ :label="label"
147
+ :category-label="categoryLabel ?? t('ui.chart.category')"
148
+ :series="series"
149
+ :data="data"
150
+ :format="fmt"
151
+ />
152
+ </div>
153
+ </template>
@@ -0,0 +1,64 @@
1
+ <script setup lang="ts">
2
+ import { ref } from 'vue'
3
+ import { useI18n } from 'vue-i18n'
4
+ import { seriesColor, valueOf, type ChartPoint, type ChartSeries } from '../../lib/chart'
5
+
6
+ /**
7
+ * The parts every Keston chart shares, under the plot: the legend (for two
8
+ * or more series), a button to see the numbers as a table, and the table.
9
+ * The table is always there for screen readers; the button shows it to
10
+ * everyone (keyboard users can't hover for tooltips). Internal: used by
11
+ * BarChart and LineChart.
12
+ */
13
+ const props = defineProps<{
14
+ /** The chart's name: the table's caption. */
15
+ label: string
16
+ /** Heading of the table's first column, e.g. "Date". */
17
+ categoryLabel: string
18
+ series: ChartSeries[]
19
+ data: ChartPoint[]
20
+ format: (value: number) => string
21
+ }>()
22
+
23
+ const { t } = useI18n()
24
+ const showTable = ref(false)
25
+ </script>
26
+
27
+ <template>
28
+ <div class="flex flex-col gap-2">
29
+ <div class="flex flex-wrap items-center gap-x-4 gap-y-1">
30
+ <!-- The legend: hidden from screen readers, which get the table's headings. -->
31
+ <ul v-if="series.length > 1" class="flex flex-wrap gap-x-4 gap-y-1 text-xs text-ink/65" aria-hidden="true">
32
+ <li v-for="(s, i) in series" :key="s.key" class="flex items-center gap-1.5">
33
+ <span class="size-2.5 rounded-sm" :style="{ background: seriesColor(s, i) }" />{{ s.label }}
34
+ </li>
35
+ </ul>
36
+ <button
37
+ type="button"
38
+ class="ml-auto cursor-pointer rounded-sm text-xs text-ink/65 underline underline-offset-2 hover:text-ink outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus"
39
+ :aria-expanded="showTable"
40
+ @click="showTable = !showTable"
41
+ >
42
+ {{ showTable ? t('ui.chart.hideTable') : t('ui.chart.showTable') }}
43
+ </button>
44
+ </div>
45
+ <!-- The numbers. For screen readers always; for everyone with the button. -->
46
+ <div :class="showTable ? 'overflow-x-auto' : 'sr-only'">
47
+ <table class="w-full text-left text-xs tabular-nums">
48
+ <caption class="sr-only">{{ props.label }}</caption>
49
+ <thead class="text-ink/65">
50
+ <tr class="border-b border-ink/10">
51
+ <th scope="col" class="py-1.5 pr-4 font-normal">{{ categoryLabel }}</th>
52
+ <th v-for="s in series" :key="s.key" scope="col" class="py-1.5 pr-4 text-right font-normal">{{ s.label }}</th>
53
+ </tr>
54
+ </thead>
55
+ <tbody>
56
+ <tr v-for="point in data" :key="point.label" class="border-b border-ink/10 last:border-b-0">
57
+ <th scope="row" class="py-1.5 pr-4 font-normal">{{ point.fullLabel ?? point.label }}</th>
58
+ <td v-for="s in series" :key="s.key" class="py-1.5 pr-4 text-right">{{ format(valueOf(point, s.key)) }}</td>
59
+ </tr>
60
+ </tbody>
61
+ </table>
62
+ </div>
63
+ </div>
64
+ </template>
@@ -68,8 +68,8 @@ function select(item: BreadcrumbItem, event: MouseEvent) {
68
68
  const step = 'inline-flex max-w-60 min-w-0 items-center gap-1.5 [&_svg]:size-3.5 [&_svg]:shrink-0'
69
69
 
70
70
  const link = [
71
- 'cursor-pointer rounded-sm text-black/65 underline-offset-2 transition',
72
- 'hover:text-black hover:underline',
71
+ 'cursor-pointer rounded-sm text-ink/65 underline-offset-2 transition',
72
+ 'hover:text-ink hover:underline',
73
73
  'outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus'
74
74
  ]
75
75
  </script>
@@ -79,7 +79,7 @@ const link = [
79
79
  <ol class="flex flex-wrap items-center gap-x-1.5 gap-y-1">
80
80
  <li v-for="(item, i) in items" :key="`${item.label}-${i}`" class="flex min-w-0 items-center gap-1.5">
81
81
  <!-- The current page. -->
82
- <span v-if="i === items.length - 1" aria-current="page" :title="item.label" :class="cn(step, 'text-black')">
82
+ <span v-if="i === items.length - 1" aria-current="page" :title="item.label" :class="cn(step, 'text-ink')">
83
83
  <component :is="item.icon" v-if="item.icon" aria-hidden="true" />
84
84
  <span class="truncate">{{ item.label }}</span>
85
85
  </span>
@@ -98,12 +98,12 @@ const link = [
98
98
  </component>
99
99
 
100
100
  <!-- A step that isn't a page itself, e.g. a group. -->
101
- <span v-else :title="item.label" :class="cn(step, 'text-black/65')">
101
+ <span v-else :title="item.label" :class="cn(step, 'text-ink/65')">
102
102
  <component :is="item.icon" v-if="item.icon" aria-hidden="true" />
103
103
  <span class="truncate">{{ item.label }}</span>
104
104
  </span>
105
105
 
106
- <ChevronRight v-if="i < items.length - 1" aria-hidden="true" class="size-3.5 shrink-0 text-black/40" />
106
+ <ChevronRight v-if="i < items.length - 1" aria-hidden="true" class="size-3.5 shrink-0 text-ink/40" />
107
107
  </li>
108
108
  </ol>
109
109
  </nav>
@@ -199,7 +199,7 @@ export const StatusDemo: Story = {
199
199
  template: `
200
200
  <div class="flex flex-col items-start gap-3">
201
201
  <Button v-bind="buttonProps" v-model:status="status" @click="run">${buttonContent}</Button>
202
- <small class="text-xs text-black/60">
202
+ <small class="text-xs text-ink/60">
203
203
  Last result: {{ lastResult ?? "—" }}
204
204
  </small>
205
205
  </div>`,
@@ -154,25 +154,28 @@ const announcement = computed(() => {
154
154
  const base = [
155
155
  // overflow-hidden: content briefly wider than the button while its width animates is clipped
156
156
  'relative inline-flex shrink-0 items-center justify-center whitespace-nowrap select-none overflow-hidden',
157
- 'border border-black/15 cursor-pointer transition',
157
+ 'border border-ink/10 cursor-pointer transition',
158
158
  'disabled:cursor-not-allowed disabled:opacity-40',
159
159
  'aria-busy:cursor-progress',
160
160
  'outline-2 outline-offset-1 outline-transparent forced-colors:not-focus-visible:outline-0',
161
161
  'focus-visible:outline-focus'
162
162
  ]
163
163
 
164
- // Hover / pressed only apply when the button is usable.
164
+ // Hover / pressed only apply when the button is usable. The theme's state
165
+ // colours (theme.css, "States") keep this the same as every other component:
166
+ // - coloured fills (primary, danger) darken
167
+ // - basic (surface fill) takes the solid surface-hover / -pressed colours,
168
+ // which lighten in dark mode rather than darken
169
+ // - ghost has no fill, so it takes the see-through hover / pressed tints. Its
170
+ // border stays (transparent) so it lines up with the other variants.
165
171
  const interactive = 'not-disabled:not-aria-disabled:hover:brightness-90 not-disabled:not-aria-disabled:active:brightness-80'
166
-
167
- // Ghost has no fill to darken, so hover / press tint it with black instead
168
- // (10% / 15%, matching the other variants' 90% / 80% brightness). The border
169
- // stays (transparent) so it lines up with the other variants.
170
- const ghostInteractive = 'not-disabled:not-aria-disabled:hover:bg-black/10 not-disabled:not-aria-disabled:active:bg-black/15'
172
+ const surfaceInteractive = 'not-disabled:not-aria-disabled:hover:bg-surface-hover not-disabled:not-aria-disabled:active:bg-surface-pressed'
173
+ const ghostInteractive = 'not-disabled:not-aria-disabled:hover:bg-hover not-disabled:not-aria-disabled:active:bg-pressed'
171
174
 
172
175
  const variants: Record<NonNullable<ButtonProps['variant']>, string> = {
173
- basic: `bg-white text-black ${interactive}`,
176
+ basic: `bg-surface text-ink shadow-xs ${surfaceInteractive}`,
174
177
  primary: `bg-primary text-white ${interactive}`,
175
- ghost: `bg-transparent text-black border-transparent ${ghostInteractive}`,
178
+ ghost: `bg-transparent text-ink border-transparent ${ghostInteractive}`,
176
179
  danger: `bg-red text-white ${interactive}`
177
180
  }
178
181
 
@@ -15,7 +15,7 @@ const meta = {
15
15
  <Card class="w-fit">
16
16
  <Calendar v-bind="args" v-model="value" />
17
17
  </Card>
18
- <p class="mt-3 text-sm text-black/65">Chosen: {{ value ?? 'nothing yet' }}</p>`,
18
+ <p class="mt-3 text-sm text-ink/65">Chosen: {{ value ?? 'nothing yet' }}</p>`,
19
19
  }),
20
20
  } satisfies Meta<typeof Calendar>;
21
21
 
@@ -42,7 +42,7 @@ export const InterviewDay: Story = {
42
42
  <div class="flex flex-wrap items-start gap-4">
43
43
  <Card class="w-fit"><Calendar v-bind="args" v-model="value" /></Card>
44
44
  <Card :title="'Interviews on ' + new Date(value).toLocaleDateString('en-GB', { dateStyle: 'long' })" class="min-w-64 flex-1">
45
- <p class="text-sm text-black/65">3 interviews booked, 2 slots free.</p>
45
+ <p class="text-sm text-ink/65">3 interviews booked, 2 slots free.</p>
46
46
  </Card>
47
47
  </div>`,
48
48
  }),
@@ -186,7 +186,7 @@ const isCurrentYear = (year: number) => year === today(getLocalTimeZone()).year
186
186
  // "October ▾" / "2026 ▾" in the heading.
187
187
  const headingButton = [
188
188
  'inline-flex items-center gap-0.5 rounded px-1.5 py-1 text-sm cursor-pointer transition',
189
- 'hover:bg-black/10 active:bg-black/15 [&_svg]:size-3.5',
189
+ 'hover:bg-hover active:bg-pressed [&_svg]:size-3.5',
190
190
  'disabled:cursor-not-allowed disabled:hover:bg-transparent',
191
191
  'outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus'
192
192
  ]
@@ -206,9 +206,9 @@ const pickCell = [
206
206
  ...todayMark,
207
207
  'aria-[current=date]:after:bottom-2',
208
208
  'flex h-12 items-center justify-center rounded text-sm tabular-nums cursor-pointer transition',
209
- 'hover:bg-black/10',
209
+ 'hover:bg-hover',
210
210
  'aria-pressed:bg-primary aria-pressed:text-white aria-pressed:hover:bg-primary',
211
- 'disabled:cursor-not-allowed disabled:text-black/25 disabled:hover:bg-transparent',
211
+ 'disabled:cursor-not-allowed disabled:text-ink/25 disabled:hover:bg-transparent',
212
212
  'outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus'
213
213
  ]
214
214
 
@@ -216,10 +216,10 @@ const day = [
216
216
  ...todayMark,
217
217
  'aria-[current=date]:after:bottom-0.5',
218
218
  'flex size-8 items-center justify-center rounded text-sm tabular-nums cursor-pointer transition',
219
- 'hover:bg-black/10',
220
- 'data-[outside-view]:text-black/35',
219
+ 'hover:bg-hover',
220
+ 'data-[outside-view]:text-ink/55',
221
221
  'data-[selected]:bg-primary data-[selected]:text-white data-[selected]:hover:bg-primary',
222
- 'data-[disabled]:cursor-not-allowed data-[disabled]:text-black/25 data-[disabled]:hover:bg-transparent',
222
+ 'data-[disabled]:cursor-not-allowed data-[disabled]:text-ink/25 data-[disabled]:hover:bg-transparent',
223
223
  'data-[unavailable]:line-through',
224
224
  'outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus'
225
225
  ]
@@ -237,7 +237,8 @@ const day = [
237
237
  :initial-focus="initialFocus"
238
238
  :week-starts-on="1"
239
239
  fixed-weeks
240
- :class="cn('w-fit text-black', disabled && 'opacity-40', props.class)"
240
+ :data-disabled="disabled || undefined"
241
+ :class="cn('w-fit text-ink', disabled && 'opacity-40', props.class)"
241
242
  @update:model-value="setValue"
242
243
  @update:placeholder="onPlaceholderChange"
243
244
  >
@@ -263,7 +264,7 @@ const day = [
263
264
  v-if="view === 'days'"
264
265
  type="button"
265
266
  :class="headingButton"
266
- :aria-label="t('ui.calendar.chooseMonth')"
267
+ :aria-label="t('ui.calendar.chooseMonth', { month: monthLongName })"
267
268
  :disabled="disabled"
268
269
  @click="showMonths"
269
270
  >
@@ -273,7 +274,7 @@ const day = [
273
274
  v-if="view !== 'years'"
274
275
  type="button"
275
276
  :class="headingButton"
276
- :aria-label="t('ui.calendar.chooseYear')"
277
+ :aria-label="t('ui.calendar.chooseYear', { year: placeholder.year })"
277
278
  :disabled="disabled"
278
279
  @click="showYears"
279
280
  >
@@ -343,7 +344,7 @@ const day = [
343
344
  <CalendarHeadCell
344
345
  v-for="weekDay in weekDays"
345
346
  :key="weekDay"
346
- class="w-8 pb-1 text-xs font-normal text-black/55"
347
+ class="w-8 pb-1 text-xs font-normal text-ink/55"
347
348
  >
348
349
  {{ weekDay }}
349
350
  </CalendarHeadCell>
@@ -62,8 +62,8 @@ export const WithActionsAndFooter: Story = {
62
62
  <Button variant="ghost" size="sm"><template #leading><Pencil /></template>Edit</Button>
63
63
  </template>
64
64
  <dl class="grid grid-cols-[8rem_1fr] gap-y-2 text-sm">
65
- <dt class="text-black/65">Email</dt><dd>office@keston.school</dd>
66
- <dt class="text-black/65">Phone</dt><dd>020 7946 0000</dd>
65
+ <dt class="text-ink/65">Email</dt><dd>office@keston.school</dd>
66
+ <dt class="text-ink/65">Phone</dt><dd>020 7946 0000</dd>
67
67
  </dl>
68
68
  <template #footer>
69
69
  <Button>Cancel</Button>
@@ -80,7 +80,7 @@ export const Stats: Story = {
80
80
  template: `
81
81
  <div class="grid grid-cols-1 gap-6 sm:grid-cols-3">
82
82
  <Card v-for="stat in [['Open applications', '48'], ['Interviews this week', '9'], ['Offers accepted', '31']]" :key="stat[0]" padding="sm" :ui="{ body: 'gap-1' }">
83
- <span class="text-sm text-black/65">{{ stat[0] }}</span>
83
+ <span class="text-sm text-ink/65">{{ stat[0] }}</span>
84
84
  <span class="text-2xl font-bold">{{ stat[1] }}</span>
85
85
  </Card>
86
86
  </div>`,
@@ -96,11 +96,11 @@ export const Table: Story = {
96
96
  template: `
97
97
  <Card v-bind="args" :ui="{ body: 'overflow-x-auto' }">
98
98
  <table class="w-full text-left text-sm">
99
- <thead class="border-b border-black/15 text-black/65">
99
+ <thead class="border-b border-ink/10 text-ink/65">
100
100
  <tr><th class="px-4 py-3 font-bold">Applicant</th><th class="px-4 py-3 font-bold">Year</th><th class="px-4 py-3 font-bold">Status</th></tr>
101
101
  </thead>
102
102
  <tbody>
103
- <tr class="border-b border-black/15"><td class="px-4 py-3 font-bold">Amelia Clarke</td><td class="px-4 py-3">Year 7</td><td class="px-4 py-3"><Badge size="sm" color="green">Offered</Badge></td></tr>
103
+ <tr class="border-b border-ink/10"><td class="px-4 py-3 font-bold">Amelia Clarke</td><td class="px-4 py-3">Year 7</td><td class="px-4 py-3"><Badge size="sm" color="green">Offered</Badge></td></tr>
104
104
  <tr><td class="px-4 py-3 font-bold">Noah Patel</td><td class="px-4 py-3">Year 9</td><td class="px-4 py-3"><Badge size="sm" color="blue">Interview</Badge></td></tr>
105
105
  </tbody>
106
106
  </table>
@@ -77,7 +77,7 @@ const footerPaddings: Record<NonNullable<CardProps['padding']>, string> = {
77
77
  :aria-labelledby="title ? headingId : undefined"
78
78
  :class="
79
79
  cn(
80
- '@container flex flex-col rounded-lg border border-black/15 bg-white text-black',
80
+ '@container flex flex-col rounded-lg border border-ink/10 bg-surface text-ink shadow-xs',
81
81
  // Content that runs to the edges (a table's header, a list's rows) is
82
82
  // clipped to the rounded corners. clip, not hidden: it doesn't make a
83
83
  // scroll container, so sticky content inside still sticks to the page.
@@ -96,7 +96,7 @@ const footerPaddings: Record<NonNullable<CardProps['padding']>, string> = {
96
96
  <component :is="`h${headingLevel}`" v-if="title" :id="headingId" class="text-base font-bold">
97
97
  {{ title }}
98
98
  </component>
99
- <p v-if="description" class="text-sm text-black/65">{{ description }}</p>
99
+ <p v-if="description" class="text-sm text-ink/65">{{ description }}</p>
100
100
  </div>
101
101
  </slot>
102
102
  <div v-if="$slots.actions" class="flex shrink-0 items-center gap-2">
@@ -109,7 +109,7 @@ const footerPaddings: Record<NonNullable<CardProps['padding']>, string> = {
109
109
 
110
110
  <div
111
111
  v-if="$slots.footer"
112
- :class="cn('flex flex-wrap justify-end gap-2 border-t border-black/15', footerPaddings[padding], ui?.footer)"
112
+ :class="cn('flex flex-wrap justify-end gap-2 border-t border-ink/10', footerPaddings[padding], ui?.footer)"
113
113
  >
114
114
  <slot name="footer" />
115
115
  </div>
@@ -88,10 +88,13 @@ const grid = computed(() => {
88
88
  // card only changes colours and gets a second, inset 1px line drawn with a
89
89
  // box-shadow, which takes no space. Text keeps the same weight. Nothing is
90
90
  // added or removed in the card, so nothing can move.
91
+ //
92
+ // 10px on top, 12px elsewhere: the radio and icon sit 2px down to line up
93
+ // with the title, so this puts them 12px from the top, the same as the sides.
91
94
  const card = [
92
- 'group relative flex w-full cursor-pointer items-start gap-3 rounded-lg border border-black/15 bg-white p-3 text-left text-black transition-colors',
95
+ 'group relative flex w-full cursor-pointer items-start gap-3 rounded-lg border border-ink/10 bg-surface p-3 pt-2.5 text-left text-ink shadow-xs transition-colors',
93
96
  'outline-2 outline-offset-2 outline-transparent focus-visible:outline-focus',
94
- 'not-disabled:not-data-[state=checked]:hover:bg-surface-elevated',
97
+ 'not-disabled:not-data-[state=checked]:hover:bg-surface-hover',
95
98
  'data-[state=checked]:border-primary data-[state=checked]:bg-primary/6 data-[state=checked]:shadow-[inset_0_0_0_1px_var(--color-primary)]',
96
99
  'disabled:cursor-not-allowed disabled:opacity-40',
97
100
  'motion-reduce:transition-none'
@@ -99,13 +102,13 @@ const card = [
99
102
  </script>
100
103
 
101
104
  <template>
102
- <div :class="cn('flex flex-col gap-2 text-black', disabled && 'opacity-40', props.class)">
105
+ <div :data-disabled="disabled || undefined" :class="cn('flex flex-col gap-2 text-ink', disabled && 'opacity-40', props.class)">
103
106
  <div :class="cn('flex flex-col gap-0.5', hideLabel && 'sr-only')">
104
107
  <div class="flex items-center gap-1">
105
108
  <span :id="labelId" class="text-sm">{{ label }}</span>
106
109
  <InfoTip v-if="helper && helperPlacement === 'icon'" :text="helper" :label="t('ui.formField.about', { label })" />
107
110
  </div>
108
- <p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-black/65">
111
+ <p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-ink/65">
109
112
  {{ helper }}
110
113
  </p>
111
114
  </div>
@@ -129,17 +132,17 @@ const card = [
129
132
  :aria-describedby="option.description ? `${id}-${i}-description` : undefined"
130
133
  :class="cn(card, errorText && 'not-data-[state=checked]:border-red')"
131
134
  >
132
- <component :is="option.icon" v-if="option.icon" aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-black/65 group-data-[state=checked]:text-primary" />
135
+ <component :is="option.icon" v-if="option.icon" aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-ink/65 group-data-[state=checked]:text-primary-fg" />
133
136
  <span class="flex min-w-0 flex-1 flex-col gap-0.5">
134
137
  <span class="text-sm font-bold">{{ option.title }}</span>
135
- <span v-if="option.description" :id="`${id}-${i}-description`" class="text-xs text-black/65">
138
+ <span v-if="option.description" :id="`${id}-${i}-description`" class="text-xs text-ink/65">
136
139
  {{ option.description }}
137
140
  </span>
138
141
  </span>
139
142
  <!-- Always there, so the card is the same size either way: the dot only fades and scales in. -->
140
143
  <span
141
144
  aria-hidden="true"
142
- class="mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border border-black/55 bg-white group-data-[state=checked]:border-primary"
145
+ class="mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border border-ink/45 bg-surface group-data-[state=checked]:border-primary"
143
146
  >
144
147
  <span class="size-2 scale-0 rounded-full bg-primary transition-transform group-data-[state=checked]:scale-100 motion-reduce:transition-none" />
145
148
  </span>
@@ -32,10 +32,10 @@ const label = computed(() => t('ui.changeIndicator.changed', { from: props.from,
32
32
  <template>
33
33
  <span
34
34
  v-if="changed"
35
- :class="cn('inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-blue/30 bg-blue/10 px-2 text-xs font-bold text-blue', props.class)"
35
+ :class="cn('inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-blue-fg/30 bg-blue-fg/10 px-2 text-xs font-bold text-blue-fg', props.class)"
36
36
  >
37
37
  <span class="sr-only">{{ label }}</span>
38
- <span aria-hidden="true" class="font-normal line-through decoration-blue/60">{{ from }}</span>
38
+ <span aria-hidden="true" class="font-normal line-through decoration-blue-fg/60">{{ from }}</span>
39
39
  <ArrowRight aria-hidden="true" class="size-3 shrink-0" />
40
40
  <span aria-hidden="true">{{ to }}<template v-if="unit"> {{ unit }}</template></span>
41
41
  </span>
@@ -61,8 +61,8 @@ function pressControl(event: MouseEvent, id: string) {
61
61
  // 16px box, level with the first line of the label (20px line: 2px above).
62
62
  // The border is darker than a text box's so the box itself is easy to see.
63
63
  const box = [
64
- 'mt-0.5 flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm border bg-white text-white transition',
65
- 'not-disabled:hover:border-black disabled:cursor-not-allowed',
64
+ 'mt-0.5 flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm border bg-surface text-white transition',
65
+ 'not-disabled:hover:border-ink disabled:cursor-not-allowed',
66
66
  'data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:hover:border-primary',
67
67
  'data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:hover:border-primary',
68
68
  'outline-2 outline-offset-2 outline-transparent focus-visible:outline-focus',
@@ -71,7 +71,7 @@ const box = [
71
71
  </script>
72
72
 
73
73
  <template>
74
- <div :class="cn('flex flex-col gap-1.5 text-black', disabled && 'opacity-40', props.class)">
74
+ <div :data-disabled="disabled || undefined" :class="cn('flex flex-col gap-1.5 text-ink', disabled && 'opacity-40', props.class)">
75
75
  <div class="flex items-start gap-2">
76
76
  <CheckboxRoot
77
77
  :id="controlId"
@@ -82,7 +82,7 @@ const box = [
82
82
  :disabled="disabled"
83
83
  :aria-invalid="errorText ? true : undefined"
84
84
  :aria-describedby="describedBy"
85
- :class="cn(box, errorText ? 'border-red' : 'border-black/55')"
85
+ :class="cn(box, errorText ? 'border-red' : 'border-ink/45')"
86
86
  >
87
87
  <CheckboxIndicator class="flex">
88
88
  <Minus v-if="model === 'indeterminate'" aria-hidden="true" />
@@ -94,7 +94,7 @@ const box = [
94
94
  @click="pressControl($event, controlId)"
95
95
  >
96
96
  <label :for="controlId" :class="cn('text-sm', disabled ? 'cursor-not-allowed' : 'cursor-pointer')">{{ label }}</label>
97
- <p v-if="description" :id="descriptionId" class="text-xs text-black/65">
97
+ <p v-if="description" :id="descriptionId" class="text-xs text-ink/65">
98
98
  {{ description }}
99
99
  </p>
100
100
  </div>
@@ -27,7 +27,7 @@ const meta = {
27
27
  setup: () => ({ args, value: ref<(string | number)[]>(["admissions"]) }),
28
28
  template: `
29
29
  <CheckboxGroup v-bind="args" v-model="value" />
30
- <pre class="mt-4 text-xs text-black/65">{{ value }}</pre>`,
30
+ <pre class="mt-4 text-xs text-ink/65">{{ value }}</pre>`,
31
31
  }),
32
32
  } satisfies Meta<typeof CheckboxGroup>;
33
33
 
@@ -61,14 +61,14 @@ function toggle(value: CheckboxGroupValue, on: boolean) {
61
61
  </script>
62
62
 
63
63
  <template>
64
- <div :class="cn('flex flex-col gap-1.5 text-black', props.class)">
64
+ <div :data-disabled="disabled || undefined" :class="cn('flex flex-col gap-1.5 text-ink', props.class)">
65
65
  <div :class="cn('flex flex-col gap-0.5', hideLabel && 'sr-only')">
66
66
  <div class="flex items-center gap-1">
67
67
  <span :id="labelId" class="text-sm">{{ label }}</span>
68
68
  <InfoTip v-if="helper && helperPlacement === 'icon'" :text="helper" :label="t('ui.formField.about', { label })" />
69
69
  </div>
70
70
  <!-- Behind the ?: hidden, but still the group's description. -->
71
- <p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-black/65">
71
+ <p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-ink/65">
72
72
  {{ helper }}
73
73
  </p>
74
74
  </div>
@@ -29,10 +29,10 @@ const props = defineProps<ChecklistProps>()
29
29
  <li v-for="item in items" :key="item.label" class="flex items-start gap-2">
30
30
  <!-- h-5 keeps the icon level with the first line of a label that wraps. -->
31
31
  <span class="flex h-5 shrink-0 items-center">
32
- <CircleCheck v-if="item.done" class="size-4 text-green" aria-hidden="true" />
33
- <Circle v-else :class="cn('size-4', invalid ? 'text-red' : 'text-black/40')" aria-hidden="true" />
32
+ <CircleCheck v-if="item.done" class="size-4 text-green-fg" aria-hidden="true" />
33
+ <Circle v-else :class="cn('size-4', invalid ? 'text-red-fg' : 'text-ink/40')" aria-hidden="true" />
34
34
  </span>
35
- <span :class="item.done ? 'text-black' : 'text-black/65'">
35
+ <span :class="item.done ? 'text-ink' : 'text-ink/65'">
36
36
  {{ item.label }}<span class="sr-only">{{ item.done ? ' (done)' : ' (to do)' }}</span>
37
37
  </span>
38
38
  </li>
@@ -65,7 +65,7 @@ export const Removable: Story = {
65
65
  <template #leading><component :is="subject.icon" /></template>
66
66
  {{ subject.label }}
67
67
  </Chip>
68
- <span v-if="!subjects.length" class="text-sm text-black/65">All removed</span>
68
+ <span v-if="!subjects.length" class="text-sm text-ink/65">All removed</span>
69
69
  </div>`,
70
70
  }),
71
71
  };
@@ -43,7 +43,7 @@ defineSlots<{
43
43
  // Light grey fill and the shared border, so it reads as a chosen item on a
44
44
  // white field without competing with buttons.
45
45
  const base = [
46
- 'inline-flex max-w-full shrink-0 items-center whitespace-nowrap rounded border border-black/15 bg-black/5 text-black',
46
+ 'inline-flex max-w-full shrink-0 items-center whitespace-nowrap rounded border border-ink/10 bg-ink/5 text-ink',
47
47
  '[&_svg]:shrink-0'
48
48
  ]
49
49
 
@@ -75,7 +75,7 @@ const removeSizes: Record<NonNullable<ChipProps['size']>, string> = {
75
75
  :disabled="disabled"
76
76
  :class="cn(
77
77
  'flex shrink-0 cursor-pointer items-center justify-center rounded-sm transition',
78
- 'not-disabled:hover:bg-black/10 not-disabled:active:bg-black/15 disabled:cursor-not-allowed',
78
+ 'not-disabled:hover:bg-hover not-disabled:active:bg-pressed disabled:cursor-not-allowed',
79
79
  'outline-2 outline-offset-0 outline-transparent focus-visible:outline-focus',
80
80
  removeSizes[size]
81
81
  )"