@thekestongroup/ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Popover/popover.d.ts +3 -2
- package/dist/components/Spinner/Spinner.vue.d.ts +1 -1
- package/dist/keston-ui.js +681 -680
- package/package.json +1 -1
- package/src/components/AppLauncher/AppLauncher.vue +3 -3
- package/src/components/AppShell/AppShell.stories.ts +2 -2
- package/src/components/AppShell/AppShell.vue +2 -2
- package/src/components/Avatar/Avatar.vue +3 -3
- package/src/components/AvatarGroup/AvatarGroup.vue +4 -4
- package/src/components/Badge/Badge.vue +2 -2
- package/src/components/Breadcrumb/Breadcrumb.vue +5 -5
- package/src/components/Button/Button.stories.ts +1 -1
- package/src/components/Button/Button.vue +12 -9
- package/src/components/Calendar/Calendar.stories.ts +2 -2
- package/src/components/Calendar/Calendar.vue +8 -8
- package/src/components/Card/Card.stories.ts +5 -5
- package/src/components/Card/Card.vue +3 -3
- package/src/components/CardSelect/CardSelect.vue +10 -7
- package/src/components/ChangeIndicator/ChangeIndicator.vue +2 -2
- package/src/components/Checkbox/Checkbox.vue +5 -5
- package/src/components/CheckboxGroup/CheckboxGroup.stories.ts +1 -1
- package/src/components/CheckboxGroup/CheckboxGroup.vue +2 -2
- package/src/components/Checklist/Checklist.vue +3 -3
- package/src/components/Chip/Chip.stories.ts +1 -1
- package/src/components/Chip/Chip.vue +2 -2
- package/src/components/Divider/Divider.vue +4 -4
- package/src/components/EmptyState/EmptyState.vue +3 -3
- package/src/components/Footer/Footer.vue +4 -4
- package/src/components/FormField/FieldMessage.vue +3 -3
- package/src/components/FormField/FormField.stories.ts +1 -1
- package/src/components/FormField/FormField.vue +8 -3
- package/src/components/Header/Header.stories.ts +8 -8
- package/src/components/Header/Header.vue +6 -6
- package/src/components/InfoTip/InfoTip.stories.ts +1 -1
- package/src/components/InfoTip/InfoTip.vue +1 -1
- package/src/components/Input/Input.vue +1 -1
- package/src/components/InputCode/InputCode.stories.ts +1 -1
- package/src/components/InputCode/InputCode.vue +4 -4
- package/src/components/InputDate/InputDate.stories.ts +1 -1
- package/src/components/InputDate/InputDate.vue +5 -5
- package/src/components/InputNumber/InputNumber.stories.ts +1 -1
- package/src/components/InputNumber/InputNumber.vue +6 -6
- package/src/components/InputPassword/InputPassword.vue +4 -4
- package/src/components/InputRichText/InputRichText.stories.ts +1 -1
- package/src/components/InputRichText/InputRichText.vue +3 -3
- package/src/components/InputTextArea/InputTextArea.vue +1 -1
- package/src/components/Link/Link.stories.ts +4 -4
- package/src/components/Link/Link.vue +1 -1
- package/src/components/Menu/Menu.vue +6 -5
- package/src/components/Notification/Notification.stories.ts +3 -3
- package/src/components/Notification/Notification.vue +9 -9
- package/src/components/Notification/NotificationPane.vue +3 -3
- package/src/components/Notification/Toaster.vue +1 -1
- package/src/components/PageHeader/PageHeader.vue +2 -2
- package/src/components/Popover/Popover.stories.ts +2 -2
- package/src/components/Popover/popover.ts +4 -3
- package/src/components/Progress/Progress.vue +1 -1
- package/src/components/RadioGroup/RadioGroup.vue +6 -6
- package/src/components/RelativeTime/RelativeTime.stories.ts +1 -1
- package/src/components/Select/Select.stories.ts +1 -1
- package/src/components/Select/Select.vue +22 -18
- package/src/components/SettingsRow/SettingsRow.vue +1 -1
- package/src/components/Sidebar/Sidebar.stories.ts +2 -2
- package/src/components/Sidebar/Sidebar.vue +9 -9
- package/src/components/Slideover/Slideover.stories.ts +5 -5
- package/src/components/Slideover/Slideover.vue +6 -6
- package/src/components/Spinner/Spinner.stories.ts +7 -7
- package/src/components/Spinner/Spinner.vue +1 -1
- package/src/components/StatTile/StatTile.stories.ts +2 -2
- package/src/components/StatTile/StatTile.vue +6 -6
- package/src/components/Steps/Steps.vue +2 -2
- package/src/components/SummaryList/SummaryList.vue +8 -8
- package/src/components/Switch/Switch.vue +3 -3
- package/src/components/Table/Table.vue +12 -12
- package/src/components/Tabs/Tabs.vue +4 -4
- package/src/components/Tooltip/Tooltip.stories.ts +1 -1
- package/src/components/Tooltip/Tooltip.vue +1 -1
- package/src/components/UnsavedChangesBar/UnsavedChangesBar.stories.ts +1 -1
- package/src/components/UnsavedChangesBar/UnsavedChangesBar.vue +1 -1
- package/src/examples/AppPages.stories.ts +3 -3
- package/src/examples/FormLayout.stories.ts +3 -3
- package/src/examples/KestonIdPages.stories.ts +18 -18
- package/src/examples/SchoolPages.stories.ts +5 -5
- package/src/styles/theme.css +94 -5
|
@@ -84,7 +84,7 @@ function linkAttrs(link: FooterLink) {
|
|
|
84
84
|
<template>
|
|
85
85
|
<footer
|
|
86
86
|
:class="cn(
|
|
87
|
-
'flex shrink-0 flex-col gap-3 border-t border-
|
|
87
|
+
'flex shrink-0 flex-col gap-3 border-t border-ink/10 bg-surface px-4 py-4 text-sm text-ink/65 sm:flex-row sm:items-center sm:justify-between sm:px-6',
|
|
88
88
|
props.class
|
|
89
89
|
)"
|
|
90
90
|
>
|
|
@@ -94,7 +94,7 @@ function linkAttrs(link: FooterLink) {
|
|
|
94
94
|
<li v-for="link in links" :key="link.label">
|
|
95
95
|
<Link v-bind="linkAttrs(link)" :icon="false">{{ link.label }}</Link>
|
|
96
96
|
</li>
|
|
97
|
-
<li v-if="moreLinks.length" class="hidden h-4 w-px bg-
|
|
97
|
+
<li v-if="moreLinks.length" class="hidden h-4 w-px bg-ink/10 sm:block" aria-hidden="true"></li>
|
|
98
98
|
<li v-for="link in moreLinks" :key="link.label">
|
|
99
99
|
<Link v-bind="linkAttrs(link)" :icon="false">{{ link.label }}</Link>
|
|
100
100
|
</li>
|
|
@@ -104,7 +104,7 @@ function linkAttrs(link: FooterLink) {
|
|
|
104
104
|
|
|
105
105
|
<div :class="cn('flex flex-wrap items-center gap-x-3 gap-y-1 sm:justify-end', ui?.meta)">
|
|
106
106
|
<p v-if="appName || version || build" class="flex flex-wrap items-baseline gap-x-1.5">
|
|
107
|
-
<span v-if="appName" class="font-bold text-
|
|
107
|
+
<span v-if="appName" class="font-bold text-ink/80">{{ appName }}</span>
|
|
108
108
|
<!-- Shows as "v1.4.2" but reads as "Version 1.4.2". -->
|
|
109
109
|
<span v-if="version">
|
|
110
110
|
<span class="sr-only">{{ versionLabel }}</span>
|
|
@@ -113,7 +113,7 @@ function linkAttrs(link: FooterLink) {
|
|
|
113
113
|
<!-- Shows as "a1b2c3d" in monospace but reads as "Build a1b2c3d". -->
|
|
114
114
|
<span v-if="build" :title="buildLabel">
|
|
115
115
|
<span class="sr-only">{{ buildLabel }}</span>
|
|
116
|
-
<span class="font-mono text-xs text-
|
|
116
|
+
<span class="font-mono text-xs text-ink/55" aria-hidden="true">{{ build }}</span>
|
|
117
117
|
</span>
|
|
118
118
|
</p>
|
|
119
119
|
<p>{{ t('ui.footer.copyright', { years, holder }) }}</p>
|
|
@@ -34,9 +34,9 @@ watch(
|
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
const colour: Record<FieldStatus, string> = {
|
|
37
|
-
error: 'text-red',
|
|
38
|
-
success: 'text-green',
|
|
39
|
-
loading: 'text-
|
|
37
|
+
error: 'text-red-fg',
|
|
38
|
+
success: 'text-green-fg',
|
|
39
|
+
loading: 'text-ink/65'
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const icon = { error: CircleAlert, success: CircleCheck } as const
|
|
@@ -32,7 +32,7 @@ const meta = {
|
|
|
32
32
|
:disabled="args.disabled"
|
|
33
33
|
:aria-invalid="invalid"
|
|
34
34
|
:aria-describedby="describedBy"
|
|
35
|
-
class="min-h-5 min-w-0 flex-1 resize-y bg-transparent outline-none placeholder:text-
|
|
35
|
+
class="min-h-5 min-w-0 flex-1 resize-y bg-transparent outline-none placeholder:text-ink/55 disabled:cursor-not-allowed"
|
|
36
36
|
/>
|
|
37
37
|
</template>
|
|
38
38
|
</FormField>`,
|
|
@@ -105,9 +105,14 @@ function focusUnlabelable() {
|
|
|
105
105
|
//
|
|
106
106
|
// Text is 16px on touch screens: iPhone zooms the page into any field with
|
|
107
107
|
// smaller text when it's tapped. 16px stops that without blocking pinch-zoom.
|
|
108
|
+
//
|
|
109
|
+
// Text sits 12px from the sides. An icon at either end sits 10px from the
|
|
110
|
+
// edge instead, the same as above and below it (16px icon in a 20px line,
|
|
111
|
+
// plus 8px padding), so it looks evenly placed.
|
|
108
112
|
const box = [
|
|
109
113
|
'flex items-center gap-2 px-3 py-2 text-sm pointer-coarse:text-base [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:opacity-70',
|
|
110
|
-
'
|
|
114
|
+
'[&>svg:first-child]:-ml-0.5 [&>svg:last-child]:-mr-0.5',
|
|
115
|
+
'bg-surface text-ink border border-ink/45 rounded shadow-xs cursor-text transition',
|
|
111
116
|
'outline-2 outline-offset-1 outline-transparent forced-colors:not-has-focus-visible:outline-0',
|
|
112
117
|
'has-focus-visible:outline-focus',
|
|
113
118
|
// A control can mark itself data-pointer-focus to hide the ring while it
|
|
@@ -124,7 +129,7 @@ const statusBorder: Record<FormFieldStatus, string> = {
|
|
|
124
129
|
</script>
|
|
125
130
|
|
|
126
131
|
<template>
|
|
127
|
-
<div :class="cn('flex flex-col gap-1.5 text-
|
|
132
|
+
<div :class="cn('flex flex-col gap-1.5 text-ink', props.class)">
|
|
128
133
|
<!-- Label row and box in a grid, so label-trailing can come after the
|
|
129
134
|
box in the page (and the Tab order) but show at the end of the label row. -->
|
|
130
135
|
<div :class="cn('grid grid-cols-[minmax(0,1fr)_auto]', !hideLabel && 'gap-y-1.5', $slots['label-trailing'] && 'gap-x-3')">
|
|
@@ -138,7 +143,7 @@ const statusBorder: Record<FormFieldStatus, string> = {
|
|
|
138
143
|
</div>
|
|
139
144
|
|
|
140
145
|
<!-- Behind the ?: hidden, but still the control's description. -->
|
|
141
|
-
<p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-
|
|
146
|
+
<p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-ink/65">
|
|
142
147
|
{{ helper }}
|
|
143
148
|
</p>
|
|
144
149
|
</div>
|
|
@@ -41,7 +41,7 @@ const meta = {
|
|
|
41
41
|
<Button variant="ghost" square aria-label="Notifications"><Bell /></Button>
|
|
42
42
|
</template>
|
|
43
43
|
</Header>
|
|
44
|
-
<p class="p-4 text-sm text-
|
|
44
|
+
<p class="p-4 text-sm text-ink/65">Last event: {{ last || "none" }}</p>
|
|
45
45
|
</div>`,
|
|
46
46
|
}),
|
|
47
47
|
} satisfies Meta<typeof Header>;
|
|
@@ -80,8 +80,8 @@ export const CustomUserMenu: Story = {
|
|
|
80
80
|
template: `
|
|
81
81
|
<Header v-bind="args">
|
|
82
82
|
<template #account-menu="{ close }">
|
|
83
|
-
<div class="flex flex-col gap-1 border-t border-
|
|
84
|
-
<p class="px-3 pt-1 text-xs font-bold text-
|
|
83
|
+
<div class="flex flex-col gap-1 border-t border-ink/10 p-2">
|
|
84
|
+
<p class="px-3 pt-1 text-xs font-bold text-ink/65 uppercase">Switch school</p>
|
|
85
85
|
<Button variant="ghost" class="w-full justify-start px-3" @click="close">
|
|
86
86
|
<template #leading><Building2 /></template>Keston Prep
|
|
87
87
|
</Button>
|
|
@@ -108,13 +108,13 @@ export const OrganisationSwitcher: Story = {
|
|
|
108
108
|
<template #organisation="{ close }">
|
|
109
109
|
<button
|
|
110
110
|
type="button"
|
|
111
|
-
class="flex w-full items-center gap-2 px-4 py-3 text-left text-sm hover:bg-
|
|
111
|
+
class="flex w-full items-center gap-2 px-4 py-3 text-left text-sm hover:bg-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus"
|
|
112
112
|
@click="close"
|
|
113
113
|
>
|
|
114
114
|
<Building2 class="size-4 shrink-0" aria-hidden="true" />
|
|
115
115
|
<span class="flex min-w-0 flex-1 flex-col">
|
|
116
116
|
<span class="truncate font-bold">The Keston School</span>
|
|
117
|
-
<span class="text-xs text-
|
|
117
|
+
<span class="text-xs text-ink/65">Switch organisation</span>
|
|
118
118
|
</span>
|
|
119
119
|
<ChevronRight class="size-4 shrink-0" aria-hidden="true" />
|
|
120
120
|
</button>
|
|
@@ -161,11 +161,11 @@ export const WithMiddle: Story = {
|
|
|
161
161
|
setup: () => ({ args }),
|
|
162
162
|
template: `
|
|
163
163
|
<Header v-bind="args">
|
|
164
|
-
<nav aria-label="Breadcrumb" class="ml-2 hidden items-center gap-1 text-sm text-
|
|
164
|
+
<nav aria-label="Breadcrumb" class="ml-2 hidden items-center gap-1 text-sm text-ink/65 sm:flex [&_svg]:size-4">
|
|
165
165
|
<ChevronRight aria-hidden="true" />
|
|
166
166
|
<a href="#" class="hover:underline">Students</a>
|
|
167
167
|
<ChevronRight aria-hidden="true" />
|
|
168
|
-
<span aria-current="page" class="text-
|
|
168
|
+
<span aria-current="page" class="text-ink">Ben Smith</span>
|
|
169
169
|
</nav>
|
|
170
170
|
<template #trailing>
|
|
171
171
|
<Button variant="ghost" square aria-label="Notifications"><Bell /></Button>
|
|
@@ -199,7 +199,7 @@ export const Sticky: Story = {
|
|
|
199
199
|
<div class="h-96 overflow-y-auto bg-background">
|
|
200
200
|
<Header v-bind="args" />
|
|
201
201
|
<div class="flex flex-col gap-3 p-4">
|
|
202
|
-
<p v-for="n in 30" :key="n" class="text-sm text-
|
|
202
|
+
<p v-for="n in 30" :key="n" class="text-sm text-ink/65">Row {{ n }}</p>
|
|
203
203
|
</div>
|
|
204
204
|
</div>`,
|
|
205
205
|
}),
|
|
@@ -135,7 +135,7 @@ const titleLink = computed(() => {
|
|
|
135
135
|
// As a link the title looks the same, with a ghost button's hover and press
|
|
136
136
|
// backgrounds round it; the negative margin keeps the text where it was.
|
|
137
137
|
const titleLinkClass = [
|
|
138
|
-
'-mx-2 rounded px-2 py-1 transition-colors hover:bg-
|
|
138
|
+
'-mx-2 rounded px-2 py-1 transition-colors hover:bg-hover active:bg-pressed',
|
|
139
139
|
'outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus forced-colors:not-focus-visible:outline-0'
|
|
140
140
|
]
|
|
141
141
|
|
|
@@ -152,7 +152,7 @@ function runAction(action: HeaderUserAction, close: () => void) {
|
|
|
152
152
|
<template>
|
|
153
153
|
<header
|
|
154
154
|
:class="cn(
|
|
155
|
-
'flex h-12 shrink-0 items-center gap-2 border-b border-
|
|
155
|
+
'flex h-12 shrink-0 items-center gap-2 border-b border-ink/10 bg-surface px-4 text-ink',
|
|
156
156
|
sticky && 'sticky top-0 z-40',
|
|
157
157
|
props.class
|
|
158
158
|
)"
|
|
@@ -207,9 +207,9 @@ function runAction(action: HeaderUserAction, close: () => void) {
|
|
|
207
207
|
<div class="flex flex-col">
|
|
208
208
|
<!-- The organisation at the top, with a divider under it. The
|
|
209
209
|
organisation slot replaces the plain heading. -->
|
|
210
|
-
<div v-if="user.organisation || $slots.organisation" class="border-b border-
|
|
210
|
+
<div v-if="user.organisation || $slots.organisation" class="border-b border-ink/10">
|
|
211
211
|
<slot name="organisation" :close="close">
|
|
212
|
-
<p class="truncate px-4 py-3 text-xs font-bold text-
|
|
212
|
+
<p class="truncate px-4 py-3 text-xs font-bold text-ink/65 uppercase" :title="user.organisation">
|
|
213
213
|
{{ user.organisation }}
|
|
214
214
|
</p>
|
|
215
215
|
</slot>
|
|
@@ -221,7 +221,7 @@ function runAction(action: HeaderUserAction, close: () => void) {
|
|
|
221
221
|
<Avatar :user="user" size="lg" decorative />
|
|
222
222
|
<div class="flex min-w-0 flex-col">
|
|
223
223
|
<span class="truncate font-bold" :title="user.name">{{ user.name }}</span>
|
|
224
|
-
<span v-if="user.email" class="truncate text-sm text-
|
|
224
|
+
<span v-if="user.email" class="truncate text-sm text-ink/65" :title="user.email">{{ user.email }}</span>
|
|
225
225
|
</div>
|
|
226
226
|
<Button
|
|
227
227
|
v-if="userActions.includes('account-settings')"
|
|
@@ -239,7 +239,7 @@ function runAction(action: HeaderUserAction, close: () => void) {
|
|
|
239
239
|
<!-- Switch account on the left, Log out on the right. -->
|
|
240
240
|
<div
|
|
241
241
|
v-if="userActions.includes('switch-account') || userActions.includes('log-out')"
|
|
242
|
-
class="flex items-center gap-2 border-t border-
|
|
242
|
+
class="flex items-center gap-2 border-t border-ink/10 px-4 py-3"
|
|
243
243
|
>
|
|
244
244
|
<Button v-if="userActions.includes('switch-account')" @click="runAction('switch-account', close)">
|
|
245
245
|
<template #leading><ArrowLeftRight /></template>
|
|
@@ -36,7 +36,7 @@ export const InTableHeading: Story = {
|
|
|
36
36
|
setup: () => ({ args }),
|
|
37
37
|
template: `
|
|
38
38
|
<table class="text-sm">
|
|
39
|
-
<thead><tr class="border-b border-
|
|
39
|
+
<thead><tr class="border-b border-ink/10">
|
|
40
40
|
<th class="px-3 py-2 text-left font-bold">Student</th>
|
|
41
41
|
<th class="px-3 py-2 text-left font-bold"><span class="inline-flex items-center gap-1">FSM <InfoTip v-bind="args" /></span></th>
|
|
42
42
|
</tr></thead>
|
|
@@ -33,7 +33,7 @@ const descriptionId = `${useId()}-description`
|
|
|
33
33
|
:aria-label="label"
|
|
34
34
|
:aria-describedby="descriptionId"
|
|
35
35
|
:class="cn(
|
|
36
|
-
'inline-flex shrink-0 rounded-full p-0.5 align-middle text-
|
|
36
|
+
'inline-flex shrink-0 rounded-full p-0.5 align-middle text-ink transition hover:bg-hover data-[state=open]:bg-selected',
|
|
37
37
|
'outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus [&_svg]:size-4',
|
|
38
38
|
props.class
|
|
39
39
|
)"
|
|
@@ -87,7 +87,7 @@ const statusText = computed(() => props.statusText ?? lengthError.value)
|
|
|
87
87
|
:disabled="disabled"
|
|
88
88
|
:aria-invalid="invalid"
|
|
89
89
|
:aria-describedby="describedBy"
|
|
90
|
-
class="h-5 min-w-0 flex-1 bg-transparent outline-none placeholder:text-
|
|
90
|
+
class="h-5 min-w-0 flex-1 bg-transparent outline-none placeholder:text-ink/55 disabled:cursor-not-allowed"
|
|
91
91
|
@blur="touched = true"
|
|
92
92
|
/>
|
|
93
93
|
</template>
|
|
@@ -35,7 +35,7 @@ export const Default: Story = {};
|
|
|
35
35
|
export const EmailCode: Story = {
|
|
36
36
|
args: {
|
|
37
37
|
label: "Code from your email",
|
|
38
|
-
helper: "We sent a 6-digit code to b
|
|
38
|
+
helper: "We sent a 6-digit code to b***@keston.school. It expires in 10 minutes.",
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -92,9 +92,9 @@ const onComplete = (value: Box[]) => emit('complete', toCode(value))
|
|
|
92
92
|
// Each box looks like FormField's box (a medium basic Button), with the
|
|
93
93
|
// focus ring on the box being typed in.
|
|
94
94
|
const box = [
|
|
95
|
-
'size-10 shrink-0 rounded border border-
|
|
95
|
+
'size-10 shrink-0 rounded border border-ink/45 bg-surface shadow-xs text-center text-lg tabular-nums text-ink transition',
|
|
96
96
|
'outline-2 outline-offset-1 outline-transparent focus:outline-focus forced-colors:not-focus:outline-0',
|
|
97
|
-
'placeholder:text-
|
|
97
|
+
'placeholder:text-ink/25 disabled:cursor-not-allowed'
|
|
98
98
|
]
|
|
99
99
|
const statusBorder: Record<InputCodeStatus, string> = {
|
|
100
100
|
error: 'border-red',
|
|
@@ -104,14 +104,14 @@ const statusBorder: Record<InputCodeStatus, string> = {
|
|
|
104
104
|
</script>
|
|
105
105
|
|
|
106
106
|
<template>
|
|
107
|
-
<div :class="cn('flex flex-col gap-1.5 text-
|
|
107
|
+
<div :class="cn('flex flex-col gap-1.5 text-ink', props.class)">
|
|
108
108
|
<div class="flex flex-col gap-0.5">
|
|
109
109
|
<div class="flex items-center gap-1">
|
|
110
110
|
<label :id="labelId" :for="`${id}-0`" class="text-sm">{{ label }}</label>
|
|
111
111
|
<InfoTip v-if="helper && helperPlacement === 'icon'" :text="helper" :label="t('ui.formField.about', { label })" />
|
|
112
112
|
</div>
|
|
113
113
|
<!-- Behind the ?: hidden, but still the boxes' description. -->
|
|
114
|
-
<p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-
|
|
114
|
+
<p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-ink/65">
|
|
115
115
|
{{ helper }}
|
|
116
116
|
</p>
|
|
117
117
|
</div>
|
|
@@ -203,9 +203,9 @@ function onCalendarPick(value: string | undefined) {
|
|
|
203
203
|
// InputNumber's + button. Negative margins cancel the box's padding.
|
|
204
204
|
const trigger = [
|
|
205
205
|
'flex w-9 shrink-0 -my-2 -mr-3 self-stretch items-center justify-center',
|
|
206
|
-
'rounded-r border-l border-
|
|
207
|
-
'not-disabled:hover:
|
|
208
|
-
'data-[state=open]:
|
|
206
|
+
'rounded-r border-l border-ink/10 bg-surface cursor-pointer transition',
|
|
207
|
+
'not-disabled:hover:bg-surface-hover not-disabled:active:bg-surface-pressed [&_svg]:opacity-100!',
|
|
208
|
+
'data-[state=open]:bg-surface-pressed disabled:cursor-not-allowed',
|
|
209
209
|
'outline-2 -outline-offset-2 outline-transparent focus-visible:outline-focus'
|
|
210
210
|
]
|
|
211
211
|
</script>
|
|
@@ -235,14 +235,14 @@ const trigger = [
|
|
|
235
235
|
:disabled="disabled"
|
|
236
236
|
:aria-invalid="invalid"
|
|
237
237
|
:aria-describedby="describedBy"
|
|
238
|
-
class="h-5 min-w-0 flex-1 bg-transparent tabular-nums outline-none placeholder:text-
|
|
238
|
+
class="h-5 min-w-0 flex-1 bg-transparent tabular-nums outline-none placeholder:text-ink/55 disabled:cursor-not-allowed"
|
|
239
239
|
@input="onTextInput"
|
|
240
240
|
@blur="onTextBlur"
|
|
241
241
|
@keydown.enter="onTextEnter"
|
|
242
242
|
/>
|
|
243
243
|
|
|
244
244
|
<!-- The date a typed phrase means, e.g. "tmrw" → 11/11/2026. -->
|
|
245
|
-
<span v-if="phrasePreview" aria-hidden="true" class="shrink-0 tabular-nums text-
|
|
245
|
+
<span v-if="phrasePreview" aria-hidden="true" class="shrink-0 tabular-nums text-ink/55">
|
|
246
246
|
{{ phrasePreview }}
|
|
247
247
|
</span>
|
|
248
248
|
|
|
@@ -25,7 +25,7 @@ const meta = {
|
|
|
25
25
|
},
|
|
26
26
|
template: `
|
|
27
27
|
<InputNumber v-bind="args" v-model="value" />
|
|
28
|
-
<small class="mt-3 block text-xs text-
|
|
28
|
+
<small class="mt-3 block text-xs text-ink/60">
|
|
29
29
|
Value: {{ value === undefined ? "undefined" : value }}
|
|
30
30
|
</small>`,
|
|
31
31
|
}),
|
|
@@ -57,15 +57,15 @@ const valueText = computed(() =>
|
|
|
57
57
|
// split from the value by a divider, so the field looks like
|
|
58
58
|
// [ − | value | + ]. Negative margins cancel the box's padding (px-3 py-2), so
|
|
59
59
|
// each button is 36×36 inside the 38px box. They behave like a basic Button:
|
|
60
|
-
//
|
|
60
|
+
// surface fill with the surface hover / pressed colours, icon at full colour (the box mutes
|
|
61
61
|
// decorative icons). When disabled (min / max reached) only the icon fades.
|
|
62
62
|
const stepButton = [
|
|
63
|
-
'flex w-9 shrink-0 -my-2 self-stretch items-center justify-center bg-
|
|
64
|
-
'not-disabled:hover:
|
|
63
|
+
'flex w-9 shrink-0 -my-2 self-stretch items-center justify-center bg-surface cursor-pointer transition',
|
|
64
|
+
'not-disabled:hover:bg-surface-hover not-disabled:active:bg-surface-pressed [&_svg]:opacity-100!',
|
|
65
65
|
'disabled:cursor-not-allowed disabled:[&_svg]:opacity-40!'
|
|
66
66
|
]
|
|
67
|
-
const decrement = '-ml-3 rounded-l border-r border-
|
|
68
|
-
const increment = '-mr-3 rounded-r border-l border-
|
|
67
|
+
const decrement = '-ml-3 rounded-l border-r border-ink/10'
|
|
68
|
+
const increment = '-mr-3 rounded-r border-l border-ink/10'
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
71
|
<template>
|
|
@@ -101,7 +101,7 @@ const increment = '-mr-3 rounded-r border-l border-black/15'
|
|
|
101
101
|
:aria-invalid="invalid"
|
|
102
102
|
:aria-describedby="describedBy"
|
|
103
103
|
:aria-valuetext="valueText"
|
|
104
|
-
class="h-5 min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none placeholder:text-
|
|
104
|
+
class="h-5 min-w-0 flex-1 bg-transparent text-center tabular-nums outline-none placeholder:text-ink/55 disabled:cursor-not-allowed"
|
|
105
105
|
/>
|
|
106
106
|
<NumberFieldIncrement :class="[stepButton, increment]">
|
|
107
107
|
<Plus />
|
|
@@ -79,9 +79,9 @@ const statusText = computed(() => props.statusText ?? (capsLock.value ? t('ui.in
|
|
|
79
79
|
// [ password | 👁 ]. Pressing it keeps focus (and the caret) in the input.
|
|
80
80
|
const toggle = [
|
|
81
81
|
'flex w-9 shrink-0 -my-2 -mr-3 self-stretch items-center justify-center',
|
|
82
|
-
'bg-
|
|
83
|
-
'not-disabled:hover:
|
|
84
|
-
'outline-none focus-visible:bg-
|
|
82
|
+
'bg-surface rounded-r border-l border-ink/10 cursor-pointer transition',
|
|
83
|
+
'not-disabled:hover:bg-surface-hover not-disabled:active:bg-surface-pressed [&_svg]:opacity-100!',
|
|
84
|
+
'outline-none focus-visible:bg-surface-hover disabled:cursor-not-allowed'
|
|
85
85
|
]
|
|
86
86
|
</script>
|
|
87
87
|
|
|
@@ -114,7 +114,7 @@ const toggle = [
|
|
|
114
114
|
:disabled="disabled"
|
|
115
115
|
:aria-invalid="invalid"
|
|
116
116
|
:aria-describedby="describedBy"
|
|
117
|
-
class="h-5 min-w-0 flex-1 bg-transparent outline-none placeholder:text-
|
|
117
|
+
class="h-5 min-w-0 flex-1 bg-transparent outline-none placeholder:text-ink/55 disabled:cursor-not-allowed"
|
|
118
118
|
@keydown="checkCapsLock"
|
|
119
119
|
@keyup="checkCapsLock"
|
|
120
120
|
@blur="capsLock = false"
|
|
@@ -23,7 +23,7 @@ const meta = {
|
|
|
23
23
|
setup: () => ({ args, value: ref("") }),
|
|
24
24
|
template: `
|
|
25
25
|
<InputRichText v-bind="args" v-model="value" />
|
|
26
|
-
<pre class="mt-4 text-xs whitespace-pre-wrap text-
|
|
26
|
+
<pre class="mt-4 text-xs whitespace-pre-wrap text-ink/65">{{ value || '(empty)' }}</pre>`,
|
|
27
27
|
}),
|
|
28
28
|
} satisfies Meta<typeof InputRichText>;
|
|
29
29
|
|
|
@@ -146,7 +146,7 @@ const editable = [
|
|
|
146
146
|
'min-h-24 max-h-80 overflow-y-auto px-3 py-2 text-sm pointer-coarse:text-base outline-none cursor-text',
|
|
147
147
|
'[&_p+p]:mt-2',
|
|
148
148
|
'[&_p.is-editor-empty:first-child]:before:pointer-events-none [&_p.is-editor-empty:first-child]:before:float-left',
|
|
149
|
-
'[&_p.is-editor-empty:first-child]:before:h-0 [&_p.is-editor-empty:first-child]:before:text-
|
|
149
|
+
'[&_p.is-editor-empty:first-child]:before:h-0 [&_p.is-editor-empty:first-child]:before:text-ink/55',
|
|
150
150
|
'[&_p.is-editor-empty:first-child]:before:content-[attr(data-placeholder)]'
|
|
151
151
|
].join(' ')
|
|
152
152
|
</script>
|
|
@@ -172,7 +172,7 @@ const editable = [
|
|
|
172
172
|
role="toolbar"
|
|
173
173
|
:aria-label="t('ui.inputRichText.formattingFor', { label })"
|
|
174
174
|
:aria-controls="slot.id"
|
|
175
|
-
class="flex items-center gap-0.5 border-b border-
|
|
175
|
+
class="flex items-center gap-0.5 border-b border-ink/10 px-1.5 py-1 [&_svg]:opacity-100!"
|
|
176
176
|
@mousedown.prevent
|
|
177
177
|
>
|
|
178
178
|
<Tooltip v-for="mark in marks" :key="mark.name" :text="`${mark.label} (${mod}${mark.key})`" :disabled="disabled">
|
|
@@ -184,7 +184,7 @@ const editable = [
|
|
|
184
184
|
:aria-pressed="active[mark.name]"
|
|
185
185
|
:aria-keyshortcuts="`${isMac ? 'Meta' : 'Control'}+${mark.key}`"
|
|
186
186
|
:disabled="disabled"
|
|
187
|
-
class="aria-pressed:bg-
|
|
187
|
+
class="aria-pressed:bg-selected"
|
|
188
188
|
@click="mark.toggle()"
|
|
189
189
|
>
|
|
190
190
|
<component :is="mark.icon" />
|
|
@@ -82,7 +82,7 @@ defineExpose({ focus: () => area.value?.focus() })
|
|
|
82
82
|
:disabled="disabled"
|
|
83
83
|
:aria-invalid="invalid"
|
|
84
84
|
:aria-describedby="describedBy"
|
|
85
|
-
class="field-sizing-content -my-0.5 max-h-80 min-h-24 min-w-0 flex-1 resize-none bg-transparent text-sm leading-5 outline-none placeholder:text-
|
|
85
|
+
class="field-sizing-content -my-0.5 max-h-80 min-h-24 min-w-0 flex-1 resize-none bg-transparent text-sm leading-5 outline-none placeholder:text-ink/55 disabled:cursor-not-allowed pointer-coarse:text-base"
|
|
86
86
|
/>
|
|
87
87
|
</template>
|
|
88
88
|
</FormField>
|
|
@@ -14,7 +14,7 @@ const meta = {
|
|
|
14
14
|
render: (args) => ({
|
|
15
15
|
components: { Link },
|
|
16
16
|
setup: () => ({ args }),
|
|
17
|
-
template: `<p class="text-sm text-
|
|
17
|
+
template: `<p class="text-sm text-ink"><Link :href="args.href" :new-tab="args.newTab" :icon="args.icon">{{ args.text }}</Link></p>`,
|
|
18
18
|
}),
|
|
19
19
|
} satisfies Meta<LinkStoryArgs>;
|
|
20
20
|
|
|
@@ -35,7 +35,7 @@ export const InASentence: Story = {
|
|
|
35
35
|
render: () => ({
|
|
36
36
|
components: { Link },
|
|
37
37
|
template: `
|
|
38
|
-
<p class="max-w-100 text-xs text-
|
|
38
|
+
<p class="max-w-100 text-xs text-ink/65">
|
|
39
39
|
Make sure you trust Keston Admissions: read its
|
|
40
40
|
<Link href="#" new-tab>privacy policy</Link> and <Link href="#" new-tab>terms</Link>.
|
|
41
41
|
You can remove its access at any time in your <Link href="#">Keston account</Link>.
|
|
@@ -48,7 +48,7 @@ export const Footer: Story = {
|
|
|
48
48
|
render: () => ({
|
|
49
49
|
components: { Link },
|
|
50
50
|
template: `
|
|
51
|
-
<nav aria-label="Legal and help" class="flex items-center gap-2 text-xs text-
|
|
51
|
+
<nav aria-label="Legal and help" class="flex items-center gap-2 text-xs text-ink/65">
|
|
52
52
|
<Link href="#" new-tab>Privacy</Link>
|
|
53
53
|
<span aria-hidden="true">·</span>
|
|
54
54
|
<Link href="#" new-tab>Terms</Link>
|
|
@@ -63,7 +63,7 @@ export const Sizes: Story = {
|
|
|
63
63
|
render: () => ({
|
|
64
64
|
components: { Link },
|
|
65
65
|
template: `
|
|
66
|
-
<div class="flex flex-col gap-2 text-
|
|
66
|
+
<div class="flex flex-col gap-2 text-ink">
|
|
67
67
|
<p class="text-xs"><Link href="#" new-tab>Extra small</Link></p>
|
|
68
68
|
<p class="text-sm"><Link href="#" new-tab>Small</Link></p>
|
|
69
69
|
<p class="text-base"><Link href="#" new-tab>Base</Link></p>
|
|
@@ -33,7 +33,7 @@ const props = withDefaults(defineProps<LinkProps>(), {
|
|
|
33
33
|
// thickens the line. Keyboard focus gets the usual focus ring.
|
|
34
34
|
const base = [
|
|
35
35
|
'cursor-pointer rounded-xs underline underline-offset-2 transition-colors',
|
|
36
|
-
'hover:text-
|
|
36
|
+
'hover:text-ink hover:decoration-2',
|
|
37
37
|
'outline-2 outline-offset-2 outline-transparent focus-visible:outline-focus'
|
|
38
38
|
]
|
|
39
39
|
</script>
|
|
@@ -62,12 +62,13 @@ function attrsFor(item: MenuItem) {
|
|
|
62
62
|
return {}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
// Like Select's options: 32px rows
|
|
66
|
-
//
|
|
65
|
+
// Like Select's options: 32px rows running the full width of the panel,
|
|
66
|
+
// square (the panel keeps its rounded corners), text 12px from the edge,
|
|
67
|
+
// tinted when highlighted.
|
|
67
68
|
const item = [
|
|
68
|
-
'flex min-h-8 cursor-pointer items-center gap-2
|
|
69
|
+
'flex min-h-8 cursor-pointer items-center gap-2 px-3 py-1.5 text-sm text-ink no-underline outline-none select-none',
|
|
69
70
|
'[&_svg]:size-4 [&_svg]:shrink-0',
|
|
70
|
-
'data-highlighted:bg-
|
|
71
|
+
'data-highlighted:bg-selected',
|
|
71
72
|
'data-disabled:cursor-not-allowed data-disabled:opacity-40'
|
|
72
73
|
]
|
|
73
74
|
</script>
|
|
@@ -84,7 +85,7 @@ const item = [
|
|
|
84
85
|
align="end"
|
|
85
86
|
:side-offset="4"
|
|
86
87
|
:collision-padding="8"
|
|
87
|
-
:class="cn(popoverContent, 'min-w-48
|
|
88
|
+
:class="cn(popoverContent, 'min-w-48 overflow-hidden py-1')"
|
|
88
89
|
>
|
|
89
90
|
<DropdownMenuItem
|
|
90
91
|
v-for="i in items"
|
|
@@ -79,8 +79,8 @@ export const Rows: Story = {
|
|
|
79
79
|
components: { Notification },
|
|
80
80
|
setup: () => ({ items: createNotifications(sampleNotifications()).items }),
|
|
81
81
|
template: `
|
|
82
|
-
<ul class="rounded border border-
|
|
83
|
-
<li v-for="item in items" :key="item.id" class="border-b border-
|
|
82
|
+
<ul class="rounded border border-ink/10 bg-surface">
|
|
83
|
+
<li v-for="item in items" :key="item.id" class="border-b border-ink/10 last:border-b-0">
|
|
84
84
|
<Notification appearance="row" v-bind="item" :created-at="item.createdAt" :unread="!item.read" />
|
|
85
85
|
</li>
|
|
86
86
|
</ul>`,
|
|
@@ -171,7 +171,7 @@ export const Playground: Story = {
|
|
|
171
171
|
<template #trailing><NotificationPane :notifications="notifications" /></template>
|
|
172
172
|
</Header>
|
|
173
173
|
<div class="flex flex-col gap-4 p-6">
|
|
174
|
-
<p class="max-w-prose text-sm text-
|
|
174
|
+
<p class="max-w-prose text-sm text-ink/65">Each button sends a notification. It pops up as a toast and is added to the bell.</p>
|
|
175
175
|
<div class="flex flex-wrap gap-2">
|
|
176
176
|
<Button @click="notifications.notify(samples.info)">Info</Button>
|
|
177
177
|
<Button @click="notifications.notify(samples.success)">Success</Button>
|
|
@@ -62,10 +62,10 @@ defineSlots<{
|
|
|
62
62
|
const titleId = `${useId()}-title`
|
|
63
63
|
|
|
64
64
|
const types = {
|
|
65
|
-
info: { icon: Info, colour: 'text-blue', word: 'Information' },
|
|
66
|
-
success: { icon: CircleCheck, colour: 'text-green', word: 'Success' },
|
|
67
|
-
warning: { icon: TriangleAlert, colour: 'text-yellow', word: 'Warning' },
|
|
68
|
-
error: { icon: CircleX, colour: 'text-red', word: 'Error' }
|
|
65
|
+
info: { icon: Info, colour: 'text-blue-fg', word: 'Information' },
|
|
66
|
+
success: { icon: CircleCheck, colour: 'text-green-fg', word: 'Success' },
|
|
67
|
+
warning: { icon: TriangleAlert, colour: 'text-yellow-fg', word: 'Warning' },
|
|
68
|
+
error: { icon: CircleX, colour: 'text-red-fg', word: 'Error' }
|
|
69
69
|
} as const
|
|
70
70
|
|
|
71
71
|
// A string, or a render function (for bold text, links).
|
|
@@ -86,11 +86,11 @@ function runAction() {
|
|
|
86
86
|
role="group"
|
|
87
87
|
:class="
|
|
88
88
|
cn(
|
|
89
|
-
'relative flex text-sm text-
|
|
89
|
+
'relative flex text-sm text-ink',
|
|
90
90
|
oneLine ? 'items-center gap-3' : 'gap-3',
|
|
91
|
-
appearance === 'row' ? 'px-4 py-3' : 'rounded border border-
|
|
91
|
+
appearance === 'row' ? 'px-4 py-3' : 'rounded border border-ink/10 bg-surface shadow-xs',
|
|
92
92
|
appearance === 'card' && (oneLine ? cn('py-1.5 pl-5', dismissible ? 'pr-1.5' : 'pr-4') : 'py-4 pr-4 pl-5'),
|
|
93
|
-
appearance === 'row' && unread && 'bg-blue/5',
|
|
93
|
+
appearance === 'row' && unread && 'bg-blue-fg/5',
|
|
94
94
|
props.class
|
|
95
95
|
)
|
|
96
96
|
"
|
|
@@ -102,11 +102,11 @@ function runAction() {
|
|
|
102
102
|
<span class="sr-only">{{ types[type].word }}: </span>{{ title }}
|
|
103
103
|
</p>
|
|
104
104
|
|
|
105
|
-
<div v-if="!oneLine && (description || $slots.default)" class="text-
|
|
105
|
+
<div v-if="!oneLine && (description || $slots.default)" class="text-ink/65 [&_a]:font-bold [&_a]:text-primary-fg [&_a]:underline [&_b]:font-bold [&_b]:text-ink [&_strong]:font-bold [&_strong]:text-ink">
|
|
106
106
|
<slot><Description /></slot>
|
|
107
107
|
</div>
|
|
108
108
|
|
|
109
|
-
<p v-if="appearance === 'row' && (createdAt || unread)" class="flex items-center gap-1.5 text-xs text-
|
|
109
|
+
<p v-if="appearance === 'row' && (createdAt || unread)" class="flex items-center gap-1.5 text-xs text-ink/65">
|
|
110
110
|
<span v-if="unread" class="size-2 shrink-0 rounded-full bg-primary" aria-hidden="true" />
|
|
111
111
|
<span v-if="unread" class="sr-only">Unread, </span>
|
|
112
112
|
<RelativeTime v-if="createdAt" :date="createdAt" :now="now" />
|
|
@@ -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-
|
|
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-
|
|
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-
|
|
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-
|
|
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',
|