@nattstack/ui 0.0.81 → 0.0.83

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.
@@ -25,18 +25,16 @@ declare const button: (props?: ({
25
25
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
26
26
  //#endregion
27
27
  //#region src/components/button-link/button-link.d.ts
28
- type ButtonLinkProps<ComponentType extends ElementType = "a"> = ButtonLinkHrefProps<ComponentType> & ButtonLinkInternalProps<ComponentType> & Omit<ComponentProps<ComponentType>, "children" | "href" | keyof ButtonLinkInternalProps<ComponentType>>;
29
- type ButtonLinkHrefProps<ComponentType extends ElementType> = ComponentProps<ComponentType> extends {
30
- href: infer Href;
31
- } ? {
32
- href: Href | string;
33
- } : ComponentProps<ComponentType> extends {
34
- href?: infer Href;
35
- } ? {
36
- href?: Href | string;
37
- } : unknown;
38
- interface ButtonLinkInternalProps<ComponentType extends ElementType> extends Pick<ButtonProps, "isFullWidth" | "isRounded" | "label" | "size" | "variant"> {
28
+ type ButtonLinkProps<ComponentType extends ElementType = "a"> = ButtonLinkInternalProps<ComponentType> & Omit<ComponentProps<ComponentType>, "children" | keyof ButtonLinkInternalProps>;
29
+ interface ButtonLinkInternalProps<ComponentType extends ElementType = "a"> {
39
30
  as?: ComponentType;
31
+ iconEnd?: ReactNode;
32
+ iconStart?: ReactNode;
33
+ isFullWidth?: VariantProps<typeof button>["isFullWidth"];
34
+ isRounded?: VariantProps<typeof button>["isRounded"];
35
+ label?: number | number[] | string | string[];
36
+ size?: VariantProps<typeof button>["size"];
37
+ variant?: VariantProps<typeof button>["variant"];
40
38
  }
41
39
  declare function ButtonLink<ComponentType extends ElementType = "a">(props: ButtonLinkProps<ComponentType>): JSX.Element;
42
40
  //#endregion
@@ -58,7 +58,7 @@ function Button(props) {
58
58
  children: [
59
59
  isLoading && /* @__PURE__ */ jsx(ButtonSpinner, {}),
60
60
  iconStart,
61
- /* @__PURE__ */ jsx("span", { children: label }),
61
+ label !== "" && /* @__PURE__ */ jsx("span", { children: label }),
62
62
  iconEnd
63
63
  ]
64
64
  });
@@ -90,17 +90,21 @@ const button = cva(button_module_default.base, { variants: {
90
90
  //#endregion
91
91
  //#region src/components/button-link/button-link.tsx
92
92
  function ButtonLink(props) {
93
- const { as = "a", className: customClassName = "", isFullWidth = false, isRounded = false, label = "", size = 40, variant = "primary", ...rest } = props;
94
- return /* @__PURE__ */ jsx(as, {
93
+ const { as: Component = "a", className = "", iconStart = "", iconEnd = "", isFullWidth = false, isRounded = false, label = "", size = 40, variant = "primary", ...rest } = props;
94
+ return /* @__PURE__ */ jsxs(Component, {
95
95
  className: button({
96
- className: customClassName,
96
+ className,
97
97
  isFullWidth,
98
98
  isRounded,
99
99
  size,
100
100
  variant
101
101
  }),
102
102
  ...rest,
103
- children: /* @__PURE__ */ jsx("span", { children: label })
103
+ children: [
104
+ iconStart,
105
+ label !== "" && /* @__PURE__ */ jsx("span", { children: label }),
106
+ iconEnd
107
+ ]
104
108
  });
105
109
  }
106
110
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nattstack/ui",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "description": "A collection of reusable React components built with Base UI, TypeScript, and CSS Modules",
5
5
  "keywords": [
6
6
  "base-ui",