@thekestongroup/ui 0.2.0 → 0.3.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 (207) hide show
  1. package/README.md +90 -32
  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/{ToastItem.vue.d.ts → FormField/FieldMessage.vue.d.ts} +10 -2
  16. package/dist/components/FormField/FormField.vue.d.ts +61 -0
  17. package/dist/components/Header/Header.vue.d.ts +104 -0
  18. package/dist/components/InfoTip/InfoTip.vue.d.ts +20 -0
  19. package/dist/components/Input/Input.vue.d.ts +56 -0
  20. package/dist/components/InputCode/InputCode.vue.d.ts +53 -0
  21. package/dist/components/InputDate/InputDate.vue.d.ts +49 -0
  22. package/dist/components/InputNumber/InputNumber.vue.d.ts +44 -0
  23. package/dist/components/InputPassword/InputPassword.vue.d.ts +51 -0
  24. package/dist/components/InputRichText/InputRichText.vue.d.ts +44 -0
  25. package/dist/components/Link/Link.vue.d.ts +39 -0
  26. package/dist/components/Notification/Notification.vue.d.ts +62 -0
  27. package/dist/components/Notification/NotificationPane.vue.d.ts +38 -0
  28. package/dist/components/Notification/Toaster.vue.d.ts +51 -0
  29. package/dist/components/Notification/notification.samples.d.ts +3 -0
  30. package/dist/components/Notification/notifications.d.ts +115 -0
  31. package/dist/components/PageHeader/PageHeader.vue.d.ts +43 -0
  32. package/dist/components/Popover/Popover.vue.d.ts +83 -0
  33. package/dist/components/Popover/popover.d.ts +16 -0
  34. package/dist/components/Progress/Progress.vue.d.ts +26 -0
  35. package/dist/components/RadioGroup/RadioGroup.vue.d.ts +45 -0
  36. package/dist/components/RelativeTime/RelativeTime.vue.d.ts +22 -0
  37. package/dist/components/Select/Select.vue.d.ts +110 -0
  38. package/dist/components/Sidebar/Sidebar.vue.d.ts +106 -0
  39. package/dist/components/Sidebar/sidebar.d.ts +10 -0
  40. package/dist/components/Slideover/Slideover.vue.d.ts +125 -0
  41. package/dist/components/Spinner/Spinner.vue.d.ts +30 -0
  42. package/dist/components/StatTile/StatTile.vue.d.ts +46 -0
  43. package/dist/components/SummaryList/SummaryList.vue.d.ts +62 -0
  44. package/dist/components/Switch/Switch.vue.d.ts +39 -0
  45. package/dist/components/Table/Table.vue.d.ts +82 -0
  46. package/dist/components/Table/table.d.ts +36 -0
  47. package/dist/components/Tooltip/Tooltip.vue.d.ts +46 -0
  48. package/dist/index.d.ts +89 -25
  49. package/dist/keston-ui.js +4963 -14785
  50. package/dist/lib/cn.d.ts +4 -0
  51. package/dist/lib/dates.d.ts +27 -0
  52. package/dist/lib/initials.d.ts +2 -0
  53. package/dist/lib/parseDate.d.ts +44 -0
  54. package/dist/lib/useNow.d.ts +3 -0
  55. package/package.json +53 -24
  56. package/src/components/.gitkeep +0 -0
  57. package/src/components/Age/Age.stories.ts +24 -0
  58. package/src/components/Age/Age.vue +56 -0
  59. package/src/components/AppShell/AppShell.stories.ts +124 -0
  60. package/src/components/AppShell/AppShell.vue +212 -0
  61. package/src/components/Avatar/Avatar.stories.ts +56 -0
  62. package/src/components/Avatar/Avatar.vue +118 -0
  63. package/src/components/AvatarGroup/AvatarGroup.stories.ts +47 -0
  64. package/src/components/AvatarGroup/AvatarGroup.vue +97 -0
  65. package/src/components/Badge/Badge.stories.ts +92 -0
  66. package/src/components/Badge/Badge.vue +67 -0
  67. package/src/components/Breadcrumb/Breadcrumb.stories.ts +58 -0
  68. package/src/components/Breadcrumb/Breadcrumb.vue +109 -0
  69. package/src/components/Button/Button.mdx +79 -0
  70. package/src/components/Button/Button.stories.ts +207 -0
  71. package/src/components/Button/Button.vue +266 -0
  72. package/src/components/Calendar/Calendar.stories.ts +51 -0
  73. package/src/components/Calendar/Calendar.vue +364 -0
  74. package/src/components/Card/Card.stories.ts +109 -0
  75. package/src/components/Card/Card.vue +115 -0
  76. package/src/components/Checkbox/Checkbox.stories.ts +102 -0
  77. package/src/components/Checkbox/Checkbox.vue +102 -0
  78. package/src/components/Checklist/Checklist.stories.ts +67 -0
  79. package/src/components/Checklist/Checklist.vue +38 -0
  80. package/src/components/Chip/Chip.stories.ts +71 -0
  81. package/src/components/Chip/Chip.vue +86 -0
  82. package/src/components/Divider/Divider.stories.ts +57 -0
  83. package/src/components/Divider/Divider.vue +58 -0
  84. package/src/components/FormField/FieldMessage.vue +81 -0
  85. package/src/components/FormField/FormField.stories.ts +55 -0
  86. package/src/components/FormField/FormField.vue +160 -0
  87. package/src/components/Header/Header.stories.ts +168 -0
  88. package/src/components/Header/Header.vue +232 -0
  89. package/src/components/InfoTip/InfoTip.stories.ts +63 -0
  90. package/src/components/InfoTip/InfoTip.vue +50 -0
  91. package/src/components/Input/Input.stories.ts +206 -0
  92. package/src/components/Input/Input.vue +90 -0
  93. package/src/components/InputCode/InputCode.stories.ts +85 -0
  94. package/src/components/InputCode/InputCode.vue +145 -0
  95. package/src/components/InputDate/InputDate.stories.ts +58 -0
  96. package/src/components/InputDate/InputDate.vue +258 -0
  97. package/src/components/InputNumber/InputNumber.stories.ts +63 -0
  98. package/src/components/InputNumber/InputNumber.vue +109 -0
  99. package/src/components/InputPassword/InputPassword.stories.ts +105 -0
  100. package/src/components/InputPassword/InputPassword.vue +132 -0
  101. package/src/components/InputRichText/InputRichText.stories.ts +100 -0
  102. package/src/components/InputRichText/InputRichText.vue +194 -0
  103. package/src/components/Link/Link.stories.ts +73 -0
  104. package/src/components/Link/Link.vue +56 -0
  105. package/src/components/Notification/Notification.stories.ts +196 -0
  106. package/src/components/Notification/Notification.vue +136 -0
  107. package/src/components/Notification/NotificationPane.vue +187 -0
  108. package/src/components/Notification/Toaster.vue +446 -0
  109. package/src/components/Notification/notification.samples.ts +45 -0
  110. package/src/components/Notification/notifications.test.ts +99 -0
  111. package/src/components/Notification/notifications.ts +172 -0
  112. package/src/components/PageHeader/PageHeader.stories.ts +79 -0
  113. package/src/components/PageHeader/PageHeader.vue +66 -0
  114. package/src/components/Popover/Popover.stories.ts +135 -0
  115. package/src/components/Popover/Popover.vue +192 -0
  116. package/src/components/Popover/popover.ts +20 -0
  117. package/src/components/Progress/Progress.stories.ts +74 -0
  118. package/src/components/Progress/Progress.vue +75 -0
  119. package/src/components/RadioGroup/RadioGroup.stories.ts +90 -0
  120. package/src/components/RadioGroup/RadioGroup.vue +132 -0
  121. package/src/components/RelativeTime/RelativeTime.stories.ts +74 -0
  122. package/src/components/RelativeTime/RelativeTime.vue +51 -0
  123. package/src/components/Select/Select.mdx +202 -0
  124. package/src/components/Select/Select.stories.ts +223 -0
  125. package/src/components/Select/Select.vue +630 -0
  126. package/src/components/Sidebar/Sidebar.stories.ts +192 -0
  127. package/src/components/Sidebar/Sidebar.vue +382 -0
  128. package/src/components/Sidebar/sidebar.ts +20 -0
  129. package/src/components/Slideover/Slideover.stories.ts +225 -0
  130. package/src/components/Slideover/Slideover.vue +365 -0
  131. package/src/components/Spinner/Spinner.stories.ts +79 -0
  132. package/src/components/Spinner/Spinner.vue +97 -0
  133. package/src/components/StatTile/StatTile.stories.ts +75 -0
  134. package/src/components/StatTile/StatTile.vue +89 -0
  135. package/src/components/SummaryList/SummaryList.stories.ts +103 -0
  136. package/src/components/SummaryList/SummaryList.vue +127 -0
  137. package/src/components/Switch/Switch.stories.ts +100 -0
  138. package/src/components/Switch/Switch.vue +96 -0
  139. package/src/components/Table/Table.stories.ts +206 -0
  140. package/src/components/Table/Table.vue +220 -0
  141. package/src/components/Table/table.test.ts +65 -0
  142. package/src/components/Table/table.ts +70 -0
  143. package/src/components/Tooltip/Tooltip.stories.ts +57 -0
  144. package/src/components/Tooltip/Tooltip.vue +86 -0
  145. package/src/examples/AppPages.stories.ts +500 -0
  146. package/src/examples/FormLayout.stories.ts +185 -0
  147. package/src/examples/KestonIdPages.stories.ts +415 -0
  148. package/src/examples/SchoolPages.stories.ts +665 -0
  149. package/src/index.ts +114 -36
  150. package/src/lib/cn.ts +4 -0
  151. package/src/lib/dates.test.ts +68 -0
  152. package/src/lib/dates.ts +86 -0
  153. package/src/lib/initials.ts +8 -0
  154. package/src/lib/parseDate.test.ts +331 -0
  155. package/src/lib/parseDate.ts +561 -0
  156. package/src/lib/useNow.ts +20 -0
  157. package/src/styles/theme.css +101 -0
  158. package/dist/components/AppLauncher.vue.d.ts +0 -10
  159. package/dist/components/Avatar.vue.d.ts +0 -16
  160. package/dist/components/Button.vue.d.ts +0 -27
  161. package/dist/components/Checkbox.vue.d.ts +0 -18
  162. package/dist/components/CloseButton.vue.d.ts +0 -6
  163. package/dist/components/Dialog.vue.d.ts +0 -23
  164. package/dist/components/Drawer.vue.d.ts +0 -34
  165. package/dist/components/DropdownMenu.vue.d.ts +0 -21
  166. package/dist/components/DropdownMenuItem.vue.d.ts +0 -19
  167. package/dist/components/DropdownMenuSeparator.vue.d.ts +0 -6
  168. package/dist/components/Input.vue.d.ts +0 -14
  169. package/dist/components/Label.vue.d.ts +0 -16
  170. package/dist/components/NotificationsMenu.vue.d.ts +0 -3
  171. package/dist/components/Popover.vue.d.ts +0 -23
  172. package/dist/components/ProfileSwitcher.vue.d.ts +0 -24
  173. package/dist/components/Select.vue.d.ts +0 -28
  174. package/dist/components/Separator.vue.d.ts +0 -11
  175. package/dist/components/ToastRenderer.vue.d.ts +0 -3
  176. package/dist/components/Toaster.vue.d.ts +0 -3
  177. package/dist/components/Tooltip.vue.d.ts +0 -23
  178. package/dist/components/TopBar.vue.d.ts +0 -34
  179. package/dist/favicon-old.svg +0 -1
  180. package/dist/favicon.svg +0 -1
  181. package/dist/keston-ui.cjs +0 -15
  182. package/dist/lib/toast.d.ts +0 -29
  183. package/dist/lib/types.d.ts +0 -5
  184. package/src/components/AppLauncher.vue +0 -63
  185. package/src/components/Avatar.vue +0 -51
  186. package/src/components/Button.vue +0 -54
  187. package/src/components/Checkbox.vue +0 -47
  188. package/src/components/CloseButton.vue +0 -24
  189. package/src/components/Dialog.vue +0 -65
  190. package/src/components/Drawer.vue +0 -202
  191. package/src/components/DropdownMenu.vue +0 -41
  192. package/src/components/DropdownMenuItem.vue +0 -28
  193. package/src/components/DropdownMenuSeparator.vue +0 -12
  194. package/src/components/Input.vue +0 -21
  195. package/src/components/Label.vue +0 -15
  196. package/src/components/NotificationsMenu.vue +0 -115
  197. package/src/components/Popover.vue +0 -46
  198. package/src/components/ProfileSwitcher.vue +0 -113
  199. package/src/components/Select.vue +0 -97
  200. package/src/components/Separator.vue +0 -30
  201. package/src/components/ToastItem.vue +0 -158
  202. package/src/components/ToastRenderer.vue +0 -113
  203. package/src/components/Toaster.vue +0 -11
  204. package/src/components/Tooltip.vue +0 -48
  205. package/src/components/TopBar.vue +0 -52
  206. package/src/lib/toast.ts +0 -95
  207. package/src/lib/types.ts +0 -5
@@ -1,48 +0,0 @@
1
- <script setup lang="ts">
2
- import {
3
- TooltipArrow,
4
- TooltipContent,
5
- TooltipPortal,
6
- TooltipProvider,
7
- TooltipRoot,
8
- TooltipTrigger,
9
- } from 'reka-ui'
10
- import { cn } from '../lib/cn'
11
-
12
- const props = withDefaults(
13
- defineProps<{
14
- content?: string
15
- side?: 'top' | 'right' | 'bottom' | 'left'
16
- class?: string
17
- }>(),
18
- {
19
- content: '',
20
- side: 'top',
21
- },
22
- )
23
- </script>
24
-
25
- <template>
26
- <TooltipProvider :delay-duration="200">
27
- <TooltipRoot>
28
- <TooltipTrigger as-child>
29
- <slot name="trigger" />
30
- </TooltipTrigger>
31
- <TooltipPortal>
32
- <TooltipContent
33
- :side="props.side"
34
- :side-offset="5"
35
- :class="
36
- cn(
37
- 'z-50 rounded-md bg-neutral-900 px-2 py-1 text-xs text-white shadow-md outline-none',
38
- props.class,
39
- )
40
- "
41
- >
42
- <slot>{{ props.content }}</slot>
43
- <TooltipArrow class="fill-neutral-900" />
44
- </TooltipContent>
45
- </TooltipPortal>
46
- </TooltipRoot>
47
- </TooltipProvider>
48
- </template>
@@ -1,52 +0,0 @@
1
- <script setup lang="ts">
2
- import AppLauncher from './AppLauncher.vue'
3
- import type { AppLink } from '../lib/types'
4
-
5
- withDefaults(
6
- defineProps<{
7
- appName: string
8
- apps?: AppLink[]
9
- current?: string
10
- showMenu?: boolean
11
- }>(),
12
- {
13
- apps: () => [],
14
- current: '',
15
- showMenu: false,
16
- },
17
- )
18
-
19
- defineEmits<{
20
- (e: 'menu'): void
21
- }>()
22
- </script>
23
-
24
- <template>
25
- <header class="flex h-16 items-center gap-2 border-b border-neutral-200 bg-white px-3 sm:px-4">
26
- <AppLauncher :apps="apps" :current="current" />
27
-
28
- <button
29
- v-if="showMenu"
30
- type="button"
31
- aria-label="Toggle navigation"
32
- class="inline-flex h-9 w-9 items-center justify-center rounded-md text-neutral-600 outline-none transition-colors hover:bg-neutral-100 focus-visible:ring-2 focus-visible:ring-blue-500"
33
- @click="$emit('menu')"
34
- >
35
- <svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" aria-hidden="true">
36
- <path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
37
- </svg>
38
- </button>
39
-
40
- <span class="ml-1 truncate text-base font-semibold text-neutral-900">{{ appName }}</span>
41
-
42
- <div class="ml-2 min-w-0 flex-1">
43
- <slot name="search" />
44
- </div>
45
-
46
- <div class="flex shrink-0 items-center gap-1">
47
- <slot name="actions" />
48
- <slot name="notifications" />
49
- <slot name="profile" />
50
- </div>
51
- </header>
52
- </template>
package/src/lib/toast.ts DELETED
@@ -1,95 +0,0 @@
1
- import { createToastManager } from 'reka-ui'
2
- import type { ToastAddOptions } from 'reka-ui'
3
- import { reactive } from 'vue'
4
-
5
- const manager = createToastManager()
6
-
7
- export type ToastStatus = 'success' | 'warning' | 'error' | 'info' | 'plain'
8
-
9
- export interface ToastNotification {
10
- id: string
11
- title: string
12
- description: string
13
- status: ToastStatus
14
- at: number
15
- read: boolean
16
- }
17
-
18
- const MAX_NOTIFICATIONS = 100
19
-
20
- export const toastNotifications = reactive<ToastNotification[]>([])
21
-
22
- function toText(value: unknown): string {
23
- if (typeof value === 'string') return value
24
- if (typeof value === 'number') return String(value)
25
- return ''
26
- }
27
-
28
- function record(id: string, options: ToastAddOptions, status: ToastStatus) {
29
- toastNotifications.unshift({
30
- id,
31
- title: toText(options.title),
32
- description: toText(options.description),
33
- status,
34
- at: Date.now(),
35
- read: false,
36
- })
37
- if (toastNotifications.length > MAX_NOTIFICATIONS) {
38
- toastNotifications.length = MAX_NOTIFICATIONS
39
- }
40
- }
41
-
42
- function add(options: ToastAddOptions) {
43
- const status = (options.status as ToastStatus) ?? 'plain'
44
- const id = manager.add(options)
45
- record(id, options, status)
46
- return id
47
- }
48
-
49
- function update(id: string, options: Partial<ToastAddOptions>) {
50
- const existing = toastNotifications.find((n) => n.id === id)
51
- if (existing) {
52
- if (options.title !== undefined) existing.title = toText(options.title)
53
- if (options.description !== undefined) existing.description = toText(options.description)
54
- if (options.status !== undefined) existing.status = options.status as ToastStatus
55
- }
56
- return manager.update(id, options)
57
- }
58
-
59
- function addWithStatus(status: ToastStatus) {
60
- return (options: ToastAddOptions) => add({ ...options, status })
61
- }
62
-
63
- export const toast = {
64
- add,
65
- update,
66
- close: manager.close,
67
- promise: manager.promise,
68
- success: addWithStatus('success'),
69
- warning: addWithStatus('warning'),
70
- error: addWithStatus('error'),
71
- info: addWithStatus('info'),
72
- plain: addWithStatus('plain'),
73
- }
74
-
75
- export function markNotificationsRead() {
76
- for (const n of toastNotifications) n.read = true
77
- }
78
-
79
- export function clearNotifications() {
80
- toastNotifications.length = 0
81
- }
82
-
83
- export function removeNotification(id: string) {
84
- const index = toastNotifications.findIndex((n) => n.id === id)
85
- if (index !== -1) toastNotifications.splice(index, 1)
86
- }
87
-
88
- export const toastManager = manager
89
-
90
- export type {
91
- ToastObject,
92
- ToastAddOptions,
93
- ToastUpdateOptions,
94
- ToastPromiseOptions,
95
- } from 'reka-ui'
package/src/lib/types.ts DELETED
@@ -1,5 +0,0 @@
1
- export interface AppLink {
2
- name: string
3
- href: string
4
- description?: string
5
- }