@dgshahr/ui-kit 0.0.39 → 0.0.41
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/Drawer/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CSSProperties, FC,
|
|
2
|
-
interface DrawerProps {
|
|
1
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
export interface DrawerProps {
|
|
3
3
|
open: boolean;
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
persist?: boolean;
|
|
@@ -20,7 +20,8 @@ interface DrawerProps {
|
|
|
20
20
|
element?: ReactNode;
|
|
21
21
|
containerClassName?: string;
|
|
22
22
|
};
|
|
23
|
+
children?: ReactNode | undefined;
|
|
23
24
|
}
|
|
24
|
-
declare const Drawer: FC<
|
|
25
|
+
declare const Drawer: FC<DrawerProps>;
|
|
25
26
|
export default Drawer;
|
|
26
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzF,OAAO,kBAAkB,CAAC;AAM1B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,aAAa,CAAC,EAAE,SAAS,CAAC;QAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,SAAS,CAAC;QACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC;AAoBD,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAmI3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";require('../../assets/styles.css');const l=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";require('../../assets/styles.css');const l=require("react/jsx-runtime"),h=require("../../clsx-C11secjj.cjs"),k=require("react"),I=require("../Input/index.cjs"),m=require("../../TextFieldWrapper-BbzQMKCb.cjs");;/* empty css */const v=y=>{const{inputsNumber:u=4,onChange:a,onEnd:f,className:j,inputsContainerClassName:C,labelContent:p,hintMessage:g,errorMessage:c,isError:w,value:n}=y,o=k.useRef(!1);function r(s){const e=document.getElementById(`dgs-ui-kit-otp-input-${s}`);e?.focus(),e?.select()}function E(s,e){const t=[s.code,s.key];if(t.includes("Backspace")||t.includes("Delete")){const i=n.split("");i[e]="",e!==0&&(i[e-1]="",r(e-1)),a(i.join(""))}else t.includes("ArrowLeft")?r(e-1):t.includes("ArrowRight")&&r(e+1)}function N(s,e){const t=s.currentTarget.value,i=n.split("");t.length>1?t.split("").forEach((q,d)=>{d<u&&(i[d]=q)}):i[e]=t,a(i.join("")),e+1!==u&&t&&r(e+1)}return k.useEffect(()=>{n.length===u&&o.current?(o.current=!1,typeof f=="function"&&f(n)):n.length<u&&(o.current=!0)},[n]),l.jsxs("div",{className:h.clsx("dgs-ui-kit-space-y-2",j),children:[p?l.jsx(m.FieldLabel,{labelContent:p}):null,l.jsx("div",{className:h.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-2 [direction:ltr]",C),children:Array.from(Array(u).keys()).map((s,e)=>l.jsx(I,{containerClassName:"dgs-ui-kit-w-12 dgs-ui-kit-h-12 dgs-ui-kit-p-0",className:"dgs-ui-kit-w-full dgs-ui-kit-h-full !dgs-ui-kit-text-center placeholder:!dgs-ui-kit-text-center",placeholder:"-",type:"tel",autoFocus:e===0,onChange:t=>N(t,e),onKeyUp:t=>E(t,e),id:`dgs-ui-kit-otp-input-${e}`,value:n[e]||"",showMaxLength:!1,isError:!!c||w,autoComplete:"off",maxLength:1},s))}),c||g?l.jsx(m.FieldBottomInfo,{errorMessage:c,hintMessage:g}):null]})};module.exports=v;
|
|
@@ -2,11 +2,11 @@ import { FC } from 'react';
|
|
|
2
2
|
import { TextFieldBaseProps } from '../Wrappers/TextFieldWrapper/TextFieldWrapper';
|
|
3
3
|
export interface OtpInputProps extends Pick<TextFieldBaseProps, 'labelContent' | 'errorMessage' | 'isError' | 'hintMessage'> {
|
|
4
4
|
inputsNumber?: number;
|
|
5
|
-
onChange
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
6
|
onEnd?: (value: string) => void;
|
|
7
7
|
className?: string;
|
|
8
8
|
inputsContainerClassName?: string;
|
|
9
|
-
value
|
|
9
|
+
value: string;
|
|
10
10
|
}
|
|
11
11
|
declare const OtpInput: FC<OtpInputProps>;
|
|
12
12
|
export default OtpInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/OtpInput/index.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/OtpInput/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAuC,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AAIzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,cAAc,GAAG,cAAc,GAAG,SAAS,GAAG,aAAa,CAAC;IAC7F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA2G/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,85 +1,81 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { F, a as
|
|
2
|
+
import { jsxs as I, jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { c as d } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import { useRef as v, useEffect as j } from "react";
|
|
5
|
+
import A from "../Input/index.js";
|
|
6
|
+
import { F as B, a as F } from "../../TextFieldWrapper-D9d-4wo1.js";
|
|
7
7
|
import '../../assets/styles.css';/* empty css */
|
|
8
|
-
const
|
|
8
|
+
const R = (h) => {
|
|
9
9
|
const {
|
|
10
|
-
inputsNumber:
|
|
11
|
-
onChange:
|
|
12
|
-
onEnd:
|
|
13
|
-
className:
|
|
14
|
-
inputsContainerClassName:
|
|
15
|
-
labelContent:
|
|
16
|
-
hintMessage:
|
|
17
|
-
errorMessage:
|
|
18
|
-
isError:
|
|
19
|
-
value:
|
|
20
|
-
} =
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
|
|
10
|
+
inputsNumber: l = 4,
|
|
11
|
+
onChange: c,
|
|
12
|
+
onEnd: f,
|
|
13
|
+
className: k,
|
|
14
|
+
inputsContainerClassName: y,
|
|
15
|
+
labelContent: p,
|
|
16
|
+
hintMessage: g,
|
|
17
|
+
errorMessage: r,
|
|
18
|
+
isError: C,
|
|
19
|
+
value: i
|
|
20
|
+
} = h, a = v(!1);
|
|
21
|
+
function o(s) {
|
|
22
|
+
const e = document.getElementById(`dgs-ui-kit-otp-input-${s}`);
|
|
23
|
+
e?.focus(), e?.select();
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
} else
|
|
31
|
-
e.includes(c[t]) && n(t);
|
|
25
|
+
function w(s, e) {
|
|
26
|
+
const t = [s.code, s.key];
|
|
27
|
+
if (t.includes("Backspace") || t.includes("Delete")) {
|
|
28
|
+
const n = i.split("");
|
|
29
|
+
n[e] = "", e !== 0 && (n[e - 1] = "", o(e - 1)), c(n.join(""));
|
|
30
|
+
} else t.includes("ArrowLeft") ? o(e - 1) : t.includes("ArrowRight") && o(e + 1);
|
|
32
31
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
|
|
32
|
+
function E(s, e) {
|
|
33
|
+
const t = s.currentTarget.value, n = i.split("");
|
|
34
|
+
t.length > 1 ? t.split("").forEach((N, m) => {
|
|
35
|
+
m < l && (n[m] = N);
|
|
36
|
+
}) : n[e] = t, c(n.join("")), e + 1 !== l && t && o(e + 1);
|
|
36
37
|
}
|
|
37
38
|
return j(() => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
n(o.length), t && typeof a == "function" && a(o);
|
|
43
|
-
}
|
|
44
|
-
}, [o]), /* @__PURE__ */ E("div", { className: h("dgs-ui-kit-space-y-2", y), children: [
|
|
45
|
-
m ? /* @__PURE__ */ r(F, { labelContent: m }) : null,
|
|
46
|
-
/* @__PURE__ */ r(
|
|
39
|
+
i.length === l && a.current ? (a.current = !1, typeof f == "function" && f(i)) : i.length < l && (a.current = !0);
|
|
40
|
+
}, [i]), /* @__PURE__ */ I("div", { className: d("dgs-ui-kit-space-y-2", k), children: [
|
|
41
|
+
p ? /* @__PURE__ */ u(B, { labelContent: p }) : null,
|
|
42
|
+
/* @__PURE__ */ u(
|
|
47
43
|
"div",
|
|
48
44
|
{
|
|
49
|
-
className:
|
|
45
|
+
className: d(
|
|
50
46
|
"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-gap-2 [direction:ltr]",
|
|
51
|
-
|
|
47
|
+
y
|
|
52
48
|
),
|
|
53
|
-
children: Array.from(Array(
|
|
54
|
-
|
|
49
|
+
children: Array.from(Array(l).keys()).map((s, e) => /* @__PURE__ */ u(
|
|
50
|
+
A,
|
|
55
51
|
{
|
|
56
52
|
containerClassName: "dgs-ui-kit-w-12 dgs-ui-kit-h-12 dgs-ui-kit-p-0",
|
|
57
53
|
className: "dgs-ui-kit-w-full dgs-ui-kit-h-full !dgs-ui-kit-text-center placeholder:!dgs-ui-kit-text-center",
|
|
58
54
|
placeholder: "-",
|
|
59
55
|
type: "tel",
|
|
60
|
-
autoFocus:
|
|
61
|
-
onChange: (
|
|
62
|
-
onKeyUp: (
|
|
63
|
-
id: `dgs-ui-kit-otp-input-${
|
|
64
|
-
value:
|
|
56
|
+
autoFocus: e === 0,
|
|
57
|
+
onChange: (t) => E(t, e),
|
|
58
|
+
onKeyUp: (t) => w(t, e),
|
|
59
|
+
id: `dgs-ui-kit-otp-input-${e}`,
|
|
60
|
+
value: i[e] || "",
|
|
65
61
|
showMaxLength: !1,
|
|
66
|
-
isError: !!
|
|
62
|
+
isError: !!r || C,
|
|
67
63
|
autoComplete: "off",
|
|
68
64
|
maxLength: 1
|
|
69
65
|
},
|
|
70
|
-
|
|
66
|
+
s
|
|
71
67
|
))
|
|
72
68
|
}
|
|
73
69
|
),
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
r || g ? /* @__PURE__ */ u(
|
|
71
|
+
F,
|
|
76
72
|
{
|
|
77
|
-
errorMessage:
|
|
78
|
-
hintMessage:
|
|
73
|
+
errorMessage: r,
|
|
74
|
+
hintMessage: g
|
|
79
75
|
}
|
|
80
76
|
) : null
|
|
81
77
|
] });
|
|
82
78
|
};
|
|
83
79
|
export {
|
|
84
|
-
|
|
80
|
+
R as default
|
|
85
81
|
};
|