@thekestongroup/ui 0.2.1 → 0.4.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 (210) hide show
  1. package/README.md +98 -31
  2. package/dist/components/Age/Age.vue.d.ts +19 -0
  3. package/dist/components/AppShell/AppShell.vue.d.ts +108 -0
  4. package/dist/components/Avatar/Avatar.vue.d.ts +34 -0
  5. package/dist/components/AvatarGroup/AvatarGroup.vue.d.ts +25 -0
  6. package/dist/components/Badge/Badge.vue.d.ts +41 -0
  7. package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +39 -0
  8. package/dist/components/Button/Button.vue.d.ts +69 -0
  9. package/dist/components/Calendar/Calendar.vue.d.ts +34 -0
  10. package/dist/components/Card/Card.vue.d.ts +56 -0
  11. package/dist/components/Checkbox/Checkbox.vue.d.ts +40 -0
  12. package/dist/components/Checklist/Checklist.vue.d.ts +18 -0
  13. package/dist/components/Chip/Chip.vue.d.ts +44 -0
  14. package/dist/components/Divider/Divider.vue.d.ts +36 -0
  15. package/dist/components/EmptyState/EmptyState.vue.d.ts +55 -0
  16. package/dist/components/{ToastItem.vue.d.ts → FormField/FieldMessage.vue.d.ts} +10 -2
  17. package/dist/components/FormField/FormField.vue.d.ts +61 -0
  18. package/dist/components/Header/Header.vue.d.ts +104 -0
  19. package/dist/components/InfoTip/InfoTip.vue.d.ts +20 -0
  20. package/dist/components/Input/Input.vue.d.ts +56 -0
  21. package/dist/components/InputCode/InputCode.vue.d.ts +53 -0
  22. package/dist/components/InputDate/InputDate.vue.d.ts +49 -0
  23. package/dist/components/InputNumber/InputNumber.vue.d.ts +44 -0
  24. package/dist/components/InputPassword/InputPassword.vue.d.ts +51 -0
  25. package/dist/components/InputRichText/InputRichText.vue.d.ts +44 -0
  26. package/dist/components/Link/Link.vue.d.ts +39 -0
  27. package/dist/components/Notification/Notification.vue.d.ts +62 -0
  28. package/dist/components/Notification/NotificationPane.vue.d.ts +38 -0
  29. package/dist/components/Notification/Toaster.vue.d.ts +51 -0
  30. package/dist/components/Notification/notification.samples.d.ts +3 -0
  31. package/dist/components/Notification/notifications.d.ts +115 -0
  32. package/dist/components/PageHeader/PageHeader.vue.d.ts +43 -0
  33. package/dist/components/Popover/Popover.vue.d.ts +83 -0
  34. package/dist/components/Popover/popover.d.ts +16 -0
  35. package/dist/components/Progress/Progress.vue.d.ts +26 -0
  36. package/dist/components/RadioGroup/RadioGroup.vue.d.ts +45 -0
  37. package/dist/components/RelativeTime/RelativeTime.vue.d.ts +22 -0
  38. package/dist/components/Select/Select.vue.d.ts +110 -0
  39. package/dist/components/Sidebar/Sidebar.vue.d.ts +106 -0
  40. package/dist/components/Sidebar/sidebar.d.ts +10 -0
  41. package/dist/components/Slideover/Slideover.vue.d.ts +125 -0
  42. package/dist/components/Spinner/Spinner.vue.d.ts +30 -0
  43. package/dist/components/StatTile/StatTile.vue.d.ts +46 -0
  44. package/dist/components/SummaryList/SummaryList.vue.d.ts +62 -0
  45. package/dist/components/Switch/Switch.vue.d.ts +39 -0
  46. package/dist/components/Table/Table.vue.d.ts +82 -0
  47. package/dist/components/Table/table.d.ts +36 -0
  48. package/dist/components/Tooltip/Tooltip.vue.d.ts +46 -0
  49. package/dist/index.d.ts +91 -25
  50. package/dist/keston-ui.js +5030 -14786
  51. package/dist/lib/cn.d.ts +4 -0
  52. package/dist/lib/dates.d.ts +27 -0
  53. package/dist/lib/initials.d.ts +2 -0
  54. package/dist/lib/parseDate.d.ts +44 -0
  55. package/dist/lib/useNow.d.ts +3 -0
  56. package/package.json +57 -24
  57. package/src/components/.gitkeep +0 -0
  58. package/src/components/Age/Age.stories.ts +24 -0
  59. package/src/components/Age/Age.vue +56 -0
  60. package/src/components/AppShell/AppShell.stories.ts +124 -0
  61. package/src/components/AppShell/AppShell.vue +221 -0
  62. package/src/components/Avatar/Avatar.stories.ts +56 -0
  63. package/src/components/Avatar/Avatar.vue +118 -0
  64. package/src/components/AvatarGroup/AvatarGroup.stories.ts +47 -0
  65. package/src/components/AvatarGroup/AvatarGroup.vue +97 -0
  66. package/src/components/Badge/Badge.stories.ts +92 -0
  67. package/src/components/Badge/Badge.vue +67 -0
  68. package/src/components/Breadcrumb/Breadcrumb.stories.ts +58 -0
  69. package/src/components/Breadcrumb/Breadcrumb.vue +109 -0
  70. package/src/components/Button/Button.mdx +79 -0
  71. package/src/components/Button/Button.stories.ts +207 -0
  72. package/src/components/Button/Button.vue +266 -0
  73. package/src/components/Calendar/Calendar.stories.ts +51 -0
  74. package/src/components/Calendar/Calendar.vue +364 -0
  75. package/src/components/Card/Card.stories.ts +109 -0
  76. package/src/components/Card/Card.vue +115 -0
  77. package/src/components/Checkbox/Checkbox.stories.ts +102 -0
  78. package/src/components/Checkbox/Checkbox.vue +102 -0
  79. package/src/components/Checklist/Checklist.stories.ts +67 -0
  80. package/src/components/Checklist/Checklist.vue +38 -0
  81. package/src/components/Chip/Chip.stories.ts +71 -0
  82. package/src/components/Chip/Chip.vue +86 -0
  83. package/src/components/Divider/Divider.stories.ts +57 -0
  84. package/src/components/Divider/Divider.vue +58 -0
  85. package/src/components/EmptyState/EmptyState.stories.ts +99 -0
  86. package/src/components/EmptyState/EmptyState.vue +87 -0
  87. package/src/components/FormField/FieldMessage.vue +81 -0
  88. package/src/components/FormField/FormField.stories.ts +55 -0
  89. package/src/components/FormField/FormField.vue +160 -0
  90. package/src/components/Header/Header.stories.ts +168 -0
  91. package/src/components/Header/Header.vue +232 -0
  92. package/src/components/InfoTip/InfoTip.stories.ts +63 -0
  93. package/src/components/InfoTip/InfoTip.vue +50 -0
  94. package/src/components/Input/Input.stories.ts +206 -0
  95. package/src/components/Input/Input.vue +90 -0
  96. package/src/components/InputCode/InputCode.stories.ts +85 -0
  97. package/src/components/InputCode/InputCode.vue +145 -0
  98. package/src/components/InputDate/InputDate.stories.ts +58 -0
  99. package/src/components/InputDate/InputDate.vue +258 -0
  100. package/src/components/InputNumber/InputNumber.stories.ts +63 -0
  101. package/src/components/InputNumber/InputNumber.vue +109 -0
  102. package/src/components/InputPassword/InputPassword.stories.ts +105 -0
  103. package/src/components/InputPassword/InputPassword.vue +132 -0
  104. package/src/components/InputRichText/InputRichText.stories.ts +100 -0
  105. package/src/components/InputRichText/InputRichText.vue +194 -0
  106. package/src/components/Link/Link.stories.ts +73 -0
  107. package/src/components/Link/Link.vue +56 -0
  108. package/src/components/Notification/Notification.stories.ts +196 -0
  109. package/src/components/Notification/Notification.vue +136 -0
  110. package/src/components/Notification/NotificationPane.vue +186 -0
  111. package/src/components/Notification/Toaster.vue +446 -0
  112. package/src/components/Notification/notification.samples.ts +45 -0
  113. package/src/components/Notification/notifications.test.ts +99 -0
  114. package/src/components/Notification/notifications.ts +172 -0
  115. package/src/components/PageHeader/PageHeader.stories.ts +79 -0
  116. package/src/components/PageHeader/PageHeader.vue +66 -0
  117. package/src/components/Popover/Popover.stories.ts +135 -0
  118. package/src/components/Popover/Popover.vue +192 -0
  119. package/src/components/Popover/popover.ts +20 -0
  120. package/src/components/Progress/Progress.stories.ts +74 -0
  121. package/src/components/Progress/Progress.vue +75 -0
  122. package/src/components/RadioGroup/RadioGroup.stories.ts +90 -0
  123. package/src/components/RadioGroup/RadioGroup.vue +132 -0
  124. package/src/components/RelativeTime/RelativeTime.stories.ts +74 -0
  125. package/src/components/RelativeTime/RelativeTime.vue +51 -0
  126. package/src/components/Select/Select.mdx +202 -0
  127. package/src/components/Select/Select.stories.ts +223 -0
  128. package/src/components/Select/Select.vue +630 -0
  129. package/src/components/Sidebar/Sidebar.stories.ts +192 -0
  130. package/src/components/Sidebar/Sidebar.vue +382 -0
  131. package/src/components/Sidebar/sidebar.ts +20 -0
  132. package/src/components/Slideover/Slideover.stories.ts +225 -0
  133. package/src/components/Slideover/Slideover.vue +365 -0
  134. package/src/components/Spinner/Spinner.stories.ts +79 -0
  135. package/src/components/Spinner/Spinner.vue +97 -0
  136. package/src/components/StatTile/StatTile.stories.ts +75 -0
  137. package/src/components/StatTile/StatTile.vue +89 -0
  138. package/src/components/SummaryList/SummaryList.stories.ts +103 -0
  139. package/src/components/SummaryList/SummaryList.vue +127 -0
  140. package/src/components/Switch/Switch.stories.ts +100 -0
  141. package/src/components/Switch/Switch.vue +96 -0
  142. package/src/components/Table/Table.stories.ts +212 -0
  143. package/src/components/Table/Table.vue +223 -0
  144. package/src/components/Table/table.test.ts +65 -0
  145. package/src/components/Table/table.ts +70 -0
  146. package/src/components/Tooltip/Tooltip.stories.ts +57 -0
  147. package/src/components/Tooltip/Tooltip.vue +86 -0
  148. package/src/examples/AppPages.stories.ts +500 -0
  149. package/src/examples/FormLayout.stories.ts +185 -0
  150. package/src/examples/KestonIdPages.stories.ts +415 -0
  151. package/src/examples/SchoolPages.stories.ts +665 -0
  152. package/src/index.ts +116 -36
  153. package/src/lib/cn.ts +4 -0
  154. package/src/lib/dates.test.ts +68 -0
  155. package/src/lib/dates.ts +86 -0
  156. package/src/lib/initials.ts +8 -0
  157. package/src/lib/parseDate.test.ts +331 -0
  158. package/src/lib/parseDate.ts +561 -0
  159. package/src/lib/useNow.ts +20 -0
  160. package/src/styles/theme.css +101 -0
  161. package/dist/components/AppLauncher.vue.d.ts +0 -10
  162. package/dist/components/Avatar.vue.d.ts +0 -16
  163. package/dist/components/Button.vue.d.ts +0 -27
  164. package/dist/components/Checkbox.vue.d.ts +0 -18
  165. package/dist/components/CloseButton.vue.d.ts +0 -6
  166. package/dist/components/Dialog.vue.d.ts +0 -23
  167. package/dist/components/Drawer.vue.d.ts +0 -34
  168. package/dist/components/DropdownMenu.vue.d.ts +0 -21
  169. package/dist/components/DropdownMenuItem.vue.d.ts +0 -19
  170. package/dist/components/DropdownMenuSeparator.vue.d.ts +0 -6
  171. package/dist/components/Input.vue.d.ts +0 -14
  172. package/dist/components/Label.vue.d.ts +0 -16
  173. package/dist/components/NotificationsMenu.vue.d.ts +0 -3
  174. package/dist/components/Popover.vue.d.ts +0 -23
  175. package/dist/components/ProfileSwitcher.vue.d.ts +0 -24
  176. package/dist/components/Select.vue.d.ts +0 -28
  177. package/dist/components/Separator.vue.d.ts +0 -11
  178. package/dist/components/ToastRenderer.vue.d.ts +0 -3
  179. package/dist/components/Toaster.vue.d.ts +0 -3
  180. package/dist/components/Tooltip.vue.d.ts +0 -23
  181. package/dist/components/TopBar.vue.d.ts +0 -34
  182. package/dist/favicon-old.svg +0 -1
  183. package/dist/favicon.svg +0 -1
  184. package/dist/keston-ui.cjs +0 -15
  185. package/dist/lib/toast.d.ts +0 -29
  186. package/dist/lib/types.d.ts +0 -5
  187. package/src/components/AppLauncher.vue +0 -63
  188. package/src/components/Avatar.vue +0 -51
  189. package/src/components/Button.vue +0 -54
  190. package/src/components/Checkbox.vue +0 -47
  191. package/src/components/CloseButton.vue +0 -24
  192. package/src/components/Dialog.vue +0 -65
  193. package/src/components/Drawer.vue +0 -202
  194. package/src/components/DropdownMenu.vue +0 -41
  195. package/src/components/DropdownMenuItem.vue +0 -28
  196. package/src/components/DropdownMenuSeparator.vue +0 -12
  197. package/src/components/Input.vue +0 -21
  198. package/src/components/Label.vue +0 -15
  199. package/src/components/NotificationsMenu.vue +0 -115
  200. package/src/components/Popover.vue +0 -46
  201. package/src/components/ProfileSwitcher.vue +0 -113
  202. package/src/components/Select.vue +0 -97
  203. package/src/components/Separator.vue +0 -30
  204. package/src/components/ToastItem.vue +0 -158
  205. package/src/components/ToastRenderer.vue +0 -113
  206. package/src/components/Toaster.vue +0 -11
  207. package/src/components/Tooltip.vue +0 -48
  208. package/src/components/TopBar.vue +0 -52
  209. package/src/lib/toast.ts +0 -95
  210. package/src/lib/types.ts +0 -5
@@ -0,0 +1,44 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ /**
3
+ * A small item someone has chosen or entered, e.g. a recipient or a filter,
4
+ * usually shown in a row that wraps. Unlike Badge (a fully rounded status
5
+ * label), a chip has the same 4px corners as Button and Input, and can have a
6
+ * × to remove it.
7
+ *
8
+ * Slots: default (the text), leading (e.g. an icon).
9
+ */
10
+ export interface ChipProps {
11
+ size?: 'sm' | 'md';
12
+ /** Show a × that emits `remove`. */
13
+ removable?: boolean;
14
+ /** Accessible name of the ×, e.g. "Remove Ben Blissett". Default "Remove". */
15
+ removeLabel?: string;
16
+ /**
17
+ * Let keyboard users Tab to the ×. Off when something else offers a
18
+ * keyboard way to remove it (e.g. Backspace in Select's search box).
19
+ */
20
+ removeFocusable?: boolean;
21
+ disabled?: boolean;
22
+ class?: HTMLAttributes['class'];
23
+ }
24
+ type __VLS_Slots = {
25
+ default?(): unknown;
26
+ leading?(): unknown;
27
+ };
28
+ declare const __VLS_base: import('vue').DefineComponent<ChipProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
29
+ remove: () => any;
30
+ }, string, import('vue').PublicProps, Readonly<ChipProps> & Readonly<{
31
+ onRemove?: (() => any) | undefined;
32
+ }>, {
33
+ size: "sm" | "md";
34
+ removeLabel: string;
35
+ removeFocusable: boolean;
36
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
37
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
38
+ declare const _default: typeof __VLS_export;
39
+ export default _default;
40
+ type __VLS_WithSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,36 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ /**
3
+ * A thin line between groups of content, in the same black 15% as every
4
+ * border. Horizontal (between stacked content) or vertical (between items in
5
+ * a row, e.g. toolbar buttons). Optionally with a short label in the middle,
6
+ * e.g. "or".
7
+ *
8
+ * Decorative by default (hidden from screen readers), as the content either
9
+ * side usually has headings. Set `decorative` to false when the split itself
10
+ * carries meaning.
11
+ *
12
+ * Slots: default (the label, instead of the `label` prop).
13
+ */
14
+ export interface DividerProps {
15
+ orientation?: 'horizontal' | 'vertical';
16
+ /** Short text in the middle of a horizontal divider, e.g. "or". */
17
+ label?: string;
18
+ /** Hidden from screen readers (the default). False: announced as a separator. */
19
+ decorative?: boolean;
20
+ class?: HTMLAttributes['class'];
21
+ }
22
+ type __VLS_Slots = {
23
+ default?(): unknown;
24
+ };
25
+ declare const __VLS_base: import('vue').DefineComponent<DividerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<DividerProps> & Readonly<{}>, {
26
+ orientation: "horizontal" | "vertical";
27
+ decorative: boolean;
28
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
@@ -0,0 +1,55 @@
1
+ import { Component, HTMLAttributes } from 'vue';
2
+ /**
3
+ * What to show where a list, table or panel has nothing in it yet: an icon,
4
+ * a short title, a line of explanation, and optionally what to do about it
5
+ * (e.g. a Button). "No connected apps", "You're all caught up", "No
6
+ * applications yet".
7
+ *
8
+ * Slots: title, description, actions (under the text, e.g. a Button),
9
+ * default (anything else, under the description). To animate the icon, pass
10
+ * classes in `ui.icon`.
11
+ */
12
+ export interface EmptyStateProps {
13
+ /** Short and specific, e.g. "No connected apps". */
14
+ title?: string;
15
+ /** What this space is for, or what to do next. */
16
+ description?: string;
17
+ /** A Lucide (or any) icon component, shown above the title. */
18
+ icon?: Component;
19
+ /**
20
+ * Make the title a heading, at this level, to fit the page outline (e.g. 2
21
+ * when it fills a page's main area). Without it the title is plain text,
22
+ * as in a panel or table that already has a heading.
23
+ */
24
+ headingLevel?: 2 | 3 | 4;
25
+ /**
26
+ * - sm: compact, for panels, popovers and tables.
27
+ * - md (default): for a Card or a page's main area.
28
+ */
29
+ size?: 'sm' | 'md';
30
+ class?: HTMLAttributes['class'];
31
+ /** Extra classes for the parts. */
32
+ ui?: {
33
+ icon?: HTMLAttributes['class'];
34
+ title?: HTMLAttributes['class'];
35
+ description?: HTMLAttributes['class'];
36
+ actions?: HTMLAttributes['class'];
37
+ };
38
+ }
39
+ type __VLS_Slots = {
40
+ default?(): unknown;
41
+ title?(): unknown;
42
+ description?(): unknown;
43
+ actions?(): unknown;
44
+ };
45
+ declare const __VLS_base: import('vue').DefineComponent<EmptyStateProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<EmptyStateProps> & Readonly<{}>, {
46
+ size: "sm" | "md";
47
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
48
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
49
+ declare const _default: typeof __VLS_export;
50
+ export default _default;
51
+ type __VLS_WithSlots<T, S> = T & {
52
+ new (): {
53
+ $slots: S;
54
+ };
55
+ };
@@ -1,6 +1,14 @@
1
- import { ToastObject } from 'reka-ui';
1
+ /**
2
+ * Internal (not exported): the status message under a form control, shared
3
+ * by FormField, Checkbox, RadioGroup and Switch so every field's error /
4
+ * success / loading message looks and moves the same.
5
+ */
6
+ export type FieldStatus = 'error' | 'success' | 'loading';
2
7
  type __VLS_Props = {
3
- toast: ToastObject;
8
+ /** id of the screen-reader copy, for the control's aria-describedby. */
9
+ id: string;
10
+ status?: FieldStatus;
11
+ text?: string;
4
12
  };
5
13
  declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
6
14
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,61 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { FieldStatus } from './FieldMessage.vue';
3
+ /**
4
+ * Shared shell for form controls: label, helper text (below or behind a `?`),
5
+ * the bordered box styled like a medium basic Button, and the status message
6
+ * that slides out underneath. Input, InputNumber, InputDate and Select use
7
+ * it; use it too for a text control the library doesn't have, so it looks and
8
+ * behaves like the rest. The control goes in the default slot, which receives
9
+ * the id and ARIA values to put on it.
10
+ */
11
+ export type FormFieldStatus = FieldStatus;
12
+ export interface FormFieldProps {
13
+ /** Visible label. Always set it: it is also the control's accessible name. */
14
+ label: string;
15
+ /** Extra guidance about what to enter. */
16
+ helper?: string;
17
+ /** Show helper text under the label, or behind a `?` icon next to it. */
18
+ helperPlacement?: 'below' | 'icon';
19
+ /**
20
+ * Error message, e.g. from a Zod / VeeValidate schema. When set (and not
21
+ * empty) the field shows as an error with this text; leave it undefined
22
+ * when the value is valid. Overrides `status` and `statusText`.
23
+ */
24
+ errorText?: string;
25
+ /**
26
+ * Colours the field and the status text. `loading` shows a small spinner
27
+ * by the status text while something is checked, e.g. "Checking
28
+ * availability…", and leaves the border as it is.
29
+ */
30
+ status?: FormFieldStatus;
31
+ /** Message under the field, e.g. why the value is invalid. */
32
+ statusText?: string;
33
+ disabled?: boolean;
34
+ class?: HTMLAttributes['class'];
35
+ }
36
+ type __VLS_Slots = {
37
+ default(props: {
38
+ id: string;
39
+ labelId: string;
40
+ describedBy?: string;
41
+ invalid?: true;
42
+ }): unknown;
43
+ leading?(): unknown;
44
+ trailing?(): unknown;
45
+ /**
46
+ * At the end of the label row, e.g. a "Forgot password?" link. It comes
47
+ * after the control in the page, so Tab reaches it after the field.
48
+ */
49
+ 'label-trailing'?(): unknown;
50
+ };
51
+ declare const __VLS_base: import('vue').DefineComponent<FormFieldProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {
52
+ helperPlacement: "below" | "icon";
53
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
54
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
55
+ declare const _default: typeof __VLS_export;
56
+ export default _default;
57
+ type __VLS_WithSlots<T, S> = T & {
58
+ new (): {
59
+ $slots: S;
60
+ };
61
+ };
@@ -0,0 +1,104 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ export interface HeaderUser {
3
+ name: string;
4
+ email?: string;
5
+ /** Organisation or school the account belongs to, shown at the top of the account menu. */
6
+ organisation?: string;
7
+ /** Picture URL. Initials are shown without one. */
8
+ avatar?: string;
9
+ }
10
+ export type HeaderUserAction = 'account-settings' | 'switch-account' | 'log-out';
11
+ /**
12
+ * The bar across the top of every Keston app. It is the same in every app:
13
+ * a menu button (to open the Sidebar on small screens), the app's name, an
14
+ * optional middle area, actions, and the signed-in user's account menu on
15
+ * the right (Account settings, Switch account, Log out). Each part can be
16
+ * overridden with a slot.
17
+ *
18
+ * Slots: leading (before the title, e.g. a logo), title, default (the middle,
19
+ * fills the space between title and trailing), trailing (actions before the
20
+ * account menu), account (replaces the account menu, or the Sign in button),
21
+ * account-menu (extra content in the account menu, above Switch account /
22
+ * Log out: `{ close }`).
23
+ */
24
+ export interface HeaderProps {
25
+ /** Name of the app or area, shown next to the menu button. */
26
+ title?: string;
27
+ /**
28
+ * Show the menu button, which emits `menu` when pressed. Hide it on wide
29
+ * screens with `ui.menu`, e.g. `{ menu: 'lg:hidden' }`.
30
+ */
31
+ menu?: boolean;
32
+ /** Whether what the menu button opens is open, for screen readers (aria-expanded). */
33
+ menuOpen?: boolean;
34
+ /** Id of what the menu button opens (aria-controls). */
35
+ menuControls?: string;
36
+ /** Accessible name of the menu button. */
37
+ menuLabel?: string;
38
+ /**
39
+ * The signed-in user. Shows their picture or initials on the right, which
40
+ * opens the account menu. Without it, a Sign in button is shown instead
41
+ * (see `signIn`).
42
+ */
43
+ user?: HeaderUser;
44
+ /**
45
+ * Which actions the account menu offers. Each emits an event of the same
46
+ * name. Account settings sits under the user's name; Switch account and Log
47
+ * out share the bottom row (left and right).
48
+ */
49
+ userActions?: HeaderUserAction[];
50
+ /** Show a Sign in button (emits `sign-in`) when there is no `user`. */
51
+ signIn?: boolean;
52
+ /**
53
+ * Stay at the top while the page scrolls (on by default). Turn off when the
54
+ * header isn't inside the element that scrolls.
55
+ */
56
+ sticky?: boolean;
57
+ class?: HTMLAttributes['class'];
58
+ /** Extra classes for the parts. */
59
+ ui?: {
60
+ menu?: HTMLAttributes['class'];
61
+ title?: HTMLAttributes['class'];
62
+ middle?: HTMLAttributes['class'];
63
+ trailing?: HTMLAttributes['class'];
64
+ userMenu?: HTMLAttributes['class'];
65
+ };
66
+ }
67
+ type __VLS_Slots = {
68
+ leading?(): unknown;
69
+ title?(): unknown;
70
+ default?(): unknown;
71
+ trailing?(): unknown;
72
+ account?(): unknown;
73
+ 'account-menu'?(props: {
74
+ close: () => void;
75
+ }): unknown;
76
+ };
77
+ declare const __VLS_base: import('vue').DefineComponent<HeaderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
78
+ menu: () => any;
79
+ "account-settings": () => any;
80
+ "switch-account": () => any;
81
+ "log-out": () => any;
82
+ "sign-in": () => any;
83
+ }, string, import('vue').PublicProps, Readonly<HeaderProps> & Readonly<{
84
+ onMenu?: (() => any) | undefined;
85
+ "onAccount-settings"?: (() => any) | undefined;
86
+ "onSwitch-account"?: (() => any) | undefined;
87
+ "onLog-out"?: (() => any) | undefined;
88
+ "onSign-in"?: (() => any) | undefined;
89
+ }>, {
90
+ menu: boolean;
91
+ sticky: boolean;
92
+ menuOpen: boolean;
93
+ menuLabel: string;
94
+ userActions: HeaderUserAction[];
95
+ signIn: boolean;
96
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
97
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
98
+ declare const _default: typeof __VLS_export;
99
+ export default _default;
100
+ type __VLS_WithSlots<T, S> = T & {
101
+ new (): {
102
+ $slots: S;
103
+ };
104
+ };
@@ -0,0 +1,20 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ /**
3
+ * A `?` that explains the thing beside it: a field's label, a table column,
4
+ * a figure. Opens on hover, and on click / tap (which keeps it open, so it
5
+ * works on touch screens). Focus is never moved, so typing in a nearby
6
+ * control isn't interrupted.
7
+ */
8
+ export interface InfoTipProps {
9
+ /** The explanation. Keep it to a sentence or two. */
10
+ text: string;
11
+ /**
12
+ * The button's accessible name: what it explains, e.g. "About Student ID".
13
+ * Screen readers then hear `text` as its description.
14
+ */
15
+ label: string;
16
+ class?: HTMLAttributes['class'];
17
+ }
18
+ declare const __VLS_export: import('vue').DefineComponent<InfoTipProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<InfoTipProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,56 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { FormFieldStatus } from '../FormField/FormField.vue';
3
+ export type InputStatus = FormFieldStatus;
4
+ export interface InputProps {
5
+ /** Visible label. Always set it: it is also the input's accessible name. */
6
+ label: string;
7
+ /** Extra guidance about what to enter. */
8
+ helper?: string;
9
+ /** Show helper text under the label, or behind a `?` icon next to it. */
10
+ helperPlacement?: 'below' | 'icon';
11
+ /**
12
+ * Error message, e.g. from a Zod / VeeValidate schema. When set (and not
13
+ * empty) the field shows as an error with this text; leave it undefined
14
+ * when the value is valid. Overrides `status`, `statusText` and the length
15
+ * check.
16
+ */
17
+ errorText?: string;
18
+ /** Colours the field and the status text. Overrides the length check. */
19
+ status?: InputStatus;
20
+ /** Message under the field, e.g. why the value is invalid. */
21
+ statusText?: string;
22
+ /** Shows an error once the user leaves a field that is too short. */
23
+ minLength?: number;
24
+ /** Shows an error as soon as the value is too long. Typing is not blocked. */
25
+ maxLength?: number;
26
+ disabled?: boolean;
27
+ class?: HTMLAttributes['class'];
28
+ }
29
+ type __VLS_Props = InputProps;
30
+ type __VLS_ModelProps = {
31
+ modelValue?: string;
32
+ };
33
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
34
+ declare const __VLS_template: () => {
35
+ __VLS_Slots: {
36
+ leading?: (props: {}) => any;
37
+ } & {
38
+ trailing?: (props: {}) => any;
39
+ };
40
+ };
41
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
42
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
43
+ "update:modelValue": (value: string) => any;
44
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
45
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
46
+ }>, {
47
+ helperPlacement: "below" | "icon";
48
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
49
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
50
+ declare const _default: typeof __VLS_export;
51
+ export default _default;
52
+ type __VLS_WithSlots<T, S> = T & {
53
+ new (): {
54
+ $slots: S;
55
+ };
56
+ };
@@ -0,0 +1,53 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { FieldStatus } from '../FormField/FieldMessage.vue';
3
+ /**
4
+ * A one-time code, e.g. from an authenticator app, an email or a text
5
+ * message: one box per character. Typing moves to the next box, Backspace to
6
+ * the one before, and pasting (or the code suggested by the phone's keyboard)
7
+ * fills every box at once. Built on Reka UI's PinInput.
8
+ */
9
+ export type InputCodeStatus = FieldStatus;
10
+ export interface InputCodeProps {
11
+ /** Visible label, e.g. "Code from your authenticator app". */
12
+ label: string;
13
+ /** Extra guidance, e.g. where the code was sent. */
14
+ helper?: string;
15
+ /** Show helper text under the label, or behind a `?` icon next to it. */
16
+ helperPlacement?: 'below' | 'icon';
17
+ /** Number of characters. */
18
+ length?: number;
19
+ /** Allow letters as well as digits. Codes are digits only by default. */
20
+ alphanumeric?: boolean;
21
+ /**
22
+ * Error message, e.g. "That code didn't work". When set (and not empty)
23
+ * every box shows as an error with this text. Overrides `status` and
24
+ * `statusText`.
25
+ */
26
+ errorText?: string;
27
+ /** Colours the boxes and the status text; `loading` while the code is checked. */
28
+ status?: InputCodeStatus;
29
+ /** Message under the boxes, e.g. "Checking code…". */
30
+ statusText?: string;
31
+ /** Form field name, so the code is sent with a native form. */
32
+ name?: string;
33
+ disabled?: boolean;
34
+ class?: HTMLAttributes['class'];
35
+ }
36
+ type __VLS_Props = InputCodeProps;
37
+ type __VLS_ModelProps = {
38
+ /** The code as one string, e.g. "042317". Shorter while it's being typed. */
39
+ modelValue?: string;
40
+ };
41
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
42
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
43
+ "update:modelValue": (value: string) => any;
44
+ complete: (code: string) => any;
45
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
46
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
47
+ onComplete?: ((code: string) => any) | undefined;
48
+ }>, {
49
+ length: number;
50
+ helperPlacement: "below" | "icon";
51
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
52
+ declare const _default: typeof __VLS_export;
53
+ export default _default;
@@ -0,0 +1,49 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { FormFieldStatus } from '../FormField/FormField.vue';
3
+ import { DatePreference } from '../../lib/parseDate';
4
+ export interface InputDateProps {
5
+ /** Visible label. Always set it: it is also the field's accessible name. */
6
+ label: string;
7
+ /** Extra guidance about what to enter. */
8
+ helper?: string;
9
+ /** Show helper text under the label, or behind a `?` icon next to it. */
10
+ helperPlacement?: 'below' | 'icon';
11
+ /** Error message, e.g. from a Zod schema. Overrides `status` / `statusText`. */
12
+ errorText?: string;
13
+ /** Colours the field and the status text. */
14
+ status?: FormFieldStatus;
15
+ /** Message under the field. */
16
+ statusText?: string;
17
+ /** Earliest allowed date, as `YYYY-MM-DD`. */
18
+ min?: string;
19
+ /** Latest allowed date, as `YYYY-MM-DD`. */
20
+ max?: string;
21
+ /** Sets the order of day / month / year and the calendar's language. */
22
+ locale?: string;
23
+ /**
24
+ * How typed dates that don't say which year, month or week are read
25
+ * ("5th march", "the 5th", "tuesday", "christmas"): 'future' (default)
26
+ * picks the next one, 'past' the last one, 'nearest' the closest. Use
27
+ * 'past' for things that already happened, e.g. an incident date.
28
+ */
29
+ prefer?: DatePreference;
30
+ disabled?: boolean;
31
+ class?: HTMLAttributes['class'];
32
+ }
33
+ type __VLS_Props = InputDateProps;
34
+ type __VLS_ModelProps = {
35
+ /** The date as `YYYY-MM-DD`, or undefined when empty or incomplete. */
36
+ modelValue?: string | undefined;
37
+ };
38
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
39
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
40
+ "update:modelValue": (value: string | undefined) => any;
41
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
42
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
43
+ }>, {
44
+ helperPlacement: "below" | "icon";
45
+ locale: string;
46
+ prefer: DatePreference;
47
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
48
+ declare const _default: typeof __VLS_export;
49
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { FormFieldStatus } from '../FormField/FormField.vue';
3
+ export interface InputNumberProps {
4
+ /** Visible label. Always set it: it is also the input's accessible name. */
5
+ label: string;
6
+ /** Extra guidance about what to enter. */
7
+ helper?: string;
8
+ /** Show helper text under the label, or behind a `?` icon next to it. */
9
+ helperPlacement?: 'below' | 'icon';
10
+ /** Error message, e.g. from a Zod schema. Overrides `status` / `statusText`. */
11
+ errorText?: string;
12
+ /** Colours the field and the status text. */
13
+ status?: FormFieldStatus;
14
+ /** Message under the field. */
15
+ statusText?: string;
16
+ /** Lowest allowed value. The − button is disabled when reached. */
17
+ min?: number;
18
+ /** Highest allowed value. The + button is disabled when reached. */
19
+ max?: number;
20
+ /** How much − / + and the arrow keys change the value. */
21
+ step?: number;
22
+ /** How the number is displayed, e.g. `{ style: 'currency', currency: 'GBP' }`. */
23
+ formatOptions?: Intl.NumberFormatOptions;
24
+ /** Locale for formatting. Defaults to the browser's. */
25
+ locale?: string;
26
+ disabled?: boolean;
27
+ class?: HTMLAttributes['class'];
28
+ }
29
+ type __VLS_Props = InputNumberProps;
30
+ type __VLS_ModelProps = {
31
+ /** The number, or undefined when the field is empty. */
32
+ modelValue?: number | undefined;
33
+ };
34
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
35
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
36
+ "update:modelValue": (value: number | undefined) => any;
37
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
38
+ "onUpdate:modelValue"?: ((value: number | undefined) => any) | undefined;
39
+ }>, {
40
+ step: number;
41
+ helperPlacement: "below" | "icon";
42
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
43
+ declare const _default: typeof __VLS_export;
44
+ export default _default;
@@ -0,0 +1,51 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { FormFieldStatus } from '../FormField/FormField.vue';
3
+ export type InputPasswordStatus = FormFieldStatus;
4
+ export interface InputPasswordProps {
5
+ /** Visible label. Always set it: it is also the input's accessible name. */
6
+ label: string;
7
+ /** Extra guidance, e.g. the password rules when choosing a new one. */
8
+ helper?: string;
9
+ /** Show helper text under the label, or behind a `?` icon next to it. */
10
+ helperPlacement?: 'below' | 'icon';
11
+ /**
12
+ * Error message, e.g. from a Zod / VeeValidate schema or "Incorrect
13
+ * password". When set (and not empty) the field shows as an error with this
14
+ * text. Overrides `status`, `statusText` and the Caps Lock note.
15
+ */
16
+ errorText?: string;
17
+ /** Colours the field and the status text. */
18
+ status?: InputPasswordStatus;
19
+ /** Message under the field. Overrides the Caps Lock note. */
20
+ statusText?: string;
21
+ disabled?: boolean;
22
+ class?: HTMLAttributes['class'];
23
+ }
24
+ type __VLS_Props = InputPasswordProps;
25
+ type __VLS_ModelProps = {
26
+ modelValue?: string;
27
+ };
28
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
+ declare const __VLS_template: () => {
30
+ __VLS_Slots: {
31
+ leading?: (props: {}) => any;
32
+ } & {
33
+ 'label-trailing'?: (props: {}) => any;
34
+ };
35
+ };
36
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
37
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
38
+ "update:modelValue": (value: string) => any;
39
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
41
+ }>, {
42
+ helperPlacement: "below" | "icon";
43
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
44
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
45
+ declare const _default: typeof __VLS_export;
46
+ export default _default;
47
+ type __VLS_WithSlots<T, S> = T & {
48
+ new (): {
49
+ $slots: S;
50
+ };
51
+ };
@@ -0,0 +1,44 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { FormFieldStatus } from '../FormField/FormField.vue';
3
+ /**
4
+ * Several lines of text with bold, italic and underline, e.g. notes on a
5
+ * student or an application. Only those three: no headings, lists, links or
6
+ * colours, so notes look the same everywhere. Pasted text keeps its bold,
7
+ * italic and underline and loses everything else.
8
+ *
9
+ * The value is HTML using only <p>, <br>, <strong>, <em> and <u>. Sanitise
10
+ * it on the server like any HTML from a browser before showing it elsewhere.
11
+ */
12
+ export interface InputRichTextProps {
13
+ /** Visible label. Always set it: it is also the editor's accessible name. */
14
+ label: string;
15
+ /** Extra guidance about what to write. */
16
+ helper?: string;
17
+ /** Show helper text under the label, or behind a `?` icon next to it. */
18
+ helperPlacement?: 'below' | 'icon';
19
+ /** Error message, e.g. from a Zod schema. Overrides `status` / `statusText`. */
20
+ errorText?: string;
21
+ /** Colours the field and the status text, e.g. 'loading' while it saves. */
22
+ status?: FormFieldStatus;
23
+ /** Message under the field. */
24
+ statusText?: string;
25
+ /** Shown in the empty editor, e.g. "Add a note…". */
26
+ placeholder?: string;
27
+ disabled?: boolean;
28
+ class?: HTMLAttributes['class'];
29
+ }
30
+ type __VLS_Props = InputRichTextProps;
31
+ type __VLS_ModelProps = {
32
+ /** The text as HTML; an empty string when there's nothing in it. */
33
+ modelValue?: string;
34
+ };
35
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
36
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
37
+ "update:modelValue": (value: string) => any;
38
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
39
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
40
+ }>, {
41
+ helperPlacement: "below" | "icon";
42
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
43
+ declare const _default: typeof __VLS_export;
44
+ export default _default;