@teammodlr/ui-kit 3.0.0-beta.7 → 3.0.0
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/lib/components/checkbox/Checkbox.vue.d.ts +4 -4
- package/lib/components/clearbutton/ClearButton.vue.d.ts +7 -0
- package/lib/components/clearbutton/style/ClearButton.css.d.ts +2 -0
- package/lib/components/clearbutton/style/index.d.ts +1 -0
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +0 -1
- package/lib/components/colorpicker/style/ColorPicker.css.d.ts +1 -0
- package/lib/components/dialog/style/Dialog.css.d.ts +2 -0
- package/lib/components/drawer/Drawer.vue.d.ts +142 -0
- package/lib/components/drawer/style/Drawer.css.d.ts +33 -0
- package/lib/components/drawer/style/index.d.ts +1 -0
- package/lib/components/hovercard/HoverCard.vue.d.ts +122 -0
- package/lib/components/hovercard/style/HoverCard.css.d.ts +3 -0
- package/lib/components/hovercard/style/index.d.ts +1 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/input/Input.vue.d.ts +20 -5
- package/lib/components/input/style/Input.css.d.ts +4 -0
- package/lib/components/paneldialog/PanelDialog.vue.d.ts +167 -0
- package/lib/components/paneldialog/style/PanelDialog.css.d.ts +8 -0
- package/lib/components/paneldialog/style/index.d.ts +1 -0
- package/lib/components/popover/Popover.vue.d.ts +113 -0
- package/lib/components/popover/style/Popover.css.d.ts +4 -0
- package/lib/components/popover/style/index.d.ts +1 -0
- package/lib/components/radio/Radio.vue.d.ts +5 -5
- package/lib/components/radiobutton/RadioButton.vue.d.ts +4 -4
- package/lib/components/select/Select.vue.d.ts +72 -91
- package/lib/components/select/style/Select.css.d.ts +9 -1
- package/lib/components/switch/Switch.vue.d.ts +4 -4
- package/lib/components/textarea/Textarea.vue.d.ts +16 -5
- package/lib/components/textarea/style/Textarea.css.d.ts +2 -0
- package/lib/composables/useInput.d.ts +9 -2
- package/lib/index.cjs.js +3 -3
- package/lib/index.es.js +11870 -9642
- package/lib/style.css +1 -1
- package/lib/tsconfig.app.tsbuildinfo +1 -0
- package/package.json +7 -4
- package/src/components/cardcontextmenu/style/Dropdown.css.ts +7 -0
- package/src/components/clearbutton/ClearButton.vue +39 -0
- package/src/components/clearbutton/style/ClearButton.css.ts +37 -0
- package/src/components/clearbutton/style/index.ts +1 -0
- package/src/components/colorpicker/ColorPicker.vue +8 -11
- package/src/components/colorpicker/examples/basic.vue +8 -17
- package/src/components/colorpicker/style/ColorPicker.css.ts +6 -1
- package/src/components/dialog/Dialog.vue +2 -5
- package/src/components/dialog/style/Dialog.css.ts +30 -0
- package/src/components/drawer/Drawer.vue +276 -0
- package/src/components/drawer/examples/basic.vue +15 -0
- package/src/components/drawer/examples/custom-title.vue +21 -0
- package/src/components/drawer/examples/index.stories.ts +24 -0
- package/src/components/drawer/examples/index.ts +7 -0
- package/src/components/drawer/examples/no-mask.vue +15 -0
- package/src/components/drawer/examples/no-outside-close.vue +15 -0
- package/src/components/drawer/examples/placements.vue +28 -0
- package/src/components/drawer/examples/with-footer.vue +21 -0
- package/src/components/drawer/examples/with-trigger.vue +13 -0
- package/src/components/drawer/style/Drawer.css.ts +208 -0
- package/src/components/drawer/style/index.ts +1 -0
- package/src/components/dropdown/Dropdown.vue +1 -1
- package/src/components/hovercard/HoverCard.vue +163 -0
- package/src/components/hovercard/style/HoverCard.css.ts +175 -0
- package/src/components/hovercard/style/index.ts +1 -0
- package/src/components/index.ts +4 -0
- package/src/components/input/Input.vue +52 -4
- package/src/components/input/examples/clearable.vue +18 -0
- package/src/components/input/examples/index.stories.ts +3 -1
- package/src/components/input/examples/index.ts +1 -0
- package/src/components/input/style/Input.css.ts +19 -0
- package/src/components/messageprovider/MessageProvider.vue +33 -7
- package/src/components/paneldialog/PanelDialog.vue +500 -0
- package/src/components/paneldialog/examples/basic.vue +36 -0
- package/src/components/paneldialog/examples/index.stories.ts +22 -0
- package/src/components/paneldialog/examples/index.ts +2 -0
- package/src/components/paneldialog/examples/modal.vue +31 -0
- package/src/components/paneldialog/style/PanelDialog.css.ts +90 -0
- package/src/components/paneldialog/style/index.ts +1 -0
- package/src/components/popover/Popover.vue +155 -0
- package/src/components/popover/examples/arrow.vue +47 -0
- package/src/components/popover/examples/basic.vue +15 -0
- package/src/components/popover/examples/index.stories.ts +19 -0
- package/src/components/popover/examples/index.ts +4 -0
- package/src/components/popover/examples/placement.vue +59 -0
- package/src/components/popover/examples/variant.vue +30 -0
- package/src/components/popover/style/Popover.css.ts +203 -0
- package/src/components/popover/style/index.ts +1 -0
- package/src/components/select/Select.vue +122 -42
- package/src/components/select/examples/clearable.vue +18 -0
- package/src/components/select/examples/fill.vue +52 -0
- package/src/components/select/examples/index.stories.ts +3 -1
- package/src/components/select/examples/index.ts +2 -0
- package/src/components/select/style/Select.css.ts +140 -24
- package/src/components/tab/Tab.vue +1 -1
- package/src/components/tab/style/Tab.css.ts +6 -0
- package/src/components/textarea/Textarea.vue +40 -4
- package/src/components/textarea/examples/clearable.vue +16 -0
- package/src/components/textarea/examples/index.stories.ts +2 -1
- package/src/components/textarea/examples/index.ts +1 -0
- package/src/components/textarea/style/Textarea.css.ts +10 -0
- package/src/composables/useInput.ts +10 -2
|
@@ -17,12 +17,14 @@
|
|
|
17
17
|
:value="textareaValue"
|
|
18
18
|
:readonly="readonly"
|
|
19
19
|
v-on="inputListeners"
|
|
20
|
+
@input="onNativeInput"
|
|
20
21
|
:class="inputComputedClasses"
|
|
21
22
|
v-bind="$attrs"
|
|
22
23
|
:disabled="disabled || loading"
|
|
23
24
|
:aria-disabled="disabled ? 'true' : 'false'"
|
|
24
25
|
:aria-labelledby="`${id}-label`"
|
|
25
26
|
/>
|
|
27
|
+
<MClearButton v-if="showClear" :class="style.clear" @clear="onClear" />
|
|
26
28
|
</div>
|
|
27
29
|
<div v-if="inputError" :class="style.errorMessage">
|
|
28
30
|
{{ inputError }}
|
|
@@ -37,14 +39,17 @@ import {
|
|
|
37
39
|
defineComponent,
|
|
38
40
|
ref,
|
|
39
41
|
computed,
|
|
40
|
-
toRef
|
|
42
|
+
toRef,
|
|
43
|
+
watch
|
|
41
44
|
} from "vue";
|
|
42
45
|
import { useInput } from "../../composables/useInput";
|
|
43
46
|
import { useInteractive } from "../../composables/useInteractive";
|
|
47
|
+
import MClearButton from '../clearbutton/ClearButton.vue';
|
|
44
48
|
import * as style from './style';
|
|
45
49
|
|
|
46
50
|
export default defineComponent({
|
|
47
51
|
name: 'MTextArea',
|
|
52
|
+
components: { MClearButton },
|
|
48
53
|
props: {
|
|
49
54
|
...useInput.props(),
|
|
50
55
|
...useInteractive.props(),
|
|
@@ -80,15 +85,19 @@ export default defineComponent({
|
|
|
80
85
|
default: false
|
|
81
86
|
},
|
|
82
87
|
error: {
|
|
83
|
-
type: String
|
|
88
|
+
type: String as PropType<string | null>,
|
|
84
89
|
default: ''
|
|
85
90
|
},
|
|
86
91
|
height: {
|
|
87
92
|
type: Number,
|
|
88
93
|
default: 64
|
|
89
94
|
},
|
|
95
|
+
clearable: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
90
99
|
},
|
|
91
|
-
emits: useInput.emits(),
|
|
100
|
+
emits: [...useInput.emits(), 'clear'],
|
|
92
101
|
setup(props, { emit, expose }) {
|
|
93
102
|
const element = ref<HTMLTextAreaElement | null>(null);
|
|
94
103
|
const { focus, blur } = useInteractive(element);
|
|
@@ -136,6 +145,7 @@ export default defineComponent({
|
|
|
136
145
|
[style.block]: props.block,
|
|
137
146
|
[style.disabled]: disabled.value || loading.value,
|
|
138
147
|
[style.error]: inputError.value,
|
|
148
|
+
[style.hasClear]: props.clearable,
|
|
139
149
|
}
|
|
140
150
|
];
|
|
141
151
|
});
|
|
@@ -144,12 +154,36 @@ export default defineComponent({
|
|
|
144
154
|
return formError.value || props.error;
|
|
145
155
|
});
|
|
146
156
|
|
|
157
|
+
// Tracks typed text so clearable works without v-model
|
|
158
|
+
const internalValue = ref('');
|
|
159
|
+
watch(() => props.modelValue, value => {
|
|
160
|
+
internalValue.value = value == null ? '' : String(value);
|
|
161
|
+
}, { immediate: true });
|
|
162
|
+
|
|
147
163
|
const textareaValue = computed(() => {
|
|
148
|
-
|
|
164
|
+
if (props.modelValue !== undefined) {
|
|
165
|
+
return props.modelValue == null ? '' : String(props.modelValue);
|
|
166
|
+
}
|
|
167
|
+
return internalValue.value;
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const onNativeInput = (event: Event) => {
|
|
171
|
+
internalValue.value = (event.target as HTMLTextAreaElement).value;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const showClear = computed(() => {
|
|
175
|
+
return props.clearable
|
|
176
|
+
&& !disabled.value
|
|
177
|
+
&& !loading.value
|
|
178
|
+
&& !readonly.value
|
|
179
|
+
&& textareaValue.value !== '';
|
|
149
180
|
});
|
|
150
181
|
|
|
151
182
|
const onClear = () => {
|
|
183
|
+
internalValue.value = '';
|
|
152
184
|
emit('update:modelValue', '');
|
|
185
|
+
emit('clear');
|
|
186
|
+
focus();
|
|
153
187
|
};
|
|
154
188
|
|
|
155
189
|
expose({
|
|
@@ -171,6 +205,8 @@ export default defineComponent({
|
|
|
171
205
|
textareaValue,
|
|
172
206
|
inputError,
|
|
173
207
|
style,
|
|
208
|
+
showClear,
|
|
209
|
+
onNativeInput,
|
|
174
210
|
|
|
175
211
|
onClear,
|
|
176
212
|
validate,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MTextArea
|
|
3
|
+
v-model="value"
|
|
4
|
+
label="Some Text"
|
|
5
|
+
name="text"
|
|
6
|
+
placeholder="Some text placeholder"
|
|
7
|
+
:height="128"
|
|
8
|
+
clearable
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { ref } from 'vue';
|
|
14
|
+
|
|
15
|
+
const value = ref('Clear me');
|
|
16
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import MTextarea from '../Textarea.vue';
|
|
2
|
-
import { MTextareaBasic } from './index';
|
|
2
|
+
import { MTextareaBasic, MTextareaClearable } from './index';
|
|
3
3
|
|
|
4
4
|
import { createStory, sizeArgType } from '../../../__storybook__';
|
|
5
5
|
|
|
@@ -12,3 +12,4 @@ export default {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export const Basic = createStory(MTextareaBasic);
|
|
15
|
+
export const Clearable = createStory(MTextareaClearable);
|
|
@@ -144,6 +144,16 @@ export const disabled = style({
|
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
+
export const hasClear = style({
|
|
148
|
+
paddingRight: '1.75rem'
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
export const clear = style({
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
top: themeVars.space[1],
|
|
154
|
+
right: themeVars.space[1]
|
|
155
|
+
});
|
|
156
|
+
|
|
147
157
|
export const label = style({
|
|
148
158
|
fontWeight: '500',
|
|
149
159
|
display: 'inline-block',
|
|
@@ -10,6 +10,14 @@ export interface FormInput {
|
|
|
10
10
|
setError: (value: string) => void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
export interface InputEmitsMap {
|
|
14
|
+
'update:modelValue': (...args: any[]) => any;
|
|
15
|
+
blur: (...args: any[]) => any;
|
|
16
|
+
focus: (...args: any[]) => any;
|
|
17
|
+
input: (...args: any[]) => any;
|
|
18
|
+
change: (...args: any[]) => any;
|
|
19
|
+
}
|
|
20
|
+
|
|
13
21
|
export const useInput = (
|
|
14
22
|
props: any,
|
|
15
23
|
{
|
|
@@ -138,12 +146,12 @@ useInput.emits = (withListeners = true): string[] => {
|
|
|
138
146
|
useInput.props = () =>
|
|
139
147
|
({
|
|
140
148
|
modelValue: [String, Number, Boolean, Object, Array] as PropType<
|
|
141
|
-
string | number | boolean | object | any[] |
|
|
149
|
+
string | number | boolean | object | any[] | null | undefined
|
|
142
150
|
>,
|
|
143
151
|
name: String,
|
|
144
152
|
readonly: Boolean,
|
|
145
153
|
required: Boolean,
|
|
146
|
-
error: String
|
|
154
|
+
error: String as PropType<string | null | undefined>,
|
|
147
155
|
rules: {
|
|
148
156
|
type: Array,
|
|
149
157
|
default: () => []
|