nuance-ui 0.2.9 → 0.2.11
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/module.json +1 -1
- package/dist/runtime/components/action-icon/action-icon-section.d.vue.ts +11 -10
- package/dist/runtime/components/action-icon/action-icon-section.vue +17 -20
- package/dist/runtime/components/action-icon/action-icon-section.vue.d.ts +11 -10
- package/dist/runtime/components/action-icon/action-icon.d.vue.ts +17 -14
- package/dist/runtime/components/action-icon/action-icon.vue +18 -17
- package/dist/runtime/components/action-icon/action-icon.vue.d.ts +17 -14
- package/dist/runtime/components/alert.d.vue.ts +8 -6
- package/dist/runtime/components/alert.vue +15 -101
- package/dist/runtime/components/alert.vue.d.ts +8 -6
- package/dist/runtime/components/app-shell/app-shell-aside.vue +2 -28
- package/dist/runtime/components/app-shell/app-shell-footer.vue +2 -27
- package/dist/runtime/components/app-shell/app-shell-header.vue +2 -28
- package/dist/runtime/components/app-shell/app-shell-main.vue +2 -16
- package/dist/runtime/components/app-shell/app-shell-navbar.vue +2 -32
- package/dist/runtime/components/app-shell/app-shell-section.vue +2 -8
- package/dist/runtime/components/app-shell/app-shell.vue +20 -44
- package/dist/runtime/components/avatar/avatar-group.d.vue.ts +2 -2
- package/dist/runtime/components/avatar/avatar-group.vue +1 -1
- package/dist/runtime/components/avatar/avatar-group.vue.d.ts +2 -2
- package/dist/runtime/components/avatar/avatar.d.vue.ts +9 -5
- package/dist/runtime/components/avatar/avatar.vue +26 -26
- package/dist/runtime/components/avatar/avatar.vue.d.ts +9 -5
- package/dist/runtime/components/background-image.d.vue.ts +2 -2
- package/dist/runtime/components/background-image.vue +3 -19
- package/dist/runtime/components/background-image.vue.d.ts +2 -2
- package/dist/runtime/components/badge.d.vue.ts +9 -8
- package/dist/runtime/components/badge.vue +18 -154
- package/dist/runtime/components/badge.vue.d.ts +9 -8
- package/dist/runtime/components/breadcrumbs.d.vue.ts +4 -4
- package/dist/runtime/components/breadcrumbs.vue +2 -48
- package/dist/runtime/components/breadcrumbs.vue.d.ts +4 -4
- package/dist/runtime/components/button/button.d.vue.ts +21 -26
- package/dist/runtime/components/button/button.module.css +1 -1
- package/dist/runtime/components/button/button.vue +36 -42
- package/dist/runtime/components/button/button.vue.d.ts +21 -26
- package/dist/runtime/components/button/unstyled-button.vue +2 -21
- package/dist/runtime/components/calendar/calendar.d.vue.ts +2 -2
- package/dist/runtime/components/calendar/calendar.vue +3 -10
- package/dist/runtime/components/calendar/calendar.vue.d.ts +2 -2
- package/dist/runtime/components/calendar/ui/core/calendar-cell.d.vue.ts +2 -2
- package/dist/runtime/components/calendar/ui/core/calendar-cell.vue +3 -114
- package/dist/runtime/components/calendar/ui/core/calendar-cell.vue.d.ts +2 -2
- package/dist/runtime/components/calendar/ui/core/calendar-header.vue +2 -67
- package/dist/runtime/components/calendar/ui/levels/calendar-decade.d.vue.ts +2 -2
- package/dist/runtime/components/calendar/ui/levels/calendar-decade.vue +3 -25
- package/dist/runtime/components/calendar/ui/levels/calendar-decade.vue.d.ts +2 -2
- package/dist/runtime/components/calendar/ui/levels/calendar-month.d.vue.ts +2 -2
- package/dist/runtime/components/calendar/ui/levels/calendar-month.vue +9 -34
- package/dist/runtime/components/calendar/ui/levels/calendar-month.vue.d.ts +2 -2
- package/dist/runtime/components/calendar/ui/levels/calendar-year.d.vue.ts +2 -2
- package/dist/runtime/components/calendar/ui/levels/calendar-year.vue +3 -25
- package/dist/runtime/components/calendar/ui/levels/calendar-year.vue.d.ts +2 -2
- package/dist/runtime/components/checkbox/checkbox-card.vue +2 -28
- package/dist/runtime/components/checkbox/checkbox-group.vue +3 -3
- package/dist/runtime/components/checkbox/checkbox-indicator.d.vue.ts +5 -4
- package/dist/runtime/components/checkbox/checkbox-indicator.vue +15 -123
- package/dist/runtime/components/checkbox/checkbox-indicator.vue.d.ts +5 -4
- package/dist/runtime/components/checkbox/checkbox.d.vue.ts +5 -7
- package/dist/runtime/components/checkbox/checkbox.vue +30 -136
- package/dist/runtime/components/checkbox/checkbox.vue.d.ts +5 -7
- package/dist/runtime/components/chip/chip.d.vue.ts +3 -2
- package/dist/runtime/components/chip/chip.vue +29 -212
- package/dist/runtime/components/chip/chip.vue.d.ts +3 -2
- package/dist/runtime/components/combobox/combobox-dropdown.vue +2 -4
- package/dist/runtime/components/container.d.vue.ts +2 -2
- package/dist/runtime/components/container.vue +1 -1
- package/dist/runtime/components/container.vue.d.ts +2 -2
- package/dist/runtime/components/date-time-picker.vue +6 -10
- package/dist/runtime/components/dialog/ui/dialog-close-button.vue +11 -7
- package/dist/runtime/components/dialog/ui/dialog-root.d.vue.ts +11 -9
- package/dist/runtime/components/dialog/ui/dialog-root.vue +5 -5
- package/dist/runtime/components/dialog/ui/dialog-root.vue.d.ts +11 -9
- package/dist/runtime/components/dialog/ui/dialog-title.vue +2 -2
- package/dist/runtime/components/drawer/drawer-close-button.vue +6 -6
- package/dist/runtime/components/drawer/drawer-root.vue +4 -4
- package/dist/runtime/components/drawer/drawer-title.vue +2 -2
- package/dist/runtime/components/files/file-upload-button.vue +8 -7
- package/dist/runtime/components/files/file-upload-icon.vue +5 -5
- package/dist/runtime/components/input/date-picker.vue +6 -10
- package/dist/runtime/components/input/email-input.vue +4 -4
- package/dist/runtime/components/input/lib/input-wrapper.context.d.ts +5 -5
- package/dist/runtime/components/input/number-input.vue +6 -84
- package/dist/runtime/components/input/password-input.vue +4 -4
- package/dist/runtime/components/input/text-input.vue +4 -4
- package/dist/runtime/components/input/ui/button-input.vue +6 -25
- package/dist/runtime/components/input/ui/input-base.vue +6 -265
- package/dist/runtime/components/input/ui/input-inline.d.vue.ts +2 -2
- package/dist/runtime/components/input/ui/input-inline.vue +3 -82
- package/dist/runtime/components/input/ui/input-inline.vue.d.ts +2 -2
- package/dist/runtime/components/input/ui/input-label.d.vue.ts +2 -2
- package/dist/runtime/components/input/ui/input-label.vue +1 -1
- package/dist/runtime/components/input/ui/input-label.vue.d.ts +2 -2
- package/dist/runtime/components/input/ui/input-wrapper.d.vue.ts +5 -1
- package/dist/runtime/components/input/ui/input-wrapper.vue +13 -65
- package/dist/runtime/components/input/ui/input-wrapper.vue.d.ts +5 -1
- package/dist/runtime/components/input/ui/spin-input.vue +2 -53
- package/dist/runtime/components/link/link-button.vue +9 -8
- package/dist/runtime/components/link/link.vue +2 -2
- package/dist/runtime/components/loader/loader.d.vue.ts +7 -7
- package/dist/runtime/components/loader/loader.vue +8 -7
- package/dist/runtime/components/loader/loader.vue.d.ts +7 -7
- package/dist/runtime/components/modal/modal-close-button.vue +6 -6
- package/dist/runtime/components/modal/modal-root.vue +4 -4
- package/dist/runtime/components/modal/modal-title.vue +2 -2
- package/dist/runtime/components/nav-link/nav-icon-link.vue +4 -4
- package/dist/runtime/components/nav-link/nav-link.d.vue.ts +6 -5
- package/dist/runtime/components/nav-link/nav-link.vue +30 -113
- package/dist/runtime/components/nav-link/nav-link.vue.d.ts +6 -5
- package/dist/runtime/components/paper.vue +2 -31
- package/dist/runtime/components/popover/popover-dropdown.vue +2 -54
- package/dist/runtime/components/progress/progress-root.d.vue.ts +3 -3
- package/dist/runtime/components/progress/progress-root.vue +2 -2
- package/dist/runtime/components/progress/progress-root.vue.d.ts +3 -3
- package/dist/runtime/components/progress/progress-section.d.vue.ts +3 -0
- package/dist/runtime/components/progress/progress-section.vue +8 -6
- package/dist/runtime/components/progress/progress-section.vue.d.ts +3 -0
- package/dist/runtime/components/progress/progress.vue +2 -2
- package/dist/runtime/components/select.vue +6 -10
- package/dist/runtime/components/switch/switch-group.vue +3 -3
- package/dist/runtime/components/switch/switch.d.vue.ts +3 -0
- package/dist/runtime/components/switch/switch.vue +15 -205
- package/dist/runtime/components/switch/switch.vue.d.ts +3 -0
- package/dist/runtime/components/table/types.d.ts +4 -3
- package/dist/runtime/components/table/ui/table-sortable-header.vue +9 -8
- package/dist/runtime/components/table/ui/table.vue +9 -174
- package/dist/runtime/components/tabs/tabs-root.d.vue.ts +14 -16
- package/dist/runtime/components/tabs/tabs-root.vue +14 -12
- package/dist/runtime/components/tabs/tabs-root.vue.d.ts +14 -16
- package/dist/runtime/components/text.d.vue.ts +10 -9
- package/dist/runtime/components/text.vue +16 -77
- package/dist/runtime/components/text.vue.d.ts +10 -9
- package/dist/runtime/components/textarea.vue +4 -4
- package/dist/runtime/components/time-picker/time-picker.vue +6 -132
- package/dist/runtime/components/title.vue +4 -8
- package/dist/runtime/components/tree/_ui/tree-item.vue +2 -62
- package/dist/runtime/components/tree/_ui/tree-root.d.vue.ts +7 -6
- package/dist/runtime/components/tree/_ui/tree-root.vue +13 -19
- package/dist/runtime/components/tree/_ui/tree-root.vue.d.ts +7 -6
- package/dist/runtime/components/tree/tree.vue +5 -5
- package/dist/runtime/composables/index.d.ts +1 -1
- package/dist/runtime/composables/index.js +1 -1
- package/dist/runtime/composables/use-vars-resolver.d.ts +4 -0
- package/dist/runtime/composables/use-vars-resolver.js +6 -0
- package/dist/runtime/types/index.d.ts +2 -2
- package/dist/runtime/types/styling.d.ts +6 -0
- package/dist/runtime/types/styling.js +0 -0
- package/dist/runtime/types/theme.d.ts +10 -15
- package/dist/runtime/utils/color/parse-theme-color.d.ts +2 -2
- package/dist/runtime/utils/style/create-variant-color-resolver.d.ts +2 -2
- package/package.json +2 -2
- package/dist/runtime/composables/use-style-resolver.d.ts +0 -6
- package/dist/runtime/composables/use-style-resolver.js +0 -5
|
@@ -20,10 +20,10 @@ const {
|
|
|
20
20
|
description: { type: String, required: false },
|
|
21
21
|
label: { type: String, required: false },
|
|
22
22
|
required: { type: Boolean, required: false },
|
|
23
|
-
radius: { type: String, required: false },
|
|
23
|
+
radius: { type: [String, Number, Object], required: false },
|
|
24
24
|
variant: { type: String, required: false },
|
|
25
|
-
leftSectionPE: { type:
|
|
26
|
-
rightSectionPE: { type:
|
|
25
|
+
leftSectionPE: { type: void 0, required: false },
|
|
26
|
+
rightSectionPE: { type: void 0, required: false }
|
|
27
27
|
});
|
|
28
28
|
const value = defineModel({ type: Array, ...{ default: [] } });
|
|
29
29
|
const id = useId();
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { NuanceColor, NuanceRadius, NuanceSize } from '@nui/types';
|
|
2
2
|
import type { InlineInputProps } from '../input/ui/input-inline.vue.js';
|
|
3
|
+
export interface SwitchVars {
|
|
4
|
+
root: '--switch-radius' | '--switch-height' | '--switch-width' | '--switch-thumb-size' | '--switch-label-font-size' | '--switch-track-label-padding' | '--switch-color';
|
|
5
|
+
}
|
|
3
6
|
export interface SwitchProps extends Omit<InlineInputProps, 'id'> {
|
|
4
7
|
/** Id used to bind input and label, auto-generated if not provided */
|
|
5
8
|
id?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useVarsResolver } from "@nui/composables";
|
|
3
3
|
import { getRadius, getSize, getThemeColor } from "@nui/utils";
|
|
4
4
|
import { computed, useId } from "vue";
|
|
5
5
|
import Box from "../box.vue";
|
|
@@ -66,21 +66,23 @@ const disabled = computed(() => {
|
|
|
66
66
|
return ctx.isDisabled(value);
|
|
67
67
|
return false;
|
|
68
68
|
});
|
|
69
|
-
const style =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
const style = useVarsResolver((theme) => ({
|
|
70
|
+
root: {
|
|
71
|
+
"--switch-radius": radius === void 0 ? void 0 : getRadius(radius),
|
|
72
|
+
"--switch-height": getSize(size.value, "switch-height"),
|
|
73
|
+
"--switch-width": getSize(size.value, "switch-width"),
|
|
74
|
+
"--switch-thumb-size": getSize(size.value, "switch-thumb-size"),
|
|
75
|
+
"--switch-label-font-size": getSize(size.value, "switch-label-font-size"),
|
|
76
|
+
"--switch-track-label-padding": getSize(size.value, "switch-track-label-padding"),
|
|
77
|
+
"--switch-color": color ? getThemeColor(color, theme) : void 0
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
78
80
|
</script>
|
|
79
81
|
|
|
80
82
|
<template>
|
|
81
83
|
<InputInline
|
|
82
84
|
:id='uuid'
|
|
83
|
-
:style
|
|
85
|
+
:style='style.root'
|
|
84
86
|
:class='$style.root'
|
|
85
87
|
body-element='label'
|
|
86
88
|
label-element='span'
|
|
@@ -131,198 +133,6 @@ const style = computed(() => useStyleResolver((theme) => ({
|
|
|
131
133
|
</InputInline>
|
|
132
134
|
</template>
|
|
133
135
|
|
|
134
|
-
<style
|
|
135
|
-
.root {
|
|
136
|
-
--switch-height-xs: rem(16px);
|
|
137
|
-
--switch-height-sm: rem(20px);
|
|
138
|
-
--switch-height-md: rem(24px);
|
|
139
|
-
--switch-height-lg: rem(30px);
|
|
140
|
-
--switch-height-xl: rem(36px);
|
|
141
|
-
|
|
142
|
-
--switch-width-xs: rem(32px);
|
|
143
|
-
--switch-width-sm: rem(38px);
|
|
144
|
-
--switch-width-md: rem(46px);
|
|
145
|
-
--switch-width-lg: rem(56px);
|
|
146
|
-
--switch-width-xl: rem(72px);
|
|
147
|
-
|
|
148
|
-
--switch-thumb-size-xs: rem(12px);
|
|
149
|
-
--switch-thumb-size-sm: rem(14px);
|
|
150
|
-
--switch-thumb-size-md: rem(18px);
|
|
151
|
-
--switch-thumb-size-lg: rem(22px);
|
|
152
|
-
--switch-thumb-size-xl: rem(28px);
|
|
153
|
-
|
|
154
|
-
--switch-label-font-size-xs: rem(7px);
|
|
155
|
-
--switch-label-font-size-sm: rem(9px);
|
|
156
|
-
--switch-label-font-size-md: rem(10px);
|
|
157
|
-
--switch-label-font-size-lg: rem(12px);
|
|
158
|
-
--switch-label-font-size-xl: rem(16px);
|
|
159
|
-
|
|
160
|
-
--switch-track-label-padding-xs: rem(3px);
|
|
161
|
-
--switch-track-label-padding-sm: rem(3px);
|
|
162
|
-
--switch-track-label-padding-md: rem(3.5px);
|
|
163
|
-
--switch-track-label-padding-lg: rem(3.5px);
|
|
164
|
-
--switch-track-label-padding-xl: rem(4px);
|
|
165
|
-
|
|
166
|
-
--switch-height: var(--switch-height-sm);
|
|
167
|
-
--switch-width: var(--switch-width-sm);
|
|
168
|
-
--switch-thumb-size: var(--switch-thumb-size-sm);
|
|
169
|
-
--switch-label-font-size: var(--switch-label-font-size-sm);
|
|
170
|
-
--switch-track-label-padding: var(--switch-track-label-padding-sm);
|
|
171
|
-
--switch-radius: 1000px;
|
|
172
|
-
--switch-color: var(--color-primary-filled);
|
|
173
|
-
--switch-disabled-color: var(--color-disabled);
|
|
174
|
-
|
|
175
|
-
position: relative;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.input {
|
|
179
|
-
position: absolute;
|
|
180
|
-
|
|
181
|
-
overflow: hidden;
|
|
182
|
-
|
|
183
|
-
width: 100%;
|
|
184
|
-
/* Hide the input visually without removing it from the accessibility tree or obscuring it in the DOM */
|
|
185
|
-
height: 100%;
|
|
186
|
-
|
|
187
|
-
margin: 0;
|
|
188
|
-
padding: 0;
|
|
189
|
-
|
|
190
|
-
white-space: nowrap;
|
|
191
|
-
|
|
192
|
-
opacity: 0;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.track {
|
|
196
|
-
cursor: var(--switch-cursor, pointer);
|
|
197
|
-
user-select: none;
|
|
198
|
-
|
|
199
|
-
position: relative;
|
|
200
|
-
z-index: 0;
|
|
201
|
-
|
|
202
|
-
overflow: hidden;
|
|
203
|
-
display: flex;
|
|
204
|
-
align-items: center;
|
|
205
|
-
order: var(--switch-order, 1);
|
|
206
|
-
|
|
207
|
-
min-width: var(--switch-width);
|
|
208
|
-
height: var(--switch-height);
|
|
209
|
-
margin: 0;
|
|
210
|
-
border-radius: var(--switch-radius);
|
|
211
|
-
|
|
212
|
-
font-size: var(--switch-label-font-size);
|
|
213
|
-
font-weight: var(--font-weight-medium);
|
|
214
|
-
line-height: 0;
|
|
215
|
-
color: var(--switch-text-color);
|
|
216
|
-
|
|
217
|
-
appearance: none;
|
|
218
|
-
background-color: var(--switch-bg);
|
|
219
|
-
|
|
220
|
-
transition:
|
|
221
|
-
background-color 150ms ease,
|
|
222
|
-
border-color 150ms ease;
|
|
223
|
-
-webkit-tap-highlight-color: transparent;
|
|
224
|
-
|
|
225
|
-
&:where([data-without-labels]) {
|
|
226
|
-
width: var(--switch-width);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.input:focus-visible+& {
|
|
230
|
-
outline: 2px solid var(--color-primary-filled);
|
|
231
|
-
outline-offset: 2px;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.input:checked+& {
|
|
235
|
-
--switch-bg: var(--switch-color);
|
|
236
|
-
--switch-text-color: var(--color-white);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.input:disabled+&,
|
|
240
|
-
.input[data-disabled]+& {
|
|
241
|
-
--switch-bg: var(--switch-disabled-color);
|
|
242
|
-
--switch-cursor: not-allowed;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
&[data-label-position='left'] {
|
|
246
|
-
--switch-order: 2;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
@mixin where-light {
|
|
250
|
-
--switch-bg: var(--color-gray-3);
|
|
251
|
-
--switch-text-color: var(--color-gray-6);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
@mixin where-dark {
|
|
255
|
-
--switch-bg: var(--color-dark-5);
|
|
256
|
-
--switch-text-color: var(--color-dark-1);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.thumb {
|
|
261
|
-
position: absolute;
|
|
262
|
-
z-index: 1;
|
|
263
|
-
inset-inline-start: var(--switch-thumb-start, var(--switch-track-label-padding));
|
|
264
|
-
|
|
265
|
-
display: flex;
|
|
266
|
-
|
|
267
|
-
width: var(--switch-thumb-size);
|
|
268
|
-
height: var(--switch-thumb-size);
|
|
269
|
-
border-radius: var(--switch-radius);
|
|
270
|
-
|
|
271
|
-
background-color: var(--switch-thumb-bg, var(--color-white));
|
|
272
|
-
|
|
273
|
-
transition: inset-inline-start 150ms ease;
|
|
274
|
-
|
|
275
|
-
&:where([data-with-indicator])::before {
|
|
276
|
-
content: '';
|
|
277
|
-
|
|
278
|
-
position: absolute;
|
|
279
|
-
top: 50%;
|
|
280
|
-
left: 50%;
|
|
281
|
-
transform: translate(-50%, -50%);
|
|
282
|
-
|
|
283
|
-
width: 40%;
|
|
284
|
-
height: 40%;
|
|
285
|
-
border-radius: var(--switch-radius);
|
|
286
|
-
|
|
287
|
-
background-color: var(--switch-bg);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
&>* {
|
|
291
|
-
margin: auto;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.input:checked+*>& {
|
|
295
|
-
--switch-thumb-start: calc(100% - var(--switch-thumb-size) - var(--switch-track-label-padding));
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
.input:disabled+*>&,
|
|
299
|
-
.input[data-disabled]+*>& {
|
|
300
|
-
--switch-thumb-bg: var(--switch-thumb-bg-disabled);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
@mixin where-light {
|
|
304
|
-
--switch-thumb-bg-disabled: var(--color-gray-0);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
@mixin where-dark {
|
|
308
|
-
--switch-thumb-bg-disabled: var(--color-dark-3);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.trackLabel {
|
|
313
|
-
display: grid;
|
|
314
|
-
place-content: center;
|
|
315
|
-
|
|
316
|
-
min-width: calc(var(--switch-width) - var(--switch-thumb-size));
|
|
317
|
-
height: 100%;
|
|
318
|
-
margin-inline-start: calc(var(--switch-thumb-size) + var(--switch-track-label-padding));
|
|
319
|
-
padding-inline: var(--switch-track-label-padding);
|
|
320
|
-
|
|
321
|
-
transition: margin 150ms ease;
|
|
322
|
-
|
|
323
|
-
.input:checked+*>& {
|
|
324
|
-
margin-inline-start: 0;
|
|
325
|
-
margin-inline-end: calc(var(--switch-thumb-size) + var(--switch-track-label-padding));
|
|
326
|
-
}
|
|
327
|
-
}
|
|
136
|
+
<style module>
|
|
137
|
+
.root{--switch-height-xs:rem(16px);--switch-height-sm:rem(20px);--switch-height-md:rem(24px);--switch-height-lg:rem(30px);--switch-height-xl:rem(36px);--switch-width-xs:rem(32px);--switch-width-sm:rem(38px);--switch-width-md:rem(46px);--switch-width-lg:rem(56px);--switch-width-xl:rem(72px);--switch-thumb-size-xs:rem(12px);--switch-thumb-size-sm:rem(14px);--switch-thumb-size-md:rem(18px);--switch-thumb-size-lg:rem(22px);--switch-thumb-size-xl:rem(28px);--switch-label-font-size-xs:rem(7px);--switch-label-font-size-sm:rem(9px);--switch-label-font-size-md:rem(10px);--switch-label-font-size-lg:rem(12px);--switch-label-font-size-xl:rem(16px);--switch-track-label-padding-xs:rem(3px);--switch-track-label-padding-sm:rem(3px);--switch-track-label-padding-md:rem(3.5px);--switch-track-label-padding-lg:rem(3.5px);--switch-track-label-padding-xl:rem(4px);--switch-height:var(--switch-height-sm);--switch-width:var(--switch-width-sm);--switch-thumb-size:var(--switch-thumb-size-sm);--switch-label-font-size:var(--switch-label-font-size-sm);--switch-track-label-padding:var(--switch-track-label-padding-sm);--switch-radius:1000px;--switch-color:var(--color-primary-filled);--switch-disabled-color:var(--color-disabled);position:relative}.input{height:100%;opacity:0;padding:0;position:absolute;white-space:nowrap;width:100%}.input,.track{margin:0;overflow:hidden}.track{align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--switch-bg);border-radius:var(--switch-radius);color:var(--switch-text-color);cursor:var(--switch-cursor,pointer);display:flex;font-size:var(--switch-label-font-size);font-weight:var(--font-weight-medium);height:var(--switch-height);line-height:0;min-width:var(--switch-width);order:var(--switch-order,1);position:relative;transition:background-color .15s ease,border-color .15s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:0;-webkit-tap-highlight-color:transparent}.track:where([data-without-labels]){width:var(--switch-width)}.input:focus-visible+.track{outline:2px solid var(--color-primary-filled);outline-offset:2px}.input:checked+.track{--switch-bg:var(--switch-color);--switch-text-color:var(--color-white)}.input:disabled+.track,.input[data-disabled]+.track{--switch-bg:var(--switch-disabled-color);--switch-cursor:not-allowed}.track[data-label-position=left]{--switch-order:2}.track{@mixin where-light{--switch-bg:var(--color-gray-3);--switch-text-color:var(--color-gray-6)}}.track{@mixin where-dark{--switch-bg:var(--color-dark-5);--switch-text-color:var(--color-dark-1)}}.thumb{background-color:var(--switch-thumb-bg,var(--color-white));border-radius:var(--switch-radius);display:flex;height:var(--switch-thumb-size);inset-inline-start:var(--switch-thumb-start,var(--switch-track-label-padding));position:absolute;transition:inset-inline-start .15s ease;width:var(--switch-thumb-size);z-index:1}.thumb:where([data-with-indicator]):before{background-color:var(--switch-bg);border-radius:var(--switch-radius);content:"";height:40%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:40%}.thumb>*{margin:auto}.input:checked+*>.thumb{--switch-thumb-start:calc(100% - var(--switch-thumb-size) - var(--switch-track-label-padding))}.input:disabled+*>.thumb,.input[data-disabled]+*>.thumb{--switch-thumb-bg:var(--switch-thumb-bg-disabled)}.thumb{@mixin where-light{--switch-thumb-bg-disabled:var(--color-gray-0)}}.thumb{@mixin where-dark{--switch-thumb-bg-disabled:var(--color-dark-3)}}.trackLabel{display:grid;height:100%;margin-inline-start:calc(var(--switch-thumb-size) + var(--switch-track-label-padding));min-width:calc(var(--switch-width) - var(--switch-thumb-size));padding-inline:var(--switch-track-label-padding);place-content:center;transition:margin .15s ease}.input:checked+*>.trackLabel{margin-inline-end:calc(var(--switch-thumb-size) + var(--switch-track-label-padding));margin-inline-start:0}
|
|
328
138
|
</style>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { NuanceColor, NuanceRadius, NuanceSize } from '@nui/types';
|
|
2
2
|
import type { InlineInputProps } from '../input/ui/input-inline.vue.js';
|
|
3
|
+
export interface SwitchVars {
|
|
4
|
+
root: '--switch-radius' | '--switch-height' | '--switch-width' | '--switch-thumb-size' | '--switch-label-font-size' | '--switch-track-label-padding' | '--switch-color';
|
|
5
|
+
}
|
|
3
6
|
export interface SwitchProps extends Omit<InlineInputProps, 'id'> {
|
|
4
7
|
/** Id used to bind input and label, auto-generated if not provided */
|
|
5
8
|
id?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Classes, NuanceColor } from '@nui/types';
|
|
1
|
+
import type { AnyString, Classes, NuanceColor } from '@nui/types';
|
|
2
2
|
import type { RowData, TableMeta } from '@tanstack/table-core';
|
|
3
3
|
import type { CellContext, ColumnDef, ColumnFiltersOptions, ColumnPinningOptions, ColumnSizingOptions, CoreOptions, ExpandedOptions, FacetedOptions, GlobalFilterOptions, GroupingOptions, HeaderContext, PaginationOptions, Row, RowPinningOptions, RowSelectionOptions, SortingOptions, VisibilityOptions } from '@tanstack/vue-table';
|
|
4
4
|
import type { VirtualizerOptions } from '@tanstack/vue-virtual';
|
|
@@ -24,6 +24,7 @@ export type TableSlots<T extends TableData = TableData> = {
|
|
|
24
24
|
'body-top': (props?: object) => any;
|
|
25
25
|
'body-bottom': (props?: object) => any;
|
|
26
26
|
} & DynamicHeaderSlots<T> & DynamicFooterSlots<T> & DynamicCellSlots<T>;
|
|
27
|
+
export type TableClasses = 'root' | 'table' | 'thead' | 'th' | 'td' | 'tr' | 'tbody' | 'tfoot' | 'caption' | 'loading' | 'empty' | 'separator';
|
|
27
28
|
export interface TableProps<T extends TableData = TableData> extends TableOptions<T>, /** @vue-ignore */ Omit<TableHTMLAttributes, 'columns' | 'onSelect' | 'onContextmenu'> {
|
|
28
29
|
/** Row data */
|
|
29
30
|
data?: T[];
|
|
@@ -67,7 +68,7 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
|
|
|
67
68
|
* Color of the loading overlay
|
|
68
69
|
* @defaultValue 'primary'
|
|
69
70
|
*/
|
|
70
|
-
loadingColor?: NuanceColor |
|
|
71
|
+
loadingColor?: NuanceColor | AnyString;
|
|
71
72
|
/** Vertical alignment of cell content */
|
|
72
73
|
verticalAlign?: CSSProperties['verticalAlign'];
|
|
73
74
|
/** Called when a row is clicked */
|
|
@@ -77,7 +78,7 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
|
|
|
77
78
|
/** Called on right-click on a row */
|
|
78
79
|
onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
|
|
79
80
|
/** Styles API */
|
|
80
|
-
classes?: Classes<
|
|
81
|
+
classes?: Classes<TableClasses>;
|
|
81
82
|
/**
|
|
82
83
|
* Use the `watchOptions` prop to customize reactivity (for ex: disable deep watching for changes in your data or limiting the max traversal depth). This can improve performance by reducing unnecessary re-renders, but it should be used with caution as it may lead to unexpected behavior if not managed properly.
|
|
83
84
|
* @see [API](https://vuejs.org/api/options-state.html#watch)
|
|
@@ -10,19 +10,20 @@ const {
|
|
|
10
10
|
color = "gray",
|
|
11
11
|
...rest
|
|
12
12
|
} = defineProps({
|
|
13
|
+
color: { type: null, required: false },
|
|
13
14
|
size: { type: null, required: false },
|
|
14
|
-
spacing: { type: String, required: false },
|
|
15
|
-
variant: { type: String, required: false },
|
|
15
|
+
spacing: { type: [String, Number, Object], required: false },
|
|
16
16
|
gradient: { type: Object, required: false },
|
|
17
|
+
radius: { type: [String, Number, Object], required: false },
|
|
18
|
+
justify: { type: void 0, required: false },
|
|
19
|
+
leftSectionPE: { type: void 0, required: false },
|
|
20
|
+
rightSectionPE: { type: void 0, required: false },
|
|
17
21
|
loading: { type: Boolean, required: false },
|
|
18
|
-
color: { type: null, required: false },
|
|
19
|
-
radius: { type: [String, Number], required: false },
|
|
20
|
-
classes: { type: Object, required: false },
|
|
21
|
-
leftSectionPE: { type: null, required: false },
|
|
22
|
-
leftSectionProps: { type: Object, required: false },
|
|
23
22
|
icon: { type: String, required: false },
|
|
24
|
-
|
|
23
|
+
leftSectionProps: { type: Object, required: false },
|
|
25
24
|
rightSectionProps: { type: Object, required: false },
|
|
25
|
+
variant: { type: String, required: false },
|
|
26
|
+
classes: { type: Object, required: false },
|
|
26
27
|
is: { type: null, required: false },
|
|
27
28
|
mod: { type: [Object, Array, null], required: false },
|
|
28
29
|
column: { type: Object, required: true },
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useVueTable
|
|
10
10
|
} from "@tanstack/vue-table";
|
|
11
11
|
import { reactivePick, unrefElement } from "@vueuse/core";
|
|
12
|
-
import {
|
|
12
|
+
import { useVarsResolver } from "#imports";
|
|
13
13
|
import { computed, ref, useTemplateRef, watch } from "vue";
|
|
14
14
|
import Box from "../../box.vue";
|
|
15
15
|
import { createRowHandlers, processColumns, resolveValue, valueUpdater } from "../lib";
|
|
@@ -201,10 +201,12 @@ const rows = computed(() => table.getRowModel().rows);
|
|
|
201
201
|
watch(() => props.data, () => {
|
|
202
202
|
data.value = props.data ? [...props.data] : [];
|
|
203
203
|
}, props.watchOptions);
|
|
204
|
-
const style =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
const style = useVarsResolver((theme) => ({
|
|
205
|
+
root: {
|
|
206
|
+
"--table-loader-color": props.loadingColor ? getThemeColor(props.loadingColor, theme) : void 0,
|
|
207
|
+
"--vertical-align": props.verticalAlign
|
|
208
|
+
}
|
|
209
|
+
}));
|
|
208
210
|
const { onRowContextmenu, onRowHover, onRowSelect } = createRowHandlers(props);
|
|
209
211
|
defineExpose({
|
|
210
212
|
get $el() {
|
|
@@ -362,173 +364,6 @@ defineExpose({
|
|
|
362
364
|
</Box>
|
|
363
365
|
</template>
|
|
364
366
|
|
|
365
|
-
<style
|
|
366
|
-
.root {
|
|
367
|
-
--table-color: var(--color-primary-4);
|
|
368
|
-
--table-loader-color: var(--table-color);
|
|
369
|
-
--table-loader-animation: carousel 2s ease-in-out infinite;
|
|
370
|
-
--table-padding-x: .5rem;
|
|
371
|
-
--table-padding-y: .5rem;
|
|
372
|
-
--vertical-align: baseline;
|
|
373
|
-
|
|
374
|
-
position: relative;
|
|
375
|
-
|
|
376
|
-
overflow: auto;
|
|
377
|
-
|
|
378
|
-
&:not([data-virtualize]) {
|
|
379
|
-
.table {
|
|
380
|
-
overflow: clip;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
.tbody>tr:not(:last-of-type) {
|
|
384
|
-
border-bottom: 1px solid var(--table-bd-color);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
@mixin where-light {
|
|
389
|
-
--table-active-bg: alpha(var(--color-slate-1), .5);
|
|
390
|
-
--table-c: var(--color-slate-7);
|
|
391
|
-
--table-bd-color: var(--color-slate-3);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
@mixin where-dark {
|
|
395
|
-
--table-active-bg: alpha(var(--color-slate-7), .5);
|
|
396
|
-
--table-c: var(--color-slate-4);
|
|
397
|
-
--table-bd-color: var(--color-slate-7);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
.table {
|
|
402
|
-
border-collapse: collapse;
|
|
403
|
-
|
|
404
|
-
min-width: 100%;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
.thead {
|
|
408
|
-
position: relative;
|
|
409
|
-
|
|
410
|
-
&[data-loading]::after {
|
|
411
|
-
content: '';
|
|
412
|
-
|
|
413
|
-
position: absolute;
|
|
414
|
-
z-index: 1;
|
|
415
|
-
|
|
416
|
-
height: 1px;
|
|
417
|
-
|
|
418
|
-
background-color: alpha(var(--table-loader-color), .75);
|
|
419
|
-
|
|
420
|
-
animation: var(--table-loader-animation);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
&[data-sticky] {
|
|
424
|
-
position: sticky;
|
|
425
|
-
z-index: 1;
|
|
426
|
-
top: 0;
|
|
427
|
-
inset-inline: 0rem;
|
|
428
|
-
|
|
429
|
-
background-color: alpha(var(--color-body), .75);
|
|
430
|
-
backdrop-filter: blur(8px);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.th {
|
|
435
|
-
padding-block: var(--table-padding-y);
|
|
436
|
-
padding-inline: var(--table-padding-x);
|
|
437
|
-
|
|
438
|
-
font-weight: 600;
|
|
439
|
-
color: var(--table-c);
|
|
440
|
-
text-align: left;
|
|
441
|
-
vertical-align: var(--vertical-align);
|
|
442
|
-
|
|
443
|
-
&:has([role='checkbox']) {
|
|
444
|
-
padding-inline-end: 0;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.th[data-pinned],
|
|
449
|
-
.tr td[data-pinned] {
|
|
450
|
-
position: sticky;
|
|
451
|
-
z-index: 1;
|
|
452
|
-
|
|
453
|
-
background-color: alpha(var(--color-body), .75);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
.tbody {
|
|
457
|
-
isolation: isolate;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.tfoot {
|
|
461
|
-
position: relative;
|
|
462
|
-
|
|
463
|
-
&[data-sticky] {
|
|
464
|
-
position: sticky;
|
|
465
|
-
z-index: 1;
|
|
466
|
-
bottom: 0;
|
|
467
|
-
inset-inline: 0rem;
|
|
468
|
-
|
|
469
|
-
background-color: var(--color-body);
|
|
470
|
-
backdrop-filter: blur(8px);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
.tr {
|
|
475
|
-
&[data-selectable] {
|
|
476
|
-
&:hover {
|
|
477
|
-
background-color: var(--table-active-bg);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
&:focus-visible {
|
|
481
|
-
outline: 1px solid var(--table-color);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
&[data-selected] {
|
|
486
|
-
background-color: var(--table-active-bg);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
td {
|
|
490
|
-
padding-block: var(--table-padding-y);
|
|
491
|
-
padding-inline: var(--table-padding-x);
|
|
492
|
-
|
|
493
|
-
color: var(--table-c);
|
|
494
|
-
white-space: nowrap;
|
|
495
|
-
vertical-align: var(--vertical-align);
|
|
496
|
-
|
|
497
|
-
&:has([role='checkbox']) {
|
|
498
|
-
padding-inline-end: 0;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
.separator {
|
|
504
|
-
position: absolute;
|
|
505
|
-
z-index: 1;
|
|
506
|
-
left: 0;
|
|
507
|
-
|
|
508
|
-
width: 100%;
|
|
509
|
-
height: 1px;
|
|
510
|
-
|
|
511
|
-
background-color: var(--table-bd-color);
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
.loading,
|
|
515
|
-
.empty {
|
|
516
|
-
padding-inline: 1.5rem;
|
|
517
|
-
|
|
518
|
-
text-align: center;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
@keyframes carousel {
|
|
522
|
-
0% {
|
|
523
|
-
transform: translate(-100%);
|
|
524
|
-
|
|
525
|
-
width: 50%;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
to {
|
|
529
|
-
transform: translate(200%);
|
|
530
|
-
|
|
531
|
-
width: 50%;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
367
|
+
<style module>
|
|
368
|
+
.root{--table-color:var(--color-primary-4);--table-loader-color:var(--table-color);--table-loader-animation:carousel 2s ease-in-out infinite;--table-padding-x:.5rem;--table-padding-y:.5rem;--vertical-align:baseline;overflow:auto;position:relative}.root:not([data-virtualize]) .table{overflow:clip}.root:not([data-virtualize]) .tbody>tr:not(:last-of-type){border-bottom:1px solid var(--table-bd-color)}.root{@mixin where-light{--table-active-bg:alpha(var(--color-slate-1),.5);--table-c:var(--color-slate-7);--table-bd-color:var(--color-slate-3)}}.root{@mixin where-dark{--table-active-bg:alpha(var(--color-slate-7),.5);--table-c:var(--color-slate-4);--table-bd-color:var(--color-slate-7)}}.table{border-collapse:collapse;min-width:100%}.thead{position:relative}.thead[data-loading]:after{animation:var(--table-loader-animation);background-color:alpha(var(--table-loader-color),.75);content:"";height:1px;position:absolute;z-index:1}.thead[data-sticky]{backdrop-filter:blur(8px);background-color:alpha(var(--color-body),.75);position:sticky;top:0;inset-inline:0;z-index:1}.th{color:var(--table-c);font-weight:600;padding-block:var(--table-padding-y);padding-inline:var(--table-padding-x);text-align:left;vertical-align:var(--vertical-align)}.th:has([role=checkbox]){padding-inline-end:0}.th[data-pinned],.tr td[data-pinned]{background-color:alpha(var(--color-body),.75);position:sticky;z-index:1}.tbody{isolation:isolate}.tfoot{position:relative}.tfoot[data-sticky]{backdrop-filter:blur(8px);background-color:var(--color-body);bottom:0;inset-inline:0;position:sticky;z-index:1}.tr[data-selectable]:hover{background-color:var(--table-active-bg)}.tr[data-selectable]:focus-visible{outline:1px solid var(--table-color)}.tr[data-selected]{background-color:var(--table-active-bg)}.tr td{color:var(--table-c);padding-block:var(--table-padding-y);padding-inline:var(--table-padding-x);vertical-align:var(--vertical-align);white-space:nowrap}.tr td:has([role=checkbox]){padding-inline-end:0}.separator{background-color:var(--table-bd-color);height:1px;left:0;position:absolute;width:100%;z-index:1}.empty,.loading{padding-inline:1.5rem;text-align:center}@keyframes carousel{0%{transform:translate(-100%);width:50%}to{transform:translate(200%);width:50%}}
|
|
534
369
|
</style>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { NuanceColor, NuanceRadius } from '@nui/types';
|
|
2
2
|
import type { BoxProps } from '../box.vue.js';
|
|
3
|
+
export type TabsVariant = 'default' | 'pills' | 'outline';
|
|
3
4
|
export interface TabsRootProps extends BoxProps {
|
|
4
|
-
/** Value of the tab activated by default (uncontrolled) */
|
|
5
|
-
defaultTab?: string;
|
|
6
5
|
/**
|
|
7
6
|
* Tabs orientation
|
|
8
7
|
* @default `'horizontal'`
|
|
@@ -13,11 +12,21 @@ export interface TabsRootProps extends BoxProps {
|
|
|
13
12
|
* @default `'left'`
|
|
14
13
|
*/
|
|
15
14
|
placement?: 'left' | 'right';
|
|
15
|
+
/** Visual variant */
|
|
16
|
+
variant?: TabsVariant;
|
|
17
|
+
/** Color from theme */
|
|
18
|
+
color?: NuanceColor;
|
|
19
|
+
/** Border radius */
|
|
20
|
+
radius?: NuanceRadius;
|
|
16
21
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @default `
|
|
22
|
+
* Inverts tab styles
|
|
23
|
+
* @default `false`
|
|
19
24
|
*/
|
|
20
|
-
|
|
25
|
+
inverted?: boolean;
|
|
26
|
+
/** Root element id */
|
|
27
|
+
id?: string;
|
|
28
|
+
/** Value of the tab activated by default (uncontrolled) */
|
|
29
|
+
defaultTab?: string;
|
|
21
30
|
/**
|
|
22
31
|
* Whether arrow key presses loop through items
|
|
23
32
|
* @default `true`
|
|
@@ -33,22 +42,11 @@ export interface TabsRootProps extends BoxProps {
|
|
|
33
42
|
* @default `false`
|
|
34
43
|
*/
|
|
35
44
|
allowTabDeactivation?: boolean;
|
|
36
|
-
/** Color from theme */
|
|
37
|
-
color?: NuanceColor;
|
|
38
|
-
/** Border radius */
|
|
39
|
-
radius?: NuanceRadius;
|
|
40
|
-
/**
|
|
41
|
-
* Inverts tab styles
|
|
42
|
-
* @default `false`
|
|
43
|
-
*/
|
|
44
|
-
inverted?: boolean;
|
|
45
45
|
/**
|
|
46
46
|
* If `false`, panel content is unmounted when inactive
|
|
47
47
|
* @default `true`
|
|
48
48
|
*/
|
|
49
49
|
keepMounted?: boolean;
|
|
50
|
-
/** Root element id */
|
|
51
|
-
id?: string;
|
|
52
50
|
}
|
|
53
51
|
type __VLS_Props = TabsRootProps;
|
|
54
52
|
type __VLS_ModelProps = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useVarsResolver } from "@nui/composables";
|
|
3
3
|
import { getRadius, getThemeColor } from "@nui/utils";
|
|
4
|
-
import {
|
|
4
|
+
import { onMounted, useId } from "vue";
|
|
5
5
|
import Box from "../box.vue";
|
|
6
6
|
import { getSafeId, useProvideTabsContext } from "./lib";
|
|
7
7
|
import css from "./tabs.module.css";
|
|
@@ -18,22 +18,21 @@ const {
|
|
|
18
18
|
defaultTab,
|
|
19
19
|
...rest
|
|
20
20
|
} = defineProps({
|
|
21
|
-
defaultTab: { type: String, required: false },
|
|
22
21
|
orientation: { type: String, required: false },
|
|
23
22
|
placement: { type: String, required: false },
|
|
24
23
|
variant: { type: String, required: false },
|
|
25
|
-
loop: { type: Boolean, required: false },
|
|
26
|
-
activateTabWithKeyboard: { type: Boolean, required: false },
|
|
27
|
-
allowTabDeactivation: { type: Boolean, required: false },
|
|
28
24
|
color: { type: null, required: false },
|
|
29
25
|
radius: { type: [String, Number], required: false },
|
|
30
26
|
inverted: { type: Boolean, required: false },
|
|
31
|
-
keepMounted: { type: Boolean, required: false },
|
|
32
27
|
id: { type: String, required: false },
|
|
28
|
+
defaultTab: { type: String, required: false },
|
|
29
|
+
loop: { type: Boolean, required: false },
|
|
30
|
+
activateTabWithKeyboard: { type: Boolean, required: false },
|
|
31
|
+
allowTabDeactivation: { type: Boolean, required: false },
|
|
32
|
+
keepMounted: { type: Boolean, required: false },
|
|
33
33
|
is: { type: null, required: false },
|
|
34
34
|
mod: { type: [Object, Array, null], required: false }
|
|
35
35
|
});
|
|
36
|
-
const VALUE_ERROR = "component was rendered with invalid value or without value";
|
|
37
36
|
const uid = id ?? useId();
|
|
38
37
|
const active = defineModel({ type: [String, null], ...{ default: null } });
|
|
39
38
|
onMounted(() => {
|
|
@@ -41,10 +40,13 @@ onMounted(() => {
|
|
|
41
40
|
active.value = defaultTab;
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
|
-
const style =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const style = useVarsResolver((theme) => ({
|
|
44
|
+
root: {
|
|
45
|
+
"--tabs-radius": getRadius(radius),
|
|
46
|
+
"--tabs-color": getThemeColor(color, theme)
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
const VALUE_ERROR = "component was rendered with invalid value or without value";
|
|
48
50
|
useProvideTabsContext({
|
|
49
51
|
...rest,
|
|
50
52
|
id: uid,
|