@ciridae/ui 0.6.0 → 0.6.1

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.
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Slot } from "radix-ui";
3
3
  import { cn } from "../../lib/utils";
4
4
  import { buttonVariants } from "./button-variants";
@@ -6,21 +6,13 @@ import { Spinner } from "./spinner";
6
6
  function Button({ children, className, variant = "default", size = "default", asChild = false, disabled, loading = false, loadingLabel = "Loading", onClick, tabIndex, ...props }) {
7
7
  const Comp = asChild ? Slot.Root : "button";
8
8
  const isDisabled = disabled || loading;
9
- return (_jsx(Comp, { ...props, "data-slot": "button", "data-variant": variant, "data-size": size, "data-loading": getDataLoading(loading), "aria-busy": getAriaBusy(loading), "aria-disabled": getAriaDisabled(asChild, isDisabled), className: cn(buttonVariants({ variant, size }), className, getDisabledChildClass(asChild, isDisabled)), disabled: getDisabled(asChild, isDisabled), onClick: getClickHandler(asChild, isDisabled, onClick), tabIndex: getTabIndex(asChild, isDisabled, tabIndex), children: _jsx(ButtonChildren, { asChild: asChild, loading: loading, loadingLabel: loadingLabel, children: children }) }));
10
- }
11
- function ButtonChildren({ asChild, children, loading, loadingLabel, }) {
12
- return (_jsxs(_Fragment, { children: [_jsx(ButtonLoadingIcon, { loading: loading }), _jsx(ButtonContent, { asChild: asChild, children: children }), _jsx(ButtonLoadingLabel, { label: loadingLabel, loading: loading })] }));
9
+ return (_jsxs(Comp, { ...props, "data-slot": "button", "data-variant": variant, "data-size": size, "data-loading": getDataLoading(loading), "aria-busy": getAriaBusy(loading), "aria-disabled": getAriaDisabled(asChild, isDisabled), className: cn(buttonVariants({ variant, size }), className, getDisabledChildClass(asChild, isDisabled)), disabled: getDisabled(asChild, isDisabled), onClick: getClickHandler(asChild, isDisabled, onClick), tabIndex: getTabIndex(asChild, isDisabled, tabIndex), children: [_jsx(ButtonLoadingIcon, { loading: loading }), asChild ? _jsx(Slot.Slottable, { children: children }) : children, _jsx(ButtonLoadingLabel, { label: loadingLabel, loading: loading })] }));
13
10
  }
14
11
  function ButtonLoadingIcon({ loading }) {
15
12
  if (!loading)
16
13
  return null;
17
14
  return _jsx(Spinner, { "aria-hidden": "true", className: "shrink-0" });
18
15
  }
19
- function ButtonContent({ asChild, children }) {
20
- if (asChild)
21
- return _jsx(Slot.Slottable, { children: children });
22
- return _jsx(_Fragment, { children: children });
23
- }
24
16
  function ButtonLoadingLabel({ label, loading }) {
25
17
  if (!loading)
26
18
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciridae/ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "repository": {