@bl33dz/fa814698dcde12f86a37ac31dd3aedf9 1.0.11 → 1.0.13

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.11",
6
+ "version": "1.0.13",
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';
@@ -20,6 +22,7 @@ export { default as SelectContent } from './ui/SelectContent.vue';
20
22
  export { default as SelectSeparator } from './ui/SelectSeparator.vue';
21
23
  export { default as SelectTrigger } from './ui/SelectTrigger.vue';
22
24
  export { default as SelectValue } from './ui/SelectValue.vue';
25
+ export { default as SelectItem } from './ui/SelectItem.vue';
23
26
  export { default as SheetContent } from './ui/SheetContent.vue';
24
27
  export { default as SheetDescription } from './ui/SheetDescription.vue';
25
28
  export { default as SheetHeader } from './ui/SheetHeader.vue';
@@ -156,7 +159,7 @@ export { default as Wrapper } from './ui/sidebar/Wrapper.vue';
156
159
  export { default as Skeleton } from './ui/skeleton.vue';
157
160
  export { default as Slider } from './ui/slider.vue';
158
161
  export { default as Sonner } from './ui/sonner.vue';
159
- export { default as Switch } from './ui/switch.vue';
162
+ // export { default as Switch } from './ui/switch.vue';
160
163
  export { default as TabContent } from './ui/tab-content.vue';
161
164
  export { default as TabList } from './ui/tab-list.vue';
162
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"
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,32 +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
- });
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
+ }>()
30
20
 
31
- const $attrs = useAttrs();
21
+ const value = computed({
22
+ get: () => [props.modelValue],
23
+ set: (v: number[]) => emit("update:modelValue", v[0]),
24
+ })
32
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,33 +1,32 @@
1
- <template>
2
- <Switch>
3
- <slot />
4
- </Switch>
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 { computed } from 'vue'
3
+ import BaseSwitch from '@/shadcn/switch/Switch.vue'
10
4
 
11
5
  const props = defineProps({
12
6
  modelValue: {
13
7
  type: Boolean,
14
8
  default: false,
15
9
  },
16
- disabled: {
17
- type: Boolean,
18
- default: false,
19
- },
20
- });
21
- const emit = defineEmits(['update:modelValue']);
22
- const $attrs = useAttrs();
10
+ disabled: Boolean,
11
+ class: String,
12
+ })
13
+
14
+ const emit = defineEmits<{
15
+ 'update:modelValue': [value: boolean]
16
+ }>()
23
17
 
24
- function toggle() {
25
- if (!props.disabled) {
26
- emit('update:modelValue', !props.modelValue);
27
- }
28
- }
18
+ // 🔑 Bridge shadcn <-> Vue v-model
19
+ const checked = computed({
20
+ get: () => props.modelValue,
21
+ set: (v: boolean) => emit('update:modelValue', v),
22
+ })
29
23
  </script>
30
24
 
31
- <style scoped>
32
- /* All styles handled by Tailwind classes */
33
- </style>
25
+ <template>
26
+ <BaseSwitch
27
+ :checked="checked"
28
+ @update:checked="checked = $event"
29
+ :disabled="disabled"
30
+ :class="class"
31
+ />
32
+ </template>