nuance-ui 0.2.36 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/module.d.mts +3 -0
  2. package/dist/module.d.ts +3 -0
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +5 -3
  5. package/dist/runtime/app-config.d.ts +4 -0
  6. package/dist/runtime/components/action-icon/action-icon.d.vue.ts +11 -1
  7. package/dist/runtime/components/action-icon/action-icon.module.css +1 -1
  8. package/dist/runtime/components/action-icon/action-icon.vue +20 -5
  9. package/dist/runtime/components/action-icon/action-icon.vue.d.ts +11 -1
  10. package/dist/runtime/components/button/button.d.vue.ts +8 -0
  11. package/dist/runtime/components/button/button.module.css +1 -1
  12. package/dist/runtime/components/button/button.vue +17 -4
  13. package/dist/runtime/components/button/button.vue.d.ts +8 -0
  14. package/dist/runtime/components/dialog/ui/dialog-close-button.vue +5 -0
  15. package/dist/runtime/components/drawer/drawer-close-button.vue +5 -0
  16. package/dist/runtime/components/files/file-upload-button.vue +4 -0
  17. package/dist/runtime/components/files/file-upload-icon.vue +5 -0
  18. package/dist/runtime/components/link/link-button.vue +4 -0
  19. package/dist/runtime/components/modal/modal-close-button.vue +5 -0
  20. package/dist/runtime/components/nav-link/nav-icon-link.d.vue.ts +5 -11
  21. package/dist/runtime/components/nav-link/nav-icon-link.vue +12 -8
  22. package/dist/runtime/components/nav-link/nav-icon-link.vue.d.ts +5 -11
  23. package/dist/runtime/components/table/ui/table-sortable-header.vue +4 -0
  24. package/dist/runtime/components/theme-toggle.vue +5 -0
  25. package/dist/runtime/composables/use-config.d.ts +1 -0
  26. package/dist/runtime/composables/use-config.js +2 -1
  27. package/dist/runtime/utils/const/active-variants.d.ts +11 -0
  28. package/dist/runtime/utils/const/active-variants.js +9 -0
  29. package/dist/runtime/utils/const/index.d.ts +1 -0
  30. package/dist/runtime/utils/const/index.js +1 -0
  31. package/package.json +2 -2
package/dist/module.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { NuanceDefaultThemeColor, NuanceGradient, NuanceIcons } from '../dist/runtime/types/index.js';
3
+ import { ActiveVariantsMap } from '../dist/runtime/utils/index.js';
3
4
 
4
5
  /** Primary color: a theme palette name or an array of 10 shade values (0..9). */
5
6
  type PrimaryColor = NuanceDefaultThemeColor | string[];
@@ -30,6 +31,8 @@ interface ModuleOptions {
30
31
  gradient?: NuanceGradient;
31
32
  /** Icon registry overrides */
32
33
  icons?: Partial<NuanceIcons>;
34
+ /** Variant an ActionIcon switches to when `active`, keyed by its base variant */
35
+ activeVariants?: Partial<ActiveVariantsMap>;
33
36
  }
34
37
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
35
38
 
package/dist/module.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { NuanceDefaultThemeColor, NuanceGradient, NuanceIcons } from '../dist/runtime/types/index.js';
3
+ import { ActiveVariantsMap } from '../dist/runtime/utils/index.js';
3
4
 
4
5
  /** Primary color: a theme palette name or an array of 10 shade values (0..9). */
5
6
  type PrimaryColor = NuanceDefaultThemeColor | string[];
@@ -30,6 +31,8 @@ interface ModuleOptions {
30
31
  gradient?: NuanceGradient;
31
32
  /** Icon registry overrides */
32
33
  icons?: Partial<NuanceIcons>;
34
+ /** Variant an ActionIcon switches to when `active`, keyed by its base variant */
35
+ activeVariants?: Partial<ActiveVariantsMap>;
33
36
  }
34
37
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
35
38
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.0.0"
6
6
  },
7
- "version": "0.2.36",
7
+ "version": "0.3.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineNuxtModule, createResolver, addTypeTemplate, addComponentsDir, addImportsDir, addTemplate } from '@nuxt/kit';
2
2
  import { defu } from 'defu';
3
- import { DEFAULT_ICONS, DEFAULT_GRADIENT } from '../dist/runtime/utils/index.js';
3
+ import { DEFAULT_ACTIVE_VARIANTS, DEFAULT_ICONS, DEFAULT_GRADIENT } from '../dist/runtime/utils/index.js';
4
4
 
5
5
  const SHADES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
6
6
  function fromName(name) {
@@ -73,7 +73,8 @@ const defaultConfig = {
73
73
  prefix: "N",
74
74
  primaryColor: "blue",
75
75
  gradient: DEFAULT_GRADIENT,
76
- icons: DEFAULT_ICONS
76
+ icons: DEFAULT_ICONS,
77
+ activeVariants: DEFAULT_ACTIVE_VARIANTS
77
78
  };
78
79
  const module$1 = defineNuxtModule({
79
80
  meta: {
@@ -114,7 +115,8 @@ const module$1 = defineNuxtModule({
114
115
  }
115
116
  nuxt.options.appConfig.nui = defu(nuxt.options.appConfig.nui, {
116
117
  gradient: options.gradient,
117
- icons: options.icons
118
+ icons: options.icons,
119
+ activeVariants: options.activeVariants
118
120
  });
119
121
  addTypeTemplate({
120
122
  filename: "types/nui-app-config.d.ts",
@@ -1,4 +1,5 @@
1
1
  import type { NuanceGradient, NuanceIcons } from './types'
2
+ import type { ActiveVariantsMap } from './utils'
2
3
 
3
4
 
4
5
  declare module '@nuxt/schema' {
@@ -8,6 +9,8 @@ declare module '@nuxt/schema' {
8
9
  gradient?: NuanceGradient
9
10
  /** Icon registry overrides */
10
11
  icons?: Partial<NuanceIcons>
12
+ /** Variant an ActionIcon switches to when `active`, keyed by its base variant */
13
+ activeVariants?: Partial<ActiveVariantsMap>
11
14
  }
12
15
  }
13
16
 
@@ -15,6 +18,7 @@ declare module '@nuxt/schema' {
15
18
  nui: {
16
19
  gradient: NuanceGradient
17
20
  icons: NuanceIcons
21
+ activeVariants: ActiveVariantsMap
18
22
  }
19
23
  }
20
24
  }
@@ -4,11 +4,13 @@ export type ActionIconClasses = 'root' | 'icon';
4
4
  export type ActionIconVariant = 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient';
5
5
  export type ActionIconSize = NuanceSize | `input-${NuanceSize}` | AnyString;
6
6
  export interface ActionIconVars {
7
- root: '--ai-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
7
+ root: '--ai-size' | '--ai-icon-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
8
8
  }
9
9
  export interface ActionIconProps {
10
10
  /** Component size @default 'md' */
11
11
  size?: ActionIconSize;
12
+ /** Icon size — `%` stays relative to the button, other values resolve via size tokens @default '70%' */
13
+ iconSize?: number | string;
12
14
  /** Gradient configuration (used with `variant="gradient"`) */
13
15
  gradient?: NuanceGradient;
14
16
  /** Color from theme */
@@ -25,6 +27,14 @@ export interface ActionIconProps {
25
27
  mod?: BoxProps['mod'];
26
28
  /** Visual variant */
27
29
  variant?: ActionIconVariant;
30
+ /** Active/pressed state — adds `data-active` and the matching ARIA attribute */
31
+ active?: boolean;
32
+ /** ARIA semantic for `active` @default 'pressed' */
33
+ activeMode?: 'pressed' | 'current';
34
+ /** Variant applied when `active`. Defaults to the configured map for the current `variant` */
35
+ activeVariant?: ActionIconVariant;
36
+ /** Color applied when `active` @default 'primary' */
37
+ activeColor?: NuanceColor;
28
38
  /** Styles API */
29
39
  classes?: Classes<ActionIconClasses>;
30
40
  }
@@ -1 +1 @@
1
- .root{--ai-size-xs:rem(26px);--ai-size-sm:rem(30px);--ai-size-md:rem(36px);--ai-size-lg:rem(42px);--ai-size-xl:rem(50px);--ai-size-input-xs:rem(30px);--ai-size-input-sm:rem(36px);--ai-size-input-md:rem(42px);--ai-size-input-lg:rem(50px);--ai-size-input-xl:rem(60px);--ai-size:var(--ai-size-sm);--ai-color:var(--color-white);--ai-radius:var(--radius-default);--ai-bg:var(--color-primary-filled);--ai-hover:var(--color-primary-filled-hover);align-items:center;background:var(--ai-bg,var(--color-primary-filled));border:var(--ai-bd,rem(1px) solid transparent);border-radius:var(--ai-radius,var(--radius-default));color:var(--ai-color,var(--color-white));cursor:pointer;display:inline-flex;height:var(--ai-size);justify-content:center;line-height:1;min-height:var(--ai-size);min-width:var(--ai-size);overflow:hidden;padding:0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ai-size)}.root[data-loading]{cursor:not-allowed}.root[data-loading] .icon{opacity:0;transform:translateY(100%)}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){border:1px solid transparent;cursor:not-allowed}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])):active{transform:none}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-light{background-color:var(--color-gray-1);color:var(--color-gray-5)}}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-dark{background-color:var(--color-dark-6);color:var(--color-dark-3)}}.root:hover:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--ai-hover);color:var(--ai-color)}.loader{align-items:center;border-radius:var(--ai-radius,var(--radius-default));display:flex;justify-content:center;left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2);@mixin where-light{background-color:hsla(0,0%,100%,.15)}@mixin where-dark{background-color:rgba(0,0,0,.15)}}.icon{align-items:center;display:flex;height:100%;justify-content:center;transition:transform .15s ease,opacity .1s ease;width:100%}.icon-element{height:70%;width:70%}.group{--ai-border-width:1px;display:flex}.group :where(*):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal] .groupSection:not(:only-child):first-child,.group[data-orientation=horizontal] .root:not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--ai-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):last-child,.group[data-orientation=horizontal] .root:not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--ai-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=horizontal] .root:not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--ai-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical] .groupSection:not(:only-child):first-child,.group[data-orientation=vertical] .root:not(:only-child):first-child{border-bottom-width:calc(var(--ai-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical] .groupSection:not(:only-child):last-child,.group[data-orientation=vertical] .root:not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.group[data-orientation=vertical] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=vertical] .root:not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--ai-border-width)/2);border-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.section{--section-height-xs:var(--ai-size-xs);--section-height-sm:var(--ai-size-sm);--section-height-md:var(--ai-size-md);--section-height-lg:var(--ai-size-lg);--section-height-xl:var(--ai-size-xl);--section-height-input-xs:var(--ai-size-input-xs);--section-height-input-sm:var(--ai-size-input-sm);--section-height-input-md:var(--ai-size-input-md);--section-height-input-lg:var(--ai-size-input-lg);--section-height-input-xl:var(--ai-size-input-xl);--section-padding-x-xs:rem(6px);--section-padding-x-sm:rem(8px);--section-padding-x-md:rem(10px);--section-padding-x-lg:rem(12px);--section-padding-x-xl:rem(16px);--section-height:var(--section-height-sm);--section-padding-x:var(--section-padding-x-sm);--section-color:var(--color-white);align-items:center;background:var(--section-bg,var(--color-primary-filled));border:var(--section-bd,rem(1px) solid transparent);border-radius:var(--section-radius,var(--radius-default));color:var(--section-color,var(--color-white));display:inline-flex;font-size:var(--section-fz,var(--font-size-md));font-weight:600;height:var(--section-height,var(--section-height-sm));justify-content:center;line-height:1;padding-inline:var(--section-padding-x,var(--section-padding-x-sm));vertical-align:middle;width:auto}
1
+ .root{--ai-size-xs:rem(26px);--ai-size-sm:rem(30px);--ai-size-md:rem(36px);--ai-size-lg:rem(42px);--ai-size-xl:rem(50px);--ai-size-input-xs:rem(30px);--ai-size-input-sm:rem(36px);--ai-size-input-md:rem(42px);--ai-size-input-lg:rem(50px);--ai-size-input-xl:rem(60px);--ai-size:var(--ai-size-sm);--ai-icon-size:70%;--ai-color:var(--color-white);--ai-radius:var(--radius-default);--ai-bg:var(--color-primary-filled);--ai-hover:var(--color-primary-filled-hover);align-items:center;background:var(--ai-bg,var(--color-primary-filled));border:var(--ai-bd,rem(1px) solid transparent);border-radius:var(--ai-radius,var(--radius-default));color:var(--ai-color,var(--color-white));cursor:pointer;display:inline-flex;height:var(--ai-size);justify-content:center;line-height:1;min-height:var(--ai-size);min-width:var(--ai-size);overflow:hidden;padding:0;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ai-size)}.root[data-loading]{cursor:not-allowed}.root[data-loading] .icon{opacity:0;transform:translateY(100%)}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){border:1px solid transparent;cursor:not-allowed}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])):active{transform:none}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-light{background-color:var(--color-gray-1);color:var(--color-gray-5)}}.root:where(:disabled:not([data-loading]),[data-disabled]:not([data-loading])){@mixin where-dark{background-color:var(--color-dark-6);color:var(--color-dark-3)}}.root:hover:where(:not([data-loading],:disabled,[data-disabled])){background-color:var(--ai-hover);color:var(--ai-color)}.loader{align-items:center;border-radius:var(--ai-radius,var(--radius-default));display:flex;justify-content:center;left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2);@mixin where-light{background-color:hsla(0,0%,100%,.15)}@mixin where-dark{background-color:rgba(0,0,0,.15)}}.icon{align-items:center;display:flex;height:100%;justify-content:center;transition:transform .15s ease,opacity .1s ease;width:100%}.icon-element{height:var(--ai-icon-size);width:var(--ai-icon-size)}.group{--ai-border-width:1px;display:flex}.group :where(*):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal] .groupSection:not(:only-child):first-child,.group[data-orientation=horizontal] .root:not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--ai-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):last-child,.group[data-orientation=horizontal] .root:not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--ai-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=horizontal] .root:not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--ai-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical] .groupSection:not(:only-child):first-child,.group[data-orientation=vertical] .root:not(:only-child):first-child{border-bottom-width:calc(var(--ai-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical] .groupSection:not(:only-child):last-child,.group[data-orientation=vertical] .root:not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.group[data-orientation=vertical] .groupSection:not(:only-child):not(:first-child):not(:last-child),.group[data-orientation=vertical] .root:not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--ai-border-width)/2);border-radius:0;border-top-width:calc(var(--ai-border-width)/2)}.section{--section-height-xs:var(--ai-size-xs);--section-height-sm:var(--ai-size-sm);--section-height-md:var(--ai-size-md);--section-height-lg:var(--ai-size-lg);--section-height-xl:var(--ai-size-xl);--section-height-input-xs:var(--ai-size-input-xs);--section-height-input-sm:var(--ai-size-input-sm);--section-height-input-md:var(--ai-size-input-md);--section-height-input-lg:var(--ai-size-input-lg);--section-height-input-xl:var(--ai-size-input-xl);--section-padding-x-xs:rem(6px);--section-padding-x-sm:rem(8px);--section-padding-x-md:rem(10px);--section-padding-x-lg:rem(12px);--section-padding-x-xl:rem(16px);--section-height:var(--section-height-sm);--section-padding-x:var(--section-padding-x-sm);--section-color:var(--color-white);align-items:center;background:var(--section-bg,var(--color-primary-filled));border:var(--section-bd,rem(1px) solid transparent);border-radius:var(--section-radius,var(--radius-default));color:var(--section-color,var(--color-white));display:inline-flex;font-size:var(--section-fz,var(--font-size-md));font-weight:600;height:var(--section-height,var(--section-height-sm));justify-content:center;line-height:1;padding-inline:var(--section-padding-x,var(--section-padding-x-sm));vertical-align:middle;width:auto}
@@ -5,8 +5,9 @@ import Box from "../box.vue";
5
5
  import Loader from "../loader/loader.vue";
6
6
  import css from "./action-icon.module.css";
7
7
  const {
8
- color,
8
+ color = "gray",
9
9
  size,
10
+ iconSize,
10
11
  variant = "default",
11
12
  gradient,
12
13
  loading,
@@ -14,9 +15,14 @@ const {
14
15
  radius,
15
16
  mod,
16
17
  icon,
17
- disabled
18
+ disabled,
19
+ active,
20
+ activeMode = "pressed",
21
+ activeVariant,
22
+ activeColor = "primary"
18
23
  } = defineProps({
19
24
  size: { type: null, required: false },
25
+ iconSize: { type: [Number, String], required: false },
20
26
  gradient: { type: Object, required: false },
21
27
  color: { type: null, required: false },
22
28
  radius: { type: [String, Number, Object], required: false },
@@ -25,19 +31,26 @@ const {
25
31
  disabled: { type: Boolean, required: false },
26
32
  mod: { type: [Object, Array, null], required: false },
27
33
  variant: { type: String, required: false },
34
+ active: { type: Boolean, required: false },
35
+ activeMode: { type: String, required: false },
36
+ activeVariant: { type: String, required: false },
37
+ activeColor: { type: null, required: false },
28
38
  classes: { type: Object, required: false }
29
39
  });
30
- const { variantResolver } = useConfig();
40
+ const { variantResolver, activeVariants } = useConfig();
31
41
  const style = useVarsResolver((theme) => {
42
+ const resolvedVariant = active ? activeVariant ?? activeVariants[variant] : variant;
43
+ const resolvedColor = active ? activeColor : color;
32
44
  const {
33
45
  background,
34
46
  border,
35
47
  hover,
36
48
  text
37
- } = variantResolver({ variant, color, theme, gradient });
49
+ } = variantResolver({ variant: resolvedVariant, color: resolvedColor, theme, gradient });
38
50
  return {
39
51
  root: {
40
52
  "--ai-size": getSize(size, "ai-size"),
53
+ "--ai-icon-size": getSize(iconSize),
41
54
  "--ai-radius": getRadius(radius),
42
55
  "--ai-bg": background,
43
56
  "--ai-hover": hover,
@@ -52,10 +65,12 @@ const style = useVarsResolver((theme) => {
52
65
  <Box
53
66
  is='button'
54
67
  type='button'
55
- :mod='[{ loading }, mod]'
68
+ :mod='[{ loading, active }, mod]'
56
69
  :style='style.root'
57
70
  :class='[css.root, classes?.root]'
58
71
  :disabled='(!disabled ? loading : disabled) || void 0'
72
+ :aria-pressed='activeMode === "pressed" ? active : void 0'
73
+ :aria-current='active && activeMode === "current" ? "page" : void 0'
59
74
  >
60
75
  <Transition name='slide-down'>
61
76
  <Loader
@@ -4,11 +4,13 @@ export type ActionIconClasses = 'root' | 'icon';
4
4
  export type ActionIconVariant = 'filled' | 'light' | 'outline' | 'subtle' | 'default' | 'gradient';
5
5
  export type ActionIconSize = NuanceSize | `input-${NuanceSize}` | AnyString;
6
6
  export interface ActionIconVars {
7
- root: '--ai-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
7
+ root: '--ai-size' | '--ai-icon-size' | '--ai-radius' | '--ai-bg' | '--ai-hover' | '--ai-color' | '--ai-bd';
8
8
  }
9
9
  export interface ActionIconProps {
10
10
  /** Component size @default 'md' */
11
11
  size?: ActionIconSize;
12
+ /** Icon size — `%` stays relative to the button, other values resolve via size tokens @default '70%' */
13
+ iconSize?: number | string;
12
14
  /** Gradient configuration (used with `variant="gradient"`) */
13
15
  gradient?: NuanceGradient;
14
16
  /** Color from theme */
@@ -25,6 +27,14 @@ export interface ActionIconProps {
25
27
  mod?: BoxProps['mod'];
26
28
  /** Visual variant */
27
29
  variant?: ActionIconVariant;
30
+ /** Active/pressed state — adds `data-active` and the matching ARIA attribute */
31
+ active?: boolean;
32
+ /** ARIA semantic for `active` @default 'pressed' */
33
+ activeMode?: 'pressed' | 'current';
34
+ /** Variant applied when `active`. Defaults to the configured map for the current `variant` */
35
+ activeVariant?: ActionIconVariant;
36
+ /** Color applied when `active` @default 'primary' */
37
+ activeColor?: NuanceColor;
28
38
  /** Styles API */
29
39
  classes?: Classes<ActionIconClasses>;
30
40
  }
@@ -30,6 +30,14 @@ export interface ButtonProps extends BoxProps {
30
30
  rightSectionProps?: HTMLAttributes;
31
31
  /** Visual variant */
32
32
  variant?: ButtonVariant;
33
+ /** Active/pressed state — adds `data-active` and the matching ARIA attribute */
34
+ active?: boolean;
35
+ /** ARIA semantic for `active` @default 'pressed' */
36
+ activeMode?: 'pressed' | 'current';
37
+ /** Variant applied when `active`. Defaults to the configured map for the current `variant` */
38
+ activeVariant?: ButtonVariant;
39
+ /** Color applied when `active` @default 'primary' */
40
+ activeColor?: NuanceColor;
33
41
  /** Styles API */
34
42
  classes?: Classes<ButtonClasses>;
35
43
  }
@@ -1 +1 @@
1
- .root{--button-height-xs:rem(26px);--button-height-sm:rem(30px);--button-height-md:rem(36px);--button-height-lg:rem(42px);--button-height-xl:rem(50px);--button-height-compact-xs:rem(22px);--button-height-compact-sm:rem(26px);--button-height-compact-md:rem(30px);--button-height-compact-lg:rem(34px);--button-height-compact-xl:rem(40px);--button-padding-x-xs:rem(14px);--button-padding-x-sm:rem(18px);--button-padding-x-md:rem(22px);--button-padding-x-lg:rem(26px);--button-padding-x-xl:rem(32px);--button-padding-x-compact-xs:rem(7px);--button-padding-x-compact-sm:rem(8px);--button-padding-x-compact-md:rem(10px);--button-padding-x-compact-lg:rem(12px);--button-padding-x-compact-xl:rem(14px);--button-height:var(--button-height-sm);--button-padding-x:var(--button-padding-x-sm);--button-color:var(--color-white);--button-fz:var(--font-size-md);--button-bg:var(--color-primary-filled);--button-radius:var(--radius-default);--button-hover:var(--color-primary-filled-hover);--button-spacing:0;--button-justify:center;--button-section-size:calc(var(--button-height) - 0.25rem);background:var(--button-bg);border:var(--button-bd,rem(1px) solid transparent);border-radius:var(--button-radius);color:var(--button-color,var(--color-white));cursor:pointer;display:inline-block;font-size:var(--button-fz);font-weight:500;height:var(--button-height,var(--button-height-sm));line-height:1;overflow:hidden;padding-inline:var(--button-padding-x,var(--button-padding-x-sm));position:relative;text-align:center;transition:background-color .2s ease-in,color .2s ease-in;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:auto}.root:where([data-with-left-section]){padding-inline-start:0}.root:where([data-with-right-section]){padding-inline-end:0}.root:where([data-variant=gradient-outline]){background-clip:padding-box,border-box;background-origin:border-box}.root:where(:disabled:not([data-loading])){background:var(--color-disabled);border:1px solid transparent;color:var(--color-disabled-text);cursor:not-allowed;transform:none}.root:before{border-radius:var(--button-radius,var(--radius-default));content:"";filter:blur(12px);inset:-1px;opacity:0;pointer-events:none;position:absolute;transform:translateY(-100%);transition:transform .15s ease,opacity .1s ease;@mixin where-light{background:var(--color-gray-1);color:var(--color-gray-5)}@mixin where-dark{background:var(--color-dark-6);color:var(--color-dark-3)}}.root:where([data-loading]){cursor:not-allowed;transform:none}.root:where([data-loading]):before{opacity:1;transform:translateY(0)}.root:where([data-loading]) .inner{opacity:0;transform:translateY(100%)}.root:hover:where(:not([data-loading],:disabled)),.root[data-active]{background:var(--button-hover);color:var(--button-color)}.root:hover:where(:not([data-loading],:disabled)):where([data-variant=gradient-outline]),.root[data-active]:where([data-variant=gradient-outline]){color:#fff}.inner{gap:var(--button-spacing);justify-content:center;overflow:visible;transition:transform .15s ease,opacity .1s ease;width:100%}.inner,.label{align-items:center;display:flex;height:100%}.label{flex:1;justify-content:var(--button-justify);opacity:1;overflow:hidden;white-space:nowrap}.label:where([data-loading]){opacity:.2}.section{--section-pointer-events:none;align-items:center;display:flex;height:100%;justify-content:center;pointer-events:var(--section-pointer-events);width:var(--button-section-size)}.loader{left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2)}.group{--group-border-width:1px;display:flex}.group>:where(*):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal]>:where(*):not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--group-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal]>:where(*):not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--group-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal]>:where(*):not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--group-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical]>:where(*):not(:only-child):first-child{border-bottom-width:calc(var(--group-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical]>:where(*):not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--group-border-width)/2)}.group[data-orientation=vertical]>:where(*):not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--group-border-width)/2);border-radius:0;border-top-width:calc(var(--group-border-width)/2)}
1
+ .root{--button-height-xs:rem(26px);--button-height-sm:rem(30px);--button-height-md:rem(36px);--button-height-lg:rem(42px);--button-height-xl:rem(50px);--button-height-compact-xs:rem(22px);--button-height-compact-sm:rem(26px);--button-height-compact-md:rem(30px);--button-height-compact-lg:rem(34px);--button-height-compact-xl:rem(40px);--button-padding-x-xs:rem(14px);--button-padding-x-sm:rem(18px);--button-padding-x-md:rem(22px);--button-padding-x-lg:rem(26px);--button-padding-x-xl:rem(32px);--button-padding-x-compact-xs:rem(7px);--button-padding-x-compact-sm:rem(8px);--button-padding-x-compact-md:rem(10px);--button-padding-x-compact-lg:rem(12px);--button-padding-x-compact-xl:rem(14px);--button-height:var(--button-height-sm);--button-padding-x:var(--button-padding-x-sm);--button-color:var(--color-white);--button-fz:var(--font-size-md);--button-bg:var(--color-primary-filled);--button-radius:var(--radius-default);--button-hover:var(--color-primary-filled-hover);--button-spacing:0;--button-justify:center;--button-section-size:calc(var(--button-height) - 0.25rem);background:var(--button-bg);border:var(--button-bd,rem(1px) solid transparent);border-radius:var(--button-radius);color:var(--button-color,var(--color-white));cursor:pointer;display:inline-block;font-size:var(--button-fz);font-weight:500;height:var(--button-height,var(--button-height-sm));line-height:1;overflow:hidden;padding-inline:var(--button-padding-x,var(--button-padding-x-sm));position:relative;text-align:center;transition:background-color .2s ease-in,color .2s ease-in;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:auto}.root:where([data-with-left-section]){padding-inline-start:0}.root:where([data-with-right-section]){padding-inline-end:0}.root:where([data-variant=gradient-outline]){background-clip:padding-box,border-box;background-origin:border-box}.root:where(:disabled:not([data-loading])){background:var(--color-disabled);border:1px solid transparent;color:var(--color-disabled-text);cursor:not-allowed;transform:none}.root:before{border-radius:var(--button-radius,var(--radius-default));content:"";filter:blur(12px);inset:-1px;opacity:0;pointer-events:none;position:absolute;transform:translateY(-100%);transition:transform .15s ease,opacity .1s ease;@mixin where-light{background:var(--color-gray-1);color:var(--color-gray-5)}@mixin where-dark{background:var(--color-dark-6);color:var(--color-dark-3)}}.root:where([data-loading]){cursor:not-allowed;transform:none}.root:where([data-loading]):before{opacity:1;transform:translateY(0)}.root:where([data-loading]) .inner{opacity:0;transform:translateY(100%)}.root:hover:where(:not([data-loading],:disabled)){background:var(--button-hover);color:var(--button-color)}.root:hover:where(:not([data-loading],:disabled)):where([data-variant=gradient-outline]){color:#fff}.inner{gap:var(--button-spacing);justify-content:center;overflow:visible;transition:transform .15s ease,opacity .1s ease;width:100%}.inner,.label{align-items:center;display:flex;height:100%}.label{flex:1;justify-content:var(--button-justify);opacity:1;overflow:hidden;white-space:nowrap}.label:where([data-loading]){opacity:.2}.section{--section-pointer-events:none;align-items:center;display:flex;height:100%;justify-content:center;pointer-events:var(--section-pointer-events);width:var(--button-section-size)}.loader{left:calc(50% - var(--loader-size)/2);position:absolute;top:calc(50% - var(--loader-size)/2)}.group{--group-border-width:1px;display:flex}.group>:where(*):focus{position:relative;z-index:1}.group[data-orientation=horizontal]{flex-direction:row}.group[data-orientation=horizontal]>:where(*):not(:only-child):first-child{border-end-end-radius:0;border-inline-end-width:calc(var(--group-border-width)/2);border-start-end-radius:0}.group[data-orientation=horizontal]>:where(*):not(:only-child):last-child{border-end-start-radius:0;border-inline-start-width:calc(var(--group-border-width)/2);border-start-start-radius:0}.group[data-orientation=horizontal]>:where(*):not(:only-child):not(:first-child):not(:last-child){border-inline-width:calc(var(--group-border-width)/2);border-radius:0}.group[data-orientation=vertical]{flex-direction:column}.group[data-orientation=vertical]>:where(*):not(:only-child):first-child{border-bottom-width:calc(var(--group-border-width)/2);border-end-end-radius:0;border-end-start-radius:0}.group[data-orientation=vertical]>:where(*):not(:only-child):last-child{border-start-end-radius:0;border-start-start-radius:0;border-top-width:calc(var(--group-border-width)/2)}.group[data-orientation=vertical]>:where(*):not(:only-child):not(:first-child):not(:last-child){border-bottom-width:calc(var(--group-border-width)/2);border-radius:0;border-top-width:calc(var(--group-border-width)/2)}
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { useConfig, useVarsResolver } from "@nui/composables";
3
3
  import { getFontSize, getRadius, getSize, getSpacing } from "@nui/utils";
4
+ import { computed } from "vue";
4
5
  import Box from "../box.vue";
5
6
  import Loader from "../loader/loader.vue";
6
7
  import css from "./button.module.css";
@@ -14,6 +15,10 @@ const {
14
15
  loading,
15
16
  classes,
16
17
  rightSectionProps,
18
+ active,
19
+ activeMode = "pressed",
20
+ activeVariant,
21
+ activeColor = "primary",
17
22
  ...props
18
23
  } = defineProps({
19
24
  color: { type: null, required: false },
@@ -29,16 +34,21 @@ const {
29
34
  leftSectionProps: { type: Object, required: false },
30
35
  rightSectionProps: { type: Object, required: false },
31
36
  variant: { type: String, required: false },
37
+ active: { type: Boolean, required: false },
38
+ activeMode: { type: String, required: false },
39
+ activeVariant: { type: String, required: false },
40
+ activeColor: { type: null, required: false },
32
41
  classes: { type: Object, required: false },
33
42
  is: { type: null, required: false },
34
43
  mod: { type: [Object, Array, null], required: false }
35
44
  });
36
- const { variantResolver } = useConfig();
45
+ const { variantResolver, activeVariants } = useConfig();
46
+ const resolvedVariant = computed(() => active ? activeVariant ?? activeVariants[variant] : variant);
37
47
  const style = useVarsResolver((theme) => {
38
48
  const { background, border, hover, text } = variantResolver({
39
49
  theme,
40
- variant,
41
- color: props.color,
50
+ variant: resolvedVariant.value,
51
+ color: active ? activeColor : props.color,
42
52
  gradient: props.gradient
43
53
  });
44
54
  return {
@@ -72,11 +82,14 @@ const style = useVarsResolver((theme) => {
72
82
  "with-left-section": !!$slots?.leftSection || !!icon,
73
83
  "with-right-section": !!$slots?.rightSection,
74
84
  loading,
75
- variant
85
+ active,
86
+ "variant": resolvedVariant
76
87
  }]'
77
88
  :style='style.root'
78
89
  :class='[css.root, classes?.root]'
79
90
  :disabled='loading'
91
+ :aria-pressed='activeMode === "pressed" ? active : void 0'
92
+ :aria-current='active && activeMode === "current" ? "page" : void 0'
80
93
  >
81
94
  <Transition name='fade-down'>
82
95
  <Loader v-show='loading' :class='css.loader' :color :size />
@@ -30,6 +30,14 @@ export interface ButtonProps extends BoxProps {
30
30
  rightSectionProps?: HTMLAttributes;
31
31
  /** Visual variant */
32
32
  variant?: ButtonVariant;
33
+ /** Active/pressed state — adds `data-active` and the matching ARIA attribute */
34
+ active?: boolean;
35
+ /** ARIA semantic for `active` @default 'pressed' */
36
+ activeMode?: 'pressed' | 'current';
37
+ /** Variant applied when `active`. Defaults to the configured map for the current `variant` */
38
+ activeVariant?: ButtonVariant;
39
+ /** Color applied when `active` @default 'primary' */
40
+ activeColor?: NuanceColor;
33
41
  /** Styles API */
34
42
  classes?: Classes<ButtonClasses>;
35
43
  }
@@ -9,6 +9,7 @@ const {
9
9
  ...props
10
10
  } = defineProps({
11
11
  size: { type: null, required: false },
12
+ iconSize: { type: [Number, String], required: false },
12
13
  gradient: { type: Object, required: false },
13
14
  color: { type: null, required: false },
14
15
  radius: { type: [String, Number, Object], required: false },
@@ -17,6 +18,10 @@ const {
17
18
  disabled: { type: Boolean, required: false },
18
19
  mod: { type: [Object, Array, null], required: false },
19
20
  variant: { type: String, required: false },
21
+ active: { type: Boolean, required: false },
22
+ activeMode: { type: String, required: false },
23
+ activeVariant: { type: String, required: false },
24
+ activeColor: { type: null, required: false },
20
25
  classes: { type: Object, required: false }
21
26
  });
22
27
  const close = useDialogState();
@@ -2,6 +2,7 @@
2
2
  import DialogCloseButton from "../dialog/ui/dialog-close-button.vue";
3
3
  const props = defineProps({
4
4
  size: { type: null, required: false },
5
+ iconSize: { type: [Number, String], required: false },
5
6
  gradient: { type: Object, required: false },
6
7
  color: { type: null, required: false },
7
8
  radius: { type: [String, Number, Object], required: false },
@@ -10,6 +11,10 @@ const props = defineProps({
10
11
  disabled: { type: Boolean, required: false },
11
12
  mod: { type: [Object, Array, null], required: false },
12
13
  variant: { type: String, required: false },
14
+ active: { type: Boolean, required: false },
15
+ activeMode: { type: String, required: false },
16
+ activeVariant: { type: String, required: false },
17
+ activeColor: { type: null, required: false },
13
18
  classes: { type: Object, required: false }
14
19
  });
15
20
  </script>
@@ -28,6 +28,10 @@ const {
28
28
  leftSectionProps: { type: Object, required: false },
29
29
  rightSectionProps: { type: Object, required: false },
30
30
  variant: { type: String, required: false },
31
+ active: { type: Boolean, required: false },
32
+ activeMode: { type: String, required: false },
33
+ activeVariant: { type: String, required: false },
34
+ activeColor: { type: null, required: false },
31
35
  classes: { type: Object, required: false },
32
36
  is: { type: null, required: false },
33
37
  mod: { type: [Object, Array, null], required: false },
@@ -16,6 +16,7 @@ const {
16
16
  reset: { type: null, required: false },
17
17
  directory: { type: null, required: false },
18
18
  size: { type: null, required: false },
19
+ iconSize: { type: [Number, String], required: false },
19
20
  gradient: { type: Object, required: false },
20
21
  color: { type: null, required: false },
21
22
  radius: { type: [String, Number, Object], required: false },
@@ -24,6 +25,10 @@ const {
24
25
  disabled: { type: Boolean, required: false },
25
26
  mod: { type: [Object, Array, null], required: false },
26
27
  variant: { type: String, required: false },
28
+ active: { type: Boolean, required: false },
29
+ activeMode: { type: String, required: false },
30
+ activeVariant: { type: String, required: false },
31
+ activeColor: { type: null, required: false },
27
32
  classes: { type: Object, required: false },
28
33
  capture: { type: null, required: false },
29
34
  initialFiles: { type: null, required: false },
@@ -30,6 +30,10 @@ const props = defineProps({
30
30
  leftSectionProps: { type: Object, required: false },
31
31
  rightSectionProps: { type: Object, required: false },
32
32
  variant: { type: String, required: false },
33
+ active: { type: Boolean, required: false },
34
+ activeMode: { type: String, required: false },
35
+ activeVariant: { type: String, required: false },
36
+ activeColor: { type: null, required: false },
33
37
  classes: { type: Object, required: false },
34
38
  is: { type: null, required: false },
35
39
  mod: { type: [Object, Array, null], required: false }
@@ -2,6 +2,7 @@
2
2
  import DialogCloseButton from "../dialog/ui/dialog-close-button.vue";
3
3
  const props = defineProps({
4
4
  size: { type: null, required: false },
5
+ iconSize: { type: [Number, String], required: false },
5
6
  gradient: { type: Object, required: false },
6
7
  color: { type: null, required: false },
7
8
  radius: { type: [String, Number, Object], required: false },
@@ -10,6 +11,10 @@ const props = defineProps({
10
11
  disabled: { type: Boolean, required: false },
11
12
  mod: { type: [Object, Array, null], required: false },
12
13
  variant: { type: String, required: false },
14
+ active: { type: Boolean, required: false },
15
+ activeMode: { type: String, required: false },
16
+ activeVariant: { type: String, required: false },
17
+ activeColor: { type: null, required: false },
13
18
  classes: { type: Object, required: false }
14
19
  });
15
20
  </script>
@@ -1,23 +1,17 @@
1
1
  import type { ActionIconProps } from '@nui/components';
2
2
  import type { NuanceColor } from '@nui/types';
3
3
  import type { NuxtLinkProps } from 'nuxt/app';
4
- export interface NavIconLinkProps extends ActionIconProps, Omit<NuxtLinkProps, 'href' | 'custom'> {
4
+ export interface NavIconLinkProps extends Omit<ActionIconProps, 'active'>, Omit<NuxtLinkProps, 'href' | 'custom'> {
5
5
  /** Link target */
6
6
  to: NuxtLinkProps['to'];
7
7
  /** Color from theme */
8
8
  color?: NuanceColor;
9
9
  /** Icon name shorthand */
10
10
  icon?: string;
11
- /**
12
- * Variant applied in active state
13
- * @default `'filled'`
14
- */
15
- active?: ActionIconProps['variant'];
16
- /**
17
- * Variant applied in inactive state
18
- * @default `'default'`
19
- */
20
- notActive?: ActionIconProps['variant'];
11
+ /** Variant applied in inactive state @default 'default' */
12
+ variant?: ActionIconProps['variant'];
13
+ /** Variant applied in active state @default 'filled' */
14
+ activeVariant?: ActionIconProps['variant'];
21
15
  }
22
16
  declare var __VLS_16: {};
23
17
  type __VLS_Slots = {} & {
@@ -3,23 +3,25 @@ import ActionIcon from "../action-icon/action-icon.vue";
3
3
  import { pickLinkProps } from "../link";
4
4
  defineOptions({ inheritAttrs: false });
5
5
  const {
6
- active = "filled",
7
- notActive = "default",
6
+ variant,
7
+ activeVariant,
8
8
  mod,
9
9
  ...etc
10
10
  } = defineProps({
11
11
  to: { type: null, required: true },
12
12
  color: { type: null, required: false },
13
13
  icon: { type: String, required: false },
14
- active: { type: String, required: false },
15
- notActive: { type: String, required: false },
14
+ variant: { type: String, required: false },
15
+ activeVariant: { type: String, required: false },
16
16
  size: { type: null, required: false },
17
+ iconSize: { type: [Number, String], required: false },
17
18
  gradient: { type: Object, required: false },
18
19
  radius: { type: [String, Number, Object], required: false },
19
20
  loading: { type: Boolean, required: false },
20
21
  disabled: { type: Boolean, required: false },
21
22
  mod: { type: [Object, Array, null], required: false },
22
- variant: { type: String, required: false },
23
+ activeMode: { type: String, required: false },
24
+ activeColor: { type: null, required: false },
23
25
  classes: { type: Object, required: false },
24
26
  external: { type: Boolean, required: false },
25
27
  target: { type: [String, Object, null], required: false },
@@ -45,9 +47,11 @@ const { link, rest } = pickLinkProps(etc);
45
47
  is='a'
46
48
  v-bind='{ ...rest, ...$attrs }'
47
49
  :href
48
- :variant='isActive ? active : notActive'
49
- :mod='[{ active: isActive }, mod]'
50
- :aria-current="isActive ? 'page' : void 0"
50
+ :variant
51
+ :active='isActive'
52
+ :active-variant
53
+ active-mode='current'
54
+ :mod
51
55
  :rel='"rel" in linkProps ? linkProps?.rel : void 0'
52
56
  :target='"target" in linkProps ? linkProps?.target : void 0'
53
57
  @click='navigate'
@@ -1,23 +1,17 @@
1
1
  import type { ActionIconProps } from '@nui/components';
2
2
  import type { NuanceColor } from '@nui/types';
3
3
  import type { NuxtLinkProps } from 'nuxt/app';
4
- export interface NavIconLinkProps extends ActionIconProps, Omit<NuxtLinkProps, 'href' | 'custom'> {
4
+ export interface NavIconLinkProps extends Omit<ActionIconProps, 'active'>, Omit<NuxtLinkProps, 'href' | 'custom'> {
5
5
  /** Link target */
6
6
  to: NuxtLinkProps['to'];
7
7
  /** Color from theme */
8
8
  color?: NuanceColor;
9
9
  /** Icon name shorthand */
10
10
  icon?: string;
11
- /**
12
- * Variant applied in active state
13
- * @default `'filled'`
14
- */
15
- active?: ActionIconProps['variant'];
16
- /**
17
- * Variant applied in inactive state
18
- * @default `'default'`
19
- */
20
- notActive?: ActionIconProps['variant'];
11
+ /** Variant applied in inactive state @default 'default' */
12
+ variant?: ActionIconProps['variant'];
13
+ /** Variant applied in active state @default 'filled' */
14
+ activeVariant?: ActionIconProps['variant'];
21
15
  }
22
16
  declare var __VLS_16: {};
23
17
  type __VLS_Slots = {} & {
@@ -23,6 +23,10 @@ const {
23
23
  leftSectionProps: { type: Object, required: false },
24
24
  rightSectionProps: { type: Object, required: false },
25
25
  variant: { type: String, required: false },
26
+ active: { type: Boolean, required: false },
27
+ activeMode: { type: String, required: false },
28
+ activeVariant: { type: String, required: false },
29
+ activeColor: { type: null, required: false },
26
30
  classes: { type: Object, required: false },
27
31
  is: { type: null, required: false },
28
32
  mod: { type: [Object, Array, null], required: false },
@@ -3,6 +3,7 @@ import { useConfig, useTheme } from "@nui/composables";
3
3
  import ActionIcon from "./action-icon/action-icon.vue";
4
4
  const props = defineProps({
5
5
  size: { type: null, required: false },
6
+ iconSize: { type: [Number, String], required: false },
6
7
  gradient: { type: Object, required: false },
7
8
  color: { type: null, required: false },
8
9
  radius: { type: [String, Number, Object], required: false },
@@ -11,6 +12,10 @@ const props = defineProps({
11
12
  disabled: { type: Boolean, required: false },
12
13
  mod: { type: [Object, Array, null], required: false },
13
14
  variant: { type: String, required: false },
15
+ active: { type: Boolean, required: false },
16
+ activeMode: { type: String, required: false },
17
+ activeVariant: { type: String, required: false },
18
+ activeColor: { type: null, required: false },
14
19
  classes: { type: Object, required: false }
15
20
  });
16
21
  const theme = useTheme();
@@ -2,5 +2,6 @@ import type { VariantColorResolverOptions } from '@nui/utils';
2
2
  /** Returns the configured icon registry merged with module defaults. */
3
3
  export declare function useConfig(): {
4
4
  icons: any;
5
+ activeVariants: any;
5
6
  variantResolver: (options: VariantColorResolverOptions) => import("#imports").VariantColorResolverResult;
6
7
  };
@@ -1,9 +1,10 @@
1
1
  import { createVariantColorResolver } from "@nui/utils";
2
2
  import { useAppConfig } from "#imports";
3
3
  export function useConfig() {
4
- const { icons, gradient } = useAppConfig().nui;
4
+ const { icons, gradient, activeVariants } = useAppConfig().nui;
5
5
  return {
6
6
  icons,
7
+ activeVariants,
7
8
  variantResolver: (options) => createVariantColorResolver({
8
9
  ...options,
9
10
  gradient: options.gradient ?? gradient
@@ -0,0 +1,11 @@
1
+ /** Variant an ActionIcon switches to when `active`, keyed by its base variant. */
2
+ export declare const DEFAULT_ACTIVE_VARIANTS: {
3
+ readonly default: "filled";
4
+ readonly light: "filled";
5
+ readonly outline: "filled";
6
+ readonly subtle: "light";
7
+ readonly filled: "filled";
8
+ readonly gradient: "gradient";
9
+ readonly 'gradient-outline': "gradient";
10
+ };
11
+ export type ActiveVariantsMap = Record<keyof typeof DEFAULT_ACTIVE_VARIANTS, string>;
@@ -0,0 +1,9 @@
1
+ export const DEFAULT_ACTIVE_VARIANTS = {
2
+ "default": "filled",
3
+ "light": "filled",
4
+ "outline": "filled",
5
+ "subtle": "light",
6
+ "filled": "filled",
7
+ "gradient": "gradient",
8
+ "gradient-outline": "gradient"
9
+ };
@@ -1,2 +1,3 @@
1
+ export * from './active-variants.js';
1
2
  export * from './gradient.js';
2
3
  export * from './icons.js';
@@ -1,2 +1,3 @@
1
+ export * from "./active-variants.js";
1
2
  export * from "./gradient.js";
2
3
  export * from "./icons.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuance-ui",
3
- "version": "0.2.36",
3
+ "version": "0.3.0",
4
4
  "description": "A modern Nuxt UI library inspired by the best of the React ecosystem.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  "dev": "npm run dev:prepare && nuxi dev playground",
47
47
  "dev:build": "nuxi build playground",
48
48
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
49
- "release": "npm run lint && npm run prepack && changelogen --release && git push --follow-tags",
49
+ "release": "npm run lint && npm run prepack && changelogen --release --minor && git push --follow-tags",
50
50
  "lint": "eslint ./src",
51
51
  "test": "vitest run",
52
52
  "test:watch": "vitest watch",