@thekestongroup/ui 0.0.0-stage → 0.1.1
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/LICENSE +130 -0
- package/README.md +55 -2
- package/dist/components/Button.vue.d.ts +27 -0
- package/dist/components/Checkbox.vue.d.ts +18 -0
- package/dist/components/CloseButton.vue.d.ts +6 -0
- package/dist/components/Dialog.vue.d.ts +23 -0
- package/dist/components/Drawer.vue.d.ts +26 -0
- package/dist/components/DropdownMenu.vue.d.ts +21 -0
- package/dist/components/DropdownMenuItem.vue.d.ts +19 -0
- package/dist/components/DropdownMenuSeparator.vue.d.ts +6 -0
- package/dist/components/Input.vue.d.ts +14 -0
- package/dist/components/Label.vue.d.ts +16 -0
- package/dist/components/Popover.vue.d.ts +23 -0
- package/dist/components/Select.vue.d.ts +28 -0
- package/dist/components/Separator.vue.d.ts +11 -0
- package/dist/components/ToastRenderer.vue.d.ts +3 -0
- package/dist/components/Toaster.vue.d.ts +3 -0
- package/dist/components/Tooltip.vue.d.ts +23 -0
- package/dist/favicon-old.svg +1 -0
- package/dist/favicon.svg +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/keston-ui.cjs +14 -0
- package/dist/keston-ui.css +1 -0
- package/dist/keston-ui.js +14065 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/toast.d.ts +8 -0
- package/package.json +50 -3
- package/src/components/Button.vue +54 -0
- package/src/components/Checkbox.vue +47 -0
- package/src/components/CloseButton.vue +24 -0
- package/src/components/Dialog.vue +65 -0
- package/src/components/Drawer.vue +200 -0
- package/src/components/DropdownMenu.vue +41 -0
- package/src/components/DropdownMenuItem.vue +28 -0
- package/src/components/DropdownMenuSeparator.vue +12 -0
- package/src/components/Input.vue +21 -0
- package/src/components/Label.vue +15 -0
- package/src/components/Popover.vue +46 -0
- package/src/components/Select.vue +97 -0
- package/src/components/Separator.vue +30 -0
- package/src/components/ToastRenderer.vue +140 -0
- package/src/components/Toaster.vue +11 -0
- package/src/components/Tooltip.vue +48 -0
- package/src/index.ts +23 -0
- package/src/lib/cn.ts +6 -0
- package/src/lib/toast.ts +19 -0
|
@@ -0,0 +1,97 @@
|
|
|
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>
|
|
@@ -0,0 +1,30 @@
|
|
|
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>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
ToastAction,
|
|
4
|
+
ToastClose,
|
|
5
|
+
ToastDescription,
|
|
6
|
+
ToastRoot,
|
|
7
|
+
ToastTitle,
|
|
8
|
+
ToastViewport,
|
|
9
|
+
useToastManager,
|
|
10
|
+
} from 'reka-ui'
|
|
11
|
+
import CloseButton from './CloseButton.vue'
|
|
12
|
+
|
|
13
|
+
const { toasts } = useToastManager()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<ToastViewport
|
|
18
|
+
class="kui-toast-viewport fixed bottom-0 right-0 z-[100] w-full max-w-sm p-4 outline-none sm:bottom-4 sm:right-4"
|
|
19
|
+
>
|
|
20
|
+
<ToastRoot
|
|
21
|
+
v-for="toast in toasts"
|
|
22
|
+
:key="toast.id"
|
|
23
|
+
:toast="toast"
|
|
24
|
+
class="kui-toast pointer-events-auto flex items-start gap-3 rounded-lg border border-neutral-200 bg-white p-4 shadow-lg"
|
|
25
|
+
>
|
|
26
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1">
|
|
27
|
+
<ToastTitle class="text-sm font-semibold text-neutral-900" />
|
|
28
|
+
<ToastDescription class="text-sm text-neutral-500" />
|
|
29
|
+
<ToastAction
|
|
30
|
+
class="mt-1 inline-flex h-8 items-center justify-center gap-2 self-start rounded-md bg-neutral-100 px-3 text-xs font-medium text-neutral-900 outline-none transition-colors hover:bg-neutral-200 focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
<ToastClose
|
|
34
|
+
aria-label="Close"
|
|
35
|
+
class="shrink-0 rounded-sm text-neutral-400 outline-none transition-colors hover:text-neutral-600 focus-visible:ring-2 focus-visible:ring-blue-500"
|
|
36
|
+
>
|
|
37
|
+
<CloseButton />
|
|
38
|
+
</ToastClose>
|
|
39
|
+
</ToastRoot>
|
|
40
|
+
</ToastViewport>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style>
|
|
44
|
+
.kui-toast {
|
|
45
|
+
position: absolute;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
right: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: var(--reka-toast-frontmost-height);
|
|
50
|
+
transform: translateY(calc(var(--reka-toast-index) * -12px))
|
|
51
|
+
scale(calc(1 - var(--reka-toast-index) * 0.05));
|
|
52
|
+
z-index: calc(1000 - var(--reka-toast-index));
|
|
53
|
+
transition:
|
|
54
|
+
transform 300ms cubic-bezier(0.21, 1.02, 0.73, 1),
|
|
55
|
+
opacity 300ms ease,
|
|
56
|
+
height 300ms ease;
|
|
57
|
+
transition-delay: 100ms;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Invisible hit-area that covers the gap above each toast, so the cursor
|
|
61
|
+
moving between toasts doesn't leave the viewport and collapse the stack. */
|
|
62
|
+
.kui-toast::after {
|
|
63
|
+
content: '';
|
|
64
|
+
position: absolute;
|
|
65
|
+
left: 0;
|
|
66
|
+
right: 0;
|
|
67
|
+
bottom: 100%;
|
|
68
|
+
height: 12px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.kui-toast-viewport[data-expanded] .kui-toast {
|
|
72
|
+
height: var(--reka-toast-height);
|
|
73
|
+
transform: translateY(
|
|
74
|
+
calc(var(--reka-toast-offset-y) * -1 - var(--reka-toast-index) * 12px)
|
|
75
|
+
);
|
|
76
|
+
transition-delay: 0ms;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.kui-toast[data-limited] {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.kui-toast[data-state='open'] {
|
|
84
|
+
animation: kui-toast-in 300ms cubic-bezier(0.21, 1.02, 0.73, 1);
|
|
85
|
+
}
|
|
86
|
+
.kui-toast[data-state='closed'] {
|
|
87
|
+
animation: kui-toast-out 200ms ease-in forwards;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.kui-toast[data-swipe='move'] {
|
|
91
|
+
transform: translateX(var(--reka-toast-swipe-move-x));
|
|
92
|
+
}
|
|
93
|
+
.kui-toast[data-swipe='cancel'] {
|
|
94
|
+
transform: translateX(0);
|
|
95
|
+
transition: transform 200ms ease-out;
|
|
96
|
+
}
|
|
97
|
+
.kui-toast[data-swipe='end'] {
|
|
98
|
+
animation: kui-toast-swipe-out 100ms ease-out forwards;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@keyframes kui-toast-in {
|
|
102
|
+
from {
|
|
103
|
+
translate: 100% 0;
|
|
104
|
+
opacity: 0;
|
|
105
|
+
}
|
|
106
|
+
to {
|
|
107
|
+
translate: 0 0;
|
|
108
|
+
opacity: 1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
@keyframes kui-toast-out {
|
|
112
|
+
to {
|
|
113
|
+
translate: 100% 0;
|
|
114
|
+
opacity: 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
@keyframes kui-toast-swipe-out {
|
|
118
|
+
from {
|
|
119
|
+
transform: translateX(var(--reka-toast-swipe-end-x));
|
|
120
|
+
}
|
|
121
|
+
to {
|
|
122
|
+
transform: translateX(calc(100% + 1rem));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (prefers-reduced-motion: reduce) {
|
|
127
|
+
.kui-toast {
|
|
128
|
+
transition: none;
|
|
129
|
+
}
|
|
130
|
+
.kui-toast[data-state='open'],
|
|
131
|
+
.kui-toast[data-state='closed'],
|
|
132
|
+
.kui-toast[data-swipe='end'] {
|
|
133
|
+
animation: none;
|
|
134
|
+
}
|
|
135
|
+
.kui-toast[data-swipe='move'],
|
|
136
|
+
.kui-toast[data-swipe='cancel'] {
|
|
137
|
+
transform: none;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
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>
|
|
@@ -0,0 +1,48 @@
|
|
|
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>
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { default as Button } from './components/Button.vue'
|
|
2
|
+
export { default as Checkbox } from './components/Checkbox.vue'
|
|
3
|
+
export { default as CloseButton } from './components/CloseButton.vue'
|
|
4
|
+
export { default as Dialog } from './components/Dialog.vue'
|
|
5
|
+
export { default as Drawer } from './components/Drawer.vue'
|
|
6
|
+
export { default as DropdownMenu } from './components/DropdownMenu.vue'
|
|
7
|
+
export { default as Input } from './components/Input.vue'
|
|
8
|
+
export { default as Label } from './components/Label.vue'
|
|
9
|
+
export { default as DropdownMenuItem } from './components/DropdownMenuItem.vue'
|
|
10
|
+
export { default as DropdownMenuSeparator } from './components/DropdownMenuSeparator.vue'
|
|
11
|
+
export { default as Popover } from './components/Popover.vue'
|
|
12
|
+
export { default as Select } from './components/Select.vue'
|
|
13
|
+
export type { SelectOption } from './components/Select.vue'
|
|
14
|
+
export { default as Separator } from './components/Separator.vue'
|
|
15
|
+
export { default as Tooltip } from './components/Tooltip.vue'
|
|
16
|
+
export { default as Toaster } from './components/Toaster.vue'
|
|
17
|
+
export { toast, toastManager } from './lib/toast'
|
|
18
|
+
export type {
|
|
19
|
+
ToastObject,
|
|
20
|
+
ToastAddOptions,
|
|
21
|
+
ToastUpdateOptions,
|
|
22
|
+
ToastPromiseOptions,
|
|
23
|
+
} from './lib/toast'
|
package/src/lib/cn.ts
ADDED
package/src/lib/toast.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createToastManager } from 'reka-ui'
|
|
2
|
+
|
|
3
|
+
const manager = createToastManager()
|
|
4
|
+
|
|
5
|
+
export const toast = {
|
|
6
|
+
add: manager.add,
|
|
7
|
+
update: manager.update,
|
|
8
|
+
close: manager.close,
|
|
9
|
+
promise: manager.promise,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const toastManager = manager
|
|
13
|
+
|
|
14
|
+
export type {
|
|
15
|
+
ToastObject,
|
|
16
|
+
ToastAddOptions,
|
|
17
|
+
ToastUpdateOptions,
|
|
18
|
+
ToastPromiseOptions,
|
|
19
|
+
} from 'reka-ui'
|