design-system-next 1.13.2 → 1.13.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.
- package/dist/design-system-next.js +4525 -4644
- package/dist/design-system-next.js.gz +0 -0
- package/dist/main.css +1 -1
- package/dist/main.css.gz +0 -0
- package/package.json +1 -1
- package/src/components/button/use-button.ts +13 -8
- package/src/components/dropdown/dropdown.vue +4 -1
- package/src/components/input/input-contact-number/input-contact-number.vue +25 -26
- package/src/components/input/input-password/input-password.vue +9 -11
- package/src/components/input/input-password/use-input-password.ts +7 -15
- package/src/components/input/input.ts +1 -5
- package/src/components/input/input.vue +7 -9
- package/src/components/input/use-input.ts +41 -37
- package/src/components/radio/radio.ts +1 -1
- package/src/components/radio/radio.vue +3 -3
- package/src/components/radio/use-radio.ts +13 -4
- package/src/components/table/table.vue +1 -1
|
@@ -4,22 +4,23 @@
|
|
|
4
4
|
{{ props.label }}
|
|
5
5
|
</label>
|
|
6
6
|
|
|
7
|
-
<div class="
|
|
7
|
+
<div :class="inputClasses.inputTextBaseClasses">
|
|
8
8
|
<div v-if="$slots.prefix" :class="inputClasses.prefixSlotClasses">
|
|
9
9
|
<slot name="prefix" />
|
|
10
10
|
</div>
|
|
11
11
|
<input
|
|
12
12
|
v-bind="$attrs"
|
|
13
13
|
:class="[inputClasses.inputTextClasses, { 'number-input': props.type === 'number' }]"
|
|
14
|
-
:value="props.modelValue ? props.modelValue : props.preValue"
|
|
15
14
|
:placeholder="props.placeholder"
|
|
16
15
|
:disabled="props.disabled"
|
|
17
16
|
:readonly="props.readonly"
|
|
18
17
|
:type="props.type"
|
|
19
18
|
:minlength="props.minLength"
|
|
20
19
|
:maxlength="props.maxLength"
|
|
20
|
+
:value="modelValue"
|
|
21
21
|
@input="onInput"
|
|
22
22
|
/>
|
|
23
|
+
<!-- :value="props.modelValue ? modelValue : props.preValue" -->
|
|
23
24
|
<div v-if="$slots.trailing" :class="inputClasses.trailingSlotClasses">
|
|
24
25
|
<slot name="trailing" />
|
|
25
26
|
</div>
|
|
@@ -30,11 +31,7 @@
|
|
|
30
31
|
|
|
31
32
|
<label
|
|
32
33
|
v-if="props.displayHelper"
|
|
33
|
-
:class="[
|
|
34
|
-
inputClasses.helperClasses,
|
|
35
|
-
'spr-body-sm-regular',
|
|
36
|
-
'spr-flex spr-items-center spr-gap-size-spacing-5xs',
|
|
37
|
-
]"
|
|
34
|
+
:class="[inputClasses.helperClasses, 'spr-body-sm-regular', 'spr-flex spr-items-center spr-gap-size-spacing-5xs']"
|
|
38
35
|
>
|
|
39
36
|
<slot name="helperMessage">
|
|
40
37
|
<icon v-if="props.helperIcon" :icon="props.helperIcon" width="20px" height="20px" />
|
|
@@ -46,16 +43,17 @@
|
|
|
46
43
|
|
|
47
44
|
<script setup lang="ts">
|
|
48
45
|
import { useSlots } from 'vue';
|
|
46
|
+
|
|
49
47
|
import { Icon } from '@iconify/vue';
|
|
48
|
+
|
|
50
49
|
import { inputPropTypes, inputEmitTypes } from './input';
|
|
51
50
|
import { useInput } from './use-input';
|
|
52
51
|
|
|
53
52
|
const emit = defineEmits(inputEmitTypes);
|
|
54
|
-
|
|
55
53
|
const props = defineProps(inputPropTypes);
|
|
56
54
|
const slots = useSlots();
|
|
57
55
|
|
|
58
|
-
const { inputClasses, onInput } = useInput(props,
|
|
56
|
+
const { inputClasses, onInput } = useInput(props, emit, slots);
|
|
59
57
|
</script>
|
|
60
58
|
|
|
61
59
|
<style scoped>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toRefs, computed, ComputedRef
|
|
1
|
+
import { toRefs, computed, ComputedRef } from 'vue';
|
|
2
2
|
import { useVModel } from '@vueuse/core';
|
|
3
3
|
|
|
4
4
|
import classNames from 'classnames';
|
|
@@ -9,6 +9,7 @@ import type { InputPropTypes, InputEmitTypes } from './input';
|
|
|
9
9
|
interface InputClasses {
|
|
10
10
|
baseClasses: string;
|
|
11
11
|
labelClasses: string;
|
|
12
|
+
inputTextBaseClasses: string;
|
|
12
13
|
inputTextClasses: string;
|
|
13
14
|
iconSlotClasses: string;
|
|
14
15
|
prefixSlotClasses: string;
|
|
@@ -18,10 +19,11 @@ interface InputClasses {
|
|
|
18
19
|
|
|
19
20
|
export const useInput = (
|
|
20
21
|
props: InputPropTypes,
|
|
21
|
-
slots: Record<string, unknown>,
|
|
22
22
|
emit: SetupContext<InputEmitTypes>['emit'],
|
|
23
|
+
slots: Record<string, unknown>,
|
|
23
24
|
) => {
|
|
24
|
-
const {
|
|
25
|
+
const { active, error, disabled, offsetSize } = toRefs(props);
|
|
26
|
+
|
|
25
27
|
const modelValue = useVModel(props, 'modelValue', emit);
|
|
26
28
|
|
|
27
29
|
const inputClasses: ComputedRef<InputClasses> = computed(() => {
|
|
@@ -31,53 +33,60 @@ export const useInput = (
|
|
|
31
33
|
'spr-text-color-on-fill-disabled': disabled.value,
|
|
32
34
|
});
|
|
33
35
|
|
|
34
|
-
const
|
|
35
|
-
'spr-
|
|
36
|
-
'spr-text-color-strong spr-font-size-200 [font-weight:inherit]',
|
|
37
|
-
'spr-border spr-border-solid',
|
|
38
|
-
'placeholder:spr-text-mushroom-300',
|
|
36
|
+
const inputTextBaseClasses = classNames(
|
|
37
|
+
'spr-relative spr-flex spr-items-center spr-rounded-border-radius-md spr-border spr-border-solid',
|
|
39
38
|
{
|
|
40
39
|
'spr-border-mushroom-200 focus:spr-border-kangkong-700': !error.value && !disabled.value && !active.value,
|
|
41
40
|
'spr-border-kangkong-700 spr-border-[1.5px] spr-border-solid': active.value,
|
|
42
41
|
'spr-border-tomato-600 focus:spr-border-tomato-600': error.value,
|
|
43
|
-
'spr-background-color-disabled spr-
|
|
42
|
+
'spr-background-color-disabled spr-cursor-not-allowed spr-text-color-on-fill-disabled spr-border-white-100 focus:spr-border-white-100':
|
|
44
43
|
disabled.value,
|
|
45
|
-
'spr-pr-[5%]': slots.icon,
|
|
46
|
-
'spr-pl-size-spacing-lg': slots.prefix,
|
|
47
|
-
'!spr-pl-size-spacing-3xl': props.type === 'url',
|
|
48
|
-
'!spr-pl-[57px]': props.type === 'contact-number',
|
|
49
|
-
'spr-pr-[93%] sm:spr-pr-[85%]': offsetSize.value === 'xs' && slots.trailing,
|
|
50
|
-
'spr-pr-[90%] sm:spr-pr-[80%]': offsetSize.value === 'sm' && slots.trailing,
|
|
51
|
-
'spr-pr-[50%]': offsetSize.value === 'md' && slots.trailing,
|
|
52
44
|
},
|
|
53
45
|
);
|
|
54
46
|
|
|
55
|
-
const
|
|
56
|
-
'spr-
|
|
47
|
+
const inputTextClasses = classNames(
|
|
48
|
+
'spr-block spr-h-8 spr-py-size-spacing-4xs spr-outline-none spr-ring-0 spr-border-none spr-rounded-border-radius-md spr-font-size-200 spr-text-color-strong',
|
|
49
|
+
'spr-text-color-strong spr-font-size-200 [font-weight:inherit]',
|
|
50
|
+
'placeholder:spr-text-mushroom-300',
|
|
57
51
|
{
|
|
58
|
-
'
|
|
52
|
+
'spr-cursor-not-allowed': disabled.value,
|
|
53
|
+
|
|
54
|
+
// Prefix, Suffix, Trailing
|
|
55
|
+
'spr-px-3': !slots.prefix && !slots.icon && !slots.trailing,
|
|
56
|
+
'spr-pr-3': slots.prefix && !slots.icon && !slots.trailing,
|
|
57
|
+
'spr-pl-3': !slots.prefix && (slots.icon || slots.trailing),
|
|
58
|
+
|
|
59
|
+
// Trailing Width Adjustments
|
|
60
|
+
'spr-w-full': !slots.trailing,
|
|
61
|
+
'spr-w-[50px]': slots.trailing && offsetSize.value === 'xs',
|
|
62
|
+
'spr-w-[40%]': slots.trailing && offsetSize.value === 'sm',
|
|
63
|
+
'spr-w-[100%]': slots.trailing && offsetSize.value === 'md',
|
|
59
64
|
},
|
|
60
65
|
);
|
|
61
66
|
|
|
62
|
-
const
|
|
63
|
-
'spr-
|
|
67
|
+
const iconSlotClasses = classNames(
|
|
68
|
+
'spr-flex spr-items-center spr-justify-center spr-h-8 spr-px-2 [&>svg]:spr-min-h-4 [&>svg]:spr-min-w-4',
|
|
64
69
|
{
|
|
65
|
-
'
|
|
66
|
-
'spr-
|
|
67
|
-
'spr-top-4 spr-z-10': props.type === 'contact-number',
|
|
70
|
+
'spr-text-mushroom-300': !error.value,
|
|
71
|
+
'spr-text-tomato-600': error.value,
|
|
68
72
|
},
|
|
69
73
|
);
|
|
70
74
|
|
|
71
|
-
const
|
|
72
|
-
'spr-
|
|
75
|
+
const prefixSlotClasses = classNames(
|
|
76
|
+
'spr-flex spr-items-center spr-justify-center spr-h-8 spr-px-2 [&>svg]:spr-min-h-4 [&>svg]:spr-min-w-4',
|
|
73
77
|
{
|
|
74
|
-
'
|
|
75
|
-
'spr-
|
|
76
|
-
'spr-
|
|
77
|
-
'spr-
|
|
78
|
+
'spr-text-mushroom-300': !error.value,
|
|
79
|
+
'spr-text-tomato-600': error.value,
|
|
80
|
+
'spr-font-size-200': props.type === 'url',
|
|
81
|
+
'spr-top-4 spr-z-10': props.type === 'contact-number',
|
|
78
82
|
},
|
|
79
83
|
);
|
|
80
84
|
|
|
85
|
+
const trailingSlotClasses = classNames('spr-flex spr-items-center spr-h-8 spr-w-full spr-px-2', {
|
|
86
|
+
'spr-text-mushroom-300': !error.value,
|
|
87
|
+
'spr-text-tomato-600': error.value,
|
|
88
|
+
});
|
|
89
|
+
|
|
81
90
|
const helperClasses = classNames({
|
|
82
91
|
'spr-text-color-danger-base': error.value,
|
|
83
92
|
'spr-text-color-supporting': !error.value,
|
|
@@ -86,6 +95,7 @@ export const useInput = (
|
|
|
86
95
|
return {
|
|
87
96
|
baseClasses,
|
|
88
97
|
labelClasses,
|
|
98
|
+
inputTextBaseClasses,
|
|
89
99
|
inputTextClasses,
|
|
90
100
|
iconSlotClasses,
|
|
91
101
|
prefixSlotClasses,
|
|
@@ -94,14 +104,8 @@ export const useInput = (
|
|
|
94
104
|
};
|
|
95
105
|
});
|
|
96
106
|
|
|
97
|
-
watch(preValue, () => {
|
|
98
|
-
modelValue.value = preValue.value;
|
|
99
|
-
});
|
|
100
|
-
|
|
101
107
|
const onInput = (event: Event) => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
modelValue.value = target.value;
|
|
108
|
+
modelValue.value = (event.target as HTMLInputElement).value;
|
|
105
109
|
};
|
|
106
110
|
|
|
107
111
|
return {
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script lang="ts" setup>
|
|
21
|
-
import {
|
|
21
|
+
import { useSlots } from 'vue';
|
|
22
22
|
|
|
23
23
|
import { radioPropTypes, radioEmitTypes } from './radio';
|
|
24
24
|
import { useRadioButton } from './use-radio';
|
|
25
25
|
|
|
26
26
|
const props = defineProps(radioPropTypes);
|
|
27
27
|
const emit = defineEmits(radioEmitTypes);
|
|
28
|
+
const slots = useSlots();
|
|
28
29
|
|
|
29
|
-
const proxyValue =
|
|
30
|
-
const { radioRef, radioClasses } = useRadioButton(props);
|
|
30
|
+
const { proxyValue, radioRef, radioClasses } = useRadioButton(props, emit, slots);
|
|
31
31
|
</script>
|
|
32
32
|
|
|
33
33
|
<style scoped>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ref, toRefs, computed, ComputedRef } from 'vue';
|
|
2
|
-
import { useElementHover } from '@vueuse/core';
|
|
2
|
+
import { useVModel, useElementHover } from '@vueuse/core';
|
|
3
3
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type { SetupContext } from 'vue';
|
|
7
|
+
import type { RadioPropTypes, RadioEmitTypes } from './radio';
|
|
7
8
|
|
|
8
9
|
interface RadioClasses {
|
|
9
10
|
baseClasses: string;
|
|
@@ -11,7 +12,11 @@ interface RadioClasses {
|
|
|
11
12
|
labelClasses: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export const useRadioButton = (
|
|
15
|
+
export const useRadioButton = (
|
|
16
|
+
props: RadioPropTypes,
|
|
17
|
+
emit: SetupContext<RadioEmitTypes>['emit'],
|
|
18
|
+
slots: Record<string, unknown>,
|
|
19
|
+
) => {
|
|
15
20
|
const { modelValue, disabled } = toRefs(props);
|
|
16
21
|
|
|
17
22
|
const radioRef = ref<HTMLInputElement | null>(null);
|
|
@@ -23,9 +28,10 @@ export const useRadioButton = (props: RadioPropTypes) => {
|
|
|
23
28
|
});
|
|
24
29
|
|
|
25
30
|
const baseIndicatorClasses = classNames(
|
|
26
|
-
'spr-inline-block spr-w-4 spr-h-4 spr-rounded-full spr-border-2 spr-border-solid spr-
|
|
31
|
+
'spr-inline-block spr-w-4 spr-h-4 spr-rounded-full spr-border-2 spr-border-solid spr-shrink-0',
|
|
27
32
|
'spr-transition spr-duration-150 spr-ease-in-out',
|
|
28
33
|
{
|
|
34
|
+
'spr-mr-2': slots.default,
|
|
29
35
|
'group-active:spr-scale-95': !disabled.value,
|
|
30
36
|
},
|
|
31
37
|
|
|
@@ -81,8 +87,11 @@ export const useRadioButton = (props: RadioPropTypes) => {
|
|
|
81
87
|
};
|
|
82
88
|
});
|
|
83
89
|
|
|
90
|
+
const proxyValue = useVModel(props, 'modelValue', emit);
|
|
91
|
+
|
|
84
92
|
return {
|
|
85
93
|
radioRef,
|
|
86
94
|
radioClasses,
|
|
95
|
+
proxyValue,
|
|
87
96
|
};
|
|
88
97
|
};
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<div :class="getTableClasses.getTableHeight">
|
|
22
22
|
<table aria-describedby="describe" class="spr-w-full spr-table-fixed" cellspacing="0" cellpadding="0">
|
|
23
23
|
<thead>
|
|
24
|
-
<tr v-if="props.removeHeaderOnEmpty && sortedData.length > 0">
|
|
24
|
+
<tr v-if="!props.removeHeaderOnEmpty && sortedData.length > 0">
|
|
25
25
|
<th v-for="(header, keyHeader) in headers" :key="keyHeader" :class="[getTableClasses.headerClasses]">
|
|
26
26
|
<div :class="getTableClasses.headerNameClass">
|
|
27
27
|
<span :class="[{ 'spr-cursor-pointer': header.sort }]" @click="header.sort && sortData(header.field)">
|