@bl33dz/fa814698dcde12f86a37ac31dd3aedf9 1.0.10 → 1.0.12
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/dist/perisai-ui.es.js +2690 -2214
- package/dist/perisai-ui.umd.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -5
- package/src/shadcn/tooltip/TooltipContent.vue +95 -3
- package/src/ui/slider.vue +4 -0
- package/src/ui/switch.vue +45 -28
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -6,6 +6,8 @@ import './globals.css'
|
|
|
6
6
|
export * from './shadcn/breadcrumb';
|
|
7
7
|
export * from './shadcn/accordion';
|
|
8
8
|
export * from './shadcn/spinner';
|
|
9
|
+
export * from './shadcn/tooltip';
|
|
10
|
+
export * from './shadcn/command';
|
|
9
11
|
|
|
10
12
|
export * from './ui/tree';
|
|
11
13
|
export { default as InputOTP } from './ui/InputOTP.vue';
|
|
@@ -18,6 +20,7 @@ export { default as SelectContent } from './ui/SelectContent.vue';
|
|
|
18
20
|
export { default as SelectSeparator } from './ui/SelectSeparator.vue';
|
|
19
21
|
export { default as SelectTrigger } from './ui/SelectTrigger.vue';
|
|
20
22
|
export { default as SelectValue } from './ui/SelectValue.vue';
|
|
23
|
+
export { default as SelectItem } from './ui/SelectItem.vue';
|
|
21
24
|
export { default as SheetContent } from './ui/SheetContent.vue';
|
|
22
25
|
export { default as SheetDescription } from './ui/SheetDescription.vue';
|
|
23
26
|
export { default as SheetHeader } from './ui/SheetHeader.vue';
|
|
@@ -171,8 +174,3 @@ export { default as Tabs } from './ui/tabs.vue';
|
|
|
171
174
|
export { default as Textarea } from './ui/textarea.vue';
|
|
172
175
|
export { default as ThreatGauge } from './ui/threat-gauge.vue';
|
|
173
176
|
export { default as Toggle } from './ui/toggle.vue';
|
|
174
|
-
export { default as TooltipContent } from './ui/tooltip-content.vue';
|
|
175
|
-
export { default as TooltipProvider } from './ui/tooltip-provider.vue';
|
|
176
|
-
export { default as TooltipRoot } from './ui/tooltip-root.vue';
|
|
177
|
-
export { default as TooltipTrigger } from './ui/tooltip-trigger.vue';
|
|
178
|
-
export { default as Tooltip } from './ui/tooltip.vue';
|
|
@@ -4,13 +4,95 @@ import type { HTMLAttributes } from "vue"
|
|
|
4
4
|
import { reactiveOmit } from "@vueuse/core"
|
|
5
5
|
import { TooltipArrow, TooltipContent, TooltipPortal, useForwardPropsEmits } from "reka-ui"
|
|
6
6
|
import { cn } from "@/lib/utils"
|
|
7
|
+
import { cva } from "class-variance-authority"
|
|
8
|
+
|
|
9
|
+
const tooltipVariants = cva(
|
|
10
|
+
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
variant: {
|
|
14
|
+
default: "bg-primary text-primary-foreground",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
16
|
+
outline:
|
|
17
|
+
"bg-popover text-popover-foreground border border-border shadow-md",
|
|
18
|
+
// Soft semantic variants using design system colors
|
|
19
|
+
"soft-success":
|
|
20
|
+
"bg-green-50 text-green-700 border border-green-200 dark:bg-green-950 dark:text-green-300 dark:border-green-800",
|
|
21
|
+
"soft-warning":
|
|
22
|
+
"bg-yellow-50 text-yellow-700 border border-yellow-200 dark:bg-yellow-950 dark:text-yellow-300 dark:border-yellow-800",
|
|
23
|
+
"soft-danger":
|
|
24
|
+
"bg-red-50 text-red-700 border border-red-200 dark:bg-red-950 dark:text-red-300 dark:border-red-800",
|
|
25
|
+
"soft-info":
|
|
26
|
+
"bg-blue-50 text-blue-700 border border-blue-200 dark:bg-blue-950 dark:text-blue-300 dark:border-blue-800",
|
|
27
|
+
// Additional soft variants
|
|
28
|
+
"soft-primary":
|
|
29
|
+
"bg-cyan-50 text-cyan-700 border border-cyan-200 dark:bg-cyan-950 dark:text-cyan-300 dark:border-cyan-800",
|
|
30
|
+
"soft-purple":
|
|
31
|
+
"bg-purple-50 text-purple-700 border border-purple-200 dark:bg-purple-950 dark:text-purple-300 dark:border-purple-800",
|
|
32
|
+
"soft-pink":
|
|
33
|
+
"bg-pink-50 text-pink-700 border border-pink-200 dark:bg-pink-950 dark:text-pink-300 dark:border-pink-800",
|
|
34
|
+
"soft-indigo":
|
|
35
|
+
"bg-indigo-50 text-indigo-700 border border-indigo-200 dark:bg-indigo-950 dark:text-indigo-300 dark:border-indigo-800",
|
|
36
|
+
"soft-orange":
|
|
37
|
+
"bg-orange-50 text-orange-700 border border-orange-200 dark:bg-orange-950 dark:text-orange-300 dark:border-orange-800",
|
|
38
|
+
"soft-teal":
|
|
39
|
+
"bg-teal-50 text-teal-700 border border-teal-200 dark:bg-teal-950 dark:text-teal-300 dark:border-teal-800",
|
|
40
|
+
"soft-neutral":
|
|
41
|
+
"bg-stone-50 text-stone-700 border border-stone-200 dark:bg-stone-900 dark:text-stone-300 dark:border-stone-700",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
variant: "default",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const tooltipArrowVariants = cva(
|
|
51
|
+
"z-50 size-2.5 translate-y-[calc(-50%_-_1px)] rotate-45 rounded-[2px]",
|
|
52
|
+
{
|
|
53
|
+
variants: {
|
|
54
|
+
variant: {
|
|
55
|
+
default: "bg-primary fill-primary",
|
|
56
|
+
secondary: "bg-secondary fill-secondary",
|
|
57
|
+
outline: "bg-popover fill-popover border border-border",
|
|
58
|
+
// Soft semantic variants - arrows match background with borders
|
|
59
|
+
"soft-success":
|
|
60
|
+
"bg-green-50 fill-green-50 border border-green-200 dark:bg-green-950 dark:fill-green-950 dark:border-green-800",
|
|
61
|
+
"soft-warning":
|
|
62
|
+
"bg-yellow-50 fill-yellow-50 border border-yellow-200 dark:bg-yellow-950 dark:fill-yellow-950 dark:border-yellow-800",
|
|
63
|
+
"soft-danger":
|
|
64
|
+
"bg-red-50 fill-red-50 border border-red-200 dark:bg-red-950 dark:fill-red-950 dark:border-red-800",
|
|
65
|
+
"soft-info":
|
|
66
|
+
"bg-blue-50 fill-blue-50 border border-blue-200 dark:bg-blue-950 dark:fill-blue-950 dark:border-blue-800",
|
|
67
|
+
"soft-primary":
|
|
68
|
+
"bg-cyan-50 fill-cyan-50 border border-cyan-200 dark:bg-cyan-950 dark:fill-cyan-950 dark:border-cyan-800",
|
|
69
|
+
"soft-purple":
|
|
70
|
+
"bg-purple-50 fill-purple-50 border border-purple-200 dark:bg-purple-950 dark:fill-purple-950 dark:border-purple-800",
|
|
71
|
+
"soft-pink":
|
|
72
|
+
"bg-pink-50 fill-pink-50 border border-pink-200 dark:bg-pink-950 dark:fill-pink-950 dark:border-pink-800",
|
|
73
|
+
"soft-indigo":
|
|
74
|
+
"bg-indigo-50 fill-indigo-50 border border-indigo-200 dark:bg-indigo-950 dark:fill-indigo-950 dark:border-indigo-800",
|
|
75
|
+
"soft-orange":
|
|
76
|
+
"bg-orange-50 fill-orange-50 border border-orange-200 dark:bg-orange-950 dark:fill-orange-950 dark:border-orange-800",
|
|
77
|
+
"soft-teal":
|
|
78
|
+
"bg-teal-50 fill-teal-50 border border-teal-200 dark:bg-teal-950 dark:fill-teal-950 dark:border-teal-800",
|
|
79
|
+
"soft-neutral":
|
|
80
|
+
"bg-stone-50 fill-stone-50 border border-stone-200 dark:bg-stone-900 dark:fill-stone-900 dark:border-stone-700",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
defaultVariants: {
|
|
84
|
+
variant: "default",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
);
|
|
7
88
|
|
|
8
89
|
defineOptions({
|
|
9
90
|
inheritAttrs: false,
|
|
10
91
|
})
|
|
11
92
|
|
|
12
|
-
const props = withDefaults(defineProps<TooltipContentProps & { class?: HTMLAttributes["class"] }>(), {
|
|
93
|
+
const props = withDefaults(defineProps<TooltipContentProps & { class?: HTMLAttributes["class"], variant?: "default" | "secondary" | "outline" | "soft-success" | "soft-warning" | "soft-danger" | "soft-info" | "soft-primary" | "soft-purple" | "soft-pink" | "soft-indigo" | "soft-orange" | "soft-teal" | "soft-neutral" }>(), {
|
|
13
94
|
sideOffset: 4,
|
|
95
|
+
variant: "default"
|
|
14
96
|
})
|
|
15
97
|
|
|
16
98
|
const emits = defineEmits<TooltipContentEmits>()
|
|
@@ -24,11 +106,21 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
|
24
106
|
<TooltipContent
|
|
25
107
|
data-slot="tooltip-content"
|
|
26
108
|
v-bind="{ ...forwarded, ...$attrs }"
|
|
27
|
-
:class="cn(
|
|
109
|
+
:class="cn(
|
|
110
|
+
'bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance',
|
|
111
|
+
tooltipVariants({ variant: props.variant }),
|
|
112
|
+
props.class,
|
|
113
|
+
'p-3'
|
|
114
|
+
)"
|
|
28
115
|
>
|
|
29
116
|
<slot />
|
|
30
117
|
|
|
31
|
-
<TooltipArrow
|
|
118
|
+
<TooltipArrow
|
|
119
|
+
:class="cn(
|
|
120
|
+
'bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]',
|
|
121
|
+
tooltipArrowVariants({ variant: props.variant })
|
|
122
|
+
)"
|
|
123
|
+
/>
|
|
32
124
|
</TooltipContent>
|
|
33
125
|
</TooltipPortal>
|
|
34
126
|
</template>
|
package/src/ui/slider.vue
CHANGED
package/src/ui/switch.vue
CHANGED
|
@@ -1,33 +1,50 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup>
|
|
8
|
-
import { defineProps, defineEmits, useAttrs } from 'vue';
|
|
9
|
-
import { cn } from './utils';
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { SwitchRoot, SwitchThumb } from 'reka-ui'
|
|
3
|
+
import { defineProps, defineEmits, useAttrs, computed } from 'vue'
|
|
4
|
+
import { cn } from './utils'
|
|
10
5
|
|
|
11
6
|
const props = defineProps({
|
|
12
|
-
modelValue:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
default: false,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
const emit = defineEmits(['update:modelValue']);
|
|
22
|
-
const $attrs = useAttrs();
|
|
7
|
+
modelValue: Boolean,
|
|
8
|
+
disabled: Boolean,
|
|
9
|
+
class: String,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const emit = defineEmits(['update:modelValue'])
|
|
23
13
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
14
|
+
const attrs = useAttrs()
|
|
15
|
+
|
|
16
|
+
const rootAttrs = computed(() => {
|
|
17
|
+
const { checked, modelValue, disabled, ...rest } = attrs
|
|
18
|
+
return rest
|
|
19
|
+
})
|
|
29
20
|
</script>
|
|
30
21
|
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
<template>
|
|
23
|
+
<SwitchRoot
|
|
24
|
+
v-bind="rootAttrs"
|
|
25
|
+
:checked="modelValue"
|
|
26
|
+
:disabled="disabled"
|
|
27
|
+
@update:checked="v => emit('update:modelValue', v)"
|
|
28
|
+
:class="cn(
|
|
29
|
+
'relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors',
|
|
30
|
+
'bg-muted data-[state=checked]:bg-primary',
|
|
31
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
|
|
32
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
33
|
+
props.class
|
|
34
|
+
)"
|
|
35
|
+
>
|
|
36
|
+
<SwitchThumb
|
|
37
|
+
class="
|
|
38
|
+
pointer-events-none
|
|
39
|
+
block
|
|
40
|
+
h-5 w-5
|
|
41
|
+
rounded-full
|
|
42
|
+
bg-background
|
|
43
|
+
shadow-lg
|
|
44
|
+
transition-transform
|
|
45
|
+
translate-x-1
|
|
46
|
+
data-[state=checked]:translate-x-5
|
|
47
|
+
"
|
|
48
|
+
/>
|
|
49
|
+
</SwitchRoot>
|
|
50
|
+
</template>
|