@thekestongroup/ui 0.16.0 → 0.19.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 (51) hide show
  1. package/dist/components/ActionList/ActionList.vue.d.ts +13 -2
  2. package/dist/components/AppLauncher/AppLauncher.vue.d.ts +8 -0
  3. package/dist/components/AsyncState/AsyncState.vue.d.ts +53 -0
  4. package/dist/components/ConfirmDialog/ConfirmDialog.vue.d.ts +62 -0
  5. package/dist/components/Footer/Footer.vue.d.ts +2 -2
  6. package/dist/components/Header/Header.vue.d.ts +19 -1
  7. package/dist/components/InputRichText/InputRichText.vue.d.ts +12 -6
  8. package/dist/components/Prose/Prose.vue.d.ts +36 -0
  9. package/dist/components/ResultState/ResultState.vue.d.ts +48 -0
  10. package/dist/components/SegmentedControl/SegmentedControl.vue.d.ts +50 -0
  11. package/dist/components/Steps/Steps.vue.d.ts +16 -5
  12. package/dist/components/ThemeSwitcher/ThemeSwitcher.vue.d.ts +8 -1
  13. package/dist/i18n/en.d.ts +17 -0
  14. package/dist/index.d.ts +11 -1
  15. package/dist/keston-ui.js +2305 -1773
  16. package/dist/lib/initials.d.ts +6 -1
  17. package/package.json +3 -1
  18. package/src/components/ActionList/ActionList.stories.ts +34 -1
  19. package/src/components/ActionList/ActionList.vue +27 -5
  20. package/src/components/AppLauncher/AppLauncher.vue +22 -1
  21. package/src/components/AppLauncher/apps.ts +2 -2
  22. package/src/components/AppShell/AppShell.vue +2 -1
  23. package/src/components/AsyncState/AsyncState.stories.ts +46 -0
  24. package/src/components/AsyncState/AsyncState.vue +78 -0
  25. package/src/components/Button/Button.vue +4 -4
  26. package/src/components/ConfirmDialog/ConfirmDialog.stories.ts +54 -0
  27. package/src/components/ConfirmDialog/ConfirmDialog.vue +119 -0
  28. package/src/components/Footer/Footer.stories.ts +3 -3
  29. package/src/components/Footer/Footer.vue +5 -4
  30. package/src/components/Footer/footer.test.ts +2 -2
  31. package/src/components/Footer/links.ts +3 -3
  32. package/src/components/FormField/FormField.vue +5 -1
  33. package/src/components/Header/Header.stories.ts +25 -12
  34. package/src/components/Header/Header.vue +38 -4
  35. package/src/components/InputRichText/InputRichText.stories.ts +19 -0
  36. package/src/components/InputRichText/InputRichText.vue +129 -13
  37. package/src/components/Notification/Toaster.vue +3 -1
  38. package/src/components/Prose/Prose.stories.ts +46 -0
  39. package/src/components/Prose/Prose.vue +54 -0
  40. package/src/components/ResultState/ResultState.stories.ts +44 -0
  41. package/src/components/ResultState/ResultState.vue +76 -0
  42. package/src/components/SegmentedControl/SegmentedControl.stories.ts +57 -0
  43. package/src/components/SegmentedControl/SegmentedControl.vue +93 -0
  44. package/src/components/Steps/Steps.stories.ts +18 -0
  45. package/src/components/Steps/Steps.vue +28 -8
  46. package/src/components/ThemeSwitcher/ThemeSwitcher.vue +24 -2
  47. package/src/i18n/en.ts +13 -3
  48. package/src/index.ts +11 -1
  49. package/src/lib/initials.test.ts +19 -0
  50. package/src/lib/initials.ts +12 -3
  51. package/src/styles/theme.css +25 -2
@@ -0,0 +1,93 @@
1
+ <script setup lang="ts">
2
+ import { computed, useId, type Component, type HTMLAttributes } from 'vue'
3
+ import { RadioGroupItem, RadioGroupRoot } from 'reka-ui'
4
+ import { cn } from '../../lib/cn'
5
+
6
+ /**
7
+ * One choice from two to four short options, shown as a row of tab-like
8
+ * buttons, e.g. Light / Dark / System. It's a radio group: arrow keys move
9
+ * the choice, and it applies at once. Smaller than a Select and shows every
10
+ * option, so it suits settings that sit in a toolbar or footer.
11
+ *
12
+ * For a choice that changes what's on the page below (sections), use Tabs.
13
+ * For longer options or ones with descriptions, use RadioGroup.
14
+ */
15
+ export type SegmentedValue = string | number
16
+
17
+ export interface SegmentedOption {
18
+ label: string
19
+ value: SegmentedValue
20
+ /** An icon before the label (decorative). */
21
+ icon?: Component
22
+ disabled?: boolean
23
+ }
24
+
25
+ export interface SegmentedControlProps {
26
+ /** What's being chosen, e.g. "Appearance". The group's accessible name. */
27
+ label: string
28
+ /** Keep the label for screen readers only. */
29
+ hideLabel?: boolean
30
+ options: SegmentedOption[]
31
+ /**
32
+ * Icons only: each option's label becomes its accessible name and shows
33
+ * as a tooltip-style title. Every option needs an icon.
34
+ */
35
+ iconOnly?: boolean
36
+ size?: 'sm' | 'md'
37
+ disabled?: boolean
38
+ /** Name for native form submission. */
39
+ name?: string
40
+ class?: HTMLAttributes['class']
41
+ }
42
+
43
+ const props = withDefaults(defineProps<SegmentedControlProps>(), { size: 'md' })
44
+
45
+ /** The chosen option's value. */
46
+ const model = defineModel<SegmentedValue | undefined>()
47
+
48
+ const labelId = `${useId()}-label`
49
+
50
+ const sizes = {
51
+ sm: { item: 'h-7 px-2.5 text-xs gap-1.5 [&_svg]:size-3.5', icon: 'size-7' },
52
+ md: { item: 'h-8 px-3 text-sm gap-2 [&_svg]:size-4', icon: 'size-8' }
53
+ }
54
+ const itemSize = computed(() => (props.iconOnly ? `${sizes[props.size].icon} justify-center [&_svg]:size-4` : sizes[props.size].item))
55
+ </script>
56
+
57
+ <template>
58
+ <div :class="cn('inline-flex flex-col gap-1.5', props.class)">
59
+ <span :id="labelId" :class="hideLabel ? 'sr-only' : 'text-sm font-bold text-ink'">{{ label }}</span>
60
+ <RadioGroupRoot
61
+ v-model="model"
62
+ :aria-labelledby="labelId"
63
+ :disabled="disabled"
64
+ :name="name"
65
+ orientation="horizontal"
66
+ loop
67
+ class="inline-flex w-max max-w-full gap-0.5 rounded-lg bg-ink/5 p-0.5"
68
+ >
69
+ <!-- The chosen one is raised like a basic button (control colours: a
70
+ step above the track in light and dark). -->
71
+ <RadioGroupItem
72
+ v-for="option in options"
73
+ :key="option.value"
74
+ :value="option.value"
75
+ :disabled="option.disabled"
76
+ :aria-label="iconOnly ? option.label : undefined"
77
+ :title="iconOnly ? option.label : undefined"
78
+ :class="
79
+ cn(
80
+ 'inline-flex shrink-0 cursor-pointer items-center rounded-md font-bold whitespace-nowrap text-ink/65 outline-2 outline-offset-1 outline-transparent transition-colors duration-150 motion-reduce:transition-none',
81
+ 'not-disabled:hover:text-ink focus-visible:outline-focus',
82
+ 'data-[state=checked]:bg-control data-[state=checked]:text-ink data-[state=checked]:shadow-xs',
83
+ 'disabled:cursor-not-allowed disabled:opacity-40',
84
+ itemSize
85
+ )
86
+ "
87
+ >
88
+ <component :is="option.icon" v-if="option.icon" aria-hidden="true" />
89
+ <span v-if="!iconOnly">{{ option.label }}</span>
90
+ </RadioGroupItem>
91
+ </RadioGroupRoot>
92
+ </div>
93
+ </template>
@@ -36,3 +36,21 @@ export const WithButtons: Story = {
36
36
  </div>`,
37
37
  }),
38
38
  };
39
+
40
+ /**
41
+ * With `v-model:step`, finished segments go back to their step ("Back to
42
+ * step 1: User info"). Steps ahead can't be picked.
43
+ */
44
+ export const GoBack: Story = {
45
+ render: (args) => ({
46
+ components: { Steps, Button },
47
+ setup: () => ({ args, step: ref(2) }),
48
+ template: `
49
+ <div class="flex flex-col gap-4">
50
+ <Steps v-bind="args" v-model:step="step" />
51
+ <div class="flex gap-2">
52
+ <Button size="sm" :disabled="step === args.steps.length - 1" @click="step++">Next</Button>
53
+ </div>
54
+ </div>`,
55
+ }),
56
+ };
@@ -1,15 +1,20 @@
1
1
  <script setup lang="ts">
2
- import type { HTMLAttributes } from 'vue'
2
+ import { computed, getCurrentInstance, type HTMLAttributes } from 'vue'
3
3
  import { I18nT } from 'vue-i18n'
4
4
  import { cn } from '../../lib/cn'
5
5
  import Progress from '../Progress/Progress.vue'
6
6
 
7
7
  /**
8
8
  * Where someone is in a set of steps: a segment for each step, filled up to
9
- * the current one, and "Step 2 of 3: Licences" above it. Put it at the top of
10
- * a multi-step form. (Slideover's `steps` shows one for you; use this when
11
- * the steps are on a page, or in a Slideover you drive yourself.) The words
12
- * are announced when the step changes.
9
+ * the current one, and "Step 2 of 3 – Licences" under it, as in Slideover's
10
+ * multi-step form. Put it at the top of a multi-step form on a page, or in a
11
+ * Slideover you drive yourself. The words are announced when the step
12
+ * changes.
13
+ *
14
+ * With `v-model:step`, finished segments are buttons ("Back to step 1: User
15
+ * info") that go back to that step; steps ahead can't be picked, so each
16
+ * step's checks still run in order. With just `:step`, it only shows where
17
+ * you are.
13
18
  */
14
19
  export interface StepsProps {
15
20
  /** The name of each step, in order, e.g. `['User info', 'Licences']`. */
@@ -18,21 +23,36 @@ export interface StepsProps {
18
23
  step: number
19
24
  /** What the steps are for, e.g. "Add a user". The progress bar's accessible name; not shown. */
20
25
  label: string
26
+ /** Stops going back, e.g. while a step saves. */
27
+ disabled?: boolean
21
28
  class?: HTMLAttributes['class']
22
29
  }
23
30
 
24
31
  const props = defineProps<StepsProps>()
32
+ const emit = defineEmits<{ 'update:step': [step: number] }>()
33
+
34
+ // Going back is offered only when someone is listening (v-model:step).
35
+ const instance = getCurrentInstance()
36
+ const canGoBack = computed(() => !!instance?.vnode.props?.['onUpdate:step'])
25
37
  </script>
26
38
 
27
39
  <template>
28
- <div :class="cn('flex flex-col gap-3', props.class)">
40
+ <div :class="cn('flex flex-col gap-2', props.class)">
41
+ <Progress
42
+ :label="label"
43
+ segments
44
+ :value="step + 1"
45
+ :max="steps.length"
46
+ :segment-labels="canGoBack ? steps : undefined"
47
+ :disabled="disabled"
48
+ @select="emit('update:step', $event)"
49
+ />
29
50
  <p class="text-sm text-ink/65" aria-live="polite">
30
- <I18nT keypath="ui.steps.stepOfNamed" scope="global" tag="span">
51
+ <I18nT keypath="ui.steps.stepOfDash" scope="global" tag="span">
31
52
  <template #current>{{ step + 1 }}</template>
32
53
  <template #total>{{ steps.length }}</template>
33
54
  <template #name><span class="text-ink">{{ steps[step] }}</span></template>
34
55
  </I18nT>
35
56
  </p>
36
- <Progress :label="label" segments :value="step + 1" :max="steps.length" />
37
57
  </div>
38
58
  </template>
@@ -2,6 +2,7 @@
2
2
  import { computed, type HTMLAttributes } from 'vue'
3
3
  import { useI18n } from 'vue-i18n'
4
4
  import { Monitor, Moon, Sun } from '@lucide/vue'
5
+ import SegmentedControl from '../SegmentedControl/SegmentedControl.vue'
5
6
  import Select from '../Select/Select.vue'
6
7
  import { useTheme, type Theme } from '../../lib/theme'
7
8
 
@@ -17,17 +18,27 @@ export interface ThemeSwitcherProps {
17
18
  /** Keep the label for screen readers only. */
18
19
  hideLabel?: boolean
19
20
  disabled?: boolean
21
+ /**
22
+ * select: a dropdown (Settings, the account menu). segmented: Light / Dark
23
+ * / System side by side with icons, small: for the footer.
24
+ */
25
+ appearance?: 'select' | 'segmented'
20
26
  class?: HTMLAttributes['class']
21
27
  }
22
28
 
23
- const props = defineProps<ThemeSwitcherProps>()
29
+ const props = withDefaults(defineProps<ThemeSwitcherProps>(), { appearance: 'select' })
24
30
  const { t } = useI18n()
25
31
  const { theme, setTheme } = useTheme()
26
32
 
27
33
  const options = computed(() => [
28
34
  { label: t('ui.themeSwitcher.light'), value: 'light', icon: Sun },
29
35
  { label: t('ui.themeSwitcher.dark'), value: 'dark', icon: Moon },
30
- { label: t('ui.themeSwitcher.system'), value: 'system', icon: Monitor }
36
+ {
37
+ // "System" fits the row; the dropdown has room for "Match device".
38
+ label: props.appearance === 'segmented' ? t('ui.themeSwitcher.systemShort') : t('ui.themeSwitcher.system'),
39
+ value: 'system',
40
+ icon: Monitor
41
+ }
31
42
  ])
32
43
 
33
44
  const model = computed({
@@ -37,7 +48,18 @@ const model = computed({
37
48
  </script>
38
49
 
39
50
  <template>
51
+ <SegmentedControl
52
+ v-if="appearance === 'segmented'"
53
+ v-model="model"
54
+ size="sm"
55
+ :label="label ?? t('ui.themeSwitcher.label')"
56
+ :hide-label="hideLabel"
57
+ :options="options"
58
+ :disabled="disabled"
59
+ :class="props.class"
60
+ />
40
61
  <Select
62
+ v-else
41
63
  v-model="model"
42
64
  :label="label ?? t('ui.themeSwitcher.label')"
43
65
  :hide-label="hideLabel"
package/src/i18n/en.ts CHANGED
@@ -75,7 +75,13 @@ export const en = {
75
75
  formattingFor: 'Formatting for {label}',
76
76
  bold: 'Bold',
77
77
  italic: 'Italic',
78
- underline: 'Underline'
78
+ underline: 'Underline',
79
+ link: 'Link',
80
+ linkAddress: 'Link address',
81
+ addLink: 'Add link',
82
+ updateLink: 'Update link',
83
+ removeLink: 'Remove link',
84
+ linkInvalid: 'Enter an address starting with https://, mailto: or tel:'
79
85
  },
80
86
  alert: { info: 'Information', success: 'Success', warning: 'Warning', error: 'Error', dismiss: 'Dismiss' },
81
87
  fileUpload: {
@@ -84,8 +90,10 @@ export const en = {
84
90
  dropFile: 'Drop a file here, or choose one.',
85
91
  dropFiles: 'Drop files here, or choose them.'
86
92
  },
93
+ confirmDialog: { confirm: 'Confirm', cancel: 'Cancel' },
94
+ asyncState: { error: "Couldn't load this", retry: 'Try again' },
87
95
  languageSwitcher: { label: 'Language' },
88
- themeSwitcher: { label: 'Appearance', light: 'Light', dark: 'Dark', system: 'Match device' },
96
+ themeSwitcher: { label: 'Appearance', light: 'Light', dark: 'Dark', system: 'Match device', systemShort: 'System' },
89
97
  notifications: {
90
98
  title: 'Notifications',
91
99
  region: 'Notification',
@@ -131,7 +139,9 @@ export const en = {
131
139
  statTile: { up: 'Up', down: 'Down', flat: 'No change' },
132
140
  steps: {
133
141
  stepOf: 'Step {current} of {total}',
134
- stepOfNamed: 'Step {current} of {total}: {name}'
142
+ stepOfNamed: 'Step {current} of {total}: {name}',
143
+ /** Under the segments, e.g. "Step 2 of 3 – Licences", as in Slideover. */
144
+ stepOfDash: 'Step {current} of {total} – {name}'
135
145
  },
136
146
  summaryList: { notSet: 'Not set' },
137
147
  table: {
package/src/index.ts CHANGED
@@ -12,7 +12,7 @@ export type { Theme } from './lib/theme'
12
12
  export { default as AppShell } from './components/AppShell/AppShell.vue'
13
13
  export type { AppShellProps } from './components/AppShell/AppShell.vue'
14
14
  export { default as Header } from './components/Header/Header.vue'
15
- export type { HeaderProps, HeaderUser, HeaderUserAction } from './components/Header/Header.vue'
15
+ export type { HeaderImage, HeaderProps, HeaderUser, HeaderUserAction } from './components/Header/Header.vue'
16
16
  export { default as PageHeader } from './components/PageHeader/PageHeader.vue'
17
17
  export type { PageHeaderAction, PageHeaderProps } from './components/PageHeader/PageHeader.vue'
18
18
  export { default as SettingsRow } from './components/SettingsRow/SettingsRow.vue'
@@ -49,6 +49,8 @@ export { default as Alert } from './components/Alert/Alert.vue'
49
49
  export type { AlertProps } from './components/Alert/Alert.vue'
50
50
  export { default as Collapsible } from './components/Collapsible/Collapsible.vue'
51
51
  export type { CollapsibleProps } from './components/Collapsible/Collapsible.vue'
52
+ export { default as Prose } from './components/Prose/Prose.vue'
53
+ export type { ProseProps } from './components/Prose/Prose.vue'
52
54
 
53
55
  // Form
54
56
  export { default as FormField } from './components/FormField/FormField.vue'
@@ -109,6 +111,10 @@ export { default as BarChart } from './components/BarChart/BarChart.vue'
109
111
  export type { BarChartProps } from './components/BarChart/BarChart.vue'
110
112
  export { default as LineChart } from './components/LineChart/LineChart.vue'
111
113
  export type { LineChartProps } from './components/LineChart/LineChart.vue'
114
+ export { default as AsyncState } from './components/AsyncState/AsyncState.vue'
115
+ export type { AsyncStateProps } from './components/AsyncState/AsyncState.vue'
116
+ export { default as ResultState } from './components/ResultState/ResultState.vue'
117
+ export type { ResultStateProps } from './components/ResultState/ResultState.vue'
112
118
 
113
119
  // Navigation
114
120
  export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.vue'
@@ -128,6 +134,8 @@ export { default as Popover } from './components/Popover/Popover.vue'
128
134
  export type { PopoverProps } from './components/Popover/Popover.vue'
129
135
  export { default as Menu } from './components/Menu/Menu.vue'
130
136
  export type { MenuItem, MenuProps } from './components/Menu/Menu.vue'
137
+ export { default as SegmentedControl } from './components/SegmentedControl/SegmentedControl.vue'
138
+ export type { SegmentedControlProps, SegmentedOption, SegmentedValue } from './components/SegmentedControl/SegmentedControl.vue'
131
139
  export { default as Tabs } from './components/Tabs/Tabs.vue'
132
140
  export type { Tab, TabsProps } from './components/Tabs/Tabs.vue'
133
141
  export { default as Slideover } from './components/Slideover/Slideover.vue'
@@ -153,6 +161,8 @@ export type {
153
161
  } from './components/Notification/notifications'
154
162
  export { default as UnsavedChangesBar } from './components/UnsavedChangesBar/UnsavedChangesBar.vue'
155
163
  export type { UnsavedChangesBarProps } from './components/UnsavedChangesBar/UnsavedChangesBar.vue'
164
+ export { default as ConfirmDialog } from './components/ConfirmDialog/ConfirmDialog.vue'
165
+ export type { ConfirmDialogProps } from './components/ConfirmDialog/ConfirmDialog.vue'
156
166
 
157
167
  // Languages
158
168
  export { createKestonI18n, uiMessages, en } from './i18n'
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { initials } from './initials'
3
+
4
+ describe('initials', () => {
5
+ it.each([
6
+ ['Ben Smith', 'BS'],
7
+ ['Ben', 'B'],
8
+ ['Mary Jane Watson', 'MW'],
9
+ [' ben smith ', 'BS'],
10
+ ['', ''],
11
+ ['Keston Admin (support)', 'KA'],
12
+ ['Jo Bloggs [guest]', 'JB'],
13
+ ["'Jo' Bloggs", 'JB'],
14
+ ['Élodie Durand', 'ÉD'],
15
+ ['(support)', ''],
16
+ ])('%j → %j', (name, want) => {
17
+ expect(initials(name)).toBe(want)
18
+ })
19
+ })
@@ -1,8 +1,17 @@
1
- /** "Ben Smith" → "BS", "Ben" → "B", "Mary Jane Watson" → "MW". Empty for an empty name. */
1
+ /**
2
+ * "Ben Smith" → "BS", "Ben" → "B", "Mary Jane Watson" → "MW". Empty for an
3
+ * empty name. Anything in brackets is a note, not part of the name, so it's
4
+ * left out ("Keston Admin (support)" → "KA"), and so is anything that isn't a
5
+ * letter at the start of a word ("'Jo' Bloggs" → "JB").
6
+ */
2
7
  export function initials(name: string): string {
3
- const words = name.trim().split(/\s+/).filter(Boolean)
8
+ const words = name
9
+ .replace(/\([^)]*\)|\[[^\]]*\]/g, ' ')
10
+ .split(/\s+/)
11
+ .map((word) => word.replace(/^[^\p{L}\p{N}]+/u, ''))
12
+ .filter(Boolean)
4
13
  if (!words.length) return ''
5
14
  const first = words[0]!
6
15
  const last = words.length > 1 ? words[words.length - 1]! : ''
7
- return (first[0]! + (last[0] ?? '')).toUpperCase()
16
+ return ([...first][0]! + ([...last][0] ?? '')).toUpperCase()
8
17
  }
@@ -82,17 +82,28 @@
82
82
  * - hover / pressed / selected: see-through tints for things with no fill
83
83
  * of their own (ghost buttons, menu items, table rows, sidebar items).
84
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.
85
+ * (the buttons inside fields, cards you can press), so they lighten in
86
+ * dark mode rather than darken.
87
+ * - control / control-hover / control-pressed: basic buttons (see above).
87
88
  * Coloured fills (primary, danger) darken instead: brightness-90 / 80.
88
89
  * Disabled is opacity-40. Focus is a 2px outline-focus ring, keyboard only.
89
90
  */
90
91
  --color-hover: color-mix(in oklab, var(--color-ink) 5%, transparent);
91
92
  --color-pressed: color-mix(in oklab, var(--color-ink) 10%, transparent);
93
+ /* A field the browser filled in (saved email, password): a light tint of Keston blue. */
94
+ --color-autofill: light-dark(color-mix(in oklab, var(--color-kblue) 8%, var(--color-surface)), color-mix(in oklab, var(--color-primary-fg) 14%, var(--color-surface)));
92
95
  --color-selected: var(--color-pressed);
93
96
  --color-surface-hover: color-mix(in oklab, var(--color-surface) 95%, var(--color-ink));
94
97
  --color-surface-pressed: color-mix(in oklab, var(--color-surface) 90%, var(--color-ink));
95
98
 
99
+ /* Controls with a fill of their own (basic buttons): always a step above
100
+ whatever they sit on. Light: white, darkening on hover / press. Dark: a
101
+ see-through white, so a button is lighter than a card, a menu or the page
102
+ alike (a solid colour would be darker than a lighter panel). */
103
+ --color-control: light-dark(#ffffff, oklch(98.5% 0 0 / 0.06));
104
+ --color-control-hover: light-dark(color-mix(in oklab, #ffffff 95%, #050505), oklch(98.5% 0 0 / 0.1));
105
+ --color-control-pressed: light-dark(color-mix(in oklab, #ffffff 90%, #050505), oklch(98.5% 0 0 / 0.14));
106
+
96
107
  /* Radius e.g. --radius-control: …; */
97
108
 
98
109
  /* Typography e.g. --font-sans: …; */
@@ -199,6 +210,18 @@
199
210
  color-scheme: light dark;
200
211
  }
201
212
 
213
+ /* Autofill: browsers paint their own background (and, in Chrome, black
214
+ text) on the <input> itself, a square inside the field's padding. Keep the
215
+ input see-through with our text colour; FormField tints the whole field
216
+ instead (--color-autofill). The long transition is the only way to stop
217
+ Chrome's background, which it sets with !important. */
218
+ input:autofill,
219
+ input:-webkit-autofill {
220
+ -webkit-text-fill-color: var(--color-ink);
221
+ caret-color: var(--color-ink);
222
+ transition: background-color 0s 600000s, color 0s 600000s;
223
+ }
224
+
202
225
  /* Tailwind's dark: variant follows the same switch, for the rare case a
203
226
  colour token can't express (e.g. Tooltip). */
204
227
  @custom-variant dark {