lecom-ui 5.2.45 → 5.2.46

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.
@@ -2,7 +2,26 @@ import * as React from 'react';
2
2
  import { cn } from '../../lib/utils.js';
3
3
  import * as SwitchPrimitives from '@radix-ui/react-switch';
4
4
 
5
- const Switch = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React.createElement(
5
+ const Spinner = () => /* @__PURE__ */ React.createElement("svg", { className: "animate-spin h-4 w-4 text-blue-600", viewBox: "0 0 24 24" }, /* @__PURE__ */ React.createElement(
6
+ "circle",
7
+ {
8
+ className: "opacity-25",
9
+ cx: "12",
10
+ cy: "12",
11
+ r: "10",
12
+ stroke: "currentColor",
13
+ strokeWidth: "4",
14
+ fill: "none"
15
+ }
16
+ ), /* @__PURE__ */ React.createElement(
17
+ "path",
18
+ {
19
+ className: "opacity-75",
20
+ fill: "currentColor",
21
+ d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"
22
+ }
23
+ ));
24
+ const Switch = React.forwardRef(({ className, loading = false, disabled, ...props }, ref) => /* @__PURE__ */ React.createElement(
6
25
  SwitchPrimitives.Root,
7
26
  {
8
27
  className: cn(
@@ -10,15 +29,17 @@ const Switch = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
10
29
  className
11
30
  ),
12
31
  ref,
32
+ disabled: disabled || loading,
13
33
  ...props
14
34
  },
15
35
  /* @__PURE__ */ React.createElement(
16
36
  SwitchPrimitives.Thumb,
17
37
  {
18
38
  className: cn(
19
- "pointer-events-none rounded-full shadow-sm transition-all h-4 w-4 data-[state=unchecked]:bg-grey-400 data-[state=unchecked]:translate-x-1 group-hover:data-[state=unchecked]:bg-grey-500 group-focus:ring-8 group-focus:ring-blue-200 group-focus:ring-opacity-50 group-active:group-enabled:h-5 group-active:group-enabled:w-5 group-active:data-[state=unchecked]:bg-grey-700 group-active:group-enabled:data-[state=unchecked]:translate-x-[-2px] group-disabled:data-[state=unchecked]:bg-grey-300 group-disabled:data-[state=unchecked]:bg-opacity-65 data-[state=checked]:bg-white data-[state=checked]:translate-x-6"
39
+ "pointer-events-none rounded-full shadow-sm transition-all h-4 w-4 data-[state=unchecked]:bg-grey-400 data-[state=unchecked]:translate-x-1 group-hover:data-[state=unchecked]:bg-grey-500 group-focus:ring-8 group-focus:ring-blue-200 group-focus:ring-opacity-50 group-active:group-enabled:h-5 group-active:group-enabled:w-5 group-active:data-[state=unchecked]:bg-grey-700 group-active:group-enabled:data-[state=unchecked]:translate-x-[-2px] group-disabled:data-[state=unchecked]:bg-grey-300 group-disabled:data-[state=unchecked]:bg-opacity-65 data-[state=checked]:bg-white data-[state=checked]:translate-x-6 flex items-center justify-center"
20
40
  )
21
- }
41
+ },
42
+ loading && /* @__PURE__ */ React.createElement(Spinner, null)
22
43
  )
23
44
  ));
24
45
  Switch.displayName = "Switch";
package/dist/index.d.ts CHANGED
@@ -935,7 +935,10 @@ interface SpinProps extends React$1.SVGAttributes<SVGSVGElement> {
935
935
  }
936
936
  declare const Spin: React$1.ForwardRefExoticComponent<SpinProps & React$1.RefAttributes<SVGSVGElement>>;
937
937
 
938
- declare const Switch: React$1.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
938
+ interface SwitchProps extends React$1.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
939
+ loading?: boolean;
940
+ }
941
+ declare const Switch: React$1.ForwardRefExoticComponent<SwitchProps & React$1.RefAttributes<HTMLButtonElement>>;
939
942
 
940
943
  declare const tagVariants: (props?: ({
941
944
  color?: "blue" | "grey" | "purple" | "yellow" | "red" | "orange" | "green" | "pink" | "turquoise" | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.2.45",
3
+ "version": "5.2.46",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
@@ -120,4 +120,4 @@
120
120
  "overrides": {
121
121
  "react-is": "^19.0.0-rc-69d4b800-20241021"
122
122
  }
123
- }
123
+ }