@thekestongroup/ui 0.9.2 → 0.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thekestongroup/ui",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "Keston UI — Vue 3 + Reka UI + Tailwind CSS component library",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -0,0 +1,88 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite'
2
+ import { ref } from 'vue'
3
+ import { Gauge, ShieldCheck, ShieldAlert, SlidersHorizontal } from '@lucide/vue'
4
+ import CardSelect from './CardSelect.vue'
5
+
6
+ const presets = [
7
+ { title: 'Baseline', value: 'baseline', description: '8 characters. Nothing extra.' },
8
+ { title: 'Recommended', value: 'recommended', description: '12 characters and a number.' },
9
+ { title: 'Strict', value: 'strict', description: '14 characters with every kind of character.' },
10
+ { title: 'Custom', value: 'custom', description: 'Set each rule yourself.' },
11
+ ]
12
+
13
+ const meta = {
14
+ title: 'Components/Form/CardSelect',
15
+ component: CardSelect,
16
+ tags: ['autodocs'],
17
+ argTypes: {
18
+ helperPlacement: { options: ['below', 'icon'], control: { type: 'inline-radio' } },
19
+ columns: { options: [undefined, 1, 2, 3, 4], control: { type: 'inline-radio' } },
20
+ },
21
+ args: {
22
+ label: 'Preset',
23
+ options: presets,
24
+ hideLabel: false,
25
+ helper: '',
26
+ helperPlacement: 'below',
27
+ errorText: '',
28
+ disabled: false,
29
+ },
30
+ render: (args) => ({
31
+ components: { CardSelect },
32
+ setup: () => ({ args, value: ref<string | number | undefined>('recommended') }),
33
+ template: '<CardSelect v-bind="args" v-model="value" />',
34
+ }),
35
+ } satisfies Meta<typeof CardSelect>
36
+
37
+ export default meta
38
+ type Story = StoryObj<typeof meta>
39
+
40
+ /** Playground. Tab into the group, then use the arrow keys to choose. Nothing moves when the choice changes. */
41
+ export const Default: Story = {}
42
+
43
+ /** Icons before the titles. */
44
+ export const WithIcons: Story = {
45
+ args: {
46
+ options: [
47
+ { title: 'Baseline', value: 'baseline', description: '8 characters.', icon: ShieldAlert },
48
+ { title: 'Recommended', value: 'recommended', description: '12 characters and a number.', icon: ShieldCheck },
49
+ { title: 'Strict', value: 'strict', description: '14 characters, every kind.', icon: Gauge },
50
+ { title: 'Custom', value: 'custom', description: 'Set each rule yourself.', icon: SlidersHorizontal },
51
+ ],
52
+ },
53
+ }
54
+
55
+ /** Titles only. */
56
+ export const TitlesOnly: Story = {
57
+ args: {
58
+ label: 'Layout',
59
+ options: [
60
+ { title: 'List', value: 'list' },
61
+ { title: 'Grid', value: 'grid' },
62
+ ],
63
+ },
64
+ }
65
+
66
+ export const Nothing: Story = {
67
+ render: (args) => ({
68
+ components: { CardSelect },
69
+ setup: () => ({ args, value: ref<string | number | undefined>() }),
70
+ template: '<CardSelect v-bind="args" v-model="value" />',
71
+ }),
72
+ }
73
+
74
+ export const HelperBelowLabel: Story = { args: { helper: 'You can change any rule afterwards.' } }
75
+ export const HelperBehindIcon: Story = { args: { helper: 'You can change any rule afterwards.', helperPlacement: 'icon' } }
76
+ export const Error: Story = {
77
+ args: { errorText: 'Choose a preset' },
78
+ render: (args) => ({
79
+ components: { CardSelect },
80
+ setup: () => ({ args, value: ref<string | number | undefined>() }),
81
+ template: '<CardSelect v-bind="args" v-model="value" />',
82
+ }),
83
+ }
84
+ export const DisabledOption: Story = {
85
+ args: { options: presets.map((o) => (o.value === 'strict' ? { ...o, disabled: true } : o)) },
86
+ }
87
+ export const Disabled: Story = { args: { disabled: true } }
88
+ export const TwoColumns: Story = { args: { columns: 2 } }
@@ -0,0 +1,151 @@
1
+ <script setup lang="ts">
2
+ import { useI18n } from 'vue-i18n'
3
+ import { computed, useId, type Component, type HTMLAttributes } from 'vue'
4
+ import { RadioGroupItem, RadioGroupRoot } from 'reka-ui'
5
+ import { cn } from '../../lib/cn'
6
+ import InfoTip from '../InfoTip/InfoTip.vue'
7
+ import FieldMessage from '../FormField/FieldMessage.vue'
8
+
9
+ /**
10
+ * One choice from a few, shown as side-by-side cards, e.g. a preset ("Baseline",
11
+ * "Recommended", "Strict", "Custom"). Behaves as a radio group: Tab moves into
12
+ * it, the arrow keys move and choose. Choosing never moves anything: every
13
+ * card keeps the same size, border width and padding whether chosen or not,
14
+ * and the space for the round indicator is always reserved.
15
+ *
16
+ * For a plain list of options with small text, use RadioGroup.
17
+ */
18
+ export type CardSelectValue = string | number
19
+
20
+ export interface CardSelectOption {
21
+ /** The card's heading, e.g. "Recommended". */
22
+ title: string
23
+ value: CardSelectValue
24
+ /** A line or two under the title. */
25
+ description?: string
26
+ /** A Lucide icon (or any component) shown before the title. */
27
+ icon?: Component
28
+ disabled?: boolean
29
+ }
30
+
31
+ export interface CardSelectProps {
32
+ /** The question. Also the group's accessible name. */
33
+ label: string
34
+ options: CardSelectOption[]
35
+ /** Visually hide the label (it stays the accessible name). */
36
+ hideLabel?: boolean
37
+ /** Extra guidance about the choice. */
38
+ helper?: string
39
+ /** Show helper text under the label, or behind a `?` icon next to it. */
40
+ helperPlacement?: 'below' | 'icon'
41
+ /** Error message. */
42
+ errorText?: string
43
+ /**
44
+ * Cards per row on wide screens (1–4). Always one or two per row on
45
+ * narrow screens. By default as many as fit, at least 10rem each.
46
+ */
47
+ columns?: 1 | 2 | 3 | 4
48
+ /** Name for native form submission. */
49
+ name?: string
50
+ required?: boolean
51
+ disabled?: boolean
52
+ class?: HTMLAttributes['class']
53
+ }
54
+
55
+ const { t } = useI18n()
56
+ const props = withDefaults(defineProps<CardSelectProps>(), {
57
+ helperPlacement: 'below'
58
+ })
59
+
60
+ /** The chosen card's value; undefined until one is chosen. */
61
+ const model = defineModel<CardSelectValue | undefined>()
62
+
63
+ const id = useId()
64
+ const labelId = `${id}-label`
65
+ const helperId = `${id}-helper`
66
+ const statusId = `${id}-status`
67
+
68
+ const describedBy = computed(
69
+ () => [props.helper && helperId, props.errorText && statusId].filter(Boolean).join(' ') || undefined
70
+ )
71
+
72
+ const grid = computed(() => {
73
+ switch (props.columns) {
74
+ case 1:
75
+ return 'grid-cols-1'
76
+ case 2:
77
+ return 'grid-cols-1 sm:grid-cols-2'
78
+ case 3:
79
+ return 'grid-cols-1 sm:grid-cols-3'
80
+ case 4:
81
+ return 'grid-cols-2 md:grid-cols-4'
82
+ default:
83
+ return 'grid-cols-[repeat(auto-fit,minmax(min(10rem,100%),1fr))]'
84
+ }
85
+ })
86
+
87
+ // Chosen and not chosen have the same 1px border and padding. The chosen
88
+ // card only changes colours and gets a second, inset 1px line drawn with a
89
+ // box-shadow, which takes no space. Text keeps the same weight. Nothing is
90
+ // added or removed in the card, so nothing can move.
91
+ const card = [
92
+ 'group relative flex w-full cursor-pointer items-start gap-3 rounded-lg border border-black/15 bg-white p-3 text-left text-black transition-colors',
93
+ 'outline-2 outline-offset-2 outline-transparent focus-visible:outline-focus',
94
+ 'not-disabled:not-data-[state=checked]:hover:bg-surface-elevated',
95
+ 'data-[state=checked]:border-primary data-[state=checked]:bg-primary/6 data-[state=checked]:shadow-[inset_0_0_0_1px_var(--color-primary)]',
96
+ 'disabled:cursor-not-allowed disabled:opacity-40',
97
+ 'motion-reduce:transition-none'
98
+ ]
99
+ </script>
100
+
101
+ <template>
102
+ <div :class="cn('flex flex-col gap-2 text-black', disabled && 'opacity-40', props.class)">
103
+ <div :class="cn('flex flex-col gap-0.5', hideLabel && 'sr-only')">
104
+ <div class="flex items-center gap-1">
105
+ <span :id="labelId" class="text-sm">{{ label }}</span>
106
+ <InfoTip v-if="helper && helperPlacement === 'icon'" :text="helper" :label="t('ui.formField.about', { label })" />
107
+ </div>
108
+ <p v-if="helper" :id="helperId" :hidden="helperPlacement === 'icon'" class="text-xs text-black/65">
109
+ {{ helper }}
110
+ </p>
111
+ </div>
112
+
113
+ <RadioGroupRoot
114
+ v-model="model"
115
+ :name="name"
116
+ :required="required"
117
+ :disabled="disabled"
118
+ :aria-labelledby="labelId"
119
+ :aria-describedby="describedBy"
120
+ :aria-invalid="errorText ? true : undefined"
121
+ :class="cn('grid gap-2', grid)"
122
+ >
123
+ <RadioGroupItem
124
+ v-for="(option, i) in options"
125
+ :id="`${id}-${i}`"
126
+ :key="String(option.value)"
127
+ :value="option.value"
128
+ :disabled="option.disabled"
129
+ :aria-describedby="option.description ? `${id}-${i}-description` : undefined"
130
+ :class="cn(card, errorText && 'not-data-[state=checked]:border-red')"
131
+ >
132
+ <component :is="option.icon" v-if="option.icon" aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-black/65 group-data-[state=checked]:text-primary" />
133
+ <span class="flex min-w-0 flex-1 flex-col gap-0.5">
134
+ <span class="text-sm font-bold">{{ option.title }}</span>
135
+ <span v-if="option.description" :id="`${id}-${i}-description`" class="text-xs text-black/65">
136
+ {{ option.description }}
137
+ </span>
138
+ </span>
139
+ <!-- Always there, so the card is the same size either way: the dot only fades and scales in. -->
140
+ <span
141
+ aria-hidden="true"
142
+ class="mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border border-black/55 bg-white group-data-[state=checked]:border-primary"
143
+ >
144
+ <span class="size-2 scale-0 rounded-full bg-primary transition-transform group-data-[state=checked]:scale-100 motion-reduce:transition-none" />
145
+ </span>
146
+ </RadioGroupItem>
147
+ </RadioGroupRoot>
148
+
149
+ <FieldMessage :id="statusId" :status="errorText ? 'error' : undefined" :text="errorText" />
150
+ </div>
151
+ </template>
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite'
2
+ import ChangeIndicator from './ChangeIndicator.vue'
3
+
4
+ const meta = {
5
+ title: 'Components/Element/ChangeIndicator',
6
+ component: ChangeIndicator,
7
+ tags: ['autodocs'],
8
+ args: { from: 15, to: 5 },
9
+ } satisfies Meta<typeof ChangeIndicator>
10
+
11
+ export default meta
12
+ type Story = StoryObj<typeof meta>
13
+
14
+ export const Default: Story = {}
15
+
16
+ /** The unit follows the new value only: `3 → 5 phrases`. */
17
+ export const WithUnit: Story = { args: { from: 3, to: 5, unit: 'phrases' } }
18
+
19
+ /** Text values work too. */
20
+ export const Text: Story = { args: { from: 'Recommended', to: 'Custom' } }
21
+
22
+ /** Nothing is shown when the value is back to what was saved. */
23
+ export const Unchanged: Story = { args: { from: 8, to: 8 } }
24
+
25
+ /** Next to a setting's label, while it has unsaved edits. */
26
+ export const BesideALabel: Story = {
27
+ render: (args) => ({
28
+ components: { ChangeIndicator },
29
+ setup: () => ({ args }),
30
+ template: '<p class="flex items-center gap-2 text-sm">Minimum length <ChangeIndicator v-bind="args" /></p>',
31
+ }),
32
+ }
@@ -0,0 +1,42 @@
1
+ <script setup lang="ts">
2
+ import { useI18n } from 'vue-i18n'
3
+ import { computed, type HTMLAttributes } from 'vue'
4
+ import { ArrowRight } from '@lucide/vue'
5
+ import { cn } from '../../lib/cn'
6
+ import { hasChanged, withUnit, type ChangeValue } from './changeIndicator'
7
+
8
+ /**
9
+ * Shows that a setting has been edited and not yet saved, as old value → new
10
+ * value, e.g. `15 → 5` or `3 → 5 phrases`. Put it next to the setting's label.
11
+ * It renders nothing when `from` and `to` are the same, so it can sit in the
12
+ * template permanently and appear only while the setting is edited.
13
+ */
14
+ export interface ChangeIndicatorProps {
15
+ /** The saved value. */
16
+ from: ChangeValue
17
+ /** The edited value. */
18
+ to: ChangeValue
19
+ /** Unit shown after the new value only, e.g. "phrases". */
20
+ unit?: string
21
+ class?: HTMLAttributes['class']
22
+ }
23
+
24
+ const { t } = useI18n()
25
+ const props = defineProps<ChangeIndicatorProps>()
26
+
27
+ const changed = computed(() => hasChanged(props.from, props.to))
28
+ // Screen readers get one sentence; the symbols are hidden from them.
29
+ const label = computed(() => t('ui.changeIndicator.changed', { from: props.from, to: withUnit(props.to, props.unit) }))
30
+ </script>
31
+
32
+ <template>
33
+ <span
34
+ v-if="changed"
35
+ :class="cn('inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-blue/30 bg-blue/10 px-2 text-xs font-bold text-blue', props.class)"
36
+ >
37
+ <span class="sr-only">{{ label }}</span>
38
+ <span aria-hidden="true" class="font-normal line-through decoration-blue/60">{{ from }}</span>
39
+ <ArrowRight aria-hidden="true" class="size-3 shrink-0" />
40
+ <span aria-hidden="true">{{ to }}<template v-if="unit"> {{ unit }}</template></span>
41
+ </span>
42
+ </template>
@@ -0,0 +1,21 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { hasChanged, withUnit } from './changeIndicator'
3
+
4
+ describe('withUnit', () => {
5
+ it('puts the unit after the value', () => {
6
+ expect(withUnit(5, 'phrases')).toBe('5 phrases')
7
+ })
8
+ it('is just the value without a unit', () => {
9
+ expect(withUnit(5)).toBe('5')
10
+ })
11
+ })
12
+
13
+ describe('hasChanged', () => {
14
+ it('is false for the same value, even as number and string', () => {
15
+ expect(hasChanged(8, 8)).toBe(false)
16
+ expect(hasChanged(8, '8')).toBe(false)
17
+ })
18
+ it('is true when different', () => {
19
+ expect(hasChanged(15, 5)).toBe(true)
20
+ })
21
+ })
@@ -0,0 +1,11 @@
1
+ export type ChangeValue = string | number
2
+
3
+ /** A value with its unit, e.g. "5 phrases"; just the value when there is no unit. */
4
+ export function withUnit(value: ChangeValue, unit?: string): string {
5
+ return unit ? `${value} ${unit}` : String(value)
6
+ }
7
+
8
+ /** True when there is something to show: the value really changed. */
9
+ export function hasChanged(from: ChangeValue, to: ChangeValue): boolean {
10
+ return String(from) !== String(to)
11
+ }
@@ -0,0 +1,62 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3-vite'
2
+ import { ref } from 'vue'
3
+ import Button from '../Button/Button.vue'
4
+ import UnsavedChangesBar from './UnsavedChangesBar.vue'
5
+
6
+ const meta = {
7
+ title: 'Components/Overlay/UnsavedChangesBar',
8
+ component: UnsavedChangesBar,
9
+ tags: ['autodocs'],
10
+ parameters: { layout: 'fullscreen' },
11
+ args: { open: true, message: '', discardLabel: '', saveLabel: '', status: 'idle', reserveSpace: true },
12
+ argTypes: { status: { options: ['idle', 'loading', 'success', 'error'], control: { type: 'inline-radio' } } },
13
+ } satisfies Meta<typeof UnsavedChangesBar>
14
+
15
+ export default meta
16
+ type Story = StoryObj<typeof meta>
17
+
18
+ /** Shown with its defaults: "Unsaved changes", Discard and Save. */
19
+ export const Default: Story = {
20
+ render: (args) => ({
21
+ components: { UnsavedChangesBar },
22
+ setup: () => ({ args }),
23
+ template: `
24
+ <div class="p-6"><p class="text-sm">Page content. The bar is fixed to the bottom of the screen.</p>
25
+ <UnsavedChangesBar v-bind="args" :message="args.message || undefined" :discard-label="args.discardLabel || undefined" :save-label="args.saveLabel || undefined" /></div>`,
26
+ }),
27
+ }
28
+
29
+ /** Edit to open it; it slides up, and slides back down on Discard or Save. Save shows a spinner for a moment. */
30
+ export const SlidesInAndOut: Story = {
31
+ render: () => ({
32
+ components: { UnsavedChangesBar, Button },
33
+ setup() {
34
+ const open = ref(false)
35
+ const status = ref<'idle' | 'loading' | 'success' | 'error'>('idle')
36
+ function save() {
37
+ status.value = 'loading'
38
+ setTimeout(() => {
39
+ status.value = 'idle'
40
+ open.value = false
41
+ }, 1200)
42
+ }
43
+ return { open, status, save }
44
+ },
45
+ template: `
46
+ <div class="flex flex-col items-start gap-4 p-6">
47
+ <p class="text-sm">The bar leaves a gap at the end of the page, so nothing is covered.</p>
48
+ <Button variant="primary" @click="open = true">Make a change</Button>
49
+ <div class="h-[60vh] w-full rounded-lg bg-surface" />
50
+ <p class="text-sm">Last line of the page.</p>
51
+ <UnsavedChangesBar :open="open" :status="status" @discard="open = false" @save="save" />
52
+ </div>`,
53
+ }),
54
+ }
55
+
56
+ /** Words that fit the page, e.g. "Unsaved password policy". */
57
+ export const CustomWords: Story = {
58
+ args: { message: 'Unsaved password policy', discardLabel: 'Undo', saveLabel: 'Apply' },
59
+ render: Default.render,
60
+ }
61
+
62
+ export const Saving: Story = { args: { status: 'loading' }, render: Default.render }
@@ -0,0 +1,87 @@
1
+ <script setup lang="ts">
2
+ import { useI18n } from 'vue-i18n'
3
+ import { computed, type HTMLAttributes } from 'vue'
4
+ import { cn } from '../../lib/cn'
5
+ import Button, { type ButtonStatus } from '../Button/Button.vue'
6
+
7
+ /**
8
+ * A bar that slides up from the bottom of the screen while a page or form has
9
+ * edits that haven't been saved, with Discard and Save. It slides back down
10
+ * when `open` is false, e.g. after saving or discarding. With reduced motion
11
+ * it simply appears and disappears.
12
+ *
13
+ * It is fixed to the bottom of the screen, so it would cover the end of the
14
+ * page. By default it therefore leaves an empty space of its own height at its
15
+ * place in the page (put it last in the page content); set `reserveSpace` to
16
+ * false if you handle that yourself, e.g. with padding on the page.
17
+ *
18
+ * Next to a setting that has been edited, show the old and new values with
19
+ * ChangeIndicator.
20
+ */
21
+ export interface UnsavedChangesBarProps {
22
+ /** Whether it is shown. */
23
+ open: boolean
24
+ /** What it says. Default "Unsaved changes". */
25
+ message?: string
26
+ /** Text of the discard button. Default "Discard". */
27
+ discardLabel?: string
28
+ /** Text of the save button. Default "Save". */
29
+ saveLabel?: string
30
+ /** Progress of saving: `loading` shows a spinner on Save and disables both buttons. */
31
+ status?: ButtonStatus
32
+ /**
33
+ * Keep the end of the page clear of the bar by leaving a blank space as tall
34
+ * as the bar where this component is placed.
35
+ */
36
+ reserveSpace?: boolean
37
+ class?: HTMLAttributes['class']
38
+ }
39
+
40
+ const { t } = useI18n()
41
+ const props = withDefaults(defineProps<UnsavedChangesBarProps>(), {
42
+ status: 'idle',
43
+ reserveSpace: true
44
+ })
45
+
46
+ const emit = defineEmits<{
47
+ /** Discard was pressed: put the edits back. The parent then closes the bar. */
48
+ discard: []
49
+ /** Save was pressed. The parent saves, then sets `open` to false. */
50
+ save: []
51
+ }>()
52
+
53
+ const saving = computed(() => props.status === 'loading')
54
+ </script>
55
+
56
+ <template>
57
+ <!-- Takes the bar's height in the page (only while open), so the last content can be scrolled clear of it. -->
58
+ <div v-if="open && reserveSpace" aria-hidden="true" class="h-20" />
59
+ <Transition
60
+ enter-active-class="transition duration-300 ease-out motion-reduce:transition-none"
61
+ leave-active-class="transition duration-200 ease-in motion-reduce:transition-none"
62
+ enter-from-class="translate-y-full motion-reduce:translate-y-0 motion-reduce:opacity-0"
63
+ leave-to-class="translate-y-full motion-reduce:translate-y-0 motion-reduce:opacity-0"
64
+ >
65
+ <div
66
+ v-if="open"
67
+ role="region"
68
+ :aria-label="message ?? t('ui.unsavedChangesBar.message')"
69
+ :class="cn('fixed inset-x-0 bottom-0 z-40 flex justify-center px-4 pb-4 pointer-events-none', props.class)"
70
+ >
71
+ <div
72
+ class="pointer-events-auto flex w-full max-w-2xl items-center justify-between gap-3 rounded-lg border border-black/15 bg-white p-3 pl-4 shadow-lg"
73
+ >
74
+ <p role="status" class="flex items-center gap-2 text-sm font-bold">
75
+ <span aria-hidden="true" class="size-2 shrink-0 rounded-full bg-yellow" />
76
+ {{ message ?? t('ui.unsavedChangesBar.message') }}
77
+ </p>
78
+ <div class="flex shrink-0 items-center gap-2">
79
+ <Button :disabled="saving" @click="emit('discard')">{{ discardLabel ?? t('ui.unsavedChangesBar.discard') }}</Button>
80
+ <Button variant="primary" :status="status" :disabled="saving" @click="emit('save')">
81
+ {{ saveLabel ?? t('ui.unsavedChangesBar.save') }}
82
+ </Button>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </Transition>
87
+ </template>
package/src/i18n/en.ts CHANGED
@@ -40,6 +40,7 @@ export const en = {
40
40
  chooseMonth: 'Choose month',
41
41
  chooseYear: 'Choose year'
42
42
  },
43
+ changeIndicator: { changed: 'Changed from {from} to {to}' },
43
44
  chip: { remove: 'Remove' },
44
45
  formField: { about: 'About {label}' },
45
46
  header: {
@@ -120,6 +121,11 @@ export const en = {
120
121
  selectAll: 'Select all rows',
121
122
  selectRow: 'Select row {n}',
122
123
  select: 'Select'
124
+ },
125
+ unsavedChangesBar: {
126
+ message: 'Unsaved changes',
127
+ discard: 'Discard',
128
+ save: 'Save'
123
129
  }
124
130
  }
125
131
  }
@@ -54,3 +54,13 @@ describe('createKestonI18n', () => {
54
54
  }
55
55
  })
56
56
  })
57
+
58
+ describe('new component words', () => {
59
+ it('has words for the unsaved changes bar and change indicator', () => {
60
+ const i18n = createKestonI18n()
61
+ expect(i18n.global.t('ui.unsavedChangesBar.message')).toBe('Unsaved changes')
62
+ expect(i18n.global.t('ui.unsavedChangesBar.discard')).toBe('Discard')
63
+ expect(i18n.global.t('ui.unsavedChangesBar.save')).toBe('Save')
64
+ expect(i18n.global.t('ui.changeIndicator.changed', { from: 15, to: '5 phrases' })).toBe('Changed from 15 to 5 phrases')
65
+ })
66
+ })
package/src/index.ts CHANGED
@@ -34,6 +34,8 @@ export { default as Spinner } from './components/Spinner/Spinner.vue'
34
34
  export type { SpinnerProps } from './components/Spinner/Spinner.vue'
35
35
  export { default as Progress } from './components/Progress/Progress.vue'
36
36
  export type { ProgressProps } from './components/Progress/Progress.vue'
37
+ export { default as ChangeIndicator } from './components/ChangeIndicator/ChangeIndicator.vue'
38
+ export type { ChangeIndicatorProps } from './components/ChangeIndicator/ChangeIndicator.vue'
37
39
 
38
40
  // Form
39
41
  export { default as FormField } from './components/FormField/FormField.vue'
@@ -66,6 +68,8 @@ export { default as CheckboxGroup } from './components/CheckboxGroup/CheckboxGro
66
68
  export type { CheckboxGroupProps, CheckboxOption, CheckboxGroupValue } from './components/CheckboxGroup/CheckboxGroup.vue'
67
69
  export { default as LanguageSwitcher } from './components/LanguageSwitcher/LanguageSwitcher.vue'
68
70
  export type { LanguageSwitcherProps } from './components/LanguageSwitcher/LanguageSwitcher.vue'
71
+ export { default as CardSelect } from './components/CardSelect/CardSelect.vue'
72
+ export type { CardSelectProps } from './components/CardSelect/CardSelect.vue'
69
73
 
70
74
  // Data
71
75
  export { default as Table } from './components/Table/Table.vue'
@@ -124,6 +128,8 @@ export type {
124
128
  NotificationType,
125
129
  ToastOptions
126
130
  } from './components/Notification/notifications'
131
+ export { default as UnsavedChangesBar } from './components/UnsavedChangesBar/UnsavedChangesBar.vue'
132
+ export type { UnsavedChangesBarProps } from './components/UnsavedChangesBar/UnsavedChangesBar.vue'
127
133
 
128
134
  // Languages
129
135
  export { createKestonI18n, uiMessages, en } from './i18n'