@youngonesworks/ui 0.1.19 → 0.1.20

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/index.js CHANGED
@@ -103326,10 +103326,13 @@ BreadCrumb.displayName = "BreadCrumb";
103326
103326
 
103327
103327
  //#endregion
103328
103328
  //#region src/icons/IconLoading.tsx
103329
- const IconLoading = (props) => /* @__PURE__ */ jsxs("svg", {
103329
+ const IconLoading = ({ className,...props }) => /* @__PURE__ */ jsxs("svg", {
103330
103330
  "data-component": "button",
103331
103331
  "data-testid": "loading-svg-button",
103332
103332
  viewBox: "0 0 256 256",
103333
+ width: "1em",
103334
+ height: "1em",
103335
+ className,
103333
103336
  ...props,
103334
103337
  children: [
103335
103338
  /* @__PURE__ */ jsx("line", {
@@ -103423,22 +103426,22 @@ const buttonVariants = {
103423
103426
 
103424
103427
  //#endregion
103425
103428
  //#region src/components/button/index.tsx
103426
- const Button = forwardRef(({ type = "button", variant = "primary", ariaLabel, block = false, isLoading = false, icon: iconFromProps = null, iconRight = false, onClick, className, children, dataTestId,...props }, ref) => {
103427
- const icon = isLoading ? /* @__PURE__ */ jsx(IconLoading, { className: "animate-spin-slow mr-2 stroke-current" }) : iconFromProps;
103428
- const formattedIcon = formatIcon(icon, { className: clsx_default("size-[1.125rem]", {
103429
+ function Button({ type = "button", variant = "primary", ariaLabel, block = false, isLoading = false, icon: iconFromProps = null, iconRight = false, onClick, className, children, dataTestId,...props }) {
103430
+ const loadingIcon = /* @__PURE__ */ jsx(IconLoading, { className: "animate-spin-slow mr-2 stroke-current" });
103431
+ const icon = isLoading ? loadingIcon : iconFromProps;
103432
+ const formattedIcon = icon ? formatIcon(icon, { className: clsx_default({
103429
103433
  "-mr-2": iconRight,
103430
103434
  "-ml-2": !iconRight
103431
- }) });
103435
+ }, icon === loadingIcon ? "text-current" : "size-[1.125rem]") }) : null;
103432
103436
  const handleOnClick = (event) => {
103433
- onClick && onClick(event);
103437
+ onClick?.(event);
103434
103438
  };
103435
103439
  return /* @__PURE__ */ jsxs("button", {
103436
103440
  type,
103437
103441
  "aria-label": ariaLabel,
103438
103442
  "data-testid": dataTestId,
103439
103443
  className: cn(buttonVariants[variant], className, block && "w-full"),
103440
- onClick: (event) => handleOnClick(event),
103441
- ref,
103444
+ onClick: handleOnClick,
103442
103445
  ...props,
103443
103446
  children: [
103444
103447
  !iconRight && formattedIcon,
@@ -103446,7 +103449,7 @@ const Button = forwardRef(({ type = "button", variant = "primary", ariaLabel, bl
103446
103449
  iconRight && formattedIcon
103447
103450
  ]
103448
103451
  });
103449
- });
103452
+ }
103450
103453
  Button.displayName = "Button";
103451
103454
 
103452
103455
  //#endregion