@cfx-dev/ui-components 4.0.1 → 4.1.1
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/{Combination-BRUj3CHE.js → Combination-Cbiw1XRb.js} +1 -1
- package/dist/assets/css/DropdownSelect.css +1 -1
- package/dist/assets/css/Flex.css +1 -1
- package/dist/assets/css/Input.css +1 -1
- package/dist/assets/css/RichInput.css +1 -1
- package/dist/assets/css/Select.css +1 -1
- package/dist/assets/general/global.css +1 -1
- package/dist/components/Accordion/Accordion.js +18 -17
- package/dist/components/Accordion/AccordionShowcase.js +3 -2
- package/dist/components/Avatar/AvatarShowcase.js +3 -2
- package/dist/components/Badge/BadgeShowcase.js +5 -4
- package/dist/components/Button/ButtonShowcase.js +3 -2
- package/dist/components/Checkbox/Checkbox.js +6 -5
- package/dist/components/DropdownSelect/DropdownSelect.d.ts +4 -1
- package/dist/components/DropdownSelect/DropdownSelect.js +783 -755
- package/dist/components/DropdownSelect/DropdownSelectShowcase.js +11 -10
- package/dist/components/Flyout/Flyout.js +1 -1
- package/dist/components/Icon/Icon.d.ts +4 -3
- package/dist/components/Icon/Icon.js +27 -25
- package/dist/components/IconBig/IconBig.js +3 -2
- package/dist/components/InfoPanel/InfoPanelShowcase.js +11 -10
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.js +96 -75
- package/dist/components/Input/InputShowcase.js +6 -5
- package/dist/components/Input/RichInput.d.ts +2 -1
- package/dist/components/Input/RichInput.js +60 -43
- package/dist/components/Layout/Box/Box.d.ts +4 -11
- package/dist/components/Layout/Box/Box.js +58 -96
- package/dist/components/Layout/Flex/Flex.d.ts +7 -3
- package/dist/components/Layout/Flex/Flex.js +70 -62
- package/dist/components/Layout/Flex/Flex.types.d.ts +42 -0
- package/dist/components/Layout/Flex/Flex.types.js +7 -0
- package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -0
- package/dist/components/Link/LinkShowcase.js +1 -0
- package/dist/components/Logos/LogosShowcase.js +3 -2
- package/dist/components/Modal/Modal.js +1 -0
- package/dist/components/Overlay/Overlay.js +1 -1
- package/dist/components/Select/Select.d.ts +2 -3
- package/dist/components/Select/Select.js +1922 -7
- package/dist/components/Select/SelectShowcase.js +4 -3
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/Select/index.js +2 -3
- package/dist/components/Separator/Separator.d.ts +2 -2
- package/dist/components/Separator/Separator.js +35 -25
- package/dist/components/Skeleton/Skeleton.d.ts +7 -6
- package/dist/components/Skeleton/Skeleton.js +35 -22
- package/dist/components/Skeleton/SkeletonShowcase.js +14 -13
- package/dist/components/Slider/Slider.js +11 -9
- package/dist/components/Slider/SliderShowcase.js +10 -9
- package/dist/components/Spacer/Spacer.d.ts +1 -1
- package/dist/components/Switch/Switch.js +6 -5
- package/dist/components/Table/Table.js +3 -2
- package/dist/components/Table/TableShowcase.js +7 -6
- package/dist/components/Tabular/TabularShowcase.js +3 -2
- package/dist/components/Text/Text.d.ts +3 -1
- package/dist/components/Text/Text.js +61 -52
- package/dist/components/Text/Text.types.d.ts +4 -13
- package/dist/components/Text/Text.types.js +1 -4
- package/dist/components/Text/index.d.ts +3 -2
- package/dist/components/Text/index.js +9 -6
- package/dist/components/Title/TitleShowcase.js +4 -3
- package/dist/components/ui.d.ts +45 -12
- package/dist/components/ui.js +64 -55
- package/dist/index-BZPx6jYI.js +8 -0
- package/dist/index-ByaXH_ih.js +10 -0
- package/dist/index-Cf5Yu9oD.js +67 -0
- package/dist/index-DBus3GoO.js +1342 -0
- package/dist/index-rKs9bXHr.js +6 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +14 -14
- package/dist/{medium-JVtzoF2c.js → medium-BA3EQDZW.js} +2 -2
- package/dist/styles-scss/_ui.scss +10 -1
- package/dist/styles-scss/global.scss +39 -25
- package/dist/styles-scss/themes/theme_cfx.scss +2 -0
- package/dist/styles-scss/themes/theme_fivem.scss +2 -0
- package/dist/styles-scss/themes/theme_redm.scss +2 -0
- package/dist/styles-scss/themes/theme_wireframe.scss +2 -0
- package/dist/styles-scss/themes.scss +4 -4
- package/dist/styles-scss/tokens.scss +28 -15
- package/package.json +1 -1
- package/dist/Select-Ds-fm4CN.js +0 -3245
- package/dist/index-BCnz73Lm.js +0 -72
- package/dist/index-BW3WdIgK.js +0 -14
- package/dist/types/Offset.d.ts +0 -1
- package/dist/types/Offset.js +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import r from "react";
|
|
3
|
-
import { Flex as
|
|
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 [
|
|
22
|
-
return /* @__PURE__ */ l
|
|
23
|
-
/* @__PURE__ */ l
|
|
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:
|
|
30
|
-
value:
|
|
30
|
+
onChange: n,
|
|
31
|
+
value: i
|
|
31
32
|
}
|
|
32
33
|
) })
|
|
33
34
|
] }),
|
|
34
|
-
/* @__PURE__ */ l
|
|
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
|
|
50
|
+
const g = r.memo(d);
|
|
50
51
|
export {
|
|
51
|
-
|
|
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-
|
|
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,
|
|
3
|
+
import { TextColorProps, ResponsiveTextSize } from '../Text';
|
|
4
|
+
import { ResponsiveValueType } from '../ui';
|
|
4
5
|
|
|
5
|
-
export type IconSize =
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import { I as
|
|
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
|
|
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
|
|
12
|
-
import { getColor as
|
|
13
|
-
const
|
|
14
|
-
root:
|
|
15
|
-
},
|
|
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:
|
|
17
|
+
as: l = "div",
|
|
18
18
|
size: o = "normal",
|
|
19
|
-
opacity:
|
|
20
|
-
className:
|
|
21
|
-
name:
|
|
22
|
-
} =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
45
|
+
const v = a.memo(h);
|
|
45
46
|
export {
|
|
46
|
-
|
|
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
|
|
2
|
-
import
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
35
|
+
function ee(x) {
|
|
21
36
|
const {
|
|
22
37
|
decorator: t,
|
|
23
38
|
loading: s,
|
|
24
|
-
type:
|
|
25
|
-
hasValue:
|
|
26
|
-
onCleare:
|
|
27
|
-
} =
|
|
28
|
-
return s ? /* @__PURE__ */
|
|
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
|
|
45
|
+
const se = n.forwardRef(function(t, s) {
|
|
31
46
|
const {
|
|
32
|
-
id:
|
|
33
|
-
fullWidth:
|
|
34
|
-
value:
|
|
35
|
-
onChange:
|
|
36
|
-
onSubmit:
|
|
37
|
-
onKeyDown:
|
|
38
|
-
pattern:
|
|
39
|
-
tabIndex:
|
|
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:
|
|
42
|
-
autofocus:
|
|
43
|
-
disabled:
|
|
56
|
+
spellCheck: y = !0,
|
|
57
|
+
autofocus: N = !1,
|
|
58
|
+
disabled: k = !1,
|
|
44
59
|
className: v = "",
|
|
45
|
-
placeholder:
|
|
46
|
-
placeholderIcon:
|
|
47
|
-
type:
|
|
48
|
-
size:
|
|
49
|
-
theme:
|
|
50
|
-
decorator:
|
|
51
|
-
backdropBlur:
|
|
52
|
-
} = t, [
|
|
53
|
-
|
|
54
|
-
}, [
|
|
55
|
-
(
|
|
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
|
-
} =
|
|
59
|
-
if (
|
|
60
|
-
|
|
73
|
+
} = l.target;
|
|
74
|
+
if (f) {
|
|
75
|
+
f.test(I) && u(I);
|
|
61
76
|
return;
|
|
62
77
|
}
|
|
63
|
-
|
|
78
|
+
u(I);
|
|
64
79
|
},
|
|
65
|
-
[
|
|
66
|
-
), K =
|
|
67
|
-
|
|
68
|
-
}, [
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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__ */
|
|
97
|
+
/* @__PURE__ */ i(
|
|
77
98
|
"input",
|
|
78
99
|
{
|
|
79
|
-
id:
|
|
100
|
+
id: o,
|
|
80
101
|
ref: s,
|
|
81
|
-
type:
|
|
82
|
-
tabIndex:
|
|
83
|
-
autoFocus:
|
|
102
|
+
type: z,
|
|
103
|
+
tabIndex: b,
|
|
104
|
+
autoFocus: N,
|
|
84
105
|
className: e.input,
|
|
85
|
-
value:
|
|
106
|
+
value: a,
|
|
86
107
|
placeholder: B,
|
|
87
|
-
disabled:
|
|
88
|
-
onChange:
|
|
108
|
+
disabled: k,
|
|
109
|
+
onChange: A,
|
|
89
110
|
onKeyDown: K,
|
|
90
|
-
spellCheck:
|
|
91
|
-
min:
|
|
92
|
-
max:
|
|
111
|
+
spellCheck: y,
|
|
112
|
+
min: D,
|
|
113
|
+
max: F
|
|
93
114
|
}
|
|
94
115
|
),
|
|
95
|
-
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
|
|
116
|
+
r && /* @__PURE__ */ i(T, { name: r, className: e.placeholderIcon }),
|
|
117
|
+
/* @__PURE__ */ i(
|
|
118
|
+
ee,
|
|
98
119
|
{
|
|
99
|
-
decorator:
|
|
120
|
+
decorator: R,
|
|
100
121
|
loading: C,
|
|
101
|
-
type:
|
|
102
|
-
hasValue:
|
|
122
|
+
type: z,
|
|
123
|
+
hasValue: h,
|
|
103
124
|
onCleare: M
|
|
104
125
|
}
|
|
105
126
|
)
|
|
106
127
|
] });
|
|
107
128
|
});
|
|
108
129
|
export {
|
|
109
|
-
|
|
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,
|
|
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:
|
|
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:
|
|
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
|
|
102
|
+
const I = i.memo(s);
|
|
102
103
|
export {
|
|
103
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import { Button as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 = "
|
|
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
|
-
|
|
13
|
-
large:
|
|
14
|
-
|
|
15
|
-
|
|
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:
|
|
18
|
-
value:
|
|
19
|
-
onChange:
|
|
20
|
-
onFocus:
|
|
21
|
-
onBlur:
|
|
22
|
-
onSelect:
|
|
23
|
-
onKeyDown:
|
|
24
|
-
className:
|
|
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:
|
|
40
|
+
autoFocus: C,
|
|
28
41
|
withClearButton: b = !1
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
}, []),
|
|
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
|
-
|
|
34
|
-
}, []),
|
|
35
|
-
if (!
|
|
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
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
40
|
-
|
|
41
|
-
}, []),
|
|
42
|
-
|
|
43
|
-
|
|
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:
|
|
47
|
-
autoFocus:
|
|
63
|
+
ref: u,
|
|
64
|
+
autoFocus: C,
|
|
48
65
|
type: "text",
|
|
49
|
-
value:
|
|
50
|
-
onChange:
|
|
66
|
+
value: n,
|
|
67
|
+
onChange: S,
|
|
51
68
|
placeholder: I,
|
|
52
|
-
onBlur:
|
|
53
|
-
onFocus:
|
|
54
|
-
onScroll:
|
|
55
|
-
onSelect:
|
|
56
|
-
onKeyDown:
|
|
69
|
+
onBlur: d,
|
|
70
|
+
onFocus: f,
|
|
71
|
+
onScroll: v,
|
|
72
|
+
onSelect: N,
|
|
73
|
+
onKeyDown: z
|
|
57
74
|
}
|
|
58
75
|
),
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
b &&
|
|
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 {
|