nuance-ui 0.2.10 → 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 -31
- package/dist/runtime/components/button/button.vue +36 -45
- package/dist/runtime/components/button/button.vue.d.ts +21 -31
- 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 -8
- 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 -9
- 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 -9
- 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 +1 -2
- package/dist/runtime/types/styling.d.ts +3 -1
- package/dist/runtime/types/theme.d.ts +10 -15
- 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 -5
- package/dist/runtime/composables/use-style-resolver.js +0 -5
|
@@ -12,36 +12,6 @@ const { mod } = defineProps({
|
|
|
12
12
|
</Box>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
<style module
|
|
16
|
-
.root {
|
|
17
|
-
position: fixed;
|
|
18
|
-
|
|
19
|
-
z-index: 1;
|
|
20
|
-
top: var(--app-shell-header-offset, 0rem);
|
|
21
|
-
inset-inline-start: 0;
|
|
22
|
-
transform: var(--app-shell-navbar-transform);
|
|
23
|
-
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
|
|
27
|
-
width: var(--app-shell-navbar-width);
|
|
28
|
-
height: calc(100dvh - var(--app-shell-header-offset, 0rem) - var(--app-shell-footer-offset, 0rem));
|
|
29
|
-
padding-block: var(--app-shell-element-padding);
|
|
30
|
-
|
|
31
|
-
background-color: var(--color-aside);
|
|
32
|
-
|
|
33
|
-
transition-timing-function: var(--app-shell-transition-timing-function);
|
|
34
|
-
transition-duration: var(--app-shell-transition-duration);
|
|
35
|
-
transition-property: transform, top, height;
|
|
36
|
-
|
|
37
|
-
:where([data-layout='alt']) > & {
|
|
38
|
-
top: 0;
|
|
39
|
-
|
|
40
|
-
height: 100dvh;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:where([data-with-border]) > & {
|
|
44
|
-
border-inline-end: 1px solid var(--app-shell-border-color);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
15
|
+
<style module>
|
|
16
|
+
.root{background-color:var(--color-aside);display:flex;flex-direction:column;height:calc(100dvh - var(--app-shell-header-offset, 0rem) - var(--app-shell-footer-offset, 0rem));inset-inline-start:0;padding-block:var(--app-shell-element-padding);position:fixed;top:var(--app-shell-header-offset,0);transform:var(--app-shell-navbar-transform);transition-duration:var(--app-shell-transition-duration);transition-property:transform,top,height;transition-timing-function:var(--app-shell-transition-timing-function);width:var(--app-shell-navbar-width);z-index:1}:where([data-layout=alt])>.root{height:100dvh;top:0}:where([data-with-border])>.root{border-inline-end:1px solid var(--app-shell-border-color)}
|
|
47
17
|
</style>
|
|
@@ -13,12 +13,6 @@ const { is = "section", mod, grow } = defineProps({
|
|
|
13
13
|
</Box>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
|
-
<style module
|
|
17
|
-
.root
|
|
18
|
-
flex-grow: 0;
|
|
19
|
-
|
|
20
|
-
&:where([data-grow]) {
|
|
21
|
-
flex-grow: 1;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
16
|
+
<style module>
|
|
17
|
+
.root{flex-grow:0}.root:where([data-grow]){flex-grow:1}
|
|
24
18
|
</style>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { useProvideDatesConfig } from "@nui/composables";
|
|
3
|
-
import { computed } from "vue";
|
|
2
|
+
import { useProvideDatesConfig, useVarsResolver } from "@nui/composables";
|
|
4
3
|
import Box from "../box.vue";
|
|
5
4
|
import { useProvideAppShell } from "./context";
|
|
6
5
|
const {
|
|
@@ -22,54 +21,31 @@ const navbar = defineModel("navbar", { type: Boolean, ...{ default: false } });
|
|
|
22
21
|
const footer = defineModel("footer", { type: Boolean, ...{ default: false } });
|
|
23
22
|
useProvideAppShell({ aside, footer, header, navbar });
|
|
24
23
|
useProvideDatesConfig(dateConfig);
|
|
25
|
-
const style =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
const style = useVarsResolver(() => ({
|
|
25
|
+
root: {
|
|
26
|
+
"--app-shell-navbar-transform": navbar.value ? "translateX(calc(-1 * var(--app-shell-navbar-width)))" : void 0,
|
|
27
|
+
"--app-shell-navbar-offset": navbar.value ? "0rem" : void 0,
|
|
28
|
+
"--app-shell-aside-transform": aside.value ? "translateX(var(--app-shell-aside-width))" : void 0,
|
|
29
|
+
"--app-shell-aside-offset": aside.value ? "0rem" : void 0,
|
|
30
|
+
"--app-shell-header-transform": header.value ? "translateY(calc(-1 * var(--app-shell-header-height)))" : void 0,
|
|
31
|
+
"--app-shell-header-offset": header.value ? "0rem" : void 0,
|
|
32
|
+
"--app-shell-footer-transform": footer.value ? "translateY(var(--app-shell-footer-height))" : void 0,
|
|
33
|
+
"--app-shell-footer-offset": footer.value ? "0rem" : void 0
|
|
34
|
+
}
|
|
34
35
|
}));
|
|
35
36
|
</script>
|
|
36
37
|
|
|
37
38
|
<template>
|
|
38
|
-
<Box
|
|
39
|
+
<Box
|
|
40
|
+
:is
|
|
41
|
+
:style
|
|
42
|
+
:class='$style.root'
|
|
43
|
+
:mod='[mod, { layout, "with-border": withBorder }]'
|
|
44
|
+
>
|
|
39
45
|
<slot />
|
|
40
46
|
</Box>
|
|
41
47
|
</template>
|
|
42
48
|
|
|
43
|
-
<style module
|
|
44
|
-
.root {
|
|
45
|
-
--app-shell-padding: var(--spacing-sm);
|
|
46
|
-
--app-shell-element-padding: .25rem;
|
|
47
|
-
|
|
48
|
-
--app-shell-transition-duration: 200ms;
|
|
49
|
-
--app-shell-transition-timing-function: ease;
|
|
50
|
-
|
|
51
|
-
--app-shell-navbar-width: rem(56px);
|
|
52
|
-
--app-shell-navbar-offset: var(--app-shell-navbar-width);
|
|
53
|
-
--app-shell-navbar-transform: none;
|
|
54
|
-
|
|
55
|
-
--app-shell-aside-width: rem(56px);
|
|
56
|
-
--app-shell-aside-offset: var(--app-shell-aside-width);
|
|
57
|
-
--app-shell-aside-transform: none;
|
|
58
|
-
|
|
59
|
-
--app-shell-header-height: rem(56px);
|
|
60
|
-
--app-shell-header-offset: var(--app-shell-header-height);
|
|
61
|
-
--app-shell-header-transform: none;
|
|
62
|
-
|
|
63
|
-
--app-shell-footer-height: rem(100px);
|
|
64
|
-
--app-shell-footer-offset: var(--app-shell-footer-height);
|
|
65
|
-
--app-shell-footer-transform: none;
|
|
66
|
-
|
|
67
|
-
@mixin light {
|
|
68
|
-
--app-shell-border-color: var(--color-gray-3);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@mixin dark {
|
|
72
|
-
--app-shell-border-color: var(--color-slate-8);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
49
|
+
<style module>
|
|
50
|
+
.root{--app-shell-padding:var(--spacing-sm);--app-shell-element-padding:.25rem;--app-shell-transition-duration:200ms;--app-shell-transition-timing-function:ease;--app-shell-navbar-width:rem(56px);--app-shell-navbar-offset:var(--app-shell-navbar-width);--app-shell-navbar-transform:none;--app-shell-aside-width:rem(56px);--app-shell-aside-offset:var(--app-shell-aside-width);--app-shell-aside-transform:none;--app-shell-header-height:rem(56px);--app-shell-header-offset:var(--app-shell-header-height);--app-shell-header-transform:none;--app-shell-footer-height:rem(100px);--app-shell-footer-offset:var(--app-shell-footer-height);--app-shell-footer-transform:none;@mixin where-light{--app-shell-border-color:var(--color-gray-3)}@mixin where-dark{--app-shell-border-color:var(--color-slate-8)}}
|
|
75
51
|
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BoxProps } from '@nui/components';
|
|
2
|
-
import type { NuanceSpacing } from '@nui/types';
|
|
2
|
+
import type { AnyString, NuanceSpacing } from '@nui/types';
|
|
3
3
|
export interface AvatarGroupProps extends BoxProps {
|
|
4
4
|
/** Negative spacing applied between child avatars to overlap them */
|
|
5
|
-
spacing?: NuanceSpacing |
|
|
5
|
+
spacing?: NuanceSpacing | AnyString;
|
|
6
6
|
}
|
|
7
7
|
declare var __VLS_8: {};
|
|
8
8
|
type __VLS_Slots = {} & {
|
|
@@ -5,7 +5,7 @@ import Box from "../box.vue";
|
|
|
5
5
|
import css from "./avatar.module.css";
|
|
6
6
|
import { useProvideAvatarGroup } from "./lib/context";
|
|
7
7
|
const { mod, is, spacing } = defineProps({
|
|
8
|
-
spacing: { type: [String, Number], required: false },
|
|
8
|
+
spacing: { type: [String, Number, Object], required: false },
|
|
9
9
|
is: { type: null, required: false },
|
|
10
10
|
mod: { type: [Object, Array, null], required: false }
|
|
11
11
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BoxProps } from '@nui/components';
|
|
2
|
-
import type { NuanceSpacing } from '@nui/types';
|
|
2
|
+
import type { AnyString, NuanceSpacing } from '@nui/types';
|
|
3
3
|
export interface AvatarGroupProps extends BoxProps {
|
|
4
4
|
/** Negative spacing applied between child avatars to overlap them */
|
|
5
|
-
spacing?: NuanceSpacing |
|
|
5
|
+
spacing?: NuanceSpacing | AnyString;
|
|
6
6
|
}
|
|
7
7
|
declare var __VLS_8: {};
|
|
8
8
|
type __VLS_Slots = {} & {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { BoxProps } from '@nui/components';
|
|
2
|
-
import type { NuanceColor, NuanceGradient, NuanceRadius, NuanceSize } from '@nui/types';
|
|
2
|
+
import type { AnyString, Classes, NuanceColor, NuanceGradient, NuanceRadius, NuanceSize } from '@nui/types';
|
|
3
|
+
type AvatarVariant = 'filled' | 'light' | 'gradient' | 'outline' | 'default';
|
|
4
|
+
type AvatarClasses = 'root' | 'placeholder' | 'image';
|
|
3
5
|
export interface AvatarProps extends BoxProps {
|
|
4
|
-
/** Component size */
|
|
5
|
-
size?: NuanceSize | string;
|
|
6
6
|
/** Border radius */
|
|
7
|
-
radius?: NuanceRadius;
|
|
7
|
+
radius?: NuanceRadius | AnyString;
|
|
8
|
+
/** Component size */
|
|
9
|
+
size?: NuanceSize | AnyString;
|
|
8
10
|
/** Color from theme. Pass `'initials'` to derive the color from the user's name. */
|
|
9
11
|
color?: NuanceColor | 'initials';
|
|
10
12
|
/** Gradient configuration (used with `variant="gradient"`) */
|
|
@@ -23,7 +25,9 @@ export interface AvatarProps extends BoxProps {
|
|
|
23
25
|
*/
|
|
24
26
|
placeholder?: string;
|
|
25
27
|
/** Visual variant */
|
|
26
|
-
variant?:
|
|
28
|
+
variant?: AvatarVariant;
|
|
29
|
+
/** Styles API */
|
|
30
|
+
classes?: Classes<AvatarClasses>;
|
|
27
31
|
}
|
|
28
32
|
declare var __VLS_8: {};
|
|
29
33
|
type __VLS_Slots = {} & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useVarsResolver } from "@nui/composables";
|
|
3
3
|
import { createVariantColorResolver, getRadius, getSize } from "@nui/utils";
|
|
4
4
|
import { computed } from "vue";
|
|
5
5
|
import Box from "../box.vue";
|
|
@@ -8,20 +8,13 @@ import { useAvatarGroupState } from "./lib/context";
|
|
|
8
8
|
import { getInitials } from "./lib/get-initials";
|
|
9
9
|
import { getInitialsColor } from "./lib/get-initials-color";
|
|
10
10
|
const {
|
|
11
|
-
alt,
|
|
12
|
-
src,
|
|
13
|
-
mod,
|
|
14
11
|
name,
|
|
15
|
-
color,
|
|
16
|
-
allowedInitialsColors,
|
|
17
|
-
gradient,
|
|
18
|
-
variant,
|
|
19
|
-
size,
|
|
20
12
|
radius,
|
|
21
|
-
placeholder = "gravity-ui:person"
|
|
13
|
+
placeholder = "gravity-ui:person",
|
|
14
|
+
...props
|
|
22
15
|
} = defineProps({
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
radius: { type: [String, Number, Object], required: false },
|
|
17
|
+
size: { type: [String, Object], required: false },
|
|
25
18
|
color: { type: null, required: false },
|
|
26
19
|
gradient: { type: Object, required: false },
|
|
27
20
|
src: { type: [String, null], required: false },
|
|
@@ -30,32 +23,39 @@ const {
|
|
|
30
23
|
allowedInitialsColors: { type: Array, required: false },
|
|
31
24
|
placeholder: { type: String, required: false },
|
|
32
25
|
variant: { type: String, required: false },
|
|
26
|
+
classes: { type: Object, required: false },
|
|
33
27
|
is: { type: null, required: false },
|
|
34
28
|
mod: { type: [Object, Array, null], required: false }
|
|
35
29
|
});
|
|
36
30
|
const initials = computed(() => name && getInitials(name));
|
|
37
31
|
const ctx = useAvatarGroupState();
|
|
38
|
-
const style =
|
|
39
|
-
const
|
|
32
|
+
const style = useVarsResolver((theme) => {
|
|
33
|
+
const color = props.color === "initials" && typeof name === "string" ? getInitialsColor(name, props.allowedInitialsColors) : props.color;
|
|
40
34
|
const { background, text, border } = createVariantColorResolver({
|
|
41
|
-
color: _color || "gray",
|
|
42
35
|
theme,
|
|
43
|
-
gradient,
|
|
44
|
-
|
|
36
|
+
gradient: props.gradient,
|
|
37
|
+
color: color || "gray",
|
|
38
|
+
variant: props.variant || "light"
|
|
45
39
|
});
|
|
46
40
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
root: {
|
|
42
|
+
"--avatar-size": getSize(props.size, "avatar-size"),
|
|
43
|
+
"--avatar-radius": radius === void 0 ? void 0 : getRadius(radius),
|
|
44
|
+
"--avatar-bg": color || props.variant ? background : void 0,
|
|
45
|
+
"--avatar-color": color || props.variant ? text : void 0,
|
|
46
|
+
"--avatar-bd": color || props.variant ? border : void 0
|
|
47
|
+
}
|
|
52
48
|
};
|
|
53
|
-
})
|
|
49
|
+
});
|
|
54
50
|
</script>
|
|
55
51
|
|
|
56
52
|
<template>
|
|
57
|
-
<Box
|
|
58
|
-
|
|
53
|
+
<Box
|
|
54
|
+
:style='style.root'
|
|
55
|
+
:class='[css.root, classes?.root]'
|
|
56
|
+
:mod='[{ "within-group": ctx?.withinGroup }, mod]'
|
|
57
|
+
>
|
|
58
|
+
<span v-if='!src' :class='[css.placeholder, classes?.placeholder]' :title='alt'>
|
|
59
59
|
<slot>
|
|
60
60
|
<Icon v-if='!src && !name' :name='placeholder' />
|
|
61
61
|
{{ initials }}
|
|
@@ -65,7 +65,7 @@ const style = computed(() => useStyleResolver((theme) => {
|
|
|
65
65
|
v-else
|
|
66
66
|
:src
|
|
67
67
|
:alt
|
|
68
|
-
:class='css.image'
|
|
68
|
+
:class='[css.image, classes?.image]'
|
|
69
69
|
/>
|
|
70
70
|
</Box>
|
|
71
71
|
</template>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { BoxProps } from '@nui/components';
|
|
2
|
-
import type { NuanceColor, NuanceGradient, NuanceRadius, NuanceSize } from '@nui/types';
|
|
2
|
+
import type { AnyString, Classes, NuanceColor, NuanceGradient, NuanceRadius, NuanceSize } from '@nui/types';
|
|
3
|
+
type AvatarVariant = 'filled' | 'light' | 'gradient' | 'outline' | 'default';
|
|
4
|
+
type AvatarClasses = 'root' | 'placeholder' | 'image';
|
|
3
5
|
export interface AvatarProps extends BoxProps {
|
|
4
|
-
/** Component size */
|
|
5
|
-
size?: NuanceSize | string;
|
|
6
6
|
/** Border radius */
|
|
7
|
-
radius?: NuanceRadius;
|
|
7
|
+
radius?: NuanceRadius | AnyString;
|
|
8
|
+
/** Component size */
|
|
9
|
+
size?: NuanceSize | AnyString;
|
|
8
10
|
/** Color from theme. Pass `'initials'` to derive the color from the user's name. */
|
|
9
11
|
color?: NuanceColor | 'initials';
|
|
10
12
|
/** Gradient configuration (used with `variant="gradient"`) */
|
|
@@ -23,7 +25,9 @@ export interface AvatarProps extends BoxProps {
|
|
|
23
25
|
*/
|
|
24
26
|
placeholder?: string;
|
|
25
27
|
/** Visual variant */
|
|
26
|
-
variant?:
|
|
28
|
+
variant?: AvatarVariant;
|
|
29
|
+
/** Styles API */
|
|
30
|
+
classes?: Classes<AvatarClasses>;
|
|
27
31
|
}
|
|
28
32
|
declare var __VLS_8: {};
|
|
29
33
|
type __VLS_Slots = {} & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { NuanceRadius } from '@nui/types';
|
|
1
|
+
import type { AnyString, NuanceRadius } from '@nui/types';
|
|
2
2
|
import type { BoxProps } from './box.vue.js';
|
|
3
3
|
export interface BackgroundImageProps extends BoxProps {
|
|
4
4
|
/** Border radius */
|
|
5
|
-
radius?: NuanceRadius |
|
|
5
|
+
radius?: NuanceRadius | AnyString;
|
|
6
6
|
/** Image URL */
|
|
7
7
|
src: string;
|
|
8
8
|
}
|
|
@@ -3,7 +3,7 @@ import { getRadius } from "@nui/utils";
|
|
|
3
3
|
import { computed } from "vue";
|
|
4
4
|
import Box from "./box.vue";
|
|
5
5
|
const { radius, src, ...rest } = defineProps({
|
|
6
|
-
radius: { type: [String, Number], required: false },
|
|
6
|
+
radius: { type: [String, Number, Object], required: false },
|
|
7
7
|
src: { type: String, required: true },
|
|
8
8
|
is: { type: null, required: false },
|
|
9
9
|
mod: { type: [Object, Array, null], required: false }
|
|
@@ -18,22 +18,6 @@ const style = computed(() => ({
|
|
|
18
18
|
<Box :style :class='$style.root' v-bind='rest' />
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
|
-
<style module
|
|
22
|
-
.root
|
|
23
|
-
--bi-radius: 0rem;
|
|
24
|
-
|
|
25
|
-
position: absolute;
|
|
26
|
-
inset: 0;
|
|
27
|
-
|
|
28
|
-
display: block;
|
|
29
|
-
|
|
30
|
-
width: 100%;
|
|
31
|
-
border: 0;
|
|
32
|
-
border-radius: var(--bi-radius, 0);
|
|
33
|
-
|
|
34
|
-
text-decoration: none;
|
|
35
|
-
|
|
36
|
-
background-position: center;
|
|
37
|
-
background-size: cover;
|
|
38
|
-
}
|
|
21
|
+
<style module>
|
|
22
|
+
.root{--bi-radius:0rem;background-position:50%;background-size:cover;border:0;border-radius:var(--bi-radius,0);display:block;inset:0;position:absolute;text-decoration:none;width:100%}
|
|
39
23
|
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { NuanceRadius } from '@nui/types';
|
|
1
|
+
import type { AnyString, NuanceRadius } from '@nui/types';
|
|
2
2
|
import type { BoxProps } from './box.vue.js';
|
|
3
3
|
export interface BackgroundImageProps extends BoxProps {
|
|
4
4
|
/** Border radius */
|
|
5
|
-
radius?: NuanceRadius |
|
|
5
|
+
radius?: NuanceRadius | AnyString;
|
|
6
6
|
/** Image URL */
|
|
7
7
|
src: string;
|
|
8
8
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import type { NuanceColor, NuanceGradient, NuanceRadius, NuanceSize } from '@nui/types';
|
|
1
|
+
import type { AnyString, NuanceColor, NuanceGradient, NuanceRadius, NuanceSize } from '@nui/types';
|
|
2
2
|
import type { BoxProps } from './box.vue.js';
|
|
3
|
+
export type BadgeVariant = 'filled' | 'light' | 'outline' | 'dot' | 'default' | 'gradient';
|
|
4
|
+
export interface BadgeVars {
|
|
5
|
+
root: '--badge-height' | '--badge-padding-x' | '--badge-fz' | '--badge-radius' | '--badge-bg' | '--badge-color' | '--badge-bd' | '--badge-dot-color';
|
|
6
|
+
}
|
|
3
7
|
export interface BadgeProps extends BoxProps {
|
|
4
|
-
/**
|
|
5
|
-
* Visual variant
|
|
6
|
-
* @default `'filled'`
|
|
7
|
-
*/
|
|
8
|
-
variant?: 'filled' | 'light' | 'outline' | 'dot' | 'default' | 'gradient';
|
|
9
8
|
/**
|
|
10
9
|
* Component size
|
|
11
10
|
* @default `'md'`
|
|
12
11
|
*/
|
|
13
|
-
size?: NuanceSize |
|
|
12
|
+
size?: NuanceSize | AnyString;
|
|
14
13
|
/** Makes the badge width equal to its height and removes horizontal padding */
|
|
15
14
|
circle?: boolean;
|
|
16
15
|
/**
|
|
@@ -19,7 +18,7 @@ export interface BadgeProps extends BoxProps {
|
|
|
19
18
|
*/
|
|
20
19
|
radius?: NuanceRadius;
|
|
21
20
|
/** Color from theme */
|
|
22
|
-
color?: NuanceColor |
|
|
21
|
+
color?: NuanceColor | AnyString;
|
|
23
22
|
/** Gradient configuration (used with `variant="gradient"`) */
|
|
24
23
|
gradient?: NuanceGradient;
|
|
25
24
|
/**
|
|
@@ -29,6 +28,8 @@ export interface BadgeProps extends BoxProps {
|
|
|
29
28
|
fullWidth?: boolean;
|
|
30
29
|
/** Icon displayed before the label */
|
|
31
30
|
icon?: string;
|
|
31
|
+
/** Visual variant */
|
|
32
|
+
variant?: BadgeVariant;
|
|
32
33
|
}
|
|
33
34
|
declare var __VLS_8: {}, __VLS_15: {}, __VLS_17: {};
|
|
34
35
|
type __VLS_Slots = {} & {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useVarsResolver } from "@nui/composables";
|
|
3
3
|
import { createVariantColorResolver, getRadius, getSize, getThemeColor } from "@nui/utils";
|
|
4
|
-
import { computed } from "vue";
|
|
5
4
|
import Box from "./box.vue";
|
|
6
5
|
const {
|
|
7
6
|
variant = "filled",
|
|
@@ -12,39 +11,41 @@ const {
|
|
|
12
11
|
circle,
|
|
13
12
|
icon
|
|
14
13
|
} = defineProps({
|
|
15
|
-
|
|
16
|
-
size: { type: String, required: false },
|
|
14
|
+
size: { type: [String, Object], required: false },
|
|
17
15
|
circle: { type: Boolean, required: false },
|
|
18
16
|
radius: { type: [String, Number], required: false },
|
|
19
17
|
color: { type: null, required: false },
|
|
20
18
|
gradient: { type: Object, required: false },
|
|
21
19
|
fullWidth: { type: Boolean, required: false },
|
|
22
20
|
icon: { type: String, required: false },
|
|
21
|
+
variant: { type: String, required: false },
|
|
23
22
|
is: { type: null, required: false },
|
|
24
23
|
mod: { type: [Object, Array, null], required: false }
|
|
25
24
|
});
|
|
26
|
-
const style =
|
|
25
|
+
const style = useVarsResolver((theme) => {
|
|
27
26
|
const { background, border, text } = createVariantColorResolver({
|
|
28
27
|
theme,
|
|
29
28
|
variant: variant === "dot" ? "default" : variant,
|
|
30
29
|
color
|
|
31
30
|
});
|
|
32
31
|
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
root: {
|
|
33
|
+
"--badge-height": getSize(size, "badge-height"),
|
|
34
|
+
"--badge-padding-x": getSize(size, "badge-padding-x"),
|
|
35
|
+
"--badge-fz": getSize(size, "badge-fz"),
|
|
36
|
+
"--badge-radius": circle || radius === void 0 ? void 0 : getRadius(radius),
|
|
37
|
+
"--badge-bg": color || variant ? background : void 0,
|
|
38
|
+
"--badge-color": color || variant ? text : void 0,
|
|
39
|
+
"--badge-bd": color || variant ? border : void 0,
|
|
40
|
+
"--badge-dot-color": variant === "dot" ? getThemeColor(color, theme) : void 0
|
|
41
|
+
}
|
|
41
42
|
};
|
|
42
|
-
})
|
|
43
|
+
});
|
|
43
44
|
</script>
|
|
44
45
|
|
|
45
46
|
<template>
|
|
46
47
|
<Box
|
|
47
|
-
:style
|
|
48
|
+
:style='style.root'
|
|
48
49
|
:class='$style.root'
|
|
49
50
|
:mod='[
|
|
50
51
|
{
|
|
@@ -75,143 +76,6 @@ const style = computed(() => useStyleResolver((theme) => {
|
|
|
75
76
|
</Box>
|
|
76
77
|
</template>
|
|
77
78
|
|
|
78
|
-
<style
|
|
79
|
-
.root {
|
|
80
|
-
--badge-height-xs: rem(16px);
|
|
81
|
-
--badge-height-sm: rem(18px);
|
|
82
|
-
--badge-height-md: rem(20px);
|
|
83
|
-
--badge-height-lg: rem(26px);
|
|
84
|
-
--badge-height-xl: rem(32px);
|
|
85
|
-
|
|
86
|
-
--badge-fz-xs: rem(8px);
|
|
87
|
-
--badge-fz-sm: rem(10px);
|
|
88
|
-
--badge-fz-md: rem(12px);
|
|
89
|
-
--badge-fz-lg: rem(14px);
|
|
90
|
-
--badge-fz-xl: rem(16px);
|
|
91
|
-
|
|
92
|
-
--badge-padding-x-xs: rem(6px);
|
|
93
|
-
--badge-padding-x-sm: rem(8px);
|
|
94
|
-
--badge-padding-x-md: rem(10px);
|
|
95
|
-
--badge-padding-x-lg: rem(12px);
|
|
96
|
-
--badge-padding-x-xl: rem(16px);
|
|
97
|
-
|
|
98
|
-
--badge-height: var(--badge-height-md);
|
|
99
|
-
--badge-fz: var(--badge-fz-md);
|
|
100
|
-
--badge-padding-x: var(--badge-padding-x-md);
|
|
101
|
-
--badge-radius: 100%;
|
|
102
|
-
--badge-lh: calc(var(--badge-height) - rem(2px));
|
|
103
|
-
--badge-color: var(--color-white);
|
|
104
|
-
--badge-bg: var(--color-primary-filled);
|
|
105
|
-
--badge-border-width: 1px;
|
|
106
|
-
--badge-bd: var(--badge-border-width) solid transparent;
|
|
107
|
-
|
|
108
|
-
cursor: default;
|
|
109
|
-
|
|
110
|
-
overflow: hidden;
|
|
111
|
-
display: inline-grid;
|
|
112
|
-
align-items: center;
|
|
113
|
-
justify-content: center;
|
|
114
|
-
|
|
115
|
-
width: fit-content;
|
|
116
|
-
height: var(--badge-height);
|
|
117
|
-
padding: 0 var(--badge-padding-x);
|
|
118
|
-
border: var(--badge-bd);
|
|
119
|
-
border-radius: var(--badge-radius);
|
|
120
|
-
|
|
121
|
-
font-size: var(--badge-fz);
|
|
122
|
-
font-weight: 700;
|
|
123
|
-
line-height: var(--badge-lh);
|
|
124
|
-
color: var(--badge-color);
|
|
125
|
-
text-decoration: none;
|
|
126
|
-
text-overflow: ellipsis;
|
|
127
|
-
text-transform: uppercase;
|
|
128
|
-
letter-spacing: 0.25px;
|
|
129
|
-
|
|
130
|
-
background: var(--badge-bg);
|
|
131
|
-
|
|
132
|
-
-webkit-tap-highlight-color: transparent;
|
|
133
|
-
|
|
134
|
-
&:where([data-with-left-section], [data-variant='dot']) {
|
|
135
|
-
grid-template-columns: auto 1fr;
|
|
136
|
-
|
|
137
|
-
padding-left: calc(var(--badge-padding-x) - calc(var(--spacing-xs) / 2));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
&:where([data-with-right-section]) {
|
|
141
|
-
grid-template-columns: 1fr auto;
|
|
142
|
-
|
|
143
|
-
padding-right: calc(var(--badge-padding-x) - calc(var(--spacing-xs) / 2));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
&:where([data-with-left-section][data-with-right-section],
|
|
147
|
-
[data-variant='dot'][data-with-right-section]) {
|
|
148
|
-
grid-template-columns: auto 1fr auto;
|
|
149
|
-
|
|
150
|
-
padding: 0 calc(var(--spacing-xs) / 2);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
&:where([data-block]) {
|
|
154
|
-
display: flex;
|
|
155
|
-
|
|
156
|
-
width: 100%;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
&:where([data-circle]) {
|
|
160
|
-
display: flex;
|
|
161
|
-
|
|
162
|
-
width: var(--badge-height);
|
|
163
|
-
padding-inline: 2px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&:where([data-variant='dot']) {
|
|
167
|
-
@mixin where-light {
|
|
168
|
-
--badge-color: var(--color-black);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@mixin where-dark {
|
|
172
|
-
--badge-color: var(--color-white);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.dot {
|
|
178
|
-
--badge-dot-size: calc(var(--badge-height) / 2);
|
|
179
|
-
|
|
180
|
-
display: block;
|
|
181
|
-
|
|
182
|
-
width: var(--badge-dot-size);
|
|
183
|
-
height: var(--badge-dot-size);
|
|
184
|
-
margin-inline-end: calc(var(--badge-dot-size) / 2);
|
|
185
|
-
border-radius: var(--badge-dot-size);
|
|
186
|
-
|
|
187
|
-
background-color: var(--badge-dot-color, var(--badge-color));
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.label {
|
|
191
|
-
cursor: inherit;
|
|
192
|
-
|
|
193
|
-
overflow: hidden;
|
|
194
|
-
|
|
195
|
-
text-align: center;
|
|
196
|
-
text-overflow: ellipsis;
|
|
197
|
-
white-space: nowrap;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.section {
|
|
201
|
-
--badge-section-margin: calc(var(--spacing-xs) / 2);
|
|
202
|
-
|
|
203
|
-
display: inline-flex;
|
|
204
|
-
align-items: center;
|
|
205
|
-
justify-content: center;
|
|
206
|
-
|
|
207
|
-
max-height: calc(var(--badge-height) - var(--badge-border-width) * 2);
|
|
208
|
-
|
|
209
|
-
&:where([data-position='left']) {
|
|
210
|
-
margin-inline-end: var(--badge-section-margin);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
&:where([data-position='right']) {
|
|
214
|
-
margin-inline-start: var(--badge-section-margin);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
79
|
+
<style module>
|
|
80
|
+
.root{--badge-height-xs:rem(16px);--badge-height-sm:rem(18px);--badge-height-md:rem(20px);--badge-height-lg:rem(26px);--badge-height-xl:rem(32px);--badge-fz-xs:rem(8px);--badge-fz-sm:rem(10px);--badge-fz-md:rem(12px);--badge-fz-lg:rem(14px);--badge-fz-xl:rem(16px);--badge-padding-x-xs:rem(6px);--badge-padding-x-sm:rem(8px);--badge-padding-x-md:rem(10px);--badge-padding-x-lg:rem(12px);--badge-padding-x-xl:rem(16px);--badge-height:var(--badge-height-md);--badge-fz:var(--badge-fz-md);--badge-padding-x:var(--badge-padding-x-md);--badge-radius:100%;--badge-lh:calc(var(--badge-height) - rem(2px));--badge-color:var(--color-white);--badge-bg:var(--color-primary-filled);--badge-border-width:1px;--badge-bd:var(--badge-border-width) solid transparent;align-items:center;background:var(--badge-bg);border:var(--badge-bd);border-radius:var(--badge-radius);color:var(--badge-color);cursor:default;display:inline-grid;font-size:var(--badge-fz);font-weight:700;height:var(--badge-height);justify-content:center;letter-spacing:.25px;line-height:var(--badge-lh);overflow:hidden;padding:0 var(--badge-padding-x);text-decoration:none;text-overflow:ellipsis;text-transform:uppercase;width:-moz-fit-content;width:fit-content;-webkit-tap-highlight-color:transparent}.root:where([data-with-left-section],[data-variant=dot]){grid-template-columns:auto 1fr;padding-left:calc(var(--badge-padding-x) - var(--spacing-xs)/2)}.root:where([data-with-right-section]){grid-template-columns:1fr auto;padding-right:calc(var(--badge-padding-x) - var(--spacing-xs)/2)}.root:where([data-with-left-section][data-with-right-section],[data-variant=dot][data-with-right-section]){grid-template-columns:auto 1fr auto;padding:0 calc(var(--spacing-xs)/2)}.root:where([data-block]){display:flex;width:100%}.root:where([data-circle]){display:flex;padding-inline:2px;width:var(--badge-height)}.root:where([data-variant=dot]){@mixin where-light{--badge-color:var(--color-black)}@mixin where-dark{--badge-color:var(--color-white)}}.dot{--badge-dot-size:calc(var(--badge-height)/2);background-color:var(--badge-dot-color,var(--badge-color));border-radius:var(--badge-dot-size);display:block;height:var(--badge-dot-size);margin-inline-end:calc(var(--badge-dot-size)/2);width:var(--badge-dot-size)}.label{cursor:inherit;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap}.section{--badge-section-margin:calc(var(--spacing-xs)/2);align-items:center;display:inline-flex;justify-content:center;max-height:calc(var(--badge-height) - var(--badge-border-width)*2)}.section:where([data-position=left]){margin-inline-end:var(--badge-section-margin)}.section:where([data-position=right]){margin-inline-start:var(--badge-section-margin)}
|
|
217
81
|
</style>
|