@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,115 +0,0 @@
1
- <script setup lang="ts">
2
- import { PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from 'reka-ui'
3
- import { computed } from 'vue'
4
- import {
5
- clearNotifications,
6
- markNotificationsRead,
7
- removeNotification,
8
- toastNotifications,
9
- } from '../lib/toast'
10
-
11
- const unread = computed(() => toastNotifications.filter((n) => !n.read).length)
12
-
13
- function onOpen(open: boolean) {
14
- if (open) markNotificationsRead()
15
- }
16
-
17
- function relativeTime(ts: number) {
18
- const seconds = Math.max(0, Math.floor((Date.now() - ts) / 1000))
19
- if (seconds < 60) return 'just now'
20
- const minutes = Math.floor(seconds / 60)
21
- if (minutes < 60) return `${minutes}m ago`
22
- const hours = Math.floor(minutes / 60)
23
- if (hours < 24) return `${hours}h ago`
24
- return `${Math.floor(hours / 24)}d ago`
25
- }
26
-
27
- const statusDot: Record<string, string> = {
28
- success: 'bg-green-500',
29
- warning: 'bg-yellow-500',
30
- error: 'bg-red-500',
31
- info: 'bg-blue-500',
32
- plain: 'bg-neutral-400',
33
- }
34
- </script>
35
-
36
- <template>
37
- <PopoverRoot @update:open="onOpen">
38
- <PopoverTrigger as-child>
39
- <button
40
- type="button"
41
- aria-label="Notifications"
42
- class="relative 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"
43
- >
44
- <svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
45
- <path
46
- stroke-linecap="round"
47
- stroke-linejoin="round"
48
- d="M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0"
49
- />
50
- </svg>
51
- <span
52
- v-if="unread"
53
- class="absolute right-1 top-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-red-600 px-1 text-[10px] font-semibold leading-none text-white"
54
- >
55
- {{ unread > 9 ? '9+' : unread }}
56
- </span>
57
- </button>
58
- </PopoverTrigger>
59
- <PopoverPortal>
60
- <PopoverContent
61
- align="end"
62
- :side-offset="8"
63
- class="z-50 w-80 rounded-lg border border-neutral-200 bg-white p-0 shadow-lg outline-none"
64
- >
65
- <div class="flex items-center justify-between border-b border-neutral-100 px-3 py-2">
66
- <p class="text-sm font-semibold">Notifications</p>
67
- <button
68
- v-if="toastNotifications.length"
69
- type="button"
70
- class="rounded px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900"
71
- @click="clearNotifications"
72
- >
73
- Clear all
74
- </button>
75
- </div>
76
-
77
- <p v-if="toastNotifications.length === 0" class="px-3 py-6 text-center text-sm text-neutral-400">
78
- No notifications yet.
79
- </p>
80
-
81
- <ul v-else class="max-h-80 divide-y divide-neutral-100 overflow-y-auto">
82
- <li
83
- v-for="item in toastNotifications"
84
- :key="item.id"
85
- class="group flex items-start gap-2 px-3 py-2.5"
86
- >
87
- <span
88
- class="mt-1.5 h-2 w-2 shrink-0 rounded-full"
89
- :class="statusDot[item.status] || statusDot.plain"
90
- />
91
- <div class="min-w-0 flex-1">
92
- <p class="truncate text-sm font-medium text-neutral-900">
93
- {{ item.title || 'Notification' }}
94
- </p>
95
- <p v-if="item.description" class="mt-0.5 text-xs text-neutral-500">
96
- {{ item.description }}
97
- </p>
98
- <p class="mt-0.5 text-xs text-neutral-400">{{ relativeTime(item.at) }}</p>
99
- </div>
100
- <button
101
- type="button"
102
- aria-label="Dismiss notification"
103
- class="mt-0.5 shrink-0 rounded p-1 text-neutral-300 opacity-0 transition-opacity hover:bg-neutral-100 hover:text-neutral-600 group-hover:opacity-100"
104
- @click="removeNotification(item.id)"
105
- >
106
- <svg class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
107
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
108
- </svg>
109
- </button>
110
- </li>
111
- </ul>
112
- </PopoverContent>
113
- </PopoverPortal>
114
- </PopoverRoot>
115
- </template>
@@ -1,46 +0,0 @@
1
- <script setup lang="ts">
2
- import {
3
- PopoverArrow,
4
- PopoverContent,
5
- PopoverPortal,
6
- PopoverRoot,
7
- PopoverTrigger,
8
- } from 'reka-ui'
9
- import { cn } from '../lib/cn'
10
-
11
- const props = withDefaults(
12
- defineProps<{
13
- side?: 'top' | 'right' | 'bottom' | 'left'
14
- align?: 'start' | 'center' | 'end'
15
- class?: string
16
- }>(),
17
- {
18
- side: 'bottom',
19
- align: 'center',
20
- },
21
- )
22
- </script>
23
-
24
- <template>
25
- <PopoverRoot>
26
- <PopoverTrigger as-child>
27
- <slot name="trigger" />
28
- </PopoverTrigger>
29
- <PopoverPortal>
30
- <PopoverContent
31
- :side="props.side"
32
- :align="props.align"
33
- :side-offset="5"
34
- :class="
35
- cn(
36
- 'z-50 w-72 rounded-md border border-neutral-200 bg-white p-4 shadow-md outline-none',
37
- props.class,
38
- )
39
- "
40
- >
41
- <slot />
42
- <PopoverArrow class="fill-white" />
43
- </PopoverContent>
44
- </PopoverPortal>
45
- </PopoverRoot>
46
- </template>
@@ -1,113 +0,0 @@
1
- <script setup lang="ts">
2
- import { PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from 'reka-ui'
3
- import Avatar from './Avatar.vue'
4
-
5
- const props = withDefaults(
6
- defineProps<{
7
- name?: string
8
- email?: string
9
- orgName?: string
10
- avatarSrc?: string
11
- accountSettingsUrl?: string
12
- differentAccountUrl?: string
13
- settingsLabel?: string
14
- }>(),
15
- {
16
- name: '',
17
- email: '',
18
- orgName: '',
19
- avatarSrc: '',
20
- accountSettingsUrl: '',
21
- differentAccountUrl: '',
22
- settingsLabel: 'Account settings at Keston ID',
23
- },
24
- )
25
-
26
- const emit = defineEmits<{
27
- (e: 'signOut'): void
28
- }>()
29
- </script>
30
-
31
- <template>
32
- <PopoverRoot>
33
- <PopoverTrigger as-child>
34
- <button
35
- type="button"
36
- aria-label="Account menu"
37
- class="rounded-full outline-none ring-offset-2 transition hover:opacity-90 focus-visible:ring-2 focus-visible:ring-blue-500"
38
- >
39
- <Avatar :name="props.name" :email="props.email" :src="props.avatarSrc" size="md" />
40
- </button>
41
- </PopoverTrigger>
42
- <PopoverPortal>
43
- <PopoverContent
44
- align="end"
45
- :side-offset="8"
46
- class="z-50 w-80 rounded-lg border border-neutral-200 bg-white p-0 shadow-lg outline-none"
47
- >
48
- <div class="flex items-center justify-between gap-3 px-3 py-2.5">
49
- <div class="min-w-0">
50
- <p class="text-[11px] uppercase tracking-wide text-neutral-400">Signed in to</p>
51
- <p class="truncate text-sm font-semibold text-neutral-900">
52
- {{ props.orgName || 'Keston' }}
53
- </p>
54
- </div>
55
- <button
56
- type="button"
57
- class="shrink-0 rounded-md px-2 py-1 text-xs font-medium text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900"
58
- @click="emit('signOut')"
59
- >
60
- Sign out
61
- </button>
62
- </div>
63
-
64
- <div class="h-px bg-neutral-100" />
65
-
66
- <div class="flex items-center gap-3 px-3 py-3">
67
- <Avatar :name="props.name" :email="props.email" :src="props.avatarSrc" size="lg" />
68
- <div class="min-w-0">
69
- <p class="truncate text-sm font-semibold text-neutral-900">
70
- {{ props.name || 'Signed in' }}
71
- </p>
72
- <p class="truncate text-xs text-neutral-500">{{ props.email }}</p>
73
- </div>
74
- </div>
75
-
76
- <div class="h-px bg-neutral-100" />
77
-
78
- <div class="p-1">
79
- <a
80
- v-if="props.accountSettingsUrl"
81
- :href="props.accountSettingsUrl"
82
- class="flex items-center gap-2 rounded-md px-2 py-2 text-sm text-neutral-700 hover:bg-neutral-100"
83
- >
84
- <svg class="h-4 w-4 text-neutral-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
85
- <path
86
- stroke-linecap="round"
87
- stroke-linejoin="round"
88
- d="M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"
89
- />
90
- <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
91
- </svg>
92
- <span class="truncate">{{ props.settingsLabel }}</span>
93
- </a>
94
-
95
- <a
96
- v-if="props.differentAccountUrl"
97
- :href="props.differentAccountUrl"
98
- class="flex items-center gap-2 rounded-md px-2 py-2 text-sm text-neutral-700 hover:bg-neutral-100"
99
- >
100
- <svg class="h-4 w-4 text-neutral-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
101
- <path
102
- stroke-linecap="round"
103
- stroke-linejoin="round"
104
- d="M16 21v-2a4 4 0 00-4-4H6a4 4 0 00-4 4v2M9 7a4 4 0 108 0 4 4 0 00-8 0zM19 8v6M22 11h-6"
105
- />
106
- </svg>
107
- <span class="truncate">Use a different account</span>
108
- </a>
109
- </div>
110
- </PopoverContent>
111
- </PopoverPortal>
112
- </PopoverRoot>
113
- </template>
@@ -1,97 +0,0 @@
1
- <script setup lang="ts">
2
- import {
3
- SelectContent,
4
- SelectIcon,
5
- SelectItem,
6
- SelectItemIndicator,
7
- SelectItemText,
8
- SelectPortal,
9
- SelectRoot,
10
- SelectTrigger,
11
- SelectValue,
12
- SelectViewport,
13
- } from 'reka-ui'
14
- import { cn } from '../lib/cn'
15
-
16
- export interface SelectOption {
17
- value: string
18
- label: string
19
- disabled?: boolean
20
- }
21
-
22
- const props = withDefaults(
23
- defineProps<{
24
- items?: SelectOption[]
25
- placeholder?: string
26
- disabled?: boolean
27
- id?: string
28
- name?: string
29
- class?: string
30
- }>(),
31
- {
32
- items: () => [],
33
- placeholder: 'Select an option',
34
- disabled: false,
35
- },
36
- )
37
-
38
- const model = defineModel<string>()
39
- </script>
40
-
41
- <template>
42
- <SelectRoot v-model="model" :disabled="props.disabled" :name="props.name">
43
- <SelectTrigger
44
- :id="props.id"
45
- :class="
46
- cn(
47
- 'group flex h-10 w-full items-center justify-between gap-2 rounded-md border border-neutral-300 bg-white px-3 text-sm text-neutral-900 outline-none transition-colors focus-visible:border-blue-500 focus-visible:ring-2 focus-visible:ring-blue-500 disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-neutral-400',
48
- props.class,
49
- )
50
- "
51
- >
52
- <SelectValue :placeholder="props.placeholder" />
53
- <SelectIcon class="text-neutral-500">
54
- <svg
55
- class="h-4 w-4 transition-transform duration-200 group-data-[state=open]:rotate-180"
56
- viewBox="0 0 15 15"
57
- fill="none"
58
- xmlns="http://www.w3.org/2000/svg"
59
- >
60
- <path
61
- d="M4.93179 5.43179C5.15811 5.20547 5.52473 5.20547 5.75105 5.43179L7.50001 7.18076L9.24898 5.43179C9.4753 5.20547 9.84192 5.20547 10.0682 5.43179C10.2946 5.65811 10.2946 6.02473 10.0682 6.25105L7.90961 8.40968C7.68329 8.636 7.31667 8.636 7.09035 8.40968L4.93179 6.25105C4.70547 6.02473 4.70547 5.65811 4.93179 5.43179Z"
62
- fill="currentColor"
63
- fill-rule="evenodd"
64
- clip-rule="evenodd"
65
- />
66
- </svg>
67
- </SelectIcon>
68
- </SelectTrigger>
69
- <SelectPortal>
70
- <SelectContent
71
- class="z-50 min-w-[10rem] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 shadow-md outline-none"
72
- >
73
- <SelectViewport>
74
- <SelectItem
75
- v-for="item in props.items"
76
- :key="item.value"
77
- :value="item.value"
78
- :disabled="item.disabled"
79
- class="relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm text-neutral-700 outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-neutral-100 data-[highlighted]:text-neutral-900"
80
- >
81
- <SelectItemIndicator class="absolute left-2 inline-flex items-center justify-center">
82
- <svg class="h-4 w-4" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
83
- <path
84
- d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z"
85
- fill="currentColor"
86
- fill-rule="evenodd"
87
- clip-rule="evenodd"
88
- />
89
- </svg>
90
- </SelectItemIndicator>
91
- <SelectItemText>{{ item.label }}</SelectItemText>
92
- </SelectItem>
93
- </SelectViewport>
94
- </SelectContent>
95
- </SelectPortal>
96
- </SelectRoot>
97
- </template>
@@ -1,30 +0,0 @@
1
- <script setup lang="ts">
2
- import { Separator } from 'reka-ui'
3
- import { cn } from '../lib/cn'
4
-
5
- const props = withDefaults(
6
- defineProps<{
7
- orientation?: 'horizontal' | 'vertical'
8
- decorative?: boolean
9
- class?: string
10
- }>(),
11
- {
12
- orientation: 'horizontal',
13
- decorative: true,
14
- },
15
- )
16
- </script>
17
-
18
- <template>
19
- <Separator
20
- :orientation="props.orientation"
21
- :decorative="props.decorative"
22
- :class="
23
- cn(
24
- 'shrink-0 bg-neutral-200',
25
- props.orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',
26
- props.class,
27
- )
28
- "
29
- />
30
- </template>
@@ -1,158 +0,0 @@
1
- <script setup lang="ts">
2
- import { CircleCheck, CircleX, Info, TriangleAlert } from '@lucide/vue'
3
- import {
4
- ToastAction,
5
- ToastClose,
6
- ToastDescription,
7
- ToastRoot,
8
- ToastTitle,
9
- } from 'reka-ui'
10
- import type { ToastObject } from 'reka-ui'
11
- import type { Component } from 'vue'
12
- import { computed } from 'vue'
13
- import { cn } from '../lib/cn'
14
- import CloseButton from './CloseButton.vue'
15
-
16
- const props = defineProps<{
17
- toast: ToastObject
18
- }>()
19
-
20
- type ToastVariant = 'success' | 'warning' | 'error' | 'info' | 'plain'
21
-
22
- interface VariantStyle {
23
- icon?: Component
24
- root: string
25
- iconClass: string
26
- title: string
27
- description: string
28
- action: string
29
- close: string
30
- bar: string
31
- }
32
-
33
- const variants: Record<ToastVariant, VariantStyle> = {
34
- success: {
35
- icon: CircleCheck,
36
- root: 'border-green-200 bg-green-50',
37
- iconClass: 'text-green-600',
38
- title: 'text-green-900',
39
- description: 'text-green-700',
40
- action: 'bg-green-100 text-green-900 hover:bg-green-200',
41
- close: 'text-green-600 hover:text-green-800',
42
- bar: 'bg-green-500',
43
- },
44
- warning: {
45
- icon: TriangleAlert,
46
- root: 'border-yellow-200 bg-yellow-50',
47
- iconClass: 'text-yellow-600',
48
- title: 'text-yellow-900',
49
- description: 'text-yellow-700',
50
- action: 'bg-yellow-100 text-yellow-900 hover:bg-yellow-200',
51
- close: 'text-yellow-600 hover:text-yellow-800',
52
- bar: 'bg-yellow-500',
53
- },
54
- error: {
55
- icon: CircleX,
56
- root: 'border-red-200 bg-red-50',
57
- iconClass: 'text-red-600',
58
- title: 'text-red-900',
59
- description: 'text-red-700',
60
- action: 'bg-red-100 text-red-900 hover:bg-red-200',
61
- close: 'text-red-600 hover:text-red-800',
62
- bar: 'bg-red-500',
63
- },
64
- info: {
65
- icon: Info,
66
- root: 'border-blue-200 bg-blue-50',
67
- iconClass: 'text-blue-600',
68
- title: 'text-blue-900',
69
- description: 'text-blue-700',
70
- action: 'bg-blue-100 text-blue-900 hover:bg-blue-200',
71
- close: 'text-blue-600 hover:text-blue-800',
72
- bar: 'bg-blue-500',
73
- },
74
- plain: {
75
- root: 'border-neutral-200 bg-white',
76
- iconClass: '',
77
- title: 'text-neutral-900',
78
- description: 'text-neutral-500',
79
- action: 'bg-neutral-100 text-neutral-900 hover:bg-neutral-200',
80
- close: 'text-neutral-400 hover:text-neutral-600',
81
- bar: 'bg-neutral-400',
82
- },
83
- }
84
-
85
- function variantFor(status?: string): ToastVariant {
86
- if (
87
- status === 'success' ||
88
- status === 'warning' ||
89
- status === 'error' ||
90
- status === 'info'
91
- ) {
92
- return status
93
- }
94
- return 'plain'
95
- }
96
-
97
- function progressRatio(remaining: number, duration: number) {
98
- if (!Number.isFinite(duration) || duration <= 0) return 0
99
- return Math.min(Math.max(remaining / duration, 0), 1)
100
- }
101
-
102
- const variant = computed(() => variantFor(props.toast.status))
103
- const style = computed(() => variants[variant.value])
104
- </script>
105
-
106
- <template>
107
- <ToastRoot
108
- :toast="toast"
109
- :class="
110
- cn(
111
- 'kui-toast pointer-events-auto flex items-start gap-3 rounded-lg border p-4 shadow-lg',
112
- style.root,
113
- )
114
- "
115
- v-slot="{ remaining, duration }"
116
- >
117
- <component
118
- :is="style.icon"
119
- v-if="style.icon"
120
- :class="cn('h-5 w-5 shrink-0', style.iconClass)"
121
- aria-hidden="true"
122
- />
123
- <div class="flex min-w-0 flex-1 flex-col gap-1">
124
- <ToastTitle :class="cn('text-sm font-semibold', style.title)" />
125
- <ToastDescription :class="cn('text-sm', style.description)" />
126
- <ToastAction
127
- :class="
128
- cn(
129
- 'mt-1 inline-flex h-8 items-center justify-center gap-2 self-start rounded-md px-3 text-xs font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2',
130
- style.action,
131
- )
132
- "
133
- />
134
- </div>
135
- <ToastClose
136
- aria-label="Close"
137
- :class="
138
- cn(
139
- 'shrink-0 rounded-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-blue-500',
140
- style.close,
141
- )
142
- "
143
- >
144
- <CloseButton />
145
- </ToastClose>
146
- <div
147
- v-if="Number.isFinite(duration) && duration > 0"
148
- aria-hidden="true"
149
- class="pointer-events-none absolute inset-x-0 bottom-0 h-1 overflow-hidden rounded-b-lg bg-black/5"
150
- >
151
- <div
152
- class="h-full w-full origin-left will-change-transform"
153
- :class="style.bar"
154
- :style="{ transform: `scaleX(${progressRatio(remaining, duration)})` }"
155
- />
156
- </div>
157
- </ToastRoot>
158
- </template>
@@ -1,113 +0,0 @@
1
- <script setup lang="ts">
2
- import { ToastViewport, useToastManager } from 'reka-ui'
3
- import ToastItem from './ToastItem.vue'
4
-
5
- const { toasts } = useToastManager()
6
- </script>
7
-
8
- <template>
9
- <ToastViewport
10
- class="kui-toast-viewport fixed left-0 top-0 z-[100] w-full max-w-sm p-4 outline-none sm:left-4 sm:top-4"
11
- >
12
- <ToastItem v-for="toast in toasts" :key="toast.id" :toast="toast" />
13
- </ToastViewport>
14
- </template>
15
-
16
- <style>
17
- .kui-toast {
18
- position: absolute;
19
- top: 0;
20
- left: 0;
21
- width: 100%;
22
- height: var(--reka-toast-frontmost-height);
23
- transform: translateY(calc(var(--reka-toast-index) * 12px))
24
- scale(calc(1 - var(--reka-toast-index) * 0.05));
25
- z-index: calc(1000 - var(--reka-toast-index));
26
- transition:
27
- transform 300ms cubic-bezier(0.21, 1.02, 0.73, 1),
28
- opacity 300ms ease,
29
- height 300ms ease;
30
- transition-delay: 100ms;
31
- }
32
-
33
- /* Invisible hit-area that covers the gap below each toast, so the cursor
34
- moving between toasts doesn't leave the viewport and collapse the stack. */
35
- .kui-toast::after {
36
- content: '';
37
- position: absolute;
38
- left: 0;
39
- right: 0;
40
- top: 100%;
41
- height: 12px;
42
- }
43
-
44
- .kui-toast-viewport[data-expanded] .kui-toast {
45
- height: var(--reka-toast-height);
46
- transform: translateY(
47
- calc(var(--reka-toast-offset-y) + var(--reka-toast-index) * 12px)
48
- );
49
- transition-delay: 0ms;
50
- }
51
-
52
- .kui-toast[data-limited] {
53
- opacity: 0;
54
- }
55
-
56
- .kui-toast[data-state='open'] {
57
- animation: kui-toast-in 300ms cubic-bezier(0.21, 1.02, 0.73, 1);
58
- }
59
- .kui-toast[data-state='closed'] {
60
- animation: kui-toast-out 200ms ease-in forwards;
61
- }
62
-
63
- .kui-toast[data-swipe='move'] {
64
- transform: translateX(var(--reka-toast-swipe-move-x));
65
- }
66
- .kui-toast[data-swipe='cancel'] {
67
- transform: translateX(0);
68
- transition: transform 200ms ease-out;
69
- }
70
- .kui-toast[data-swipe='end'] {
71
- animation: kui-toast-swipe-out 100ms ease-out forwards;
72
- }
73
-
74
- @keyframes kui-toast-in {
75
- from {
76
- translate: -100% 0;
77
- opacity: 0;
78
- }
79
- to {
80
- translate: 0 0;
81
- opacity: 1;
82
- }
83
- }
84
- @keyframes kui-toast-out {
85
- to {
86
- translate: -100% 0;
87
- opacity: 0;
88
- }
89
- }
90
- @keyframes kui-toast-swipe-out {
91
- from {
92
- transform: translateX(var(--reka-toast-swipe-end-x));
93
- }
94
- to {
95
- transform: translateX(calc(-100% - 1rem));
96
- }
97
- }
98
-
99
- @media (prefers-reduced-motion: reduce) {
100
- .kui-toast {
101
- transition: none;
102
- }
103
- .kui-toast[data-state='open'],
104
- .kui-toast[data-state='closed'],
105
- .kui-toast[data-swipe='end'] {
106
- animation: none;
107
- }
108
- .kui-toast[data-swipe='move'],
109
- .kui-toast[data-swipe='cancel'] {
110
- transform: none;
111
- }
112
- }
113
- </style>
@@ -1,11 +0,0 @@
1
- <script setup lang="ts">
2
- import { ToastProvider } from 'reka-ui'
3
- import { toastManager } from '../lib/toast'
4
- import ToastRenderer from './ToastRenderer.vue'
5
- </script>
6
-
7
- <template>
8
- <ToastProvider :toast-manager="toastManager">
9
- <ToastRenderer />
10
- </ToastProvider>
11
- </template>