nuance-ui 0.2.9 → 0.2.10

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.9",
7
+ "version": "0.2.10",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -37,6 +37,11 @@ export interface ButtonProps extends BoxProps {
37
37
  rightSectionPE?: CSSStyleDeclaration['pointerEvents'];
38
38
  /** Extra attributes forwarded to the right section element */
39
39
  rightSectionProps?: HTMLAttributes;
40
+ /**
41
+ * Sets `justify-content` of `inner` element, can be used to change distribution of sections and label
42
+ * @default 'center'
43
+ */
44
+ justify?: CSSStyleDeclaration['justifyContent'];
40
45
  }
41
46
  declare var __VLS_19: {}, __VLS_26: {}, __VLS_28: {};
42
47
  type __VLS_Slots = {} & {
@@ -1 +1 @@
1
- .root{--button-height-xs:rem(30px);--button-height-sm:rem(36px);--button-height-md:rem(42px);--button-height-lg:rem(50px);--button-height-xl:rem(60px);--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-sm);--button-bg:var(--color-primary-filled);--button-radius:var(--radius-default);--button-hover:var(--color-primary-filled-hover);--button-spacing:0;--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:600;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);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;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(30px);--button-height-sm:rem(36px);--button-height-md:rem(42px);--button-height-lg:rem(50px);--button-height-xl:rem(60px);--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-sm);--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:600;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);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)}
@@ -20,7 +20,8 @@ const {
20
20
  rightSectionProps,
21
21
  is = "button",
22
22
  radius,
23
- mod: _mod
23
+ mod: _mod,
24
+ justify
24
25
  } = defineProps({
25
26
  size: { type: null, required: false },
26
27
  spacing: { type: String, required: false },
@@ -35,6 +36,7 @@ const {
35
36
  icon: { type: String, required: false },
36
37
  rightSectionPE: { type: null, required: false },
37
38
  rightSectionProps: { type: Object, required: false },
39
+ justify: { type: null, required: false },
38
40
  is: { type: null, required: false },
39
41
  mod: { type: [Object, Array, null], required: false }
40
42
  });
@@ -48,6 +50,7 @@ const style = computed(() => useStyleResolver((theme) => {
48
50
  } = createVariantColorResolver({ variant, color, theme, gradient });
49
51
  return {
50
52
  root: {
53
+ "--button-justify": justify,
51
54
  "--button-height": getSize(size, "button-height"),
52
55
  "--button-padding-x": getSize(size, "button-padding-x"),
53
56
  "--button-fz": size?.includes("compact") ? getFontSize(size.replace("compact-", "")) : getFontSize(size),
@@ -37,6 +37,11 @@ export interface ButtonProps extends BoxProps {
37
37
  rightSectionPE?: CSSStyleDeclaration['pointerEvents'];
38
38
  /** Extra attributes forwarded to the right section element */
39
39
  rightSectionProps?: HTMLAttributes;
40
+ /**
41
+ * Sets `justify-content` of `inner` element, can be used to change distribution of sections and label
42
+ * @default 'center'
43
+ */
44
+ justify?: CSSStyleDeclaration['justifyContent'];
40
45
  }
41
46
  declare var __VLS_19: {}, __VLS_26: {}, __VLS_28: {};
42
47
  type __VLS_Slots = {} & {
@@ -27,6 +27,7 @@ const {
27
27
  leftSectionProps: { type: Object, required: false },
28
28
  rightSectionPE: { type: null, required: false },
29
29
  rightSectionProps: { type: Object, required: false },
30
+ justify: { type: null, required: false },
30
31
  is: { type: null, required: false },
31
32
  mod: { type: [Object, Array, null], required: false },
32
33
  capture: { type: null, required: false },
@@ -30,6 +30,7 @@ const props = defineProps({
30
30
  icon: { type: String, required: false },
31
31
  rightSectionPE: { type: null, required: false },
32
32
  rightSectionProps: { type: Object, required: false },
33
+ justify: { type: null, required: false },
33
34
  is: { type: null, required: false },
34
35
  mod: { type: [Object, Array, null], required: false }
35
36
  });
@@ -23,6 +23,7 @@ const {
23
23
  icon: { type: String, required: false },
24
24
  rightSectionPE: { type: null, required: false },
25
25
  rightSectionProps: { type: Object, required: false },
26
+ justify: { type: null, required: false },
26
27
  is: { type: null, required: false },
27
28
  mod: { type: [Object, Array, null], required: false },
28
29
  column: { type: Object, required: true },
@@ -1,6 +1,5 @@
1
- import type { NuanceTheme } from '@nui/types';
2
- import type { CSSProperties } from 'vue';
1
+ import type { NuanceTheme, TransformVars } from '@nui/types';
3
2
  /**
4
3
  * Builds a style object from a factory that receives the current theme.
5
4
  */
6
- export declare function useStyleResolver<T extends CSSProperties>(factory: (theme: NuanceTheme) => T): T;
5
+ export declare function useStyleResolver<T extends object>(factory: (theme: NuanceTheme) => TransformVars<T>): TransformVars<T>;
@@ -1,3 +1,4 @@
1
+ export type * from './styling';
1
2
  export type * from './theme';
2
3
  /** Map of component part names to user-provided class names. */
3
4
  export type Classes<Key extends string, Value = string | string[]> = Partial<Record<Key, Value>>;
@@ -0,0 +1,4 @@
1
+ export type CssVariable = `--${string}`;
2
+ export type TransformVars<V> = {
3
+ [Key in keyof V]: V[Key] extends CssVariable ? Record<V[Key], string | undefined> : never;
4
+ };
File without changes
@@ -1,4 +1,4 @@
1
- import type { NuanceColorShade, NuanceTheme } from '@nui/types';
1
+ import type { CssVariable, NuanceColorShade, NuanceTheme } from '@nui/types';
2
2
  interface ParseThemeColorResult {
3
3
  /** Color name without its shade suffix. */
4
4
  color: string;
@@ -7,7 +7,7 @@ interface ParseThemeColorResult {
7
7
  /** Parsed shade index, or `undefined` when the color has no shade. */
8
8
  shade: NuanceColorShade | undefined;
9
9
  /** Matching CSS custom property, or `undefined` for non-theme colors. */
10
- variable: `--${string}` | undefined;
10
+ variable: CssVariable | undefined;
11
11
  /** `true` when the color belongs to the Nuance theme palette. */
12
12
  isThemeColor: boolean;
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuance-ui",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "A modern Vue UI library inspired by the best of the React ecosystem.",
5
5
  "repository": {
6
6
  "type": "git",