sprintify-ui 0.1.12 → 0.1.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/dist/sprintify-ui.es.js +1647 -1597
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +3 -3
- package/dist/types/src/components/BaseMediaPreview.vue.d.ts +9 -0
- package/dist/types/src/components/BaseSwitch.vue.d.ts +45 -0
- package/package.json +1 -1
- package/src/components/BaseDatePicker.vue +2 -2
- package/src/components/BaseMediaPreview.vue +6 -2
- package/src/components/BaseSwitch.stories.js +20 -0
- package/src/components/BaseSwitch.vue +50 -2
|
@@ -11,7 +11,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
11
11
|
enableTime?: boolean | undefined;
|
|
12
12
|
mode?: "time" | "multiple" | "single" | "range" | undefined;
|
|
13
13
|
noCalendar?: boolean | undefined;
|
|
14
|
-
disableDates?: string[] | Date[] | undefined;
|
|
14
|
+
disableDates?: string[] | Date[] | ((date: Date) => boolean) | undefined;
|
|
15
15
|
}>, {
|
|
16
16
|
modelValue: null;
|
|
17
17
|
required: boolean;
|
|
@@ -37,7 +37,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
37
37
|
enableTime?: boolean | undefined;
|
|
38
38
|
mode?: "time" | "multiple" | "single" | "range" | undefined;
|
|
39
39
|
noCalendar?: boolean | undefined;
|
|
40
|
-
disableDates?: string[] | Date[] | undefined;
|
|
40
|
+
disableDates?: string[] | Date[] | ((date: Date) => boolean) | undefined;
|
|
41
41
|
}>, {
|
|
42
42
|
modelValue: null;
|
|
43
43
|
required: boolean;
|
|
@@ -65,7 +65,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
65
65
|
maxDate: string | Date | null;
|
|
66
66
|
enableTime: boolean;
|
|
67
67
|
noCalendar: boolean;
|
|
68
|
-
disableDates: string[] | Date[];
|
|
68
|
+
disableDates: string[] | Date[] | ((date: Date) => boolean);
|
|
69
69
|
}>;
|
|
70
70
|
export default _default;
|
|
71
71
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -10,6 +10,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
10
10
|
default: boolean;
|
|
11
11
|
type: BooleanConstructor;
|
|
12
12
|
};
|
|
13
|
+
previewImage: {
|
|
14
|
+
default: boolean;
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
};
|
|
13
17
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "delete"[], "delete", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
14
18
|
media: {
|
|
15
19
|
required: true;
|
|
@@ -19,9 +23,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
19
23
|
default: boolean;
|
|
20
24
|
type: BooleanConstructor;
|
|
21
25
|
};
|
|
26
|
+
previewImage: {
|
|
27
|
+
default: boolean;
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
};
|
|
22
30
|
}>> & {
|
|
23
31
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
24
32
|
}, {
|
|
25
33
|
showRemove: boolean;
|
|
34
|
+
previewImage: boolean;
|
|
26
35
|
}>;
|
|
27
36
|
export default _default;
|
|
@@ -24,6 +24,26 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
24
24
|
default: boolean;
|
|
25
25
|
type: BooleanConstructor;
|
|
26
26
|
};
|
|
27
|
+
hasIcon: {
|
|
28
|
+
default: boolean;
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
};
|
|
31
|
+
checkedIcon: {
|
|
32
|
+
default: string;
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
};
|
|
35
|
+
unCheckedIcon: {
|
|
36
|
+
default: string;
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
};
|
|
39
|
+
checkedIconColor: {
|
|
40
|
+
default: string;
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
};
|
|
43
|
+
unCheckedIconColor: {
|
|
44
|
+
default: string;
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
};
|
|
27
47
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
28
48
|
modelValue: {
|
|
29
49
|
default: boolean;
|
|
@@ -49,6 +69,26 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
49
69
|
default: boolean;
|
|
50
70
|
type: BooleanConstructor;
|
|
51
71
|
};
|
|
72
|
+
hasIcon: {
|
|
73
|
+
default: boolean;
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
};
|
|
76
|
+
checkedIcon: {
|
|
77
|
+
default: string;
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
};
|
|
80
|
+
unCheckedIcon: {
|
|
81
|
+
default: string;
|
|
82
|
+
type: StringConstructor;
|
|
83
|
+
};
|
|
84
|
+
checkedIconColor: {
|
|
85
|
+
default: string;
|
|
86
|
+
type: StringConstructor;
|
|
87
|
+
};
|
|
88
|
+
unCheckedIconColor: {
|
|
89
|
+
default: string;
|
|
90
|
+
type: StringConstructor;
|
|
91
|
+
};
|
|
52
92
|
}>> & {
|
|
53
93
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
54
94
|
}, {
|
|
@@ -58,6 +98,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
58
98
|
modelValue: string | number | boolean | null | undefined;
|
|
59
99
|
hasError: boolean;
|
|
60
100
|
size: "base" | "xs" | "sm" | "lg" | "xl";
|
|
101
|
+
hasIcon: boolean;
|
|
102
|
+
checkedIcon: string;
|
|
103
|
+
unCheckedIcon: string;
|
|
104
|
+
checkedIconColor: string;
|
|
105
|
+
unCheckedIconColor: string;
|
|
61
106
|
}>, {
|
|
62
107
|
default: (_: {}) => any;
|
|
63
108
|
}>;
|
package/package.json
CHANGED
|
@@ -58,7 +58,7 @@ const props = withDefaults(
|
|
|
58
58
|
enableTime?: boolean;
|
|
59
59
|
mode?: 'single' | 'multiple' | 'range' | 'time';
|
|
60
60
|
noCalendar?: boolean;
|
|
61
|
-
disableDates?: string[] | Date[];
|
|
61
|
+
disableDates?: string[] | Date[] | ((date: Date) => boolean);
|
|
62
62
|
}>(),
|
|
63
63
|
{
|
|
64
64
|
modelValue: null,
|
|
@@ -164,7 +164,7 @@ const flatpickrConfig = computed(() => {
|
|
|
164
164
|
inline: props.inline,
|
|
165
165
|
animate: false,
|
|
166
166
|
time_24hr: true,
|
|
167
|
-
};
|
|
167
|
+
} as any;
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
// Make sure the model value is formatted on the parent component onload
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
:class="[url ? 'duration-100 hover:bg-slate-100' : 'bg-white']"
|
|
9
9
|
>
|
|
10
10
|
<img
|
|
11
|
-
v-if="type == 'image' && url"
|
|
11
|
+
v-if="type == 'image' && url && previewImage"
|
|
12
12
|
:src="url"
|
|
13
13
|
class="h-full w-full bg-black object-contain object-center"
|
|
14
14
|
:alt="name"
|
|
15
15
|
/>
|
|
16
16
|
<img
|
|
17
|
-
v-else-if="type == 'image' && 'data_url' in media"
|
|
17
|
+
v-else-if="type == 'image' && 'data_url' in media && previewImage"
|
|
18
18
|
:src="media.data_url"
|
|
19
19
|
class="h-full w-full bg-black object-contain object-center"
|
|
20
20
|
:alt="name"
|
|
@@ -71,6 +71,10 @@ const props = defineProps({
|
|
|
71
71
|
default: true,
|
|
72
72
|
type: Boolean,
|
|
73
73
|
},
|
|
74
|
+
previewImage: {
|
|
75
|
+
default: true,
|
|
76
|
+
type: Boolean,
|
|
77
|
+
},
|
|
74
78
|
});
|
|
75
79
|
|
|
76
80
|
const name = computed(() => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BaseSwitch from './BaseSwitch.vue';
|
|
2
2
|
import BaseContainer from './BaseContainer.vue';
|
|
3
3
|
import { createFieldStory } from '../../.storybook/utils';
|
|
4
|
+
import { Icon } from '@iconify/vue';
|
|
4
5
|
|
|
5
6
|
export default {
|
|
6
7
|
title: 'Form/BaseSwitch',
|
|
@@ -106,3 +107,22 @@ export const Field = createFieldStory({
|
|
|
106
107
|
componentName: 'BaseSwitch',
|
|
107
108
|
label: 'Activate',
|
|
108
109
|
});
|
|
110
|
+
|
|
111
|
+
const Icons = (args) => ({
|
|
112
|
+
components: {
|
|
113
|
+
BaseSwitch,
|
|
114
|
+
BaseContainer,
|
|
115
|
+
},
|
|
116
|
+
setup() {
|
|
117
|
+
const value = ref(true);
|
|
118
|
+
return { args, value };
|
|
119
|
+
},
|
|
120
|
+
template: `
|
|
121
|
+
<BaseSwitch v-model="value" :hasIcon="true" v-bind="args">
|
|
122
|
+
<span class="text-slate-600">Label</span>
|
|
123
|
+
</BaseSwitch>
|
|
124
|
+
`,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export const WithIcons = Icons.bind({});
|
|
128
|
+
WithIcons.args = {};
|
|
@@ -20,9 +20,13 @@
|
|
|
20
20
|
height: sizePx + 'px',
|
|
21
21
|
width: sizePx + 'px',
|
|
22
22
|
transform: `translateX(${translateX}px)`,
|
|
23
|
+
color: iconColor,
|
|
24
|
+
fontSize: sizePx - 7 + 'px',
|
|
23
25
|
}"
|
|
24
|
-
class="
|
|
25
|
-
|
|
26
|
+
class="flex items-center justify-center inline-block transition duration-200 ease-in-out bg-white rounded-full shadow pointer-events-none ring-0"
|
|
27
|
+
>
|
|
28
|
+
<BaseIcon v-if="hasIcon" :icon="icon" />
|
|
29
|
+
</span>
|
|
26
30
|
</Switch>
|
|
27
31
|
<SwitchLabel v-if="$slots.default" class="cursor-pointer">
|
|
28
32
|
<slot />
|
|
@@ -66,6 +70,26 @@ const props = defineProps({
|
|
|
66
70
|
default: false,
|
|
67
71
|
type: Boolean,
|
|
68
72
|
},
|
|
73
|
+
hasIcon: {
|
|
74
|
+
default: false,
|
|
75
|
+
type: Boolean,
|
|
76
|
+
},
|
|
77
|
+
checkedIcon: {
|
|
78
|
+
default: 'heroicons-solid:check',
|
|
79
|
+
type: String,
|
|
80
|
+
},
|
|
81
|
+
unCheckedIcon: {
|
|
82
|
+
default: 'heroicons-solid:x',
|
|
83
|
+
type: String,
|
|
84
|
+
},
|
|
85
|
+
checkedIconColor: {
|
|
86
|
+
default: '#9ca3af',
|
|
87
|
+
type: String,
|
|
88
|
+
},
|
|
89
|
+
unCheckedIconColor: {
|
|
90
|
+
default: '#9ca3af',
|
|
91
|
+
type: String,
|
|
92
|
+
},
|
|
69
93
|
});
|
|
70
94
|
|
|
71
95
|
const emit = defineEmits(['update:modelValue']);
|
|
@@ -182,6 +206,30 @@ const translateX = computed(() => {
|
|
|
182
206
|
return padding.value;
|
|
183
207
|
});
|
|
184
208
|
|
|
209
|
+
const iconColor = computed(() => {
|
|
210
|
+
if (props.hasIcon) {
|
|
211
|
+
if (props.modelValue) {
|
|
212
|
+
return props.checkedIconColor;
|
|
213
|
+
}
|
|
214
|
+
if (!props.modelValue) {
|
|
215
|
+
return props.unCheckedIconColor;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return '';
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const icon = computed(() => {
|
|
222
|
+
if (props.hasIcon) {
|
|
223
|
+
if (props.modelValue) {
|
|
224
|
+
return props.checkedIcon;
|
|
225
|
+
}
|
|
226
|
+
if (!props.modelValue) {
|
|
227
|
+
return props.unCheckedIcon;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return null;
|
|
231
|
+
});
|
|
232
|
+
|
|
185
233
|
function update(payload: any) {
|
|
186
234
|
emitUpdate(payload);
|
|
187
235
|
}
|