@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
@@ -72,7 +72,7 @@ const MaybeProvider: FunctionalComponent = (_, { slots }) =>
72
72
  :collision-padding="8"
73
73
  :class="
74
74
  cn(
75
- 'z-100 max-w-72 rounded-md bg-gray-900 px-2.5 py-1.5 text-xs/4 font-medium text-white shadow-lg ring-1 ring-white/10',
75
+ 'z-100 max-w-72 rounded-md bg-neutral-900 dark:bg-neutral-700 px-2.5 py-1.5 text-xs/4 text-white shadow-lg ring-1 ring-white/10',
76
76
  'data-[state=closed]:animate-fade-out data-[state=delayed-open]:animate-fade-in data-[state=instant-open]:animate-fade-in',
77
77
  props.class
78
78
  )
@@ -46,7 +46,7 @@ export const SlidesInAndOut: Story = {
46
46
  <div class="flex flex-col items-start gap-4 p-6">
47
47
  <p class="text-sm">The bar leaves a gap at the end of the page, so nothing is covered.</p>
48
48
  <Button variant="primary" @click="open = true">Make a change</Button>
49
- <div class="h-[60vh] w-full rounded-lg bg-surface" />
49
+ <div class="h-[60vh] w-full rounded-lg bg-surface-muted" />
50
50
  <p class="text-sm">Last line of the page.</p>
51
51
  <UnsavedChangesBar :open="open" :status="status" @discard="open = false" @save="save" />
52
52
  </div>`,
@@ -69,7 +69,7 @@ const saving = computed(() => props.status === 'loading')
69
69
  :class="cn('fixed inset-x-0 bottom-0 z-40 flex justify-center px-4 pb-4 pointer-events-none', props.class)"
70
70
  >
71
71
  <div
72
- class="pointer-events-auto flex w-full max-w-2xl items-center justify-between gap-3 rounded-lg border border-black/15 bg-white p-3 pl-4 shadow-lg"
72
+ class="pointer-events-auto flex w-full max-w-2xl items-center justify-between gap-3 rounded-lg border border-ink/10 bg-surface-elevated p-3 pl-4 shadow-lg"
73
73
  >
74
74
  <p role="status" class="flex items-center gap-2 text-sm font-bold">
75
75
  <span aria-hidden="true" class="size-2 shrink-0 rounded-full bg-yellow" />
@@ -106,7 +106,7 @@ const pageTemplate = `
106
106
 
107
107
  <Card padding="none">
108
108
  <Table :columns="columns" :rows="rows" row-key="name" :caption="current">
109
- <template #cell-date="{ value }"><span class="text-black/65">{{ value }}</span></template>
109
+ <template #cell-date="{ value }"><span class="text-ink/65">{{ value }}</span></template>
110
110
  <template #cell-status="{ row }"><Badge :color="row.color" size="sm">{{ row.status }}</Badge></template>
111
111
  </Table>
112
112
  </Card>
@@ -416,7 +416,7 @@ export const NewSchoolYearSetup: Story = {
416
416
  Start new year
417
417
  </Button>
418
418
  </template>
419
- <p v-if="checked && errorCount" role="alert" class="text-sm text-red">
419
+ <p v-if="checked && errorCount" role="alert" class="text-sm text-red-fg">
420
420
  {{ errorCount === 1 ? 'There is 1 thing' : 'There are ' + errorCount + ' things' }} to fix before the new year can start.
421
421
  </p>
422
422
  </PageHeader>
@@ -487,7 +487,7 @@ export const NewSchoolYearSetup: Story = {
487
487
  <Divider />
488
488
  <div class="flex flex-col gap-2">
489
489
  <h3 class="text-sm font-bold">Sign-off</h3>
490
- <p class="text-sm text-black/65">Starting the year needs one of these people.</p>
490
+ <p class="text-sm text-ink/65">Starting the year needs one of these people.</p>
491
491
  <AvatarGroup :users="signOff" size="sm" label="People who can sign off" />
492
492
  </div>
493
493
  </Card>
@@ -97,10 +97,10 @@ export const AddStudent: Story = {
97
97
  return { form, errors, errorCount, status, formEl, todayIso, check, recheck, submit, reset };
98
98
  },
99
99
  template: `
100
- <form ref="formEl" novalidate class="flex max-w-md flex-col gap-5 text-black" @submit.prevent="submit">
100
+ <form ref="formEl" novalidate class="flex max-w-md flex-col gap-5 text-ink" @submit.prevent="submit">
101
101
  <div>
102
102
  <h2 class="text-lg">Add student</h2>
103
- <p class="text-sm text-black/65">Fields check themselves when you leave them. Try "Create student" with the form empty.</p>
103
+ <p class="text-sm text-ink/65">Fields check themselves when you leave them. Try "Create student" with the form empty.</p>
104
104
  </div>
105
105
 
106
106
  <div class="grid grid-cols-2 items-start gap-3">
@@ -167,7 +167,7 @@ export const AddStudent: Story = {
167
167
  <template #leading><IdCard /></template>
168
168
  </Input>
169
169
 
170
- <div class="flex justify-end gap-2 border-t border-black/15 pt-4">
170
+ <div class="flex justify-end gap-2 border-t border-ink/10 pt-4">
171
171
  <Button @click="reset">Reset</Button>
172
172
  <Button
173
173
  v-model:status="status"
@@ -102,12 +102,12 @@ const appState = () => ({
102
102
  // logo: swap it for the SVG when there is one.
103
103
  const brands = {
104
104
  tkg: `
105
- <div class="flex items-center justify-center gap-2 text-primary">
105
+ <div class="flex items-center justify-center gap-2 text-primary-fg">
106
106
  <span class="flex size-8 items-center justify-center rounded bg-primary text-xs font-bold text-white" aria-hidden="true">TKG</span>
107
107
  <span class="text-lg font-bold">The Keston Group</span>
108
108
  </div>`,
109
109
  kestonId: `
110
- <div class="flex items-center justify-center gap-2 text-primary">
110
+ <div class="flex items-center justify-center gap-2 text-primary-fg">
111
111
  <ShieldCheck class="size-6" aria-hidden="true" />
112
112
  <span class="text-lg font-bold">Keston ID</span>
113
113
  </div>`,
@@ -116,11 +116,11 @@ const brands = {
116
116
  // Every Keston ID page: a narrow column centred on the grey background, with
117
117
  // the branding above the card.
118
118
  const page = (body: string, brand: keyof typeof brands = "kestonId") => `
119
- <div class="flex min-h-screen flex-col items-center bg-background px-4 py-12 text-black">
119
+ <div class="flex min-h-screen flex-col items-center bg-background px-4 py-12 text-ink">
120
120
  <div class="flex w-full max-w-100 flex-col gap-6">
121
121
  ${brands[brand]}
122
122
  ${body}
123
- <nav aria-label="Legal and help" class="flex items-center justify-center gap-2 text-xs text-black/65">
123
+ <nav aria-label="Legal and help" class="flex items-center justify-center gap-2 text-xs text-ink/65">
124
124
  <Link href="#" new-tab class="py-1">Privacy</Link>
125
125
  <span aria-hidden="true">·</span>
126
126
  <Link href="#" new-tab class="py-1">Terms</Link>
@@ -150,7 +150,7 @@ const appName = (headingId: string) => `
150
150
  <button
151
151
  type="button"
152
152
  :aria-label="mark.label"
153
- :class="client.verification === 'owned' ? 'text-kblue' : 'text-blue'"
153
+ :class="client.verification === 'owned' ? 'text-kblue' : 'text-blue-fg'"
154
154
  class="flex cursor-pointer rounded-full outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus"
155
155
  >
156
156
  <BadgeCheck class="size-5" aria-hidden="true" />
@@ -202,14 +202,14 @@ const consentCard = `
202
202
  <div class="flex flex-col gap-6">
203
203
  <div class="flex items-center justify-center gap-3" aria-hidden="true">
204
204
  <Avatar :user="app" size="lg" decorative />
205
- <ArrowLeftRight class="size-5 text-black/55" />
205
+ <ArrowLeftRight class="size-5 text-ink/55" />
206
206
  <Avatar :user="user" size="lg" decorative />
207
207
  </div>
208
208
 
209
209
  <div class="flex flex-col gap-1 text-center">
210
210
  ${appName("consent-heading")}
211
211
  <p class="text-base">wants to access your Keston account</p>
212
- <p class="text-sm text-black/65">An app by {{ client.publisher }}</p>
212
+ <p class="text-sm text-ink/65">An app by {{ client.publisher }}</p>
213
213
  </div>
214
214
 
215
215
  <!-- Who's signed in, as a small Card in a row. -->
@@ -218,7 +218,7 @@ const consentCard = `
218
218
  <Avatar :user="user" size="sm" decorative />
219
219
  <div class="flex min-w-0 flex-col">
220
220
  <span class="truncate text-sm font-bold">{{ user.name }}</span>
221
- <span class="truncate text-xs text-black/65">{{ user.email }}</span>
221
+ <span class="truncate text-xs text-ink/65">{{ user.email }}</span>
222
222
  </div>
223
223
  </div>
224
224
  <Button size="sm" class="shrink-0">Switch account</Button>
@@ -228,10 +228,10 @@ const consentCard = `
228
228
  <h2 class="text-sm font-bold">This will let {{ client.name }}:</h2>
229
229
  <ul class="flex flex-col gap-3">
230
230
  <li v-for="scope in required" :key="scope.id" class="flex items-start gap-3">
231
- <component :is="scope.icon" class="mt-0.5 size-4 shrink-0 text-black/65" aria-hidden="true" />
231
+ <component :is="scope.icon" class="mt-0.5 size-4 shrink-0 text-ink/65" aria-hidden="true" />
232
232
  <div class="flex flex-col gap-0.5">
233
233
  <span class="text-sm">{{ scope.label }}</span>
234
- <span class="text-xs text-black/65">{{ scope.description }}</span>
234
+ <span class="text-xs text-ink/65">{{ scope.description }}</span>
235
235
  </div>
236
236
  </li>
237
237
  </ul>
@@ -250,8 +250,8 @@ const consentCard = `
250
250
 
251
251
  <Divider />
252
252
 
253
- <p class="text-xs text-black/65">
254
- You'll be sent to <span class="font-bold text-black">{{ client.redirectHost }}</span>.
253
+ <p class="text-xs text-ink/65">
254
+ You'll be sent to <span class="font-bold text-ink">{{ client.redirectHost }}</span>.
255
255
  Make sure you trust {{ client.name }}: read its
256
256
  <Link href="#" new-tab>privacy policy</Link>
257
257
  and
@@ -266,7 +266,7 @@ const consentCard = `
266
266
  </Button>
267
267
  </div>
268
268
 
269
- <p v-if="result" class="break-all rounded bg-surface px-3 py-2 font-mono text-xs" role="status">{{ result }}</p>
269
+ <p v-if="result" class="break-all rounded bg-surface-muted px-3 py-2 font-mono text-xs" role="status">{{ result }}</p>
270
270
  </div>
271
271
  </Card>`;
272
272
 
@@ -315,7 +315,7 @@ export const SignIn: Story = {
315
315
  <div class="flex flex-col gap-1 text-center">
316
316
  ${appName("sign-in-heading")}
317
317
  <p class="text-base">Sign in with your Keston account</p>
318
- <p class="text-sm text-black/65">An app by {{ client.publisher }}</p>
318
+ <p class="text-sm text-ink/65">An app by {{ client.publisher }}</p>
319
319
  </div>
320
320
 
321
321
  <form class="flex flex-col gap-4" @submit.prevent="signIn">
@@ -327,7 +327,7 @@ export const SignIn: Story = {
327
327
  <InputPassword v-model="form.password" label="Password" :error-text="error">
328
328
  <template #leading><Lock /></template>
329
329
  <template #label-trailing>
330
- <Link href="#" class="text-black/65">Forgot password?</Link>
330
+ <Link href="#" class="text-ink/65">Forgot password?</Link>
331
331
  </template>
332
332
  </InputPassword>
333
333
  <Button type="submit" variant="primary" :status="status" loading-text="Signing in" success-text="Signed in">
@@ -338,7 +338,7 @@ export const SignIn: Story = {
338
338
  <Button>Sign in with a passkey</Button>
339
339
  </div>
340
340
  <template #footer>
341
- <p class="text-center text-xs text-black/65">
341
+ <p class="text-center text-xs text-ink/65">
342
342
  By signing in, you agree to our <Link href="#" new-tab>terms</Link>
343
343
  and <Link href="#" new-tab>privacy policy</Link>.
344
344
  </p>
@@ -392,8 +392,8 @@ export const TwoStepCode: Story = {
392
392
  <Button type="submit" variant="primary" :disabled="status === 'loading'">Continue</Button>
393
393
  </form>
394
394
  <template #footer>
395
- <Link href="#" class="py-1 text-xs text-black/65">Use a backup code</Link>
396
- <Link href="#" class="py-1 text-xs text-black/65">Email me a code</Link>
395
+ <Link href="#" class="py-1 text-xs text-ink/65">Use a backup code</Link>
396
+ <Link href="#" class="py-1 text-xs text-ink/65">Email me a code</Link>
397
397
  </template>
398
398
  </Card>`, "tkg"),
399
399
  }),
@@ -199,7 +199,7 @@ export const StudentRecord: Story = {
199
199
  <div class="grid grid-cols-1 gap-6 @lg:grid-cols-3">
200
200
  <StatTile label="Attendance" value="96.4%" change="+1.2%" change-label="on last term" trend="up">
201
201
  <template #footer>
202
- <span class="flex items-center gap-1 text-xs text-black/65">
202
+ <span class="flex items-center gap-1 text-xs text-ink/65">
203
203
  This term
204
204
  <InfoTip label="About attendance" text="Sessions attended as a share of possible sessions. Authorised absences count against it." />
205
205
  </span>
@@ -236,7 +236,7 @@ export const StudentRecord: Story = {
236
236
  {{ contact.name }}
237
237
  <Badge v-if="contact.primary" size="sm">Primary</Badge>
238
238
  </span>
239
- <span class="text-xs text-black/65">{{ contact.relation }}</span>
239
+ <span class="text-xs text-ink/65">{{ contact.relation }}</span>
240
240
  </div>
241
241
  </div>
242
242
  <div class="flex flex-wrap gap-2">
@@ -251,7 +251,7 @@ export const StudentRecord: Story = {
251
251
  <ul class="flex flex-col gap-3 text-sm">
252
252
  <li v-for="item in activity" :key="item.text" class="flex flex-col gap-0.5">
253
253
  <span>{{ item.text }}</span>
254
- <span class="text-xs text-black/65">{{ item.by }} · <RelativeTime :date="item.at" :now="now" /></span>
254
+ <span class="text-xs text-ink/65">{{ item.by }} · <RelativeTime :date="item.at" :now="now" /></span>
255
255
  </li>
256
256
  </ul>
257
257
  </Card>
@@ -420,7 +420,7 @@ export const ApplicationReview: Story = {
420
420
 
421
421
  <Card padding="none">
422
422
  <Table v-model:sort="sort" :columns="columns" :rows="applications" row-key="id" caption="Applications">
423
- <template #cell-submitted="{ row }"><span class="text-black/65"><RelativeTime :date="row.submitted" :now="now" /></span></template>
423
+ <template #cell-submitted="{ row }"><span class="text-ink/65"><RelativeTime :date="row.submitted" :now="now" /></span></template>
424
424
  <template #cell-status="{ row }"><Badge :color="statusColour[row.status]" size="sm">{{ row.status }}</Badge></template>
425
425
  <template #cell-review="{ row }">
426
426
  <Button size="sm" :aria-label="'Review ' + row.name" @click="review(row)">Review</Button>
@@ -547,7 +547,7 @@ export const InterviewBooking: Story = {
547
547
  </Card>
548
548
 
549
549
  <Card :title="dayLabel ? 'Times on ' + dayLabel : 'Times'">
550
- <p v-if="weekend" class="text-sm text-black/65">No interviews at weekends. Choose a weekday.</p>
550
+ <p v-if="weekend" class="text-sm text-ink/65">No interviews at weekends. Choose a weekday.</p>
551
551
  <template v-else>
552
552
  <RadioGroup v-model="slot" label="Time" :options="slots" :error-text="slotError" />
553
553
  <Select v-model="interviewer" label="Interviewer" :options="interviewers" placeholder="Choose…" :error-text="interviewerError" />
package/src/i18n/en.ts CHANGED
@@ -37,10 +37,12 @@ export const en = {
37
37
  nextYear: 'Next year',
38
38
  previousYears: 'Previous years',
39
39
  nextYears: 'Next years',
40
- chooseMonth: 'Choose month',
41
- chooseYear: 'Choose year'
40
+ // Start with what the button shows, so voice control ("click June") finds it.
41
+ chooseMonth: '{month}, choose month',
42
+ chooseYear: '{year}, choose year'
42
43
  },
43
44
  changeIndicator: { changed: 'Changed from {from} to {to}' },
45
+ chart: { category: 'Category', showTable: 'Show as table', hideTable: 'Hide table' },
44
46
  chip: { remove: 'Remove' },
45
47
  appLauncher: { label: 'Keston apps' },
46
48
  footer: {
@@ -75,7 +77,15 @@ export const en = {
75
77
  italic: 'Italic',
76
78
  underline: 'Underline'
77
79
  },
80
+ alert: { info: 'Information', success: 'Success', warning: 'Warning', error: 'Error', dismiss: 'Dismiss' },
81
+ fileUpload: {
82
+ chooseFile: 'Choose a file',
83
+ chooseFiles: 'Choose files',
84
+ dropFile: 'Drop a file here, or choose one.',
85
+ dropFiles: 'Drop files here, or choose them.'
86
+ },
78
87
  languageSwitcher: { label: 'Language' },
88
+ themeSwitcher: { label: 'Appearance', light: 'Light', dark: 'Dark', system: 'Match device' },
79
89
  notifications: {
80
90
  title: 'Notifications',
81
91
  region: 'Notification',
@@ -92,7 +102,7 @@ export const en = {
92
102
  actions: '{title} actions',
93
103
  moreActions: 'More actions'
94
104
  },
95
- progress: { stepOf: 'Step {current} of {total}' },
105
+ progress: { stepOf: 'Step {current} of {total}', backTo: 'Back to step {current}: {name}' },
96
106
  select: {
97
107
  choose: 'Choose…',
98
108
  search: 'Search…',
@@ -113,7 +123,9 @@ export const en = {
113
123
  next: 'Next',
114
124
  finish: 'Finish',
115
125
  steps: 'Steps',
116
- stepOf: 'Step {current} of {total}: {name}'
126
+ stepOf: 'Step {current} of {total}: {name}',
127
+ /** Shown under the title, e.g. "Step 1 of 3 – Name". */
128
+ stepHeading: 'Step {current} of {total} – {name}'
117
129
  },
118
130
  spinner: { loading: 'Loading' },
119
131
  statTile: { up: 'Up', down: 'Down', flat: 'No change' },
package/src/index.ts CHANGED
@@ -4,6 +4,9 @@
4
4
  // at the end of its group.
5
5
 
6
6
  export { cn } from './lib/cn'
7
+ export { initTheme, useTheme } from './lib/theme'
8
+ export type { ChartPoint, ChartSeries } from './lib/chart'
9
+ export type { Theme } from './lib/theme'
7
10
 
8
11
  // Layout
9
12
  export { default as AppShell } from './components/AppShell/AppShell.vue'
@@ -42,6 +45,10 @@ export { default as Progress } from './components/Progress/Progress.vue'
42
45
  export type { ProgressProps } from './components/Progress/Progress.vue'
43
46
  export { default as ChangeIndicator } from './components/ChangeIndicator/ChangeIndicator.vue'
44
47
  export type { ChangeIndicatorProps } from './components/ChangeIndicator/ChangeIndicator.vue'
48
+ export { default as Alert } from './components/Alert/Alert.vue'
49
+ export type { AlertProps } from './components/Alert/Alert.vue'
50
+ export { default as Collapsible } from './components/Collapsible/Collapsible.vue'
51
+ export type { CollapsibleProps } from './components/Collapsible/Collapsible.vue'
45
52
 
46
53
  // Form
47
54
  export { default as FormField } from './components/FormField/FormField.vue'
@@ -74,8 +81,12 @@ export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGro
74
81
  export type { CheckboxGroupProps, CheckboxOption, CheckboxGroupValue } from './components/CheckboxGroup/CheckboxGroup.vue'
75
82
  export { default as LanguageSwitcher } from './components/LanguageSwitcher/LanguageSwitcher.vue'
76
83
  export type { LanguageSwitcherProps } from './components/LanguageSwitcher/LanguageSwitcher.vue'
84
+ export { default as ThemeSwitcher } from './components/ThemeSwitcher/ThemeSwitcher.vue'
85
+ export type { ThemeSwitcherProps } from './components/ThemeSwitcher/ThemeSwitcher.vue'
77
86
  export { default as CardSelect } from './components/CardSelect/CardSelect.vue'
78
87
  export type { CardSelectProps } from './components/CardSelect/CardSelect.vue'
88
+ export { default as FileUpload } from './components/FileUpload/FileUpload.vue'
89
+ export type { FileUploadProps } from './components/FileUpload/FileUpload.vue'
79
90
 
80
91
  // Data
81
92
  export { default as Table } from './components/Table/Table.vue'
@@ -94,6 +105,10 @@ export { default as Age } from './components/Age/Age.vue'
94
105
  export type { AgeProps } from './components/Age/Age.vue'
95
106
  export { default as EmptyState } from './components/EmptyState/EmptyState.vue'
96
107
  export type { EmptyStateProps } from './components/EmptyState/EmptyState.vue'
108
+ export { default as BarChart } from './components/BarChart/BarChart.vue'
109
+ export type { BarChartProps } from './components/BarChart/BarChart.vue'
110
+ export { default as LineChart } from './components/LineChart/LineChart.vue'
111
+ export type { LineChartProps } from './components/LineChart/LineChart.vue'
97
112
 
98
113
  // Navigation
99
114
  export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.vue'
@@ -105,6 +120,8 @@ export { default as Link } from './components/Link/Link.vue'
105
120
  export type { LinkProps } from './components/Link/Link.vue'
106
121
  export { default as Steps } from './components/Steps/Steps.vue'
107
122
  export type { StepsProps } from './components/Steps/Steps.vue'
123
+ export { default as ActionList } from './components/ActionList/ActionList.vue'
124
+ export type { ActionListItem, ActionListProps } from './components/ActionList/ActionList.vue'
108
125
 
109
126
  // Overlay
110
127
  export { default as Popover } from './components/Popover/Popover.vue'
@@ -0,0 +1,47 @@
1
+ /** One series in a chart: a name for the legend and table, and its colour slot. */
2
+ export interface ChartSeries {
3
+ /** The key of this series' number in each point's `values`. */
4
+ key: string
5
+ /** Its name in the legend, the tooltip and the table, e.g. "Failed". */
6
+ label: string
7
+ /**
8
+ * Which of the eight chart colours (1–8). Default: the series' place in
9
+ * the list. Set it so a series keeps its colour when others are filtered
10
+ * out, e.g. failed sign-ins always red (8).
11
+ */
12
+ color?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
13
+ }
14
+
15
+ /** One point along the chart: a day, a month, a school. */
16
+ export interface ChartPoint {
17
+ /** Short label under the bar or along the axis, e.g. "Mon". */
18
+ label: string
19
+ /** Full label for the tooltip and table, e.g. "Monday 24 November". Default `label`. */
20
+ fullLabel?: string
21
+ /** A number for each series, by its key. Missing counts as 0. */
22
+ values: Record<string, number | null | undefined>
23
+ }
24
+
25
+ export function seriesColor(series: ChartSeries, index: number): string {
26
+ const slot = series.color ?? Math.min(index + 1, 8)
27
+ return `var(--color-chart-${slot})`
28
+ }
29
+
30
+ export const valueOf = (point: ChartPoint, key: string) => point.values[key] ?? 0
31
+
32
+ /**
33
+ * A clean top for the value axis and the ticks up to it: 0, 5, 10, 15
34
+ * rather than 0, 4.3, 8.6, 12.9. About `count` steps of 1, 2, 2.5 or 5 × 10ⁿ.
35
+ */
36
+ export function niceScale(max: number, count = 4): { max: number; ticks: number[] } {
37
+ if (!(max > 0)) return { max: 1, ticks: [0, 1] }
38
+ const rough = max / count
39
+ const power = 10 ** Math.floor(Math.log10(rough))
40
+ const step = ([1, 2, 2.5, 5, 10].find((m) => m * power >= rough) ?? 10) * power
41
+ // Whole numbers only for counts: a step under 1 shows as 0, 0, 1, 1.
42
+ const safeStep = max >= 1 && step < 1 ? 1 : step
43
+ const top = Math.ceil(max / safeStep) * safeStep
44
+ const ticks: number[] = []
45
+ for (let v = 0; v <= top + safeStep / 2; v += safeStep) ticks.push(Number(v.toFixed(10)))
46
+ return { max: top, ticks }
47
+ }
@@ -0,0 +1,75 @@
1
+ import { readonly, ref, type Ref } from 'vue'
2
+
3
+ /**
4
+ * Light, dark or following the device. Keston UI's colours switch with the
5
+ * `data-theme` attribute on `<html>` (see theme.css, "Dark mode").
6
+ */
7
+ export type Theme = 'light' | 'dark' | 'system'
8
+
9
+ const STORAGE_KEY = 'keston-theme'
10
+ const themes: readonly Theme[] = ['light', 'dark', 'system']
11
+
12
+ function isTheme(value: unknown): value is Theme {
13
+ return typeof value === 'string' && (themes as readonly string[]).includes(value)
14
+ }
15
+
16
+ // Storage can be missing or blocked (private windows, strict settings): the
17
+ // choice then lasts until the page is closed.
18
+ function readSaved(): Theme | undefined {
19
+ try {
20
+ const saved = localStorage.getItem(STORAGE_KEY)
21
+ return isTheme(saved) ? saved : undefined
22
+ } catch {
23
+ return undefined
24
+ }
25
+ }
26
+
27
+ function save(theme: Theme) {
28
+ try {
29
+ localStorage.setItem(STORAGE_KEY, theme)
30
+ } catch {
31
+ // Not saved; still applied for this page.
32
+ }
33
+ }
34
+
35
+ // One choice for the whole page, however many switchers are showing.
36
+ const current = ref<Theme>('system')
37
+ let started = false
38
+
39
+ function apply(theme: Theme) {
40
+ current.value = theme
41
+ if (typeof document !== 'undefined') document.documentElement.dataset.theme = theme
42
+ }
43
+
44
+ /**
45
+ * Applies the person's saved choice (or `fallback` if there is none) and keeps
46
+ * other tabs in step. Call it once in main.ts, before mounting, so the page
47
+ * doesn't flash the wrong colours:
48
+ *
49
+ * initTheme() // follows the device until someone picks
50
+ * initTheme('light') // an app that starts light
51
+ */
52
+ export function initTheme(fallback: Theme = 'system') {
53
+ apply(readSaved() ?? fallback)
54
+ if (started || typeof window === 'undefined') return
55
+ started = true
56
+ // Picked in another tab: follow it here too.
57
+ window.addEventListener('storage', (event) => {
58
+ if (event.key === STORAGE_KEY && isTheme(event.newValue)) apply(event.newValue)
59
+ })
60
+ }
61
+
62
+ /**
63
+ * The current theme and a way to change it, e.g. for ThemeSwitcher. A change
64
+ * applies at once and is remembered in this browser.
65
+ */
66
+ export function useTheme(): { theme: Readonly<Ref<Theme>>; setTheme: (theme: Theme) => void } {
67
+ if (!started) initTheme(isTheme(document.documentElement.dataset.theme) ? document.documentElement.dataset.theme : 'system')
68
+ return {
69
+ theme: readonly(current),
70
+ setTheme(theme: Theme) {
71
+ apply(theme)
72
+ save(theme)
73
+ }
74
+ }
75
+ }
@@ -26,19 +26,72 @@
26
26
 
27
27
  @theme {
28
28
  --font-sans: "Lato", sans-serif;
29
+
30
+ /*
31
+ * Colours
32
+ * -------
33
+ * Each colour holds its light and dark value: light-dark(light, dark). The
34
+ * browser picks one from the element's color-scheme, set by data-theme (see
35
+ * "Dark mode" at the end of this file). Tailwind's shades are named in
36
+ * comments; hex values for native apps are in tokens/README.md.
37
+ *
38
+ * black / white never change. Use them only where the colour must stay the
39
+ * same in both modes: white text on a coloured fill, black text on yellow,
40
+ * the dimmed backdrop behind a Slideover.
41
+ *
42
+ * Everything else uses the colours below:
43
+ * - ink: text, icons, borders and tints, usually with an opacity:
44
+ * text-ink (body text), text-ink/65 (secondary text), border-ink/10
45
+ * (cards, dividers, buttons), border-ink/45 (outlines of form fields,
46
+ * checkboxes and radios: 3:1 contrast, WCAG 1.4.11).
47
+ * - background: the page. surface: cards, fields, header, sidebar.
48
+ * surface-elevated: things that float (popovers, menus, toasts). In dark
49
+ * mode it's a step lighter, as shadows barely show on dark.
50
+ * surface-muted: a solid grey fill, e.g. the "+3" in an AvatarGroup.
51
+ */
29
52
  --color-white: #fafafa;
30
53
  --color-black: #050505;
31
- --color-primary: var(--color-kblue);
54
+ --color-ink: light-dark(#050505, oklch(98.5% 0 0)); /* dark: neutral-50 */
55
+ --color-background: light-dark(oklch(97% 0 0), oklch(14.5% 0 0)); /* neutral-100 / 950 */
56
+ --color-surface: light-dark(#ffffff, oklch(20.5% 0 0)); /* white / neutral-900 */
57
+ --color-surface-elevated: light-dark(#ffffff, oklch(26.9% 0 0)); /* white / neutral-800 */
58
+ --color-surface-muted: light-dark(oklch(92.2% 0 0), oklch(26.9% 0 0)); /* neutral-200 / 800 */
59
+
60
+ /* Brand and status colours as fills: white text on them (black on yellow).
61
+ Dark mode lightens Keston blue (sky-700) so primary buttons, switches and
62
+ checkboxes stand out from the dark page; white text on it still passes. */
32
63
  --color-kblue: #023750;
33
- --color-background: #e1e1e1;
34
- --color-surface: #ebebeb;
35
- --color-surface-elevated: #f2f2f2;
64
+ --color-primary: light-dark(var(--color-kblue), oklch(50% 0.134 242.749)); /* dark: sky-700 */
36
65
  --color-green: #007a16;
37
66
  --color-yellow: #f1c70b;
38
67
  --color-red: #d2042d;
39
68
  --color-blue: #035483;
40
69
  --color-focus: #007fc9;
41
- /* Colours e.g. --color-primary: …; */
70
+
71
+ /* The same colours as text or icons, e.g. text-red-fg for an error message.
72
+ Light: the fill colour, or a darker amber for yellow (yellow text on
73
+ white fails contrast). Dark: lighter shades that pass 4.5:1. */
74
+ --color-primary-fg: light-dark(var(--color-kblue), oklch(82.8% 0.111 230.318)); /* dark: sky-300 */
75
+ --color-green-fg: light-dark(var(--color-green), oklch(79.2% 0.209 151.711)); /* dark: green-400 */
76
+ --color-red-fg: light-dark(var(--color-red), oklch(70.4% 0.191 22.216)); /* dark: red-400 */
77
+ --color-blue-fg: light-dark(var(--color-blue), oklch(80.9% 0.105 251.813)); /* dark: blue-300 */
78
+ --color-yellow-fg: light-dark(oklch(55.4% 0.135 66.442), var(--color-yellow)); /* light: yellow-700 */
79
+
80
+ /*
81
+ * States: one look for hover, press and selection everywhere.
82
+ * - hover / pressed / selected: see-through tints for things with no fill
83
+ * of their own (ghost buttons, menu items, table rows, sidebar items).
84
+ * - surface-hover / surface-pressed: solid, for things filled with surface
85
+ * (basic buttons, the buttons inside fields), so they lighten in dark
86
+ * mode rather than darken.
87
+ * Coloured fills (primary, danger) darken instead: brightness-90 / 80.
88
+ * Disabled is opacity-40. Focus is a 2px outline-focus ring, keyboard only.
89
+ */
90
+ --color-hover: color-mix(in oklab, var(--color-ink) 5%, transparent);
91
+ --color-pressed: color-mix(in oklab, var(--color-ink) 10%, transparent);
92
+ --color-selected: var(--color-pressed);
93
+ --color-surface-hover: color-mix(in oklab, var(--color-surface) 95%, var(--color-ink));
94
+ --color-surface-pressed: color-mix(in oklab, var(--color-surface) 90%, var(--color-ink));
42
95
 
43
96
  /* Radius e.g. --radius-control: …; */
44
97
 
@@ -99,3 +152,62 @@
99
152
  80% { rotate: 4deg; }
100
153
  }
101
154
  }
155
+
156
+ @theme static {
157
+ /*
158
+ * Chart series, for BarChart and LineChart: eight hues in a fixed order,
159
+ * each stepped separately for light and dark. The order is what keeps
160
+ * neighbours apart for colour-blind readers (checked with the data-viz
161
+ * palette validator), so take them in order and never cycle: past eight
162
+ * series, group the rest as "Other". Marks only: chart text uses ink.
163
+ * Slots 3, 4 and 5 are under 3:1 on white in light mode, so every chart
164
+ * keeps its data table.
165
+ *
166
+ * `static`: the charts set these through inline styles, not classes, so
167
+ * Tailwind must output them even when no class uses them.
168
+ */
169
+ --color-chart-1: light-dark(#2a78d6, #3987e5); /* blue */
170
+ --color-chart-2: light-dark(#eb6834, #d95926); /* orange */
171
+ --color-chart-3: light-dark(#1baf7a, #199e70); /* aqua */
172
+ --color-chart-4: light-dark(#eda100, #c98500); /* yellow */
173
+ --color-chart-5: light-dark(#e87ba4, #d55181); /* magenta */
174
+ --color-chart-6: light-dark(#008300, #0ca30c); /* green */
175
+ --color-chart-7: light-dark(#6250d6, #9085e9); /* violet */
176
+ --color-chart-8: light-dark(#e34948, #e66767); /* red */
177
+ }
178
+
179
+ /*
180
+ * Dark mode
181
+ * ---------
182
+ * Opt-in per app, on the <html> element (or any element, for one section):
183
+ *
184
+ * data-theme="light" always light (also the default with no attribute)
185
+ * data-theme="dark" always dark
186
+ * data-theme="system" follows the device setting
187
+ *
188
+ * color-scheme drives every light-dark() colour above, and also the browser's
189
+ * own parts: scrollbars, date pickers, autofill.
190
+ */
191
+ :root,
192
+ [data-theme="light"] {
193
+ color-scheme: light;
194
+ }
195
+ [data-theme="dark"] {
196
+ color-scheme: dark;
197
+ }
198
+ [data-theme="system"] {
199
+ color-scheme: light dark;
200
+ }
201
+
202
+ /* Tailwind's dark: variant follows the same switch, for the rare case a
203
+ colour token can't express (e.g. Tooltip). */
204
+ @custom-variant dark {
205
+ &:where([data-theme="dark"], [data-theme="dark"] *) {
206
+ @slot;
207
+ }
208
+ @media (prefers-color-scheme: dark) {
209
+ &:where([data-theme="system"], [data-theme="system"] *) {
210
+ @slot;
211
+ }
212
+ }
213
+ }