@bl33dz/fa814698dcde12f86a37ac31dd3aedf9 1.0.12 → 1.0.14

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.12",
6
+ "version": "1.0.14",
7
7
  "main": "dist/perisai-ui.umd.js",
8
8
  "module": "dist/perisai-ui.es.js",
9
9
  "scripts": {
package/src/index.ts CHANGED
@@ -8,6 +8,8 @@ export * from './shadcn/accordion';
8
8
  export * from './shadcn/spinner';
9
9
  export * from './shadcn/tooltip';
10
10
  export * from './shadcn/command';
11
+ export * from './shadcn/switch';
12
+ export * from './shadcn/collapsible';
11
13
 
12
14
  export * from './ui/tree';
13
15
  export { default as InputOTP } from './ui/InputOTP.vue';
@@ -157,7 +159,7 @@ export { default as Wrapper } from './ui/sidebar/Wrapper.vue';
157
159
  export { default as Skeleton } from './ui/skeleton.vue';
158
160
  export { default as Slider } from './ui/slider.vue';
159
161
  export { default as Sonner } from './ui/sonner.vue';
160
- export { default as Switch } from './ui/switch.vue';
162
+ // export { default as Switch } from './ui/switch.vue';
161
163
  export { default as TabContent } from './ui/tab-content.vue';
162
164
  export { default as TabList } from './ui/tab-list.vue';
163
165
  export { default as TabPanel } from './ui/tab-panel.vue';
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ import type { CollapsibleRootEmits, CollapsibleRootProps } from "reka-ui"
3
+ import { CollapsibleRoot, useForwardPropsEmits } from "reka-ui"
4
+
5
+ const props = defineProps<CollapsibleRootProps>()
6
+ const emits = defineEmits<CollapsibleRootEmits>()
7
+
8
+ const forwarded = useForwardPropsEmits(props, emits)
9
+ </script>
10
+
11
+ <template>
12
+ <CollapsibleRoot
13
+ v-slot="slotProps"
14
+ data-slot="collapsible"
15
+ v-bind="forwarded"
16
+ >
17
+ <slot v-bind="slotProps" />
18
+ </CollapsibleRoot>
19
+ </template>
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ import type { CollapsibleContentProps } from "reka-ui"
3
+ import { CollapsibleContent } from "reka-ui"
4
+
5
+ const props = defineProps<CollapsibleContentProps>()
6
+ </script>
7
+
8
+ <template>
9
+ <CollapsibleContent
10
+ data-slot="collapsible-content"
11
+ v-bind="props"
12
+ >
13
+ <slot />
14
+ </CollapsibleContent>
15
+ </template>
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ import type { CollapsibleTriggerProps } from "reka-ui"
3
+ import { CollapsibleTrigger } from "reka-ui"
4
+
5
+ const props = defineProps<CollapsibleTriggerProps>()
6
+ </script>
7
+
8
+ <template>
9
+ <CollapsibleTrigger
10
+ data-slot="collapsible-trigger"
11
+ v-bind="props"
12
+ >
13
+ <slot />
14
+ </CollapsibleTrigger>
15
+ </template>
@@ -0,0 +1,3 @@
1
+ export { default as Collapsible } from "./Collapsible.vue"
2
+ export { default as CollapsibleContent } from "./CollapsibleContent.vue"
3
+ export { default as CollapsibleTrigger } from "./CollapsibleTrigger.vue"
@@ -29,7 +29,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
29
29
  v-bind="forwarded"
30
30
  :class="
31
31
  cn(
32
- 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
32
+ 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border shadow-lg duration-200 sm:max-w-lg',
33
33
  props.class,
34
34
  )"
35
35
  >
package/src/ui/select.vue CHANGED
@@ -13,65 +13,53 @@
13
13
  }"
14
14
  @update:modelValue="$emit('update:modelValue', $event)"
15
15
  />
16
- <Select v-else v-bind="singleProps" data-slot="select" :custom-class="customClass" @update:modelValue="$emit('update:modelValue', $event)" >
17
- <slot />
18
- </Select>
19
- </template>
20
-
21
- <script setup>
22
16
 
23
- import { ref, computed, defineProps, defineEmits, useAttrs } from 'vue';
17
+ <ShadcnSelect
18
+ v-else
19
+ v-model="internalValue"
20
+ :disabled="disabled"
21
+ >
22
+ <SelectTrigger class="w-full">
23
+ <SelectValue :placeholder="placeholder" />
24
+ </SelectTrigger>
24
25
 
25
- import SelectMultiple from './select-multiple.vue';
26
- import { Select } from '@/shadcn/select';
26
+ <SelectContent>
27
+ <SelectItem
28
+ v-for="opt in options"
29
+ :key="String(opt.value)"
30
+ :value="String(opt.value)"
31
+ >
32
+ {{ opt.label }}
33
+ </SelectItem>
34
+ </SelectContent>
35
+ </ShadcnSelect>
36
+ </template>
37
+ <script setup lang="ts">
38
+ import { computed, useAttrs } from 'vue'
39
+ import {
40
+ Select as ShadcnSelect,
41
+ SelectTrigger,
42
+ SelectValue,
43
+ SelectContent,
44
+ SelectItem,
45
+ } from '@/shadcn/select'
27
46
 
28
47
  const props = defineProps({
29
- modelValue: {
30
- type: [String, Array],
31
- default: '',
32
- },
33
- options: {
34
- type: Array,
35
- default: () => [],
36
- },
37
- multiple: {
38
- type: Boolean,
39
- default: false,
40
- },
41
- placeholder: {
42
- type: String,
43
- default: 'Select option',
44
- },
45
- title: {
46
- type: String,
47
- default: 'Select Options',
48
- },
49
- maxDisplay: {
50
- type: Number,
51
- default: 2,
52
- },
53
- disabled: {
54
- type: Boolean,
55
- default: false,
56
- },
57
- size: {
58
- type: String,
59
- default: 'default',
60
- },
61
- customClass: {
62
- type: String,
63
- default: '',
64
- },
65
- });
48
+ modelValue: [String, Array],
49
+ options: { type: Array, default: () => [] },
50
+ multiple: Boolean,
51
+ placeholder: String,
52
+ disabled: Boolean,
53
+ customClass: String,
54
+ })
66
55
 
56
+ const emit = defineEmits(['update:modelValue'])
67
57
 
68
- const emit = defineEmits(['update:modelValue']);
69
- const $attrs = useAttrs();
70
- const mergedClass = computed(() => props.customClass || $attrs.class || '');
58
+ const internalValue = computed({
59
+ get: () => props.modelValue,
60
+ set: v => emit('update:modelValue', v),
61
+ })
71
62
 
72
- // Remove 'multiple' prop for single select, pass the rest
73
- const singleProps = computed(() => {
74
- const { multiple, ...rest } = { ...props, class: mergedClass.value };
75
- return rest;
76
- });
63
+ const attrs = useAttrs()
64
+ const mergedClass = computed(() => props.customClass || attrs.class || '')
77
65
  </script>
package/src/ui/slider.vue CHANGED
@@ -1,36 +1,36 @@
1
- <template>
2
- <Slider ref="sliderRef" :class="['relative flex w-full touch-none select-none items-center', customClass]" v-bind="props" />
3
- </template>
4
-
5
- <script setup>
6
- import { defineProps, useAttrs } from 'vue';
1
+ <script setup lang="ts">
2
+ import { computed } from "vue"
3
+ import SliderBase from "@/shadcn/slider/Slider.vue"
7
4
 
8
5
  const props = defineProps({
9
6
  modelValue: {
10
7
  type: Number,
11
8
  default: 0,
12
9
  },
13
- min: {
14
- type: Number,
15
- default: 0,
16
- },
17
- max: {
18
- type: Number,
19
- default: 100,
20
- },
21
- step: {
22
- type: Number,
23
- default: 1,
24
- },
25
- disabled: {
26
- type: Boolean,
27
- default: false,
28
- },
29
- customClass: {
30
- type: [String, Array, Object],
31
- default: '',
32
- }
33
- });
10
+ min: Number,
11
+ max: Number,
12
+ step: Number,
13
+ disabled: Boolean,
14
+ class: String,
15
+ })
16
+
17
+ const emit = defineEmits<{
18
+ "update:modelValue": [value: number]
19
+ }>()
34
20
 
35
- const $attrs = useAttrs();
21
+ const value = computed({
22
+ get: () => [props.modelValue],
23
+ set: (v: number[]) => emit("update:modelValue", v[0]),
24
+ })
36
25
  </script>
26
+
27
+ <template>
28
+ <SliderBase
29
+ v-model="value"
30
+ :min="min"
31
+ :max="max"
32
+ :step="step"
33
+ :disabled="disabled"
34
+ :class="class"
35
+ />
36
+ </template>
package/src/ui/switch.vue CHANGED
@@ -1,50 +1,32 @@
1
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'
2
+ import { computed } from 'vue'
3
+ import BaseSwitch from '@/shadcn/switch/Switch.vue'
5
4
 
6
5
  const props = defineProps({
7
- modelValue: Boolean,
6
+ modelValue: {
7
+ type: Boolean,
8
+ default: false,
9
+ },
8
10
  disabled: Boolean,
9
11
  class: String,
10
12
  })
11
13
 
12
- const emit = defineEmits(['update:modelValue'])
14
+ const emit = defineEmits<{
15
+ 'update:modelValue': [value: boolean]
16
+ }>()
13
17
 
14
- const attrs = useAttrs()
15
-
16
- const rootAttrs = computed(() => {
17
- const { checked, modelValue, disabled, ...rest } = attrs
18
- return rest
18
+ // 🔑 Bridge shadcn <-> Vue v-model
19
+ const checked = computed({
20
+ get: () => props.modelValue,
21
+ set: (v: boolean) => emit('update:modelValue', v),
19
22
  })
20
23
  </script>
21
24
 
22
25
  <template>
23
- <SwitchRoot
24
- v-bind="rootAttrs"
25
- :checked="modelValue"
26
+ <BaseSwitch
27
+ :checked="checked"
28
+ @update:checked="checked = $event"
26
29
  :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>
30
+ :class="class"
31
+ />
50
32
  </template>