@v1nt1248/3nclient-lib 0.0.41 → 0.1.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/README.md +4 -4
- package/dist/components/index.d.ts +22 -38
- package/dist/components/ui3n-badge-simple.vue.d.ts +3 -3
- package/dist/components/ui3n-badge.vue.d.ts +2 -2
- package/dist/components/ui3n-breadcrumb.vue.d.ts +7 -7
- package/dist/components/ui3n-breadcrumbs.vue.d.ts +3 -3
- package/dist/components/ui3n-button.vue.d.ts +29 -4
- package/dist/components/ui3n-checkbox.vue.d.ts +3 -3
- package/dist/components/ui3n-chip.vue.d.ts +3 -3
- package/dist/components/ui3n-dialog.vue.d.ts +6 -5
- package/dist/components/ui3n-drop-files.vue.d.ts +23 -3
- package/dist/components/ui3n-emoji.vue.d.ts +3 -3
- package/dist/components/ui3n-icon.vue.d.ts +29 -3
- package/dist/components/ui3n-input.vue.d.ts +9 -9
- package/dist/components/ui3n-list.vue.d.ts +4 -4
- package/dist/components/ui3n-menu.vue.d.ts +3 -3
- package/dist/components/ui3n-notification.vue.d.ts +32 -2
- package/dist/components/ui3n-switch.vue.d.ts +55 -0
- package/dist/components/ui3n-table-sort-icon.vue.d.ts +1 -1
- package/dist/components/ui3n-table.vue.d.ts +4 -3
- package/dist/components/ui3n-tabs.vue.d.ts +3 -3
- package/dist/components/ui3n-text.vue.d.ts +29 -3
- package/dist/components/ui3n-virtual-scroll.vue.d.ts +12 -9
- package/dist/constants/types.d.ts +2 -4
- package/dist/directives/index.d.ts +3 -2
- package/dist/directives/ui3n-click-outside.d.ts +2 -1
- package/dist/directives/ui3n-html.d.ts +1 -0
- package/dist/index.d.ts +27 -29
- package/dist/plugins/dialogs.d.ts +3 -3
- package/dist/plugins/i18n.d.ts +2 -2
- package/dist/plugins/icons.d.ts +1 -0
- package/dist/plugins/index.d.ts +5 -8
- package/dist/plugins/notifications.d.ts +2 -2
- package/dist/plugins/store-dialogs.d.ts +2 -1
- package/dist/plugins/store-notifications.d.ts +2 -1
- package/dist/plugins/store-vue-bus.d.ts +2 -1
- package/dist/plugins/vue-bus.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -2
- package/dist/tools/ui.helpers.d.ts +1 -0
- package/dist/ui-3n-lib.js +6953 -6615
- package/package.json +57 -58
- package/src/components/index.ts +47 -41
- package/src/components/ui3n-badge-simple.vue +35 -38
- package/src/components/ui3n-badge.vue +25 -25
- package/src/components/ui3n-breadcrumb.vue +44 -44
- package/src/components/ui3n-breadcrumbs.vue +19 -19
- package/src/components/ui3n-button.vue +240 -150
- package/src/components/ui3n-checkbox.vue +199 -158
- package/src/components/ui3n-chip.vue +96 -98
- package/src/components/ui3n-dialog.vue +225 -235
- package/src/components/ui3n-drop-files.vue +146 -154
- package/src/components/ui3n-emoji.vue +62 -64
- package/src/components/ui3n-icon.vue +32 -13
- package/src/components/ui3n-input.vue +239 -221
- package/src/components/ui3n-list.vue +92 -111
- package/src/components/ui3n-menu.vue +101 -100
- package/src/components/ui3n-notification.vue +182 -113
- package/src/components/ui3n-switch.vue +146 -0
- package/src/components/ui3n-table-sort-icon.vue +1 -2
- package/src/components/ui3n-table.vue +229 -223
- package/src/components/ui3n-tabs.vue +141 -148
- package/src/components/ui3n-text.vue +235 -146
- package/src/components/ui3n-virtual-scroll.vue +68 -68
- package/dist/stories/Ui3nBadge.stories.d.ts +0 -124
- package/dist/stories/Ui3nBreadcrumbs.stories.d.ts +0 -252
- package/dist/stories/Ui3nButton.stories.d.ts +0 -152
- package/dist/stories/Ui3nCheckbox.stories.d.ts +0 -186
- package/dist/stories/Ui3nChip.stories.d.ts +0 -562
- package/dist/stories/Ui3nDialog.stories.d.ts +0 -41
- package/dist/stories/Ui3nDropFiles.stories.d.ts +0 -73
- package/dist/stories/Ui3nEmoji.stories.d.ts +0 -39
- package/dist/stories/Ui3nIcon.stories.d.ts +0 -80
- package/dist/stories/Ui3nInput.stories.d.ts +0 -456
- package/dist/stories/Ui3nList.stories.d.ts +0 -54
- package/dist/stories/Ui3nTabs.stories.d.ts +0 -177
- package/dist/stories/data/data-to-list.d.ts +0 -8
- package/dist/stories/data/icons.d.ts +0 -1
|
@@ -1,146 +1,158 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { computed, onMounted, watch, onBeforeMount, ref, useSlots } from 'vue';
|
|
3
|
+
|
|
4
|
+
type Ui3nCheckboxValue = boolean | string | number;
|
|
5
|
+
|
|
6
|
+
export interface Ui3nCheckboxProps {
|
|
7
|
+
modelValue: Ui3nCheckboxValue;
|
|
8
|
+
checkedValue?: Ui3nCheckboxValue;
|
|
9
|
+
uncheckedValue?: Ui3nCheckboxValue;
|
|
10
|
+
size?: number | string;
|
|
11
|
+
color?: string;
|
|
12
|
+
indeterminate?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Ui3nCheckboxEmits {
|
|
17
|
+
(ev: 'change', value: Ui3nCheckboxValue): void;
|
|
18
|
+
(ev: 'update:modelValue', value: Ui3nCheckboxValue): void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Ui3nCheckboxSlots {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
default: () => any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const props = withDefaults(
|
|
27
|
+
defineProps<Ui3nCheckboxProps>(),
|
|
28
|
+
{
|
|
29
|
+
modelValue: false,
|
|
30
|
+
checkedValue: true,
|
|
31
|
+
uncheckedValue: false,
|
|
32
|
+
size: '16',
|
|
33
|
+
color: 'var(--color-icon-control-accent-default)',
|
|
34
|
+
indeterminate: false,
|
|
35
|
+
disabled: false,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
const emits = defineEmits<Ui3nCheckboxEmits>();
|
|
39
|
+
defineSlots<Ui3nCheckboxSlots>();
|
|
40
|
+
|
|
41
|
+
const slots = useSlots();
|
|
42
|
+
const checkboxEl = ref<HTMLDivElement | null>(null);
|
|
43
|
+
const val = ref<Ui3nCheckboxValue>(props.uncheckedValue || false);
|
|
44
|
+
const uncertain = ref(false);
|
|
45
|
+
|
|
46
|
+
onBeforeMount(() => {
|
|
47
|
+
const checkedValueType = typeof props.checkedValue;
|
|
48
|
+
const uncheckedValueType = typeof props.uncheckedValue;
|
|
49
|
+
const valueType = typeof props.modelValue;
|
|
50
|
+
if (
|
|
51
|
+
checkedValueType !== uncheckedValueType
|
|
52
|
+
|| checkedValueType !== valueType
|
|
53
|
+
|| uncheckedValueType !== valueType
|
|
54
|
+
) {
|
|
55
|
+
throw Error('[Ui3nCheckbox] types of "value", "checkedValue" and "uncheckedValue" are different');
|
|
15
56
|
}
|
|
57
|
+
});
|
|
16
58
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(
|
|
59
|
+
onMounted(() => {
|
|
60
|
+
if (checkboxEl.value) {
|
|
61
|
+
checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${props.size}px`);
|
|
20
62
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
uncheckedValue: false,
|
|
39
|
-
size: '16',
|
|
40
|
-
color: '#0090ec',
|
|
41
|
-
indeterminate: false,
|
|
42
|
-
disabled: false,
|
|
43
|
-
},
|
|
44
|
-
)
|
|
45
|
-
const emits = defineEmits<Ui3nCheckboxEmits>()
|
|
46
|
-
defineSlots<Ui3nCheckboxSlots>()
|
|
47
|
-
|
|
48
|
-
const slots = useSlots()
|
|
49
|
-
|
|
50
|
-
const checkboxEl = ref<HTMLDivElement|null>(null)
|
|
51
|
-
const val = ref<Ui3nCheckboxValue>(props.uncheckedValue || false)
|
|
52
|
-
const uncertain = ref(false)
|
|
53
|
-
|
|
54
|
-
onBeforeMount(() => {
|
|
55
|
-
const checkedValueType = typeof props.checkedValue
|
|
56
|
-
const uncheckedValueType = typeof props.uncheckedValue
|
|
57
|
-
const valueType = typeof props.modelValue
|
|
58
|
-
if (
|
|
59
|
-
checkedValueType !== uncheckedValueType
|
|
60
|
-
|| checkedValueType !== valueType
|
|
61
|
-
|| uncheckedValueType !== valueType
|
|
62
|
-
) {
|
|
63
|
-
throw Error('[Ui3nCheckbox] types of "value", "checkedValue" and "unchecktdValue" are different')
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
onMounted(() => {
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
watch(
|
|
66
|
+
() => props.modelValue,
|
|
67
|
+
newValue => val.value = newValue,
|
|
68
|
+
{ immediate: true },
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
watch(
|
|
72
|
+
() => props.indeterminate,
|
|
73
|
+
newValue => uncertain.value = newValue,
|
|
74
|
+
{ immediate: true },
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
watch(
|
|
78
|
+
() => props.size,
|
|
79
|
+
newValue => {
|
|
68
80
|
if (checkboxEl.value) {
|
|
69
|
-
checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
watch(
|
|
74
|
-
() => props.modelValue,
|
|
75
|
-
newValue => val.value = newValue,
|
|
76
|
-
{ immediate: true },
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
watch(
|
|
80
|
-
() => props.indeterminate,
|
|
81
|
-
newValue => uncertain.value = newValue,
|
|
82
|
-
{ immediate: true},
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
watch(
|
|
86
|
-
() => props.size,
|
|
87
|
-
newValue => {
|
|
88
|
-
if (checkboxEl.value) {
|
|
89
|
-
checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${newValue}px`)
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
const checkBoxValue = computed(() => {
|
|
95
|
-
if (uncertain.value) {
|
|
96
|
-
return 'indeterminate'
|
|
81
|
+
checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${newValue}px`);
|
|
97
82
|
}
|
|
83
|
+
},
|
|
84
|
+
);
|
|
98
85
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
86
|
+
const checkBoxValue = computed(() => {
|
|
87
|
+
if (uncertain.value) {
|
|
88
|
+
return 'indeterminate';
|
|
89
|
+
}
|
|
103
90
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
91
|
+
return val.value === props.checkedValue
|
|
92
|
+
? 'checked'
|
|
93
|
+
: 'unchecked';
|
|
94
|
+
});
|
|
108
95
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
96
|
+
const change = () => {
|
|
97
|
+
val.value = checkBoxValue.value !== 'unchecked'
|
|
98
|
+
? props.uncheckedValue
|
|
99
|
+
: props.checkedValue;
|
|
112
100
|
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
if (uncertain.value) {
|
|
102
|
+
uncertain.value = false;
|
|
115
103
|
}
|
|
104
|
+
|
|
105
|
+
emits('change', val.value);
|
|
106
|
+
emits('update:modelValue', val.value);
|
|
107
|
+
};
|
|
116
108
|
</script>
|
|
117
109
|
|
|
118
110
|
<template>
|
|
119
111
|
<div
|
|
120
112
|
ref="checkboxEl"
|
|
121
|
-
:class="[
|
|
122
|
-
'ui3n-checkbox',
|
|
123
|
-
{
|
|
124
|
-
'ui3n-checkbox--disabled': props.disabled,
|
|
125
|
-
'ui3n-checkbox--with-label': slots.default,
|
|
126
|
-
},
|
|
127
|
-
]"
|
|
113
|
+
:class="[$style.checkbox, disabled && $style.disabled, !slots.default && $style.noLabel]"
|
|
128
114
|
>
|
|
129
115
|
<div
|
|
130
|
-
class="
|
|
116
|
+
:class="[$style.body, checkBoxValue === 'unchecked' ? $style.unfilled : $style.filled]"
|
|
131
117
|
@click="change"
|
|
132
118
|
>
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
:
|
|
136
|
-
:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
119
|
+
<svg
|
|
120
|
+
v-if="checkBoxValue === 'checked'"
|
|
121
|
+
:width="Number(size) - 4"
|
|
122
|
+
:height="Number(size) - 4"
|
|
123
|
+
viewBox="0 0 24 24"
|
|
124
|
+
fill="none"
|
|
125
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
126
|
+
:class="$style.icon"
|
|
127
|
+
>
|
|
128
|
+
<g id="SVGRepo_bgCarrier" stroke-width="0" />
|
|
129
|
+
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" />
|
|
130
|
+
<g id="SVGRepo_iconCarrier">
|
|
131
|
+
<path d="M20.0001 7L9.0001 18L4 13" stroke="#fff" stroke-width="3" stroke-linecap="round"
|
|
132
|
+
stroke-linejoin="round"
|
|
133
|
+
/>
|
|
134
|
+
</g>
|
|
135
|
+
</svg>
|
|
136
|
+
|
|
137
|
+
<svg
|
|
138
|
+
v-if="checkBoxValue === 'indeterminate'"
|
|
139
|
+
:width="Number(size) - 4"
|
|
140
|
+
:height="Number(size) - 4"
|
|
141
|
+
viewBox="0 0 24 24"
|
|
142
|
+
fill="none"
|
|
143
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
144
|
+
:class="$style.icon"
|
|
145
|
+
>
|
|
146
|
+
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
|
147
|
+
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
|
|
148
|
+
<g id="SVGRepo_iconCarrier">
|
|
149
|
+
<path d="M7 12L17 12" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" />
|
|
150
|
+
</g>
|
|
151
|
+
</svg>
|
|
140
152
|
</div>
|
|
141
153
|
|
|
142
154
|
<div
|
|
143
|
-
class="
|
|
155
|
+
:class="$style.label"
|
|
144
156
|
@click="change"
|
|
145
157
|
>
|
|
146
158
|
<slot />
|
|
@@ -148,44 +160,73 @@
|
|
|
148
160
|
</div>
|
|
149
161
|
</template>
|
|
150
162
|
|
|
151
|
-
<style lang="scss"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
163
|
+
<style lang="scss" module>
|
|
164
|
+
@import "../assets/styles/mixins";
|
|
165
|
+
|
|
166
|
+
.checkbox {
|
|
167
|
+
--ui3n-checkbox-size: 16px;
|
|
168
|
+
--ui3n-checkbox-color: var(--color-icon-control-accent-default);
|
|
169
|
+
--ui3n-checkbox-text-size: 12px;
|
|
170
|
+
--ui3n-checkbox-text-color: var(--color-text-control-primary-default);
|
|
171
|
+
--ui3n-checkbox-text-weight: 500;
|
|
172
|
+
|
|
173
|
+
position: relative;
|
|
174
|
+
display: flex;
|
|
175
|
+
justify-content: flex-start;
|
|
176
|
+
align-items: center;
|
|
177
|
+
min-height: var(--spacing-vl);
|
|
178
|
+
gap: var(--spacing-s);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.noLabel {
|
|
182
|
+
gap: 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.body {
|
|
186
|
+
position: relative;
|
|
187
|
+
display: flex;
|
|
188
|
+
width: var(--ui3n-checkbox-size);
|
|
189
|
+
height: var(--ui3n-checkbox-size);
|
|
190
|
+
justify-content: center;
|
|
191
|
+
align-items: center;
|
|
192
|
+
border-radius: calc(var(--ui3n-checkbox-size) / 10);
|
|
193
|
+
border: calc(var(--ui3n-checkbox-size) / 10) solid var(--ui3n-checkbox-color);
|
|
194
|
+
cursor: pointer;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.filled {
|
|
198
|
+
background-color: var(--ui3n-checkbox-color);
|
|
199
|
+
|
|
200
|
+
&:hover {
|
|
201
|
+
border-color: hsl(from var(--ui3n-checkbox-color) h s calc(l - 10));
|
|
202
|
+
background-color: hsl(from var(--ui3n-checkbox-color) h s calc(l - 10));
|
|
203
|
+
@include ripple(hsl(from var(--ui3n-checkbox-color) h s calc(l - 10)));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
185
206
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
207
|
+
.unfilled {
|
|
208
|
+
&:hover {
|
|
209
|
+
border-color: hsl(from var(--ui3n-checkbox-color) h s calc(l - 10));
|
|
210
|
+
background-color: hsl(from transparent h s calc(l - 10));
|
|
211
|
+
@include ripple(hsl(from transparent h s calc(l - 10)));
|
|
190
212
|
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.icon {
|
|
216
|
+
min-height: calc(var(--ui3n-checkbox-size) - 4px);
|
|
217
|
+
min-width: calc(var(--ui3n-checkbox-size) - 4px);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.label {
|
|
221
|
+
font-size: var(--ui3n-checkbox-text-size);
|
|
222
|
+
font-weight: var(--ui3n-checkbox-text-weight);
|
|
223
|
+
color: var(--ui3n-checkbox-text-color);
|
|
224
|
+
user-select: none;
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.disabled {
|
|
229
|
+
opacity: 0.7;
|
|
230
|
+
pointer-events: none;
|
|
231
|
+
}
|
|
191
232
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, useSlots } from 'vue'
|
|
3
|
-
import Ui3nButton from './ui3n-button.vue'
|
|
2
|
+
import { computed, useSlots } from 'vue';
|
|
3
|
+
import Ui3nButton from './ui3n-button.vue';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
6
|
export interface Ui3nChipProps {
|
|
@@ -29,128 +29,126 @@
|
|
|
29
29
|
plain: false,
|
|
30
30
|
round: true,
|
|
31
31
|
closeable: false,
|
|
32
|
-
color: '
|
|
32
|
+
color: 'var(--color-bg-control-secondary-default)',
|
|
33
33
|
textSize: 10,
|
|
34
|
-
textColor: '
|
|
34
|
+
textColor: 'var(--color-text-control-primary-default)',
|
|
35
35
|
},
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const emits = defineEmits<Ui3nChipEmits>();
|
|
39
|
+
defineSlots<Ui3nChipSlots>();
|
|
40
|
+
|
|
41
|
+
const slots = useSlots();
|
|
42
|
+
|
|
43
|
+
const height = computed(() => `${props.height}px`);
|
|
44
|
+
const iconHeight = computed(() => props.height ? Number(props.height) - 2 : Number(props.height));
|
|
45
|
+
const padding = computed(() => `${Math.round(Number(props.height) / 3)}px`);
|
|
46
|
+
const maxWidth = computed(() => `${props.maxWidth}px`);
|
|
47
|
+
const bgColor = computed(() => props.color);
|
|
48
|
+
const textSize = computed(() => `${props.textSize}px`);
|
|
49
|
+
const textColor = computed(() => props.textColor);
|
|
50
|
+
const hasLeftSlot = computed(() => !!slots.left);
|
|
50
51
|
</script>
|
|
51
52
|
|
|
52
53
|
<template>
|
|
53
54
|
<div
|
|
54
55
|
:class="[
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'ui3n-chip--with-icon': hasLeftSlot,
|
|
61
|
-
},
|
|
56
|
+
$style.chip,
|
|
57
|
+
round && $style.round,
|
|
58
|
+
plain && $style.plain,
|
|
59
|
+
closeable && $style.closable,
|
|
60
|
+
hasLeftSlot && $style.withIcon,
|
|
62
61
|
]"
|
|
63
62
|
>
|
|
64
|
-
<div class="
|
|
65
|
-
<slot
|
|
66
|
-
name="left"
|
|
67
|
-
:size="iconHeight"
|
|
68
|
-
:color="props.textColor"
|
|
69
|
-
/>
|
|
63
|
+
<div :class="$style.icon">
|
|
64
|
+
<slot name="left" :size="iconHeight" :color="props.textColor" />
|
|
70
65
|
</div>
|
|
71
|
-
|
|
72
|
-
<div class="
|
|
66
|
+
|
|
67
|
+
<div :class="$style.body">
|
|
73
68
|
<slot />
|
|
74
69
|
</div>
|
|
75
|
-
|
|
70
|
+
|
|
76
71
|
<ui3n-button
|
|
77
|
-
v-if="
|
|
78
|
-
class="
|
|
79
|
-
|
|
72
|
+
v-if="closeable"
|
|
73
|
+
:class="$style.closeBtn"
|
|
74
|
+
type="icon"
|
|
75
|
+
size="small"
|
|
80
76
|
color="transparent"
|
|
81
77
|
icon="close"
|
|
82
|
-
icon-
|
|
83
|
-
icon-color="#212121"
|
|
78
|
+
icon-color="var(--color-icon-control-primary-default)"
|
|
84
79
|
@click="emits('close')"
|
|
85
80
|
/>
|
|
86
81
|
</div>
|
|
87
82
|
</template>
|
|
88
83
|
|
|
89
|
-
<style lang="scss"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
line-height: 1;
|
|
107
|
-
font-weight: 400;
|
|
108
|
-
color: v-bind('textColor');
|
|
109
|
-
overflow: hidden;
|
|
110
|
-
white-space: nowrap;
|
|
111
|
-
text-overflow: ellipsis;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&__close {
|
|
115
|
-
margin-left: var(--half-size, 4px);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&--with-icon {
|
|
119
|
-
.ui3n-chip__icon {
|
|
120
|
-
display: flex;
|
|
121
|
-
margin-right: 5px;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&--round {
|
|
126
|
-
border-radius: calc(v-bind('height') / 2);
|
|
84
|
+
<style lang="scss" module>
|
|
85
|
+
@import "../assets/styles/mixins";
|
|
86
|
+
|
|
87
|
+
.chip {
|
|
88
|
+
position: relative;
|
|
89
|
+
display: flex;
|
|
90
|
+
height: v-bind('height');
|
|
91
|
+
padding: 0 v-bind('padding');
|
|
92
|
+
width: max-content;
|
|
93
|
+
max-width: v-bind('maxWidth');
|
|
94
|
+
background-color: v-bind('bgColor');
|
|
95
|
+
justify-content: flex-start;
|
|
96
|
+
align-items: center;
|
|
97
|
+
|
|
98
|
+
&.closeable:not(.withIcon) {
|
|
99
|
+
.body {
|
|
100
|
+
max-width: calc(100% - 24px);
|
|
127
101
|
}
|
|
102
|
+
}
|
|
128
103
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
104
|
+
&.withIcon:not(.closeable) {
|
|
105
|
+
.body {
|
|
106
|
+
max-width: calc(100% - v-bind(height) - 4px);
|
|
132
107
|
}
|
|
108
|
+
}
|
|
133
109
|
|
|
134
|
-
|
|
135
|
-
|
|
110
|
+
&.closable.withIcon {
|
|
111
|
+
.body {
|
|
112
|
+
max-width: calc(100% - v-bind(height) - 28px);
|
|
136
113
|
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.body {
|
|
118
|
+
font-size: v-bind('textSize');
|
|
119
|
+
line-height: 1;
|
|
120
|
+
font-weight: 400;
|
|
121
|
+
color: v-bind('textColor');
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
white-space: nowrap;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.closeBtn {
|
|
128
|
+
margin-left: var(--spacing-xs);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.withIcon {
|
|
132
|
+
.icon {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-grow: 0;
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
border-radius: 50%;
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
margin-right: var(--spacing-xs);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
137
141
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
}
|
|
142
|
+
.round {
|
|
143
|
+
border-radius: calc(v-bind('height') / 2);
|
|
144
|
+
}
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
146
|
+
.closeable {
|
|
147
|
+
min-width: var(--spacing-ml);
|
|
148
|
+
padding-right: 0;
|
|
149
|
+
}
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
151
|
+
.plain {
|
|
152
|
+
border: 1px solid v-bind('textColor');
|
|
153
|
+
}
|
|
156
154
|
</style>
|