@quen-ui/components 1.1.0 → 1.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.
- package/dist/Banner/Banner.cjs.js +96 -0
- package/dist/Banner/Banner.d.ts +4 -0
- package/dist/Banner/Banner.es.js +96 -0
- package/dist/Banner/index.d.ts +2 -0
- package/dist/Banner/styles.cjs.js +113 -0
- package/dist/Banner/styles.d.ts +12 -0
- package/dist/Banner/styles.es.js +113 -0
- package/dist/Banner/types.d.ts +40 -0
- package/dist/Dropdown/Dropdown.cjs.js +47 -43
- package/dist/Dropdown/Dropdown.d.ts +1 -1
- package/dist/Dropdown/Dropdown.es.js +48 -44
- package/dist/Dropdown/DropdownItem.cjs.js +10 -13
- package/dist/Dropdown/DropdownItem.es.js +10 -13
- package/dist/Dropdown/DropdownList.cjs.js +0 -2
- package/dist/Dropdown/DropdownList.es.js +0 -2
- package/dist/InputBase/InputBase.cjs.js +55 -12
- package/dist/InputBase/InputBase.d.ts +1 -1
- package/dist/InputBase/InputBase.es.js +57 -14
- package/dist/InputBase/styles.cjs.js +44 -4
- package/dist/InputBase/styles.d.ts +7 -1
- package/dist/InputBase/styles.es.js +45 -5
- package/dist/InputBase/types.d.ts +5 -1
- package/dist/InputDate/styles.d.ts +1 -1
- package/dist/InputNumber/styles.d.ts +1 -1
- package/dist/Select/Select.cjs.js +2 -5
- package/dist/Select/Select.es.js +2 -5
- package/dist/Select/helpers.d.ts +8 -0
- package/dist/Select/styles.d.ts +1 -1
- package/dist/Select/useSelect.d.ts +8 -0
- package/dist/Slider/Slider.cjs.js +122 -224
- package/dist/Slider/Slider.d.ts +1 -1
- package/dist/Slider/Slider.es.js +125 -227
- package/dist/Slider/styles.cjs.js +49 -32
- package/dist/Slider/styles.d.ts +1 -1
- package/dist/Slider/styles.es.js +49 -32
- package/dist/Slider/useSlider.cjs.js +194 -0
- package/dist/Slider/useSlider.d.ts +11 -0
- package/dist/Slider/useSlider.es.js +194 -0
- package/dist/Stepper/Step.cjs.js +114 -0
- package/dist/Stepper/Step.d.ts +2 -0
- package/dist/Stepper/Step.es.js +114 -0
- package/dist/Stepper/StepContent.cjs.js +10 -0
- package/dist/Stepper/StepContent.d.ts +4 -0
- package/dist/Stepper/StepContent.es.js +10 -0
- package/dist/Stepper/StepLabel.cjs.js +28 -0
- package/dist/Stepper/StepLabel.d.ts +2 -0
- package/dist/Stepper/StepLabel.es.js +28 -0
- package/dist/Stepper/Stepper.cjs.js +54 -0
- package/dist/Stepper/Stepper.d.ts +2 -0
- package/dist/Stepper/Stepper.es.js +54 -0
- package/dist/Stepper/StepperContext.cjs.js +13 -0
- package/dist/Stepper/StepperContext.d.ts +3 -0
- package/dist/Stepper/StepperContext.es.js +13 -0
- package/dist/Stepper/index.cjs.js +10 -0
- package/dist/Stepper/index.d.ts +12 -0
- package/dist/Stepper/index.es.js +11 -0
- package/dist/Stepper/styles.cjs.js +149 -0
- package/dist/Stepper/styles.d.ts +44 -0
- package/dist/Stepper/styles.es.js +149 -0
- package/dist/Stepper/types.d.ts +70 -0
- package/dist/TextField/TextField.cjs.js +4 -0
- package/dist/TextField/TextField.d.ts +1 -1
- package/dist/TextField/TextField.es.js +4 -0
- package/dist/TextField/styles.d.ts +1 -1
- package/dist/Textarea/styles.d.ts +1 -1
- package/dist/Tooltip/Tooltip.cjs.js +3 -1
- package/dist/Tooltip/Tooltip.es.js +4 -2
- package/dist/index.cjs.js +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +4 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useEffect, useLayoutEffect } from "react";
|
|
2
|
+
import { useState, useRef, useEffect, useCallback, useLayoutEffect } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { useTransitionState } from "react-transition-state";
|
|
5
5
|
import { useOnClickOutside } from "@quen-ui/hooks";
|
|
@@ -13,68 +13,72 @@ const Dropdown = ({
|
|
|
13
13
|
width,
|
|
14
14
|
anchorRef,
|
|
15
15
|
onClickClose,
|
|
16
|
+
onClickOutside,
|
|
17
|
+
notCloseOutside,
|
|
16
18
|
...props
|
|
17
19
|
}) => {
|
|
18
|
-
const [
|
|
20
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
21
|
+
const isControlled = typeof open !== "undefined";
|
|
22
|
+
const openState = isControlled ? open : isOpen;
|
|
19
23
|
const dropdownRef = useRef(null);
|
|
20
24
|
const [containerDropdown, setContainerDropdown] = useState(null);
|
|
25
|
+
const [anchorRect, setAnchorRect] = useState(DEFAULT_RECT_ELEMENT);
|
|
26
|
+
const lastInternalMousedownRef = useRef(0);
|
|
21
27
|
const [state, toggle] = useTransitionState({
|
|
22
28
|
timeout: 500,
|
|
23
29
|
unmountOnExit: true,
|
|
24
|
-
initialEntered:
|
|
30
|
+
initialEntered: openState
|
|
25
31
|
});
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (isControlled) toggle(open);
|
|
34
|
+
}, [open, isControlled, toggle]);
|
|
35
|
+
const calculateAnchorRect = useCallback(() => {
|
|
36
|
+
if (anchorRef.current) {
|
|
37
|
+
setAnchorRect(calculateRectElement(anchorRef.current));
|
|
38
|
+
}
|
|
39
|
+
}, [anchorRef]);
|
|
40
|
+
const handleInternalMouseDown = useCallback(
|
|
41
|
+
(e) => {
|
|
42
|
+
lastInternalMousedownRef.current = e.timeStamp || Date.now();
|
|
43
|
+
},
|
|
44
|
+
[]
|
|
45
|
+
);
|
|
26
46
|
useOnClickOutside(
|
|
27
|
-
anchorRef,
|
|
28
|
-
() => {
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
47
|
+
[anchorRef, dropdownRef],
|
|
48
|
+
(e) => {
|
|
49
|
+
if (e.timeStamp - lastInternalMousedownRef.current < 2100) return;
|
|
50
|
+
onClickOutside?.();
|
|
51
|
+
onClickClose?.();
|
|
52
|
+
if (!isControlled) setIsOpen(false);
|
|
33
53
|
},
|
|
34
|
-
{
|
|
35
|
-
excludeRef: dropdownRef
|
|
36
|
-
}
|
|
54
|
+
{ isActive: !notCloseOutside && openState }
|
|
37
55
|
);
|
|
38
|
-
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (isControlled || !anchorRef.current) return;
|
|
58
|
+
const el = anchorRef.current;
|
|
59
|
+
const handleClick = () => {
|
|
60
|
+
toggle();
|
|
61
|
+
setIsOpen((prev) => !prev);
|
|
62
|
+
};
|
|
63
|
+
el.addEventListener("click", handleClick);
|
|
64
|
+
return () => el.removeEventListener("click", handleClick);
|
|
65
|
+
}, [anchorRef, toggle, isControlled]);
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
calculateAnchorRect();
|
|
68
|
+
}, [state, calculateAnchorRect]);
|
|
46
69
|
useEffect(() => {
|
|
47
70
|
window.addEventListener("resize", calculateAnchorRect);
|
|
48
71
|
window.addEventListener("scroll", calculateAnchorRect, true);
|
|
49
72
|
return () => {
|
|
50
73
|
window.removeEventListener("resize", calculateAnchorRect);
|
|
51
|
-
window.
|
|
52
|
-
};
|
|
53
|
-
}, [anchorRect]);
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (typeof open === "undefined") {
|
|
56
|
-
anchorRef.current?.addEventListener("click", handleClickAnchorRef);
|
|
57
|
-
}
|
|
58
|
-
return () => {
|
|
59
|
-
anchorRef.current?.removeEventListener("click", handleClickAnchorRef);
|
|
74
|
+
window.removeEventListener("scroll", calculateAnchorRect, true);
|
|
60
75
|
};
|
|
61
|
-
}, [
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
if (typeof open !== "undefined") {
|
|
64
|
-
toggle(open);
|
|
65
|
-
}
|
|
66
|
-
}, [open]);
|
|
67
|
-
useLayoutEffect(() => {
|
|
68
|
-
calculateAnchorRect();
|
|
69
|
-
}, [state]);
|
|
76
|
+
}, [calculateAnchorRect]);
|
|
70
77
|
useEffect(() => {
|
|
71
|
-
|
|
72
|
-
setContainerDropdown(container);
|
|
78
|
+
if (typeof document !== "undefined") setContainerDropdown(document.body);
|
|
73
79
|
}, []);
|
|
74
|
-
if (disabled)
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ jsx(DropdownWrapper, { children: state.isEnter && containerDropdown && createPortal(
|
|
80
|
+
if (disabled) return null;
|
|
81
|
+
return /* @__PURE__ */ jsx(DropdownWrapper, { onMouseDown: handleInternalMouseDown, children: state.isEnter && containerDropdown && createPortal(
|
|
78
82
|
/* @__PURE__ */ jsx(
|
|
79
83
|
DropdownPortal,
|
|
80
84
|
{
|
|
@@ -10,22 +10,19 @@ const DropdownItem = ({
|
|
|
10
10
|
getItemLeftContent,
|
|
11
11
|
size
|
|
12
12
|
}) => {
|
|
13
|
+
const isDisabled = getItemDisabled?.(item);
|
|
13
14
|
const handleClick = (event) => {
|
|
14
|
-
|
|
15
|
+
if (isDisabled) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
15
20
|
getItemOnClick?.(item)?.(item, event);
|
|
16
21
|
onItemClick?.(item, event);
|
|
17
22
|
};
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
disabled: getItemDisabled?.(item),
|
|
23
|
-
onClick: handleClick,
|
|
24
|
-
children: [
|
|
25
|
-
getItemLeftContent?.(item),
|
|
26
|
-
getItemLabel(item)
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
);
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(styles.DropdownItemStyled, { size, disabled: isDisabled, onClick: handleClick, children: [
|
|
24
|
+
getItemLeftContent?.(item),
|
|
25
|
+
getItemLabel(item)
|
|
26
|
+
] });
|
|
30
27
|
};
|
|
31
28
|
module.exports = DropdownItem;
|
|
@@ -9,23 +9,20 @@ const DropdownItem = ({
|
|
|
9
9
|
getItemLeftContent,
|
|
10
10
|
size
|
|
11
11
|
}) => {
|
|
12
|
+
const isDisabled = getItemDisabled?.(item);
|
|
12
13
|
const handleClick = (event) => {
|
|
13
|
-
|
|
14
|
+
if (isDisabled) {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
14
19
|
getItemOnClick?.(item)?.(item, event);
|
|
15
20
|
onItemClick?.(item, event);
|
|
16
21
|
};
|
|
17
|
-
return /* @__PURE__ */ jsxs(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
disabled: getItemDisabled?.(item),
|
|
22
|
-
onClick: handleClick,
|
|
23
|
-
children: [
|
|
24
|
-
getItemLeftContent?.(item),
|
|
25
|
-
getItemLabel(item)
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
);
|
|
22
|
+
return /* @__PURE__ */ jsxs(DropdownItemStyled, { size, disabled: isDisabled, onClick: handleClick, children: [
|
|
23
|
+
getItemLeftContent?.(item),
|
|
24
|
+
getItemLabel(item)
|
|
25
|
+
] });
|
|
29
26
|
};
|
|
30
27
|
export {
|
|
31
28
|
DropdownItem as default
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const hooks = require("@quen-ui/hooks");
|
|
5
4
|
const Divider = require("../Divider/Divider.cjs.js");
|
|
6
5
|
const styles = require("./styles.cjs.js");
|
|
7
6
|
const helpers = require("./helpers.cjs.js");
|
|
@@ -23,7 +22,6 @@ const DropdownList = (props, ref) => {
|
|
|
23
22
|
getItemOnClick,
|
|
24
23
|
...otherProps
|
|
25
24
|
} = helpers.withDefaultGetters(props);
|
|
26
|
-
hooks.useOnClickOutside(ref, otherProps.onClickOutside);
|
|
27
25
|
const groups = React.useMemo(() => {
|
|
28
26
|
const _groups = items.reduce(
|
|
29
27
|
(result, x) => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { forwardRef, useMemo } from "react";
|
|
3
|
-
import { useOnClickOutside } from "@quen-ui/hooks";
|
|
4
3
|
import Divider from "../Divider/Divider.es.js";
|
|
5
4
|
import { DropdownListWrapper, DropdownItemsWrapper } from "./styles.es.js";
|
|
6
5
|
import { withDefaultGetters } from "./helpers.es.js";
|
|
@@ -22,7 +21,6 @@ const DropdownList$1 = (props, ref) => {
|
|
|
22
21
|
getItemOnClick,
|
|
23
22
|
...otherProps
|
|
24
23
|
} = withDefaultGetters(props);
|
|
25
|
-
useOnClickOutside(ref, otherProps.onClickOutside);
|
|
26
24
|
const groups = useMemo(() => {
|
|
27
25
|
const _groups = items.reduce(
|
|
28
26
|
(result, x) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
3
4
|
const styles = require("./styles.cjs.js");
|
|
4
5
|
const Text = require("../typography/Text/Text.cjs.js");
|
|
5
6
|
const InputBase = ({
|
|
@@ -14,19 +15,61 @@ const InputBase = ({
|
|
|
14
15
|
children,
|
|
15
16
|
leftContent,
|
|
16
17
|
rightContent,
|
|
18
|
+
leftContentVariant = "icon",
|
|
19
|
+
rightContentVariant = "icon",
|
|
17
20
|
...props
|
|
18
21
|
}) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
const leftContentRender = React.useMemo(() => {
|
|
23
|
+
if (leftContent) {
|
|
24
|
+
if (leftContentVariant === "text") {
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles.InputContentText, { size, children: leftContent });
|
|
26
|
+
} else if (leftContentVariant === "addon") {
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles.InputBaseAddonWrapper, { children: leftContent });
|
|
28
|
+
}
|
|
29
|
+
return leftContent;
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}, [leftContent, leftContentVariant, size]);
|
|
33
|
+
const rightContentRender = React.useMemo(() => {
|
|
34
|
+
if (rightContent) {
|
|
35
|
+
if (rightContentVariant === "text") {
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles.InputContentText, { size, children: rightContent });
|
|
37
|
+
} else if (rightContentVariant === "addon") {
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles.InputBaseRightAddonWrapper, { children: rightContent });
|
|
39
|
+
}
|
|
40
|
+
return rightContent;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}, [rightContent, rightContentVariant, size]);
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45
|
+
styles.InputBaseWrapper,
|
|
46
|
+
{
|
|
47
|
+
className,
|
|
48
|
+
style,
|
|
49
|
+
...props,
|
|
50
|
+
size,
|
|
51
|
+
children: [
|
|
52
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size, as: "label", htmlFor: id, children: [
|
|
53
|
+
label,
|
|
54
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "quen-ui__input-base--required", children: "*" })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
57
|
+
styles.InputBaseContainer,
|
|
58
|
+
{
|
|
59
|
+
size,
|
|
60
|
+
error,
|
|
61
|
+
disabled,
|
|
62
|
+
leftContent: !!leftContent && leftContentVariant !== "icon",
|
|
63
|
+
children: [
|
|
64
|
+
leftContentRender,
|
|
65
|
+
children,
|
|
66
|
+
rightContentRender
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
typeof error === "string" && /* @__PURE__ */ jsxRuntime.jsx(Text, { className: "quen-ui__input-base--error-message", size: "xs", children: error })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
31
74
|
};
|
|
32
75
|
module.exports = InputBase;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { IInputBaseProps } from './types';
|
|
3
|
-
declare const InputBase: ({ label, className, size, id, required, style, error, disabled, children, leftContent, rightContent, ...props }: PropsWithChildren<IInputBaseProps>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const InputBase: ({ label, className, size, id, required, style, error, disabled, children, leftContent, rightContent, leftContentVariant, rightContentVariant, ...props }: PropsWithChildren<IInputBaseProps>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default InputBase;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { InputContentText, InputBaseAddonWrapper, InputBaseRightAddonWrapper, InputBaseWrapper, InputBaseContainer } from "./styles.es.js";
|
|
3
4
|
import Text from "../typography/Text/Text.es.js";
|
|
4
5
|
const InputBase = ({
|
|
5
6
|
label,
|
|
@@ -13,20 +14,62 @@ const InputBase = ({
|
|
|
13
14
|
children,
|
|
14
15
|
leftContent,
|
|
15
16
|
rightContent,
|
|
17
|
+
leftContentVariant = "icon",
|
|
18
|
+
rightContentVariant = "icon",
|
|
16
19
|
...props
|
|
17
20
|
}) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
const leftContentRender = useMemo(() => {
|
|
22
|
+
if (leftContent) {
|
|
23
|
+
if (leftContentVariant === "text") {
|
|
24
|
+
return /* @__PURE__ */ jsx(InputContentText, { size, children: leftContent });
|
|
25
|
+
} else if (leftContentVariant === "addon") {
|
|
26
|
+
return /* @__PURE__ */ jsx(InputBaseAddonWrapper, { children: leftContent });
|
|
27
|
+
}
|
|
28
|
+
return leftContent;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}, [leftContent, leftContentVariant, size]);
|
|
32
|
+
const rightContentRender = useMemo(() => {
|
|
33
|
+
if (rightContent) {
|
|
34
|
+
if (rightContentVariant === "text") {
|
|
35
|
+
return /* @__PURE__ */ jsx(InputContentText, { size, children: rightContent });
|
|
36
|
+
} else if (rightContentVariant === "addon") {
|
|
37
|
+
return /* @__PURE__ */ jsx(InputBaseRightAddonWrapper, { children: rightContent });
|
|
38
|
+
}
|
|
39
|
+
return rightContent;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}, [rightContent, rightContentVariant, size]);
|
|
43
|
+
return /* @__PURE__ */ jsxs(
|
|
44
|
+
InputBaseWrapper,
|
|
45
|
+
{
|
|
46
|
+
className,
|
|
47
|
+
style,
|
|
48
|
+
...props,
|
|
49
|
+
size,
|
|
50
|
+
children: [
|
|
51
|
+
label && /* @__PURE__ */ jsxs(Text, { size, as: "label", htmlFor: id, children: [
|
|
52
|
+
label,
|
|
53
|
+
required && /* @__PURE__ */ jsx("span", { className: "quen-ui__input-base--required", children: "*" })
|
|
54
|
+
] }),
|
|
55
|
+
/* @__PURE__ */ jsxs(
|
|
56
|
+
InputBaseContainer,
|
|
57
|
+
{
|
|
58
|
+
size,
|
|
59
|
+
error,
|
|
60
|
+
disabled,
|
|
61
|
+
leftContent: !!leftContent && leftContentVariant !== "icon",
|
|
62
|
+
children: [
|
|
63
|
+
leftContentRender,
|
|
64
|
+
children,
|
|
65
|
+
rightContentRender
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
typeof error === "string" && /* @__PURE__ */ jsx(Text, { className: "quen-ui__input-base--error-message", size: "xs", children: error })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
30
73
|
};
|
|
31
74
|
export {
|
|
32
75
|
InputBase as default
|
|
@@ -2,17 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const styled = require("styled-components");
|
|
4
4
|
const polished = require("polished");
|
|
5
|
+
const Text = require("../typography/Text/Text.cjs.js");
|
|
6
|
+
const InputBaseAddonWrapper = styled.div`
|
|
7
|
+
margin-inline-start: -0.0625rem;
|
|
8
|
+
`;
|
|
9
|
+
const InputBaseRightAddonWrapper = styled.div`
|
|
10
|
+
margin-inline-end: -0.75rem;
|
|
11
|
+
`;
|
|
5
12
|
const InputBaseContainer = styled.div.attrs({
|
|
6
13
|
className: "quen-ui__input-base__container"
|
|
7
14
|
}).withConfig({
|
|
8
|
-
shouldForwardProp: (prop) => !["size", "error", "disabled"].includes(prop)
|
|
15
|
+
shouldForwardProp: (prop) => !["size", "error", "disabled", "leftContent"].includes(prop)
|
|
9
16
|
})`
|
|
10
17
|
height: ${({ size, theme }) => theme.control.height[size]};
|
|
11
18
|
border-radius: ${({ theme }) => theme.control.radius};
|
|
12
19
|
border: ${({ theme }) => `${theme.control.borderWidth} solid ${theme.colors.grayViolet[9]}`};
|
|
13
20
|
display: flex;
|
|
14
21
|
align-items: center;
|
|
15
|
-
|
|
22
|
+
${({ size, leftContent }) => !leftContent && styled.css`
|
|
23
|
+
padding-left: ${size === "xs" || size === "s" ? "0.385rem" : "0.75rem"};
|
|
24
|
+
`};
|
|
16
25
|
gap: 0.5rem;
|
|
17
26
|
|
|
18
27
|
svg {
|
|
@@ -21,9 +30,18 @@ const InputBaseContainer = styled.div.attrs({
|
|
|
21
30
|
|
|
22
31
|
&:hover {
|
|
23
32
|
${({ theme }) => styled.css`
|
|
33
|
+
border-bottom: ${theme.control.borderWidth} solid
|
|
34
|
+
${theme.colors[theme.primaryColor][9]};
|
|
35
|
+
`};
|
|
36
|
+
|
|
37
|
+
${InputBaseAddonWrapper} {
|
|
38
|
+
${({ theme, size }) => styled.css`
|
|
39
|
+
height: ${polished.math(`${theme.control.height[size]} - 0.0625rem`)};
|
|
40
|
+
border-bottom-left-radius: ${theme.control.radius};
|
|
24
41
|
border-bottom: ${theme.control.borderWidth} solid
|
|
25
42
|
${theme.colors[theme.primaryColor][9]};
|
|
26
|
-
`}
|
|
43
|
+
`};
|
|
44
|
+
}
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
${({ error, theme }) => error && styled.css`
|
|
@@ -37,7 +55,18 @@ const InputBaseContainer = styled.div.attrs({
|
|
|
37
55
|
${theme.components.Input.disabledColor}!important;
|
|
38
56
|
`};
|
|
39
57
|
`;
|
|
40
|
-
const
|
|
58
|
+
const InputContentText = styled(Text)`
|
|
59
|
+
background: ${({ theme }) => theme.components.Input.borderColor};
|
|
60
|
+
border-right: 1px solid ${({ theme }) => theme.components.Input.disabledColor};
|
|
61
|
+
height: ${({ theme, size = "m" }) => polished.math(`${theme.control.height[size]} - 0.0625rem`)};
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
padding-left: ${({ size }) => size === "xs" || size === "s" ? "0.385rem" : "0.75rem"};
|
|
65
|
+
padding-right: ${({ size }) => size === "xs" || size === "s" ? "0.385rem" : "0.75rem"};
|
|
66
|
+
`;
|
|
67
|
+
const InputBaseWrapper = styled.div.withConfig({
|
|
68
|
+
shouldForwardProp: (prop) => !["size"].includes(prop)
|
|
69
|
+
})`
|
|
41
70
|
display: flex;
|
|
42
71
|
flex-direction: column;
|
|
43
72
|
gap: 0.5rem;
|
|
@@ -52,10 +81,21 @@ const InputBaseWrapper = styled.div`
|
|
|
52
81
|
}
|
|
53
82
|
|
|
54
83
|
&.quen-ui__input-base--focus-input {
|
|
84
|
+
${InputContentText} {
|
|
85
|
+
height: ${({ theme, size = "m" }) => polished.math(`${theme.control.height[size]} - 0.125rem`)};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
${InputBaseAddonWrapper} {
|
|
89
|
+
height: ${({ theme, size = "m" }) => polished.math(`${theme.control.height[size]} - 0.125rem`)};
|
|
90
|
+
}
|
|
91
|
+
|
|
55
92
|
${InputBaseContainer} {
|
|
56
93
|
border-bottom: ${({ theme }) => `${polished.math(`${theme.control.borderWidth} * 2`)} solid ${theme.colors[theme.primaryColor][9]}`};
|
|
57
94
|
}
|
|
58
95
|
}
|
|
59
96
|
`;
|
|
97
|
+
exports.InputBaseAddonWrapper = InputBaseAddonWrapper;
|
|
60
98
|
exports.InputBaseContainer = InputBaseContainer;
|
|
99
|
+
exports.InputBaseRightAddonWrapper = InputBaseRightAddonWrapper;
|
|
61
100
|
exports.InputBaseWrapper = InputBaseWrapper;
|
|
101
|
+
exports.InputContentText = InputContentText;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { TQuenSize } from '../types/size';
|
|
2
|
+
export declare const InputBaseAddonWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const InputBaseRightAddonWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
4
|
export declare const InputBaseContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, never>, {
|
|
3
5
|
size: TQuenSize;
|
|
4
6
|
error?: string | boolean;
|
|
5
7
|
disabled?: boolean;
|
|
8
|
+
leftContent?: boolean;
|
|
9
|
+
}>> & string;
|
|
10
|
+
export declare const InputContentText: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('..').ITextProps, never>> & string & Omit<import('react').FC<import('..').ITextProps>, keyof import('react').Component<any, {}, any>>;
|
|
11
|
+
export declare const InputBaseWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
12
|
+
size: TQuenSize;
|
|
6
13
|
}>> & string;
|
|
7
|
-
export declare const InputBaseWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { math } from "polished";
|
|
3
|
+
import Text from "../typography/Text/Text.es.js";
|
|
4
|
+
const InputBaseAddonWrapper = styled.div`
|
|
5
|
+
margin-inline-start: -0.0625rem;
|
|
6
|
+
`;
|
|
7
|
+
const InputBaseRightAddonWrapper = styled.div`
|
|
8
|
+
margin-inline-end: -0.75rem;
|
|
9
|
+
`;
|
|
3
10
|
const InputBaseContainer = styled.div.attrs({
|
|
4
11
|
className: "quen-ui__input-base__container"
|
|
5
12
|
}).withConfig({
|
|
6
|
-
shouldForwardProp: (prop) => !["size", "error", "disabled"].includes(prop)
|
|
13
|
+
shouldForwardProp: (prop) => !["size", "error", "disabled", "leftContent"].includes(prop)
|
|
7
14
|
})`
|
|
8
15
|
height: ${({ size, theme }) => theme.control.height[size]};
|
|
9
16
|
border-radius: ${({ theme }) => theme.control.radius};
|
|
10
17
|
border: ${({ theme }) => `${theme.control.borderWidth} solid ${theme.colors.grayViolet[9]}`};
|
|
11
18
|
display: flex;
|
|
12
19
|
align-items: center;
|
|
13
|
-
|
|
20
|
+
${({ size, leftContent }) => !leftContent && css`
|
|
21
|
+
padding-left: ${size === "xs" || size === "s" ? "0.385rem" : "0.75rem"};
|
|
22
|
+
`};
|
|
14
23
|
gap: 0.5rem;
|
|
15
24
|
|
|
16
25
|
svg {
|
|
@@ -19,9 +28,18 @@ const InputBaseContainer = styled.div.attrs({
|
|
|
19
28
|
|
|
20
29
|
&:hover {
|
|
21
30
|
${({ theme }) => css`
|
|
31
|
+
border-bottom: ${theme.control.borderWidth} solid
|
|
32
|
+
${theme.colors[theme.primaryColor][9]};
|
|
33
|
+
`};
|
|
34
|
+
|
|
35
|
+
${InputBaseAddonWrapper} {
|
|
36
|
+
${({ theme, size }) => css`
|
|
37
|
+
height: ${math(`${theme.control.height[size]} - 0.0625rem`)};
|
|
38
|
+
border-bottom-left-radius: ${theme.control.radius};
|
|
22
39
|
border-bottom: ${theme.control.borderWidth} solid
|
|
23
40
|
${theme.colors[theme.primaryColor][9]};
|
|
24
|
-
`}
|
|
41
|
+
`};
|
|
42
|
+
}
|
|
25
43
|
}
|
|
26
44
|
|
|
27
45
|
${({ error, theme }) => error && css`
|
|
@@ -35,7 +53,18 @@ const InputBaseContainer = styled.div.attrs({
|
|
|
35
53
|
${theme.components.Input.disabledColor}!important;
|
|
36
54
|
`};
|
|
37
55
|
`;
|
|
38
|
-
const
|
|
56
|
+
const InputContentText = styled(Text)`
|
|
57
|
+
background: ${({ theme }) => theme.components.Input.borderColor};
|
|
58
|
+
border-right: 1px solid ${({ theme }) => theme.components.Input.disabledColor};
|
|
59
|
+
height: ${({ theme, size = "m" }) => math(`${theme.control.height[size]} - 0.0625rem`)};
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
padding-left: ${({ size }) => size === "xs" || size === "s" ? "0.385rem" : "0.75rem"};
|
|
63
|
+
padding-right: ${({ size }) => size === "xs" || size === "s" ? "0.385rem" : "0.75rem"};
|
|
64
|
+
`;
|
|
65
|
+
const InputBaseWrapper = styled.div.withConfig({
|
|
66
|
+
shouldForwardProp: (prop) => !["size"].includes(prop)
|
|
67
|
+
})`
|
|
39
68
|
display: flex;
|
|
40
69
|
flex-direction: column;
|
|
41
70
|
gap: 0.5rem;
|
|
@@ -50,12 +79,23 @@ const InputBaseWrapper = styled.div`
|
|
|
50
79
|
}
|
|
51
80
|
|
|
52
81
|
&.quen-ui__input-base--focus-input {
|
|
82
|
+
${InputContentText} {
|
|
83
|
+
height: ${({ theme, size = "m" }) => math(`${theme.control.height[size]} - 0.125rem`)};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
${InputBaseAddonWrapper} {
|
|
87
|
+
height: ${({ theme, size = "m" }) => math(`${theme.control.height[size]} - 0.125rem`)};
|
|
88
|
+
}
|
|
89
|
+
|
|
53
90
|
${InputBaseContainer} {
|
|
54
91
|
border-bottom: ${({ theme }) => `${math(`${theme.control.borderWidth} * 2`)} solid ${theme.colors[theme.primaryColor][9]}`};
|
|
55
92
|
}
|
|
56
93
|
}
|
|
57
94
|
`;
|
|
58
95
|
export {
|
|
96
|
+
InputBaseAddonWrapper,
|
|
59
97
|
InputBaseContainer,
|
|
60
|
-
|
|
98
|
+
InputBaseRightAddonWrapper,
|
|
99
|
+
InputBaseWrapper,
|
|
100
|
+
InputContentText
|
|
61
101
|
};
|
|
@@ -13,8 +13,12 @@ export interface IInputBaseProps {
|
|
|
13
13
|
error?: string | boolean;
|
|
14
14
|
/** Left adornment (icon/prefix) */
|
|
15
15
|
leftContent?: ReactNode;
|
|
16
|
-
/**
|
|
16
|
+
/** Determines the visual display mode of leftContent */
|
|
17
|
+
leftContentVariant?: "icon" | "text" | "addon";
|
|
18
|
+
/** Right adornment (icon/suffix) */
|
|
17
19
|
rightContent?: ReactNode;
|
|
20
|
+
/** Determines the visual display mode of rightContent */
|
|
21
|
+
rightContentVariant?: "icon" | "text" | "addon";
|
|
18
22
|
/** DOM ID for label association */
|
|
19
23
|
id?: string;
|
|
20
24
|
/** Container class name */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInputBaseProps } from '../InputBase';
|
|
2
2
|
export declare const InputBaseStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<IInputBaseProps & {
|
|
3
3
|
children?: import('react').ReactNode | undefined;
|
|
4
|
-
}, IInputBaseProps>> & string & Omit<({ label, className, size, id, required, style, error, disabled, children, leftContent, rightContent, ...props }: import('react').PropsWithChildren<IInputBaseProps>) => import("react/jsx-runtime").JSX.Element, keyof import('react').Component<any, {}, any>>;
|
|
4
|
+
}, IInputBaseProps>> & string & Omit<({ label, className, size, id, required, style, error, disabled, children, leftContent, rightContent, leftContentVariant, rightContentVariant, ...props }: import('react').PropsWithChildren<IInputBaseProps>) => import("react/jsx-runtime").JSX.Element, keyof import('react').Component<any, {}, any>>;
|
|
5
5
|
export declare const InputDateStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, never>> & string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IInputBaseProps } from '../InputBase';
|
|
2
2
|
export declare const InputBaseStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<IInputBaseProps & {
|
|
3
3
|
children?: import('react').ReactNode | undefined;
|
|
4
|
-
}, IInputBaseProps>> & string & Omit<({ label, className, size, id, required, style, error, disabled, children, leftContent, rightContent, ...props }: import('react').PropsWithChildren<IInputBaseProps>) => import("react/jsx-runtime").JSX.Element, keyof import('react').Component<any, {}, any>>;
|
|
4
|
+
}, IInputBaseProps>> & string & Omit<({ label, className, size, id, required, style, error, disabled, children, leftContent, rightContent, leftContentVariant, rightContentVariant, ...props }: import('react').PropsWithChildren<IInputBaseProps>) => import("react/jsx-runtime").JSX.Element, keyof import('react').Component<any, {}, any>>;
|
|
5
5
|
export declare const InputNumberStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('rc-input-number').InputNumberProps<import('rc-input-number').ValueType> & {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
} & {
|
|
@@ -8,7 +8,6 @@ const useSelect = require("./useSelect.cjs.js");
|
|
|
8
8
|
const helpers = require("./helpers.cjs.js");
|
|
9
9
|
const Tag = require("../Tag/Tag.cjs.js");
|
|
10
10
|
const iconArrowBottom = require("../assets/icon-arrow-bottom.svg.cjs.js");
|
|
11
|
-
const Flex = require("../Flex/Flex.cjs.js");
|
|
12
11
|
const iconClose = require("../assets/icon-close.svg.cjs.js");
|
|
13
12
|
const SelectComponent = (props) => {
|
|
14
13
|
const {
|
|
@@ -62,6 +61,7 @@ const SelectComponent = (props) => {
|
|
|
62
61
|
error,
|
|
63
62
|
size,
|
|
64
63
|
required,
|
|
64
|
+
rightContent,
|
|
65
65
|
...otherProps,
|
|
66
66
|
children: [
|
|
67
67
|
/* @__PURE__ */ jsxRuntime.jsx(styles.SelectDropDownStyles, { zIndex }),
|
|
@@ -80,10 +80,7 @@ const SelectComponent = (props) => {
|
|
|
80
80
|
menuItemSelectedIcon: null,
|
|
81
81
|
loading,
|
|
82
82
|
prefix: leftContent,
|
|
83
|
-
suffixIcon: /* @__PURE__ */ jsxRuntime.
|
|
84
|
-
rightContent,
|
|
85
|
-
/* @__PURE__ */ jsxRuntime.jsx(iconArrowBottom, { className: "icon-arrow" })
|
|
86
|
-
] }),
|
|
83
|
+
suffixIcon: /* @__PURE__ */ jsxRuntime.jsx(iconArrowBottom, { className: "icon-arrow" }),
|
|
87
84
|
labelRender: (props2) => /* @__PURE__ */ jsxRuntime.jsx(Text, { size, children: props2.label }),
|
|
88
85
|
open,
|
|
89
86
|
disabled,
|