@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.
Files changed (114) hide show
  1. package/dist/Banner/Banner.cjs.js +96 -0
  2. package/dist/Banner/Banner.d.ts +4 -0
  3. package/dist/Banner/Banner.es.js +96 -0
  4. package/dist/Banner/index.d.ts +2 -0
  5. package/dist/Banner/styles.cjs.js +113 -0
  6. package/dist/Banner/styles.d.ts +12 -0
  7. package/dist/Banner/styles.es.js +113 -0
  8. package/dist/Banner/types.d.ts +40 -0
  9. package/dist/Button/styles.cjs.js +6 -10
  10. package/dist/Button/styles.es.js +6 -10
  11. package/dist/Calendar/Calendar.cjs.js +5 -3
  12. package/dist/Calendar/Calendar.es.js +5 -3
  13. package/dist/Calendar/styles.cjs.js +0 -1
  14. package/dist/Calendar/styles.es.js +0 -1
  15. package/dist/Card/Card.cjs.js +8 -4
  16. package/dist/Card/Card.d.ts +1 -1
  17. package/dist/Card/Card.es.js +8 -4
  18. package/dist/Card/styles.cjs.js +9 -3
  19. package/dist/Card/styles.d.ts +3 -1
  20. package/dist/Card/styles.es.js +9 -3
  21. package/dist/Card/types.d.ts +2 -0
  22. package/dist/Dropdown/Dropdown.cjs.js +47 -43
  23. package/dist/Dropdown/Dropdown.d.ts +1 -1
  24. package/dist/Dropdown/Dropdown.es.js +48 -44
  25. package/dist/Dropdown/DropdownItem.cjs.js +10 -13
  26. package/dist/Dropdown/DropdownItem.es.js +10 -13
  27. package/dist/Dropdown/DropdownList.cjs.js +0 -2
  28. package/dist/Dropdown/DropdownList.es.js +0 -2
  29. package/dist/Form/Form.cjs.js +1 -1
  30. package/dist/Form/Form.es.js +1 -1
  31. package/dist/Image/styles.cjs.js +3 -1
  32. package/dist/Image/styles.es.js +3 -1
  33. package/dist/InputBase/InputBase.cjs.js +55 -12
  34. package/dist/InputBase/InputBase.d.ts +1 -1
  35. package/dist/InputBase/InputBase.es.js +57 -14
  36. package/dist/InputBase/styles.cjs.js +44 -4
  37. package/dist/InputBase/styles.d.ts +7 -1
  38. package/dist/InputBase/styles.es.js +45 -5
  39. package/dist/InputBase/types.d.ts +5 -1
  40. package/dist/InputDate/styles.d.ts +1 -1
  41. package/dist/InputNumber/styles.d.ts +1 -1
  42. package/dist/Layout/Footer.cjs.js +9 -0
  43. package/dist/Layout/Footer.d.ts +1 -2
  44. package/dist/Layout/Footer.es.js +9 -0
  45. package/dist/Layout/Header.cjs.js +12 -4
  46. package/dist/Layout/Header.es.js +12 -4
  47. package/dist/Layout/Layout.cjs.js +8 -3
  48. package/dist/Layout/Layout.d.ts +1 -1
  49. package/dist/Layout/Layout.es.js +8 -3
  50. package/dist/Layout/Sidebar.cjs.js +2 -1
  51. package/dist/Layout/Sidebar.es.js +2 -1
  52. package/dist/Layout/styles.cjs.js +6 -4
  53. package/dist/Layout/styles.d.ts +2 -0
  54. package/dist/Layout/styles.es.js +6 -4
  55. package/dist/Layout/types.d.ts +6 -0
  56. package/dist/Menu/MenuItem.cjs.js +9 -1
  57. package/dist/Menu/MenuItem.es.js +9 -1
  58. package/dist/Menu/styles.cjs.js +3 -1
  59. package/dist/Menu/styles.es.js +3 -1
  60. package/dist/Menu/types.d.ts +4 -1
  61. package/dist/Modal/Modal.cjs.js +2 -2
  62. package/dist/Modal/Modal.es.js +2 -2
  63. package/dist/Modal/styles.cjs.js +3 -1
  64. package/dist/Modal/styles.es.js +3 -1
  65. package/dist/Select/Select.cjs.js +2 -5
  66. package/dist/Select/Select.es.js +2 -5
  67. package/dist/Select/helpers.d.ts +8 -0
  68. package/dist/Select/styles.d.ts +1 -1
  69. package/dist/Select/useSelect.d.ts +8 -0
  70. package/dist/Slider/Slider.cjs.js +122 -224
  71. package/dist/Slider/Slider.d.ts +1 -1
  72. package/dist/Slider/Slider.es.js +125 -227
  73. package/dist/Slider/styles.cjs.js +49 -32
  74. package/dist/Slider/styles.d.ts +1 -1
  75. package/dist/Slider/styles.es.js +49 -32
  76. package/dist/Slider/useSlider.cjs.js +194 -0
  77. package/dist/Slider/useSlider.d.ts +11 -0
  78. package/dist/Slider/useSlider.es.js +194 -0
  79. package/dist/Stepper/Step.cjs.js +114 -0
  80. package/dist/Stepper/Step.d.ts +2 -0
  81. package/dist/Stepper/Step.es.js +114 -0
  82. package/dist/Stepper/StepContent.cjs.js +10 -0
  83. package/dist/Stepper/StepContent.d.ts +4 -0
  84. package/dist/Stepper/StepContent.es.js +10 -0
  85. package/dist/Stepper/StepLabel.cjs.js +28 -0
  86. package/dist/Stepper/StepLabel.d.ts +2 -0
  87. package/dist/Stepper/StepLabel.es.js +28 -0
  88. package/dist/Stepper/Stepper.cjs.js +54 -0
  89. package/dist/Stepper/Stepper.d.ts +2 -0
  90. package/dist/Stepper/Stepper.es.js +54 -0
  91. package/dist/Stepper/StepperContext.cjs.js +13 -0
  92. package/dist/Stepper/StepperContext.d.ts +3 -0
  93. package/dist/Stepper/StepperContext.es.js +13 -0
  94. package/dist/Stepper/index.cjs.js +10 -0
  95. package/dist/Stepper/index.d.ts +12 -0
  96. package/dist/Stepper/index.es.js +11 -0
  97. package/dist/Stepper/styles.cjs.js +149 -0
  98. package/dist/Stepper/styles.d.ts +44 -0
  99. package/dist/Stepper/styles.es.js +149 -0
  100. package/dist/Stepper/types.d.ts +70 -0
  101. package/dist/TextField/TextField.cjs.js +4 -0
  102. package/dist/TextField/TextField.d.ts +1 -1
  103. package/dist/TextField/TextField.es.js +4 -0
  104. package/dist/TextField/styles.d.ts +1 -1
  105. package/dist/Textarea/styles.d.ts +1 -1
  106. package/dist/Tooltip/Tooltip.cjs.js +3 -1
  107. package/dist/Tooltip/Tooltip.es.js +4 -2
  108. package/dist/index.cjs.js +4 -0
  109. package/dist/index.d.ts +2 -0
  110. package/dist/index.es.js +4 -0
  111. package/dist/typography/Text/Text.cjs.js +2 -2
  112. package/dist/typography/Text/Text.es.js +2 -2
  113. package/dist/typography/Text/types.d.ts +1 -1
  114. package/package.json +1 -1
@@ -26,10 +26,16 @@ const getSizing = (size) => {
26
26
  `;
27
27
  }
28
28
  };
29
- const CardStyled = styled.div.attrs({ className: "quen-ui__card" })`
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
- max-width: 350px;
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: space-between;
55
+ justify-content: flex-end;
50
56
  align-items: center;
51
57
  `;
52
58
  exports.CardActionsStyled = CardActionsStyled;
@@ -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').FastOmit<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>, never>> & string;
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;
@@ -24,10 +24,16 @@ const getSizing = (size) => {
24
24
  `;
25
25
  }
26
26
  };
27
- const CardStyled = styled.div.attrs({ className: "quen-ui__card" })`
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
- max-width: 350px;
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: space-between;
53
+ justify-content: flex-end;
48
54
  align-items: center;
49
55
  `;
50
56
  export {
@@ -24,5 +24,7 @@ export interface ICardProps {
24
24
  leftContent?: React.ReactNode;
25
25
  style?: React.CSSProperties;
26
26
  onClickExtra?: () => void;
27
+ /** Show shadow */
28
+ shadow?: boolean;
27
29
  [key: string]: any;
28
30
  }
@@ -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 [anchorRect, setAnchorRect] = React.useState(helpers.DEFAULT_RECT_ELEMENT);
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: open
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 (typeof open === "undefined") {
31
- toggle(false);
32
- onClickClose?.();
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
- const calculateAnchorRect = () => {
40
- if (anchorRef && anchorRef.current) {
41
- setAnchorRect(helpers.calculateRectElement(anchorRef.current));
42
- }
43
- };
44
- const handleClickAnchorRef = () => {
45
- toggle();
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.addEventListener("scroll", calculateAnchorRect, true);
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
- }, [anchorRef]);
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
- const container = document.getElementsByTagName("body").item(0);
73
- setContainerDropdown(container);
79
+ if (typeof document !== "undefined") setContainerDropdown(document.body);
74
80
  }, []);
75
- if (disabled) {
76
- return null;
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 [anchorRect, setAnchorRect] = useState(DEFAULT_RECT_ELEMENT);
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: open
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 (typeof open === "undefined") {
30
- toggle(false);
31
- onClickClose?.();
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
- const calculateAnchorRect = () => {
39
- if (anchorRef && anchorRef.current) {
40
- setAnchorRect(calculateRectElement(anchorRef.current));
41
- }
42
- };
43
- const handleClickAnchorRef = () => {
44
- toggle();
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.addEventListener("scroll", calculateAnchorRect, true);
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
- }, [anchorRef]);
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
- const container = document.getElementsByTagName("body").item(0);
72
- setContainerDropdown(container);
78
+ if (typeof document !== "undefined") setContainerDropdown(document.body);
73
79
  }, []);
74
- if (disabled) {
75
- return null;
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
- event.preventDefault();
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
- styles.DropdownItemStyled,
20
- {
21
- size,
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
- event.preventDefault();
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
- DropdownItemStyled,
19
- {
20
- size,
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) => {
@@ -40,7 +40,7 @@ const Form = ({
40
40
  };
41
41
  React.useEffect(() => {
42
42
  form.setSubmitCallback(() => handleSubmit);
43
- }, []);
43
+ }, [form.getFieldsValue, form.getFieldsError]);
44
44
  return /* @__PURE__ */ jsxRuntime.jsx(
45
45
  FormContext.Provider,
46
46
  {
@@ -38,7 +38,7 @@ const Form = ({
38
38
  };
39
39
  useEffect(() => {
40
40
  form.setSubmitCallback(() => handleSubmit);
41
- }, []);
41
+ }, [form.getFieldsValue, form.getFieldsError]);
42
42
  return /* @__PURE__ */ jsx(
43
43
  FormContext.Provider,
44
44
  {
@@ -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"};
@@ -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
- return /* @__PURE__ */ jsxRuntime.jsxs(styles.InputBaseWrapper, { className, style, ...props, children: [
20
- label && /* @__PURE__ */ jsxRuntime.jsxs(Text, { size, as: "label", htmlFor: id, children: [
21
- label,
22
- required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "quen-ui__input-base--required", children: "*" })
23
- ] }),
24
- /* @__PURE__ */ jsxRuntime.jsxs(styles.InputBaseContainer, { size, error, disabled, children: [
25
- leftContent,
26
- children,
27
- rightContent
28
- ] }),
29
- typeof error === "string" && /* @__PURE__ */ jsxRuntime.jsx(Text, { className: "quen-ui__input-base--error-message", size: "xs", children: error })
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 { jsxs, jsx } from "react/jsx-runtime";
2
- import { InputBaseWrapper, InputBaseContainer } from "./styles.es.js";
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
- return /* @__PURE__ */ jsxs(InputBaseWrapper, { className, style, ...props, children: [
19
- label && /* @__PURE__ */ jsxs(Text, { size, as: "label", htmlFor: id, children: [
20
- label,
21
- required && /* @__PURE__ */ jsx("span", { className: "quen-ui__input-base--required", children: "*" })
22
- ] }),
23
- /* @__PURE__ */ jsxs(InputBaseContainer, { size, error, disabled, children: [
24
- leftContent,
25
- children,
26
- rightContent
27
- ] }),
28
- typeof error === "string" && /* @__PURE__ */ jsx(Text, { className: "quen-ui__input-base--error-message", size: "xs", children: error })
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