sprintify-ui 0.6.3 → 0.6.5

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.
@@ -8,13 +8,6 @@ declare const _default: import("vue").DefineComponent<{
8
8
  type: import("vue").PropType<ActionItem[]>;
9
9
  default: undefined;
10
10
  };
11
- attributes: {
12
- type: import("vue").PropType<{
13
- icon: string;
14
- label: string;
15
- }[]>;
16
- default: undefined;
17
- };
18
11
  breadcrumbs: {
19
12
  type: import("vue").PropType<Breadcrumb[]>;
20
13
  default: undefined;
@@ -23,6 +16,13 @@ declare const _default: import("vue").DefineComponent<{
23
16
  type: import("vue").PropType<"default" | "compact">;
24
17
  default: string;
25
18
  };
19
+ attributes: {
20
+ type: import("vue").PropType<{
21
+ icon: string;
22
+ label: string;
23
+ }[]>;
24
+ default: undefined;
25
+ };
26
26
  subtitle: {
27
27
  type: import("vue").PropType<string>;
28
28
  default: undefined;
@@ -48,13 +48,6 @@ declare const _default: import("vue").DefineComponent<{
48
48
  type: import("vue").PropType<ActionItem[]>;
49
49
  default: undefined;
50
50
  };
51
- attributes: {
52
- type: import("vue").PropType<{
53
- icon: string;
54
- label: string;
55
- }[]>;
56
- default: undefined;
57
- };
58
51
  breadcrumbs: {
59
52
  type: import("vue").PropType<Breadcrumb[]>;
60
53
  default: undefined;
@@ -63,6 +56,13 @@ declare const _default: import("vue").DefineComponent<{
63
56
  type: import("vue").PropType<"default" | "compact">;
64
57
  default: string;
65
58
  };
59
+ attributes: {
60
+ type: import("vue").PropType<{
61
+ icon: string;
62
+ label: string;
63
+ }[]>;
64
+ default: undefined;
65
+ };
66
66
  subtitle: {
67
67
  type: import("vue").PropType<string>;
68
68
  default: undefined;
@@ -81,12 +81,12 @@ declare const _default: import("vue").DefineComponent<{
81
81
  };
82
82
  }>>, {
83
83
  actions: ActionItem[];
84
+ breadcrumbs: Breadcrumb[];
85
+ layout: 'default' | 'compact';
84
86
  attributes: {
85
87
  icon: string;
86
88
  label: string;
87
89
  }[];
88
- breadcrumbs: Breadcrumb[];
89
- layout: 'default' | 'compact';
90
90
  subtitle: string;
91
91
  badge: {
92
92
  icon: string;
@@ -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.5",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -105,8 +105,6 @@ const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate } =
105
105
  emit: emit,
106
106
  });
107
107
 
108
- const options = ref<HTMLOptionElement[]>([]);
109
-
110
108
  function isEmptyExternal(value: string | number | null | undefined) {
111
109
  if (value === undefined || value === EMPTY_VALUE_EXTERNAL) {
112
110
  return true;
@@ -132,46 +130,9 @@ const modelValueInternal = computed(() => {
132
130
  return EMPTY_VALUE_INTERNAL;
133
131
  }
134
132
 
135
- if (!checkIfModelValueIsValid()) {
136
- return EMPTY_VALUE_INTERNAL;
137
- }
138
-
139
133
  return props.modelValue;
140
134
  });
141
135
 
142
- /**
143
- * Checks if the current modelValue is valid
144
- */
145
- useMutationObserver(
146
- select,
147
- () => {
148
- options.value = getOptions();
149
- },
150
- { attributes: false, childList: true }
151
- );
152
-
153
- onMounted(() => {
154
- options.value = getOptions();
155
- });
156
-
157
- function getOptions(): HTMLOptionElement[] {
158
- return [...(select.value?.options ?? [])];
159
- }
160
-
161
- function checkIfModelValueIsValid(): boolean {
162
- if (props.modelValue === EMPTY_VALUE_EXTERNAL) {
163
- return true;
164
- }
165
-
166
- if (props.options && props.options.length) {
167
- return props.options.some((o) =>
168
- isEqual(o[props.valueKey as any], props.modelValue)
169
- );
170
- }
171
-
172
- return options.value.some((o) => isEqual(o.value, props.modelValue));
173
- }
174
-
175
136
  /**
176
137
  *
177
138
  * Emit change while mutating internal empty value ''
@@ -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>