@thekestongroup/ui 0.9.0 → 0.9.2
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/Checklist/Checklist.vue.d.ts +2 -0
- package/dist/components/Steps/Steps.vue.d.ts +1 -1
- package/dist/keston-ui.js +459 -437
- package/package.json +1 -1
- package/src/components/Checklist/Checklist.stories.ts +6 -0
- package/src/components/Checklist/Checklist.vue +3 -1
- package/src/components/Header/Header.vue +3 -2
- package/src/components/Slideover/Slideover.vue +5 -3
- package/src/components/Steps/Steps.vue +2 -2
- package/src/components/Table/Table.vue +22 -7
package/package.json
CHANGED
|
@@ -25,6 +25,12 @@ export const Default: Story = {
|
|
|
25
25
|
decorators: [() => ({ template: '<div class="max-w-72"><story /></div>' })],
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/** After submitting without meeting everything: the circles not done yet turn red. */
|
|
29
|
+
export const Invalid: Story = {
|
|
30
|
+
decorators: [() => ({ template: '<div class="max-w-72"><story /></div>' })],
|
|
31
|
+
args: { invalid: true },
|
|
32
|
+
};
|
|
33
|
+
|
|
28
34
|
/** Long steps wrap; the icon stays level with the first line. */
|
|
29
35
|
export const LongItems: Story = {
|
|
30
36
|
decorators: [() => ({ template: '<div class="max-w-72"><story /></div>' })],
|
|
@@ -16,6 +16,8 @@ export interface ChecklistItem {
|
|
|
16
16
|
|
|
17
17
|
export interface ChecklistProps {
|
|
18
18
|
items: ChecklistItem[]
|
|
19
|
+
/** Turns the circles of items not done yet red, e.g. after submitting a form that doesn't meet them. */
|
|
20
|
+
invalid?: boolean
|
|
19
21
|
class?: HTMLAttributes['class']
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -28,7 +30,7 @@ const props = defineProps<ChecklistProps>()
|
|
|
28
30
|
<!-- h-5 keeps the icon level with the first line of a label that wraps. -->
|
|
29
31
|
<span class="flex h-5 shrink-0 items-center">
|
|
30
32
|
<CircleCheck v-if="item.done" class="size-4 text-green" aria-hidden="true" />
|
|
31
|
-
<Circle v-else class="size-4 text-black/40" aria-hidden="true" />
|
|
33
|
+
<Circle v-else :class="cn('size-4', invalid ? 'text-red' : 'text-black/40')" aria-hidden="true" />
|
|
32
34
|
</span>
|
|
33
35
|
<span :class="item.done ? 'text-black' : 'text-black/65'">
|
|
34
36
|
{{ item.label }}<span class="sr-only">{{ item.done ? ' (done)' : ' (to do)' }}</span>
|
|
@@ -202,6 +202,7 @@ function runAction(action: HeaderUserAction, close: () => void) {
|
|
|
202
202
|
<p
|
|
203
203
|
v-if="user.organisation"
|
|
204
204
|
class="truncate px-4 pt-3 text-xs font-bold text-black/65 uppercase"
|
|
205
|
+
:title="user.organisation"
|
|
205
206
|
>
|
|
206
207
|
{{ user.organisation }}
|
|
207
208
|
</p>
|
|
@@ -211,8 +212,8 @@ function runAction(action: HeaderUserAction, close: () => void) {
|
|
|
211
212
|
<div class="grid grid-cols-[auto_minmax(0,1fr)] items-start gap-x-3 gap-y-2 px-4 py-3">
|
|
212
213
|
<Avatar :user="user" size="lg" decorative />
|
|
213
214
|
<div class="flex min-w-0 flex-col">
|
|
214
|
-
<span class="truncate font-bold">{{ user.name }}</span>
|
|
215
|
-
<span v-if="user.email" class="truncate text-sm text-black/65">{{ user.email }}</span>
|
|
215
|
+
<span class="truncate font-bold" :title="user.name">{{ user.name }}</span>
|
|
216
|
+
<span v-if="user.email" class="truncate text-sm text-black/65" :title="user.email">{{ user.email }}</span>
|
|
216
217
|
</div>
|
|
217
218
|
<Button
|
|
218
219
|
v-if="userActions.includes('account-settings')"
|
|
@@ -295,6 +295,10 @@ const panel = [
|
|
|
295
295
|
v-if="title || description || close || steps || $slots.header || $slots.title"
|
|
296
296
|
:class="cn('flex flex-col gap-4 border-b border-black/15 px-6 py-4', ui?.header)"
|
|
297
297
|
>
|
|
298
|
+
<!-- The step sits above its progress bar. -->
|
|
299
|
+
<p v-if="steps" :id="stepLabelId" class="text-sm text-black/65">
|
|
300
|
+
Step {{ step + 1 }} of {{ stepCount }}: <span class="text-black">{{ steps[step] }}</span>
|
|
301
|
+
</p>
|
|
298
302
|
<Progress v-if="steps" :label="title ?? t('ui.slideover.steps')" segments :value="step + 1" :max="stepCount" />
|
|
299
303
|
<div class="flex items-start gap-4">
|
|
300
304
|
<slot name="header" :close="closePanel">
|
|
@@ -310,9 +314,7 @@ const panel = [
|
|
|
310
314
|
class="flex flex-col gap-1 text-sm text-black/65"
|
|
311
315
|
>
|
|
312
316
|
<p v-if="description || $slots.description"><slot name="description">{{ description }}</slot></p>
|
|
313
|
-
<p v-if="steps"
|
|
314
|
-
Step {{ step + 1 }} of {{ stepCount }}: <span class="text-black">{{ steps[step] }}</span>
|
|
315
|
-
</p>
|
|
317
|
+
<p v-if="steps" class="sr-only">{{ stepText }}</p>
|
|
316
318
|
</DialogDescription>
|
|
317
319
|
<p v-if="steps" aria-live="polite" class="sr-only">{{ announcement }}</p>
|
|
318
320
|
</div>
|
|
@@ -6,7 +6,7 @@ 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"
|
|
9
|
+
* the current one, and "Step 2 of 3: Licences" above it. Put it at the top of
|
|
10
10
|
* a multi-step form. (Slideover's `steps` shows one for you; use this when
|
|
11
11
|
* the steps are on a page, or in a Slideover you drive yourself.) The words
|
|
12
12
|
* are announced when the step changes.
|
|
@@ -26,7 +26,6 @@ const props = defineProps<StepsProps>()
|
|
|
26
26
|
|
|
27
27
|
<template>
|
|
28
28
|
<div :class="cn('flex flex-col gap-3', props.class)">
|
|
29
|
-
<Progress :label="label" segments :value="step + 1" :max="steps.length" />
|
|
30
29
|
<p class="text-sm text-black/65" aria-live="polite">
|
|
31
30
|
<I18nT keypath="ui.steps.stepOfNamed" scope="global" tag="span">
|
|
32
31
|
<template #current>{{ step + 1 }}</template>
|
|
@@ -34,5 +33,6 @@ const props = defineProps<StepsProps>()
|
|
|
34
33
|
<template #name><span class="text-black">{{ steps[step] }}</span></template>
|
|
35
34
|
</I18nT>
|
|
36
35
|
</p>
|
|
36
|
+
<Progress :label="label" segments :value="step + 1" :max="steps.length" />
|
|
37
37
|
</div>
|
|
38
38
|
</template>
|
|
@@ -161,20 +161,25 @@ function linkFor(row: Row, index: number) {
|
|
|
161
161
|
return props.linkComponent === 'a' ? { href: target as string } : { to: target }
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
//
|
|
164
|
+
// A click anywhere on the row follows its link. Each cell is `relative` and
|
|
165
|
+
// holds its own overlay: the real link's ::after in its cell, and in the
|
|
166
|
+
// others a hidden twin (same target, out of the tab order and the
|
|
167
|
+
// accessibility tree). Not one overlay stretched across the row: Safari
|
|
168
|
+
// (WebKit) doesn't reliably make a <tr> the containing block for absolutely
|
|
169
|
+
// positioned children, so it grew to the whole table. Controls in other cells
|
|
170
|
+
// are lifted above the overlays, so they still get their own clicks. The focus
|
|
171
|
+
// ring is drawn on the real link's ::after, and the row is shaded to match.
|
|
168
172
|
const rowLinkClass = [
|
|
169
173
|
'text-inherit no-underline outline-none group-hover/row:underline underline-offset-2',
|
|
170
174
|
'after:absolute after:inset-0 after:outline-2 after:-outline-offset-2 after:outline-transparent',
|
|
171
175
|
'focus-visible:after:outline-focus forced-colors:not-focus-visible:after:outline-0'
|
|
172
176
|
]
|
|
173
177
|
const linkedRowClass = [
|
|
174
|
-
'
|
|
175
|
-
'[&_:is(a,button,input,select,textarea,label,[tabindex]):not([data-row-link])]:relative',
|
|
176
|
-
'[&_:is(a,button,input,select,textarea,label,[tabindex]):not([data-row-link])]:z-1'
|
|
178
|
+
'cursor-pointer hover:bg-black/5 has-[[data-row-link]:focus-visible]:bg-black/5',
|
|
179
|
+
'[&_:is(a,button,input,select,textarea,label,[tabindex]):not([data-row-link],[data-row-overlay])]:relative',
|
|
180
|
+
'[&_:is(a,button,input,select,textarea,label,[tabindex]):not([data-row-link],[data-row-overlay])]:z-1'
|
|
177
181
|
]
|
|
182
|
+
const overlayClass = 'absolute inset-0 outline-none'
|
|
178
183
|
|
|
179
184
|
const cellPadding = computed(() => {
|
|
180
185
|
const base = props.size === 'sm' ? 'px-4 py-2' : 'px-4 py-3'
|
|
@@ -321,10 +326,20 @@ onBeforeUnmount(() => observer?.disconnect())
|
|
|
321
326
|
column.rowHeader ? 'font-bold' : 'font-normal',
|
|
322
327
|
column.align === 'end' && 'tabular-nums',
|
|
323
328
|
cellPadding,
|
|
329
|
+
linkFor(row, index) && 'relative',
|
|
324
330
|
columnClasses(column)
|
|
325
331
|
)
|
|
326
332
|
"
|
|
327
333
|
>
|
|
334
|
+
<component
|
|
335
|
+
:is="linkComponent"
|
|
336
|
+
v-if="column.key !== linkColumn && linkFor(row, index)"
|
|
337
|
+
v-bind="linkFor(row, index)"
|
|
338
|
+
data-row-overlay
|
|
339
|
+
tabindex="-1"
|
|
340
|
+
aria-hidden="true"
|
|
341
|
+
:class="overlayClass"
|
|
342
|
+
/>
|
|
328
343
|
<component
|
|
329
344
|
:is="linkComponent"
|
|
330
345
|
v-if="column.key === linkColumn && linkFor(row, index)"
|