@cfx-dev/ui-components 4.5.1 → 4.5.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 (52) hide show
  1. package/dist/assets/all_css.css +2 -0
  2. package/dist/assets/css/Input.css +1 -1
  3. package/dist/assets/css/Modal.css +1 -1
  4. package/dist/assets/css/StyledInput.css +1 -0
  5. package/dist/assets/css/StyledTextarea.css +1 -0
  6. package/dist/assets/css/Textarea.css +1 -1
  7. package/dist/assets/general/global.css +1 -1
  8. package/dist/components/Button/LinkButton.js +30 -24
  9. package/dist/components/Checkbox/Checkbox.d.ts +1 -0
  10. package/dist/components/Checkbox/Checkbox.js +139 -129
  11. package/dist/components/ClipboardButton/ClipboardButton.js +4 -4
  12. package/dist/components/DropdownSelect/DropdownSelect.d.ts +2 -1
  13. package/dist/components/DropdownSelect/DropdownSelect.js +53 -44
  14. package/dist/components/DropdownSelect/DropdownSelectShowcase.js +13 -12
  15. package/dist/components/Flyout/Flyout.js +4 -4
  16. package/dist/components/Input/Input.d.ts +3 -2
  17. package/dist/components/Input/Input.js +94 -89
  18. package/dist/components/Input/Input.types.d.ts +2 -0
  19. package/dist/components/Input/Input.types.js +1 -0
  20. package/dist/components/Input/RichInput.d.ts +1 -1
  21. package/dist/components/Input/index.d.ts +2 -1
  22. package/dist/components/InputDropzone/InputDropzone.d.ts +1 -0
  23. package/dist/components/InputDropzone/InputDropzone.js +135 -134
  24. package/dist/components/InputDropzone/InputDropzoneShowcase.js +6 -5
  25. package/dist/components/Modal/Modal.d.ts +36 -2
  26. package/dist/components/Modal/Modal.js +129 -63
  27. package/dist/components/Modal/ModalShowcase.js +24 -16
  28. package/dist/components/Radio/Radio.d.ts +1 -0
  29. package/dist/components/Radio/Radio.js +21 -19
  30. package/dist/components/StyledInput/StyledInput.d.ts +12 -0
  31. package/dist/components/StyledInput/StyledInput.js +46 -0
  32. package/dist/components/StyledInput/index.d.ts +2 -0
  33. package/dist/components/StyledInput/index.js +4 -0
  34. package/dist/components/StyledTextarea/StyledTextarea.d.ts +10 -0
  35. package/dist/components/StyledTextarea/StyledTextarea.js +32 -0
  36. package/dist/components/StyledTextarea/index.d.ts +2 -0
  37. package/dist/components/StyledTextarea/index.js +4 -0
  38. package/dist/components/Switch/Switch.js +61 -49
  39. package/dist/components/Tabular/Tabular.d.ts +12 -0
  40. package/dist/components/Tabular/Tabular.js +34 -33
  41. package/dist/components/Tabular/index.d.ts +1 -1
  42. package/dist/components/Textarea/Textarea.d.ts +7 -3
  43. package/dist/components/Textarea/Textarea.js +46 -43
  44. package/dist/components/ToggleGroup/ToggleGroup.d.ts +1 -0
  45. package/dist/components/ToggleGroup/ToggleGroup.js +57 -47
  46. package/dist/main.d.ts +5 -1
  47. package/dist/main.js +126 -122
  48. package/dist/rsc.d.ts +4 -0
  49. package/dist/rsc.js +12 -8
  50. package/dist/styles-scss/global.scss +1 -1
  51. package/dist/styles-scss/tokens.scss +19 -20
  52. package/package.json +1 -1
@@ -1,60 +1,81 @@
1
- import { jsxs as i, jsx as a } from "react/jsx-runtime";
2
- import N from "react";
1
+ import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
+ import B from "react";
3
3
  import "../Button/Button.js";
4
- import { ButtonBar as k } from "../Button/ButtonBar.js";
4
+ import { ButtonBar as M } from "../Button/ButtonBar.js";
5
5
  import "../../utils/links.js";
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 "../../utils/ui/ui.js";
10
- import { clsx as s } from "../../utils/clsx.js";
6
+ import g from "../Flex/Flex.js";
7
+ import { clsx as i } from "../../utils/clsx.js";
8
+ import { IconBig as w } from "../IconBig/IconBig.js";
9
+ import O from "../IconButton/IconButton.js";
10
+ import { Overlay as u } from "../Overlay/Overlay.js";
11
+ import { Text as b } from "../Text/Text.js";
12
+ import { ui as C } from "../../utils/ui/ui.js";
13
+ import { ColorEnum as z } from "../../utils/ui/ui.types.js";
11
14
  import "../../utils/hooks/useGlobalKeyboardEvent.js";
12
- import { useKeyboardClose as x } from "../../utils/hooks/useKeyboardClose.js";
15
+ import { useKeyboardClose as F } from "../../utils/hooks/useKeyboardClose.js";
13
16
  import "../../index-Cl_RnsqN.js";
14
- const M = "cfxui__Modal__root__53283", B = "cfxui__Modal__close__2df9b", v = "cfxui__Modal__header__bec76", g = "cfxui__Modal__footer__bb2fc", r = {
15
- root: M,
16
- close: B,
17
- header: v,
18
- footer: g
17
+ const H = "cfxui__Modal__root__53283", I = "cfxui__Modal__colored__649d1", L = "cfxui__Modal__close__2df9b", T = "cfxui__Modal__header__bec76", j = "cfxui__Modal__footer__bb2fc", l = {
18
+ root: H,
19
+ colored: I,
20
+ close: L,
21
+ header: T,
22
+ footer: j
19
23
  };
20
- function _(c) {
24
+ var A = /* @__PURE__ */ ((o) => (o.default = "default", o.danger = "danger", o.success = "success", o.warning = "warning", o))(A || {});
25
+ const h = {
26
+ default: void 0,
27
+ danger: "red",
28
+ success: "green",
29
+ warning: "yellow"
30
+ };
31
+ function N(o) {
21
32
  const {
22
- onClose: o,
23
- children: l,
24
- className: e,
25
- overlayClassName: f,
26
- backdropClassName: p,
27
- contentClassName: b,
28
- ariaDescribedby: u,
29
- ariaLabelledby: h,
30
- disableBackdropClose: d = !1,
31
- disableFocusLock: C = !1
32
- } = c, n = N.useCallback(() => {
33
- d || !o || o();
34
- }, [o, d]);
35
- return x(n), /* @__PURE__ */ i(t, { className: s(r.overlay, f), children: [
33
+ theme: r = "default",
34
+ color: c,
35
+ onClose: e,
36
+ children: t,
37
+ className: s,
38
+ overlayClassName: m,
39
+ backdropClassName: f,
40
+ contentClassName: y,
41
+ ariaDescribedby: v,
42
+ ariaLabelledby: x,
43
+ disableBackdropClose: _ = !1,
44
+ disableFocusLock: k = !1
45
+ } = o, p = B.useCallback(() => {
46
+ _ || !e || e();
47
+ }, [e, _]);
48
+ F(p);
49
+ const n = c || h[r];
50
+ return /* @__PURE__ */ d(u, { className: i(l.overlay, m), children: [
36
51
  /* @__PURE__ */ a(
37
- t.Backdrop,
52
+ u.Backdrop,
38
53
  {
39
- onClick: n,
40
- className: s(r.backdrop, p)
54
+ onClick: p,
55
+ className: i(l.backdrop, f)
41
56
  }
42
57
  ),
43
58
  /* @__PURE__ */ a(
44
- t.Content,
59
+ u.Content,
45
60
  {
46
- className: b,
47
- disableFocusLock: C,
48
- children: /* @__PURE__ */ i(
61
+ className: y,
62
+ disableFocusLock: k,
63
+ children: /* @__PURE__ */ d(
49
64
  "div",
50
65
  {
51
66
  role: "dialog",
52
- "aria-describedby": u,
53
- "aria-labelledby": h,
54
- className: s(r.root, e),
67
+ "aria-describedby": v,
68
+ "aria-labelledby": x,
69
+ className: i(l.root, s, {
70
+ [l.colored]: !!n
71
+ }),
72
+ style: {
73
+ "--modal-color": n ? C.color(n) : void 0,
74
+ "--modal-color-bg": n ? C.color(n, void 0, 0.2) : void 0
75
+ },
55
76
  children: [
56
- !!o && /* @__PURE__ */ a(y, { areaSize: "large", className: r.close, name: "Close", onClick: o }),
57
- l
77
+ !!e && /* @__PURE__ */ a(O, { areaSize: "large", className: l.close, name: "Close", onClick: e }),
78
+ t
58
79
  ]
59
80
  }
60
81
  )
@@ -62,37 +83,82 @@ function _(c) {
62
83
  )
63
84
  ] });
64
85
  }
65
- _.Header = function(o) {
86
+ function D(o) {
87
+ switch (o) {
88
+ case "danger":
89
+ return "Warni";
90
+ case "success":
91
+ return "Confirm";
92
+ default:
93
+ return;
94
+ }
95
+ }
96
+ function P(o) {
66
97
  const {
67
- title: l,
68
- description: e
98
+ theme: r = "default",
99
+ iconName: c,
100
+ iconColor: e
69
101
  } = o;
70
- return /* @__PURE__ */ i("div", { className: r.header, children: [
71
- /* @__PURE__ */ a(
72
- m,
102
+ if (!c && !r)
103
+ return null;
104
+ const t = c || D(r), s = e || h[r] || z.primary;
105
+ return t ? /* @__PURE__ */ a(g, { centered: !0, children: /* @__PURE__ */ a(
106
+ w,
107
+ {
108
+ name: t,
109
+ color: s,
110
+ size: "normal"
111
+ }
112
+ ) }) : null;
113
+ }
114
+ N.Header = function(r) {
115
+ const {
116
+ title: c,
117
+ description: e,
118
+ theme: t = "default",
119
+ icon: s,
120
+ iconName: m,
121
+ iconColor: f
122
+ } = r;
123
+ return /* @__PURE__ */ d(g, { vertical: !0, gap: "large", children: [
124
+ s || /* @__PURE__ */ a(
125
+ P,
73
126
  {
74
- weight: "bold",
75
- size: "large",
76
- children: l
127
+ theme: t,
128
+ iconName: m,
129
+ iconColor: f
77
130
  }
78
131
  ),
79
- e && /* @__PURE__ */ a(
80
- m,
81
- {
82
- size: "small",
83
- color: "secondary",
84
- children: e
85
- }
86
- )
132
+ /* @__PURE__ */ d("div", { className: l.header, children: [
133
+ /* @__PURE__ */ a(
134
+ b,
135
+ {
136
+ weight: "bold",
137
+ size: "large",
138
+ children: c
139
+ }
140
+ ),
141
+ e && /* @__PURE__ */ a(
142
+ b,
143
+ {
144
+ size: "small",
145
+ color: "secondary",
146
+ typographic: !0,
147
+ children: e
148
+ }
149
+ )
150
+ ] })
87
151
  ] });
88
152
  };
89
- _.Footer = function(o) {
153
+ N.Footer = function(r) {
90
154
  const {
91
- className: l,
155
+ className: c,
92
156
  ...e
93
- } = o;
94
- return /* @__PURE__ */ a(k, { ...e, className: s(r.footer, l) });
157
+ } = r;
158
+ return /* @__PURE__ */ a(M, { ...e, className: i(l.footer, c) });
95
159
  };
96
160
  export {
97
- _ as Modal
161
+ h as MODAL_THEME_TO_COLOR_MAP,
162
+ N as Modal,
163
+ A as ModalThemeEnum
98
164
  };
@@ -1,17 +1,17 @@
1
1
  import { jsxs as e, jsx as o } from "react/jsx-runtime";
2
- import i from "react";
2
+ import r from "react";
3
3
  import n from "../Box/Box.js";
4
4
  import "../../utils/ui/ui.js";
5
- import l from "../Button/Button.js";
5
+ import i from "../Button/Button.js";
6
6
  import "../../utils/links.js";
7
- import p from "../Input/Input.js";
7
+ import c from "../Input/Input.js";
8
8
  import "../../utils/hooks/useGlobalKeyboardEvent.js";
9
9
  import "../../utils/hooks/useKeyboardClose.js";
10
10
  import "../../index-Cl_RnsqN.js";
11
- import { LOREM_IPSUM as c } from "../../utils/loremipsum.js";
12
- import { Modal as r } from "./Modal.js";
11
+ import { LOREM_IPSUM as p } from "../../utils/loremipsum.js";
12
+ import { Modal as l } from "./Modal.js";
13
13
  function s() {
14
- const [d, m] = i.useState(!1), t = i.useCallback(() => m((a) => !a), []);
14
+ const [a, d] = r.useState(!1), t = r.useCallback(() => d((m) => !m), []);
15
15
  return /* @__PURE__ */ e(
16
16
  "div",
17
17
  {
@@ -22,16 +22,24 @@ function s() {
22
22
  children: [
23
23
  /* @__PURE__ */ o("div", { id: "backdrop" }),
24
24
  /* @__PURE__ */ o("div", { id: "overlay-outlet" }),
25
- /* @__PURE__ */ o(l, { theme: "primary", onClick: t, text: "Toggle Modal" }),
26
- d && /* @__PURE__ */ e(r, { onClose: t, children: [
27
- /* @__PURE__ */ o(r.Header, { title: "Modal Title", description: "Modal Description" }),
28
- /* @__PURE__ */ o(n, { mb: 4, children: /* @__PURE__ */ o(p, { theme: "onlight", placeholder: "Input", fullWidth: !0 }) }),
25
+ /* @__PURE__ */ o(i, { theme: "primary", onClick: t, text: "Toggle Modal" }),
26
+ a && /* @__PURE__ */ e(l, { onClose: t, children: [
27
+ /* @__PURE__ */ o(
28
+ l.Header,
29
+ {
30
+ iconName: "Subscriptions",
31
+ iconColor: "accent",
32
+ title: "Modal Title",
33
+ description: "Modal Description"
34
+ }
35
+ ),
36
+ /* @__PURE__ */ o(n, { mb: 4, children: /* @__PURE__ */ o(c, { theme: "onlight", placeholder: "Input", fullWidth: !0 }) }),
29
37
  "Modal content:",
30
38
  " ",
31
- c,
32
- /* @__PURE__ */ e(r.Footer, { children: [
39
+ p,
40
+ /* @__PURE__ */ e(l.Footer, { children: [
33
41
  /* @__PURE__ */ o(
34
- l,
42
+ i,
35
43
  {
36
44
  fullWidth: !0,
37
45
  theme: "secondary",
@@ -40,7 +48,7 @@ function s() {
40
48
  }
41
49
  ),
42
50
  /* @__PURE__ */ o(
43
- l,
51
+ i,
44
52
  {
45
53
  fullWidth: !0,
46
54
  theme: "primary",
@@ -54,7 +62,7 @@ function s() {
54
62
  }
55
63
  );
56
64
  }
57
- const b = i.memo(s);
65
+ const w = r.memo(s);
58
66
  export {
59
- b as default
67
+ w as default
60
68
  };
@@ -8,5 +8,6 @@ export interface RadioProps {
8
8
  size?: RadioSize;
9
9
  disabled?: boolean;
10
10
  className?: string;
11
+ name?: string;
11
12
  }
12
13
  export declare function Radio(props: RadioProps): import("react/jsx-runtime").JSX.Element;
@@ -1,45 +1,47 @@
1
- import { jsxs as x, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as b, jsx as o } from "react/jsx-runtime";
2
2
  import a from "react";
3
- import { clsx as b } from "../../utils/clsx.js";
4
- const h = "cfxui__Radio__root__05f1c", R = "cfxui__Radio__indicator__2181e", p = "cfxui__Radio__disabled__c411f", o = {
5
- root: h,
3
+ import { clsx as h } from "../../utils/clsx.js";
4
+ const R = "cfxui__Radio__root__05f1c", p = "cfxui__Radio__indicator__2181e", z = "cfxui__Radio__disabled__c411f", e = {
5
+ root: R,
6
6
  "size-normal": "cfxui__Radio__size-normal__6dccc",
7
7
  "size-large": "cfxui__Radio__size-large__0a074",
8
- indicator: R,
9
- disabled: p
8
+ indicator: p,
9
+ disabled: z
10
10
  };
11
11
  let t = 1;
12
- function C(d) {
12
+ function N(d) {
13
13
  const {
14
14
  checked: i,
15
15
  onChange: n,
16
16
  label: _,
17
17
  size: l = "normal",
18
18
  className: r,
19
- disabled: s = !1
20
- } = d, f = a.useRef(t);
19
+ disabled: s = !1,
20
+ name: f
21
+ } = d, m = a.useRef(t);
21
22
  a.useEffect(() => {
22
23
  t += 1;
23
24
  }, []);
24
- const m = () => {
25
+ const u = () => {
25
26
  n(!i);
26
- }, c = a.useId(), u = b(o.root, r, o[`size-${l}`], { [o.disabled]: s });
27
- return /* @__PURE__ */ x("label", { className: u, htmlFor: c, children: [
28
- /* @__PURE__ */ e(
27
+ }, c = a.useId(), x = h(e.root, r, e[`size-${l}`], { [e.disabled]: s });
28
+ return /* @__PURE__ */ b("label", { className: x, htmlFor: c, children: [
29
+ /* @__PURE__ */ o(
29
30
  "input",
30
31
  {
31
32
  type: "radio",
32
- tabIndex: f.current,
33
+ tabIndex: m.current,
33
34
  checked: i,
34
35
  disabled: s,
35
- onChange: m,
36
- id: c
36
+ onChange: u,
37
+ id: c,
38
+ name: f
37
39
  }
38
40
  ),
39
- /* @__PURE__ */ e("div", { className: o.indicator }),
40
- /* @__PURE__ */ e("div", { className: o.label, children: _ })
41
+ /* @__PURE__ */ o("div", { className: e.indicator }),
42
+ /* @__PURE__ */ o("div", { className: e.label, children: _ })
41
43
  ] });
42
44
  }
43
45
  export {
44
- C as Radio
46
+ N as Radio
45
47
  };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { InputSize, InputTheme } from '../Input/Input.types';
3
+ import { ResponsiveValueType } from '../../utils/ui';
4
+
5
+ export interface StyledInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
6
+ className?: string;
7
+ size?: ResponsiveValueType<InputSize>;
8
+ theme?: InputTheme;
9
+ ref?: React.Ref<HTMLInputElement>;
10
+ }
11
+ declare function StyledInput(props: StyledInputProps): import("react/jsx-runtime").JSX.Element;
12
+ export default StyledInput;
@@ -0,0 +1,46 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { clsx as m } from "../../utils/clsx.js";
3
+ import { ui as p } from "../../utils/ui/ui.js";
4
+ const s = "cfxui__StyledInput__root__37064", S = "cfxui__StyledInput__small__0f240", r = "cfxui__StyledInput__large__a3ad2", d = "cfxui__StyledInput__onlight__dcd8f", l = {
5
+ root: s,
6
+ small: S,
7
+ large: r,
8
+ onlight: d,
9
+ "inputSizeinitial-large": "cfxui__StyledInput__inputSizeinitial-large__a31e6",
10
+ "inputSizeinitial-small": "cfxui__StyledInput__inputSizeinitial-small__77433",
11
+ "inputSizesmall-large": "cfxui__StyledInput__inputSizesmall-large__eb62a",
12
+ "inputSizesmall-small": "cfxui__StyledInput__inputSizesmall-small__d5e87",
13
+ "inputSizesmall-medium-large": "cfxui__StyledInput__inputSizesmall-medium-large__b13be",
14
+ "inputSizesmall-medium-small": "cfxui__StyledInput__inputSizesmall-medium-small__a9d00",
15
+ "inputSizemedium-large": "cfxui__StyledInput__inputSizemedium-large__75764",
16
+ "inputSizemedium-small": "cfxui__StyledInput__inputSizemedium-small__43151",
17
+ "inputSizemedium-large-large": "cfxui__StyledInput__inputSizemedium-large-large__3f450",
18
+ "inputSizemedium-large-small": "cfxui__StyledInput__inputSizemedium-large-small__eba0f",
19
+ "inputSizelarge-large": "cfxui__StyledInput__inputSizelarge-large__19572",
20
+ "inputSizelarge-small": "cfxui__StyledInput__inputSizelarge-small__3ecc3",
21
+ "inputSizexlarge-large": "cfxui__StyledInput__inputSizexlarge-large__06e9b",
22
+ "inputSizexlarge-small": "cfxui__StyledInput__inputSizexlarge-small__b318f"
23
+ };
24
+ function f(e) {
25
+ const {
26
+ className: i,
27
+ size: _ = "normal",
28
+ theme: t = "default",
29
+ ...u
30
+ } = e;
31
+ return /* @__PURE__ */ n(
32
+ "input",
33
+ {
34
+ className: m(
35
+ i,
36
+ l.root,
37
+ l[t],
38
+ p.getResponsiveFlatClassnames("input-size", _).map((a) => l[a])
39
+ ),
40
+ ...u
41
+ }
42
+ );
43
+ }
44
+ export {
45
+ f as default
46
+ };
@@ -0,0 +1,2 @@
1
+ export { default as StyledInput } from './StyledInput';
2
+ export type { StyledInputProps } from './StyledInput';
@@ -0,0 +1,4 @@
1
+ import { default as a } from "./StyledInput.js";
2
+ export {
3
+ a as StyledInput
4
+ };
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+
3
+ export type TextareaResizeType = 'none' | 'vertical' | 'horizontal' | 'both';
4
+ export interface StyledTextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
5
+ className?: string;
6
+ resize?: TextareaResizeType;
7
+ ref?: React.Ref<HTMLTextAreaElement>;
8
+ }
9
+ declare function StyledTextarea(props: StyledTextareaProps): import("react/jsx-runtime").JSX.Element;
10
+ export default StyledTextarea;
@@ -0,0 +1,32 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { clsx as i } from "../../utils/clsx.js";
3
+ const c = "cfxui__StyledTextarea__root__8c3b9", e = {
4
+ root: c,
5
+ "resize-none": "cfxui__StyledTextarea__resize-none__e5b55",
6
+ "resize-vertical": "cfxui__StyledTextarea__resize-vertical__717ec",
7
+ "resize-horizontal": "cfxui__StyledTextarea__resize-horizontal__4f44b",
8
+ "resize-both": "cfxui__StyledTextarea__resize-both__c451f"
9
+ };
10
+ function n(r) {
11
+ const {
12
+ className: t,
13
+ resize: _ = "none",
14
+ ref: o,
15
+ ...a
16
+ } = r;
17
+ return /* @__PURE__ */ s(
18
+ "textarea",
19
+ {
20
+ className: i(
21
+ e.root,
22
+ t,
23
+ e[`resize-${_}`]
24
+ ),
25
+ ref: o,
26
+ ...a
27
+ }
28
+ );
29
+ }
30
+ export {
31
+ n as default
32
+ };
@@ -0,0 +1,2 @@
1
+ export { default as StyledTextarea } from './StyledTextarea';
2
+ export type { StyledTextareaProps, TextareaResizeType } from './StyledTextarea';
@@ -0,0 +1,4 @@
1
+ import { default as t } from "./StyledTextarea.js";
2
+ export {
3
+ t as StyledTextarea
4
+ };