@nattstack/ui 0.0.80 → 0.0.82

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/README.md CHANGED
@@ -32,7 +32,7 @@ function App() {
32
32
  <html className="color-gray-slate color-primary-blue">
33
33
  <head>...</head>
34
34
  <body>
35
- <Button>Click me</Button>
35
+ <Button label="Click me" />
36
36
  </body>
37
37
  </html>
38
38
  )
@@ -4,13 +4,13 @@ import { CSSProperties, ComponentProps, ElementType, JSX, ReactNode } from "reac
4
4
 
5
5
  //#region src/components/button/button.d.ts
6
6
  interface ButtonProps extends Omit<ComponentProps<"button">, "children" | "disabled"> {
7
- children?: number | number[] | string | string[];
8
7
  iconEnd?: ReactNode;
9
8
  iconStart?: ReactNode;
10
9
  isDisabled?: ComponentProps<"button">["disabled"];
11
10
  isFullWidth?: VariantProps<typeof button>["isFullWidth"];
12
11
  isLoading?: ComponentProps<"button">["disabled"];
13
12
  isRounded?: VariantProps<typeof button>["isRounded"];
13
+ label?: number | number[] | string | string[];
14
14
  size?: VariantProps<typeof button>["size"];
15
15
  variant?: VariantProps<typeof button>["variant"];
16
16
  }
@@ -25,7 +25,7 @@ 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>, "href" | keyof ButtonLinkInternalProps<ComponentType>>;
28
+ type ButtonLinkProps<ComponentType extends ElementType = "a"> = ButtonLinkHrefProps<ComponentType> & ButtonLinkInternalProps<ComponentType> & Omit<ComponentProps<ComponentType>, "children" | "href" | keyof ButtonLinkInternalProps<ComponentType>>;
29
29
  type ButtonLinkHrefProps<ComponentType extends ElementType> = ComponentProps<ComponentType> extends {
30
30
  href: infer Href;
31
31
  } ? {
@@ -35,7 +35,7 @@ type ButtonLinkHrefProps<ComponentType extends ElementType> = ComponentProps<Com
35
35
  } ? {
36
36
  href?: Href | string;
37
37
  } : unknown;
38
- interface ButtonLinkInternalProps<ComponentType extends ElementType> extends Pick<ButtonProps, "isFullWidth" | "isRounded" | "size" | "variant"> {
38
+ interface ButtonLinkInternalProps<ComponentType extends ElementType> extends Pick<ButtonProps, "iconEnd" | "iconStart" | "isFullWidth" | "isRounded" | "label" | "size" | "variant"> {
39
39
  as?: ComponentType;
40
40
  }
41
41
  declare function ButtonLink<ComponentType extends ElementType = "a">(props: ButtonLinkProps<ComponentType>): JSX.Element;
@@ -76,8 +76,8 @@ interface DialogResponsiveTriggerProps extends Drawer.Trigger.Props {}
76
76
  declare function DialogResponsiveTrigger(props: DialogResponsiveTriggerProps): JSX.Element;
77
77
  //#endregion
78
78
  //#region src/components/icon-button/icon-button.d.ts
79
- interface IconButtonProps extends Omit<ButtonProps, "children" | "iconEnd" | "iconStart" | "isFullWidth"> {
80
- children?: ReactNode;
79
+ interface IconButtonProps extends Omit<ButtonProps, "iconEnd" | "iconStart" | "isFullWidth" | "label"> {
80
+ icon?: ReactNode;
81
81
  }
82
82
  declare function IconButton(props: IconButtonProps): JSX.Element;
83
83
  declare const iconButton: (props?: ({
@@ -41,7 +41,7 @@ var button_module_default = {
41
41
  //#endregion
42
42
  //#region src/components/button/button.tsx
43
43
  function Button(props) {
44
- const { children = "", className = "", isDisabled = false, iconStart = "", iconEnd = "", isFullWidth = false, isLoading = false, isRounded = false, variant = "primary", size = 40, ...rest } = props;
44
+ const { className = "", isDisabled = false, iconStart = "", iconEnd = "", isFullWidth = false, isLoading = false, isRounded = false, label = "", variant = "primary", size = 40, ...rest } = props;
45
45
  return /* @__PURE__ */ jsxs("button", {
46
46
  className: button({
47
47
  className,
@@ -58,7 +58,7 @@ function Button(props) {
58
58
  children: [
59
59
  isLoading && /* @__PURE__ */ jsx(ButtonSpinner, {}),
60
60
  iconStart,
61
- /* @__PURE__ */ jsx("span", { children }),
61
+ /* @__PURE__ */ jsx("span", { children: label }),
62
62
  iconEnd
63
63
  ]
64
64
  });
@@ -90,8 +90,8 @@ 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", children, className: customClassName = "", isFullWidth = false, isRounded = false, size = 40, variant = "primary", ...rest } = props;
94
- return /* @__PURE__ */ jsx(as, {
93
+ const { as = "a", className: customClassName = "", iconEnd = "", iconStart = "", isFullWidth = false, isRounded = false, label = "", size = 40, variant = "primary", ...rest } = props;
94
+ return /* @__PURE__ */ jsxs(as, {
95
95
  className: button({
96
96
  className: customClassName,
97
97
  isFullWidth,
@@ -100,7 +100,11 @@ function ButtonLink(props) {
100
100
  variant
101
101
  }),
102
102
  ...rest,
103
- children
103
+ children: [
104
+ iconStart,
105
+ /* @__PURE__ */ jsx("span", { children: label }),
106
+ iconEnd
107
+ ]
104
108
  });
105
109
  }
106
110
  //#endregion
@@ -276,7 +280,7 @@ var icon_button_module_default = {
276
280
  //#endregion
277
281
  //#region src/components/icon-button/icon-button.tsx
278
282
  function IconButton(props) {
279
- const { children = "", className = "", isDisabled = false, isLoading = false, isRounded = false, variant = "primary", size = 40, ...rest } = props;
283
+ const { className = "", icon = "", isDisabled = false, isLoading = false, isRounded = false, variant = "primary", size = 40, ...rest } = props;
280
284
  return /* @__PURE__ */ jsxs("button", {
281
285
  className: cx(button({
282
286
  isDisabled,
@@ -291,7 +295,7 @@ function IconButton(props) {
291
295
  disabled: isDisabled || isLoading,
292
296
  type: "button",
293
297
  ...rest,
294
- children: [isLoading && /* @__PURE__ */ jsx(ButtonSpinner, {}), children]
298
+ children: [isLoading && /* @__PURE__ */ jsx(ButtonSpinner, {}), icon]
295
299
  });
296
300
  }
297
301
  const iconButton = cva(icon_button_module_default.base, { variants: { size: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nattstack/ui",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "description": "A collection of reusable React components built with Base UI, TypeScript, and CSS Modules",
5
5
  "keywords": [
6
6
  "base-ui",