@quen-ui/components 1.0.1 → 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/Button/styles.cjs.js +6 -10
- package/dist/Button/styles.es.js +6 -10
- package/dist/Calendar/Calendar.cjs.js +5 -3
- package/dist/Calendar/Calendar.es.js +5 -3
- package/dist/Calendar/styles.cjs.js +0 -1
- package/dist/Calendar/styles.es.js +0 -1
- package/dist/Card/Card.cjs.js +8 -4
- package/dist/Card/Card.d.ts +1 -1
- package/dist/Card/Card.es.js +8 -4
- package/dist/Card/styles.cjs.js +9 -3
- package/dist/Card/styles.d.ts +3 -1
- package/dist/Card/styles.es.js +9 -3
- package/dist/Card/types.d.ts +2 -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/Form/Form.cjs.js +1 -1
- package/dist/Form/Form.es.js +1 -1
- package/dist/Image/styles.cjs.js +3 -1
- package/dist/Image/styles.es.js +3 -1
- 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/Layout/Footer.cjs.js +9 -0
- package/dist/Layout/Footer.d.ts +1 -2
- package/dist/Layout/Footer.es.js +9 -0
- package/dist/Layout/Header.cjs.js +12 -4
- package/dist/Layout/Header.es.js +12 -4
- package/dist/Layout/Layout.cjs.js +8 -3
- package/dist/Layout/Layout.d.ts +1 -1
- package/dist/Layout/Layout.es.js +8 -3
- package/dist/Layout/Sidebar.cjs.js +2 -1
- package/dist/Layout/Sidebar.es.js +2 -1
- package/dist/Layout/styles.cjs.js +6 -4
- package/dist/Layout/styles.d.ts +2 -0
- package/dist/Layout/styles.es.js +6 -4
- package/dist/Layout/types.d.ts +6 -0
- package/dist/Menu/MenuItem.cjs.js +9 -1
- package/dist/Menu/MenuItem.es.js +9 -1
- package/dist/Menu/styles.cjs.js +3 -1
- package/dist/Menu/styles.es.js +3 -1
- package/dist/Menu/types.d.ts +4 -1
- package/dist/Modal/Modal.cjs.js +2 -2
- package/dist/Modal/Modal.es.js +2 -2
- package/dist/Modal/styles.cjs.js +3 -1
- package/dist/Modal/styles.es.js +3 -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/dist/typography/Text/Text.cjs.js +2 -2
- package/dist/typography/Text/Text.es.js +2 -2
- package/dist/typography/Text/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/Card/styles.cjs.js
CHANGED
|
@@ -26,10 +26,16 @@ const getSizing = (size) => {
|
|
|
26
26
|
`;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const CardStyled = styled.div.
|
|
29
|
+
const CardStyled = styled.div.withConfig({
|
|
30
|
+
shouldForwardProp: (prop) => !["shadow"].includes(prop)
|
|
31
|
+
}).attrs({ className: "quen-ui__card" })`
|
|
30
32
|
border-radius: ${({ theme }) => theme.components.Card.radius};
|
|
31
33
|
border: 1px solid ${({ theme }) => theme.components.Card.borderColor};
|
|
32
|
-
|
|
34
|
+
width: 350px;
|
|
35
|
+
|
|
36
|
+
${({ shadow, theme }) => shadow && styled.css`
|
|
37
|
+
box-shadow: ${theme.components.Card.shadow};
|
|
38
|
+
`};
|
|
33
39
|
`;
|
|
34
40
|
const CardHeaderStyled = styled.div`
|
|
35
41
|
${({ size }) => getSizing(size)};
|
|
@@ -46,7 +52,7 @@ const CardContentStyled = styled.div`
|
|
|
46
52
|
const CardActionsStyled = styled.div`
|
|
47
53
|
${({ size }) => getSizing(size)};
|
|
48
54
|
display: flex;
|
|
49
|
-
justify-content:
|
|
55
|
+
justify-content: flex-end;
|
|
50
56
|
align-items: center;
|
|
51
57
|
`;
|
|
52
58
|
exports.CardActionsStyled = CardActionsStyled;
|
package/dist/Card/styles.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TQuenSize } from '../types/size';
|
|
2
|
-
export declare const CardStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').
|
|
2
|
+
export declare const CardStyled: 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
|
+
shadow?: boolean;
|
|
4
|
+
}>> & string;
|
|
3
5
|
export declare const CardHeaderStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
6
|
size: TQuenSize;
|
|
5
7
|
}>> & string;
|
package/dist/Card/styles.es.js
CHANGED
|
@@ -24,10 +24,16 @@ const getSizing = (size) => {
|
|
|
24
24
|
`;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
const CardStyled = styled.div.
|
|
27
|
+
const CardStyled = styled.div.withConfig({
|
|
28
|
+
shouldForwardProp: (prop) => !["shadow"].includes(prop)
|
|
29
|
+
}).attrs({ className: "quen-ui__card" })`
|
|
28
30
|
border-radius: ${({ theme }) => theme.components.Card.radius};
|
|
29
31
|
border: 1px solid ${({ theme }) => theme.components.Card.borderColor};
|
|
30
|
-
|
|
32
|
+
width: 350px;
|
|
33
|
+
|
|
34
|
+
${({ shadow, theme }) => shadow && css`
|
|
35
|
+
box-shadow: ${theme.components.Card.shadow};
|
|
36
|
+
`};
|
|
31
37
|
`;
|
|
32
38
|
const CardHeaderStyled = styled.div`
|
|
33
39
|
${({ size }) => getSizing(size)};
|
|
@@ -44,7 +50,7 @@ const CardContentStyled = styled.div`
|
|
|
44
50
|
const CardActionsStyled = styled.div`
|
|
45
51
|
${({ size }) => getSizing(size)};
|
|
46
52
|
display: flex;
|
|
47
|
-
justify-content:
|
|
53
|
+
justify-content: flex-end;
|
|
48
54
|
align-items: center;
|
|
49
55
|
`;
|
|
50
56
|
export {
|
package/dist/Card/types.d.ts
CHANGED
|
@@ -14,68 +14,72 @@ const Dropdown = ({
|
|
|
14
14
|
width,
|
|
15
15
|
anchorRef,
|
|
16
16
|
onClickClose,
|
|
17
|
+
onClickOutside,
|
|
18
|
+
notCloseOutside,
|
|
17
19
|
...props
|
|
18
20
|
}) => {
|
|
19
|
-
const [
|
|
21
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
22
|
+
const isControlled = typeof open !== "undefined";
|
|
23
|
+
const openState = isControlled ? open : isOpen;
|
|
20
24
|
const dropdownRef = React.useRef(null);
|
|
21
25
|
const [containerDropdown, setContainerDropdown] = React.useState(null);
|
|
26
|
+
const [anchorRect, setAnchorRect] = React.useState(helpers.DEFAULT_RECT_ELEMENT);
|
|
27
|
+
const lastInternalMousedownRef = React.useRef(0);
|
|
22
28
|
const [state, toggle] = reactTransitionState.useTransitionState({
|
|
23
29
|
timeout: 500,
|
|
24
30
|
unmountOnExit: true,
|
|
25
|
-
initialEntered:
|
|
31
|
+
initialEntered: openState
|
|
26
32
|
});
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (isControlled) toggle(open);
|
|
35
|
+
}, [open, isControlled, toggle]);
|
|
36
|
+
const calculateAnchorRect = React.useCallback(() => {
|
|
37
|
+
if (anchorRef.current) {
|
|
38
|
+
setAnchorRect(helpers.calculateRectElement(anchorRef.current));
|
|
39
|
+
}
|
|
40
|
+
}, [anchorRef]);
|
|
41
|
+
const handleInternalMouseDown = React.useCallback(
|
|
42
|
+
(e) => {
|
|
43
|
+
lastInternalMousedownRef.current = e.timeStamp || Date.now();
|
|
44
|
+
},
|
|
45
|
+
[]
|
|
46
|
+
);
|
|
27
47
|
hooks.useOnClickOutside(
|
|
28
|
-
anchorRef,
|
|
29
|
-
() => {
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
[anchorRef, dropdownRef],
|
|
49
|
+
(e) => {
|
|
50
|
+
if (e.timeStamp - lastInternalMousedownRef.current < 2100) return;
|
|
51
|
+
onClickOutside?.();
|
|
52
|
+
onClickClose?.();
|
|
53
|
+
if (!isControlled) setIsOpen(false);
|
|
34
54
|
},
|
|
35
|
-
{
|
|
36
|
-
excludeRef: dropdownRef
|
|
37
|
-
}
|
|
55
|
+
{ isActive: !notCloseOutside && openState }
|
|
38
56
|
);
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
if (isControlled || !anchorRef.current) return;
|
|
59
|
+
const el = anchorRef.current;
|
|
60
|
+
const handleClick = () => {
|
|
61
|
+
toggle();
|
|
62
|
+
setIsOpen((prev) => !prev);
|
|
63
|
+
};
|
|
64
|
+
el.addEventListener("click", handleClick);
|
|
65
|
+
return () => el.removeEventListener("click", handleClick);
|
|
66
|
+
}, [anchorRef, toggle, isControlled]);
|
|
67
|
+
React.useLayoutEffect(() => {
|
|
68
|
+
calculateAnchorRect();
|
|
69
|
+
}, [state, calculateAnchorRect]);
|
|
47
70
|
React.useEffect(() => {
|
|
48
71
|
window.addEventListener("resize", calculateAnchorRect);
|
|
49
72
|
window.addEventListener("scroll", calculateAnchorRect, true);
|
|
50
73
|
return () => {
|
|
51
74
|
window.removeEventListener("resize", calculateAnchorRect);
|
|
52
|
-
window.
|
|
53
|
-
};
|
|
54
|
-
}, [anchorRect]);
|
|
55
|
-
React.useEffect(() => {
|
|
56
|
-
if (typeof open === "undefined") {
|
|
57
|
-
anchorRef.current?.addEventListener("click", handleClickAnchorRef);
|
|
58
|
-
}
|
|
59
|
-
return () => {
|
|
60
|
-
anchorRef.current?.removeEventListener("click", handleClickAnchorRef);
|
|
75
|
+
window.removeEventListener("scroll", calculateAnchorRect, true);
|
|
61
76
|
};
|
|
62
|
-
}, [
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
if (typeof open !== "undefined") {
|
|
65
|
-
toggle(open);
|
|
66
|
-
}
|
|
67
|
-
}, [open]);
|
|
68
|
-
React.useLayoutEffect(() => {
|
|
69
|
-
calculateAnchorRect();
|
|
70
|
-
}, [state]);
|
|
77
|
+
}, [calculateAnchorRect]);
|
|
71
78
|
React.useEffect(() => {
|
|
72
|
-
|
|
73
|
-
setContainerDropdown(container);
|
|
79
|
+
if (typeof document !== "undefined") setContainerDropdown(document.body);
|
|
74
80
|
}, []);
|
|
75
|
-
if (disabled)
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
return /* @__PURE__ */ jsxRuntime.jsx(styles.DropdownWrapper, { children: state.isEnter && containerDropdown && reactDom.createPortal(
|
|
81
|
+
if (disabled) return null;
|
|
82
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles.DropdownWrapper, { onMouseDown: handleInternalMouseDown, children: state.isEnter && containerDropdown && reactDom.createPortal(
|
|
79
83
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
80
84
|
DropdownPortal,
|
|
81
85
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { IDropdownProps } from './types';
|
|
3
|
-
declare const Dropdown: <ITEM>({ disabled, open, direction, width, anchorRef, onClickClose, ...props }: IDropdownProps<ITEM>) => ReactNode;
|
|
3
|
+
declare const Dropdown: <ITEM>({ disabled, open, direction, width, anchorRef, onClickClose, onClickOutside, notCloseOutside, ...props }: IDropdownProps<ITEM>) => ReactNode;
|
|
4
4
|
export default Dropdown;
|
|
@@ -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) => {
|
package/dist/Form/Form.cjs.js
CHANGED
package/dist/Form/Form.es.js
CHANGED
package/dist/Image/styles.cjs.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const styled = require("styled-components");
|
|
4
4
|
const Button = require("../Button/Button.cjs.js");
|
|
5
|
-
const ImageContainer = styled.div
|
|
5
|
+
const ImageContainer = styled.div.withConfig({
|
|
6
|
+
shouldForwardProp: (prop) => !["width", "height", "preview"].includes(prop)
|
|
7
|
+
})`
|
|
6
8
|
position: relative;
|
|
7
9
|
width: ${({ width }) => typeof width === "number" ? `${width}px` : width || "auto"};
|
|
8
10
|
height: ${({ height }) => typeof height === "number" ? `${height}px` : height || "auto"};
|
package/dist/Image/styles.es.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import Button from "../Button/Button.es.js";
|
|
3
|
-
const ImageContainer = styled.div
|
|
3
|
+
const ImageContainer = styled.div.withConfig({
|
|
4
|
+
shouldForwardProp: (prop) => !["width", "height", "preview"].includes(prop)
|
|
5
|
+
})`
|
|
4
6
|
position: relative;
|
|
5
7
|
width: ${({ width }) => typeof width === "number" ? `${width}px` : width || "auto"};
|
|
6
8
|
height: ${({ height }) => typeof height === "number" ? `${height}px` : height || "auto"};
|
|
@@ -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
|