@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.
Files changed (41) hide show
  1. package/dist/cjs/components/Badge/Badge.cjs +1 -1
  2. package/dist/cjs/components/Button/Button.cjs +1 -1
  3. package/dist/cjs/components/Card/Card.cjs +1 -1
  4. package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
  5. package/dist/cjs/components/Container/Container.cjs +1 -1
  6. package/dist/cjs/components/Flex/Flex.cjs +1 -1
  7. package/dist/cjs/components/Flex/FlexItem.cjs +1 -1
  8. package/dist/cjs/components/Input/Input.cjs +1 -1
  9. package/dist/cjs/components/Modal/Modal.cjs +1 -1
  10. package/dist/cjs/components/Radio/Radio.cjs +1 -1
  11. package/dist/cjs/components/Select/Select.cjs +1 -1
  12. package/dist/cjs/components/Switch/Switch.cjs +1 -1
  13. package/dist/cjs/components/Table/Table.cjs +1 -1
  14. package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
  15. package/dist/cjs/components/Typography/Heading.cjs +1 -1
  16. package/dist/cjs/components/Typography/Text.cjs +1 -1
  17. package/dist/cjs/dev-ui.css +1 -1
  18. package/dist/cjs/theme.cjs +1 -1
  19. package/dist/esm/components/Badge/Badge.js +14 -22
  20. package/dist/esm/components/Button/Button.js +12 -24
  21. package/dist/esm/components/Card/Card.js +10 -18
  22. package/dist/esm/components/Checkbox/Checkbox.js +17 -33
  23. package/dist/esm/components/Container/Container.js +11 -18
  24. package/dist/esm/components/Flex/Flex.js +26 -44
  25. package/dist/esm/components/Flex/FlexItem.js +24 -38
  26. package/dist/esm/components/Input/Input.js +16 -46
  27. package/dist/esm/components/Modal/Modal.d.ts +0 -35
  28. package/dist/esm/components/Modal/Modal.js +60 -83
  29. package/dist/esm/components/Radio/Radio.js +16 -32
  30. package/dist/esm/components/Select/Select.d.ts +1 -17
  31. package/dist/esm/components/Select/Select.js +62 -79
  32. package/dist/esm/components/Switch/Switch.js +18 -34
  33. package/dist/esm/components/Table/Table.js +13 -22
  34. package/dist/esm/components/Tabs/Tabs.d.ts +0 -25
  35. package/dist/esm/components/Tabs/Tabs.js +45 -70
  36. package/dist/esm/components/Typography/Heading.js +15 -25
  37. package/dist/esm/components/Typography/Text.js +19 -32
  38. package/dist/esm/dev-ui.css +1 -1
  39. package/dist/esm/theme.d.ts +0 -5
  40. package/dist/esm/theme.js +11 -16
  41. package/package.json +15 -5
@@ -1,31 +1,30 @@
1
- import { jsxs as m, jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import { clsx as u } from "clsx";
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 i = p(
7
- ({ className: s, label: r, error: b, disabled: c, size: n = "md", variant: a = "primary", ...l }, t) => /* @__PURE__ */ m(
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: u(
9
+ className: x(
11
10
  "ui-checkbox-label",
12
- `ui-checkbox-${n}`,
13
- `ui-checkbox-${a}`,
11
+ `ui-checkbox-${i}`,
12
+ `ui-checkbox-${s}`,
14
13
  c && "ui-checkbox-disabled",
15
- s
14
+ r
16
15
  ),
17
16
  children: [
18
- /* @__PURE__ */ o(
17
+ /* @__PURE__ */ e(
19
18
  "input",
20
19
  {
21
20
  type: "checkbox",
22
21
  className: "ui-checkbox-input",
23
22
  disabled: c,
24
- ref: t,
25
- ...l
23
+ ref: a,
24
+ ...n
26
25
  }
27
26
  ),
28
- /* @__PURE__ */ o("span", { className: "ui-checkbox-custom", children: /* @__PURE__ */ o(
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__ */ o("polyline", { points: "20 6 9 17 4 12" })
36
+ children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" })
38
37
  }
39
38
  ) }),
40
- r && /* @__PURE__ */ o("span", { className: "ui-checkbox-text", children: r })
39
+ o && /* @__PURE__ */ e("span", { className: "ui-checkbox-text", children: o })
41
40
  ]
42
41
  }
43
42
  )
44
43
  );
45
- i.displayName = "Checkbox";
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
- i as Checkbox
46
+ m as Checkbox
63
47
  };
@@ -1,31 +1,24 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as l } from "react";
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 r = l(
5
+ const f = m(
7
6
  ({
8
- className: e,
9
- children: s,
7
+ className: r,
8
+ children: o,
10
9
  fluid: i = !1,
11
10
  as: a = "div",
12
- ...n
11
+ ...s
13
12
  }, t) => {
14
- const m = c(
13
+ const e = c(
15
14
  "ui-container",
16
15
  i && "ui-container--fluid",
17
- e
16
+ r
18
17
  );
19
- return /* @__PURE__ */ p(a, { ref: t, className: m, ...n, children: s });
18
+ return /* @__PURE__ */ n(a, { ref: t, className: e, ...s, children: o });
20
19
  }
21
20
  );
22
- r.displayName = "Container";
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
- r as Container
23
+ f as Container
31
24
  };
@@ -1,57 +1,39 @@
1
- import { jsx as w } from "react/jsx-runtime";
2
- import { forwardRef as b } from "react";
3
- import { clsx as O } from "clsx";
4
- import * as e from "prop-types";
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 = b(
6
+ const s = $(
8
7
  ({
9
- className: o,
10
- children: n,
11
- direction: i = "row",
12
- justify: l = "start",
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: r = "md",
16
- inline: a = !1,
17
- as: p = "div",
18
- style: c,
19
- ...u
20
- }, d) => {
21
- const t = typeof r == "number" || typeof r == "string" && !["sm", "md", "lg", "xl"].includes(r), x = O(
22
- a ? "ui-flex--inline" : "ui-flex",
23
- `ui-flex--dir-${i}`,
24
- `ui-flex--justify-${l}`,
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 && r && `ui-flex--gap-${r}`,
28
- o
29
- ), y = {
30
- ...c,
31
- ...t ? { gap: r } : {}
26
+ !t && e && `ui-flex--gap-${e}`,
27
+ i
28
+ ), d = {
29
+ ...n,
30
+ ...t ? { gap: e } : {}
32
31
  };
33
- return /* @__PURE__ */ w(p, { ref: d, className: x, style: y, ...u, children: n });
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 = g;
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 b } from "react/jsx-runtime";
2
- import { forwardRef as x } from "react";
3
- import { clsx as c } from "clsx";
4
- import * as e from "prop-types";
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: l,
8
- children: f,
9
- grow: o,
10
- shrink: r,
11
- basis: s,
12
- flex: t,
6
+ className: i,
7
+ children: s,
8
+ grow: e,
9
+ shrink: o,
10
+ basis: t,
11
+ flex: l,
13
12
  width: m,
14
- order: i,
15
- as: p = "div",
16
- style: a,
13
+ order: f,
14
+ as: a = "div",
15
+ style: x,
17
16
  ...d
18
- }, y) => {
19
- const u = {
20
- ...a,
21
- ...o !== void 0 && { flexGrow: o === !0 ? 1 : o === !1 ? 0 : o },
22
- ...r !== void 0 && { flexShrink: r === !0 ? 1 : r === !1 ? 0 : r },
23
- ...s !== void 0 && { flexBasis: s },
24
- ...t !== void 0 && { flex: t },
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
- ...i !== void 0 && { order: i }
25
+ ...f !== void 0 && { order: f }
27
26
  };
28
- return /* @__PURE__ */ b(p, { ref: y, className: c("ui-flex-item", l), style: u, ...d, children: f });
27
+ return /* @__PURE__ */ c(a, { ref: r, className: u("ui-flex-item", i), style: v, ...d, children: s });
29
28
  }
30
29
  );
31
- n.displayName = "Flex.Item";
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
- n as FlexItem
32
+ y as FlexItem
47
33
  };
@@ -1,61 +1,31 @@
1
- import { jsxs as g, jsx as n } from "react/jsx-runtime";
2
- import { forwardRef as c, useId as b } from "react";
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 u = c(
7
- ({ className: p, label: t, error: i, helperText: o, fullWidth: l, size: a = "md", id: m, ...d }, f) => {
8
- const s = m || b();
9
- return /* @__PURE__ */ g("div", { className: r("ui-input-wrapper", l && "ui-input-wrapper-full"), children: [
10
- t && /* @__PURE__ */ n("label", { htmlFor: s, className: "ui-label", children: t }),
11
- /* @__PURE__ */ n(
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: f,
15
- id: s,
13
+ ref: o,
14
+ id: e,
16
15
  className: r(
17
16
  "ui-input",
18
17
  `ui-input-${a}`,
19
- i && "ui-input-error",
20
- p
18
+ t && "ui-input-error",
19
+ s
21
20
  ),
22
- ...d
21
+ ...m
23
22
  }
24
23
  ),
25
- o && /* @__PURE__ */ n("span", { className: r("ui-helper-text", i && "ui-helper-text-error"), children: o })
24
+ u && /* @__PURE__ */ i("span", { className: r("ui-helper-text", t && "ui-helper-text-error"), children: u })
26
25
  ] });
27
26
  }
28
27
  );
29
- u.displayName = "Input";
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
- u as Input
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 r, jsxs as c, Fragment as C } from "react/jsx-runtime";
2
- import { createContext as E, useRef as B, useState as R, useEffect as h, useContext as T } from "react";
3
- import { createPortal as j } from "react-dom";
4
- import { clsx as l } from "clsx";
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 v = E(void 0), F = () => {
8
- const e = T(v);
9
- if (!e)
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 e;
12
- }, a = ({ children: e, className: d }) => {
13
- const { onClose: n } = F();
14
- return /* @__PURE__ */ c("div", { className: l("ui-modal-header", d), children: [
15
- /* @__PURE__ */ r("h3", { className: "ui-modal-title", children: e }),
16
- /* @__PURE__ */ r(
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: n,
19
+ onClick: a,
21
20
  "aria-label": "Close modal",
22
- children: /* @__PURE__ */ c("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
23
- /* @__PURE__ */ r("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
24
- /* @__PURE__ */ r("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
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: e, className: d }) => /* @__PURE__ */ r("div", { className: l("ui-modal-body", d), children: e }), s = ({ children: e, className: d }) => /* @__PURE__ */ r("div", { className: l("ui-modal-footer", d), children: e }), m = ({
30
- isOpen: e,
31
- onClose: d,
32
- title: n,
33
- children: u,
34
- footer: y,
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: N,
37
- closeOnBackdropClick: g = !0
35
+ className: M,
36
+ closeOnBackdropClick: k = !0
38
37
  }) => {
39
- const p = B(null), [k, f] = R(e);
40
- h(() => {
41
- e && f(!0);
42
- }, [e]);
43
- const M = () => {
44
- e || f(!1);
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 (h(() => {
47
- const t = (w) => {
48
- w.key === "Escape" && d();
45
+ if (f(() => {
46
+ const l = (w) => {
47
+ w.key === "Escape" && t();
49
48
  };
50
- return e && (document.addEventListener("keydown", t), document.body.style.overflow = "hidden"), () => {
51
- document.removeEventListener("keydown", t), document.body.style.overflow = "";
49
+ return o && (document.addEventListener("keydown", l), document.body.style.overflow = "hidden"), () => {
50
+ document.removeEventListener("keydown", l), document.body.style.overflow = "";
52
51
  };
53
- }, [e, d]), !k) return null;
54
- const b = (t) => {
55
- g && t.target === p.current && d();
52
+ }, [o, t]), !N) return null;
53
+ const p = (l) => {
54
+ k && l.target === u.current && t();
56
55
  };
57
- return j(
58
- /* @__PURE__ */ r(v.Provider, { value: { onClose: d }, children: /* @__PURE__ */ r(
56
+ return F(
57
+ /* @__PURE__ */ e(h.Provider, { value: { onClose: t }, children: /* @__PURE__ */ e(
59
58
  "div",
60
59
  {
61
- className: l("ui-modal-overlay", !e && "ui-modal-closing"),
62
- ref: p,
63
- onClick: b,
64
- onAnimationEnd: M,
65
- children: /* @__PURE__ */ r(
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: l(
67
+ className: d(
69
68
  "ui-modal",
70
69
  `ui-modal-${x}`,
71
- !e && "ui-modal-closing",
72
- N
70
+ !o && "ui-modal-closing",
71
+ M
73
72
  ),
74
73
  role: "dialog",
75
74
  "aria-modal": "true",
76
- children: n ? /* @__PURE__ */ c(C, { children: [
77
- /* @__PURE__ */ r(a, { children: n }),
78
- /* @__PURE__ */ r(i, { children: u }),
79
- y && /* @__PURE__ */ r(s, { children: y })
80
- ] }) : u
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
- }, V = Object.assign(m, {
88
- Header: a,
86
+ }, I = Object.assign(v, {
87
+ Header: n,
89
88
  Body: i,
90
89
  Footer: s
91
90
  });
92
- m.displayName = "Modal";
93
- a.displayName = "ModalHeader";
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
- V as Modal,
96
+ I as Modal,
120
97
  i as ModalBody,
121
98
  s as ModalFooter,
122
- a as ModalHeader
99
+ n as ModalHeader
123
100
  };