@cfx-dev/ui-components 2.1.12 → 2.1.14

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 (35) hide show
  1. package/dist/assets/Badge.css +1 -1
  2. package/dist/assets/IconButton.css +1 -1
  3. package/dist/assets/Input.css +1 -1
  4. package/dist/assets/InputDropzone.css +1 -1
  5. package/dist/assets/ItemPreview.css +1 -1
  6. package/dist/assets/Modal.css +1 -1
  7. package/dist/assets/RichInput.css +1 -1
  8. package/dist/assets/Select.css +1 -1
  9. package/dist/assets/Table.css +1 -1
  10. package/dist/assets/Tabular.css +1 -1
  11. package/dist/assets/global.css +1 -1
  12. package/dist/components/Badge/Badge.d.ts +2 -0
  13. package/dist/components/Badge/Badge.js +23 -21
  14. package/dist/components/Badge/BadgeShowcase.js +44 -22
  15. package/dist/components/IconButton/IconButton.d.ts +2 -0
  16. package/dist/components/IconButton/IconButton.js +27 -24
  17. package/dist/components/Input/Input.d.ts +2 -0
  18. package/dist/components/Input/Input.js +94 -72
  19. package/dist/components/Input/InputShowcase.js +24 -10
  20. package/dist/components/Input/RichInput.js +28 -28
  21. package/dist/components/InputDropzone/InputDropzone.d.ts +9 -1
  22. package/dist/components/InputDropzone/InputDropzone.js +316 -300
  23. package/dist/components/InputDropzone/InputDropzoneShowcase.js +28 -18
  24. package/dist/components/InputDropzone/ItemPreview.d.ts +2 -1
  25. package/dist/components/InputDropzone/ItemPreview.js +20 -18
  26. package/dist/components/Modal/Modal.js +39 -39
  27. package/dist/components/Modal/ModalShowcase.js +18 -14
  28. package/dist/components/Select/Select.js +53 -53
  29. package/dist/components/Table/Table.d.ts +2 -0
  30. package/dist/components/Table/Table.js +87 -82
  31. package/dist/components/Tabular/Tabular.js +46 -46
  32. package/dist/main.d.ts +1 -1
  33. package/dist/main.js +43 -42
  34. package/dist/styles-scss/tokens.scss +5 -0
  35. package/package.json +1 -1
@@ -1,27 +1,37 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import e from "react";
3
- import p from "./InputDropzone.js";
4
- function u() {
5
- const [r, t] = e.useState([]), s = e.useCallback((o) => {
6
- t(o);
7
- }, []), a = e.useCallback((o) => {
8
- t((i) => {
9
- const n = [...i], l = n.indexOf(o);
10
- return l !== -1 && n.splice(l, 1), n;
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import n from "react";
3
+ import d from "./InputDropzone.js";
4
+ function R() {
5
+ const [l, i] = n.useState([]), [a, c] = n.useState([]), r = n.useCallback((o, t) => {
6
+ i(o), c(t);
7
+ }, []), p = n.useCallback((o) => {
8
+ i((t) => {
9
+ const e = [...t], s = e.indexOf(o);
10
+ return s !== -1 && e.splice(s, 1), e;
11
+ });
12
+ }, []), u = n.useCallback((o) => {
13
+ c((t) => {
14
+ const e = [...t], s = e.findIndex((f) => o === f.file);
15
+ return s !== -1 && e.splice(s, 1), e;
11
16
  });
12
17
  }, []);
13
- return /* @__PURE__ */ c(
14
- p,
18
+ return /* @__PURE__ */ m(
19
+ d,
15
20
  {
16
- value: r,
17
- onRemoveFile: a,
18
- onDrop: s,
21
+ value: l,
22
+ rejections: a,
23
+ onRemoveFile: p,
24
+ onRemoveRejection: u,
25
+ onDrop: r,
19
26
  text: "Drag and Drop file here or",
20
- linkText: "Choose file."
27
+ linkText: "Choose file.",
28
+ accept: {
29
+ "image/png": [".png"]
30
+ }
21
31
  }
22
32
  );
23
33
  }
24
- const h = e.memo(u);
34
+ const D = n.memo(R);
25
35
  export {
26
- h as default
36
+ D as default
27
37
  };
@@ -6,7 +6,8 @@ export interface ItemPreviewProps {
6
6
  onRemoveFile: (file: FileWithPath) => void;
7
7
  removeAriaLabel?: string;
8
8
  className?: string;
9
+ theme?: 'default' | 'failed';
9
10
  }
10
- declare function ItemPreview({ file, onRemoveFile, removeAriaLabel, className, }: ItemPreviewProps): import("react/jsx-runtime").JSX.Element;
11
+ declare function ItemPreview({ file, onRemoveFile, removeAriaLabel, className, theme, }: ItemPreviewProps): import("react/jsx-runtime").JSX.Element;
11
12
  declare const _default: React.MemoExoticComponent<typeof ItemPreview>;
12
13
  export default _default;
@@ -1,27 +1,29 @@
1
- import { jsxs as i, jsx as a } from "react/jsx-runtime";
1
+ import { jsxs as n, jsx as s } from "react/jsx-runtime";
2
2
  import e from "react";
3
- import { Button as l } from "../Button/Button.js";
4
- import { Text as f } from "../Text/Text.js";
5
- import { clsx as h } from "../../utils/clsx.js";
6
- import '../../assets/ItemPreview.css';const p = "_root_7ek6f_1", d = "_filePath_7ek6f_13", r = {
7
- root: p,
8
- filePath: d
3
+ import f from "../IconButton/IconButton.js";
4
+ import { Text as d } from "../Text/Text.js";
5
+ import { clsx as _ } from "../../utils/clsx.js";
6
+ import '../../assets/ItemPreview.css';const h = "_root_1v0i1_1", p = "_failed_1v0i1_12", u = "_filePath_1v0i1_15", a = {
7
+ root: h,
8
+ failed: p,
9
+ filePath: u
9
10
  };
10
- function _({
11
+ function P({
11
12
  file: t,
12
- onRemoveFile: s,
13
+ onRemoveFile: r,
13
14
  removeAriaLabel: o = "",
14
- className: c
15
+ className: i,
16
+ theme: c = "default"
15
17
  }) {
16
- const m = e.useCallback(() => {
17
- s(t);
18
- }, [t, s]), n = e.useMemo(() => `${o}${o ? ", " : ""}${t.path}`, [o, t.path]);
19
- return /* @__PURE__ */ i("div", { className: h(r.root, c), children: [
20
- /* @__PURE__ */ a(f, { family: "secondary", className: r.filePath, children: t.path }),
21
- /* @__PURE__ */ a(l, { theme: "secondary", ariaLabel: n, icon: "Close", onClick: m })
18
+ const l = e.useCallback(() => {
19
+ r(t);
20
+ }, [t, r]), m = e.useMemo(() => `${o}${o ? ", " : ""}${t.path}`, [o, t.path]);
21
+ return /* @__PURE__ */ n("div", { className: _(a.root, a[c], i), children: [
22
+ /* @__PURE__ */ s(d, { family: "secondary", className: a.filePath, children: t.path }),
23
+ /* @__PURE__ */ s(f, { areaSize: "large", ariaLabel: m, name: "Close", onClick: l })
22
24
  ] });
23
25
  }
24
- const $ = e.memo(_);
26
+ const I = e.memo(P);
25
27
  export {
26
- $ as default
28
+ I as default
27
29
  };
@@ -4,46 +4,46 @@ import "../Button/Button.js";
4
4
  import { ButtonBar as k } from "../Button/ButtonBar.js";
5
5
  import "../Button/LinkButton.js";
6
6
  import y from "../IconButton/IconButton.js";
7
- import { Overlay as t } from "../Overlay/Overlay.js";
8
- import { Text as m } from "../Text/Text.js";
9
- import { clsx as l } from "../../utils/clsx.js";
7
+ import { Overlay as c } from "../Overlay/Overlay.js";
8
+ import { Text as d } from "../Text/Text.js";
9
+ import { clsx as s } from "../../utils/clsx.js";
10
10
  import "../../utils/hooks/useGlobalKeyboardEvent.js";
11
11
  import { useKeyboardClose as w } from "../../utils/hooks/useKeyboardClose.js";
12
12
  import "../../index-2hJuj4UN.js";
13
- import '../../assets/Modal.css';const B = "_root_w22bc_1", v = "_close_w22bc_36", x = "_header_w22bc_42", g = "_footer_w22bc_52", r = {
13
+ import '../../assets/Modal.css';const B = "_root_lmrwf_1", v = "_close_lmrwf_36", x = "_header_lmrwf_42", g = "_footer_lmrwf_52", r = {
14
14
  root: B,
15
- "modal-appearance": "_modal-appearance_w22bc_1",
15
+ "modal-appearance": "_modal-appearance_lmrwf_1",
16
16
  close: v,
17
17
  header: x,
18
18
  footer: g
19
19
  };
20
- function p(c) {
20
+ function f(t) {
21
21
  const {
22
- onClose: o,
23
- children: s,
24
- className: e,
25
- overlayClassName: b,
26
- backdropClassName: f,
27
- contentClassName: _,
22
+ onClose: e,
23
+ children: l,
24
+ className: o,
25
+ overlayClassName: p,
26
+ backdropClassName: _,
27
+ contentClassName: b,
28
28
  ariaDescribedby: h,
29
29
  ariaLabelledby: u,
30
30
  disableBackdropClose: n = !1,
31
31
  disableFocusLock: C = !1
32
- } = c, d = N.useCallback(() => {
33
- n || !o || o();
34
- }, [o, n]);
35
- return w(d), /* @__PURE__ */ i(t, { className: l(r.overlay, b), children: [
32
+ } = t, m = N.useCallback(() => {
33
+ n || !e || e();
34
+ }, [e, n]);
35
+ return w(m), /* @__PURE__ */ i(c, { className: s(r.overlay, p), children: [
36
36
  /* @__PURE__ */ a(
37
- t.Backdrop,
37
+ c.Backdrop,
38
38
  {
39
- onClick: d,
40
- className: l(r.backdrop, f)
39
+ onClick: m,
40
+ className: s(r.backdrop, _)
41
41
  }
42
42
  ),
43
43
  /* @__PURE__ */ a(
44
- t.Content,
44
+ c.Content,
45
45
  {
46
- className: _,
46
+ className: b,
47
47
  disableFocusLock: C,
48
48
  children: /* @__PURE__ */ i(
49
49
  "div",
@@ -51,10 +51,10 @@ function p(c) {
51
51
  role: "dialog",
52
52
  "aria-describedby": h,
53
53
  "aria-labelledby": u,
54
- className: l(r.root, e),
54
+ className: s(r.root, o),
55
55
  children: [
56
- !!o && /* @__PURE__ */ a(y, { className: r.close, name: "Close", onClick: o }),
57
- s
56
+ !!e && /* @__PURE__ */ a(y, { areaSize: "large", className: r.close, name: "Close", onClick: e }),
57
+ l
58
58
  ]
59
59
  }
60
60
  )
@@ -62,37 +62,37 @@ function p(c) {
62
62
  )
63
63
  ] });
64
64
  }
65
- p.Header = function(o) {
65
+ f.Header = function(e) {
66
66
  const {
67
- title: s,
68
- description: e
69
- } = o;
67
+ title: l,
68
+ description: o
69
+ } = e;
70
70
  return /* @__PURE__ */ i("div", { className: r.header, children: [
71
71
  /* @__PURE__ */ a(
72
- m,
72
+ d,
73
73
  {
74
74
  weight: "bold",
75
75
  size: "large",
76
- children: s
76
+ children: l
77
77
  }
78
78
  ),
79
- e && /* @__PURE__ */ a(
80
- m,
79
+ o && /* @__PURE__ */ a(
80
+ d,
81
81
  {
82
82
  size: "small",
83
83
  color: "secondary",
84
- children: e
84
+ children: o
85
85
  }
86
86
  )
87
87
  ] });
88
88
  };
89
- p.Footer = function(o) {
89
+ f.Footer = function(e) {
90
90
  const {
91
- className: s,
92
- ...e
93
- } = o;
94
- return /* @__PURE__ */ a(k, { ...e, className: l(r.footer, s) });
91
+ className: l,
92
+ ...o
93
+ } = e;
94
+ return /* @__PURE__ */ a(k, { ...o, className: s(r.footer, l) });
95
95
  };
96
96
  export {
97
- p as Modal
97
+ f as Modal
98
98
  };
@@ -1,12 +1,15 @@
1
- import { jsxs as t, jsx as o } from "react/jsx-runtime";
2
- import r from "react";
1
+ import { jsxs as e, jsx as o } from "react/jsx-runtime";
2
+ import i from "react";
3
3
  import { Button as l } from "../Button/Button.js";
4
4
  import "../Button/LinkButton.js";
5
+ import n from "../Input/Input.js";
6
+ import "../Input/RichInput.js";
7
+ import { Box as c } from "../Layout/Box/Box.js";
5
8
  import { LOREM_IPSUM as s } from "../../utils/loremipsum.js";
6
- import { Modal as i } from "./Modal.js";
7
- function m() {
8
- const [a, d] = r.useState(!1), e = r.useCallback(() => d((n) => !n), []);
9
- return /* @__PURE__ */ t(
9
+ import { Modal as r } from "./Modal.js";
10
+ function p() {
11
+ const [d, a] = i.useState(!1), t = i.useCallback(() => a((m) => !m), []);
12
+ return /* @__PURE__ */ e(
10
13
  "div",
11
14
  {
12
15
  style: {
@@ -16,18 +19,19 @@ function m() {
16
19
  children: [
17
20
  /* @__PURE__ */ o("div", { id: "backdrop" }),
18
21
  /* @__PURE__ */ o("div", { id: "overlay-outlet" }),
19
- /* @__PURE__ */ o(l, { theme: "primary", onClick: e, text: "Toggle Modal" }),
20
- a && /* @__PURE__ */ t(i, { onClose: e, children: [
21
- /* @__PURE__ */ o(i.Header, { title: "Modal Title", description: "Modal Description" }),
22
+ /* @__PURE__ */ o(l, { theme: "primary", onClick: t, text: "Toggle Modal" }),
23
+ d && /* @__PURE__ */ e(r, { onClose: t, children: [
24
+ /* @__PURE__ */ o(r.Header, { title: "Modal Title", description: "Modal Description" }),
25
+ /* @__PURE__ */ o(c, { mb: 4, children: /* @__PURE__ */ o(n, { theme: "onlight", placeholder: "Input", fullWidth: !0 }) }),
22
26
  "Modal content: ",
23
27
  s,
24
- /* @__PURE__ */ t(i.Footer, { children: [
28
+ /* @__PURE__ */ e(r.Footer, { children: [
25
29
  /* @__PURE__ */ o(
26
30
  l,
27
31
  {
28
32
  fullWidth: !0,
29
33
  theme: "secondary",
30
- onClick: e,
34
+ onClick: t,
31
35
  text: "Close"
32
36
  }
33
37
  ),
@@ -36,7 +40,7 @@ function m() {
36
40
  {
37
41
  fullWidth: !0,
38
42
  theme: "primary",
39
- onClick: e,
43
+ onClick: t,
40
44
  text: "Confirm"
41
45
  }
42
46
  )
@@ -46,7 +50,7 @@ function m() {
46
50
  }
47
51
  );
48
52
  }
49
- const x = r.memo(m);
53
+ const S = i.memo(p);
50
54
  export {
51
- x as default
55
+ S as default
52
56
  };