@thekestongroup/ui 0.5.0 → 0.6.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/FormField/FormField.vue.d.ts +5 -0
- package/dist/components/Input/Input.vue.d.ts +2 -0
- package/dist/components/InputDate/InputDate.vue.d.ts +2 -0
- package/dist/components/InputNumber/InputNumber.vue.d.ts +2 -0
- package/dist/components/InputPassword/InputPassword.vue.d.ts +2 -0
- package/dist/components/InputRichText/InputRichText.vue.d.ts +2 -0
- package/dist/components/Menu/Menu.vue.d.ts +38 -0
- package/dist/components/PageHeader/PageHeader.vue.d.ts +23 -1
- package/dist/components/Select/Select.vue.d.ts +2 -0
- package/dist/components/Tabs/Tabs.vue.d.ts +42 -0
- package/dist/index.d.ts +5 -1
- package/dist/keston-ui.js +749 -559
- package/package.json +1 -1
- package/src/components/FormField/FormField.vue +7 -2
- package/src/components/Input/Input.stories.ts +21 -0
- package/src/components/Input/Input.vue +3 -0
- package/src/components/InputDate/InputDate.vue +3 -0
- package/src/components/InputNumber/InputNumber.vue +3 -0
- package/src/components/InputPassword/InputPassword.vue +3 -0
- package/src/components/InputRichText/InputRichText.vue +3 -0
- package/src/components/Menu/Menu.stories.ts +40 -0
- package/src/components/Menu/Menu.vue +104 -0
- package/src/components/PageHeader/PageHeader.stories.ts +33 -1
- package/src/components/PageHeader/PageHeader.vue +52 -1
- package/src/components/Select/Select.vue +3 -0
- package/src/components/Tabs/Tabs.stories.ts +47 -0
- package/src/components/Tabs/Tabs.vue +69 -0
- package/src/index.ts +5 -1
|
@@ -16,6 +16,11 @@ export interface FormFieldProps {
|
|
|
16
16
|
helper?: string;
|
|
17
17
|
/** Show helper text under the label, or behind a `?` icon next to it. */
|
|
18
18
|
helperPlacement?: 'below' | 'icon';
|
|
19
|
+
/**
|
|
20
|
+
* Keep the label (and helper) for screen readers only, e.g. in a table of
|
|
21
|
+
* fields where the column headings say what each one is.
|
|
22
|
+
*/
|
|
23
|
+
hideLabel?: boolean;
|
|
19
24
|
/**
|
|
20
25
|
* Error message, e.g. from a Zod / VeeValidate schema. When set (and not
|
|
21
26
|
* empty) the field shows as an error with this text; leave it undefined
|
|
@@ -8,6 +8,8 @@ export interface InputProps {
|
|
|
8
8
|
helper?: string;
|
|
9
9
|
/** Show helper text under the label, or behind a `?` icon next to it. */
|
|
10
10
|
helperPlacement?: 'below' | 'icon';
|
|
11
|
+
/** Keep the label for screen readers only, e.g. in a table of fields with column headings. */
|
|
12
|
+
hideLabel?: boolean;
|
|
11
13
|
/**
|
|
12
14
|
* Error message, e.g. from a Zod / VeeValidate schema. When set (and not
|
|
13
15
|
* empty) the field shows as an error with this text; leave it undefined
|
|
@@ -8,6 +8,8 @@ export interface InputDateProps {
|
|
|
8
8
|
helper?: string;
|
|
9
9
|
/** Show helper text under the label, or behind a `?` icon next to it. */
|
|
10
10
|
helperPlacement?: 'below' | 'icon';
|
|
11
|
+
/** Keep the label for screen readers only, e.g. in a table of fields with column headings. */
|
|
12
|
+
hideLabel?: boolean;
|
|
11
13
|
/** Error message, e.g. from a Zod schema. Overrides `status` / `statusText`. */
|
|
12
14
|
errorText?: string;
|
|
13
15
|
/** Colours the field and the status text. */
|
|
@@ -7,6 +7,8 @@ export interface InputNumberProps {
|
|
|
7
7
|
helper?: string;
|
|
8
8
|
/** Show helper text under the label, or behind a `?` icon next to it. */
|
|
9
9
|
helperPlacement?: 'below' | 'icon';
|
|
10
|
+
/** Keep the label for screen readers only, e.g. in a table of fields with column headings. */
|
|
11
|
+
hideLabel?: boolean;
|
|
10
12
|
/** Error message, e.g. from a Zod schema. Overrides `status` / `statusText`. */
|
|
11
13
|
errorText?: string;
|
|
12
14
|
/** Colours the field and the status text. */
|
|
@@ -8,6 +8,8 @@ export interface InputPasswordProps {
|
|
|
8
8
|
helper?: string;
|
|
9
9
|
/** Show helper text under the label, or behind a `?` icon next to it. */
|
|
10
10
|
helperPlacement?: 'below' | 'icon';
|
|
11
|
+
/** Keep the label for screen readers only, e.g. in a table of fields with column headings. */
|
|
12
|
+
hideLabel?: boolean;
|
|
11
13
|
/**
|
|
12
14
|
* Error message, e.g. from a Zod / VeeValidate schema or "Incorrect
|
|
13
15
|
* password". When set (and not empty) the field shows as an error with this
|
|
@@ -16,6 +16,8 @@ export interface InputRichTextProps {
|
|
|
16
16
|
helper?: string;
|
|
17
17
|
/** Show helper text under the label, or behind a `?` icon next to it. */
|
|
18
18
|
helperPlacement?: 'below' | 'icon';
|
|
19
|
+
/** Keep the label for screen readers only, e.g. in a table of fields with column headings. */
|
|
20
|
+
hideLabel?: boolean;
|
|
19
21
|
/** Error message, e.g. from a Zod schema. Overrides `status` / `statusText`. */
|
|
20
22
|
errorText?: string;
|
|
21
23
|
/** Colours the field and the status text, e.g. 'loading' while it saves. */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Component, HTMLAttributes } from 'vue';
|
|
2
|
+
export interface MenuItem {
|
|
3
|
+
label: string;
|
|
4
|
+
/** A Lucide (or any) icon component, shown before the label. */
|
|
5
|
+
icon?: Component;
|
|
6
|
+
/** Called when it's chosen (click, Enter or Space). */
|
|
7
|
+
onSelect?: () => void;
|
|
8
|
+
/** Link with a plain <a href>. */
|
|
9
|
+
href?: string;
|
|
10
|
+
/** Link through `linkComponent` (e.g. RouterLink), which receives `to`. */
|
|
11
|
+
to?: unknown;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* More actions behind a "⋯" button, e.g. on each row of a table: Open,
|
|
16
|
+
* Reset password, Delete… Built on Reka UI's DropdownMenu, so it's a proper
|
|
17
|
+
* menu: arrow keys move between items, typing jumps to one, Escape closes
|
|
18
|
+
* it and focus goes back to the button.
|
|
19
|
+
*
|
|
20
|
+
* Items run `onSelect`, or are links (`href`, or `to` through
|
|
21
|
+
* `linkComponent`).
|
|
22
|
+
*/
|
|
23
|
+
export interface MenuProps {
|
|
24
|
+
items: MenuItem[];
|
|
25
|
+
/** The button's accessible name, e.g. "Actions for Jo Bloggs". It has no visible text. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** The button's size; `sm` in compact tables. */
|
|
28
|
+
size?: 'sm' | 'md';
|
|
29
|
+
/** Component used for items with `to`, e.g. RouterLink or NuxtLink. */
|
|
30
|
+
linkComponent?: string | Component;
|
|
31
|
+
class?: HTMLAttributes['class'];
|
|
32
|
+
}
|
|
33
|
+
declare const __VLS_export: import('vue').DefineComponent<MenuProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<MenuProps> & Readonly<{}>, {
|
|
34
|
+
size: "sm" | "md";
|
|
35
|
+
linkComponent: string | Component;
|
|
36
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
declare const _default: typeof __VLS_export;
|
|
38
|
+
export default _default;
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import { Component, HTMLAttributes } from 'vue';
|
|
2
2
|
import { BreadcrumbItem } from '../Breadcrumb/Breadcrumb.vue';
|
|
3
|
+
/** One of the page's everyday actions, in the toolbar under the title. */
|
|
4
|
+
export interface PageHeaderAction {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: Component;
|
|
7
|
+
/** Runs on click, e.g. opens a Slideover. */
|
|
8
|
+
onSelect?: () => void;
|
|
9
|
+
/** Link with a plain <a href>. */
|
|
10
|
+
href?: string;
|
|
11
|
+
/** Link through `linkComponent` (e.g. RouterLink), which receives `to`. */
|
|
12
|
+
to?: unknown;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
3
15
|
/**
|
|
4
16
|
* The top of a page: where it is (breadcrumb), what it is (the h1 title, with
|
|
5
17
|
* an optional status badge and description), and its main actions on the
|
|
6
18
|
* right. Actions wrap under the title on narrow screens.
|
|
7
19
|
*
|
|
20
|
+
* `toolbar`: the everyday things people do to what the page is about (e.g.
|
|
21
|
+
* on a user: Reset password, Unblock sign-in, Delete user), as a row of quiet
|
|
22
|
+
* buttons under the title. Keep the one main action (Save, Add…) in the
|
|
23
|
+
* actions slot on the right; the toolbar is for the rest.
|
|
24
|
+
*
|
|
8
25
|
* Slots: badge (after the title, e.g. a Badge), description (instead of the
|
|
9
26
|
* prop, for links or formatting), actions (e.g. Buttons), default (anything
|
|
10
27
|
* under, e.g. an alert or tabs).
|
|
@@ -18,12 +35,15 @@ export interface PageHeaderProps {
|
|
|
18
35
|
breadcrumb?: BreadcrumbItem[];
|
|
19
36
|
/** Component used for breadcrumb steps with `to`, e.g. RouterLink. */
|
|
20
37
|
linkComponent?: string | Component;
|
|
38
|
+
/** Everyday actions, in a row under the title. */
|
|
39
|
+
toolbar?: PageHeaderAction[];
|
|
21
40
|
class?: HTMLAttributes['class'];
|
|
22
41
|
/** Extra classes for the parts. */
|
|
23
42
|
ui?: {
|
|
24
43
|
title?: HTMLAttributes['class'];
|
|
25
44
|
description?: HTMLAttributes['class'];
|
|
26
45
|
actions?: HTMLAttributes['class'];
|
|
46
|
+
toolbar?: HTMLAttributes['class'];
|
|
27
47
|
};
|
|
28
48
|
}
|
|
29
49
|
type __VLS_Slots = {
|
|
@@ -32,7 +52,9 @@ type __VLS_Slots = {
|
|
|
32
52
|
actions?(): unknown;
|
|
33
53
|
default?(): unknown;
|
|
34
54
|
};
|
|
35
|
-
declare const __VLS_base: import('vue').DefineComponent<PageHeaderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PageHeaderProps> & Readonly<{}>, {
|
|
55
|
+
declare const __VLS_base: import('vue').DefineComponent<PageHeaderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PageHeaderProps> & Readonly<{}>, {
|
|
56
|
+
linkComponent: string | Component;
|
|
57
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
36
58
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
37
59
|
declare const _default: typeof __VLS_export;
|
|
38
60
|
export default _default;
|
|
@@ -68,6 +68,8 @@ export interface SelectProps {
|
|
|
68
68
|
helper?: string;
|
|
69
69
|
/** Show helper text under the label, or behind a `?` icon next to it. */
|
|
70
70
|
helperPlacement?: 'below' | 'icon';
|
|
71
|
+
/** Keep the label for screen readers only, e.g. in a table of fields with column headings. */
|
|
72
|
+
hideLabel?: boolean;
|
|
71
73
|
/** Error message, e.g. from a Zod schema. Overrides `status` / `statusText`. */
|
|
72
74
|
errorText?: string;
|
|
73
75
|
/** Colours the field and the status text. */
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component, HTMLAttributes } from 'vue';
|
|
2
|
+
export interface Tab {
|
|
3
|
+
/** Identifies the tab: v-model's value, and the name of its content slot. */
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
/** A Lucide (or any) icon component, shown before the label. */
|
|
7
|
+
icon?: Component;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Sections of one page, one shown at a time, e.g. a user's Account and
|
|
12
|
+
* Licences & Apps. Built on Reka UI's Tabs: a tab list (arrow keys move
|
|
13
|
+
* between tabs, Home / End jump), each tab's content in a slot named after
|
|
14
|
+
* its value. Use v-model to know or set the open tab (e.g. to keep it in
|
|
15
|
+
* the URL).
|
|
16
|
+
*/
|
|
17
|
+
export interface TabsProps {
|
|
18
|
+
tabs: Tab[];
|
|
19
|
+
/** The tab list's accessible name, e.g. "User details". */
|
|
20
|
+
label: string;
|
|
21
|
+
class?: HTMLAttributes['class'];
|
|
22
|
+
}
|
|
23
|
+
type __VLS_Props = TabsProps;
|
|
24
|
+
type __VLS_Slots = Record<string, () => unknown>;
|
|
25
|
+
type __VLS_ModelProps = {
|
|
26
|
+
/** The open tab's value. Defaults to the first tab. */
|
|
27
|
+
modelValue?: string;
|
|
28
|
+
};
|
|
29
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
30
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
31
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
32
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
33
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
34
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
36
|
+
declare const _default: typeof __VLS_export;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
39
|
+
new (): {
|
|
40
|
+
$slots: S;
|
|
41
|
+
};
|
|
42
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export type { AppShellProps } from './components/AppShell/AppShell.vue';
|
|
|
4
4
|
export { default as Header } from './components/Header/Header.vue';
|
|
5
5
|
export type { HeaderProps, HeaderUser, HeaderUserAction } from './components/Header/Header.vue';
|
|
6
6
|
export { default as PageHeader } from './components/PageHeader/PageHeader.vue';
|
|
7
|
-
export type { PageHeaderProps } from './components/PageHeader/PageHeader.vue';
|
|
7
|
+
export type { PageHeaderAction, PageHeaderProps } from './components/PageHeader/PageHeader.vue';
|
|
8
8
|
export { default as Avatar } from './components/Avatar/Avatar.vue';
|
|
9
9
|
export type { AvatarProps, AvatarUser } from './components/Avatar/Avatar.vue';
|
|
10
10
|
export { default as AvatarGroup } from './components/AvatarGroup/AvatarGroup.vue';
|
|
@@ -72,6 +72,10 @@ export { default as Link } from './components/Link/Link.vue';
|
|
|
72
72
|
export type { LinkProps } from './components/Link/Link.vue';
|
|
73
73
|
export { default as Popover } from './components/Popover/Popover.vue';
|
|
74
74
|
export type { PopoverProps } from './components/Popover/Popover.vue';
|
|
75
|
+
export { default as Menu } from './components/Menu/Menu.vue';
|
|
76
|
+
export type { MenuItem, MenuProps } from './components/Menu/Menu.vue';
|
|
77
|
+
export { default as Tabs } from './components/Tabs/Tabs.vue';
|
|
78
|
+
export type { Tab, TabsProps } from './components/Tabs/Tabs.vue';
|
|
75
79
|
export { default as Slideover } from './components/Slideover/Slideover.vue';
|
|
76
80
|
export type { SlideoverProps } from './components/Slideover/Slideover.vue';
|
|
77
81
|
export { default as Tooltip } from './components/Tooltip/Tooltip.vue';
|