@thekestongroup/ui 0.10.0 → 0.12.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 (44) hide show
  1. package/README.md +8 -12
  2. package/dist/components/AppShell/AppShell.vue.d.ts +11 -1
  3. package/dist/components/CardSelect/CardSelect.vue.d.ts +1 -1
  4. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +1 -1
  5. package/dist/components/Footer/Footer.vue.d.ts +66 -0
  6. package/dist/components/Footer/footer.d.ts +6 -0
  7. package/dist/components/Footer/links.d.ts +8 -0
  8. package/dist/components/FormField/FormField.vue.d.ts +1 -1
  9. package/dist/components/Header/Header.vue.d.ts +7 -2
  10. package/dist/components/Input/Input.vue.d.ts +1 -1
  11. package/dist/components/InputCode/InputCode.vue.d.ts +1 -1
  12. package/dist/components/InputDate/InputDate.vue.d.ts +1 -1
  13. package/dist/components/InputNumber/InputNumber.vue.d.ts +1 -1
  14. package/dist/components/InputPassword/InputPassword.vue.d.ts +1 -1
  15. package/dist/components/InputRichText/InputRichText.vue.d.ts +1 -1
  16. package/dist/components/InputTextArea/InputTextArea.vue.d.ts +1 -1
  17. package/dist/components/RadioGroup/RadioGroup.vue.d.ts +1 -1
  18. package/dist/components/Select/Select.vue.d.ts +1 -1
  19. package/dist/components/Slideover/Slideover.vue.d.ts +1 -1
  20. package/dist/components/StatTile/StatTile.vue.d.ts +10 -1
  21. package/dist/i18n/en.d.ts +6 -0
  22. package/dist/index.d.ts +3 -0
  23. package/dist/keston-ui.js +805 -617
  24. package/package.json +1 -1
  25. package/src/components/AppShell/AppShell.stories.ts +8 -0
  26. package/src/components/AppShell/AppShell.vue +17 -4
  27. package/src/components/Avatar/Avatar.vue +6 -3
  28. package/src/components/Card/Card.stories.ts +1 -1
  29. package/src/components/Checklist/Checklist.stories.ts +1 -1
  30. package/src/components/Footer/Footer.stories.ts +82 -0
  31. package/src/components/Footer/Footer.vue +123 -0
  32. package/src/components/Footer/footer.test.ts +41 -0
  33. package/src/components/Footer/footer.ts +15 -0
  34. package/src/components/Footer/links.ts +19 -0
  35. package/src/components/Header/Header.stories.ts +29 -0
  36. package/src/components/Header/Header.vue +14 -9
  37. package/src/components/Input/Input.vue +1 -0
  38. package/src/components/StatTile/StatTile.stories.ts +11 -2
  39. package/src/components/StatTile/StatTile.vue +43 -6
  40. package/src/examples/AppPages.stories.ts +1 -1
  41. package/src/examples/SchoolPages.stories.ts +2 -2
  42. package/src/i18n/en.ts +6 -0
  43. package/src/index.ts +3 -0
  44. package/src/lib/parseDate.ts +1 -1
package/README.md CHANGED
@@ -112,19 +112,15 @@ prop, component or token).
112
112
 
113
113
  1. With each change, run `pnpm changeset` and commit the file it creates.
114
114
  Merging only collects changes: nothing is released yet.
115
- 2. When you want a release, run the **Release** workflow: Actions → Release →
116
- Run workflow, or:
117
-
118
- ```sh
119
- gh workflow run release.yml -R thekestongroup/ui
120
- ```
121
-
122
- It tests and builds, works out the version from the changesets waiting,
123
- updates `package.json` and `CHANGELOG.md`, commits and tags that on
124
- `main`, and creates a GitHub Release. Then it starts the **Publish**
115
+ 2. The **Release PR** workflow keeps a "Release vX" pull request up to date
116
+ with every changeset waiting on `main`: the new version in `package.json`
117
+ and the entry in `CHANGELOG.md`. It only proposes the release. You can also
118
+ run it by hand: Actions → Release PR → Run workflow.
119
+ 3. When you want a release, merge that pull request. The **Tag release**
120
+ workflow then tags it, creates a GitHub Release and starts the **Publish**
125
121
  workflow, which stages the release on npm (trusted publishing, no token
126
- needed). With no changesets waiting, it stops without releasing.
127
- 3. Approve the staged release on npmjs.com to make it live.
122
+ needed).
123
+ 4. Approve the staged release on npmjs.com to make it live.
128
124
 
129
125
  If staging on npm fails, run **Publish** again by hand on the release's tag
130
126
  (e.g. `v0.4.0`); it skips a version that's already on npm.
@@ -1,4 +1,5 @@
1
1
  import { HTMLAttributes } from 'vue';
2
+ import { FooterProps } from '../Footer/Footer.vue';
2
3
  import { HeaderProps, HeaderUser, HeaderUserAction } from '../Header/Header.vue';
3
4
  import { SidebarItem, SidebarProps } from '../Sidebar/Sidebar.vue';
4
5
  /**
@@ -20,8 +21,12 @@ import { SidebarItem, SidebarProps } from '../Sidebar/Sidebar.vue';
20
21
  * The account menu (top right) is the Header's: pass `user` and listen for
21
22
  * account-settings, switch-account, log-out (and sign-in when signed out).
22
23
  *
24
+ * The footer: pass `footer` (the Footer's props, e.g. `{ appName, version }`) to put the
25
+ * Keston Group footer at the bottom of the page, under the content. It sits at the bottom of the
26
+ * screen on short pages and after the content on long ones.
27
+ *
23
28
  * Slots: default (the page), header-leading, header-middle, header-trailing,
24
- * account, account-menu (passed to Header), sidebar-header and sidebar-footer (passed to Sidebar;
29
+ * account, account-menu and organisation (passed to Header), sidebar-header and sidebar-footer (passed to Sidebar;
25
30
  * sidebar-header is only shown on wide screens, as the Slideover has its own
26
31
  * title).
27
32
  */
@@ -42,6 +47,8 @@ export interface AppShellProps {
42
47
  sections?: SidebarProps['sections'];
43
48
  /** Wide screens: show the header's menu button, which collapses the sidebar to icons. */
44
49
  collapsible?: boolean;
50
+ /** Show the Keston Group footer under the page. The Footer's props: `{ appName, version, … }`. Without it there is no footer. */
51
+ footer?: FooterProps;
45
52
  /** Component used for sidebar items with `to`, and the title link, e.g. RouterLink. */
46
53
  linkComponent?: SidebarProps['linkComponent'];
47
54
  /** Other Header props, e.g. `{ ui: { title: '…' } }`. */
@@ -64,6 +71,9 @@ type __VLS_Slots = {
64
71
  'account-menu'?(props: {
65
72
  close: () => void;
66
73
  }): unknown;
74
+ organisation?(props: {
75
+ close: () => void;
76
+ }): unknown;
67
77
  'sidebar-header'?(props: {
68
78
  collapsed: boolean;
69
79
  }): unknown;
@@ -53,7 +53,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
53
53
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
54
54
  "onUpdate:modelValue"?: ((value: CardSelectValue | undefined) => any) | undefined;
55
55
  }>, {
56
- helperPlacement: "below" | "icon";
56
+ helperPlacement: "icon" | "below";
57
57
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
58
58
  declare const _default: typeof __VLS_export;
59
59
  export default _default;
@@ -39,7 +39,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
39
39
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
40
  "onUpdate:modelValue"?: ((value: CheckboxGroupValue[]) => any) | undefined;
41
41
  }>, {
42
- helperPlacement: "below" | "icon";
42
+ helperPlacement: "icon" | "below";
43
43
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
45
45
  export default _default;
@@ -0,0 +1,66 @@
1
+ import { Component, HTMLAttributes } from 'vue';
2
+ export interface FooterLink {
3
+ label: string;
4
+ /** A plain link. */
5
+ href?: string;
6
+ /** Link through `linkComponent` (e.g. RouterLink), which receives `to`. */
7
+ to?: unknown;
8
+ /** Open in a new tab. Default true for `href` links (they leave the app), false for `to`. */
9
+ newTab?: boolean;
10
+ }
11
+ /**
12
+ * The bottom of an app's page: on the left Help & support and the legal links (Privacy Policy, Terms & Conditions), and
13
+ * on the right the app's name, version and build (so a bug report can say exactly which build) with
14
+ * the copyright. The same in every Keston app; pass the app's `version` and `build`.
15
+ *
16
+ * Without `links` it shows the Keston Group's footer links (`kestonFooterLinks`). Add to them rather than
17
+ * replacing them with `moreLinks` (e.g. Contact us, or `kestonGroupLinks` to point at the other Keston
18
+ * apps), which follow, after a divider. The version comes from the app's package.json and the build
19
+ * from its CI: in Vite, put them in with `define` (see the spec).
20
+ *
21
+ * Slots: nav (instead of the whole link list), end (after the copyright, e.g. a language switcher).
22
+ */
23
+ export interface FooterProps {
24
+ /** The links on the left. Default: `kestonFooterLinks` (Help & support, Privacy Policy, Terms & Conditions). */
25
+ links?: FooterLink[];
26
+ /** More links after a divider, e.g. Contact us, or `kestonGroupLinks` to point at the other Keston apps. */
27
+ moreLinks?: FooterLink[];
28
+ /** Component used for links with `to`, e.g. RouterLink. */
29
+ linkComponent?: string | Component;
30
+ /** The app's name, shown before its version. */
31
+ appName?: string;
32
+ /** The app's version, e.g. "1.4.2" or "v1.4.2". */
33
+ version?: string;
34
+ /** The build, e.g. a commit "a1b2c3d" or a CI run number, shown after the version so a bug report can name the exact build. */
35
+ build?: string;
36
+ /** Who owns the copyright. */
37
+ holder?: string;
38
+ /** The current year. Default: this year, from the device's clock. */
39
+ year?: number;
40
+ /** The first year, to show a range such as 2024–2026. */
41
+ since?: number;
42
+ class?: HTMLAttributes['class'];
43
+ /** Extra classes for the parts. */
44
+ ui?: {
45
+ links?: HTMLAttributes['class'];
46
+ meta?: HTMLAttributes['class'];
47
+ };
48
+ }
49
+ type __VLS_Slots = {
50
+ nav?(): unknown;
51
+ end?(): unknown;
52
+ };
53
+ declare const __VLS_base: import('vue').DefineComponent<FooterProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FooterProps> & Readonly<{}>, {
54
+ links: FooterLink[];
55
+ moreLinks: FooterLink[];
56
+ linkComponent: string | Component;
57
+ holder: string;
58
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
59
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
60
+ declare const _default: typeof __VLS_export;
61
+ export default _default;
62
+ type __VLS_WithSlots<T, S> = T & {
63
+ new (): {
64
+ $slots: S;
65
+ };
66
+ };
@@ -0,0 +1,6 @@
1
+ /** "2024–2026" when `since` is before `year`, otherwise just the year. */
2
+ export declare function yearRange(year: number, since?: number): string;
3
+ /** "1.4.2" and "v1.4.2" both show as "v1.4.2". Empty for no version. */
4
+ export declare function displayVersion(version?: string): string;
5
+ /** The version without a leading "v", for the screen reader's "Version 1.4.2". */
6
+ export declare function bareVersion(version?: string): string;
@@ -0,0 +1,8 @@
1
+ import { FooterLink } from './Footer.vue';
2
+ /**
3
+ * The links every Keston app shows on the left of its footer: help first, then the legal pages.
4
+ * Apps can pass their own `links`, or add to these with `moreLinks`.
5
+ */
6
+ export declare const kestonFooterLinks: FooterLink[];
7
+ /** Links to the rest of the Keston Group. Not shown by default: pass them as `moreLinks` where an app should offer them. */
8
+ export declare const kestonGroupLinks: FooterLink[];
@@ -54,7 +54,7 @@ type __VLS_Slots = {
54
54
  'label-trailing'?(): unknown;
55
55
  };
56
56
  declare const __VLS_base: import('vue').DefineComponent<FormFieldProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {
57
- helperPlacement: "below" | "icon";
57
+ helperPlacement: "icon" | "below";
58
58
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
59
59
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
60
60
  declare const _default: typeof __VLS_export;
@@ -19,7 +19,9 @@ export type HeaderUserAction = 'account-settings' | 'switch-account' | 'log-out'
19
19
  * fills the space between title and trailing), trailing (actions before the
20
20
  * account menu), account (replaces the account menu, or the Sign in button),
21
21
  * account-menu (extra content in the account menu, above Switch account /
22
- * Log out: `{ close }`).
22
+ * Log out: `{ close }`), organisation (replaces the organisation heading at the
23
+ * very top of the account menu, e.g. with a row that switches organisation:
24
+ * `{ close }`).
23
25
  */
24
26
  export interface HeaderProps {
25
27
  /** Name of the app or area, shown next to the menu button. */
@@ -80,6 +82,9 @@ type __VLS_Slots = {
80
82
  'account-menu'?(props: {
81
83
  close: () => void;
82
84
  }): unknown;
85
+ organisation?(props: {
86
+ close: () => void;
87
+ }): unknown;
83
88
  };
84
89
  declare const __VLS_base: import('vue').DefineComponent<HeaderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
85
90
  menu: () => any;
@@ -95,8 +100,8 @@ declare const __VLS_base: import('vue').DefineComponent<HeaderProps, {}, {}, {},
95
100
  "onSign-in"?: (() => any) | undefined;
96
101
  }>, {
97
102
  menu: boolean;
98
- sticky: boolean;
99
103
  linkComponent: string | Component;
104
+ sticky: boolean;
100
105
  menuOpen: boolean;
101
106
  userActions: HeaderUserAction[];
102
107
  signIn: boolean;
@@ -46,7 +46,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
46
46
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
47
47
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
48
48
  }>, {
49
- helperPlacement: "below" | "icon";
49
+ helperPlacement: "icon" | "below";
50
50
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
51
51
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
52
52
  declare const _default: typeof __VLS_export;
@@ -47,7 +47,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
47
47
  onComplete?: ((code: string) => any) | undefined;
48
48
  }>, {
49
49
  length: number;
50
- helperPlacement: "below" | "icon";
50
+ helperPlacement: "icon" | "below";
51
51
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
52
52
  declare const _default: typeof __VLS_export;
53
53
  export default _default;
@@ -44,7 +44,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
44
44
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
45
45
  }>, {
46
46
  locale: string;
47
- helperPlacement: "below" | "icon";
47
+ helperPlacement: "icon" | "below";
48
48
  prefer: DatePreference;
49
49
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
50
50
  declare const _default: typeof __VLS_export;
@@ -40,7 +40,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
40
40
  "onUpdate:modelValue"?: ((value: number | undefined) => any) | undefined;
41
41
  }>, {
42
42
  step: number;
43
- helperPlacement: "below" | "icon";
43
+ helperPlacement: "icon" | "below";
44
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
45
45
  declare const _default: typeof __VLS_export;
46
46
  export default _default;
@@ -41,7 +41,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
41
41
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
42
42
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
43
43
  }>, {
44
- helperPlacement: "below" | "icon";
44
+ helperPlacement: "icon" | "below";
45
45
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
46
46
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
47
47
  declare const _default: typeof __VLS_export;
@@ -40,7 +40,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
40
40
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
41
41
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
42
42
  }>, {
43
- helperPlacement: "below" | "icon";
43
+ helperPlacement: "icon" | "below";
44
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
45
45
  declare const _default: typeof __VLS_export;
46
46
  export default _default;
@@ -43,7 +43,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {
43
43
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
44
44
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
45
45
  }>, {
46
- helperPlacement: "below" | "icon";
46
+ helperPlacement: "icon" | "below";
47
47
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
48
48
  declare const _default: typeof __VLS_export;
49
49
  export default _default;
@@ -39,7 +39,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
39
39
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
40
  "onUpdate:modelValue"?: ((value: RadioValue | undefined) => any) | undefined;
41
41
  }>, {
42
- helperPlacement: "below" | "icon";
42
+ helperPlacement: "icon" | "below";
43
43
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
45
45
  export default _default;
@@ -97,7 +97,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
97
97
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
98
98
  "onUpdate:modelValue"?: ((value: SelectValueType | SelectValueType[] | undefined) => any) | undefined;
99
99
  }>, {
100
- helperPlacement: "below" | "icon";
100
+ helperPlacement: "icon" | "below";
101
101
  options: (string | SelectOption)[];
102
102
  groups: SelectGroupOptions[];
103
103
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -112,7 +112,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
112
112
  modal: boolean;
113
113
  close: boolean;
114
114
  overlay: boolean;
115
- initialFocus: "none" | "close" | "auto";
115
+ initialFocus: "none" | "auto" | "close";
116
116
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
117
117
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
118
118
  declare const _default: typeof __VLS_export;
@@ -1,11 +1,16 @@
1
1
  import { Component, HTMLAttributes } from 'vue';
2
+ import { PrimitiveProps } from 'reka-ui';
2
3
  /**
3
4
  * One number that matters, in a small Card: "Open applications 48".
4
5
  * Put several in a grid. Optionally with how it's changed ("+12% on last
5
6
  * year") and a short description.
6
7
  *
8
+ * Give it an `href` (or `as`, e.g. a router link, with its own `to`) and the
9
+ * whole tile becomes one link: an arrow in the corner shows it's clickable,
10
+ * and it darkens its border on hover and its background when pressed.
11
+ *
7
12
  * Slots: value (e.g. a value with a unit in smaller text), description,
8
- * footer (e.g. a "View all" link).
13
+ * footer (e.g. a "View all" link; not in a tile that is itself a link).
9
14
  */
10
15
  export interface StatTileProps {
11
16
  /** What the number is, e.g. "Open applications". */
@@ -28,6 +33,10 @@ export interface StatTileProps {
28
33
  sentiment?: 'positive' | 'negative' | 'neutral';
29
34
  /** Grey text under the value. */
30
35
  description?: string;
36
+ /** Makes the whole tile a link to here. */
37
+ href?: string;
38
+ /** Element or component to render the link as, e.g. RouterLink (then pass its `to`). Makes the tile a link. */
39
+ as?: PrimitiveProps['as'];
31
40
  class?: HTMLAttributes['class'];
32
41
  }
33
42
  type __VLS_Slots = {
package/dist/i18n/en.d.ts CHANGED
@@ -48,6 +48,12 @@ export declare const en: {
48
48
  chip: {
49
49
  remove: string;
50
50
  };
51
+ footer: {
52
+ label: string;
53
+ version: string;
54
+ build: string;
55
+ copyright: string;
56
+ };
51
57
  formField: {
52
58
  about: string;
53
59
  };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,9 @@ export { default as PageHeader } from './components/PageHeader/PageHeader.vue';
7
7
  export type { PageHeaderAction, PageHeaderProps } from './components/PageHeader/PageHeader.vue';
8
8
  export { default as SettingsRow } from './components/SettingsRow/SettingsRow.vue';
9
9
  export type { SettingsRowProps } from './components/SettingsRow/SettingsRow.vue';
10
+ export { default as Footer } from './components/Footer/Footer.vue';
11
+ export type { FooterLink, FooterProps } from './components/Footer/Footer.vue';
12
+ export { kestonFooterLinks, kestonGroupLinks } from './components/Footer/links';
10
13
  export { default as Avatar } from './components/Avatar/Avatar.vue';
11
14
  export type { AvatarProps, AvatarUser } from './components/Avatar/Avatar.vue';
12
15
  export { default as AvatarGroup } from './components/AvatarGroup/AvatarGroup.vue';