@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.
- package/README.md +98 -31
- package/dist/components/Age/Age.vue.d.ts +19 -0
- package/dist/components/AppShell/AppShell.vue.d.ts +108 -0
- package/dist/components/Avatar/Avatar.vue.d.ts +34 -0
- package/dist/components/AvatarGroup/AvatarGroup.vue.d.ts +25 -0
- package/dist/components/Badge/Badge.vue.d.ts +41 -0
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +39 -0
- package/dist/components/Button/Button.vue.d.ts +69 -0
- package/dist/components/Calendar/Calendar.vue.d.ts +34 -0
- package/dist/components/Card/Card.vue.d.ts +56 -0
- package/dist/components/Checkbox/Checkbox.vue.d.ts +40 -0
- package/dist/components/Checklist/Checklist.vue.d.ts +18 -0
- package/dist/components/Chip/Chip.vue.d.ts +44 -0
- package/dist/components/Divider/Divider.vue.d.ts +36 -0
- package/dist/components/EmptyState/EmptyState.vue.d.ts +55 -0
- package/dist/components/{ToastItem.vue.d.ts → FormField/FieldMessage.vue.d.ts} +10 -2
- package/dist/components/FormField/FormField.vue.d.ts +61 -0
- package/dist/components/Header/Header.vue.d.ts +104 -0
- package/dist/components/InfoTip/InfoTip.vue.d.ts +20 -0
- package/dist/components/Input/Input.vue.d.ts +56 -0
- package/dist/components/InputCode/InputCode.vue.d.ts +53 -0
- package/dist/components/InputDate/InputDate.vue.d.ts +49 -0
- package/dist/components/InputNumber/InputNumber.vue.d.ts +44 -0
- package/dist/components/InputPassword/InputPassword.vue.d.ts +51 -0
- package/dist/components/InputRichText/InputRichText.vue.d.ts +44 -0
- package/dist/components/Link/Link.vue.d.ts +39 -0
- package/dist/components/Notification/Notification.vue.d.ts +62 -0
- package/dist/components/Notification/NotificationPane.vue.d.ts +38 -0
- package/dist/components/Notification/Toaster.vue.d.ts +51 -0
- package/dist/components/Notification/notification.samples.d.ts +3 -0
- package/dist/components/Notification/notifications.d.ts +115 -0
- package/dist/components/PageHeader/PageHeader.vue.d.ts +43 -0
- package/dist/components/Popover/Popover.vue.d.ts +83 -0
- package/dist/components/Popover/popover.d.ts +16 -0
- package/dist/components/Progress/Progress.vue.d.ts +26 -0
- package/dist/components/RadioGroup/RadioGroup.vue.d.ts +45 -0
- package/dist/components/RelativeTime/RelativeTime.vue.d.ts +22 -0
- package/dist/components/Select/Select.vue.d.ts +110 -0
- package/dist/components/Sidebar/Sidebar.vue.d.ts +106 -0
- package/dist/components/Sidebar/sidebar.d.ts +10 -0
- package/dist/components/Slideover/Slideover.vue.d.ts +125 -0
- package/dist/components/Spinner/Spinner.vue.d.ts +30 -0
- package/dist/components/StatTile/StatTile.vue.d.ts +46 -0
- package/dist/components/SummaryList/SummaryList.vue.d.ts +62 -0
- package/dist/components/Switch/Switch.vue.d.ts +39 -0
- package/dist/components/Table/Table.vue.d.ts +82 -0
- package/dist/components/Table/table.d.ts +36 -0
- package/dist/components/Tooltip/Tooltip.vue.d.ts +46 -0
- package/dist/index.d.ts +91 -25
- package/dist/keston-ui.js +5030 -14786
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/dates.d.ts +27 -0
- package/dist/lib/initials.d.ts +2 -0
- package/dist/lib/parseDate.d.ts +44 -0
- package/dist/lib/useNow.d.ts +3 -0
- package/package.json +57 -24
- package/src/components/.gitkeep +0 -0
- package/src/components/Age/Age.stories.ts +24 -0
- package/src/components/Age/Age.vue +56 -0
- package/src/components/AppShell/AppShell.stories.ts +124 -0
- package/src/components/AppShell/AppShell.vue +221 -0
- package/src/components/Avatar/Avatar.stories.ts +56 -0
- package/src/components/Avatar/Avatar.vue +118 -0
- package/src/components/AvatarGroup/AvatarGroup.stories.ts +47 -0
- package/src/components/AvatarGroup/AvatarGroup.vue +97 -0
- package/src/components/Badge/Badge.stories.ts +92 -0
- package/src/components/Badge/Badge.vue +67 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.ts +58 -0
- package/src/components/Breadcrumb/Breadcrumb.vue +109 -0
- package/src/components/Button/Button.mdx +79 -0
- package/src/components/Button/Button.stories.ts +207 -0
- package/src/components/Button/Button.vue +266 -0
- package/src/components/Calendar/Calendar.stories.ts +51 -0
- package/src/components/Calendar/Calendar.vue +364 -0
- package/src/components/Card/Card.stories.ts +109 -0
- package/src/components/Card/Card.vue +115 -0
- package/src/components/Checkbox/Checkbox.stories.ts +102 -0
- package/src/components/Checkbox/Checkbox.vue +102 -0
- package/src/components/Checklist/Checklist.stories.ts +67 -0
- package/src/components/Checklist/Checklist.vue +38 -0
- package/src/components/Chip/Chip.stories.ts +71 -0
- package/src/components/Chip/Chip.vue +86 -0
- package/src/components/Divider/Divider.stories.ts +57 -0
- package/src/components/Divider/Divider.vue +58 -0
- package/src/components/EmptyState/EmptyState.stories.ts +99 -0
- package/src/components/EmptyState/EmptyState.vue +87 -0
- package/src/components/FormField/FieldMessage.vue +81 -0
- package/src/components/FormField/FormField.stories.ts +55 -0
- package/src/components/FormField/FormField.vue +160 -0
- package/src/components/Header/Header.stories.ts +168 -0
- package/src/components/Header/Header.vue +232 -0
- package/src/components/InfoTip/InfoTip.stories.ts +63 -0
- package/src/components/InfoTip/InfoTip.vue +50 -0
- package/src/components/Input/Input.stories.ts +206 -0
- package/src/components/Input/Input.vue +90 -0
- package/src/components/InputCode/InputCode.stories.ts +85 -0
- package/src/components/InputCode/InputCode.vue +145 -0
- package/src/components/InputDate/InputDate.stories.ts +58 -0
- package/src/components/InputDate/InputDate.vue +258 -0
- package/src/components/InputNumber/InputNumber.stories.ts +63 -0
- package/src/components/InputNumber/InputNumber.vue +109 -0
- package/src/components/InputPassword/InputPassword.stories.ts +105 -0
- package/src/components/InputPassword/InputPassword.vue +132 -0
- package/src/components/InputRichText/InputRichText.stories.ts +100 -0
- package/src/components/InputRichText/InputRichText.vue +194 -0
- package/src/components/Link/Link.stories.ts +73 -0
- package/src/components/Link/Link.vue +56 -0
- package/src/components/Notification/Notification.stories.ts +196 -0
- package/src/components/Notification/Notification.vue +136 -0
- package/src/components/Notification/NotificationPane.vue +186 -0
- package/src/components/Notification/Toaster.vue +446 -0
- package/src/components/Notification/notification.samples.ts +45 -0
- package/src/components/Notification/notifications.test.ts +99 -0
- package/src/components/Notification/notifications.ts +172 -0
- package/src/components/PageHeader/PageHeader.stories.ts +79 -0
- package/src/components/PageHeader/PageHeader.vue +66 -0
- package/src/components/Popover/Popover.stories.ts +135 -0
- package/src/components/Popover/Popover.vue +192 -0
- package/src/components/Popover/popover.ts +20 -0
- package/src/components/Progress/Progress.stories.ts +74 -0
- package/src/components/Progress/Progress.vue +75 -0
- package/src/components/RadioGroup/RadioGroup.stories.ts +90 -0
- package/src/components/RadioGroup/RadioGroup.vue +132 -0
- package/src/components/RelativeTime/RelativeTime.stories.ts +74 -0
- package/src/components/RelativeTime/RelativeTime.vue +51 -0
- package/src/components/Select/Select.mdx +202 -0
- package/src/components/Select/Select.stories.ts +223 -0
- package/src/components/Select/Select.vue +630 -0
- package/src/components/Sidebar/Sidebar.stories.ts +192 -0
- package/src/components/Sidebar/Sidebar.vue +382 -0
- package/src/components/Sidebar/sidebar.ts +20 -0
- package/src/components/Slideover/Slideover.stories.ts +225 -0
- package/src/components/Slideover/Slideover.vue +365 -0
- package/src/components/Spinner/Spinner.stories.ts +79 -0
- package/src/components/Spinner/Spinner.vue +97 -0
- package/src/components/StatTile/StatTile.stories.ts +75 -0
- package/src/components/StatTile/StatTile.vue +89 -0
- package/src/components/SummaryList/SummaryList.stories.ts +103 -0
- package/src/components/SummaryList/SummaryList.vue +127 -0
- package/src/components/Switch/Switch.stories.ts +100 -0
- package/src/components/Switch/Switch.vue +96 -0
- package/src/components/Table/Table.stories.ts +212 -0
- package/src/components/Table/Table.vue +223 -0
- package/src/components/Table/table.test.ts +65 -0
- package/src/components/Table/table.ts +70 -0
- package/src/components/Tooltip/Tooltip.stories.ts +57 -0
- package/src/components/Tooltip/Tooltip.vue +86 -0
- package/src/examples/AppPages.stories.ts +500 -0
- package/src/examples/FormLayout.stories.ts +185 -0
- package/src/examples/KestonIdPages.stories.ts +415 -0
- package/src/examples/SchoolPages.stories.ts +665 -0
- package/src/index.ts +116 -36
- package/src/lib/cn.ts +4 -0
- package/src/lib/dates.test.ts +68 -0
- package/src/lib/dates.ts +86 -0
- package/src/lib/initials.ts +8 -0
- package/src/lib/parseDate.test.ts +331 -0
- package/src/lib/parseDate.ts +561 -0
- package/src/lib/useNow.ts +20 -0
- package/src/styles/theme.css +101 -0
- package/dist/components/AppLauncher.vue.d.ts +0 -10
- package/dist/components/Avatar.vue.d.ts +0 -16
- package/dist/components/Button.vue.d.ts +0 -27
- package/dist/components/Checkbox.vue.d.ts +0 -18
- package/dist/components/CloseButton.vue.d.ts +0 -6
- package/dist/components/Dialog.vue.d.ts +0 -23
- package/dist/components/Drawer.vue.d.ts +0 -34
- package/dist/components/DropdownMenu.vue.d.ts +0 -21
- package/dist/components/DropdownMenuItem.vue.d.ts +0 -19
- package/dist/components/DropdownMenuSeparator.vue.d.ts +0 -6
- package/dist/components/Input.vue.d.ts +0 -14
- package/dist/components/Label.vue.d.ts +0 -16
- package/dist/components/NotificationsMenu.vue.d.ts +0 -3
- package/dist/components/Popover.vue.d.ts +0 -23
- package/dist/components/ProfileSwitcher.vue.d.ts +0 -24
- package/dist/components/Select.vue.d.ts +0 -28
- package/dist/components/Separator.vue.d.ts +0 -11
- package/dist/components/ToastRenderer.vue.d.ts +0 -3
- package/dist/components/Toaster.vue.d.ts +0 -3
- package/dist/components/Tooltip.vue.d.ts +0 -23
- package/dist/components/TopBar.vue.d.ts +0 -34
- package/dist/favicon-old.svg +0 -1
- package/dist/favicon.svg +0 -1
- package/dist/keston-ui.cjs +0 -15
- package/dist/lib/toast.d.ts +0 -29
- package/dist/lib/types.d.ts +0 -5
- package/src/components/AppLauncher.vue +0 -63
- package/src/components/Avatar.vue +0 -51
- package/src/components/Button.vue +0 -54
- package/src/components/Checkbox.vue +0 -47
- package/src/components/CloseButton.vue +0 -24
- package/src/components/Dialog.vue +0 -65
- package/src/components/Drawer.vue +0 -202
- package/src/components/DropdownMenu.vue +0 -41
- package/src/components/DropdownMenuItem.vue +0 -28
- package/src/components/DropdownMenuSeparator.vue +0 -12
- package/src/components/Input.vue +0 -21
- package/src/components/Label.vue +0 -15
- package/src/components/NotificationsMenu.vue +0 -115
- package/src/components/Popover.vue +0 -46
- package/src/components/ProfileSwitcher.vue +0 -113
- package/src/components/Select.vue +0 -97
- package/src/components/Separator.vue +0 -30
- package/src/components/ToastItem.vue +0 -158
- package/src/components/ToastRenderer.vue +0 -113
- package/src/components/Toaster.vue +0 -11
- package/src/components/Tooltip.vue +0 -48
- package/src/components/TopBar.vue +0 -52
- package/src/lib/toast.ts +0 -95
- 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-12 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'
|