@adam-milo/ui 1.0.20 → 1.0.22
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.cjs +1 -1
- package/dist/index.js +53 -53
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +38 -36
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +82 -76
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +50 -49
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +30 -30
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +348 -209
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +92 -82
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +32 -31
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +10 -7
- package/dist/index19.cjs +1 -0
- package/dist/index19.js +22 -0
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +26 -26
- package/dist/index20.cjs +1 -0
- package/dist/index20.js +301 -0
- package/dist/index21.cjs +1 -0
- package/dist/index21.js +16 -0
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +37 -95
- package/dist/index30.cjs +1 -0
- package/dist/index30.js +9 -0
- package/dist/index33.cjs +1 -0
- package/dist/index33.js +21 -0
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +18 -174
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +51 -155
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +102 -159
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +76 -61
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +68 -54
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +47 -43
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.component.d.ts +23 -38
- package/dist/src/components/forms/alphanumeric-input/AlphanumericInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/email-input/EmailInput.component.d.ts +17 -20
- package/dist/src/components/forms/email-input/EmailInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/input/Input.component.d.ts +105 -0
- package/dist/src/components/forms/input/Input.component.d.ts.map +1 -0
- package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts +30 -48
- package/dist/src/components/forms/numeric-input/NumericInput.component.d.ts.map +1 -1
- package/dist/src/components/forms/password-input/PasswordInput.component.d.ts +19 -16
- package/dist/src/components/forms/password-input/PasswordInput.component.d.ts.map +1 -1
- package/dist/src/lib/debounce.d.ts +12 -0
- package/dist/src/lib/debounce.d.ts.map +1 -0
- package/dist/src/lib/debounce.spec.d.ts +2 -0
- package/dist/src/lib/debounce.spec.d.ts.map +1 -0
- package/dist/src/lib/dev-utils.d.ts +41 -0
- package/dist/src/lib/dev-utils.d.ts.map +1 -0
- package/dist/src/lib/index.d.ts +15 -2
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/useMergedRef.d.ts +19 -0
- package/dist/src/lib/useMergedRef.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +5 -2
package/dist/index15.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),t=require("@radix-ui/react-dialog"),o=require("./index17.cjs");function i(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}return a.default=e,Object.freeze(a)};/* empty css */const r=i(t),s=r.Root,d=r.Trigger,l=r.Portal,c=r.Close,n=a.forwardRef(({className:a,"data-cy":t,"data-testid":i,...s},d)=>{const l=t||"dialog-overlay",c=i||"dialog-overlay";return e.jsx(r.Overlay,{ref:d,className:o.cn("dialog-overlay",a),"data-cy":l,"data-testid":c,...s})});n.displayName=r.Overlay.displayName;const g=a.forwardRef(({className:a,children:t,"data-cy":i,"data-testid":s,...d},c)=>{const g=i||"dialog-content",y=s||"dialog-content";return e.jsxs(l,{children:[e.jsx(n,{}),e.jsx(r.Content,{ref:c,className:o.cn("dialog-content",a),"data-cy":g,"data-testid":y,...d,children:t})]})});g.displayName=r.Content.displayName;const y=({className:a,"data-cy":t,"data-testid":i,...r})=>{const s=t||"dialog-header",d=i||"dialog-header";return e.jsx("div",{className:o.cn("dialog-header",a),"data-cy":s,"data-testid":d,...r})};y.displayName="DialogHeader";const p=({className:a,"data-cy":t,"data-testid":i,...r})=>{const s=t||"dialog-footer",d=i||"dialog-footer";return e.jsx("div",{className:o.cn("dialog-footer",a),"data-cy":s,"data-testid":d,...r})};p.displayName="DialogFooter";const m=a.forwardRef(({className:a,"data-cy":t,"data-testid":i,...s},d)=>{const l=t||"dialog-title",c=i||"dialog-title";return e.jsx(r.Title,{ref:d,className:o.cn("dialog-title",a),"data-cy":l,"data-testid":c,...s})});m.displayName=r.Title.displayName;const f=a.forwardRef(({className:a,"data-cy":t,"data-testid":i,...s},d)=>{const l=t||"dialog-description",c=i||"dialog-description";return e.jsx(r.Description,{ref:d,className:o.cn("dialog-description",a),"data-cy":l,"data-testid":c,...s})});f.displayName=r.Description.displayName,exports.Dialog=s,exports.DialogClose=c,exports.DialogContent=g,exports.DialogDescription=f,exports.DialogFooter=p,exports.DialogHeader=y,exports.DialogOverlay=n,exports.DialogPortal=l,exports.DialogTitle=m,exports.DialogTrigger=d;
|
package/dist/index15.js
CHANGED
|
@@ -1,115 +1,125 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import * as
|
|
4
|
-
import { cn
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
4
|
+
import { cn } from "./index17.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const Dialog = DialogPrimitive.Root;
|
|
7
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
8
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
9
|
+
const DialogClose = DialogPrimitive.Close;
|
|
10
|
+
const DialogOverlay = forwardRef(({ className, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
11
|
+
const finalDataCy = dataCy || "dialog-overlay";
|
|
12
|
+
const finalTestId = dataTestId || "dialog-overlay";
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
DialogPrimitive.Overlay,
|
|
10
15
|
{
|
|
11
|
-
ref
|
|
12
|
-
className:
|
|
13
|
-
"data-cy":
|
|
14
|
-
"data-testid":
|
|
15
|
-
...
|
|
16
|
+
ref,
|
|
17
|
+
className: cn("dialog-overlay", className),
|
|
18
|
+
"data-cy": finalDataCy,
|
|
19
|
+
"data-testid": finalTestId,
|
|
20
|
+
...props
|
|
16
21
|
}
|
|
17
22
|
);
|
|
18
23
|
});
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
24
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
25
|
+
const DialogContent = forwardRef(({ className, children, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
26
|
+
const finalDataCy = dataCy || "dialog-content";
|
|
27
|
+
const finalTestId = dataTestId || "dialog-content";
|
|
28
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
DialogPrimitive.Content,
|
|
26
32
|
{
|
|
27
|
-
ref
|
|
28
|
-
className:
|
|
29
|
-
"data-cy":
|
|
30
|
-
"data-testid":
|
|
31
|
-
...
|
|
32
|
-
children
|
|
33
|
+
ref,
|
|
34
|
+
className: cn("dialog-content", className),
|
|
35
|
+
"data-cy": finalDataCy,
|
|
36
|
+
"data-testid": finalTestId,
|
|
37
|
+
...props,
|
|
38
|
+
children
|
|
33
39
|
}
|
|
34
40
|
)
|
|
35
41
|
] });
|
|
36
42
|
});
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
className
|
|
40
|
-
"data-cy":
|
|
41
|
-
"data-testid":
|
|
42
|
-
...
|
|
43
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
44
|
+
const DialogHeader = ({
|
|
45
|
+
className,
|
|
46
|
+
"data-cy": dataCy,
|
|
47
|
+
"data-testid": dataTestId,
|
|
48
|
+
...props
|
|
43
49
|
}) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
50
|
+
const finalDataCy = dataCy || "dialog-header";
|
|
51
|
+
const finalTestId = dataTestId || "dialog-header";
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
46
53
|
"div",
|
|
47
54
|
{
|
|
48
|
-
className:
|
|
49
|
-
"data-cy":
|
|
50
|
-
"data-testid":
|
|
51
|
-
...
|
|
55
|
+
className: cn("dialog-header", className),
|
|
56
|
+
"data-cy": finalDataCy,
|
|
57
|
+
"data-testid": finalTestId,
|
|
58
|
+
...props
|
|
52
59
|
}
|
|
53
60
|
);
|
|
54
61
|
};
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
className
|
|
58
|
-
"data-cy":
|
|
59
|
-
"data-testid":
|
|
60
|
-
...
|
|
62
|
+
DialogHeader.displayName = "DialogHeader";
|
|
63
|
+
const DialogFooter = ({
|
|
64
|
+
className,
|
|
65
|
+
"data-cy": dataCy,
|
|
66
|
+
"data-testid": dataTestId,
|
|
67
|
+
...props
|
|
61
68
|
}) => {
|
|
62
|
-
const
|
|
63
|
-
|
|
69
|
+
const finalDataCy = dataCy || "dialog-footer";
|
|
70
|
+
const finalTestId = dataTestId || "dialog-footer";
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
64
72
|
"div",
|
|
65
73
|
{
|
|
66
|
-
className:
|
|
67
|
-
"data-cy":
|
|
68
|
-
"data-testid":
|
|
69
|
-
...
|
|
74
|
+
className: cn("dialog-footer", className),
|
|
75
|
+
"data-cy": finalDataCy,
|
|
76
|
+
"data-testid": finalTestId,
|
|
77
|
+
...props
|
|
70
78
|
}
|
|
71
79
|
);
|
|
72
80
|
};
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
({ className
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
DialogFooter.displayName = "DialogFooter";
|
|
82
|
+
const DialogTitle = forwardRef(
|
|
83
|
+
({ className, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
84
|
+
const finalDataCy = dataCy || "dialog-title";
|
|
85
|
+
const finalTestId = dataTestId || "dialog-title";
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
DialogPrimitive.Title,
|
|
79
88
|
{
|
|
80
|
-
ref
|
|
81
|
-
className:
|
|
82
|
-
"data-cy":
|
|
83
|
-
"data-testid":
|
|
84
|
-
...
|
|
89
|
+
ref,
|
|
90
|
+
className: cn("dialog-title", className),
|
|
91
|
+
"data-cy": finalDataCy,
|
|
92
|
+
"data-testid": finalTestId,
|
|
93
|
+
...props
|
|
85
94
|
}
|
|
86
95
|
);
|
|
87
96
|
}
|
|
88
97
|
);
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
98
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
99
|
+
const DialogDescription = forwardRef(({ className, "data-cy": dataCy, "data-testid": dataTestId, ...props }, ref) => {
|
|
100
|
+
const finalDataCy = dataCy || "dialog-description";
|
|
101
|
+
const finalTestId = dataTestId || "dialog-description";
|
|
102
|
+
return /* @__PURE__ */ jsx(
|
|
103
|
+
DialogPrimitive.Description,
|
|
94
104
|
{
|
|
95
|
-
ref
|
|
96
|
-
className:
|
|
97
|
-
"data-cy":
|
|
98
|
-
"data-testid":
|
|
99
|
-
...
|
|
105
|
+
ref,
|
|
106
|
+
className: cn("dialog-description", className),
|
|
107
|
+
"data-cy": finalDataCy,
|
|
108
|
+
"data-testid": finalTestId,
|
|
109
|
+
...props
|
|
100
110
|
}
|
|
101
111
|
);
|
|
102
112
|
});
|
|
103
|
-
|
|
113
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
104
114
|
export {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
Dialog,
|
|
116
|
+
DialogClose,
|
|
117
|
+
DialogContent,
|
|
118
|
+
DialogDescription,
|
|
119
|
+
DialogFooter,
|
|
120
|
+
DialogHeader,
|
|
121
|
+
DialogOverlay,
|
|
122
|
+
DialogPortal,
|
|
123
|
+
DialogTitle,
|
|
124
|
+
DialogTrigger
|
|
115
125
|
};
|
package/dist/index16.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),e=require("./index17.cjs");;/* empty css */const s=a.forwardRef(({direction:a="vertical",spacing:s="4",align:c="stretch",justify:r="start",wrap:i=!1,className:n,children:d,"data-cy":l,"data-testid":o,...u},k)=>{const p=l||`stack-${a}`,j=o||`stack-${a}`;return t.jsx("div",{ref:k,className:e.cn("stack",`stack--${a}`,`stack--spacing-${s}`,`stack--align-${c}`,`stack--justify-${r}`,i&&"stack--wrap",n),"data-cy":p,"data-testid":j,...u,children:d})});s.displayName="Stack",exports.Stack=s;
|
package/dist/index16.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { cn
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "./index17.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
const
|
|
5
|
+
const Stack = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
direction
|
|
8
|
-
spacing
|
|
9
|
-
align
|
|
10
|
-
justify
|
|
11
|
-
wrap
|
|
12
|
-
className
|
|
13
|
-
children
|
|
14
|
-
"data-cy":
|
|
15
|
-
"data-testid":
|
|
16
|
-
...
|
|
17
|
-
},
|
|
18
|
-
const
|
|
19
|
-
|
|
7
|
+
direction = "vertical",
|
|
8
|
+
spacing = "4",
|
|
9
|
+
align = "stretch",
|
|
10
|
+
justify = "start",
|
|
11
|
+
wrap = false,
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
"data-cy": dataCy,
|
|
15
|
+
"data-testid": dataTestId,
|
|
16
|
+
...props
|
|
17
|
+
}, ref) => {
|
|
18
|
+
const finalDataCy = dataCy || `stack-${direction}`;
|
|
19
|
+
const finalTestId = dataTestId || `stack-${direction}`;
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
20
21
|
"div",
|
|
21
22
|
{
|
|
22
|
-
ref
|
|
23
|
-
className:
|
|
23
|
+
ref,
|
|
24
|
+
className: cn(
|
|
24
25
|
"stack",
|
|
25
|
-
`stack--${
|
|
26
|
-
`stack--spacing-${
|
|
27
|
-
`stack--align-${
|
|
28
|
-
`stack--justify-${
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
`stack--${direction}`,
|
|
27
|
+
`stack--spacing-${spacing}`,
|
|
28
|
+
`stack--align-${align}`,
|
|
29
|
+
`stack--justify-${justify}`,
|
|
30
|
+
wrap && "stack--wrap",
|
|
31
|
+
className
|
|
31
32
|
),
|
|
32
|
-
"data-cy":
|
|
33
|
-
"data-testid":
|
|
34
|
-
...
|
|
35
|
-
children
|
|
33
|
+
"data-cy": finalDataCy,
|
|
34
|
+
"data-testid": finalTestId,
|
|
35
|
+
...props,
|
|
36
|
+
children
|
|
36
37
|
}
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
|
-
|
|
41
|
+
Stack.displayName = "Stack";
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
Stack
|
|
43
44
|
};
|
package/dist/index17.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("clsx"),r=require("tailwind-merge");let t=0;exports.cn=function(...t){return r.twMerge(e.clsx(t))},exports.generateId=function(e="id"){return t+=1,`${e}-${t}`};
|
package/dist/index17.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
function cn(...inputs) {
|
|
4
|
+
return twMerge(clsx(inputs));
|
|
3
5
|
}
|
|
4
|
-
let
|
|
5
|
-
function
|
|
6
|
-
|
|
6
|
+
let idCounter = 0;
|
|
7
|
+
function generateId(prefix = "id") {
|
|
8
|
+
idCounter += 1;
|
|
9
|
+
return `${prefix}-${idCounter}`;
|
|
7
10
|
}
|
|
8
11
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
cn,
|
|
13
|
+
generateId
|
|
11
14
|
};
|
package/dist/index19.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var t=/^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;exports.validate=function(e){if(!e)return!1;if(e.length>254)return!1;if(!t.test(e))return!1;var r=e.split("@");return!(r[0].length>64)&&!r[1].split(".").some(function(t){return t.length>63})};
|
package/dist/index19.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var tester = /^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;
|
|
2
|
+
var validate = function(email) {
|
|
3
|
+
if (!email)
|
|
4
|
+
return false;
|
|
5
|
+
if (email.length > 254)
|
|
6
|
+
return false;
|
|
7
|
+
var valid = tester.test(email);
|
|
8
|
+
if (!valid)
|
|
9
|
+
return false;
|
|
10
|
+
var parts = email.split("@");
|
|
11
|
+
if (parts[0].length > 64)
|
|
12
|
+
return false;
|
|
13
|
+
var domainParts = parts[1].split(".");
|
|
14
|
+
if (domainParts.some(function(part) {
|
|
15
|
+
return part.length > 63;
|
|
16
|
+
}))
|
|
17
|
+
return false;
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
validate
|
|
22
|
+
};
|
package/dist/index2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),r=require("./index17.cjs");;/* empty css */const a=e.forwardRef(({variant:e="primary-workspace",fullWidth:a=!1,icon:n,className:s,children:i,disabled:c,"data-testid":d,"data-cy":o,...l},u)=>{const b=r.cn("btn",`btn--${e}`,a&&"btn--full-width",s);return t.jsxs("button",{ref:u,disabled:c,className:b,"data-testid":d||`button-${e}`,"data-cy":o||`button-${e}`,...l,children:[n&&t.jsx("span",{className:"btn__icon",children:n}),i]})});a.displayName="Button",exports.Button=a;
|
package/dist/index2.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { cn
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { cn } from "./index17.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
const
|
|
5
|
+
const Button = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
variant
|
|
8
|
-
fullWidth
|
|
9
|
-
icon
|
|
10
|
-
className
|
|
11
|
-
children
|
|
12
|
-
disabled
|
|
13
|
-
"data-testid":
|
|
14
|
-
"data-cy":
|
|
15
|
-
...
|
|
16
|
-
},
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */
|
|
7
|
+
variant = "primary-workspace",
|
|
8
|
+
fullWidth = false,
|
|
9
|
+
icon,
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
disabled,
|
|
13
|
+
"data-testid": dataTestId,
|
|
14
|
+
"data-cy": dataCy,
|
|
15
|
+
...props
|
|
16
|
+
}, ref) => {
|
|
17
|
+
const classes = cn("btn", `btn--${variant}`, fullWidth && "btn--full-width", className);
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
19
|
"button",
|
|
20
20
|
{
|
|
21
|
-
ref
|
|
22
|
-
disabled
|
|
23
|
-
className:
|
|
24
|
-
"data-testid":
|
|
25
|
-
"data-cy":
|
|
26
|
-
...
|
|
21
|
+
ref,
|
|
22
|
+
disabled,
|
|
23
|
+
className: classes,
|
|
24
|
+
"data-testid": dataTestId || `button-${variant}`,
|
|
25
|
+
"data-cy": dataCy || `button-${variant}`,
|
|
26
|
+
...props,
|
|
27
27
|
children: [
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
icon && /* @__PURE__ */ jsx("span", { className: "btn__icon", children: icon }),
|
|
29
|
+
children
|
|
30
30
|
]
|
|
31
31
|
}
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
|
-
|
|
35
|
+
Button.displayName = "Button";
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
Button
|
|
38
38
|
};
|
package/dist/index20.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),t=require("./index17.cjs");;/* empty css */const a=require("./index21.cjs"),s=require("./index33.cjs"),n=r.forwardRef(({type:n="text",label:l,error:i,helperText:o,fullWidth:u=!1,showPasswordToggle:d=!0,showLastChar:c=!0,lastCharDelay:p=500,validate:h,onValidationChange:f,className:g,id:x,onChange:v,onBlur:w,required:j,value:m,"data-cy":y,"data-testid":k,...b},C)=>{const[$,N]=r.useState(!1),[_,q]=r.useState(),[M,S]=r.useState(!1),[L,R]=r.useState(!1),T=r.useRef(!1),[E,W]=r.useState(""),B=r.useRef(""),F=r.useRef(null),I=r.useRef(null),z=a.useMergedRef(C,I),D=r.useId(),O=x||D,P=`${O}-error`,V=`${O}-helper`,H=y||"input",A=k||"input",G="password"===n,J=G&&d,K=G&&c&&!$,Q=G&&($||K&&B.current.length>0)?"text":n,U=l&&j&&!l.includes("*")?`${l} *`:l,X=r.useMemo(()=>s.debounce(e=>{if(h&&T.current){const r=h(e);q(r),null==f||f(!r)}},300),[h,f]),Y=r.useRef(X);r.useEffect(()=>{Y.current=X},[X]),r.useEffect(()=>{process.env.NODE_ENV},[G,c,m]),r.useEffect(()=>()=>{F.current&&clearTimeout(F.current),Y.current.cancel()},[]);const Z=K&&void 0===m?E:$&&G&&void 0===m?B.current||"":m,ee=i||_,re=b.disabled?"disabled":ee?"error":M?"focus":L?"hover":"idle";return e.jsxs("div",{className:t.cn("input-wrapper",u&&"input-wrapper--full-width"),"data-cy":`${H}-wrapper`,"data-testid":`${A}-wrapper`,children:[l&&e.jsx("label",{htmlFor:O,className:"input__label","data-cy":`${H}-label`,"data-testid":`${A}-label`,children:U}),e.jsxs("div",{className:"input__field-container",children:[e.jsx("input",{ref:z,id:O,type:Q,value:Z,className:t.cn("input",ee&&"input--error",u&&"input--full-width",J&&"input--with-toggle",g),"aria-invalid":ee?"true":"false","aria-required":j?"true":void 0,"aria-describedby":ee?P:o?V:void 0,"data-cy":H,"data-testid":A,"data-state":re,onChange:e=>{null==v||v(e);let r=e.target.value;if(K){const t=e.target,a=t.value;B.current=a;const s=a?"•".repeat(a.length-1)+a.slice(-1):"";W(s),t.value=s,r=a,F.current&&clearTimeout(F.current),F.current=setTimeout(()=>{W("•".repeat(a.length))},p)}T.current&&X(r)},onFocus:e=>{var r;S(!0),null==(r=b.onFocus)||r.call(b,e)},onBlur:e=>{if(S(!1),T.current=!0,h){const r=K?B.current:e.target.value,t=h(r);q(t),null==f||f(!t)}null==w||w(e)},onMouseEnter:()=>{R(!0)},onMouseLeave:()=>{R(!1)},required:j,...b}),J&&e.jsx("button",{type:"button",className:"input__toggle",onClick:()=>{N(e=>!e),setTimeout(()=>{var e;return null==(e=I.current)?void 0:e.focus()},0)},"aria-label":$?"Hide password":"Show password","data-cy":`${H}-toggle`,"data-testid":`${A}-toggle`,children:$?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsx("path",{d:"M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),e.jsx("circle",{cx:"10",cy:"10",r:"2.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsx("path",{d:"M10 4C5.5 4 2 10 2 10s3.5 6 8 6 8-6 8-6-3.5-6-8-6z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),e.jsx("circle",{cx:"10",cy:"10",r:"2.5",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),e.jsx("path",{d:"M3 3l14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})]}),ee&&e.jsx("span",{id:P,className:"input__error",role:"alert","data-cy":`${H}-error`,"data-testid":`${A}-error`,children:ee}),o&&!ee&&e.jsx("span",{id:V,className:"input__helper","data-cy":`${H}-helper`,"data-testid":`${A}-helper`,children:o})]})});n.displayName="Input",exports.Input=n;
|