@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
@@ -135,7 +135,7 @@ async function finishClear() {
135
135
  <Bell />
136
136
  <span
137
137
  v-if="unread"
138
- class="absolute top-1 left-1/2 ml-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-red px-1 text-xs leading-none font-bold text-white ring-2 ring-white"
138
+ class="absolute top-1 left-1/2 ml-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-red px-1 text-xs leading-none font-bold text-white ring-2 ring-surface"
139
139
  aria-hidden="true"
140
140
  >
141
141
  {{ countText }}
@@ -144,7 +144,7 @@ async function finishClear() {
144
144
 
145
145
  <template #content="{ close }">
146
146
  <section ref="pane" :aria-labelledby="headingId" class="flex min-h-0 flex-col">
147
- <div class="flex h-11 shrink-0 items-center justify-between gap-2 border-b border-black/15 pr-2 pl-4">
147
+ <div class="flex h-11 shrink-0 items-center justify-between gap-2 border-b border-ink/10 pr-2 pl-4">
148
148
  <h2 :id="headingId" ref="heading" tabindex="-1" class="font-bold outline-none">{{ title }}</h2>
149
149
  <Button v-if="items.length" variant="ghost" size="sm" :disabled="clearing" @click="clearAll">
150
150
  {{ t('ui.notifications.clearAll') }}
@@ -159,7 +159,7 @@ async function finishClear() {
159
159
  :class="cn('min-h-0 overflow-y-auto overscroll-contain [scrollbar-width:thin]', clearing && 'animate-fade-out')"
160
160
  @animationend.self="clearing && finishClear()"
161
161
  >
162
- <li v-for="(item, index) in items" :key="item.id" class="border-b border-black/15 last:border-b-0">
162
+ <li v-for="(item, index) in items" :key="item.id" class="border-b border-ink/10 last:border-b-0">
163
163
  <Notification
164
164
  appearance="row"
165
165
  :type="item.type"
@@ -426,7 +426,7 @@ const positions = {
426
426
  type="button"
427
427
  :class="
428
428
  cn(
429
- 'flex cursor-pointer items-center justify-center overflow-hidden border border-black/15 bg-white font-bold whitespace-nowrap text-black shadow-md hover:bg-surface-elevated',
429
+ 'flex cursor-pointer items-center justify-center overflow-hidden border border-ink/10 bg-surface font-bold whitespace-nowrap text-ink shadow-md hover:bg-surface-hover',
430
430
  'h-7 w-24 rounded-2xl text-xs',
431
431
  hidden && 'in-data-expanded:h-9 in-data-expanded:w-full in-data-expanded:rounded in-data-expanded:text-sm',
432
432
  'transition-[width,height,border-radius,font-size,background-color] duration-300 ease-out motion-reduce:transition-none',
@@ -142,7 +142,7 @@ const overflow = computed<MenuItem[]>(() => (props.toolbar ?? []).slice(shown.va
142
142
  <h1 :class="cn('min-w-0 text-2xl font-bold break-words', ui?.title)">{{ title }}</h1>
143
143
  <slot name="badge" />
144
144
  </div>
145
- <p v-if="description || $slots.description" :class="cn('max-w-prose text-sm text-black/65', ui?.description)">
145
+ <p v-if="description || $slots.description" :class="cn('max-w-prose text-sm text-ink/65', ui?.description)">
146
146
  <slot name="description">{{ description }}</slot>
147
147
  </p>
148
148
  </div>
@@ -158,7 +158,7 @@ const overflow = computed<MenuItem[]>(() => (props.toolbar ?? []).slice(shown.va
158
158
  v-if="hasToolbar"
159
159
  role="group"
160
160
  :aria-label="t('ui.pageHeader.actions', { title })"
161
- :class="cn('flex items-center gap-1 rounded-lg border border-black/15 bg-white p-1', ui?.toolbar)"
161
+ :class="cn('flex items-center gap-1 rounded-lg border border-ink/10 bg-surface p-1 shadow-xs', ui?.toolbar)"
162
162
  >
163
163
  <!-- Text here reads as the toolbar's own: bold, spaced like a button. -->
164
164
  <div v-if="$slots['toolbar-start']" class="flex shrink-0 items-center gap-2 px-3 text-sm font-bold" aria-live="polite">
@@ -67,7 +67,7 @@ export const Hover: Story = {
67
67
  setup: () => ({ args }),
68
68
  template: `
69
69
  <Popover v-bind="args">
70
- <button type="button" aria-label="About attendance codes" class="inline-flex rounded-full p-1 transition hover:bg-black/10 [&_svg]:size-4">
70
+ <button type="button" aria-label="About attendance codes" class="inline-flex rounded-full p-1 transition hover:bg-hover [&_svg]:size-4">
71
71
  <CircleHelp />
72
72
  </button>
73
73
  <template #content>
@@ -107,7 +107,7 @@ export const NotDismissible: Story = {
107
107
  <template #content="{ close }">
108
108
  <div class="flex w-64 flex-col gap-3 p-3 text-sm">
109
109
  <p>Only the button below closes this.</p>
110
- <p class="text-black/60">Blocked close attempts: {{ attempts }}</p>
110
+ <p class="text-ink/60">Blocked close attempts: {{ attempts }}</p>
111
111
  <Button size="sm" @click="close">Close</Button>
112
112
  </div>
113
113
  </template>
@@ -2,12 +2,13 @@
2
2
  * The shared look of floating panels: Popover, and anything else built on
3
3
  * Reka's popper (e.g. InputDate's calendar), so they all match.
4
4
  *
5
- * White panel with the same border and radius as a basic Button, a shadow,
5
+ * An elevated panel (white; a step lighter than the page in dark mode) with
6
+ * the same border and radius as a basic Button, a shadow,
6
7
  * and the theme's fade in / out (Reka waits for the fade-out to finish
7
8
  * before removing the panel).
8
9
  */
9
10
  export const popoverContent = [
10
- 'z-50 rounded border border-black/15 bg-white text-black shadow-md outline-none',
11
+ 'z-50 rounded border border-ink/10 bg-surface-elevated text-ink shadow-md outline-none',
11
12
  'data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out'
12
13
  ]
13
14
 
@@ -17,4 +18,4 @@ export const popoverContent = [
17
18
  * covers the panel's border where they meet. Reka rotates the arrow's wrapper
18
19
  * for each side, so this only needs drawing pointing down.
19
20
  */
20
- export const popoverArrow = 'block size-2.5 -translate-y-1/2 rotate-45 border-r border-b border-black/15 bg-white'
21
+ export const popoverArrow = 'block size-2.5 -translate-y-1/2 rotate-45 border-r border-b border-ink/10 bg-surface-elevated'
@@ -72,3 +72,21 @@ export const Stepping: Story = {
72
72
  </div>`,
73
73
  }),
74
74
  };
75
+
76
+ /**
77
+ * Going back: with `segmentLabels`, each finished segment before the current
78
+ * one is a button ("Back to step 1: Name") that emits `select`. Steps ahead
79
+ * can't be picked. Slideover's multi-step form uses this.
80
+ */
81
+ export const GoBack: Story = {
82
+ render: () => ({
83
+ components: { Progress, Button },
84
+ setup: () => ({ step: ref(3), names: ["Name", "Date of birth", "Contact", "Check and add"] }),
85
+ template: `
86
+ <div class="flex flex-col gap-3">
87
+ <Progress label="Add a student" segments :value="step" :max="4" :segment-labels="names" @select="step = $event + 1" />
88
+ <p class="text-sm">Step {{ step }}: {{ names[step - 1] }}</p>
89
+ <Button size="sm" class="self-start" :disabled="step === 4" @click="step++">Next</Button>
90
+ </div>`,
91
+ }),
92
+ };
@@ -11,6 +11,11 @@ import { cn } from '../../lib/cn'
11
11
  * steps filled out of `max`);
12
12
  * - indeterminate, when there's no telling how long it'll take (no `value`).
13
13
  * Built on Reka UI's Progress, so it's announced as a progress bar.
14
+ *
15
+ * Segments can take you back: give `segmentLabels` (one name per segment) and
16
+ * the finished segments before the current one become buttons ("Back to step
17
+ * 1: Name") that emit `select` with the segment's index, from 0. Steps ahead
18
+ * can't be picked, so each step's checks still run in order.
14
19
  */
15
20
  export interface ProgressProps {
16
21
  /** Done so far, out of `max`. Leave it out (or null) for indeterminate. */
@@ -21,6 +26,10 @@ export interface ProgressProps {
21
26
  segments?: boolean
22
27
  /** What's progressing, e.g. "Uploading report.pdf". Its accessible name; not shown. */
23
28
  label: string
29
+ /** With `segments`: a name per segment. Finished segments become buttons that emit `select`. */
30
+ segmentLabels?: string[]
31
+ /** Stops the segment buttons working, e.g. while a step is saving. */
32
+ disabled?: boolean
24
33
  class?: HTMLAttributes['class']
25
34
  }
26
35
 
@@ -30,6 +39,11 @@ const props = withDefaults(defineProps<ProgressProps>(), {
30
39
  max: 100
31
40
  })
32
41
 
42
+ const emit = defineEmits<{
43
+ /** A finished segment was pressed: its index, from 0. */
44
+ select: [index: number]
45
+ }>()
46
+
33
47
  const indeterminate = computed(() => props.value === null || props.value === undefined)
34
48
  const clamped = computed(() => Math.min(Math.max(props.value ?? 0, 0), props.max))
35
49
  const percent = computed(() => (clamped.value / props.max) * 100)
@@ -43,13 +57,56 @@ const valueText = () =>
43
57
  ? t('ui.progress.stepOf', { current: clamped.value, total: props.max })
44
58
  : `${Math.round(percent.value)}%`
45
59
 
46
- const track = 'h-1.5 overflow-hidden rounded-full bg-black/10'
60
+ const track = 'h-1.5 overflow-hidden rounded-full bg-ink/10'
47
61
  // Filling and segments colouring in ease over 300ms.
48
62
  const fill = 'h-full rounded-full bg-primary transition-[translate,background-color] duration-300 ease-out motion-reduce:transition-none'
63
+
64
+ // Segment buttons sit over the bar, not inside it: a progress bar's contents
65
+ // are hidden from screen readers. Each is 24px tall (WCAG 2.5.8 target size)
66
+ // around a 6px segment; hover and press darken the segment, focus rings it.
67
+ const navigable = computed(() => props.segments && !indeterminate.value && !!props.segmentLabels?.length)
68
+ const segmentButton = [
69
+ 'flex h-6 flex-1 cursor-pointer items-center rounded-sm',
70
+ 'outline-2 outline-offset-0 outline-transparent focus-visible:outline-focus',
71
+ 'not-disabled:hover:[&>span]:bg-black/20 not-disabled:active:[&>span]:bg-black/35',
72
+ 'disabled:cursor-not-allowed'
73
+ ]
74
+ const segmentShade = 'h-1.5 w-full rounded-full transition-colors'
49
75
  </script>
50
76
 
51
77
  <template>
78
+ <div v-if="navigable" :class="cn('relative', props.class)">
79
+ <ProgressRoot
80
+ :model-value="clamped"
81
+ :max="max"
82
+ :get-value-label="() => label"
83
+ :get-value-text="valueText"
84
+ class="flex gap-1"
85
+ >
86
+ <div v-for="i in max" :key="i" :class="cn(track, 'flex-1')">
87
+ <div :class="cn(fill, i <= clamped ? 'translate-x-0' : '-translate-x-full')" />
88
+ </div>
89
+ </ProgressRoot>
90
+ <!-- Over the bar: a button for each finished segment, a spacer for the rest. -->
91
+ <div class="absolute inset-x-0 top-1/2 flex -translate-y-1/2 gap-1">
92
+ <template v-for="i in max" :key="i">
93
+ <button
94
+ v-if="i < clamped"
95
+ type="button"
96
+ data-progress-segment
97
+ :class="segmentButton"
98
+ :disabled="disabled"
99
+ :aria-label="t('ui.progress.backTo', { current: i, name: segmentLabels![i - 1] })"
100
+ @click="emit('select', i - 1)"
101
+ >
102
+ <span :class="segmentShade" />
103
+ </button>
104
+ <span v-else class="flex-1" />
105
+ </template>
106
+ </div>
107
+ </div>
52
108
  <ProgressRoot
109
+ v-else
53
110
  :model-value="indeterminate ? null : clamped"
54
111
  :max="max"
55
112
  :get-value-label="() => label"
@@ -68,22 +68,22 @@ function pressControl(event: MouseEvent, id: string) {
68
68
  // 16px circle, level with the first line of the label; the chosen one gets a
69
69
  // dot. The border is darker than a text box's so each circle is easy to see.
70
70
  const circle = [
71
- 'mt-0.5 flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full border bg-white transition',
72
- 'not-disabled:hover:border-black disabled:cursor-not-allowed',
71
+ 'mt-0.5 flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full border bg-surface transition',
72
+ 'not-disabled:hover:border-ink disabled:cursor-not-allowed',
73
73
  'data-[state=checked]:border-primary data-[state=checked]:hover:border-primary',
74
74
  'outline-2 outline-offset-2 outline-transparent focus-visible:outline-focus'
75
75
  ]
76
76
  </script>
77
77
 
78
78
  <template>
79
- <div :class="cn('flex flex-col gap-1.5 text-black', disabled && 'opacity-40', props.class)">
79
+ <div :data-disabled="disabled || undefined" :class="cn('flex flex-col gap-1.5 text-ink', disabled && 'opacity-40', props.class)">
80
80
  <div class="flex flex-col gap-0.5">
81
81
  <div class="flex items-center gap-1">
82
82
  <span :id="labelId" class="text-sm">{{ label }}</span>
83
83
  <InfoTip v-if="helper && helperPlacement === 'icon'" :text="helper" :label="t('ui.formField.about', { label })" />
84
84
  </div>
85
85
  <!-- Behind the ?: hidden, but still the group's description. -->
86
- <p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-black/65">
86
+ <p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-ink/65">
87
87
  {{ helper }}
88
88
  </p>
89
89
  </div>
@@ -98,13 +98,13 @@ const circle = [
98
98
  :aria-invalid="errorText ? true : undefined"
99
99
  class="flex flex-col gap-2"
100
100
  >
101
- <div v-for="(option, i) in options" :key="String(option.value)" class="flex items-start gap-2">
101
+ <div v-for="(option, i) in options" :key="String(option.value)" :data-disabled="option.disabled || undefined" class="flex items-start gap-2">
102
102
  <RadioGroupItem
103
103
  :id="`${id}-${i}`"
104
104
  :value="option.value"
105
105
  :disabled="option.disabled"
106
106
  :aria-describedby="option.description ? `${id}-${i}-description` : undefined"
107
- :class="cn(circle, errorText ? 'border-red' : 'border-black/55', option.disabled && !disabled && 'opacity-40')"
107
+ :class="cn(circle, errorText ? 'border-red' : 'border-ink/45', option.disabled && !disabled && 'opacity-40')"
108
108
  >
109
109
  <RadioGroupIndicator class="size-2 rounded-full bg-primary" />
110
110
  </RadioGroupItem>
@@ -122,7 +122,7 @@ const circle = [
122
122
  >
123
123
  {{ option.label }}
124
124
  </label>
125
- <p v-if="option.description" :id="`${id}-${i}-description`" class="text-xs text-black/65">
125
+ <p v-if="option.description" :id="`${id}-${i}-description`" class="text-xs text-ink/65">
126
126
  {{ option.description }}
127
127
  </p>
128
128
  </div>
@@ -61,7 +61,7 @@ export const Ages: Story = {
61
61
  },
62
62
  template: `
63
63
  <table class="text-left">
64
- <thead class="text-black/65"><tr><th class="pr-8 pb-2 font-bold">Student</th><th class="pb-2 text-right font-bold">Age</th></tr></thead>
64
+ <thead class="text-ink/65"><tr><th class="pr-8 pb-2 font-bold">Student</th><th class="pb-2 text-right font-bold">Age</th></tr></thead>
65
65
  <tbody>
66
66
  <tr v-for="s in students" :key="s.name">
67
67
  <td class="py-1 pr-8">{{ s.name }}</td>
@@ -31,7 +31,7 @@ const meta = {
31
31
  },
32
32
  template: `
33
33
  <Select v-bind="args" v-model="value" />
34
- <p class="mt-4 text-xs text-black/65">Value: {{ value === undefined ? "undefined" : JSON.stringify(value) }}</p>`,
34
+ <p class="mt-4 text-xs text-ink/65">Value: {{ value === undefined ? "undefined" : JSON.stringify(value) }}</p>`,
35
35
  }),
36
36
  } satisfies Meta<typeof Select>;
37
37
 
@@ -399,7 +399,10 @@ const parts = computed(() =>
399
399
  // The trigger (or the search box's anchor) fills FormField's box: negative
400
400
  // margins cancel its padding, so the whole box opens the list. The box draws
401
401
  // the border and focus ring.
402
- const fill = '-mx-3 -my-2 flex min-w-0 flex-1 items-center gap-2 self-stretch px-3 py-2'
402
+ //
403
+ // Anything that isn't text sits as far from the side as from the top and
404
+ // bottom: icons and the chevron 10px (like FormField), chips 8px.
405
+ const fill = '-mx-3 -my-2 flex min-w-0 flex-1 items-center gap-2 self-stretch px-3 py-2 [&>svg:first-child]:-ml-0.5 [&>svg:last-child]:-mr-0.5'
403
406
 
404
407
  // The list is at least as wide as the field and no taller than the space
405
408
  // below / above it; it scrolls inside.
@@ -411,12 +414,13 @@ const content = computed(() => cn(
411
414
  : 'max-h-(--reka-select-content-available-height) min-w-(--reka-select-trigger-width) max-w-[max(var(--reka-select-trigger-width),--spacing(80))]'
412
415
  ))
413
416
 
414
- // Compact rows: 32px tall with a label only (6px + 20px line + 6px), 8px
415
- // either side, tinted like a ghost Button. A description adds lines below;
417
+ // Compact rows: 32px tall with a label only (6px + 20px line + 6px), running
418
+ // the full width of the panel and square (the panel keeps its rounded
419
+ // corners), text 12px from the edge, tinted when highlighted. A description adds lines below;
416
420
  // the icon and tick stay level with the label (h-5 slots, top-aligned).
417
421
  const item = [
418
- 'relative flex min-h-8 cursor-pointer items-start gap-2 rounded px-2 py-1.5 text-sm outline-none select-none',
419
- 'data-highlighted:bg-black/10',
422
+ 'relative flex min-h-8 cursor-pointer items-start gap-2 px-3 py-1.5 text-sm outline-none select-none',
423
+ 'data-highlighted:bg-selected',
420
424
  'data-disabled:cursor-not-allowed data-disabled:opacity-40'
421
425
  ]
422
426
 
@@ -424,8 +428,10 @@ const item = [
424
428
  const searchText = (row: Row) =>
425
429
  props.searchable ? [row.option.label, row.option.description, row.path].filter(Boolean).join(' ') : row.option.label
426
430
 
427
- // Turns over while the list is open.
428
- const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-180 motion-reduce:transition-none'
431
+ // Turns over while this list is open. A named group on the trigger, so a
432
+ // Select inside something else that's open (e.g. the account menu) doesn't
433
+ // turn over with it.
434
+ const chevron = 'transition-transform duration-150 group-data-[state=open]/select:rotate-180 motion-reduce:transition-none'
429
435
  </script>
430
436
 
431
437
  <template>
@@ -471,7 +477,7 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
471
477
  <!-- Multiple: a chip per chosen option, then the search box, wrapping
472
478
  onto more lines as needed. × removes one (mouse); keyboard users
473
479
  press Backspace in the empty box, or untick it in the list. -->
474
- <span :class="multiple ? 'flex min-w-0 flex-1 flex-wrap items-center gap-1' : 'contents'">
480
+ <span :class="multiple ? cn('flex min-w-0 flex-1 flex-wrap items-center gap-1', chosen.length && '-ml-1') : 'contents'">
475
481
  <!-- pointerdown.stop keeps a press on × from opening the list. -->
476
482
  <Chip
477
483
  v-for="option in chosen"
@@ -496,7 +502,7 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
496
502
  :aria-invalid="invalid"
497
503
  :aria-describedby="describedBy"
498
504
  autocomplete="off"
499
- :class="cn('h-5 min-w-0 flex-1 bg-transparent outline-none placeholder:text-black/55 disabled:cursor-not-allowed', multiple && 'min-w-16')"
505
+ :class="cn('h-5 min-w-0 flex-1 bg-transparent outline-none placeholder:text-ink/55 disabled:cursor-not-allowed', multiple && 'min-w-16')"
500
506
  :data-pointer-focus="pointerFocus || undefined"
501
507
  @focus="onSearchFocus"
502
508
  @blur="pointerFocus = false"
@@ -504,7 +510,7 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
504
510
  @keydown.backspace="onSearchBackspace"
505
511
  />
506
512
  </span>
507
- <ComboboxTrigger tabindex="-1" :aria-label="t('ui.select.showOptions')" class="flex cursor-pointer disabled:cursor-not-allowed">
513
+ <ComboboxTrigger tabindex="-1" :aria-label="t('ui.select.showOptions')" class="group/select -mr-0.5 flex cursor-pointer disabled:cursor-not-allowed">
508
514
  <ChevronDown aria-hidden="true" :class="chevron" />
509
515
  </ComboboxTrigger>
510
516
  </ComboboxAnchor>
@@ -517,7 +523,7 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
517
523
  :aria-describedby="describedBy"
518
524
  :data-pointer-focus="pointerFocus || undefined"
519
525
  @blur="pointerFocus = false"
520
- :class="cn(fill, 'cursor-pointer text-left outline-none disabled:cursor-not-allowed data-placeholder:text-black/55')"
526
+ :class="cn(fill, 'group/select cursor-pointer text-left outline-none disabled:cursor-not-allowed data-placeholder:text-ink/55')"
521
527
  >
522
528
  <slot name="leading">
523
529
  <component :is="selected.icon" v-if="selected?.icon" aria-hidden="true" />
@@ -526,7 +532,7 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
526
532
  SelectValue, which only knows the options currently showing (a
527
533
  nested choice isn't, once the list is back at the top). -->
528
534
  <!-- Multiple: a chip per chosen option, wrapping onto more lines. -->
529
- <span v-if="multiple && chosen.length" class="flex min-w-0 flex-1 flex-wrap gap-1">
535
+ <span v-if="multiple && chosen.length" class="-ml-1 flex min-w-0 flex-1 flex-wrap gap-1">
530
536
  <Chip v-for="option in chosen" :key="String(option.value)" size="sm">
531
537
  <template v-if="option.icon" #leading><component :is="option.icon" aria-hidden="true" /></template>
532
538
  {{ option.label }}
@@ -553,9 +559,9 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
553
559
  one so long lists look scrollable. -->
554
560
  <component
555
561
  :is="parts.Viewport"
556
- class="flex flex-col gap-0.5 p-1 [scrollbar-width:thin]! [&::-webkit-scrollbar]:block!"
562
+ class="flex flex-col py-1 [scrollbar-width:thin]! [&::-webkit-scrollbar]:block!"
557
563
  >
558
- <ComboboxEmpty v-if="searchable" class="px-2 py-1.5 text-sm text-black/65">
564
+ <ComboboxEmpty v-if="searchable" class="px-3 py-1.5 text-sm text-ink/65">
559
565
  {{ emptyText ?? t('ui.select.noMatches') }}
560
566
  </ComboboxEmpty>
561
567
 
@@ -575,20 +581,20 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
575
581
  <!-- Names the level being shown; pressing it goes up one. -->
576
582
  <span class="min-w-0 flex-1 truncate"><span class="sr-only">Back from </span>{{ current!.label }}</span>
577
583
  </component>
578
- <component :is="parts.Separator" class="-mx-1 my-0.5 border-t border-black/15" />
584
+ <component :is="parts.Separator" class="my-1 border-t border-ink/10" />
579
585
  </template>
580
586
 
581
587
  <template v-for="(group, g) in shownGroups" :key="g">
582
588
  <component
583
589
  :is="parts.Separator"
584
590
  v-if="g > 0 && !search"
585
- class="-mx-1 my-0.5 border-t border-black/15"
591
+ class="my-1 border-t border-ink/10"
586
592
  />
587
- <component :is="parts.Group" class="flex flex-col gap-0.5">
593
+ <component :is="parts.Group" class="flex flex-col">
588
594
  <component
589
595
  :is="parts.Label"
590
596
  v-if="group.label"
591
- class="flex h-6 items-center gap-1.5 px-2 text-xs font-bold text-black/65 uppercase"
597
+ class="flex h-6 items-center gap-1.5 px-3 text-xs font-bold text-ink/65 uppercase"
592
598
  >
593
599
  <component :is="group.icon" v-if="group.icon" aria-hidden="true" class="size-3.5 shrink-0" />
594
600
  <span class="truncate">{{ group.label }}</span>
@@ -613,8 +619,8 @@ const chevron = 'transition-transform duration-150 in-data-[state=open]:rotate-1
613
619
  <component :is="parts.ItemText" class="truncate in-data-[state=checked]:font-bold">
614
620
  {{ row.option.label }}<span v-if="row.parent" class="sr-only">, more options</span>
615
621
  </component>
616
- <span v-if="row.path" class="text-xs text-black/65">{{ row.path }}</span>
617
- <span v-if="row.option.description" class="text-xs text-black/65">{{ row.option.description }}</span>
622
+ <span v-if="row.path" class="text-xs text-ink/65">{{ row.path }}</span>
623
+ <span v-if="row.option.description" class="text-xs text-ink/65">{{ row.option.description }}</span>
618
624
  </span>
619
625
  <!-- Parents: an arrow into their options. Others: the tick's
620
626
  space, reserved on every row so labels don't shift. -->
@@ -30,7 +30,7 @@ defineSlots<{
30
30
  <div class="flex min-w-0 flex-col gap-0.5">
31
31
  <!-- The control has this name too (hide-label), so it isn't read twice. -->
32
32
  <p class="text-sm" aria-hidden="true">{{ label }}</p>
33
- <p v-if="description" class="text-xs text-black/65">{{ description }}</p>
33
+ <p v-if="description" class="text-xs text-ink/65">{{ description }}</p>
34
34
  </div>
35
35
  <div class="w-full shrink-0 sm:w-80">
36
36
  <slot />
@@ -116,10 +116,10 @@ export const WithFooter: Story = {
116
116
  <template #header="{ collapsed }">${Logo}</template>
117
117
  <template #footer>
118
118
  <div class="flex items-center gap-3 px-3 py-2 text-sm">
119
- <span class="flex size-7 shrink-0 items-center justify-center rounded-full bg-black/10 text-xs font-bold" aria-hidden="true">BS</span>
119
+ <span class="flex size-7 shrink-0 items-center justify-center rounded-full bg-ink/10 text-xs font-bold" aria-hidden="true">BS</span>
120
120
  <span class="flex min-w-0 flex-col">
121
121
  <span class="truncate font-bold">Ben Smith</span>
122
- <span class="truncate text-xs text-black/65">Head of Year 9</span>
122
+ <span class="truncate text-xs text-ink/65">Head of Year 9</span>
123
123
  </span>
124
124
  </div>
125
125
  </template>
@@ -247,22 +247,22 @@ const itemBase = [
247
247
  // Inset, so the ring isn't clipped by the scrolling body.
248
248
  'outline-2 -outline-offset-2 outline-transparent forced-colors:not-focus-visible:outline-0',
249
249
  'focus-visible:outline-focus',
250
- 'not-aria-disabled:not-disabled:hover:bg-black/10 not-aria-disabled:not-disabled:active:bg-black/15',
250
+ 'not-aria-disabled:not-disabled:hover:bg-hover not-aria-disabled:not-disabled:active:bg-pressed',
251
251
  'disabled:cursor-not-allowed disabled:opacity-40 aria-disabled:cursor-not-allowed aria-disabled:opacity-40'
252
252
  ]
253
253
 
254
- const itemActive = 'bg-primary/10 font-bold text-primary not-aria-disabled:not-disabled:hover:bg-primary/15'
254
+ const itemActive = 'bg-primary/10 font-bold text-primary-fg not-aria-disabled:not-disabled:hover:bg-primary/15'
255
255
 
256
256
  // A parent of the current page: bold primary text, no fill, so it reads as
257
257
  // "you are in here" without looking like the page itself.
258
- const itemActiveParent = 'font-bold text-primary'
258
+ const itemActiveParent = 'font-bold text-primary-fg'
259
259
  </script>
260
260
 
261
261
  <template>
262
262
  <aside
263
263
  :data-collapsed="collapsed || undefined"
264
264
  :class="cn(
265
- 'flex h-full shrink-0 flex-col border-r border-black/15 bg-white text-black',
265
+ 'flex h-full shrink-0 flex-col border-r border-ink/10 bg-surface text-ink',
266
266
  'w-64 transition-[width] duration-300 ease-out motion-reduce:transition-none',
267
267
  collapsed && 'w-14',
268
268
  props.class
@@ -270,7 +270,7 @@ const itemActiveParent = 'font-bold text-primary'
270
270
  >
271
271
  <div
272
272
  v-if="$slots.header"
273
- :class="cn('flex h-12 shrink-0 items-center gap-2 overflow-hidden border-b border-black/15 px-4', ui?.header)"
273
+ :class="cn('flex h-12 shrink-0 items-center gap-2 overflow-hidden border-b border-ink/10 px-4', ui?.header)"
274
274
  >
275
275
  <slot name="header" :collapsed="collapsed" />
276
276
  </div>
@@ -290,7 +290,7 @@ const itemActiveParent = 'font-bold text-primary'
290
290
  <div :key="levelKey" :data-level="levelKey" class="flex flex-col gap-4">
291
291
  <!-- Inside a nested item: ‹ and its label, back to the level above.
292
292
  The divider under it keeps the list's gap-4 rhythm with sections. -->
293
- <div v-if="current" class="-mb-2 flex flex-col gap-1 border-b border-black/15 pb-2">
293
+ <div v-if="current" class="-mb-2 flex flex-col gap-1 border-b border-ink/10 pb-2">
294
294
  <button
295
295
  type="button"
296
296
  data-back
@@ -311,13 +311,13 @@ const itemActiveParent = 'font-bold text-primary'
311
311
  <div v-if="section.label" class="relative flex h-6 items-center px-3">
312
312
  <div
313
313
  :id="`${uid}-section-${s}`"
314
- :class="cn('truncate text-xs font-bold text-black/65 uppercase', fade, collapsed && 'opacity-0')"
314
+ :class="cn('truncate text-xs font-bold text-ink/65 uppercase', fade, collapsed && 'opacity-0')"
315
315
  >
316
316
  {{ section.label }}
317
317
  </div>
318
318
  <div
319
319
  aria-hidden="true"
320
- :class="cn('absolute inset-x-2 top-1/2 border-t border-black/15', fade, !collapsed && 'opacity-0')"
320
+ :class="cn('absolute inset-x-2 top-1/2 border-t border-ink/10', fade, !collapsed && 'opacity-0')"
321
321
  />
322
322
  </div>
323
323
 
@@ -363,7 +363,7 @@ const itemActiveParent = 'font-bold text-primary'
363
363
 
364
364
  <div
365
365
  v-if="$slots.footer || collapsible"
366
- :class="cn('flex shrink-0 flex-col gap-1 overflow-hidden border-t border-black/15 p-2', ui?.footer)"
366
+ :class="cn('flex shrink-0 flex-col gap-1 overflow-hidden border-t border-ink/10 p-2', ui?.footer)"
367
367
  >
368
368
  <slot name="footer" :collapsed="collapsed" />
369
369
  <Button
@@ -32,7 +32,7 @@ const meta = {
32
32
  <Slideover v-bind="args">
33
33
  <Button>Open slideover</Button>
34
34
  <template #body>
35
- <p class="text-sm text-black/65">Nothing new.</p>
35
+ <p class="text-sm text-ink/65">Nothing new.</p>
36
36
  </template>
37
37
  </Slideover>`,
38
38
  }),
@@ -160,7 +160,7 @@ export const Sides: Story = {
160
160
  <div class="flex gap-2">
161
161
  <Slideover v-for="side in ['right', 'left', 'top', 'bottom']" :key="side" v-bind="args" :side="side" :title="'From the ' + side">
162
162
  <Button>{{ side }}</Button>
163
- <template #body><p class="text-sm text-black/65">Slides in from the {{ side }}.</p></template>
163
+ <template #body><p class="text-sm text-ink/65">Slides in from the {{ side }}.</p></template>
164
164
  </Slideover>
165
165
  </div>`,
166
166
  }),
@@ -177,7 +177,7 @@ export const LongContent: Story = {
177
177
  <Button>Open log</Button>
178
178
  <template #body>
179
179
  <ul class="flex flex-col gap-3 text-sm">
180
- <li v-for="n in 40" :key="n" class="rounded border border-black/15 p-3">Entry {{ n }}</li>
180
+ <li v-for="n in 40" :key="n" class="rounded border border-ink/10 p-3">Entry {{ n }}</li>
181
181
  </ul>
182
182
  </template>
183
183
  <template #footer="{ close }"><Button @click="close">Done</Button></template>
@@ -197,7 +197,7 @@ export const NotDismissible: Story = {
197
197
  template: `
198
198
  <Slideover v-bind="args" @close:prevent="attempts++">
199
199
  <Button>Open</Button>
200
- <template #body><p class="text-sm text-black/65">Blocked close attempts: {{ attempts }}</p></template>
200
+ <template #body><p class="text-sm text-ink/65">Blocked close attempts: {{ attempts }}</p></template>
201
201
  <template #footer="{ close }">
202
202
  <Button @click="close">Discard</Button>
203
203
  <Button variant="primary" @click="close">Save</Button>
@@ -218,7 +218,7 @@ export const Controlled: Story = {
218
218
  <div>
219
219
  <Button variant="primary" @click="open = true">Open from code</Button>
220
220
  <Slideover v-bind="args" v-model:open="open">
221
- <template #body><p class="text-sm text-black/65">Opened with v-model:open.</p></template>
221
+ <template #body><p class="text-sm text-ink/65">Opened with v-model:open.</p></template>
222
222
  </Slideover>
223
223
  </div>`,
224
224
  }),