@cfx-dev/ui-components 4.0.2 → 4.2.0

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 (95) hide show
  1. package/dist/{Combination-BRUj3CHE.js → Combination-Cbiw1XRb.js} +1 -1
  2. package/dist/assets/css/DropdownSelect.css +1 -1
  3. package/dist/assets/css/Flex.css +1 -1
  4. package/dist/assets/css/Input.css +1 -1
  5. package/dist/assets/css/RichInput.css +1 -1
  6. package/dist/assets/css/Select.css +1 -1
  7. package/dist/assets/css/Tabular.css +1 -1
  8. package/dist/assets/css/ToggleGroup.css +1 -1
  9. package/dist/assets/general/global.css +1 -1
  10. package/dist/components/Accordion/Accordion.js +18 -17
  11. package/dist/components/Accordion/AccordionShowcase.js +3 -2
  12. package/dist/components/Avatar/AvatarShowcase.js +3 -2
  13. package/dist/components/Badge/BadgeShowcase.js +5 -4
  14. package/dist/components/Button/ButtonShowcase.js +3 -2
  15. package/dist/components/Checkbox/Checkbox.js +6 -5
  16. package/dist/components/DropdownSelect/DropdownSelect.d.ts +4 -1
  17. package/dist/components/DropdownSelect/DropdownSelect.js +739 -715
  18. package/dist/components/DropdownSelect/DropdownSelectShowcase.js +11 -10
  19. package/dist/components/Flyout/Flyout.js +1 -1
  20. package/dist/components/Icon/Icon.d.ts +4 -3
  21. package/dist/components/Icon/Icon.js +27 -25
  22. package/dist/components/IconBig/IconBig.js +3 -2
  23. package/dist/components/InfoPanel/InfoPanelShowcase.js +11 -10
  24. package/dist/components/Input/Input.d.ts +2 -1
  25. package/dist/components/Input/Input.js +96 -75
  26. package/dist/components/Input/InputShowcase.js +6 -5
  27. package/dist/components/Input/RichInput.d.ts +2 -1
  28. package/dist/components/Input/RichInput.js +60 -43
  29. package/dist/components/Layout/Box/Box.d.ts +4 -11
  30. package/dist/components/Layout/Box/Box.js +58 -96
  31. package/dist/components/Layout/Flex/Flex.d.ts +7 -3
  32. package/dist/components/Layout/Flex/Flex.js +70 -62
  33. package/dist/components/Layout/Flex/Flex.types.d.ts +42 -0
  34. package/dist/components/Layout/Flex/Flex.types.js +7 -0
  35. package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -0
  36. package/dist/components/Link/LinkShowcase.js +1 -0
  37. package/dist/components/Logos/LogosShowcase.js +3 -2
  38. package/dist/components/Modal/Modal.js +1 -0
  39. package/dist/components/Overlay/Overlay.js +1 -1
  40. package/dist/components/Select/Select.d.ts +2 -3
  41. package/dist/components/Select/Select.js +1922 -7
  42. package/dist/components/Select/SelectShowcase.js +4 -3
  43. package/dist/components/Select/index.d.ts +1 -1
  44. package/dist/components/Select/index.js +2 -3
  45. package/dist/components/Separator/Separator.d.ts +2 -2
  46. package/dist/components/Separator/Separator.js +35 -25
  47. package/dist/components/Skeleton/Skeleton.d.ts +7 -6
  48. package/dist/components/Skeleton/Skeleton.js +35 -22
  49. package/dist/components/Skeleton/SkeletonShowcase.js +14 -13
  50. package/dist/components/Slider/Slider.js +11 -9
  51. package/dist/components/Slider/SliderShowcase.js +10 -9
  52. package/dist/components/Spacer/Spacer.d.ts +1 -1
  53. package/dist/components/Switch/Switch.js +6 -5
  54. package/dist/components/Table/Table.js +3 -2
  55. package/dist/components/Table/TableShowcase.js +7 -6
  56. package/dist/components/Tabular/Tabular.d.ts +6 -1
  57. package/dist/components/Tabular/Tabular.js +93 -64
  58. package/dist/components/Tabular/TabularShowcase.js +51 -25
  59. package/dist/components/Text/Text.d.ts +3 -1
  60. package/dist/components/Text/Text.js +61 -52
  61. package/dist/components/Text/Text.types.d.ts +4 -13
  62. package/dist/components/Text/Text.types.js +1 -4
  63. package/dist/components/Text/index.d.ts +3 -2
  64. package/dist/components/Text/index.js +9 -6
  65. package/dist/components/Title/TitleShowcase.js +4 -3
  66. package/dist/components/ToggleGroup/ToggleGroup.d.ts +1 -0
  67. package/dist/components/ToggleGroup/ToggleGroup.js +36 -33
  68. package/dist/components/ToggleGroup/ToggleGroupShowcase.d.ts +5 -0
  69. package/dist/components/ToggleGroup/ToggleGroupShowcase.js +60 -0
  70. package/dist/components/ToggleGroup/index.d.ts +2 -0
  71. package/dist/components/ToggleGroup/index.js +4 -0
  72. package/dist/components/ui.d.ts +37 -12
  73. package/dist/components/ui.js +61 -57
  74. package/dist/index-BZPx6jYI.js +8 -0
  75. package/dist/index-ByaXH_ih.js +10 -0
  76. package/dist/index-Cf5Yu9oD.js +67 -0
  77. package/dist/index-DBus3GoO.js +1342 -0
  78. package/dist/index-rKs9bXHr.js +6 -0
  79. package/dist/main.d.ts +1 -1
  80. package/dist/main.js +14 -14
  81. package/dist/{medium-JVtzoF2c.js → medium-BA3EQDZW.js} +2 -2
  82. package/dist/styles-scss/_ui.scss +10 -1
  83. package/dist/styles-scss/global.scss +39 -26
  84. package/dist/styles-scss/themes/theme_cfx.scss +2 -0
  85. package/dist/styles-scss/themes/theme_fivem.scss +2 -0
  86. package/dist/styles-scss/themes/theme_redm.scss +2 -0
  87. package/dist/styles-scss/themes/theme_wireframe.scss +2 -0
  88. package/dist/styles-scss/themes.scss +4 -4
  89. package/dist/styles-scss/tokens.scss +30 -17
  90. package/package.json +1 -1
  91. package/dist/Select-Ds-fm4CN.js +0 -3245
  92. package/dist/index-BCnz73Lm.js +0 -72
  93. package/dist/index-BW3WdIgK.js +0 -14
  94. package/dist/types/Offset.d.ts +0 -1
  95. package/dist/types/Offset.js +0 -1
@@ -1,7 +1,8 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
2
  import r from "react";
3
- import { Flex as t } from "../Layout/Flex/Flex.js";
3
+ import { Flex as l } from "../Layout/Flex/Flex.js";
4
4
  import { Text as o } from "../Text/Text.js";
5
+ import "../ui.js";
5
6
  import { DropdownSelect as a } from "./DropdownSelect.js";
6
7
  const c = [
7
8
  {
@@ -18,20 +19,20 @@ const c = [
18
19
  }
19
20
  ];
20
21
  function d() {
21
- const [n, i] = r.useState(void 0), [u, s] = r.useState(void 0);
22
- return /* @__PURE__ */ l(t, { gap: "large", vertical: !0, pb: 20, children: [
23
- /* @__PURE__ */ l(t, { gap: "normal", vertical: !0, children: [
22
+ const [i, n] = r.useState(void 0), [u, s] = r.useState(void 0);
23
+ return /* @__PURE__ */ t(l, { gap: "large", vertical: !0, pb: 20, children: [
24
+ /* @__PURE__ */ t(l, { gap: "normal", vertical: !0, children: [
24
25
  /* @__PURE__ */ e(o, { children: "Default Select Input" }),
25
26
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
26
27
  a,
27
28
  {
28
29
  options: c,
29
- onChange: i,
30
- value: n
30
+ onChange: n,
31
+ value: i
31
32
  }
32
33
  ) })
33
34
  ] }),
34
- /* @__PURE__ */ l(t, { gap: "normal", vertical: !0, children: [
35
+ /* @__PURE__ */ t(l, { gap: "normal", vertical: !0, children: [
35
36
  /* @__PURE__ */ e(o, { children: "Full Width Select Input" }),
36
37
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
37
38
  a,
@@ -46,7 +47,7 @@ function d() {
46
47
  ] })
47
48
  ] });
48
49
  }
49
- const f = r.memo(d);
50
+ const g = r.memo(d);
50
51
  export {
51
- f as default
52
+ g as default
52
53
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import n from "react";
3
- import { F as f } from "../../Combination-BRUj3CHE.js";
3
+ import { F as f } from "../../Combination-Cbiw1XRb.js";
4
4
  import { Button as p } from "../Button/Button.js";
5
5
  import { Interactive as h } from "../Interactive/Interactive.js";
6
6
  import { clsx as l } from "../../utils/clsx.js";
@@ -1,11 +1,12 @@
1
1
  import { default as React } from 'react';
2
2
  import { IconName } from '../Icons';
3
- import { TextColorProps, TextSize } from '../Text';
3
+ import { TextColorProps, ResponsiveTextSize } from '../Text';
4
+ import { ResponsiveValueType } from '../ui';
4
5
 
5
- export type IconSize = TextSize;
6
+ export type IconSize = ResponsiveTextSize;
6
7
  export interface IconProps extends TextColorProps {
7
8
  as?: React.ElementType;
8
- size?: IconSize;
9
+ size?: ResponsiveValueType<IconSize>;
9
10
  className?: string;
10
11
  name: IconName;
11
12
  }
@@ -1,37 +1,39 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import l from "react";
3
- import { I as _ } from "../../cfxIcons-BNd1WgpX.js";
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import i from "react";
3
+ import { I as g } from "../../cfxIcons-BNd1WgpX.js";
4
4
  import "../Icons/cfx-icons-big/Like.js";
5
5
  import "../Icons/cfx-icons-big/Subscriptions.js";
6
6
  import "../Icons/cfx-icons-big/Upload.js";
7
7
  import "../Icons/cfx-icons-big/Warning.js";
8
8
  import "../Icons/cfx-icons-big/Confirm.js";
9
- import { getTextOpacity as d } from "../Text/Text.js";
9
+ import { textSizeResponsiveValueFormatter as c, getTextOpacity as u } from "../Text/Text.js";
10
10
  import { ui as t } from "../ui.js";
11
- import { clsx as h } from "../../utils/clsx.js";
12
- import { getColor as y } from "../../utils/color.js";
13
- const I = "cfxui__Icon__root__6c380", S = {
14
- root: I
15
- }, A = l.forwardRef(function(r, i) {
11
+ import { clsx as a } from "../../utils/clsx.js";
12
+ import { getColor as h } from "../../utils/color.js";
13
+ const C = "cfxui__Icon__root__6c380", d = {
14
+ root: C
15
+ }, k = i.forwardRef(function(e, p) {
16
16
  const {
17
- as: c = "div",
17
+ as: l = "div",
18
18
  size: o = "normal",
19
- opacity: e,
20
- className: m,
21
- name: s
22
- } = r, p = {
23
- color: y({
24
- ...r,
25
- opacity: d(e)
19
+ opacity: m,
20
+ className: f,
21
+ name: y
22
+ } = e, n = a(
23
+ t.getResponsiveClassnames("width", o),
24
+ t.getResponsiveClassnames("height", o)
25
+ ), s = i.useMemo(() => ({
26
+ ...t.getResponsiveStyles("width", o, c),
27
+ ...t.getResponsiveStyles("height", o, c)
28
+ }), [o]), R = i.useMemo(() => ({
29
+ color: h({
30
+ ...e,
31
+ opacity: u(m)
26
32
  }),
27
- width: t.fontSize(o),
28
- height: t.fontSize(o)
29
- }, f = {
30
- width: t.fontSize(o),
31
- height: t.fontSize(o)
32
- }, a = _[s];
33
- return /* @__PURE__ */ n(c, { ref: i, style: p, className: h(S.root, m), children: /* @__PURE__ */ n(a, { style: f }) });
33
+ ...s
34
+ }), [m, e, s]), _ = g[y];
35
+ return /* @__PURE__ */ r(l, { ref: p, style: R, className: a(d.root, f, n), children: /* @__PURE__ */ r(_, { className: n, style: s }) });
34
36
  });
35
37
  export {
36
- A as Icon
38
+ k as Icon
37
39
  };
@@ -47,6 +47,7 @@ import "../Icons/cfx-icons/UpvotesBurst.js";
47
47
  import "../Icons/cfx-icons/UpvotesRecurring.js";
48
48
  import { I as f } from "../../cfxIconsBig-BLJjMT-Y.js";
49
49
  import { getTextOpacity as g } from "../Text/Text.js";
50
+ import "../ui.js";
50
51
  import { clsx as I } from "../../utils/clsx.js";
51
52
  import { getColor as x } from "../../utils/color.js";
52
53
  const z = "cfxui__IconBig__root__f259a", i = {
@@ -54,7 +55,7 @@ const z = "cfxui__IconBig__root__f259a", i = {
54
55
  "size-small": "cfxui__IconBig__size-small__4e0b8",
55
56
  "size-normal": "cfxui__IconBig__size-normal__6ab6d",
56
57
  "size-large": "cfxui__IconBig__size-large__753d2"
57
- }, Bo = l.forwardRef(function(o, r) {
58
+ }, uo = l.forwardRef(function(o, r) {
58
59
  const {
59
60
  as: m = "div",
60
61
  size: p = "normal",
@@ -70,5 +71,5 @@ const z = "cfxui__IconBig__root__f259a", i = {
70
71
  return /* @__PURE__ */ t(m, { ref: r, style: e, className: _, children: /* @__PURE__ */ t(a, {}) });
71
72
  });
72
73
  export {
73
- Bo as IconBig
74
+ uo as IconBig
74
75
  };
@@ -1,39 +1,40 @@
1
1
  import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
- import o from "react";
2
+ import a from "react";
3
3
  import { Flex as n } from "../Layout/Flex/Flex.js";
4
4
  import { Text as i } from "../Text/Text.js";
5
+ import "../ui.js";
5
6
  import { LOREM_IPSUM as t } from "../../utils/loremipsum.js";
6
7
  import l from "./InfoPanel.js";
7
8
  function c() {
8
9
  return /* @__PURE__ */ r(i, { size: "small", children: t });
9
10
  }
10
- const a = () => {
11
+ const o = () => {
11
12
  };
12
13
  function h() {
13
14
  return /* @__PURE__ */ e(n, { gap: "large", vertical: !0, children: [
14
15
  /* @__PURE__ */ e(n, { gap: "normal", vertical: !0, children: [
15
16
  /* @__PURE__ */ r(i, { children: "Default" }),
16
- /* @__PURE__ */ r(l, { onClick: a, icon: "Warning", children: /* @__PURE__ */ r(c, {}) })
17
+ /* @__PURE__ */ r(l, { onClick: o, icon: "Warning", children: /* @__PURE__ */ r(c, {}) })
17
18
  ] }),
18
19
  /* @__PURE__ */ e(n, { gap: "normal", vertical: !0, children: [
19
20
  /* @__PURE__ */ r(i, { children: "Success" }),
20
- /* @__PURE__ */ r(l, { onClick: a, type: "success", icon: "Close", children: /* @__PURE__ */ r(c, {}) })
21
+ /* @__PURE__ */ r(l, { onClick: o, type: "success", icon: "Close", children: /* @__PURE__ */ r(c, {}) })
21
22
  ] }),
22
23
  /* @__PURE__ */ e(n, { gap: "normal", vertical: !0, children: [
23
24
  /* @__PURE__ */ r(i, { children: "Error" }),
24
- /* @__PURE__ */ r(l, { onClick: a, type: "error", icon: "Users", children: /* @__PURE__ */ r(c, {}) })
25
+ /* @__PURE__ */ r(l, { onClick: o, type: "error", icon: "Users", children: /* @__PURE__ */ r(c, {}) })
25
26
  ] }),
26
27
  /* @__PURE__ */ e(n, { gap: "normal", vertical: !0, children: [
27
28
  /* @__PURE__ */ r(i, { children: "Warning" }),
28
- /* @__PURE__ */ r(l, { onClick: a, type: "warning", icon: "Search", children: /* @__PURE__ */ r(c, {}) })
29
+ /* @__PURE__ */ r(l, { onClick: o, type: "warning", icon: "Search", children: /* @__PURE__ */ r(c, {}) })
29
30
  ] }),
30
31
  /* @__PURE__ */ e(n, { gap: "normal", vertical: !0, children: [
31
32
  /* @__PURE__ */ r(i, { children: "Small" }),
32
- /* @__PURE__ */ r(l, { onClick: a, size: "small", icon: "Warning", children: /* @__PURE__ */ r(c, {}) })
33
+ /* @__PURE__ */ r(l, { onClick: o, size: "small", icon: "Warning", children: /* @__PURE__ */ r(c, {}) })
33
34
  ] }),
34
35
  /* @__PURE__ */ e(n, { gap: "normal", vertical: !0, children: [
35
36
  /* @__PURE__ */ r(i, { children: "Large" }),
36
- /* @__PURE__ */ r(l, { onClick: a, size: "large", icon: "Warning", children: /* @__PURE__ */ r(c, {}) })
37
+ /* @__PURE__ */ r(l, { onClick: o, size: "large", icon: "Warning", children: /* @__PURE__ */ r(c, {}) })
37
38
  ] }),
38
39
  /* @__PURE__ */ e(n, { gap: "normal", vertical: !0, children: [
39
40
  /* @__PURE__ */ r(i, { children: "Not interactive" }),
@@ -41,7 +42,7 @@ function h() {
41
42
  ] })
42
43
  ] });
43
44
  }
44
- const f = o.memo(h);
45
+ const v = a.memo(h);
45
46
  export {
46
- f as default
47
+ v as default
47
48
  };
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { IconName } from '../Icon';
3
+ import { ResponsiveValueType } from '../ui';
3
4
 
4
5
  export type InputSize = 'small' | 'normal' | 'large';
5
6
  export type InputTheme = 'default' | 'onlight';
@@ -14,7 +15,7 @@ type InputTypeSpecificProps = {
14
15
  };
15
16
  export type InputProps = InputTypeSpecificProps & {
16
17
  id?: string;
17
- size?: InputSize;
18
+ size?: ResponsiveValueType<InputSize>;
18
19
  theme?: InputTheme;
19
20
  tabIndex?: number;
20
21
  autofocus?: boolean;
@@ -1,110 +1,131 @@
1
- import { jsxs as G, jsx as o } from "react/jsx-runtime";
2
- import l from "react";
1
+ import { jsxs as G, jsx as i } from "react/jsx-runtime";
2
+ import n from "react";
3
3
  import { Icon as T } from "../Icon/Icon.js";
4
4
  import W from "../IconButton/IconButton.js";
5
5
  import { Indicator as X } from "../Indicator/Indicator.js";
6
- import { clsx as $ } from "../../utils/clsx.js";
7
- import { getValue as q } from "../../utils/getValue.js";
8
- const H = "cfxui__Input__root__6392b", J = "cfxui__Input__input__07830", L = "cfxui__Input__small__c1513", O = "cfxui__Input__large__92d72", P = "cfxui__Input__placeholderIcon__4d079", Q = "cfxui__Input__onlight__7d0b7", U = "cfxui__Input__empty__3b36a", Y = "cfxui__Input__decorator__3b81f", e = {
9
- root: H,
10
- input: J,
11
- small: L,
12
- large: O,
13
- placeholderIcon: P,
14
- onlight: Q,
6
+ import { ui as $ } from "../ui.js";
7
+ import { clsx as q } from "../../utils/clsx.js";
8
+ import { getValue as H } from "../../utils/getValue.js";
9
+ const J = "cfxui__Input__root__6392b", L = "cfxui__Input__input__07830", O = "cfxui__Input__empty__3b36a", P = "cfxui__Input__placeholderIcon__4d079", Q = "cfxui__Input__decorator__3b81f", U = "cfxui__Input__small__c1513", Y = "cfxui__Input__large__92d72", Z = "cfxui__Input__onlight__7d0b7", e = {
10
+ root: J,
15
11
  "full-width": "cfxui__Input__full-width__587b3",
16
- empty: U,
17
- decorator: Y,
18
- "backdrop-blur": "cfxui__Input__backdrop-blur__6922f"
12
+ input: L,
13
+ empty: O,
14
+ placeholderIcon: P,
15
+ decorator: Q,
16
+ small: U,
17
+ large: Y,
18
+ onlight: Z,
19
+ "backdrop-blur": "cfxui__Input__backdrop-blur__6922f",
20
+ "input-size-initial-large": "cfxui__Input__input-size-initial-large__41d16",
21
+ "input-size-initial-small": "cfxui__Input__input-size-initial-small__5c106",
22
+ "input-size-small-large": "cfxui__Input__input-size-small-large__908ed",
23
+ "input-size-small-small": "cfxui__Input__input-size-small-small__936ed",
24
+ "input-size-small-medium-large": "cfxui__Input__input-size-small-medium-large__d2cf3",
25
+ "input-size-small-medium-small": "cfxui__Input__input-size-small-medium-small__50768",
26
+ "input-size-medium-large": "cfxui__Input__input-size-medium-large__9e343",
27
+ "input-size-medium-small": "cfxui__Input__input-size-medium-small__5ec16",
28
+ "input-size-medium-large-large": "cfxui__Input__input-size-medium-large-large__5a58f",
29
+ "input-size-medium-large-small": "cfxui__Input__input-size-medium-large-small__f4e31",
30
+ "input-size-large-large": "cfxui__Input__input-size-large-large__bd0f0",
31
+ "input-size-large-small": "cfxui__Input__input-size-large-small__05100",
32
+ "input-size-xlarge-large": "cfxui__Input__input-size-xlarge-large__38b57",
33
+ "input-size-xlarge-small": "cfxui__Input__input-size-xlarge-small__00b5b"
19
34
  };
20
- function Z(b) {
35
+ function ee(x) {
21
36
  const {
22
37
  decorator: t,
23
38
  loading: s,
24
- type: i,
25
- hasValue: _,
26
- onCleare: n
27
- } = b;
28
- return s ? /* @__PURE__ */ o("div", { className: e.decorator, children: /* @__PURE__ */ o(X, {}) }) : t ? /* @__PURE__ */ o("div", { className: e.decorator, children: q(t) }) : i === "search" && _ ? /* @__PURE__ */ o("div", { className: e.decorator, children: /* @__PURE__ */ o(W, { size: "xsmall", areaSize: "large", name: "Close", onClick: n }) }) : null;
39
+ type: o,
40
+ hasValue: c,
41
+ onCleare: a
42
+ } = x;
43
+ return s ? /* @__PURE__ */ i("div", { className: e.decorator, children: /* @__PURE__ */ i(X, {}) }) : t ? /* @__PURE__ */ i("div", { className: e.decorator, children: H(t) }) : o === "search" && c ? /* @__PURE__ */ i("div", { className: e.decorator, children: /* @__PURE__ */ i(W, { size: "xsmall", areaSize: "large", name: "Close", onClick: a }) }) : null;
29
44
  }
30
- const ce = l.forwardRef(function(t, s) {
45
+ const se = n.forwardRef(function(t, s) {
31
46
  const {
32
- id: i,
33
- fullWidth: _ = !1,
34
- value: n,
35
- onChange: d,
36
- onSubmit: f,
37
- onKeyDown: m,
38
- pattern: p,
39
- tabIndex: y,
47
+ id: o,
48
+ fullWidth: c = !1,
49
+ value: a,
50
+ onChange: m,
51
+ onSubmit: p,
52
+ onKeyDown: d,
53
+ pattern: f,
54
+ tabIndex: b,
40
55
  loading: C = !1,
41
- spellCheck: N = !0,
42
- autofocus: k = !1,
43
- disabled: w = !1,
56
+ spellCheck: y = !0,
57
+ autofocus: N = !1,
58
+ disabled: k = !1,
44
59
  className: v = "",
45
- placeholder: c = "",
46
- placeholderIcon: u,
47
- type: x = "text",
48
- size: E = "normal",
49
- theme: R = "default",
50
- decorator: V,
51
- backdropBlur: S = !1
52
- } = t, [h, D] = l.useState(n), g = typeof h < "u" && h !== "" && h !== null || typeof n < "u" && n !== "" && n !== null, z = t.type === "number" && (t.min ?? Number.MIN_SAFE_INTEGER) || void 0, A = t.type === "number" && (t.max ?? Number.MAX_SAFE_INTEGER) || void 0, r = l.useCallback((a) => {
53
- D(a), d && d(a);
54
- }, [d]), F = l.useCallback(
55
- (a) => {
60
+ placeholder: _ = "",
61
+ placeholderIcon: r,
62
+ type: z = "text",
63
+ size: w = "normal",
64
+ theme: E = "default",
65
+ decorator: R,
66
+ backdropBlur: V = !1
67
+ } = t, [g, S] = n.useState(a), h = typeof g < "u" && g !== "" && g !== null || typeof a < "u" && a !== "" && a !== null, D = t.type === "number" && (t.min ?? Number.MIN_SAFE_INTEGER) || void 0, F = t.type === "number" && (t.max ?? Number.MAX_SAFE_INTEGER) || void 0, u = n.useCallback((l) => {
68
+ S(l), m && m(l);
69
+ }, [m]), A = n.useCallback(
70
+ (l) => {
56
71
  const {
57
72
  value: I
58
- } = a.target;
59
- if (p) {
60
- p.test(I) && r(I);
73
+ } = l.target;
74
+ if (f) {
75
+ f.test(I) && u(I);
61
76
  return;
62
77
  }
63
- r(I);
78
+ u(I);
64
79
  },
65
- [r, p]
66
- ), K = l.useCallback((a) => {
67
- m && m(a), f && a.key === "Enter" && f();
68
- }, [m, f]), M = l.useCallback(() => {
69
- r("");
70
- }, [r]), j = $(e.root, e[E], e[R], v, {
71
- [e["full-width"]]: _,
72
- [e["backdrop-blur"]]: S,
73
- [e.empty]: !g
74
- }), B = l.useMemo(() => c ? u ? ` ${c.trim()}` : c.trim() : "", [c, u]);
80
+ [u, f]
81
+ ), K = n.useCallback((l) => {
82
+ d && d(l), p && l.key === "Enter" && p();
83
+ }, [d, p]), M = n.useCallback(() => {
84
+ u("");
85
+ }, [u]), j = q(
86
+ e.root,
87
+ e[E],
88
+ v,
89
+ $.getResponsiveFlatClassnames("input-size", w).map((l) => e[l]),
90
+ {
91
+ [e["full-width"]]: c,
92
+ [e["backdrop-blur"]]: V,
93
+ [e.empty]: !h
94
+ }
95
+ ), B = n.useMemo(() => _ ? r ? ` ${_.trim()}` : _.trim() : "", [_, r]);
75
96
  return /* @__PURE__ */ G("div", { className: j, children: [
76
- /* @__PURE__ */ o(
97
+ /* @__PURE__ */ i(
77
98
  "input",
78
99
  {
79
- id: i,
100
+ id: o,
80
101
  ref: s,
81
- type: x,
82
- tabIndex: y,
83
- autoFocus: k,
102
+ type: z,
103
+ tabIndex: b,
104
+ autoFocus: N,
84
105
  className: e.input,
85
- value: n,
106
+ value: a,
86
107
  placeholder: B,
87
- disabled: w,
88
- onChange: F,
108
+ disabled: k,
109
+ onChange: A,
89
110
  onKeyDown: K,
90
- spellCheck: N,
91
- min: z,
92
- max: A
111
+ spellCheck: y,
112
+ min: D,
113
+ max: F
93
114
  }
94
115
  ),
95
- u && /* @__PURE__ */ o(T, { name: u, className: e.placeholderIcon }),
96
- /* @__PURE__ */ o(
97
- Z,
116
+ r && /* @__PURE__ */ i(T, { name: r, className: e.placeholderIcon }),
117
+ /* @__PURE__ */ i(
118
+ ee,
98
119
  {
99
- decorator: V,
120
+ decorator: R,
100
121
  loading: C,
101
- type: x,
102
- hasValue: g,
122
+ type: z,
123
+ hasValue: h,
103
124
  onCleare: M
104
125
  }
105
126
  )
106
127
  ] });
107
128
  });
108
129
  export {
109
- ce as default
130
+ se as default
110
131
  };
@@ -2,10 +2,11 @@ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
2
  import i from "react";
3
3
  import { Flex as r } from "../Layout/Flex/Flex.js";
4
4
  import { Text as a } from "../Text/Text.js";
5
+ import "../ui.js";
5
6
  import c from "./Input.js";
6
7
  const m = /^\+?[0-9]*$/;
7
8
  function s() {
8
- const [d, h] = i.useState(""), [o, n] = i.useState(0), [t, p] = i.useState("");
9
+ const [d, o] = i.useState(""), [h, n] = i.useState(0), [t, p] = i.useState("");
9
10
  return /* @__PURE__ */ l(r, { gap: "large", vertical: !0, children: [
10
11
  /* @__PURE__ */ l(r, { gap: "normal", vertical: !0, children: [
11
12
  /* @__PURE__ */ e(a, { children: "Small" }),
@@ -50,7 +51,7 @@ function s() {
50
51
  size: "large",
51
52
  placeholderIcon: "Tick",
52
53
  value: d,
53
- onChange: h
54
+ onChange: o
54
55
  }
55
56
  ) })
56
57
  ] }),
@@ -77,7 +78,7 @@ function s() {
77
78
  type: "number",
78
79
  min: 1,
79
80
  max: 100,
80
- value: o,
81
+ value: h,
81
82
  onChange: (u) => n(Number(u))
82
83
  }
83
84
  ) })
@@ -98,7 +99,7 @@ function s() {
98
99
  ] })
99
100
  ] });
100
101
  }
101
- const x = i.memo(s);
102
+ const I = i.memo(s);
102
103
  export {
103
- x as default
104
+ I as default
104
105
  };
@@ -1,8 +1,9 @@
1
1
  import { default as React } from 'react';
2
+ import { ResponsiveValueType } from '../ui';
2
3
  import { InputSize } from './Input';
3
4
 
4
5
  export interface RichInputProps {
5
- size?: InputSize;
6
+ size?: ResponsiveValueType<InputSize>;
6
7
  value: string;
7
8
  onChange(value: string): void;
8
9
  onFocus?(): void;
@@ -1,63 +1,80 @@
1
- import { jsxs as B, jsx as n } from "react/jsx-runtime";
2
- import r from "react";
3
- import { Button as D } from "../Button/Button.js";
4
- import { clsx as F } from "../../utils/clsx.js";
5
- import { useDynamicRef as i } from "../../utils/hooks/useDynamicRef.js";
1
+ import { jsxs as w, jsx as l } from "react/jsx-runtime";
2
+ import i from "react";
3
+ import { Button as y } from "../Button/Button.js";
4
+ import { ui as B } from "../ui.js";
5
+ import { clsx as D } from "../../utils/clsx.js";
6
+ import { useDynamicRef as _ } from "../../utils/hooks/useDynamicRef.js";
6
7
  import "../../utils/hooks/useGlobalKeyboardEvent.js";
7
8
  import "../../utils/hooks/useKeyboardClose.js";
8
9
  import "../../index-2hJuj4UN.js";
9
- const L = "cfxui__RichInput__root__57e6e", T = "cfxui__RichInput__renderer__8b298", j = "cfxui__RichInput__small__cd3d1", E = "cfxui__RichInput__large__74aed", z = "cfxui__RichInput__clear__5538b", c = {
10
+ const L = "cfxui__RichInput__root__57e6e", T = "cfxui__RichInput__renderer__8b298", j = "cfxui__RichInput__clear__5538b", c = {
10
11
  root: L,
11
12
  renderer: T,
12
- small: j,
13
- large: E,
14
- clear: z
15
- }, P = r.forwardRef(function(f, _) {
13
+ clear: j,
14
+ "richinput-size-initial-large": "cfxui__RichInput__richinput-size-initial-large__cdc8c",
15
+ "richinput-size-initial-small": "cfxui__RichInput__richinput-size-initial-small__c3ec0",
16
+ "richinput-size-small-large": "cfxui__RichInput__richinput-size-small-large__1e06d",
17
+ "richinput-size-small-small": "cfxui__RichInput__richinput-size-small-small__f3518",
18
+ "richinput-size-small-medium-large": "cfxui__RichInput__richinput-size-small-medium-large__92eec",
19
+ "richinput-size-small-medium-small": "cfxui__RichInput__richinput-size-small-medium-small__8df57",
20
+ "richinput-size-medium-large": "cfxui__RichInput__richinput-size-medium-large__43539",
21
+ "richinput-size-medium-small": "cfxui__RichInput__richinput-size-medium-small__4d0ff",
22
+ "richinput-size-medium-large-large": "cfxui__RichInput__richinput-size-medium-large-large__df4e3",
23
+ "richinput-size-medium-large-small": "cfxui__RichInput__richinput-size-medium-large-small__af8ce",
24
+ "richinput-size-large-large": "cfxui__RichInput__richinput-size-large-large__1dc6d",
25
+ "richinput-size-large-small": "cfxui__RichInput__richinput-size-large-small__bd0d0",
26
+ "richinput-size-xlarge-large": "cfxui__RichInput__richinput-size-xlarge-large__ae9e6",
27
+ "richinput-size-xlarge-small": "cfxui__RichInput__richinput-size-xlarge-small__41461"
28
+ }, P = i.forwardRef(function(o, m) {
16
29
  const {
17
- size: d = "normal",
18
- value: l,
19
- onChange: m,
20
- onFocus: p,
21
- onBlur: h,
22
- onSelect: R,
23
- onKeyDown: C,
24
- className: g,
30
+ size: p = "normal",
31
+ value: n,
32
+ onChange: h,
33
+ onFocus: f,
34
+ onBlur: d,
35
+ onSelect: g,
36
+ onKeyDown: z,
37
+ className: R,
25
38
  rendered: x,
26
39
  placeholder: I,
27
- autoFocus: S,
40
+ autoFocus: C,
28
41
  withClearButton: b = !1
29
- } = f, a = r.useRef(null), t = r.useRef(null), s = i(m), u = i(R), k = r.useCallback((e) => {
30
- s.current(e.target.value);
31
- }, []), N = r.useCallback(() => {
42
+ } = o, u = i.useRef(null), r = i.useRef(null), a = _(h), s = _(g), S = i.useCallback((e) => {
43
+ a.current(e.target.value);
44
+ }, []), k = i.useCallback(() => {
32
45
  var e;
33
- s.current(""), (e = a.current) == null || e.focus();
34
- }, []), v = r.useCallback((e) => {
35
- if (!u.current || !(e.target instanceof HTMLInputElement))
46
+ a.current(""), (e = u.current) == null || e.focus();
47
+ }, []), N = i.useCallback((e) => {
48
+ if (!s.current || !(e.target instanceof HTMLInputElement))
36
49
  return;
37
- const o = e.target;
38
- u.current(o.selectionStart, o.selectionEnd, o.selectionDirection);
39
- }, []), w = r.useCallback((e) => {
40
- t.current && (t.current.scrollTop = e.target.scrollTop, t.current.scrollLeft = e.target.scrollLeft);
41
- }, []), y = F(c.root, g, c[d]);
42
- return /* @__PURE__ */ B("div", { ref: _, className: y, children: [
43
- /* @__PURE__ */ n(
50
+ const t = e.target;
51
+ s.current(t.selectionStart, t.selectionEnd, t.selectionDirection);
52
+ }, []), v = i.useCallback((e) => {
53
+ r.current && (r.current.scrollTop = e.target.scrollTop, r.current.scrollLeft = e.target.scrollLeft);
54
+ }, []), F = D(
55
+ c.root,
56
+ R,
57
+ B.getResponsiveFlatClassnames("richinput-size", p).map((e) => c[e])
58
+ );
59
+ return /* @__PURE__ */ w("div", { ref: m, className: F, children: [
60
+ /* @__PURE__ */ l(
44
61
  "input",
45
62
  {
46
- ref: a,
47
- autoFocus: S,
63
+ ref: u,
64
+ autoFocus: C,
48
65
  type: "text",
49
- value: l,
50
- onChange: k,
66
+ value: n,
67
+ onChange: S,
51
68
  placeholder: I,
52
- onBlur: h,
53
- onFocus: p,
54
- onScroll: w,
55
- onSelect: v,
56
- onKeyDown: C
69
+ onBlur: d,
70
+ onFocus: f,
71
+ onScroll: v,
72
+ onSelect: N,
73
+ onKeyDown: z
57
74
  }
58
75
  ),
59
- /* @__PURE__ */ n("div", { ref: t, className: c.renderer, children: x }),
60
- b && l && /* @__PURE__ */ n("div", { className: c.clear, children: /* @__PURE__ */ n(D, { icon: "Close", onClick: N }) })
76
+ /* @__PURE__ */ l("div", { ref: r, className: c.renderer, children: x }),
77
+ b && n && /* @__PURE__ */ l("div", { className: c.clear, children: /* @__PURE__ */ l(y, { icon: "Close", onClick: k }) })
61
78
  ] });
62
79
  });
63
80
  export {