@bigbinary/neetoui 8.2.24 → 8.2.25

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/cjs/Label.js CHANGED
@@ -1,25 +1,84 @@
1
1
  'use strict';
2
2
 
3
3
  var _extends = require('@babel/runtime/helpers/extends');
4
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
4
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
6
5
  var React = require('react');
7
6
  var classnames = require('classnames');
7
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
8
8
  var neetoIcons = require('@bigbinary/neeto-icons');
9
9
  var Button = require('./Button.js');
10
10
  var Popover = require('./Popover.js');
11
11
  var Tooltip = require('./Tooltip.js');
12
12
  var Typography = require('./Typography.js');
13
- require('react-router-dom');
14
- require('./Spinner.js');
15
13
  require('@babel/runtime/helpers/slicedToArray');
16
14
  require('@tippyjs/react');
17
15
  require('tippy.js');
16
+ require('react-router-dom');
17
+ require('./Spinner.js');
18
+
19
+ var _excluded$2 = ["onClick", "className", "icon"];
20
+ var HelpIcon = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
21
+ var onClick = _ref.onClick,
22
+ className = _ref.className,
23
+ icon = _ref.icon,
24
+ otherProps = _objectWithoutProperties(_ref, _excluded$2);
25
+ var HelpIcon = icon || neetoIcons.Help;
26
+ return /*#__PURE__*/React.createElement("span", {
27
+ onClick: onClick,
28
+ ref: ref,
29
+ className: classnames("neeto-ui-label__help-icon-wrap", _defineProperty({}, className, className))
30
+ }, /*#__PURE__*/React.createElement(HelpIcon, _extends({
31
+ size: 16
32
+ }, otherProps)));
33
+ });
34
+ HelpIcon.displayName = "HelpIcon";
18
35
 
19
- var _excluded = ["children", "className", "required", "helpIconProps"],
20
- _excluded2 = ["onClick", "icon", "tooltipProps", "popoverProps", "className"],
21
- _excluded3 = ["title", "description", "helpLinkProps"];
22
- var Title = Popover.Title;
36
+ var _excluded$1 = ["tooltipProps", "popoverProps"],
37
+ _excluded2 = ["title", "description", "helpLinkProps"];
38
+ var HelpContent = function HelpContent(_ref) {
39
+ var helpIconProps = _ref.helpIconProps;
40
+ var popoverReferenceElement = React.useRef();
41
+ var _ref2 = helpIconProps || {},
42
+ tooltipProps = _ref2.tooltipProps,
43
+ popoverProps = _ref2.popoverProps,
44
+ otherHelpIconProps = _objectWithoutProperties(_ref2, _excluded$1);
45
+ if (tooltipProps) {
46
+ return /*#__PURE__*/React.createElement(Tooltip, tooltipProps, /*#__PURE__*/React.createElement(HelpIcon, otherHelpIconProps));
47
+ }
48
+ if (popoverProps) {
49
+ var title = popoverProps.title,
50
+ description = popoverProps.description,
51
+ helpLinkProps = popoverProps.helpLinkProps,
52
+ otherPopoverProps = _objectWithoutProperties(popoverProps, _excluded2);
53
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HelpIcon, _extends({}, otherHelpIconProps, {
54
+ ref: popoverReferenceElement
55
+ })), /*#__PURE__*/React.createElement(Popover, _extends({
56
+ reference: popoverReferenceElement
57
+ }, otherPopoverProps), /*#__PURE__*/React.createElement("div", {
58
+ className: "flex flex-col"
59
+ }, title && /*#__PURE__*/React.createElement(Popover.Title, {
60
+ "data-cy": "help-popover-title",
61
+ "data-testid": "help-popover-title"
62
+ }, title), typeof description === "string" ? /*#__PURE__*/React.createElement(Typography, {
63
+ "data-cy": "help-popover-description",
64
+ "data-testid": "help-popover-description",
65
+ lineHeight: "normal",
66
+ style: "body2",
67
+ weight: "normal"
68
+ }, description) : description, helpLinkProps && /*#__PURE__*/React.createElement(Button, _extends({
69
+ className: "neeto-ui-mt-3",
70
+ "data-cy": "help-popover-link-button",
71
+ size: "small"
72
+ }, helpLinkProps, {
73
+ "data-testid": "help-popover-link-button",
74
+ style: "link",
75
+ target: "_blank"
76
+ })))));
77
+ }
78
+ return /*#__PURE__*/React.createElement(HelpIcon, otherHelpIconProps);
79
+ };
80
+
81
+ var _excluded = ["children", "className", "required", "helpIconProps"];
23
82
  var Label = function Label(_ref) {
24
83
  var children = _ref.children,
25
84
  _ref$className = _ref.className,
@@ -28,56 +87,14 @@ var Label = function Label(_ref) {
28
87
  required = _ref$required === void 0 ? false : _ref$required,
29
88
  _ref$helpIconProps = _ref.helpIconProps,
30
89
  helpIconProps = _ref$helpIconProps === void 0 ? null : _ref$helpIconProps,
31
- otherProps = _objectWithoutProperties(_ref, _excluded);
32
- var _ref2 = helpIconProps || {},
33
- onClick = _ref2.onClick,
34
- icon = _ref2.icon,
35
- tooltipProps = _ref2.tooltipProps,
36
- popoverProps = _ref2.popoverProps,
37
- helpIconClassName = _ref2.className,
38
- otherHelpIconProps = _objectWithoutProperties(_ref2, _excluded2);
39
- var _ref3 = popoverProps || {},
40
- title = _ref3.title,
41
- description = _ref3.description,
42
- helpLinkProps = _ref3.helpLinkProps,
43
- otherPopoverProps = _objectWithoutProperties(_ref3, _excluded3);
44
- var HelpIcon = icon || neetoIcons.Help;
45
- var popoverReferenceElement = React.useRef();
46
- var renderHelpIcon = function renderHelpIcon() {
47
- return /*#__PURE__*/React.createElement("span", {
48
- onClick: onClick,
49
- ref: popoverProps ? popoverReferenceElement : undefined,
50
- className: classnames("neeto-ui-label__help-icon-wrap", _defineProperty({}, helpIconClassName, helpIconClassName))
51
- }, /*#__PURE__*/React.createElement(HelpIcon, _extends({
52
- size: 16
53
- }, otherHelpIconProps)));
54
- };
90
+ props = _objectWithoutProperties(_ref, _excluded);
55
91
  return /*#__PURE__*/React.createElement("label", _extends({
56
92
  className: classnames("neeto-ui-label neeto-ui-flex neeto-ui-items-center", className)
57
- }, otherProps), children, required && /*#__PURE__*/React.createElement("span", {
93
+ }, props), children, required && /*#__PURE__*/React.createElement("span", {
58
94
  "aria-hidden": true
59
- }, "*"), helpIconProps && /*#__PURE__*/React.createElement(React.Fragment, null, tooltipProps ? /*#__PURE__*/React.createElement(Tooltip, tooltipProps, renderHelpIcon()) : popoverProps ? /*#__PURE__*/React.createElement(React.Fragment, null, renderHelpIcon(), /*#__PURE__*/React.createElement(Popover, _extends({
60
- reference: popoverReferenceElement
61
- }, otherPopoverProps), /*#__PURE__*/React.createElement("div", {
62
- className: "flex flex-col"
63
- }, title && /*#__PURE__*/React.createElement(Title, {
64
- "data-cy": "help-popover-title",
65
- "data-testid": "help-popover-title"
66
- }, title), typeof description === "string" ? /*#__PURE__*/React.createElement(Typography, {
67
- "data-cy": "help-popover-description",
68
- "data-testid": "help-popover-description",
69
- lineHeight: "normal",
70
- style: "body2",
71
- weight: "normal"
72
- }, description) : description, helpLinkProps && /*#__PURE__*/React.createElement(Button, _extends({
73
- className: "neeto-ui-mt-3",
74
- "data-cy": "help-popover-link-button",
75
- size: "small"
76
- }, helpLinkProps, {
77
- "data-testid": "help-popover-link-button",
78
- style: "link",
79
- target: "_blank"
80
- }))))) : renderHelpIcon()));
95
+ }, "*"), helpIconProps && /*#__PURE__*/React.createElement(HelpContent, {
96
+ helpIconProps: helpIconProps
97
+ }));
81
98
  };
82
99
 
83
100
  module.exports = Label;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.js","sources":["../../src/components/Label.jsx"],"sourcesContent":["import React, { useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { Help } from \"neetoicons\";\nimport PropTypes from \"prop-types\";\n\nimport Button from \"./Button\";\nimport Popover from \"./Popover\";\nimport Tooltip from \"./Tooltip\";\nimport Typography from \"./Typography\";\n\nconst { Title } = Popover;\n\nconst Label = ({\n children,\n className = \"\",\n required = false,\n helpIconProps = null,\n ...otherProps\n}) => {\n const {\n onClick,\n icon,\n tooltipProps,\n popoverProps,\n className: helpIconClassName,\n ...otherHelpIconProps\n } = helpIconProps || {};\n\n const { title, description, helpLinkProps, ...otherPopoverProps } =\n popoverProps || {};\n\n const HelpIcon = icon || Help;\n const popoverReferenceElement = useRef();\n\n const renderHelpIcon = () => (\n <span\n {...{ onClick }}\n ref={popoverProps ? popoverReferenceElement : undefined}\n className={classnames(\"neeto-ui-label__help-icon-wrap\", {\n [helpIconClassName]: helpIconClassName,\n })}\n >\n <HelpIcon size={16} {...otherHelpIconProps} />\n </span>\n );\n\n return (\n <label\n className={classnames(\n \"neeto-ui-label neeto-ui-flex neeto-ui-items-center\",\n className\n )}\n {...otherProps}\n >\n {children}\n {required && <span aria-hidden>*</span>}\n {helpIconProps && (\n <>\n {tooltipProps ? (\n <Tooltip {...tooltipProps}>{renderHelpIcon()}</Tooltip>\n ) : popoverProps ? (\n <>\n {renderHelpIcon()}\n <Popover\n reference={popoverReferenceElement}\n {...otherPopoverProps}\n >\n <div className=\"flex flex-col\">\n {title && (\n <Title\n data-cy=\"help-popover-title\"\n data-testid=\"help-popover-title\"\n >\n {title}\n </Title>\n )}\n {typeof description === \"string\" ? (\n <Typography\n data-cy=\"help-popover-description\"\n data-testid=\"help-popover-description\"\n lineHeight=\"normal\"\n style=\"body2\"\n weight=\"normal\"\n >\n {description}\n </Typography>\n ) : (\n description\n )}\n {helpLinkProps && (\n <Button\n className=\"neeto-ui-mt-3\"\n data-cy=\"help-popover-link-button\"\n size=\"small\"\n {...helpLinkProps}\n data-testid=\"help-popover-link-button\"\n style=\"link\"\n target=\"_blank\"\n />\n )}\n </div>\n </Popover>\n </>\n ) : (\n renderHelpIcon()\n )}\n </>\n )}\n </label>\n );\n};\n\nLabel.propTypes = {\n /**\n * To specify the content to be rendered inside the Label.\n */\n children: PropTypes.node,\n /**\n * Provide external classnames to Label component.\n */\n className: PropTypes.string,\n /**\n * To specify whether to show the required asterisk.\n */\n required: PropTypes.bool,\n /**\n * Props for the help icon\n */\n helpIconProps: PropTypes.shape({\n onClick: PropTypes.func,\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n tooltipProps: PropTypes.shape({ ...Tooltip.propTypes }),\n popoverProps: PropTypes.shape({\n title: PropTypes.node,\n description: PropTypes.node,\n helpLinkProps: PropTypes.shape({ ...Button.propTypes }),\n }),\n className: PropTypes.string,\n }),\n};\n\nexport default Label;\n"],"names":["Title","Popover","Label","_ref","children","_ref$className","className","_ref$required","required","_ref$helpIconProps","helpIconProps","otherProps","_objectWithoutProperties","_excluded","_ref2","onClick","icon","tooltipProps","popoverProps","helpIconClassName","otherHelpIconProps","_excluded2","_ref3","title","description","helpLinkProps","otherPopoverProps","_excluded3","HelpIcon","Help","popoverReferenceElement","useRef","renderHelpIcon","React","createElement","ref","undefined","classnames","_defineProperty","_extends","size","Fragment","Tooltip","reference","Typography","lineHeight","style","weight","Button","target"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAWA,IAAQA,KAAK,GAAKC,OAAO,CAAjBD,KAAK,CAAA;AAEb,IAAME,KAAK,GAAG,SAARA,KAAKA,CAAAC,IAAA,EAML;AAAA,EAAA,IALJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IAAAC,cAAA,GAAAF,IAAA,CACRG,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,cAAA;IAAAE,aAAA,GAAAJ,IAAA,CACdK,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;IAAAE,kBAAA,GAAAN,IAAA,CAChBO,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,kBAAA;AACjBE,IAAAA,UAAU,GAAAC,wBAAA,CAAAT,IAAA,EAAAU,SAAA,CAAA,CAAA;AAEb,EAAA,IAAAC,KAAA,GAOIJ,aAAa,IAAI,EAAE;IANrBK,OAAO,GAAAD,KAAA,CAAPC,OAAO;IACPC,IAAI,GAAAF,KAAA,CAAJE,IAAI;IACJC,YAAY,GAAAH,KAAA,CAAZG,YAAY;IACZC,YAAY,GAAAJ,KAAA,CAAZI,YAAY;IACDC,iBAAiB,GAAAL,KAAA,CAA5BR,SAAS;AACNc,IAAAA,kBAAkB,GAAAR,wBAAA,CAAAE,KAAA,EAAAO,UAAA,CAAA,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js","sources":["../../src/components/Label/HelpIcon.jsx","../../src/components/Label/HelpContent.jsx","../../src/components/Label/index.jsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\n\nimport classNames from \"classnames\";\nimport { Help } from \"neetoicons\";\n\nconst HelpIcon = forwardRef(\n ({ onClick, className, icon, ...otherProps }, ref) => {\n const HelpIcon = icon || Help;\n\n return (\n <span\n {...{ onClick, ref }}\n className={classNames(\"neeto-ui-label__help-icon-wrap\", {\n [className]: className,\n })}\n >\n <HelpIcon size={16} {...otherProps} />\n </span>\n );\n }\n);\n\nHelpIcon.displayName = \"HelpIcon\";\n\nexport default HelpIcon;\n","import React, { useRef } from \"react\";\n\nimport HelpIcon from \"./HelpIcon\";\n\nimport Button from \"../Button\";\nimport Popover from \"../Popover\";\nimport Tooltip from \"../Tooltip\";\nimport Typography from \"../Typography\";\n\nconst HelpContent = ({ helpIconProps }) => {\n const popoverReferenceElement = useRef();\n\n const { tooltipProps, popoverProps, ...otherHelpIconProps } =\n helpIconProps || {};\n\n if (tooltipProps) {\n return (\n <Tooltip {...tooltipProps}>\n <HelpIcon {...otherHelpIconProps} />\n </Tooltip>\n );\n }\n\n if (popoverProps) {\n const { title, description, helpLinkProps, ...otherPopoverProps } =\n popoverProps;\n\n return (\n <>\n <HelpIcon {...otherHelpIconProps} ref={popoverReferenceElement} />\n <Popover reference={popoverReferenceElement} {...otherPopoverProps}>\n <div className=\"flex flex-col\">\n {title && (\n <Popover.Title\n data-cy=\"help-popover-title\"\n data-testid=\"help-popover-title\"\n >\n {title}\n </Popover.Title>\n )}\n {typeof description === \"string\" ? (\n <Typography\n data-cy=\"help-popover-description\"\n data-testid=\"help-popover-description\"\n lineHeight=\"normal\"\n style=\"body2\"\n weight=\"normal\"\n >\n {description}\n </Typography>\n ) : (\n description\n )}\n {helpLinkProps && (\n <Button\n className=\"neeto-ui-mt-3\"\n data-cy=\"help-popover-link-button\"\n size=\"small\"\n {...helpLinkProps}\n data-testid=\"help-popover-link-button\"\n style=\"link\"\n target=\"_blank\"\n />\n )}\n </div>\n </Popover>\n </>\n );\n }\n\n return <HelpIcon {...otherHelpIconProps} />;\n};\n\nexport default HelpContent;\n","import React from \"react\";\n\nimport classnames from \"classnames\";\nimport PropTypes from \"prop-types\";\n\nimport HelpContent from \"./HelpContent\";\n\nimport Button from \"../Button\";\nimport Tooltip from \"../Tooltip\";\n\nconst Label = ({\n children,\n className = \"\",\n required = false,\n helpIconProps = null,\n ...props\n}) => (\n <label\n className={classnames(\n \"neeto-ui-label neeto-ui-flex neeto-ui-items-center\",\n className\n )}\n {...props}\n >\n {children}\n {required && <span aria-hidden>*</span>}\n {helpIconProps && <HelpContent {...{ helpIconProps }} />}\n </label>\n);\n\nLabel.propTypes = {\n /**\n * To specify the content to be rendered inside the Label.\n */\n children: PropTypes.node,\n /**\n * Provide external classnames to Label component.\n */\n className: PropTypes.string,\n /**\n * To specify whether to show the required asterisk.\n */\n required: PropTypes.bool,\n /**\n * Props for the help icon\n */\n helpIconProps: PropTypes.shape({\n onClick: PropTypes.func,\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n tooltipProps: PropTypes.shape({ ...Tooltip.propTypes }),\n popoverProps: PropTypes.shape({\n title: PropTypes.node,\n description: PropTypes.node,\n helpLinkProps: PropTypes.shape({ ...Button.propTypes }),\n }),\n className: PropTypes.string,\n }),\n};\n\nexport default Label;\n"],"names":["HelpIcon","forwardRef","_ref","ref","onClick","className","icon","otherProps","_objectWithoutProperties","_excluded","Help","React","createElement","classNames","_defineProperty","_extends","size","displayName","HelpContent","helpIconProps","popoverReferenceElement","useRef","_ref2","tooltipProps","popoverProps","otherHelpIconProps","Tooltip","title","description","helpLinkProps","otherPopoverProps","_excluded2","Fragment","Popover","reference","Title","Typography","lineHeight","style","weight","Button","target","Label","children","_ref$className","_ref$required","required","_ref$helpIconProps","props","classnames"],"mappings":";;;;;;;;;;;;;;;;;;;AAKA,IAAMA,QAAQ,gBAAGC,gBAAU,CACzB,UAAAC,IAA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AAa,iBAAIR,KAAA,CAAAC,aAAA,CAACM,WAAW,EAAA;AAAOC,IAAAA,aAAa,EAAbA,aAAAA;AAAa,GAAA,CAAM,CAClD,CAAA;AAAA;;;;"}
@@ -26,7 +26,7 @@ require('react-colorful');
26
26
  require('./tinycolor-C4a31PPv.js');
27
27
  require('./Dropdown.js');
28
28
  require('./index-CvMjRZDt.js');
29
- var DatePicker = require('./index-DoQ9g6qh.js');
29
+ var DatePicker = require('./index-E2IEf9Av.js');
30
30
  require('./Input.js');
31
31
  require('./Label.js');
32
32
  require('./MultiEmailInput.js');
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var _extends = require('@babel/runtime/helpers/extends');
4
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
5
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
5
6
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
6
7
  var React = require('react');
@@ -10,6 +11,8 @@ var tippy_js = require('tippy.js');
10
11
  var ARROW = "<svg width='12' height='6' viewBox='0 0 10 5' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M10 5H0.926697L3.95208 1.63847C4.74227 0.760478 6.11722 0.754951 6.91445 1.62656L10 5Z' /></svg>";
11
12
 
12
13
  var _excluded = ["content", "children", "theme", "disabled", "position", "interactive", "hideAfter", "hideOnTargetExit"];
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
16
  var Tooltip = function Tooltip(_ref) {
14
17
  var content = _ref.content,
15
18
  children = _ref.children,
@@ -52,24 +55,26 @@ var Tooltip = function Tooltip(_ref) {
52
55
  }
53
56
  return undefined;
54
57
  }, [instance, hideOnTargetExit]);
58
+ var handleCreate = function handleCreate(instance) {
59
+ var _instance$popper$firs;
60
+ setInstance(instance);
61
+ (_instance$popper$firs = instance.popper.firstElementChild) === null || _instance$popper$firs === void 0 || _instance$popper$firs.setAttribute("data-cy", "tooltip-box");
62
+ };
55
63
  return /*#__PURE__*/React.createElement(Tippy, _extends({
56
64
  animation: "scale-subtle",
57
65
  arrow: ARROW,
58
- content: content,
59
- disabled: disabled,
60
66
  duration: [100, 200],
61
- interactive: interactive,
62
67
  placement: position,
63
68
  plugins: [tippy_js.followCursor],
64
69
  role: "tooltip",
65
- theme: theme,
66
70
  zIndex: 100001,
67
- onCreate: function onCreate(instance) {
68
- var _instance$popper$firs;
69
- setInstance(instance);
70
- (_instance$popper$firs = instance.popper.firstElementChild) === null || _instance$popper$firs === void 0 || _instance$popper$firs.setAttribute("data-cy", "tooltip-box");
71
- }
72
- }, localProps, otherProps), /*#__PURE__*/React.isValidElement(children) ? children : /*#__PURE__*/React.createElement("span", null, children));
71
+ onCreate: handleCreate
72
+ }, _objectSpread(_objectSpread({
73
+ content: content,
74
+ disabled: disabled,
75
+ interactive: interactive,
76
+ theme: theme
77
+ }, localProps), otherProps)), /*#__PURE__*/React.isValidElement(children) ? children : children && /*#__PURE__*/React.createElement("span", null, children));
73
78
  };
74
79
 
75
80
  module.exports = Tooltip;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../src/components/Tooltip/constants.js","../../src/components/Tooltip/index.jsx"],"sourcesContent":["export const ARROW =\n \"<svg width='12' height='6' viewBox='0 0 10 5' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M10 5H0.926697L3.95208 1.63847C4.74227 0.760478 6.11722 0.754951 6.91445 1.62656L10 5Z' /></svg>\";\n","import React, { useEffect, useState } from \"react\";\n\nimport Tippy from \"@tippyjs/react\";\nimport PropTypes from \"prop-types\";\nimport { followCursor } from \"tippy.js\";\n\nimport { ARROW } from \"./constants\";\n\nconst Tooltip = ({\n content,\n children,\n theme = \"dark\",\n disabled = false,\n position = \"auto\",\n interactive = false,\n hideAfter = -1,\n hideOnTargetExit = false,\n ...otherProps\n}) => {\n const [instance, setInstance] = useState(null);\n\n const localProps = {};\n\n if (hideAfter > 0) {\n localProps[\"onShow\"] = instance =>\n setTimeout(() => instance.hide(), hideAfter);\n }\n\n useEffect(() => {\n if (hideOnTargetExit) {\n const intersectionObserver = new IntersectionObserver(entries => {\n entries.forEach(entry => !entry.isIntersecting && instance?.hide());\n });\n instance?.reference && intersectionObserver.observe(instance?.reference);\n\n return () => intersectionObserver.disconnect();\n }\n\n return undefined;\n }, [instance, hideOnTargetExit]);\n\n return (\n <Tippy\n animation=\"scale-subtle\"\n arrow={ARROW}\n content={content}\n disabled={disabled}\n duration={[100, 200]}\n interactive={interactive}\n placement={position}\n plugins={[followCursor]}\n role=\"tooltip\"\n theme={theme}\n zIndex={100001}\n onCreate={instance => {\n setInstance(instance);\n instance.popper.firstElementChild?.setAttribute(\n \"data-cy\",\n \"tooltip-box\"\n );\n }}\n {...localProps}\n {...otherProps}\n >\n {React.isValidElement(children) ? children : <span>{children}</span>}\n </Tippy>\n );\n};\n\nTooltip.propTypes = {\n /**\n * The component to be rendered inside the popup.\n */\n content: PropTypes.node,\n /**\n * Tooltip popup will be shown when mouse is hovered over this component.\n */\n children: PropTypes.node,\n /**\n * To display Tooltip in dark or light theme. By default the theme is dark.\n */\n theme: PropTypes.oneOf([\"dark\", \"light\"]),\n /**\n * To specify whether the Tooltip is disabled or not.\n */\n disabled: PropTypes.bool,\n /**\n * To specify the position of the Tooltip.\n */\n position: PropTypes.string,\n /**\n * To specify whether the Tooltip can be hovered over and clicked inside without hiding.\n */\n interactive: PropTypes.bool,\n /**\n * To auto-hide the Tooltip after n-milliseconds.\n * Negative values to this prop disables this feature.\n * By default it's disabled.\n */\n hideAfter: PropTypes.number,\n /**\n * To auto-hide the Tooltip on when target leaves the screen.\n * By default it's disabled.\n */\n hideOnTargetExit: PropTypes.bool,\n};\n\nexport default Tooltip;\n"],"names":["ARROW","Tooltip","_ref","content","children","_ref$theme","theme","_ref$disabled","disabled","_ref$position","position","_ref$interactive","interactive","_ref$hideAfter","hideAfter","_ref$hideOnTargetExit","hideOnTargetExit","otherProps","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","instance","setInstance","localProps","setTimeout","hide","useEffect","intersectionObserver","IntersectionObserver","entries","forEach","entry","isIntersecting","reference","observe","disconnect","undefined","React","createElement","Tippy","_extends","animation","arrow","duration","placement","plugins","followCursor","role","zIndex","onCreate","_instance$popper$firs","popper","firstElementChild","setAttribute","isValidElement"],"mappings":";;;;;;;;;AAAO,IAAMA,KAAK,GAChB,wMAAwM;;;ACO1M,IAAMC,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAUP;AAAA,EAAA,IATJC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,UAAA,GAAAH,IAAA,CACRI,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,UAAA;IAAAE,aAAA,GAAAL,IAAA,CACdM,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;IAAAE,aAAA,GAAAP,IAAA,CAChBQ,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,aAAA;IAAAE,gBAAA,GAAAT,IAAA,CACjBU,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,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H,KAAA;GACI9B,EAAAA,UAAU,EACVT,UAAU,CAAA,eAEbuB,KAAK,CAACiB,cAAc,CAACrD,QAAQ,CAAC,GAAGA,QAAQ,gBAAGoC,KAAA,CAAAC,aAAA,CAAOrC,MAAAA,EAAAA,IAAAA,EAAAA,QAAQ,CAAQ,CAC9D,CAAA;AAEZ;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../src/components/Tooltip/constants.js","../../src/components/Tooltip/index.jsx"],"sourcesContent":["export const ARROW =\n \"<svg width='12' height='6' viewBox='0 0 10 5' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M10 5H0.926697L3.95208 1.63847C4.74227 0.760478 6.11722 0.754951 6.91445 1.62656L10 5Z' /></svg>\";\n","import React, { useEffect, useState } from \"react\";\n\nimport Tippy from \"@tippyjs/react\";\nimport PropTypes from \"prop-types\";\nimport { followCursor } from \"tippy.js\";\n\nimport { ARROW } from \"./constants\";\n\nconst Tooltip = ({\n content,\n children,\n theme = \"dark\",\n disabled = false,\n position = \"auto\",\n interactive = false,\n hideAfter = -1,\n hideOnTargetExit = false,\n ...otherProps\n}) => {\n const [instance, setInstance] = useState(null);\n\n const localProps = {};\n\n if (hideAfter > 0) {\n localProps[\"onShow\"] = instance =>\n setTimeout(() => instance.hide(), hideAfter);\n }\n\n useEffect(() => {\n if (hideOnTargetExit) {\n const intersectionObserver = new IntersectionObserver(entries => {\n entries.forEach(entry => !entry.isIntersecting && instance?.hide());\n });\n instance?.reference && intersectionObserver.observe(instance?.reference);\n\n return () => intersectionObserver.disconnect();\n }\n\n return undefined;\n }, [instance, hideOnTargetExit]);\n\n const handleCreate = instance => {\n setInstance(instance);\n instance.popper.firstElementChild?.setAttribute(\"data-cy\", \"tooltip-box\");\n };\n\n return (\n <Tippy\n animation=\"scale-subtle\"\n arrow={ARROW}\n duration={[100, 200]}\n placement={position}\n plugins={[followCursor]}\n role=\"tooltip\"\n zIndex={100001}\n onCreate={handleCreate}\n {...{\n content,\n disabled,\n interactive,\n theme,\n ...localProps,\n ...otherProps,\n }}\n >\n {React.isValidElement(children)\n ? children\n : children && <span>{children}</span>}\n </Tippy>\n );\n};\n\nTooltip.propTypes = {\n /**\n * The component to be rendered inside the popup.\n */\n content: PropTypes.node,\n /**\n * Tooltip popup will be shown when mouse is hovered over this component.\n */\n children: PropTypes.node,\n /**\n * To display Tooltip in dark or light theme. By default the theme is dark.\n */\n theme: PropTypes.oneOf([\"dark\", \"light\"]),\n /**\n * To specify whether the Tooltip is disabled or not.\n */\n disabled: PropTypes.bool,\n /**\n * To specify the position of the Tooltip.\n */\n position: PropTypes.string,\n /**\n * To specify whether the Tooltip can be hovered over and clicked inside without hiding.\n */\n interactive: PropTypes.bool,\n /**\n * To auto-hide the Tooltip after n-milliseconds.\n * Negative values to this prop disables this feature.\n * By default it's disabled.\n */\n hideAfter: PropTypes.number,\n /**\n * To auto-hide the Tooltip on when target leaves the screen.\n * By default it's disabled.\n */\n hideOnTargetExit: PropTypes.bool,\n};\n\nexport default Tooltip;\n"],"names":["ARROW","Tooltip","_ref","content","children","_ref$theme","theme","_ref$disabled","disabled","_ref$position","position","_ref$interactive","interactive","_ref$hideAfter","hideAfter","_ref$hideOnTargetExit","hideOnTargetExit","otherProps","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","instance","setInstance","localProps","setTimeout","hide","useEffect","intersectionObserver","IntersectionObserver","entries","forEach","entry","isIntersecting","reference","observe","disconnect","undefined","handleCreate","_instance$popper$firs","popper","firstElementChild","setAttribute","React","createElement","Tippy","_extends","animation","arrow","duration","placement","plugins","followCursor","role","zIndex","onCreate","_objectSpread","isValidElement"],"mappings":";;;;;;;;;;AAAO,IAAMA,KAAK,GAChB,wMAAwM;;;;;ACO1M,IAAMC,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAUP;AAAA,EAAA,IATJC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,UAA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AC,aAAA,CAACC,KAAK,EAAAC,QAAA,CAAA;AACJC,IAAAA,SAAS,EAAC,cAAc;AACxBC,IAAAA,KAAK,EAAElD,KAAM;AACbmD,IAAAA,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAE;AACrBC,IAAAA,SAAS,EAAE1C,QAAS;IACpB2C,OAAO,EAAE,CAACC,qBAAY,CAAE;AACxBC,IAAAA,IAAI,EAAC,SAAS;AACdC,IAAAA,MAAM,EAAE,MAAO;AACfC,IAAAA,QAAQ,EAAEjB,YAAAA;GAAakB,EAAAA,aAAA,CAAAA,aAAA,CAAA;AAErBvD,IAAAA,OAAO,EAAPA,OAAO;AACPK,IAAAA,QAAQ,EAARA,QAAQ;AACRI,IAAAA,WAAW,EAAXA,WAAW;AACXN,IAAAA,KAAK,EAALA,KAAAA;GACGoB,EAAAA,UAAU,GACVT,UAAU,CAAA,CAAA,eAGd4B,KAAK,CAACc,cAAc,CAACvD,QAAQ,CAAC,GAC3BA,QAAQ,GACRA,QAAQ,iBAAIyC,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAA,IAAA,EAAO1C,QAAQ,CAAQ,CACjC,CAAA;AAEZ;;;;"}
@@ -123,8 +123,19 @@ var TreeSelect = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
123
123
  className: "neeto-ui-text-center neeto-ui-p-1"
124
124
  }, index.getLocale(i18n, t, "neetoui.treeSelect.noOptions")),
125
125
  popupClassName: classnames("neeto-ui-tree-select-dropdown", popupClassName),
126
- switcherIcon: function switcherIcon(props) {
127
- return /*#__PURE__*/React.createElement("div", props, /*#__PURE__*/React.createElement(SwitcherIcon, null));
126
+ switcherIcon: function switcherIcon(_ref2) {
127
+ var className = _ref2.className,
128
+ style = _ref2.style,
129
+ onMouseMove = _ref2.onMouseMove,
130
+ id = _ref2.id,
131
+ title = _ref2.title;
132
+ return /*#__PURE__*/React.createElement("div", {
133
+ className: className,
134
+ id: id,
135
+ onMouseMove: onMouseMove,
136
+ style: style,
137
+ title: title
138
+ }, /*#__PURE__*/React.createElement(SwitcherIcon, null));
128
139
  }
129
140
  }, otherProps)), error && /*#__PURE__*/React.createElement("p", {
130
141
  className: "neeto-ui-input__error",
@@ -1 +1 @@
1
- {"version":3,"file":"TreeSelect.js","sources":["../../src/components/TreeSelect.jsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\n\nimport { TreeSelect as AntdTreeSelect, ConfigProvider } from \"antd\";\nimport classnames from \"classnames\";\nimport { Down } from \"neetoicons\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ANT_DESIGN_GLOBAL_TOKEN_OVERRIDES, getLocale } from \"utils\";\n\nimport { ANTD_LOCALE } from \"./constants\";\nimport Label from \"./Label\";\n\nconst TreeSelect = forwardRef(\n (\n {\n allowClear,\n className,\n disabled = false,\n error,\n fieldNames,\n label = \"\",\n onChange,\n placeholder = \"\",\n required = false,\n showSearch = false,\n size = \"middle\",\n suffixIcon,\n switcherIcon,\n treeData,\n treeDataSimpleMode = true,\n value,\n popupClassName,\n ...otherProps\n },\n ref\n ) => {\n const { t, i18n } = useTranslation();\n const SuffixIcon = suffixIcon ?? Down;\n\n const SwitcherIcon = switcherIcon ?? Down;\n\n return (\n <ConfigProvider\n locale={ANTD_LOCALE[i18n.language || \"en\"]}\n theme={{\n token: { ...ANT_DESIGN_GLOBAL_TOKEN_OVERRIDES },\n components: {\n TreeSelect: {\n nodeHoverBg: \"rgb(var(--neeto-ui-gray-100))\",\n nodeSelectedBg: \"rgb(var(--neeto-ui-primary-500))\",\n\n // Global overrides\n colorBgElevated: \"rgb(var(--neeto-ui-white))\",\n },\n },\n }}\n >\n <div className=\"neeto-ui-input__wrapper\">\n {label && (\n <Label {...{ required }} data-testid=\"treeselect-label\">\n {label}\n </Label>\n )}\n <AntdTreeSelect\n {...{\n allowClear,\n disabled,\n fieldNames,\n onChange,\n placeholder,\n ref,\n showSearch,\n size,\n treeData,\n treeDataSimpleMode,\n }}\n data-cy=\"neeto-ui-tree-select-wrapper\"\n dropdownStyle={{ zIndex: 100000 }}\n suffixIcon={<SuffixIcon />}\n treeNodeFilterProp={fieldNames?.label ?? \"label\"}\n value={value || undefined}\n className={classnames(\"neeto-ui-tree-select__wrapper\", className, {\n \"neeto-ui-tree-select__error\": error,\n })}\n notFoundContent={\n // eslint-disable-next-line @bigbinary/neeto/hard-coded-strings-should-be-localized\n <div className=\"neeto-ui-text-center neeto-ui-p-1\">\n {getLocale(i18n, t, \"neetoui.treeSelect.noOptions\")}\n </div>\n }\n popupClassName={classnames(\n \"neeto-ui-tree-select-dropdown\",\n popupClassName\n )}\n switcherIcon={props => (\n <div {...props}>\n <SwitcherIcon />\n </div>\n )}\n {...otherProps}\n />\n {error && (\n <p className=\"neeto-ui-input__error\" data-testid=\"treeselect-error\">\n {error}\n </p>\n )}\n </div>\n </ConfigProvider>\n );\n }\n);\n\nTreeSelect.displayName = \"TreeSelect\";\n\nTreeSelect.propTypes = {\n /**\n * Controls whether the value is allowed to be cleared or not.\n */\n allowClear: PropTypes.bool,\n /**\n * To specify additional classes.\n */\n className: PropTypes.string,\n /**\n * To specify additional classes to the popup.\n */\n popupClassName: PropTypes.string,\n /**\n * To disable the TreeSelect component.\n */\n disabled: PropTypes.bool,\n /**\n * To display the specified error.\n */\n error: PropTypes.string,\n /**\n * This prop can be used to override the default keys of label and value pairs in options.\n */\n fieldNames: PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n }),\n /**\n * To display a label above the TreeSelect component.\n */\n label: PropTypes.string,\n /**\n * The callback function that will be triggered when value changes.\n */\n onChange: PropTypes.func,\n /**\n * Callback function to be executed when search input changes that can be\n * used for advanced usecases. This is not necessary as basic search works\n * when `showSearch` is enabled.\n */\n onSearch: PropTypes.func,\n /**\n * The placeholder string to be displayed.\n */\n placeholder: PropTypes.string,\n /**\n * To specify whether TreeSelect field is required or not.\n */\n required: PropTypes.bool,\n /**\n * The search value to make search controlled. This is not required as basic search\n * works when `showSearch` is enabled.\n */\n searchValue: PropTypes.string,\n /**\n * To enable search for the TreeSelect component.\n */\n showSearch: PropTypes.bool,\n /**\n * To specify the size of the TreeSelect component.\n */\n size: PropTypes.oneOf([\"small\", \"middle\", \"large\"]),\n /**\n * To specify the icon at the end of the TreeSelect component.\n */\n suffixIcon: PropTypes.node,\n /**\n * To specify the icon next to options that have children.\n */\n switcherIcon: PropTypes.node,\n /**\n * The options to be passed to the TreeSelect component.\n */\n treeData: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n disabled: PropTypes.bool,\n children: PropTypes.array,\n })\n ),\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n label: PropTypes.string,\n value: PropTypes.string,\n disabled: PropTypes.bool,\n pId: PropTypes.string,\n })\n ),\n ]),\n /**\n * This prop specifies the format of data that has to be passed in the `treeData` prop.\n * When enabled, treeData can be a flat array of the form `{ id, label, value, pId }`.\n */\n treeDataSimpleMode: PropTypes.bool,\n /**\n * The currently selected option.\n */\n value: PropTypes.string,\n};\n\nexport default TreeSelect;\n"],"names":["TreeSelect","forwardRef","_ref","ref","_fieldNames$label","allowClear","className","_ref$disabled","disabled","error","fieldNames","_ref$label","label","onChange","_ref$placeholder","placeholder","_ref$required","required","_ref$showSearch","showSearch","_ref$size","size","suffixIcon","switcherIcon","treeData","_ref$treeDataSimpleMo","treeDataSimpleMode","value","popupClassName","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","i18n","SuffixIcon","Down","SwitcherIcon","React","createElement","_ConfigProvider","locale","ANTD_LOCALE","language","theme","token","_objectSpread","ANT_DESIGN_GLOBAL_TOKEN_OVERRIDES","components","nodeHoverBg","nodeSelectedBg","colorBgElevated","Label","_TreeSelect","_extends","dropdownStyle","zIndex","treeNodeFilterProp","undefined","classnames","notFoundContent","getLocale","props","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A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CAAAwC,KAAK,EAAA;AAAA,MAAA,oBACjBxB,KAAA,CAAAC,aAAA,CAAA,KAAA,EAASuB,KAAK,eACZxB,KAAA,CAAAC,aAAA,CAACF,YAAY,EAAA,IAAA,CAAG,CACZ,CAAA;AAAA,KAAA;AACN,GAAA,EACET,UAAU,CACd,CAAA,EACDpB,KAAK,iBACJ8B,KAAA,CAAAC,aAAA,CAAA,GAAA,EAAA;AAAGlC,IAAAA,SAAS,EAAC,uBAAuB;IAAC,aAAY,EAAA,kBAAA;GAC9CG,EAAAA,KAAK,CAET,CACG,CACS,CAAA;AAErB,CAAC,EACF;AAEDT,UAAU,CAACgE,WAAW,GAAG,YAAY;;;;"}
1
+ {"version":3,"file":"TreeSelect.js","sources":["../../src/components/TreeSelect.jsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\n\nimport { TreeSelect as AntdTreeSelect, ConfigProvider } from \"antd\";\nimport classnames from \"classnames\";\nimport { Down } from \"neetoicons\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ANT_DESIGN_GLOBAL_TOKEN_OVERRIDES, getLocale } from \"utils\";\n\nimport { ANTD_LOCALE } from \"./constants\";\nimport Label from \"./Label\";\n\nconst TreeSelect = forwardRef(\n (\n {\n allowClear,\n className,\n disabled = false,\n error,\n fieldNames,\n label = \"\",\n onChange,\n placeholder = \"\",\n required = false,\n showSearch = false,\n size = \"middle\",\n suffixIcon,\n switcherIcon,\n treeData,\n treeDataSimpleMode = true,\n value,\n popupClassName,\n ...otherProps\n },\n ref\n ) => {\n const { t, i18n } = useTranslation();\n const SuffixIcon = suffixIcon ?? Down;\n\n const SwitcherIcon = switcherIcon ?? Down;\n\n return (\n <ConfigProvider\n locale={ANTD_LOCALE[i18n.language || \"en\"]}\n theme={{\n token: { ...ANT_DESIGN_GLOBAL_TOKEN_OVERRIDES },\n components: {\n TreeSelect: {\n nodeHoverBg: \"rgb(var(--neeto-ui-gray-100))\",\n nodeSelectedBg: \"rgb(var(--neeto-ui-primary-500))\",\n\n // Global overrides\n colorBgElevated: \"rgb(var(--neeto-ui-white))\",\n },\n },\n }}\n >\n <div className=\"neeto-ui-input__wrapper\">\n {label && (\n <Label {...{ required }} data-testid=\"treeselect-label\">\n {label}\n </Label>\n )}\n <AntdTreeSelect\n {...{\n allowClear,\n disabled,\n fieldNames,\n onChange,\n placeholder,\n ref,\n showSearch,\n size,\n treeData,\n treeDataSimpleMode,\n }}\n data-cy=\"neeto-ui-tree-select-wrapper\"\n dropdownStyle={{ zIndex: 100000 }}\n suffixIcon={<SuffixIcon />}\n treeNodeFilterProp={fieldNames?.label ?? \"label\"}\n value={value || undefined}\n className={classnames(\"neeto-ui-tree-select__wrapper\", className, {\n \"neeto-ui-tree-select__error\": error,\n })}\n notFoundContent={\n // eslint-disable-next-line @bigbinary/neeto/hard-coded-strings-should-be-localized\n <div className=\"neeto-ui-text-center neeto-ui-p-1\">\n {getLocale(i18n, t, \"neetoui.treeSelect.noOptions\")}\n </div>\n }\n popupClassName={classnames(\n \"neeto-ui-tree-select-dropdown\",\n popupClassName\n )}\n switcherIcon={({ className, style, onMouseMove, id, title }) => (\n <div {...{ className, id, onMouseMove, style, title }}>\n <SwitcherIcon />\n </div>\n )}\n {...otherProps}\n />\n {error && (\n <p className=\"neeto-ui-input__error\" data-testid=\"treeselect-error\">\n {error}\n </p>\n )}\n </div>\n </ConfigProvider>\n );\n }\n);\n\nTreeSelect.displayName = \"TreeSelect\";\n\nTreeSelect.propTypes = {\n /**\n * Controls whether the value is allowed to be cleared or not.\n */\n allowClear: PropTypes.bool,\n /**\n * To specify additional classes.\n */\n className: PropTypes.string,\n /**\n * To specify additional classes to the popup.\n */\n popupClassName: PropTypes.string,\n /**\n * To disable the TreeSelect component.\n */\n disabled: PropTypes.bool,\n /**\n * To display the specified error.\n */\n error: PropTypes.string,\n /**\n * This prop can be used to override the default keys of label and value pairs in options.\n */\n fieldNames: PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n }),\n /**\n * To display a label above the TreeSelect component.\n */\n label: PropTypes.string,\n /**\n * The callback function that will be triggered when value changes.\n */\n onChange: PropTypes.func,\n /**\n * Callback function to be executed when search input changes that can be\n * used for advanced usecases. This is not necessary as basic search works\n * when `showSearch` is enabled.\n */\n onSearch: PropTypes.func,\n /**\n * The placeholder string to be displayed.\n */\n placeholder: PropTypes.string,\n /**\n * To specify whether TreeSelect field is required or not.\n */\n required: PropTypes.bool,\n /**\n * The search value to make search controlled. This is not required as basic search\n * works when `showSearch` is enabled.\n */\n searchValue: PropTypes.string,\n /**\n * To enable search for the TreeSelect component.\n */\n showSearch: PropTypes.bool,\n /**\n * To specify the size of the TreeSelect component.\n */\n size: PropTypes.oneOf([\"small\", \"middle\", \"large\"]),\n /**\n * To specify the icon at the end of the TreeSelect component.\n */\n suffixIcon: PropTypes.elementType,\n /**\n * To specify the icon next to options that have children.\n */\n switcherIcon: PropTypes.elementType,\n /**\n * The options to be passed to the TreeSelect component.\n */\n treeData: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n disabled: PropTypes.bool,\n children: PropTypes.array,\n })\n ),\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n label: PropTypes.string,\n value: PropTypes.string,\n disabled: PropTypes.bool,\n pId: PropTypes.string,\n })\n ),\n ]),\n /**\n * This prop specifies the format of data that has to be passed in the `treeData` prop.\n * When enabled, treeData can be a flat array of the form `{ id, label, value, pId }`.\n */\n treeDataSimpleMode: PropTypes.bool,\n /**\n * The currently selected option.\n */\n value: PropTypes.string,\n};\n\nexport default TreeSelect;\n"],"names":["TreeSelect","forwardRef","_ref","ref","_fieldNames$label","allowClear","className","_ref$disabled","disabled","error","fieldNames","_ref$label","label","onChange","_ref$placeholder","placeholder","_ref$required","required","_ref$showSearch","showSearch","_ref$size","size","suffixIcon","switcherIcon","treeData","_ref$treeDataSimpleMo","treeDataSimpleMode","value","popupClassName","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","i18n","SuffixIcon","Down","SwitcherIcon","React","createElement","_ConfigProvider","locale","ANTD_LOCALE","language","theme","token","_objectSpread","ANT_DESIGN_GLOBAL_TOKEN_OVERRIDES","components","nodeHoverBg","nodeSelectedBg","colorBgElevated","Label","_TreeSelect","_extends","dropdownStyle","zIndex","treeNodeFilterProp","undefined","classnames","notFoundContent","getLocale","_ref2","style","onMouseMove","id","title","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaMA,IAAAA,UAAU,gBAAGC,gBAAU,CAC3B,UAAAC,IAAA,EAqBEC,GAAG,EACA;AAAA,EAAA,IAAAC,iBAAA,CAAA;AAAA,EAAA,IApBDC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAAC,aAAA,GAAAL,IAAA,CACTM,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;IAChBE,KAAK,GAAAP,IAAA,CAALO,KAAK;IACLC,UAAU,GAAAR,IAAA,CAAVQ,UAAU;IAAAC,UAAA,GAAAT,IAAA,CACVU,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,UAAA;IACVE,QAAQ,GAAAX,IAAA,CAARW,QAAQ;IAAAC,gBAAA,GAAAZ,IAAA,CACRa,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,gBAAA;IAAAE,aAAA,GAAAd,IAAA,CAChBe,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;IAAAE,eAAA,GAAAhB,IAAA,CAChBiB,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,G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ports.TimePicker = TimePicker;
510
- //# sourceMappingURL=index-DoQ9g6qh.js.map
510
+ //# sourceMappingURL=index-E2IEf9Av.js.map