@antify/ui 3.1.26 → 3.1.27
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/components/inputs/AntCheckbox.vue +18 -3
- package/dist/components/inputs/AntCheckboxGroup.vue +18 -0
- package/dist/components/inputs/__stories/AntCheckbox.stories.d.ts +1 -0
- package/dist/components/inputs/__stories/AntCheckbox.stories.js +33 -1
- package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +32 -0
- package/package.json +1 -1
|
@@ -40,6 +40,18 @@ const props =
|
|
|
40
40
|
disabled?: boolean;
|
|
41
41
|
readonly?: boolean;
|
|
42
42
|
messages?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Tailwind ring class with focus prefix e.g. focus:ring-primary-200
|
|
45
|
+
*/
|
|
46
|
+
focusColorClass?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Tailwind outline class e.g. outline-primary-300
|
|
49
|
+
*/
|
|
50
|
+
inactiveColorClass?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Tailwind text class e.g. text-primary-500
|
|
53
|
+
*/
|
|
54
|
+
activeColorClass?: string;
|
|
43
55
|
}>(), {
|
|
44
56
|
state: InputState.base,
|
|
45
57
|
size: Size.md,
|
|
@@ -47,27 +59,30 @@ const props =
|
|
|
47
59
|
disabled: false,
|
|
48
60
|
readonly: false,
|
|
49
61
|
messages: () => [],
|
|
62
|
+
focusColorClass: 'focus:ring-primary-200',
|
|
63
|
+
inactiveColorClass: 'outline-base-300',
|
|
64
|
+
activeColorClass: 'text-primary-500',
|
|
50
65
|
});
|
|
51
66
|
const _modelValue = useVModel(props, 'modelValue', emit);
|
|
52
67
|
const delayedValue = ref(_modelValue.value);
|
|
53
68
|
const hasInputState = computed(() => props.skeleton || props.readonly || props.disabled);
|
|
54
69
|
const inputClasses = computed(() => {
|
|
55
70
|
const focusColorVariant: Record<InputState, string> = {
|
|
56
|
-
[InputState.base]:
|
|
71
|
+
[InputState.base]: props.focusColorClass,
|
|
57
72
|
[InputState.danger]: 'focus:ring-danger-200',
|
|
58
73
|
[InputState.info]: 'focus:ring-info-200',
|
|
59
74
|
[InputState.success]: 'focus:ring-success-200',
|
|
60
75
|
[InputState.warning]: 'focus:ring-warning-200',
|
|
61
76
|
};
|
|
62
77
|
const activeColorVariant: Record<InputState, string> = {
|
|
63
|
-
[InputState.base]:
|
|
78
|
+
[InputState.base]: props.activeColorClass,
|
|
64
79
|
[InputState.danger]: 'text-danger-500',
|
|
65
80
|
[InputState.info]: 'text-info-500',
|
|
66
81
|
[InputState.success]: 'text-success-500',
|
|
67
82
|
[InputState.warning]: 'text-warning-500',
|
|
68
83
|
};
|
|
69
84
|
const inactiveColorVariant: Record<InputState, string> = {
|
|
70
|
-
[InputState.base]:
|
|
85
|
+
[InputState.base]: props.inactiveColorClass,
|
|
71
86
|
[InputState.danger]: 'outline-danger-500',
|
|
72
87
|
[InputState.info]: 'outline-info-500',
|
|
73
88
|
[InputState.success]: 'outline-success-500',
|
|
@@ -34,6 +34,18 @@ const props = withDefaults(
|
|
|
34
34
|
readonly?: boolean;
|
|
35
35
|
disabled?: boolean;
|
|
36
36
|
messages?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Tailwind ring class with focus prefix e.g. focus:ring-primary-200
|
|
39
|
+
*/
|
|
40
|
+
focusColorClass?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Tailwind outline class e.g. outline-primary-300
|
|
43
|
+
*/
|
|
44
|
+
inactiveColorClass?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Tailwind text class e.g. text-primary-500
|
|
47
|
+
*/
|
|
48
|
+
activeColorClass?: string;
|
|
37
49
|
}>(),
|
|
38
50
|
{
|
|
39
51
|
direction: Direction.column,
|
|
@@ -43,6 +55,9 @@ const props = withDefaults(
|
|
|
43
55
|
readonly: false,
|
|
44
56
|
disabled: false,
|
|
45
57
|
messages: () => [],
|
|
58
|
+
focusColorClass: 'focus:ring-primary-200',
|
|
59
|
+
inactiveColorClass: 'outline-base-300',
|
|
60
|
+
activeColorClass: 'text-primary-500',
|
|
46
61
|
},
|
|
47
62
|
);
|
|
48
63
|
const containerClasses = computed(() => ({
|
|
@@ -131,6 +146,9 @@ onMounted(() => {
|
|
|
131
146
|
:skeleton="skeleton"
|
|
132
147
|
:disabled="disabled || checkbox.disabled"
|
|
133
148
|
:readonly="readonly || checkbox.readonly"
|
|
149
|
+
:active-color-class="activeColorClass"
|
|
150
|
+
:inactive-color-class="inactiveColorClass"
|
|
151
|
+
:focus-color-class="focusColorClass"
|
|
134
152
|
@update:model-value="updateValue(checkbox.value)"
|
|
135
153
|
@blur="() => onBlurCheckbox()"
|
|
136
154
|
>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
module.exports = exports.Summary = exports.Docs = void 0;
|
|
6
|
+
module.exports = exports.customColors = exports.Summary = exports.Docs = void 0;
|
|
7
7
|
var _AntCheckbox = _interopRequireDefault(require("../AntCheckbox.vue"));
|
|
8
8
|
var _vue = require("vue");
|
|
9
9
|
var _enums = require("../../../enums");
|
|
@@ -61,6 +61,38 @@ const Docs = exports.Docs = {
|
|
|
61
61
|
`
|
|
62
62
|
})
|
|
63
63
|
};
|
|
64
|
+
const customColors = exports.customColors = {
|
|
65
|
+
render: args => ({
|
|
66
|
+
components: {
|
|
67
|
+
AntCheckbox: _AntCheckbox.default
|
|
68
|
+
},
|
|
69
|
+
setup() {
|
|
70
|
+
const value = (0, _vue.computed)({
|
|
71
|
+
get() {
|
|
72
|
+
return args.modelValue;
|
|
73
|
+
},
|
|
74
|
+
set(val) {
|
|
75
|
+
args.modelValue = val;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
args,
|
|
80
|
+
value
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
template: `
|
|
84
|
+
<div class="m-2">
|
|
85
|
+
<AntCheckbox v-bind="args" v-model="value"/>
|
|
86
|
+
<span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
|
|
87
|
+
</div>
|
|
88
|
+
`
|
|
89
|
+
}),
|
|
90
|
+
args: {
|
|
91
|
+
focusColorClass: "focus:ring-teal-200",
|
|
92
|
+
inactiveColorClass: "outline-teal-300",
|
|
93
|
+
activeColorClass: "text-teal-300"
|
|
94
|
+
}
|
|
95
|
+
};
|
|
64
96
|
const Summary = exports.Summary = {
|
|
65
97
|
parameters: {
|
|
66
98
|
chromatic: {
|
|
@@ -60,6 +60,38 @@ export const Docs = {
|
|
|
60
60
|
`
|
|
61
61
|
})
|
|
62
62
|
};
|
|
63
|
+
export const customColors = {
|
|
64
|
+
render: (args) => ({
|
|
65
|
+
components: {
|
|
66
|
+
AntCheckbox
|
|
67
|
+
},
|
|
68
|
+
setup() {
|
|
69
|
+
const value = computed({
|
|
70
|
+
get() {
|
|
71
|
+
return args.modelValue;
|
|
72
|
+
},
|
|
73
|
+
set(val) {
|
|
74
|
+
args.modelValue = val;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
args,
|
|
79
|
+
value
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
template: `
|
|
83
|
+
<div class="m-2">
|
|
84
|
+
<AntCheckbox v-bind="args" v-model="value"/>
|
|
85
|
+
<span class="text-sm text-gray-500">Reactive value: {{ value }}</span>
|
|
86
|
+
</div>
|
|
87
|
+
`
|
|
88
|
+
}),
|
|
89
|
+
args: {
|
|
90
|
+
focusColorClass: "focus:ring-teal-200",
|
|
91
|
+
inactiveColorClass: "outline-teal-300",
|
|
92
|
+
activeColorClass: "text-teal-300"
|
|
93
|
+
}
|
|
94
|
+
};
|
|
63
95
|
export const Summary = {
|
|
64
96
|
parameters: {
|
|
65
97
|
chromatic: {
|