@kadoui/react 1.3.8 → 1.4.9

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
1
  import { HTMLAttributes } from "react";
2
2
  export type CarouselRootPropsT = HTMLAttributes<HTMLDivElement>;
3
- export declare function CarouselRoot(p: CarouselRootPropsT): import("react/jsx-runtime").JSX.Element;
3
+ export declare function CarouselRoot({ dir, ...p }: CarouselRootPropsT): import("react/jsx-runtime").JSX.Element;
4
4
  //# sourceMappingURL=CarouselRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarouselRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/CarouselRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAIpE,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEhE,wBAAgB,YAAY,CAAC,CAAC,EAAE,kBAAkB,2CA+CjD"}
1
+ {"version":3,"file":"CarouselRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Carousel/CarouselRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAIpE,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEhE,wBAAgB,YAAY,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,kBAAkB,2CAiD7D"}
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { CarouselContext } from "./CarouselContext";
5
- export function CarouselRoot(p) {
5
+ export function CarouselRoot({ dir, ...p }) {
6
6
  const scrollRef = useRef(null);
7
7
  const [leftOpacity, setLeftOpacity] = useState(0);
8
8
  const [rightOpacity, setRightOpacity] = useState(1);
@@ -18,10 +18,11 @@ export function CarouselRoot(p) {
18
18
  return;
19
19
  }
20
20
  const scrollRatio = Math.abs(+(scrollLeft / maxScroll));
21
- const left = Math.min(1, scrollRatio * 2);
22
- const right = Math.min(1, (1 - scrollRatio) * 2);
23
- setLeftOpacity(+left.toFixed(1));
24
- setRightOpacity(+right.toFixed(1));
21
+ const left = +(Math.min(1, scrollRatio * 2).toFixed(1));
22
+ const right = +(Math.min(1, (1 - scrollRatio) * 2).toFixed(1));
23
+ const currentDir = (dir || document.documentElement.getAttribute("dir") || "ltr");
24
+ setLeftOpacity(currentDir === "ltr" ? right : left);
25
+ setRightOpacity(currentDir === "ltr" ? left : right);
25
26
  };
26
27
  useEffect(() => {
27
28
  const el = scrollRef.current;
@@ -0,0 +1,6 @@
1
+ import { SubmitRoot } from "./SubmitRoot";
2
+ import { SubmitLoader } from "./SubmitLoader";
3
+ export declare const Submit: typeof SubmitRoot & {
4
+ Loader: typeof SubmitLoader;
5
+ };
6
+ //# sourceMappingURL=Submit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Submit.d.ts","sourceRoot":"","sources":["../../../src/components/Submit/Submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,MAAM;;CAEjB,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { SubmitRoot } from "./SubmitRoot";
2
+ import { SubmitLoader } from "./SubmitLoader";
3
+ export const Submit = Object.assign(SubmitRoot, {
4
+ Loader: SubmitLoader
5
+ });
@@ -0,0 +1,5 @@
1
+ export type SubmitContextT = {
2
+ pending: boolean;
3
+ };
4
+ export declare const SubmitContext: import("react").Context<SubmitContextT>;
5
+ //# sourceMappingURL=SubmitContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmitContext.d.ts","sourceRoot":"","sources":["../../../src/components/Submit/SubmitContext.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB,CAAA;AAED,eAAO,MAAM,aAAa,yCAAsC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { createContext } from "react";
2
+ export const SubmitContext = createContext({});
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren, ReactNode } from "react";
2
+ export type SubmitLoaderPropsT = PropsWithChildren & {
3
+ loader: ReactNode;
4
+ };
5
+ export declare function SubmitLoader({ children, loader }: SubmitLoaderPropsT): ReactNode;
6
+ //# sourceMappingURL=SubmitLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmitLoader.d.ts","sourceRoot":"","sources":["../../../src/components/Submit/SubmitLoader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAO,MAAM,OAAO,CAAC;AAI1D,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IACnD,MAAM,EAAE,SAAS,CAAC;CACnB,CAAA;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,kBAAkB,aAIpE"}
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { use } from "react";
3
+ import { SubmitContext } from "./SubmitContext";
4
+ export function SubmitLoader({ children, loader }) {
5
+ const { pending } = use(SubmitContext);
6
+ return pending ? loader : children;
7
+ }
@@ -0,0 +1,6 @@
1
+ import { ButtonHTMLAttributes, ReactNode } from "react";
2
+ export type SubmitRootPropsT = ButtonHTMLAttributes<HTMLButtonElement> & {
3
+ loader?: ReactNode;
4
+ };
5
+ export declare function SubmitRoot({ disabled, ...p }: SubmitRootPropsT): import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=SubmitRoot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmitRoot.d.ts","sourceRoot":"","sources":["../../../src/components/Submit/SubmitRoot.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIxD,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACvE,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,EAAE,gBAAgB,2CAW9D"}
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useFormStatus } from "react-dom";
4
+ import { SubmitContext } from "./SubmitContext";
5
+ export function SubmitRoot({ disabled, ...p }) {
6
+ const { pending } = useFormStatus();
7
+ return (_jsx(SubmitContext, { value: { pending }, children: _jsx("button", { disabled: disabled || pending, ...p }) }));
8
+ }
package/dist/index.d.ts CHANGED
@@ -23,4 +23,5 @@ export * from "./components/Spoiler/Spoiler";
23
23
  export * from "./components/Steps/Steps";
24
24
  export * from "./components/Swap/Swap";
25
25
  export * from "./components/Tabs/Tabs";
26
+ export * from "./components/Submit/Submit";
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -23,3 +23,4 @@ export * from "./components/Spoiler/Spoiler";
23
23
  export * from "./components/Steps/Steps";
24
24
  export * from "./components/Swap/Swap";
25
25
  export * from "./components/Tabs/Tabs";
26
+ export * from "./components/Submit/Submit";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadoui/react",
3
- "version": "1.3.8",
3
+ "version": "1.4.9",
4
4
  "description": "Kadoui primitive components for React",
5
5
  "author": "ArrowUp",
6
6
  "license": "MIT",