@coinloger/dev-ui 0.1.1 → 0.1.4
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/cjs/components/Badge/Badge.cjs +1 -1
- package/dist/cjs/components/Button/Button.cjs +1 -1
- package/dist/cjs/components/Card/Card.cjs +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/cjs/components/Container/Container.cjs +1 -1
- package/dist/cjs/components/Flex/Flex.cjs +1 -1
- package/dist/cjs/components/Flex/FlexItem.cjs +1 -1
- package/dist/cjs/components/Input/Input.cjs +1 -1
- package/dist/cjs/components/Modal/Modal.cjs +1 -1
- package/dist/cjs/components/Radio/Radio.cjs +1 -1
- package/dist/cjs/components/Select/Select.cjs +1 -1
- package/dist/cjs/components/Switch/Switch.cjs +1 -1
- package/dist/cjs/components/Table/Table.cjs +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
- package/dist/cjs/components/Typography/Heading.cjs +1 -1
- package/dist/cjs/components/Typography/Text.cjs +1 -1
- package/dist/cjs/dev-ui.css +1 -1
- package/dist/cjs/theme.cjs +1 -1
- package/dist/esm/components/Badge/Badge.js +14 -22
- package/dist/esm/components/Button/Button.js +12 -24
- package/dist/esm/components/Card/Card.js +10 -18
- package/dist/esm/components/Checkbox/Checkbox.js +17 -33
- package/dist/esm/components/Container/Container.js +11 -18
- package/dist/esm/components/Flex/Flex.js +26 -44
- package/dist/esm/components/Flex/FlexItem.js +24 -38
- package/dist/esm/components/Input/Input.js +16 -46
- package/dist/esm/components/Modal/Modal.d.ts +0 -35
- package/dist/esm/components/Modal/Modal.js +60 -83
- package/dist/esm/components/Radio/Radio.js +16 -32
- package/dist/esm/components/Select/Select.d.ts +1 -17
- package/dist/esm/components/Select/Select.js +62 -79
- package/dist/esm/components/Switch/Switch.js +18 -34
- package/dist/esm/components/Table/Table.js +13 -22
- package/dist/esm/components/Tabs/Tabs.d.ts +0 -25
- package/dist/esm/components/Tabs/Tabs.js +45 -70
- package/dist/esm/components/Typography/Heading.js +15 -25
- package/dist/esm/components/Typography/Text.js +19 -32
- package/dist/esm/dev-ui.css +1 -1
- package/dist/esm/theme.d.ts +0 -5
- package/dist/esm/theme.js +11 -16
- package/package.json +15 -5
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { clsx as
|
|
4
|
-
import * as e from "prop-types";
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as t } from "react";
|
|
3
|
+
import { clsx as x } from "clsx";
|
|
5
4
|
/* empty css */
|
|
6
|
-
const
|
|
7
|
-
({ className:
|
|
5
|
+
const m = t(
|
|
6
|
+
({ className: r, label: o, error: h, disabled: c, size: i = "md", variant: s = "primary", ...n }, a) => /* @__PURE__ */ l(
|
|
8
7
|
"label",
|
|
9
8
|
{
|
|
10
|
-
className:
|
|
9
|
+
className: x(
|
|
11
10
|
"ui-checkbox-label",
|
|
12
|
-
`ui-checkbox-${
|
|
13
|
-
`ui-checkbox-${
|
|
11
|
+
`ui-checkbox-${i}`,
|
|
12
|
+
`ui-checkbox-${s}`,
|
|
14
13
|
c && "ui-checkbox-disabled",
|
|
15
|
-
|
|
14
|
+
r
|
|
16
15
|
),
|
|
17
16
|
children: [
|
|
18
|
-
/* @__PURE__ */
|
|
17
|
+
/* @__PURE__ */ e(
|
|
19
18
|
"input",
|
|
20
19
|
{
|
|
21
20
|
type: "checkbox",
|
|
22
21
|
className: "ui-checkbox-input",
|
|
23
22
|
disabled: c,
|
|
24
|
-
ref:
|
|
25
|
-
...
|
|
23
|
+
ref: a,
|
|
24
|
+
...n
|
|
26
25
|
}
|
|
27
26
|
),
|
|
28
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ e("span", { className: "ui-checkbox-custom", children: /* @__PURE__ */ e(
|
|
29
28
|
"svg",
|
|
30
29
|
{
|
|
31
30
|
className: "ui-checkbox-icon",
|
|
@@ -34,30 +33,15 @@ const i = p(
|
|
|
34
33
|
stroke: "currentColor",
|
|
35
34
|
strokeLinecap: "round",
|
|
36
35
|
strokeLinejoin: "round",
|
|
37
|
-
children: /* @__PURE__ */
|
|
36
|
+
children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" })
|
|
38
37
|
}
|
|
39
38
|
) }),
|
|
40
|
-
|
|
39
|
+
o && /* @__PURE__ */ e("span", { className: "ui-checkbox-text", children: o })
|
|
41
40
|
]
|
|
42
41
|
}
|
|
43
42
|
)
|
|
44
43
|
);
|
|
45
|
-
|
|
46
|
-
i.propTypes = {
|
|
47
|
-
label: e.node,
|
|
48
|
-
error: e.bool,
|
|
49
|
-
size: e.oneOf(["sm", "md", "lg", "xl"]),
|
|
50
|
-
variant: e.oneOf(["primary", "success", "warning", "danger"]),
|
|
51
|
-
checked: e.bool,
|
|
52
|
-
defaultChecked: e.bool,
|
|
53
|
-
onChange: e.func,
|
|
54
|
-
name: e.string,
|
|
55
|
-
value: e.oneOfType([e.string, e.number]),
|
|
56
|
-
disabled: e.bool,
|
|
57
|
-
required: e.bool,
|
|
58
|
-
id: e.string,
|
|
59
|
-
className: e.string
|
|
60
|
-
};
|
|
44
|
+
m.displayName = "Checkbox";
|
|
61
45
|
export {
|
|
62
|
-
|
|
46
|
+
m as Checkbox
|
|
63
47
|
};
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as m } from "react";
|
|
3
3
|
import { clsx as c } from "clsx";
|
|
4
|
-
import * as o from "prop-types";
|
|
5
4
|
/* empty css */
|
|
6
|
-
const
|
|
5
|
+
const f = m(
|
|
7
6
|
({
|
|
8
|
-
className:
|
|
9
|
-
children:
|
|
7
|
+
className: r,
|
|
8
|
+
children: o,
|
|
10
9
|
fluid: i = !1,
|
|
11
10
|
as: a = "div",
|
|
12
|
-
...
|
|
11
|
+
...s
|
|
13
12
|
}, t) => {
|
|
14
|
-
const
|
|
13
|
+
const e = c(
|
|
15
14
|
"ui-container",
|
|
16
15
|
i && "ui-container--fluid",
|
|
17
|
-
|
|
16
|
+
r
|
|
18
17
|
);
|
|
19
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ n(a, { ref: t, className: e, ...s, children: o });
|
|
20
19
|
}
|
|
21
20
|
);
|
|
22
|
-
|
|
23
|
-
r.propTypes = {
|
|
24
|
-
fluid: o.bool,
|
|
25
|
-
as: o.elementType,
|
|
26
|
-
children: o.node,
|
|
27
|
-
className: o.string
|
|
28
|
-
};
|
|
21
|
+
f.displayName = "Container";
|
|
29
22
|
export {
|
|
30
|
-
|
|
23
|
+
f as Container
|
|
31
24
|
};
|
|
@@ -1,57 +1,39 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { clsx as
|
|
4
|
-
import
|
|
5
|
-
import { FlexItem as g } from "./FlexItem.js";
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as $ } from "react";
|
|
3
|
+
import { clsx as w } from "clsx";
|
|
4
|
+
import { FlexItem as F } from "./FlexItem.js";
|
|
6
5
|
/* empty css */
|
|
7
|
-
const s =
|
|
6
|
+
const s = $(
|
|
8
7
|
({
|
|
9
|
-
className:
|
|
10
|
-
children:
|
|
11
|
-
direction:
|
|
12
|
-
justify:
|
|
8
|
+
className: i,
|
|
9
|
+
children: l,
|
|
10
|
+
direction: r = "row",
|
|
11
|
+
justify: o = "start",
|
|
13
12
|
align: m = "stretch",
|
|
14
13
|
wrap: f = "nowrap",
|
|
15
|
-
gap:
|
|
16
|
-
inline:
|
|
17
|
-
as:
|
|
18
|
-
style:
|
|
19
|
-
...
|
|
20
|
-
},
|
|
21
|
-
const t = typeof
|
|
22
|
-
|
|
23
|
-
`ui-flex--dir-${
|
|
24
|
-
`ui-flex--justify-${
|
|
14
|
+
gap: e = "md",
|
|
15
|
+
inline: x = !1,
|
|
16
|
+
as: u = "div",
|
|
17
|
+
style: n,
|
|
18
|
+
...c
|
|
19
|
+
}, a) => {
|
|
20
|
+
const t = typeof e == "number" || typeof e == "string" && !["sm", "md", "lg", "xl"].includes(e), p = w(
|
|
21
|
+
x ? "ui-flex--inline" : "ui-flex",
|
|
22
|
+
`ui-flex--dir-${r}`,
|
|
23
|
+
`ui-flex--justify-${o}`,
|
|
25
24
|
`ui-flex--align-${m}`,
|
|
26
25
|
`ui-flex--wrap-${f}`,
|
|
27
|
-
!t &&
|
|
28
|
-
|
|
29
|
-
),
|
|
30
|
-
...
|
|
31
|
-
...t ? { gap:
|
|
26
|
+
!t && e && `ui-flex--gap-${e}`,
|
|
27
|
+
i
|
|
28
|
+
), d = {
|
|
29
|
+
...n,
|
|
30
|
+
...t ? { gap: e } : {}
|
|
32
31
|
};
|
|
33
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ y(u, { ref: a, className: p, style: d, ...c, children: l });
|
|
34
33
|
}
|
|
35
34
|
);
|
|
36
35
|
s.displayName = "Flex";
|
|
37
|
-
s.Item =
|
|
38
|
-
s.propTypes = {
|
|
39
|
-
direction: e.oneOf(["row", "column", "row-reverse", "column-reverse"]),
|
|
40
|
-
justify: e.oneOf(["start", "center", "end", "between", "around", "evenly"]),
|
|
41
|
-
align: e.oneOf(["start", "center", "end", "stretch", "baseline"]),
|
|
42
|
-
wrap: e.oneOf(["nowrap", "wrap", "wrap-reverse"]),
|
|
43
|
-
gap: e.oneOfType([
|
|
44
|
-
e.oneOf(["sm", "md", "lg", "xl"]),
|
|
45
|
-
e.number,
|
|
46
|
-
e.string
|
|
47
|
-
]),
|
|
48
|
-
inline: e.bool,
|
|
49
|
-
as: e.elementType,
|
|
50
|
-
children: e.node,
|
|
51
|
-
className: e.string,
|
|
52
|
-
style: e.object,
|
|
53
|
-
id: e.string
|
|
54
|
-
};
|
|
36
|
+
s.Item = F;
|
|
55
37
|
export {
|
|
56
38
|
s as Flex
|
|
57
39
|
};
|
|
@@ -1,47 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { clsx as
|
|
4
|
-
|
|
5
|
-
const n = x(
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as p } from "react";
|
|
3
|
+
import { clsx as u } from "clsx";
|
|
4
|
+
const y = p(
|
|
6
5
|
({
|
|
7
|
-
className:
|
|
8
|
-
children:
|
|
9
|
-
grow:
|
|
10
|
-
shrink:
|
|
11
|
-
basis:
|
|
12
|
-
flex:
|
|
6
|
+
className: i,
|
|
7
|
+
children: s,
|
|
8
|
+
grow: e,
|
|
9
|
+
shrink: o,
|
|
10
|
+
basis: t,
|
|
11
|
+
flex: l,
|
|
13
12
|
width: m,
|
|
14
|
-
order:
|
|
15
|
-
as:
|
|
16
|
-
style:
|
|
13
|
+
order: f,
|
|
14
|
+
as: a = "div",
|
|
15
|
+
style: x,
|
|
17
16
|
...d
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
...
|
|
21
|
-
...
|
|
22
|
-
...
|
|
23
|
-
...
|
|
24
|
-
...
|
|
17
|
+
}, r) => {
|
|
18
|
+
const v = {
|
|
19
|
+
...x,
|
|
20
|
+
...e !== void 0 && { flexGrow: e === !0 ? 1 : e === !1 ? 0 : e },
|
|
21
|
+
...o !== void 0 && { flexShrink: o === !0 ? 1 : o === !1 ? 0 : o },
|
|
22
|
+
...t !== void 0 && { flexBasis: t },
|
|
23
|
+
...l !== void 0 && { flex: l },
|
|
25
24
|
...m !== void 0 && { width: m },
|
|
26
|
-
...
|
|
25
|
+
...f !== void 0 && { order: f }
|
|
27
26
|
};
|
|
28
|
-
return /* @__PURE__ */
|
|
27
|
+
return /* @__PURE__ */ c(a, { ref: r, className: u("ui-flex-item", i), style: v, ...d, children: s });
|
|
29
28
|
}
|
|
30
29
|
);
|
|
31
|
-
|
|
32
|
-
n.propTypes = {
|
|
33
|
-
grow: e.oneOfType([e.bool, e.number]),
|
|
34
|
-
shrink: e.oneOfType([e.bool, e.number]),
|
|
35
|
-
basis: e.oneOfType([e.string, e.number]),
|
|
36
|
-
flex: e.oneOfType([e.string, e.number]),
|
|
37
|
-
width: e.oneOfType([e.string, e.number]),
|
|
38
|
-
order: e.number,
|
|
39
|
-
as: e.elementType,
|
|
40
|
-
children: e.node,
|
|
41
|
-
className: e.string,
|
|
42
|
-
style: e.object,
|
|
43
|
-
id: e.string
|
|
44
|
-
};
|
|
30
|
+
y.displayName = "Flex.Item";
|
|
45
31
|
export {
|
|
46
|
-
|
|
32
|
+
y as FlexItem
|
|
47
33
|
};
|
|
@@ -1,61 +1,31 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d, useId as f } from "react";
|
|
3
3
|
import { clsx as r } from "clsx";
|
|
4
|
-
import * as e from "prop-types";
|
|
5
4
|
/* empty css */
|
|
6
|
-
const
|
|
7
|
-
({ className:
|
|
8
|
-
const
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
|
|
11
|
-
/* @__PURE__ */
|
|
5
|
+
const h = d(
|
|
6
|
+
({ className: s, label: p, error: t, helperText: u, fullWidth: n, size: a = "md", id: l, ...m }, o) => {
|
|
7
|
+
const e = l || f();
|
|
8
|
+
return /* @__PURE__ */ c("div", { className: r("ui-input-wrapper", n && "ui-input-wrapper-full"), children: [
|
|
9
|
+
p && /* @__PURE__ */ i("label", { htmlFor: e, className: "ui-label", children: p }),
|
|
10
|
+
/* @__PURE__ */ i(
|
|
12
11
|
"input",
|
|
13
12
|
{
|
|
14
|
-
ref:
|
|
15
|
-
id:
|
|
13
|
+
ref: o,
|
|
14
|
+
id: e,
|
|
16
15
|
className: r(
|
|
17
16
|
"ui-input",
|
|
18
17
|
`ui-input-${a}`,
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
t && "ui-input-error",
|
|
19
|
+
s
|
|
21
20
|
),
|
|
22
|
-
...
|
|
21
|
+
...m
|
|
23
22
|
}
|
|
24
23
|
),
|
|
25
|
-
|
|
24
|
+
u && /* @__PURE__ */ i("span", { className: r("ui-helper-text", t && "ui-helper-text-error"), children: u })
|
|
26
25
|
] });
|
|
27
26
|
}
|
|
28
27
|
);
|
|
29
|
-
|
|
30
|
-
u.propTypes = {
|
|
31
|
-
label: e.node,
|
|
32
|
-
error: e.bool,
|
|
33
|
-
helperText: e.string,
|
|
34
|
-
fullWidth: e.bool,
|
|
35
|
-
size: e.oneOf(["sm", "md", "lg", "xl"]),
|
|
36
|
-
value: e.oneOfType([e.string, e.number]),
|
|
37
|
-
defaultValue: e.oneOfType([e.string, e.number]),
|
|
38
|
-
onChange: e.func,
|
|
39
|
-
onBlur: e.func,
|
|
40
|
-
onFocus: e.func,
|
|
41
|
-
name: e.string,
|
|
42
|
-
id: e.string,
|
|
43
|
-
placeholder: e.string,
|
|
44
|
-
type: e.string,
|
|
45
|
-
disabled: e.bool,
|
|
46
|
-
readOnly: e.bool,
|
|
47
|
-
required: e.bool,
|
|
48
|
-
autoComplete: e.string,
|
|
49
|
-
autoFocus: e.bool,
|
|
50
|
-
min: e.oneOfType([e.string, e.number]),
|
|
51
|
-
max: e.oneOfType([e.string, e.number]),
|
|
52
|
-
step: e.oneOfType([e.string, e.number]),
|
|
53
|
-
minLength: e.number,
|
|
54
|
-
maxLength: e.number,
|
|
55
|
-
pattern: e.string,
|
|
56
|
-
inputMode: e.string,
|
|
57
|
-
className: e.string
|
|
58
|
-
};
|
|
28
|
+
h.displayName = "Input";
|
|
59
29
|
export {
|
|
60
|
-
|
|
30
|
+
h as Input
|
|
61
31
|
};
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
import * as PropTypes from 'prop-types';
|
|
4
3
|
export declare const ModalHeader: {
|
|
5
4
|
({ children, className }: {
|
|
6
5
|
children: ReactNode;
|
|
7
6
|
className?: string;
|
|
8
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
displayName: string;
|
|
10
|
-
propTypes: {
|
|
11
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
12
|
-
className: PropTypes.Requireable<string>;
|
|
13
|
-
};
|
|
14
9
|
};
|
|
15
10
|
export declare const ModalBody: {
|
|
16
11
|
({ children, className }: {
|
|
@@ -18,10 +13,6 @@ export declare const ModalBody: {
|
|
|
18
13
|
className?: string;
|
|
19
14
|
}): import("react/jsx-runtime").JSX.Element;
|
|
20
15
|
displayName: string;
|
|
21
|
-
propTypes: {
|
|
22
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
23
|
-
className: PropTypes.Requireable<string>;
|
|
24
|
-
};
|
|
25
16
|
};
|
|
26
17
|
export declare const ModalFooter: {
|
|
27
18
|
({ children, className }: {
|
|
@@ -29,10 +20,6 @@ export declare const ModalFooter: {
|
|
|
29
20
|
className?: string;
|
|
30
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
31
22
|
displayName: string;
|
|
32
|
-
propTypes: {
|
|
33
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
34
|
-
className: PropTypes.Requireable<string>;
|
|
35
|
-
};
|
|
36
23
|
};
|
|
37
24
|
/**
|
|
38
25
|
* Modal component properties.
|
|
@@ -76,16 +63,6 @@ export interface ModalProps {
|
|
|
76
63
|
export declare const Modal: {
|
|
77
64
|
({ isOpen, onClose, title, children, footer, size, className, closeOnBackdropClick, }: ModalProps): import('react').ReactPortal | null;
|
|
78
65
|
displayName: string;
|
|
79
|
-
propTypes: {
|
|
80
|
-
isOpen: PropTypes.Validator<boolean>;
|
|
81
|
-
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
82
|
-
title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
83
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
84
|
-
footer: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
85
|
-
size: PropTypes.Requireable<string>;
|
|
86
|
-
className: PropTypes.Requireable<string>;
|
|
87
|
-
closeOnBackdropClick: PropTypes.Requireable<boolean>;
|
|
88
|
-
};
|
|
89
66
|
} & {
|
|
90
67
|
Header: {
|
|
91
68
|
({ children, className }: {
|
|
@@ -93,10 +70,6 @@ export declare const Modal: {
|
|
|
93
70
|
className?: string;
|
|
94
71
|
}): import("react/jsx-runtime").JSX.Element;
|
|
95
72
|
displayName: string;
|
|
96
|
-
propTypes: {
|
|
97
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
98
|
-
className: PropTypes.Requireable<string>;
|
|
99
|
-
};
|
|
100
73
|
};
|
|
101
74
|
Body: {
|
|
102
75
|
({ children, className }: {
|
|
@@ -104,10 +77,6 @@ export declare const Modal: {
|
|
|
104
77
|
className?: string;
|
|
105
78
|
}): import("react/jsx-runtime").JSX.Element;
|
|
106
79
|
displayName: string;
|
|
107
|
-
propTypes: {
|
|
108
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
109
|
-
className: PropTypes.Requireable<string>;
|
|
110
|
-
};
|
|
111
80
|
};
|
|
112
81
|
Footer: {
|
|
113
82
|
({ children, className }: {
|
|
@@ -115,9 +84,5 @@ export declare const Modal: {
|
|
|
115
84
|
className?: string;
|
|
116
85
|
}): import("react/jsx-runtime").JSX.Element;
|
|
117
86
|
displayName: string;
|
|
118
|
-
propTypes: {
|
|
119
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
120
|
-
className: PropTypes.Requireable<string>;
|
|
121
|
-
};
|
|
122
87
|
};
|
|
123
88
|
};
|
|
@@ -1,123 +1,100 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as E, useRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import { clsx as
|
|
5
|
-
import * as o from "prop-types";
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as E, useRef as C, useState as B, useEffect as f, useContext as j } from "react";
|
|
3
|
+
import { createPortal as F } from "react-dom";
|
|
4
|
+
import { clsx as d } from "clsx";
|
|
6
5
|
/* empty css */
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
6
|
+
const h = E(void 0), L = () => {
|
|
7
|
+
const o = j(h);
|
|
8
|
+
if (!o)
|
|
10
9
|
throw new Error("Modal compound components must be used within a Modal");
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
const { onClose:
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
10
|
+
return o;
|
|
11
|
+
}, n = ({ children: o, className: t }) => {
|
|
12
|
+
const { onClose: a } = L();
|
|
13
|
+
return /* @__PURE__ */ r("div", { className: d("ui-modal-header", t), children: [
|
|
14
|
+
/* @__PURE__ */ e("h3", { className: "ui-modal-title", children: o }),
|
|
15
|
+
/* @__PURE__ */ e(
|
|
17
16
|
"button",
|
|
18
17
|
{
|
|
19
18
|
className: "ui-modal-close",
|
|
20
|
-
onClick:
|
|
19
|
+
onClick: a,
|
|
21
20
|
"aria-label": "Close modal",
|
|
22
|
-
children: /* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
21
|
+
children: /* @__PURE__ */ r("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
22
|
+
/* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
23
|
+
/* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
25
24
|
] })
|
|
26
25
|
}
|
|
27
26
|
)
|
|
28
27
|
] });
|
|
29
|
-
}, i = ({ children:
|
|
30
|
-
isOpen:
|
|
31
|
-
onClose:
|
|
32
|
-
title:
|
|
33
|
-
children:
|
|
34
|
-
footer:
|
|
28
|
+
}, i = ({ children: o, className: t }) => /* @__PURE__ */ e("div", { className: d("ui-modal-body", t), children: o }), s = ({ children: o, className: t }) => /* @__PURE__ */ e("div", { className: d("ui-modal-footer", t), children: o }), v = ({
|
|
29
|
+
isOpen: o,
|
|
30
|
+
onClose: t,
|
|
31
|
+
title: a,
|
|
32
|
+
children: c,
|
|
33
|
+
footer: m,
|
|
35
34
|
size: x = "md",
|
|
36
|
-
className:
|
|
37
|
-
closeOnBackdropClick:
|
|
35
|
+
className: M,
|
|
36
|
+
closeOnBackdropClick: k = !0
|
|
38
37
|
}) => {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
const
|
|
44
|
-
|
|
38
|
+
const u = C(null), [N, y] = B(o);
|
|
39
|
+
f(() => {
|
|
40
|
+
o && y(!0);
|
|
41
|
+
}, [o]);
|
|
42
|
+
const b = () => {
|
|
43
|
+
o || y(!1);
|
|
45
44
|
};
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
w.key === "Escape" &&
|
|
45
|
+
if (f(() => {
|
|
46
|
+
const l = (w) => {
|
|
47
|
+
w.key === "Escape" && t();
|
|
49
48
|
};
|
|
50
|
-
return
|
|
51
|
-
document.removeEventListener("keydown",
|
|
49
|
+
return o && (document.addEventListener("keydown", l), document.body.style.overflow = "hidden"), () => {
|
|
50
|
+
document.removeEventListener("keydown", l), document.body.style.overflow = "";
|
|
52
51
|
};
|
|
53
|
-
}, [
|
|
54
|
-
const
|
|
55
|
-
|
|
52
|
+
}, [o, t]), !N) return null;
|
|
53
|
+
const p = (l) => {
|
|
54
|
+
k && l.target === u.current && t();
|
|
56
55
|
};
|
|
57
|
-
return
|
|
58
|
-
/* @__PURE__ */
|
|
56
|
+
return F(
|
|
57
|
+
/* @__PURE__ */ e(h.Provider, { value: { onClose: t }, children: /* @__PURE__ */ e(
|
|
59
58
|
"div",
|
|
60
59
|
{
|
|
61
|
-
className:
|
|
62
|
-
ref:
|
|
63
|
-
onClick:
|
|
64
|
-
onAnimationEnd:
|
|
65
|
-
children: /* @__PURE__ */
|
|
60
|
+
className: d("ui-modal-overlay", !o && "ui-modal-closing"),
|
|
61
|
+
ref: u,
|
|
62
|
+
onClick: p,
|
|
63
|
+
onAnimationEnd: b,
|
|
64
|
+
children: /* @__PURE__ */ e(
|
|
66
65
|
"div",
|
|
67
66
|
{
|
|
68
|
-
className:
|
|
67
|
+
className: d(
|
|
69
68
|
"ui-modal",
|
|
70
69
|
`ui-modal-${x}`,
|
|
71
|
-
!
|
|
72
|
-
|
|
70
|
+
!o && "ui-modal-closing",
|
|
71
|
+
M
|
|
73
72
|
),
|
|
74
73
|
role: "dialog",
|
|
75
74
|
"aria-modal": "true",
|
|
76
|
-
children:
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
80
|
-
] }) :
|
|
75
|
+
children: a ? /* @__PURE__ */ r(g, { children: [
|
|
76
|
+
/* @__PURE__ */ e(n, { children: a }),
|
|
77
|
+
/* @__PURE__ */ e(i, { children: c }),
|
|
78
|
+
m && /* @__PURE__ */ e(s, { children: m })
|
|
79
|
+
] }) : c
|
|
81
80
|
}
|
|
82
81
|
)
|
|
83
82
|
}
|
|
84
83
|
) }),
|
|
85
84
|
document.body
|
|
86
85
|
);
|
|
87
|
-
},
|
|
88
|
-
Header:
|
|
86
|
+
}, I = Object.assign(v, {
|
|
87
|
+
Header: n,
|
|
89
88
|
Body: i,
|
|
90
89
|
Footer: s
|
|
91
90
|
});
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
v.displayName = "Modal";
|
|
92
|
+
n.displayName = "ModalHeader";
|
|
94
93
|
i.displayName = "ModalBody";
|
|
95
94
|
s.displayName = "ModalFooter";
|
|
96
|
-
m.propTypes = {
|
|
97
|
-
isOpen: o.bool.isRequired,
|
|
98
|
-
onClose: o.func.isRequired,
|
|
99
|
-
title: o.node,
|
|
100
|
-
children: o.node,
|
|
101
|
-
footer: o.node,
|
|
102
|
-
size: o.oneOf(["sm", "md", "lg", "xl"]),
|
|
103
|
-
className: o.string,
|
|
104
|
-
closeOnBackdropClick: o.bool
|
|
105
|
-
};
|
|
106
|
-
a.propTypes = {
|
|
107
|
-
children: o.node,
|
|
108
|
-
className: o.string
|
|
109
|
-
};
|
|
110
|
-
i.propTypes = {
|
|
111
|
-
children: o.node,
|
|
112
|
-
className: o.string
|
|
113
|
-
};
|
|
114
|
-
s.propTypes = {
|
|
115
|
-
children: o.node,
|
|
116
|
-
className: o.string
|
|
117
|
-
};
|
|
118
95
|
export {
|
|
119
|
-
|
|
96
|
+
I as Modal,
|
|
120
97
|
i as ModalBody,
|
|
121
98
|
s as ModalFooter,
|
|
122
|
-
|
|
99
|
+
n as ModalHeader
|
|
123
100
|
};
|