sprintify-ui 0.6.3 → 0.6.4

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.
@@ -24,6 +24,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
24
24
  default: boolean;
25
25
  type: BooleanConstructor;
26
26
  };
27
+ disabled: {
28
+ default: boolean;
29
+ type: BooleanConstructor;
30
+ };
27
31
  checkedIcon: {
28
32
  default: string;
29
33
  type: StringConstructor;
@@ -59,6 +63,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
59
63
  default: boolean;
60
64
  type: BooleanConstructor;
61
65
  };
66
+ disabled: {
67
+ default: boolean;
68
+ type: BooleanConstructor;
69
+ };
62
70
  checkedIcon: {
63
71
  default: string;
64
72
  type: StringConstructor;
@@ -74,6 +82,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
74
82
  name: string;
75
83
  color: "dark" | "light" | "danger" | "success" | "warning" | "primary" | "info";
76
84
  modelValue: string | number | boolean | null | undefined;
85
+ disabled: boolean;
77
86
  hasError: boolean;
78
87
  size: "base" | "xs" | "sm" | "lg" | "xl";
79
88
  checkedIcon: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -45,6 +45,11 @@ const Template = (args) => ({
45
45
  export const Demo = Template.bind({});
46
46
  Demo.args = {};
47
47
 
48
+ export const Disabled = Template.bind({});
49
+ Disabled.args = {
50
+ disabled: true,
51
+ };
52
+
48
53
  const colors = [
49
54
  'primary',
50
55
  'info',
@@ -5,7 +5,8 @@
5
5
  :model-value="normalizedModelValue"
6
6
  :class="[
7
7
  modelValue ? bg : 'bg-slate-200',
8
- 'relative inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-offset-2 ',
8
+ 'relative inline-flex shrink-0 items-center rounded-full transition-colors duration-200 ease-in-out',
9
+ disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer focus:outline-none focus:ring-2 focus:ring-offset-2',
9
10
  focus,
10
11
  ]"
11
12
  :style="{
@@ -32,7 +33,9 @@
32
33
  </Switch>
33
34
  <SwitchLabel
34
35
  v-if="$slots.default"
35
- class="cursor-pointer"
36
+ :class="[
37
+ disabled ? 'cursor-not-allowed' : 'cursor-pointer',
38
+ ]"
36
39
  >
37
40
  <slot />
38
41
  </SwitchLabel>
@@ -75,6 +78,10 @@ const props = defineProps({
75
78
  default: false,
76
79
  type: Boolean,
77
80
  },
81
+ disabled: {
82
+ default: false,
83
+ type: Boolean,
84
+ },
78
85
  checkedIcon: {
79
86
  default: '',
80
87
  type: String,
@@ -210,6 +217,10 @@ const icon = computed(() => {
210
217
  });
211
218
 
212
219
  function update(payload: any) {
220
+ if (props.disabled) {
221
+ return;
222
+ }
223
+
213
224
  emitUpdate(payload);
214
225
  }
215
226
  </script>