nuance-ui 0.2.33 → 0.2.34

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0"
6
6
  },
7
- "version": "0.2.33",
7
+ "version": "0.2.34",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -1,9 +1,9 @@
1
- import type { Classes, NuanceColor, NuanceRadius } from '@nui/types';
1
+ import type { Classes, NuanceColor, NuanceRadius, NuanceSize } from '@nui/types';
2
2
  import type { BoxProps } from './box.vue.js';
3
3
  export type AlertClasses = 'root' | 'icon' | 'body' | 'title' | 'label' | 'message' | 'closeButton';
4
- export type AlertVariant = 'filled' | 'light' | 'outline' | 'default';
4
+ export type AlertVariant = 'filled' | 'light' | 'outline' | 'light-outline' | 'default';
5
5
  export interface AlertVars {
6
- root: '--alert-radius' | '--alert-bg' | '--alert-color' | '--alert-bd';
6
+ root: '--alert-radius' | '--alert-bg' | '--alert-color' | '--alert-bd' | '--alert-font-size';
7
7
  }
8
8
  export interface AlertProps extends BoxProps {
9
9
  /** Border radius */
@@ -20,6 +20,8 @@ export interface AlertProps extends BoxProps {
20
20
  onClose?: () => void;
21
21
  /** `aria-label` for the close button */
22
22
  closeButtonLabel?: string;
23
+ /** Component size */
24
+ size?: NuanceSize;
23
25
  /** Visual variant */
24
26
  variant?: AlertVariant;
25
27
  /** Styles API */
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { useConfig, useVarsResolver } from "@nui/composables";
3
- import { getRadius } from "@nui/utils";
3
+ import { getFontSize, getRadius } from "@nui/utils";
4
4
  import { useId } from "vue";
5
5
  import ActionIcon from "./action-icon/action-icon.vue";
6
6
  import Box from "./box.vue";
@@ -10,6 +10,7 @@ const {
10
10
  color,
11
11
  title,
12
12
  radius,
13
+ size = "md",
13
14
  variant = "light",
14
15
  withCloseButton,
15
16
  classes
@@ -21,6 +22,7 @@ const {
21
22
  withCloseButton: { type: Boolean, required: false },
22
23
  onClose: { type: Function, required: false },
23
24
  closeButtonLabel: { type: String, required: false },
25
+ size: { type: String, required: false },
24
26
  variant: { type: String, required: false },
25
27
  classes: { type: Object, required: false },
26
28
  is: { type: null, required: false },
@@ -36,7 +38,8 @@ const style = useVarsResolver((theme) => {
36
38
  "--alert-radius": radius === void 0 ? void 0 : getRadius(radius),
37
39
  "--alert-bg": color || variant ? background : void 0,
38
40
  "--alert-color": text,
39
- "--alert-bd": color || variant ? border : void 0
41
+ "--alert-bd": color || variant ? border : void 0,
42
+ "--alert-font-size": getFontSize(size)
40
43
  }
41
44
  };
42
45
  });
@@ -89,5 +92,5 @@ const style = useVarsResolver((theme) => {
89
92
  </template>
90
93
 
91
94
  <style module>
92
- .root{--alert-radius:var(--radius-default);--alert-bg:var(--color-primary-light);--alert-bd:1px solid transparent;--alert-color:var(--color-primary-light-color);background-color:var(--alert-bg);border:var(--alert-bd);border-radius:var(--alert-radius);color:var(--alert-color);gap:var(--spacing-sm);overflow:hidden;padding:var(--spacing-sm);position:relative}.body,.root{display:flex}.body{flex:1;flex-direction:column;gap:var(--spacing-xs)}.title{align-items:center;display:flex;font-size:var(--font-size-md);font-weight:700;justify-content:space-between}.label{display:block;overflow:hidden;text-overflow:ellipsis}.icon{align-items:center;display:flex;height:1.25rem;justify-content:flex-start;line-height:1;margin-top:1px;width:1.25rem}.message{font-size:var(--font-size-md);overflow:hidden;text-overflow:ellipsis}:where([data-mantine-color-scheme=light]) .message{color:var(--color-black)}:where([data-mantine-color-scheme=dark]) .message{color:var(--color-white)}.message:where([data-variant=filled]){color:var(--alert-color)}.message:where([data-variant=white]){color:var(--color-black)}.closeButton{color:var(--alert-color);height:20px;width:20px}
95
+ .root{--alert-radius:var(--radius-default);--alert-bg:var(--color-primary-light);--alert-bd:1px solid transparent;--alert-color:var(--color-primary-light-color);background-color:var(--alert-bg);border:var(--alert-bd);border-radius:var(--alert-radius);color:var(--alert-color);gap:var(--spacing-xs);overflow:hidden;padding:var(--spacing-sm);position:relative}.body,.root{display:flex}.body{flex:1;flex-direction:column}.title{align-items:center;display:flex;font-size:var(--alert-font-size,var(--font-size-md));font-weight:700;justify-content:space-between}.label{display:block;overflow:hidden;text-overflow:ellipsis}.icon{align-items:center;display:flex;font-size:var(--alert-font-size);height:calc(var(--alert-font-size)*1.3);justify-content:flex-start;line-height:1;margin-top:1px;width:calc(var(--alert-font-size)*1.3)}.message{font-size:var(--alert-font-size,var(--font-size-md));overflow:hidden;text-overflow:ellipsis}:where([data-mantine-color-scheme=light]) .message{color:var(--color-black)}:where([data-mantine-color-scheme=dark]) .message{color:var(--color-white)}.message:where([data-variant=filled]){color:var(--alert-color)}.message:where([data-variant=white]){color:var(--color-black)}.closeButton{color:var(--alert-color);height:20px;width:20px}
93
96
  </style>
@@ -1,9 +1,9 @@
1
- import type { Classes, NuanceColor, NuanceRadius } from '@nui/types';
1
+ import type { Classes, NuanceColor, NuanceRadius, NuanceSize } from '@nui/types';
2
2
  import type { BoxProps } from './box.vue.js';
3
3
  export type AlertClasses = 'root' | 'icon' | 'body' | 'title' | 'label' | 'message' | 'closeButton';
4
- export type AlertVariant = 'filled' | 'light' | 'outline' | 'default';
4
+ export type AlertVariant = 'filled' | 'light' | 'outline' | 'light-outline' | 'default';
5
5
  export interface AlertVars {
6
- root: '--alert-radius' | '--alert-bg' | '--alert-color' | '--alert-bd';
6
+ root: '--alert-radius' | '--alert-bg' | '--alert-color' | '--alert-bd' | '--alert-font-size';
7
7
  }
8
8
  export interface AlertProps extends BoxProps {
9
9
  /** Border radius */
@@ -20,6 +20,8 @@ export interface AlertProps extends BoxProps {
20
20
  onClose?: () => void;
21
21
  /** `aria-label` for the close button */
22
22
  closeButtonLabel?: string;
23
+ /** Component size */
24
+ size?: NuanceSize;
23
25
  /** Visual variant */
24
26
  variant?: AlertVariant;
25
27
  /** Styles API */
@@ -11,6 +11,7 @@ const { size = "md", lh = "1", ...props } = defineProps({
11
11
  inherit: { type: Boolean, required: false },
12
12
  gradient: { type: Object, required: false },
13
13
  fz: { type: null, required: false },
14
+ ff: { type: [String, Object], required: false },
14
15
  lh: { type: [String, Object], required: false },
15
16
  fw: { type: void 0, required: false },
16
17
  c: { type: null, required: false },
@@ -0,0 +1,40 @@
1
+ import type { AnyString, NuanceColor, NuanceSize } from '@nui/types';
2
+ import type { BoxProps } from './box.vue.js';
3
+ export type DividerVariant = 'solid' | 'dashed' | 'dotted';
4
+ export interface DividerVars {
5
+ root: '--divider-color' | '--divider-border-style' | '--divider-size';
6
+ }
7
+ export interface DividerProps extends BoxProps {
8
+ /** Color from theme */
9
+ color?: NuanceColor | AnyString;
10
+ /**
11
+ * Controls width/height depending on orientation
12
+ * @default `'xs'`
13
+ */
14
+ size?: NuanceSize | AnyString;
15
+ /**
16
+ * Label position
17
+ * @default `'center'`
18
+ */
19
+ labelPosition?: 'left' | 'center' | 'right';
20
+ /**
21
+ * Divider orientation
22
+ * @default `'horizontal'`
23
+ */
24
+ orientation?: 'horizontal' | 'vertical';
25
+ /** Visual variant */
26
+ variant?: DividerVariant;
27
+ }
28
+ declare var __VLS_14: {};
29
+ type __VLS_Slots = {} & {
30
+ default?: (props: typeof __VLS_14) => any;
31
+ };
32
+ declare const __VLS_base: import("vue").DefineComponent<DividerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DividerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,49 @@
1
+ <script setup>
2
+ import { useVarsResolver } from "@nui/composables";
3
+ import { getSize, getThemeColor } from "@nui/utils";
4
+ import Box from "./box.vue";
5
+ const {
6
+ color,
7
+ size,
8
+ labelPosition = "center",
9
+ orientation = "horizontal",
10
+ variant
11
+ } = defineProps({
12
+ color: { type: null, required: false },
13
+ size: { type: [String, Object], required: false },
14
+ labelPosition: { type: String, required: false },
15
+ orientation: { type: String, required: false },
16
+ variant: { type: String, required: false },
17
+ is: { type: null, required: false },
18
+ mod: { type: [Object, Array, null], required: false }
19
+ });
20
+ const style = useVarsResolver((theme) => ({
21
+ root: {
22
+ "--divider-color": color ? getThemeColor(color, theme) : void 0,
23
+ "--divider-border-style": variant,
24
+ "--divider-size": getSize(size, "divider-size")
25
+ }
26
+ }));
27
+ </script>
28
+
29
+ <template>
30
+ <Box
31
+ role='separator'
32
+ :style='style.root'
33
+ :class='$style.root'
34
+ :mod="[{ orientation, 'with-label': !!$slots.default }, mod]"
35
+ >
36
+ <Box
37
+ is='span'
38
+ v-if='$slots.default'
39
+ :class='$style.label'
40
+ :mod='{ position: labelPosition }'
41
+ >
42
+ <slot />
43
+ </Box>
44
+ </Box>
45
+ </template>
46
+
47
+ <style module>
48
+ .root{--divider-size-xs:1px;--divider-size-sm:2px;--divider-size-md:3px;--divider-size-lg:4px;--divider-size-xl:5px;--divider-size:var(--divider-size-xs);@mixin where-light{--divider-color:var(--color-gray-3)}@mixin where-dark{--divider-color:var(--color-dark-4)}}.root:where([data-orientation=horizontal]){border-top:var(--divider-size) var(--divider-border-style,solid) var(--divider-color)}.root:where([data-orientation=vertical]){align-self:stretch;border-inline-start:var(--divider-size) var(--divider-border-style,solid) var(--divider-color);height:auto}.root:where([data-with-label]){border:0}.label{align-items:center;color:var(--color-dimmed);display:flex;font-size:var(--font-size-xs);white-space:nowrap}.label:where([data-position=left]):before{display:none}.label:where([data-position=right]):after{display:none}.label:before{margin-inline-end:var(--spacing-xs)}.label:after,.label:before{border-top:var(--divider-size) var(--divider-border-style,solid) var(--divider-color);content:"";flex:1;height:1px}.label:after{margin-inline-start:var(--spacing-xs)}
49
+ </style>
@@ -0,0 +1,40 @@
1
+ import type { AnyString, NuanceColor, NuanceSize } from '@nui/types';
2
+ import type { BoxProps } from './box.vue.js';
3
+ export type DividerVariant = 'solid' | 'dashed' | 'dotted';
4
+ export interface DividerVars {
5
+ root: '--divider-color' | '--divider-border-style' | '--divider-size';
6
+ }
7
+ export interface DividerProps extends BoxProps {
8
+ /** Color from theme */
9
+ color?: NuanceColor | AnyString;
10
+ /**
11
+ * Controls width/height depending on orientation
12
+ * @default `'xs'`
13
+ */
14
+ size?: NuanceSize | AnyString;
15
+ /**
16
+ * Label position
17
+ * @default `'center'`
18
+ */
19
+ labelPosition?: 'left' | 'center' | 'right';
20
+ /**
21
+ * Divider orientation
22
+ * @default `'horizontal'`
23
+ */
24
+ orientation?: 'horizontal' | 'vertical';
25
+ /** Visual variant */
26
+ variant?: DividerVariant;
27
+ }
28
+ declare var __VLS_14: {};
29
+ type __VLS_Slots = {} & {
30
+ default?: (props: typeof __VLS_14) => any;
31
+ };
32
+ declare const __VLS_base: import("vue").DefineComponent<DividerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DividerProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -10,6 +10,7 @@ const props = defineProps({
10
10
  inherit: { type: Boolean, required: false },
11
11
  gradient: { type: Object, required: false },
12
12
  fz: { type: null, required: false },
13
+ ff: { type: [String, Object], required: false },
13
14
  lh: { type: [String, Object], required: false },
14
15
  fw: { type: void 0, required: false },
15
16
  c: { type: null, required: false },
@@ -14,6 +14,7 @@ export * from './combobox/index.js';
14
14
  export type * from './container.vue';
15
15
  export type * from './date-time-picker.vue';
16
16
  export * from './dialog/index.js';
17
+ export type * from './divider.vue';
17
18
  export * from './drawer/index.js';
18
19
  export * from './files/index.js';
19
20
  export type * from './floating-indicator.vue';
@@ -27,6 +27,7 @@ const props = defineProps({
27
27
  inherit: { type: Boolean, required: false },
28
28
  gradient: { type: Object, required: false },
29
29
  fz: { type: null, required: false },
30
+ ff: { type: [String, Object], required: false },
30
31
  lh: { type: [String, Object], required: false },
31
32
  fw: { type: void 0, required: false },
32
33
  c: { type: null, required: false },
@@ -10,6 +10,7 @@ const props = defineProps({
10
10
  inherit: { type: Boolean, required: false },
11
11
  gradient: { type: Object, required: false },
12
12
  fz: { type: null, required: false },
13
+ ff: { type: [String, Object], required: false },
13
14
  lh: { type: [String, Object], required: false },
14
15
  fw: { type: void 0, required: false },
15
16
  c: { type: null, required: false },
@@ -19,6 +19,8 @@ export interface TextProps extends BoxProps {
19
19
  gradient?: NuanceGradient;
20
20
  /** Font size token */
21
21
  fz?: NuanceFontSize | `h${TitleOrder}` | AnyString;
22
+ /** Font family token @default 'text' */
23
+ ff?: 'mono' | 'headings' | 'text' | AnyString;
22
24
  /** Line height token */
23
25
  lh?: NuanceSize | AnyString;
24
26
  /** Font weight */
@@ -13,6 +13,7 @@ const {
13
13
  variant,
14
14
  gradient,
15
15
  fz,
16
+ ff,
16
17
  fw,
17
18
  lh,
18
19
  c,
@@ -26,6 +27,7 @@ const {
26
27
  inherit: { type: Boolean, required: false },
27
28
  gradient: { type: Object, required: false },
28
29
  fz: { type: null, required: false },
30
+ ff: { type: [String, Object], required: false },
29
31
  lh: { type: [String, Object], required: false },
30
32
  fw: { type: void 0, required: false },
31
33
  c: { type: null, required: false },
@@ -43,6 +45,7 @@ const _mod = computed(() => [{
43
45
  const style = useVarsResolver((theme) => ({
44
46
  root: {
45
47
  "--text-fz": getFontSize(fz || size),
48
+ "--text-ff": ff ? `var(--font-family${ff === "text" ? "" : ff})` : void 0,
46
49
  "--text-fw": fw?.toString(),
47
50
  "--text-lh": getLineHeight(lh || size),
48
51
  "--text-gradient": variant === "gradient" ? getGradient(gradient, theme) : void 0,
@@ -59,5 +62,5 @@ const style = useVarsResolver((theme) => ({
59
62
  </template>
60
63
 
61
64
  <style module>
62
- .root{--text-fz:var(--font-size-md);--text-lh:var(--line-height-md);--text-color:inherit;--text-fw:normal;--text-gradient:none;--text-line-clamp:none;color:var(--text-color);font-size:var(--text-fz);font-weight:var(--text-fw);line-height:var(--text-lh);margin:0;padding:0;text-decoration:none;-webkit-tap-highlight-color:transparent}.root:where([data-truncate]){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.root:where([data-truncate=start]){direction:rtl;text-align:right;@mixin where-rtl{direction:ltr;text-align:left}}.root:where([data-variant=gradient]){-webkit-background-clip:text;background-clip:text;background-image:var(--text-gradient);-webkit-text-fill-color:transparent}.root:where([data-line-clamp]){display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--text-line-clamp);text-overflow:ellipsis}.root:where([data-inherit]){color:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}.root:where([data-inline]){line-height:1}
65
+ .root{--text-fz:var(--font-size-md);--text-lh:var(--line-height-md);--text-color:inherit;--text-fw:normal;--text-gradient:none;--text-line-clamp:none;color:var(--text-color);font-family:var(--text-ff,var(--font-family));font-size:var(--text-fz);font-weight:var(--text-fw);line-height:var(--text-lh);margin:0;padding:0;text-decoration:none;-webkit-tap-highlight-color:transparent}.root:where([data-truncate]){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.root:where([data-truncate=start]){direction:rtl;text-align:right;@mixin where-rtl{direction:ltr;text-align:left}}.root:where([data-variant=gradient]){-webkit-background-clip:text;background-clip:text;background-image:var(--text-gradient);-webkit-text-fill-color:transparent}.root:where([data-line-clamp]){display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--text-line-clamp);text-overflow:ellipsis}.root:where([data-inherit]){color:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}.root:where([data-inline]){line-height:1}
63
66
  </style>
@@ -19,6 +19,8 @@ export interface TextProps extends BoxProps {
19
19
  gradient?: NuanceGradient;
20
20
  /** Font size token */
21
21
  fz?: NuanceFontSize | `h${TitleOrder}` | AnyString;
22
+ /** Font family token @default 'text' */
23
+ ff?: 'mono' | 'headings' | 'text' | AnyString;
22
24
  /** Line height token */
23
25
  lh?: NuanceSize | AnyString;
24
26
  /** Font weight */
@@ -5,6 +5,7 @@ const {
5
5
  order = "2",
6
6
  textWrap,
7
7
  size,
8
+ ff = "headings",
8
9
  ...rest
9
10
  } = defineProps({
10
11
  order: { type: String, required: false },
@@ -16,6 +17,7 @@ const {
16
17
  inherit: { type: Boolean, required: false },
17
18
  gradient: { type: Object, required: false },
18
19
  fz: { type: null, required: false },
20
+ ff: { type: [String, Object], required: false },
19
21
  lh: { type: [String, Object], required: false },
20
22
  fw: { type: void 0, required: false },
21
23
  c: { type: null, required: false },
@@ -29,6 +31,7 @@ const style = computed(() => ({ "--title-text-wrap": textWrap }));
29
31
  <Text
30
32
  :is='`h${order}`'
31
33
  v-bind='rest'
34
+ :ff
32
35
  :size='size || `h${order}`'
33
36
  :class='$style.root'
34
37
  :style
@@ -1,7 +1,7 @@
1
1
  import type { AnyString, NuanceColor, NuanceGradient, NuanceTheme } from '@nui/types';
2
2
  export interface VariantColorResolverOptions {
3
3
  color: NuanceColor | AnyString | undefined;
4
- variant: 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient' | 'gradient-outline';
4
+ variant: 'filled' | 'light' | 'outline' | 'light-outline' | 'subtle' | 'default' | 'gradient' | 'gradient-outline';
5
5
  gradient?: NuanceGradient;
6
6
  theme: NuanceTheme;
7
7
  }
@@ -57,6 +57,22 @@ export function createVariantColorResolver({
57
57
  border: `1px solid var(--color-${parsed.color}-${parsed.shade})`
58
58
  };
59
59
  }
60
+ if (variant === "light-outline") {
61
+ if (parsed.shade === void 0) {
62
+ return {
63
+ background: `var(--color-${color}-light)`,
64
+ hover: `var(--color-${color}-light-hover)`,
65
+ text: `var(--color-${color}-light-color)`,
66
+ border: `1px solid var(--color-${color}-outline)`
67
+ };
68
+ }
69
+ return {
70
+ background: `color-mix(var(--color-${parsed.color}-${parsed.shade}), .1)`,
71
+ hover: `color-mix(var(--color-${parsed.color}-${parsed.shade}), .12)`,
72
+ text: `var(--color-${parsed.color}-${Math.min(parsed.shade, 6)})`,
73
+ border: `1px solid var(--color-${parsed.color}-${parsed.shade})`
74
+ };
75
+ }
60
76
  if (variant === "subtle") {
61
77
  if (parsed.shade === void 0) {
62
78
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuance-ui",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
4
4
  "description": "A modern Vue UI library inspired by the best of the React ecosystem.",
5
5
  "repository": {
6
6
  "type": "git",