se-design 0.0.127 → 0.0.128

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 (120) hide show
  1. package/dist/assets/icons/radio-filled.svg +4 -0
  2. package/dist/assets/icons/radio.svg +3 -0
  3. package/dist/assets/style.css +1 -1
  4. package/dist/components/PhoneInput/index.d.ts +1 -0
  5. package/dist/index104.js +1 -1
  6. package/dist/index104.js.map +1 -1
  7. package/dist/index105.js +1 -1
  8. package/dist/index105.js.map +1 -1
  9. package/dist/index106.js +1 -1
  10. package/dist/index106.js.map +1 -1
  11. package/dist/index107.js +1 -1
  12. package/dist/index107.js.map +1 -1
  13. package/dist/index108.js +1 -1
  14. package/dist/index108.js.map +1 -1
  15. package/dist/index109.js +1 -1
  16. package/dist/index109.js.map +1 -1
  17. package/dist/index110.js +1 -1
  18. package/dist/index110.js.map +1 -1
  19. package/dist/index111.js +1 -1
  20. package/dist/index111.js.map +1 -1
  21. package/dist/index112.js +1 -1
  22. package/dist/index112.js.map +1 -1
  23. package/dist/index113.js +1 -1
  24. package/dist/index113.js.map +1 -1
  25. package/dist/index114.js +1 -1
  26. package/dist/index114.js.map +1 -1
  27. package/dist/index115.js +1 -1
  28. package/dist/index115.js.map +1 -1
  29. package/dist/index116.js +2 -2
  30. package/dist/index116.js.map +1 -1
  31. package/dist/index117.js +1 -1
  32. package/dist/index117.js.map +1 -1
  33. package/dist/index118.js +2 -2
  34. package/dist/index118.js.map +1 -1
  35. package/dist/index119.js +1 -1
  36. package/dist/index119.js.map +1 -1
  37. package/dist/index120.js +2 -2
  38. package/dist/index120.js.map +1 -1
  39. package/dist/index121.js +1 -1
  40. package/dist/index121.js.map +1 -1
  41. package/dist/index122.js +2 -2
  42. package/dist/index122.js.map +1 -1
  43. package/dist/index123.js +1 -1
  44. package/dist/index123.js.map +1 -1
  45. package/dist/index124.js +1 -1
  46. package/dist/index124.js.map +1 -1
  47. package/dist/index125.js +1 -1
  48. package/dist/index125.js.map +1 -1
  49. package/dist/index126.js +2 -2
  50. package/dist/index126.js.map +1 -1
  51. package/dist/index127.js +1 -1
  52. package/dist/index127.js.map +1 -1
  53. package/dist/index128.js +2 -2
  54. package/dist/index128.js.map +1 -1
  55. package/dist/index129.js +2 -149
  56. package/dist/index129.js.map +1 -1
  57. package/dist/index130.js +5 -0
  58. package/dist/index130.js.map +1 -0
  59. package/dist/index131.js +152 -0
  60. package/dist/index131.js.map +1 -0
  61. package/dist/{index141.js → index143.js} +1 -1
  62. package/dist/{index141.js.map → index143.js.map} +1 -1
  63. package/dist/{index149.js → index151.js} +1 -1
  64. package/dist/{index149.js.map → index151.js.map} +1 -1
  65. package/dist/index154.js +9 -4
  66. package/dist/index154.js.map +1 -1
  67. package/dist/index155.js +10 -170
  68. package/dist/index155.js.map +1 -1
  69. package/dist/index156.js +5 -11
  70. package/dist/index156.js.map +1 -1
  71. package/dist/index157.js +170 -6
  72. package/dist/index157.js.map +1 -1
  73. package/dist/index158.js +11 -6
  74. package/dist/index158.js.map +1 -1
  75. package/dist/index159.js +5 -37
  76. package/dist/index159.js.map +1 -1
  77. package/dist/index160.js +6 -2
  78. package/dist/index160.js.map +1 -1
  79. package/dist/index161.js +37 -7
  80. package/dist/index161.js.map +1 -1
  81. package/dist/index162.js +2 -327
  82. package/dist/index162.js.map +1 -1
  83. package/dist/index163.js +7 -49
  84. package/dist/index163.js.map +1 -1
  85. package/dist/index164.js +327 -2
  86. package/dist/index164.js.map +1 -1
  87. package/dist/index165.js +45 -71
  88. package/dist/index165.js.map +1 -1
  89. package/dist/index166.js +2 -93
  90. package/dist/index166.js.map +1 -1
  91. package/dist/index167.js +72 -48
  92. package/dist/index167.js.map +1 -1
  93. package/dist/index168.js +92 -7
  94. package/dist/index168.js.map +1 -1
  95. package/dist/index169.js +51 -4
  96. package/dist/index169.js.map +1 -1
  97. package/dist/index170.js +7 -51
  98. package/dist/index170.js.map +1 -1
  99. package/dist/index171.js +5 -2
  100. package/dist/index171.js.map +1 -1
  101. package/dist/index172.js +52 -2
  102. package/dist/index172.js.map +1 -1
  103. package/dist/index173.js +5 -0
  104. package/dist/index173.js.map +1 -0
  105. package/dist/index174.js +5 -0
  106. package/dist/index174.js.map +1 -0
  107. package/dist/index23.js +20 -18
  108. package/dist/index23.js.map +1 -1
  109. package/dist/index31.js +70 -42
  110. package/dist/index31.js.map +1 -1
  111. package/dist/index38.js +1 -1
  112. package/dist/index44.js +33 -30
  113. package/dist/index44.js.map +1 -1
  114. package/dist/index5.js +35 -31
  115. package/dist/index5.js.map +1 -1
  116. package/package.json +1 -1
  117. package/dist/index152.js +0 -13
  118. package/dist/index152.js.map +0 -1
  119. package/dist/index153.js +0 -13
  120. package/dist/index153.js.map +0 -1
package/dist/index172.js CHANGED
@@ -1,5 +1,55 @@
1
- var e = {};
1
+ import { __require as E } from "./index170.js";
2
+ import { __require as _ } from "./index171.js";
3
+ var f, v;
4
+ function P() {
5
+ if (v) return f;
6
+ v = 1;
7
+ var o = function() {
8
+ };
9
+ if (process.env.NODE_ENV !== "production") {
10
+ var y = E(), t = {}, d = _();
11
+ o = function(n) {
12
+ var a = "Warning: " + n;
13
+ typeof console != "undefined" && console.error(a);
14
+ try {
15
+ throw new Error(a);
16
+ } catch (i) {
17
+ }
18
+ };
19
+ }
20
+ function u(n, a, i, s, c) {
21
+ if (process.env.NODE_ENV !== "production") {
22
+ for (var e in n)
23
+ if (d(n, e)) {
24
+ var r;
25
+ try {
26
+ if (typeof n[e] != "function") {
27
+ var h = Error(
28
+ (s || "React class") + ": " + i + " type `" + e + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof n[e] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
29
+ );
30
+ throw h.name = "Invariant Violation", h;
31
+ }
32
+ r = n[e](a, e, s, i, null, y);
33
+ } catch (l) {
34
+ r = l;
35
+ }
36
+ if (r && !(r instanceof Error) && o(
37
+ (s || "React class") + ": type specification of " + i + " `" + e + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof r + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
38
+ ), r instanceof Error && !(r.message in t)) {
39
+ t[r.message] = !0;
40
+ var p = c ? c() : "";
41
+ o(
42
+ "Failed " + i + " type: " + r.message + (p != null ? p : "")
43
+ );
44
+ }
45
+ }
46
+ }
47
+ }
48
+ return u.resetWarningCache = function() {
49
+ process.env.NODE_ENV !== "production" && (t = {});
50
+ }, f = u, f;
51
+ }
2
52
  export {
3
- e as __exports
53
+ P as __require
4
54
  };
5
55
  //# sourceMappingURL=index172.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index172.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index172.js","sources":["../node_modules/prop-types/checkPropTypes.js"],"sourcesContent":["/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n var loggedTypeFailures = {};\n var has = require('./lib/has');\n\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) { /**/ }\n };\n}\n\n/**\n * Assert that the values match with the type specs.\n * Error messages are memorized and will only be shown once.\n *\n * @param {object} typeSpecs Map of name to a ReactPropType\n * @param {object} values Runtime values that need to be type-checked\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\n * @param {string} componentName Name of the component for error messages.\n * @param {?Function} getStack Returns the component stack.\n * @private\n */\nfunction checkPropTypes(typeSpecs, values, location, componentName, getStack) {\n if (process.env.NODE_ENV !== 'production') {\n for (var typeSpecName in typeSpecs) {\n if (has(typeSpecs, typeSpecName)) {\n var error;\n // Prop type validation may throw. In case they do, we don't want to\n // fail the render phase where it didn't fail before. So we log it.\n // After these have been cleaned up, we'll let them throw.\n try {\n // This is intentionally an invariant that gets caught. It's the same\n // behavior as without this statement except with a better message.\n if (typeof typeSpecs[typeSpecName] !== 'function') {\n var err = Error(\n (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +\n 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +\n 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'\n );\n err.name = 'Invariant Violation';\n throw err;\n }\n error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);\n } catch (ex) {\n error = ex;\n }\n if (error && !(error instanceof Error)) {\n printWarning(\n (componentName || 'React class') + ': type specification of ' +\n location + ' `' + typeSpecName + '` is invalid; the type checker ' +\n 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +\n 'You may have forgotten to pass an argument to the type checker ' +\n 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +\n 'shape all require an argument).'\n );\n }\n if (error instanceof Error && !(error.message in loggedTypeFailures)) {\n // Only monitor this failure once because there tends to be a lot of the\n // same error.\n loggedTypeFailures[error.message] = true;\n\n var stack = getStack ? getStack() : '';\n\n printWarning(\n 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')\n );\n }\n }\n }\n }\n}\n\n/**\n * Resets warning cache when testing.\n *\n * @private\n */\ncheckPropTypes.resetWarningCache = function() {\n if (process.env.NODE_ENV !== 'production') {\n loggedTypeFailures = {};\n }\n}\n\nmodule.exports = checkPropTypes;\n"],"names":["printWarning","ReactPropTypesSecret","require$$0","loggedTypeFailures","has","require$$1","text","message","x","checkPropTypes","typeSpecs","values","location","componentName","getStack","typeSpecName","error","err","ex","stack","checkPropTypes_1"],"mappings":";;;;;;AASA,MAAIA,IAAe,WAAW;AAAA,EAAE;AAEhC,MAAI,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,IAAI,QAAQ,IAAI,aAAa,iBAC3BN,IAAqB,CAAE;AAAA,KAI3BiB,IAAiBX;;","x_google_ignoreList":[0]}
@@ -0,0 +1,5 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
5
+ //# sourceMappingURL=index173.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index173.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,5 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
5
+ //# sourceMappingURL=index174.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index174.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/dist/index23.js CHANGED
@@ -1,13 +1,13 @@
1
1
  var F = Object.defineProperty, G = Object.defineProperties;
2
2
  var H = Object.getOwnPropertyDescriptors;
3
- var N = Object.getOwnPropertySymbols;
3
+ var k = Object.getOwnPropertySymbols;
4
4
  var K = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
5
- var s = (e, c, d) => c in e ? F(e, c, { enumerable: !0, configurable: !0, writable: !0, value: d }) : e[c] = d, w = (e, c) => {
5
+ var N = (e, c, d) => c in e ? F(e, c, { enumerable: !0, configurable: !0, writable: !0, value: d }) : e[c] = d, w = (e, c) => {
6
6
  for (var d in c || (c = {}))
7
- K.call(c, d) && s(e, d, c[d]);
8
- if (N)
9
- for (var d of N(c))
10
- L.call(c, d) && s(e, d, c[d]);
7
+ K.call(c, d) && N(e, d, c[d]);
8
+ if (k)
9
+ for (var d of k(c))
10
+ L.call(c, d) && N(e, d, c[d]);
11
11
  return e;
12
12
  }, V = (e, c) => G(e, H(c));
13
13
  import l, { useState as $, useRef as Q, useEffect as U } from "react";
@@ -40,9 +40,9 @@ const ce = (e) => {
40
40
  className: "option-chip flex flex-1 items-center justify-between"
41
41
  }, R(t), " ", b && (n == null ? void 0 : n.length) > 0 && /* @__PURE__ */ l.createElement("span", {
42
42
  className: "w-5 h-5 mx-1 rounded-full bg-[var(--color-gray-700)] text-[var(--color-white)] text-sm flex items-center justify-center"
43
- }, n == null ? void 0 : n.length)), J = (t) => {
44
- var E, k;
45
- const a = t[o], r = ((E = n[0]) == null ? void 0 : E[o]) || y, g = m != null && m.length ? t[m] == ((k = n[0]) == null ? void 0 : k[m]) : !0, S = j && a === r && g;
43
+ }, n == null ? void 0 : n.length)), z = (t) => {
44
+ var E, s;
45
+ const a = t[o], r = ((E = n[0]) == null ? void 0 : E[o]) || y, g = m != null && m.length ? t[m] == ((s = n[0]) == null ? void 0 : s[m]) : !0, S = j && a === r && g;
46
46
  return /* @__PURE__ */ l.createElement("div", {
47
47
  key: `$drop-option-${a}`,
48
48
  className: `option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between ${S ? "selected" : ""}`,
@@ -53,15 +53,15 @@ const ce = (e) => {
53
53
  name: "checkmark",
54
54
  stroke: x
55
55
  }));
56
- }, _ = () => /* @__PURE__ */ l.createElement("div", {
56
+ }, J = () => /* @__PURE__ */ l.createElement("div", {
57
57
  className: "dropdown-content dropdown-options"
58
- }, i == null ? void 0 : i.map((t) => J(t))), W = (t, a) => {
58
+ }, i == null ? void 0 : i.map((t) => z(t))), _ = (t, a) => {
59
59
  let r = [];
60
60
  t ? r = [...n, a] : r = n == null ? void 0 : n.filter((g) => g[m] !== a[m]), u(r);
61
- }, X = () => {
61
+ }, W = () => {
62
62
  var t, a;
63
63
  (t = f.current) == null || t.togglePopover(), (a = e == null ? void 0 : e.onApply) == null || a.call(e, n);
64
- }, q = (t) => {
64
+ }, X = (t) => {
65
65
  const a = n.some((r) => r[m] === t[m]);
66
66
  return /* @__PURE__ */ l.createElement("div", {
67
67
  key: `$drop-option-${t[o]}`,
@@ -70,21 +70,23 @@ const ce = (e) => {
70
70
  automationId: "checkbox",
71
71
  className: "checkbox",
72
72
  defaultChecked: a,
73
- onChange: (r) => W(r, t),
73
+ onChange: (r) => _(r, t),
74
74
  label: t == null ? void 0 : t.label
75
75
  }));
76
- }, z = () => /* @__PURE__ */ l.createElement("div", {
76
+ }, q = () => /* @__PURE__ */ l.createElement("div", {
77
77
  className: "dropdown-content dropdown-options"
78
- }, i == null ? void 0 : i.map((t) => q(t)), /* @__PURE__ */ l.createElement("div", {
78
+ }, i == null ? void 0 : i.map((t) => X(t)), /* @__PURE__ */ l.createElement("div", {
79
79
  className: "flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]"
80
80
  }, /* @__PURE__ */ l.createElement(P, {
81
81
  label: "Clear",
82
82
  type: "link",
83
+ size: "sm",
83
84
  onClick: T
84
85
  }), /* @__PURE__ */ l.createElement(P, {
85
86
  label: "Apply",
86
87
  type: "primary",
87
- onClick: X
88
+ size: "sm",
89
+ onClick: W
88
90
  }))), D = () => {
89
91
  const t = c ? "border-[var(--color-blue-500)]" : v ? "border-[var(--color-gray-300)]" : "border-[var(--color-gray-600)]", a = h ? "border-[var(--color-red-500)]" : "", r = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 border rounded-md ${a || t} flex items-center ${I}`;
90
92
  return /* @__PURE__ */ l.createElement("div", {
@@ -106,7 +108,7 @@ const ce = (e) => {
106
108
  className: `${v ? "bg-[var(--color-gray-50)] rounded-md cursor-not-allowed" : ""}`
107
109
  }, /* @__PURE__ */ l.createElement(Y, {
108
110
  ref: f,
109
- renderPopoverContents: b ? z : _,
111
+ renderPopoverContents: b ? q : J,
110
112
  contentWidth: "full",
111
113
  renderPopoverSrcElement: D,
112
114
  onPopoverToggle: (t) => d(t),
@@ -1 +1 @@
1
- {"version":3,"file":"index23.js","sources":["../src/components/Dropdown/index.tsx"],"sourcesContent":["import React, { FC, useState, useRef, useEffect } from 'react';\n\nimport { Popover, PopoverHandle } from 'src/components/Popover';\nimport { Icon } from 'components/Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\n\ntype DropdownValue = {\n [key: string]: any;\n};\n\ntype DropdownProps = {\n label?: string;\n type: 'select' | 'multi-select';\n dropDownOptions?: DropdownValue[];\n defaultText?: string;\n selectBy?: string;\n optionsUniqueBy?: string;\n displaySelected?: boolean;\n defaultSelectedValue?: DropdownValue | DropdownValue[];\n onOptionClick?: (selectedValue: DropdownValue) => void;\n style?: React.CSSProperties;\n renderOptionChip?: (option: DropdownValue) => React.ReactNode;\n className?: string;\n iconColor?: string;\n disabled?: boolean;\n dropdownClassName?: string;\n hasError?: boolean;\n errorMessage?: string;\n onApply?: (selectedValue: DropdownValue[]) => void;\n};\n\nexport const Dropdown: FC<DropdownProps> = (props) => {\n const [isDropDownOpen, setIsDropDownOpen] = useState(false);\n const [selectedDropDownValues, setSelectedDropDownValues] = useState<DropdownValue[]>(() =>\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n const popoverRef = useRef<HTMLDivElement & PopoverHandle>(null);\n\n const {\n selectBy = '',\n optionsUniqueBy = '',\n displaySelected = false,\n dropDownOptions,\n defaultText = 'Select',\n iconColor = 'var(--color-gray-700)',\n disabled = false,\n dropdownClassName = '',\n hasError = false,\n errorMessage = ''\n } = props;\n\n useEffect(() => {\n setSelectedDropDownValues(\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n }, [props?.defaultSelectedValue]);\n\n const isMultiSelect = props?.type === 'multi-select';\n\n const handleDropDownOptionClick = (dropDownOption: any) => {\n setSelectedDropDownValues([dropDownOption]);\n popoverRef.current?.togglePopover();\n props?.onOptionClick?.(dropDownOption);\n };\n\n const getSelectedDropDownValue = (option: DropdownValue) => {\n if (isMultiSelect) {\n return defaultText;\n }\n return option?.[selectBy] || defaultText;\n };\n\n const clearSelectedDropDownValues = () => {\n setSelectedDropDownValues([]);\n };\n\n const optionChip = (option: DropdownValue) => {\n if (props?.renderOptionChip) {\n return props?.renderOptionChip(option);\n }\n return (\n <p className={`option-chip flex flex-1 items-center justify-between`}>\n {getSelectedDropDownValue(option)}{' '}\n {isMultiSelect && selectedDropDownValues?.length > 0 && (\n <span className=\"w-5 h-5 mx-1 rounded-full bg-[var(--color-gray-700)] text-[var(--color-white)] text-sm flex items-center justify-center\">\n {selectedDropDownValues?.length}\n </span>\n )}\n </p>\n );\n };\n\n const dropDownOptionJsx = (dropDownOption: DropdownValue) => {\n const optionTxt = dropDownOption[selectBy];\n const dropDownSelectedValue = selectedDropDownValues[0]?.[selectBy] || defaultText;\n const selectByUniqueId = optionsUniqueBy?.length\n ? dropDownOption[optionsUniqueBy] == selectedDropDownValues[0]?.[optionsUniqueBy]\n : true;\n const isOptionSelected = displaySelected && optionTxt === dropDownSelectedValue && selectByUniqueId;\n return (\n <div\n key={`$drop-option-${optionTxt}`}\n className={`option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between ${isOptionSelected ? 'selected' : ''}`}\n onClick={() => handleDropDownOptionClick(dropDownOption)}\n >\n {optionChip({ ...dropDownOption, isOptionSelected })}\n {isOptionSelected && <Icon name=\"checkmark\" stroke={iconColor} />}\n </div>\n );\n };\n\n const renderDropdownContents = () => {\n return (\n <div className=\"dropdown-content dropdown-options\">\n {dropDownOptions?.map((dropDownOption) => dropDownOptionJsx(dropDownOption))}\n </div>\n );\n };\n\n const handleMultiSelectDropdownOptionClick = (isSelected: boolean, dropDownOption: DropdownValue) => {\n let newSelectedDropDownValue: DropdownValue[] = [];\n if (isSelected) {\n newSelectedDropDownValue = [...selectedDropDownValues, dropDownOption];\n } else {\n newSelectedDropDownValue = selectedDropDownValues?.filter(\n (option) => option[optionsUniqueBy] !== dropDownOption[optionsUniqueBy]\n );\n }\n setSelectedDropDownValues(newSelectedDropDownValue);\n };\n\n const handleApplySelectedDropDownValues = () => {\n popoverRef.current?.togglePopover();\n props?.onApply?.(selectedDropDownValues);\n };\n\n const multiSelectDropdownOptionJSX = (dropDownOption: DropdownValue) => {\n const isOptionSelected = selectedDropDownValues.some(\n (option) => option[optionsUniqueBy] === dropDownOption[optionsUniqueBy]\n );\n return (\n <div\n key={`$drop-option-${dropDownOption[selectBy]}`}\n className=\"option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between\"\n >\n <Checkbox\n automationId=\"checkbox\"\n className=\"checkbox\"\n defaultChecked={isOptionSelected}\n onChange={(value) => handleMultiSelectDropdownOptionClick(value, dropDownOption)}\n label={dropDownOption?.label}\n />\n </div>\n );\n };\n\n const renderMultiSelectDropdownContents = () => {\n return (\n <div className=\"dropdown-content dropdown-options\">\n {dropDownOptions?.map((dropDownOption) => multiSelectDropdownOptionJSX(dropDownOption))}\n <div className=\"flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]\">\n <Button label=\"Clear\" type=\"link\" onClick={clearSelectedDropDownValues} />\n <Button label=\"Apply\" type=\"primary\" onClick={handleApplySelectedDropDownValues} />\n </div>\n </div>\n );\n };\n\n const renderDropdownSelect = () => {\n const borderColor = isDropDownOpen\n ? 'border-[var(--color-blue-500)]'\n : disabled\n ? 'border-[var(--color-gray-300)]'\n : 'border-[var(--color-gray-600)]';\n const errorBorderColor = hasError ? 'border-[var(--color-red-500)]' : '';\n const dropDownSelectClass = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 border rounded-md ${errorBorderColor ? errorBorderColor : borderColor} flex items-center ${dropdownClassName}`;\n\n return (\n <div className={dropDownSelectClass}>\n {optionChip(selectedDropDownValues[0])}\n <Icon\n name={'chevron'}\n rotation={isDropDownOpen ? '180' : '0'}\n className={`ml-auto transition-transform`}\n stroke={iconColor}\n />\n </div>\n );\n };\n\n return (\n <div\n className={`se-design-dropdown-container${props?.className ? ` ${props?.className}` : ''}`}\n style={props?.style}\n >\n {props?.label && (\n <div className=\"se-design-dropdown-label mb-[3px] text-[var(--color-gray-700)] text-sm\">{props?.label}</div>\n )}\n <div\n style={props?.style}\n className={`${disabled ? 'bg-[var(--color-gray-50)] rounded-md cursor-not-allowed' : ''}`}\n >\n <Popover\n ref={popoverRef}\n renderPopoverContents={isMultiSelect ? renderMultiSelectDropdownContents : renderDropdownContents}\n contentWidth={'full'}\n renderPopoverSrcElement={renderDropdownSelect}\n onPopoverToggle={(value) => setIsDropDownOpen(value)}\n disabled={disabled}\n />\n </div>\n {hasError && <div className=\"text-[var(--color-red-500)] text-sm\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["React__default","useState","useRef","useEffect","Popover","Icon","Checkbox","Button","Dropdown","props","isDropDownOpen","setIsDropDownOpen","selectedDropDownValues","setSelectedDropDownValues","defaultSelectedValue","Array","isArray","popoverRef","selectBy","optionsUniqueBy","displaySelected","dropDownOptions","defaultText","iconColor","disabled","dropdownClassName","hasError","errorMessage","isMultiSelect","type","handleDropDownOptionClick","dropDownOption","_a","_b","current","togglePopover","onOptionClick","getSelectedDropDownValue","option","clearSelectedDropDownValues","optionChip","renderOptionChip","React","createElement","className","length","dropDownOptionJsx","optionTxt","dropDownSelectedValue","selectByUniqueId","isOptionSelected","key","onClick","__spreadProps","__spreadValues","name","stroke","renderDropdownContents","map","handleMultiSelectDropdownOptionClick","isSelected","newSelectedDropDownValue","filter","handleApplySelectedDropDownValues","onApply","multiSelectDropdownOptionJSX","some","automationId","defaultChecked","onChange","value","label","renderMultiSelectDropdownContents","renderDropdownSelect","borderColor","errorBorderColor","dropDownSelectClass","rotation","style","ref","renderPopoverContents","contentWidth","renderPopoverSrcElement","onPopoverToggle"],"mappings":";;;;;;;;;;;;AAgCO,OAAAA,KAAA,YAAAC,GAAA,UAAAC,GAAA,aAAAC,SAAA;AAAA,SAAA,WAAAC,SAAA;AAAA,SAAA,QAAAC,SAAA;AAAA,SAAA,YAAAC,SAAA;AAAA,SAAA,UAAAC,SAAA;AAAA,MAAMC,KAA+BC,CAAUA,MAAA;AACpD,QAAM,CAACC,GAAgBC,CAAiB,IAAIV,EAAS,EAAK,GACpD,CAACW,GAAwBC,CAAyB,IAAIZ,EAA0B,MACpFQ,KAAAA,QAAAA,EAAOK,uBACHC,MAAMC,QAAQP,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,CAAA,CACE,GACJE,KAAYgB,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKC,WAAU;AAAA,EAAqC,GAAEjB,CAAkB,CAClF;AAET;"}
1
+ {"version":3,"file":"index23.js","sources":["../src/components/Dropdown/index.tsx"],"sourcesContent":["import React, { FC, useState, useRef, useEffect } from 'react';\n\nimport { Popover, PopoverHandle } from 'src/components/Popover';\nimport { Icon } from 'components/Icon';\nimport { Checkbox } from '../Checkbox';\nimport { Button } from '../Button';\n\ntype DropdownValue = {\n [key: string]: any;\n};\n\ntype DropdownProps = {\n label?: string;\n type: 'select' | 'multi-select';\n dropDownOptions?: DropdownValue[];\n defaultText?: string;\n selectBy?: string;\n optionsUniqueBy?: string;\n displaySelected?: boolean;\n defaultSelectedValue?: DropdownValue | DropdownValue[];\n onOptionClick?: (selectedValue: DropdownValue) => void;\n style?: React.CSSProperties;\n renderOptionChip?: (option: DropdownValue) => React.ReactNode;\n className?: string;\n iconColor?: string;\n disabled?: boolean;\n dropdownClassName?: string;\n hasError?: boolean;\n errorMessage?: string;\n onApply?: (selectedValue: DropdownValue[]) => void;\n};\n\nexport const Dropdown: FC<DropdownProps> = (props) => {\n const [isDropDownOpen, setIsDropDownOpen] = useState(false);\n const [selectedDropDownValues, setSelectedDropDownValues] = useState<DropdownValue[]>(() =>\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n const popoverRef = useRef<HTMLDivElement & PopoverHandle>(null);\n\n const {\n selectBy = '',\n optionsUniqueBy = '',\n displaySelected = false,\n dropDownOptions,\n defaultText = 'Select',\n iconColor = 'var(--color-gray-700)',\n disabled = false,\n dropdownClassName = '',\n hasError = false,\n errorMessage = ''\n } = props;\n\n useEffect(() => {\n setSelectedDropDownValues(\n props?.defaultSelectedValue\n ? Array.isArray(props?.defaultSelectedValue)\n ? props?.defaultSelectedValue\n : [props.defaultSelectedValue]\n : []\n );\n }, [props?.defaultSelectedValue]);\n\n const isMultiSelect = props?.type === 'multi-select';\n\n const handleDropDownOptionClick = (dropDownOption: any) => {\n setSelectedDropDownValues([dropDownOption]);\n popoverRef.current?.togglePopover();\n props?.onOptionClick?.(dropDownOption);\n };\n\n const getSelectedDropDownValue = (option: DropdownValue) => {\n if (isMultiSelect) {\n return defaultText;\n }\n return option?.[selectBy] || defaultText;\n };\n\n const clearSelectedDropDownValues = () => {\n setSelectedDropDownValues([]);\n };\n\n const optionChip = (option: DropdownValue) => {\n if (props?.renderOptionChip) {\n return props?.renderOptionChip(option);\n }\n return (\n <p className={`option-chip flex flex-1 items-center justify-between`}>\n {getSelectedDropDownValue(option)}{' '}\n {isMultiSelect && selectedDropDownValues?.length > 0 && (\n <span className=\"w-5 h-5 mx-1 rounded-full bg-[var(--color-gray-700)] text-[var(--color-white)] text-sm flex items-center justify-center\">\n {selectedDropDownValues?.length}\n </span>\n )}\n </p>\n );\n };\n\n const dropDownOptionJsx = (dropDownOption: DropdownValue) => {\n const optionTxt = dropDownOption[selectBy];\n const dropDownSelectedValue = selectedDropDownValues[0]?.[selectBy] || defaultText;\n const selectByUniqueId = optionsUniqueBy?.length\n ? dropDownOption[optionsUniqueBy] == selectedDropDownValues[0]?.[optionsUniqueBy]\n : true;\n const isOptionSelected = displaySelected && optionTxt === dropDownSelectedValue && selectByUniqueId;\n return (\n <div\n key={`$drop-option-${optionTxt}`}\n className={`option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between ${isOptionSelected ? 'selected' : ''}`}\n onClick={() => handleDropDownOptionClick(dropDownOption)}\n >\n {optionChip({ ...dropDownOption, isOptionSelected })}\n {isOptionSelected && <Icon name=\"checkmark\" stroke={iconColor} />}\n </div>\n );\n };\n\n const renderDropdownContents = () => {\n return (\n <div className=\"dropdown-content dropdown-options\">\n {dropDownOptions?.map((dropDownOption) => dropDownOptionJsx(dropDownOption))}\n </div>\n );\n };\n\n const handleMultiSelectDropdownOptionClick = (isSelected: boolean, dropDownOption: DropdownValue) => {\n let newSelectedDropDownValue: DropdownValue[] = [];\n if (isSelected) {\n newSelectedDropDownValue = [...selectedDropDownValues, dropDownOption];\n } else {\n newSelectedDropDownValue = selectedDropDownValues?.filter(\n (option) => option[optionsUniqueBy] !== dropDownOption[optionsUniqueBy]\n );\n }\n setSelectedDropDownValues(newSelectedDropDownValue);\n };\n\n const handleApplySelectedDropDownValues = () => {\n popoverRef.current?.togglePopover();\n props?.onApply?.(selectedDropDownValues);\n };\n\n const multiSelectDropdownOptionJSX = (dropDownOption: DropdownValue) => {\n const isOptionSelected = selectedDropDownValues.some(\n (option) => option[optionsUniqueBy] === dropDownOption[optionsUniqueBy]\n );\n return (\n <div\n key={`$drop-option-${dropDownOption[selectBy]}`}\n className=\"option px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center justify-between\"\n >\n <Checkbox\n automationId=\"checkbox\"\n className=\"checkbox\"\n defaultChecked={isOptionSelected}\n onChange={(value) => handleMultiSelectDropdownOptionClick(value, dropDownOption)}\n label={dropDownOption?.label}\n />\n </div>\n );\n };\n\n const renderMultiSelectDropdownContents = () => {\n return (\n <div className=\"dropdown-content dropdown-options\">\n {dropDownOptions?.map((dropDownOption) => multiSelectDropdownOptionJSX(dropDownOption))}\n <div className=\"flex items-center justify-end gap-4 p-3 border-t border-[var(--color-gray-200)]\">\n <Button label=\"Clear\" type=\"link\" size=\"sm\" onClick={clearSelectedDropDownValues} />\n <Button label=\"Apply\" type=\"primary\" size=\"sm\" onClick={handleApplySelectedDropDownValues} />\n </div>\n </div>\n );\n };\n\n const renderDropdownSelect = () => {\n const borderColor = isDropDownOpen\n ? 'border-[var(--color-blue-500)]'\n : disabled\n ? 'border-[var(--color-gray-300)]'\n : 'border-[var(--color-gray-600)]';\n const errorBorderColor = hasError ? 'border-[var(--color-red-500)]' : '';\n const dropDownSelectClass = `dropdown-src-element bg-[var(--color-white)] flex px-3 py-2 border rounded-md ${errorBorderColor ? errorBorderColor : borderColor} flex items-center ${dropdownClassName}`;\n\n return (\n <div className={dropDownSelectClass}>\n {optionChip(selectedDropDownValues[0])}\n <Icon\n name={'chevron'}\n rotation={isDropDownOpen ? '180' : '0'}\n className={`ml-auto transition-transform`}\n stroke={iconColor}\n />\n </div>\n );\n };\n\n return (\n <div\n className={`se-design-dropdown-container${props?.className ? ` ${props?.className}` : ''}`}\n style={props?.style}\n >\n {props?.label && (\n <div className=\"se-design-dropdown-label mb-[3px] text-[var(--color-gray-700)] text-sm\">{props?.label}</div>\n )}\n <div\n style={props?.style}\n className={`${disabled ? 'bg-[var(--color-gray-50)] rounded-md cursor-not-allowed' : ''}`}\n >\n <Popover\n ref={popoverRef}\n renderPopoverContents={isMultiSelect ? renderMultiSelectDropdownContents : renderDropdownContents}\n contentWidth={'full'}\n renderPopoverSrcElement={renderDropdownSelect}\n onPopoverToggle={(value) => setIsDropDownOpen(value)}\n disabled={disabled}\n />\n </div>\n {hasError && <div className=\"text-[var(--color-red-500)] text-sm\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["React__default","useState","useRef","useEffect","Popover","Icon","Checkbox","Button","Dropdown","props","isDropDownOpen","setIsDropDownOpen","selectedDropDownValues","setSelectedDropDownValues","defaultSelectedValue","Array","isArray","popoverRef","selectBy","optionsUniqueBy","displaySelected","dropDownOptions","defaultText","iconColor","disabled","dropdownClassName","hasError","errorMessage","isMultiSelect","type","handleDropDownOptionClick","dropDownOption","_a","_b","current","togglePopover","onOptionClick","getSelectedDropDownValue","option","clearSelectedDropDownValues","optionChip","renderOptionChip","React","createElement","className","length","dropDownOptionJsx","optionTxt","dropDownSelectedValue","selectByUniqueId","isOptionSelected","key","onClick","__spreadProps","__spreadValues","name","stroke","renderDropdownContents","map","handleMultiSelectDropdownOptionClick","isSelected","newSelectedDropDownValue","filter","handleApplySelectedDropDownValues","onApply","multiSelectDropdownOptionJSX","some","automationId","defaultChecked","onChange","value","label","renderMultiSelectDropdownContents","size","renderDropdownSelect","borderColor","errorBorderColor","dropDownSelectClass","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AC,cAAA,OAAA;AAAA,IAAKC,WAAU;AAAA,KAA0EnC,KAAAA,gBAAAA,EAAO8D,KAAW,GAE7G7B,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEoC,OAAOtE,KAAAA,gBAAAA,EAAOsE;AAAAA,IACdnC,WAAW,GAAGpB,IAAW,4DAA4D,EAAE;AAAA,EAAA,GAEvFmB,gBAAAA,EAAAA,cAACvC,GAAO;AAAA,IACN4E,KAAK/D;AAAAA,IACLgE,uBAAuBrD,IAAgB4C,IAAoCf;AAAAA,IAC3EyB,cAAc;AAAA,IACdC,yBAAyBT;AAAAA,IACzBU,iBAAkBd,CAAU3D,MAAAA,EAAkB2D,CAAK;AAAA,IACnD9C,UAAAA;AAAAA,EACD,CAAA,CACE,GACJE,KAAYgB,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IAAKC,WAAU;AAAA,EAAqC,GAAEjB,CAAkB,CAClF;AAET;"}
package/dist/index31.js CHANGED
@@ -1,61 +1,89 @@
1
- var f = Object.defineProperty, $ = Object.defineProperties;
2
- var E = Object.getOwnPropertyDescriptors;
3
- var s = Object.getOwnPropertySymbols;
4
- var v = Object.prototype.hasOwnProperty, C = Object.prototype.propertyIsEnumerable;
5
- var d = (e, a, t) => a in e ? f(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t, m = (e, a) => {
6
- for (var t in a || (a = {}))
7
- v.call(a, t) && d(e, t, a[t]);
8
- if (s)
9
- for (var t of s(a))
10
- C.call(a, t) && d(e, t, a[t]);
1
+ var g = Object.defineProperty, b = Object.defineProperties;
2
+ var w = Object.getOwnPropertyDescriptors;
3
+ var d = Object.getOwnPropertySymbols;
4
+ var y = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
5
+ var s = (e, t, a) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, m = (e, t) => {
6
+ for (var a in t || (t = {}))
7
+ y.call(t, a) && s(e, a, t[a]);
8
+ if (d)
9
+ for (var a of d(t))
10
+ E.call(t, a) && s(e, a, t[a]);
11
11
  return e;
12
- }, u = (e, a) => $(e, E(a));
13
- import r, { useRef as N } from "react";
14
- function y(e) {
12
+ }, x = (e, t) => b(e, w(t));
13
+ import l, { useRef as v } from "react";
14
+ function N(e) {
15
15
  const {
16
- label: a,
17
- value: t,
16
+ label: t,
17
+ value: a,
18
18
  checked: o,
19
- disabled: l,
20
- name: h,
21
- onChange: c,
22
- width: b,
23
- radioLabelClassName: x = "",
24
- radioContainerClassName: w = ""
25
- } = e, n = N(null);
26
- return /* @__PURE__ */ r.createElement("div", {
27
- className: `flex items-start gap-2 ${l ? "cursor-not-allowed" : "cursor-pointer"} bg-[var(--color-white)] border ${o ? "border-[#1088E7]" : "border-[#C9D4E3]"} rounded-[6px] p-2 transition-colors duration-300 ${l ? "opacity-50" : ""} ${w}`,
19
+ disabled: r,
20
+ name: p,
21
+ onChange: i,
22
+ width: h,
23
+ radioLabelClassName: u = "",
24
+ radioContainerClassName: f = ""
25
+ } = e, n = v(null);
26
+ return /* @__PURE__ */ l.createElement("div", {
27
+ className: `flex items-start gap-2 ${r ? "cursor-not-allowed" : "cursor-pointer"} bg-[var(--color-white)] border ${o ? "border-[#1088E7]" : "border-[#C9D4E3]"} rounded-[6px] transition-colors duration-300 ${r ? "opacity-50" : ""} ${f}`,
28
28
  onClick: () => {
29
- var i;
30
- return (i = n.current) == null ? void 0 : i.click();
29
+ var c;
30
+ return (c = n.current) == null ? void 0 : c.click();
31
31
  },
32
32
  style: {
33
- width: b || "20vw"
33
+ width: h || "20vw"
34
34
  }
35
- }, /* @__PURE__ */ r.createElement("input", {
35
+ }, /* @__PURE__ */ l.createElement("div", {
36
+ style: {
37
+ width: "100%",
38
+ display: "flex",
39
+ flexDirection: "column",
40
+ padding: "16px",
41
+ gap: "6px"
42
+ }
43
+ }, /* @__PURE__ */ l.createElement("div", {
44
+ style: {
45
+ display: "flex",
46
+ alignItems: "center",
47
+ gap: "12px"
48
+ }
49
+ }, /* @__PURE__ */ l.createElement("input", {
36
50
  ref: n,
37
51
  type: "radio",
38
- id: t,
39
- name: h,
40
- value: t,
52
+ id: a,
53
+ name: p,
54
+ value: a,
41
55
  checked: o,
42
- disabled: l,
43
- className: "mt-1 h-4 w-4 cursor-pointer accent-[#1088E7] disabled:cursor-not-allowed disabled:opacity-50",
56
+ disabled: r,
57
+ className: "cursor-pointer accent-[#1088E7] disabled:cursor-not-allowed disabled:opacity-50",
58
+ style: {
59
+ color: "#1088E7",
60
+ width: "14px",
61
+ height: "14px",
62
+ padding: "3px"
63
+ },
44
64
  onChange: () => {
45
- c && c(u(m({}, e), {
65
+ i && i(x(m({}, e), {
46
66
  checked: !0
47
67
  }));
48
68
  }
49
- }), /* @__PURE__ */ r.createElement("label", {
50
- htmlFor: t,
51
- className: `${e.helperLabel && "flex flex-col"} ${l ? "cursor-not-allowed" : "cursor-pointer"}`
52
- }, /* @__PURE__ */ r.createElement("span", {
53
- className: `text-sm text-[var(--color-gray-800)] ${x}`
54
- }, a), e.helperLabel && /* @__PURE__ */ r.createElement("span", {
55
- className: `text-xs text-[var(--color-gray-600)] ${e.maxWidth ? `max-w-[${e.maxWidth}]` : "max-w-[20vw]"} break-words whitespace-normal`
69
+ }), /* @__PURE__ */ l.createElement("label", {
70
+ htmlFor: a,
71
+ className: `${e.helperLabel ? "flex flex-col gap-[6px]" : ""} ${r ? "cursor-not-allowed" : "cursor-pointer"}`
72
+ }, /* @__PURE__ */ l.createElement("span", {
73
+ className: `text-sm text-[var(--color-gray-800)] ${u} `,
74
+ style: {
75
+ fontSize: "16px",
76
+ fontWeight: "400"
77
+ }
78
+ }, t))), e.helperLabel && /* @__PURE__ */ l.createElement("span", {
79
+ className: `text-xs text-[var(--color-gray-600)] ${e.maxWidth ? `max-w-[${e.maxWidth}]` : "max-w-[20vw]"} break-words whitespace-normal`,
80
+ style: {
81
+ fontSize: "14px",
82
+ fontWeight: "400"
83
+ }
56
84
  }, e.helperLabel)));
57
85
  }
58
86
  export {
59
- y as Radio
87
+ N as Radio
60
88
  };
61
89
  //# sourceMappingURL=index31.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index31.js","sources":["../src/components/Radio/index.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nexport interface RadioProps {\n label: string;\n value: string;\n checked: boolean;\n disabled: boolean;\n name: string;\n onChange?: (props: RadioProps) => void;\n helperLabel?: string;\n maxWidth?: string;\n width?: string;\n radioLabelClassName?: string;\n radioContainerClassName?: string;\n}\n\nexport function Radio(props: RadioProps) {\n const {\n label,\n value,\n checked,\n disabled,\n name,\n onChange,\n width,\n radioLabelClassName = '',\n radioContainerClassName = ''\n } = props;\n const radioRef = useRef<HTMLInputElement>(null);\n\n return (\n <div\n className={`flex items-start gap-2 ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'} bg-[var(--color-white)] border ${checked ? 'border-[#1088E7]' : 'border-[#C9D4E3]'} rounded-[6px] p-2 transition-colors duration-300 ${disabled ? 'opacity-50' : ''} ${radioContainerClassName}`}\n onClick={() => radioRef.current?.click()}\n style={{ width: width || '20vw' }}\n >\n <input\n ref={radioRef}\n type=\"radio\"\n id={value}\n name={name}\n value={value}\n checked={checked}\n disabled={disabled}\n className=\"mt-1 h-4 w-4 cursor-pointer accent-[#1088E7] disabled:cursor-not-allowed disabled:opacity-50\"\n onChange={() => {\n onChange && onChange({ ...props, checked: true });\n }}\n />\n <label\n htmlFor={value}\n className={`${props.helperLabel && 'flex flex-col'} ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}`}\n >\n <span className={`text-sm text-[var(--color-gray-800)] ${radioLabelClassName}`}>{label}</span>\n {props.helperLabel && (\n <span\n className={`text-xs text-[var(--color-gray-600)] ${props.maxWidth ? `max-w-[${props.maxWidth}]` : 'max-w-[20vw]'} break-words whitespace-normal`}\n >\n {props.helperLabel}\n </span>\n )}\n </label>\n </div>\n );\n}\n"],"names":["Radio","props","label","value","checked","disabled","name","onChange","width","radioLabelClassName","radioContainerClassName","radioRef","useRef","React","createElement","className","onClick","current","click","style","ref","type","id","__spreadProps","__spreadValues","htmlFor","helperLabel","maxWidth"],"mappings":";;;;;;;;;;;;;AAgBO,SAASA,EAAMC,GAAmB;AACjC,QAAA;AAAA,IACJC,OAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,MAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,qBAAAA,IAAsB;AAAA,IACtBC,yBAAAA,IAA0B;AAAA,EAAA,IACxBT,GACEU,IAAWC,EAAyB,IAAI;AAG5CC,SAAAA,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEC,WAAW,0BAA0BV,IAAW,uBAAuB,gBAAgB,mCAAmCD,IAAU,qBAAqB,kBAAkB,qDAAqDC,IAAW,eAAe,EAAE,IAAIK,CAAuB;AAAA,IACvRM,SAASA,MAAML;;AAAAA,cAAAA,IAAAA,EAASM,YAATN,gBAAAA,EAAkBO;AAAAA;AAAAA,IACjCC,OAAO;AAAA,MAAEX,OAAOA,KAAS;AAAA,IAAA;AAAA,EAAO,GAEhCM,gBAAAA,EAAAA,cAAA,SAAA;AAAA,IACEM,KAAKT;AAAAA,IACLU,MAAK;AAAA,IACLC,IAAInB;AAAAA,IACJG,MAAAA;AAAAA,IACAH,OAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAU,WAAU;AAAA,IACVR,UAAUA,MAAM;AACdA,MAAAA,KAAYA,EAASgB,EAAAC,EAAA,IAAKvB,IAAL;AAAA,QAAYG,SAAS;AAAA,MAAA,EAAM;AAAA,IAAA;AAAA,EAClD,CACD,GACDU,gBAAAA,EAAAA,cAAA,SAAA;AAAA,IACEW,SAAStB;AAAAA,IACTY,WAAW,GAAGd,EAAMyB,eAAe,eAAe,IAAIrB,IAAW,uBAAuB,gBAAgB;AAAA,EAAA,GAExGS,gBAAAA,EAAAA,cAAA,QAAA;AAAA,IAAMC,WAAW,wCAAwCN,CAAmB;AAAA,EAAA,GAAKP,CAAY,GAC5FD,EAAMyB,eACLb,gBAAAA,EAAAC,cAAA,QAAA;AAAA,IACEC,WAAW,wCAAwCd,EAAM0B,WAAW,UAAU1B,EAAM0B,QAAQ,MAAM,cAAc;AAAA,EAAA,GAE/G1B,EAAMyB,WACH,CAEH,CACJ;AAET;"}
1
+ {"version":3,"file":"index31.js","sources":["../src/components/Radio/index.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nexport interface RadioProps {\n label: string;\n value: string;\n checked: boolean;\n disabled: boolean;\n name: string;\n onChange?: (props: RadioProps) => void;\n helperLabel?: string;\n maxWidth?: string;\n width?: string;\n radioLabelClassName?: string;\n radioContainerClassName?: string;\n}\n\nexport function Radio(props: RadioProps) {\n const {\n label,\n value,\n checked,\n disabled,\n name,\n onChange,\n width,\n radioLabelClassName = '',\n radioContainerClassName = ''\n } = props;\n const radioRef = useRef<HTMLInputElement>(null);\n\n return (\n <div\n className={`flex items-start gap-2 ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'} bg-[var(--color-white)] border ${checked ? 'border-[#1088E7]' : 'border-[#C9D4E3]'} rounded-[6px] transition-colors duration-300 ${disabled ? 'opacity-50' : ''} ${radioContainerClassName}`}\n onClick={() => radioRef.current?.click()}\n style={{ width: width || '20vw' }}\n >\n <div style={{ width: '100%', display: 'flex', flexDirection: 'column', padding: '16px', gap: '6px' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>\n <input\n ref={radioRef}\n type=\"radio\"\n id={value}\n name={name}\n value={value}\n checked={checked}\n disabled={disabled}\n className=\"cursor-pointer accent-[#1088E7] disabled:cursor-not-allowed disabled:opacity-50\"\n style={{\n color: '#1088E7',\n width: '14px',\n height: '14px',\n padding: '3px'\n }}\n onChange={() => {\n onChange && onChange({ ...props, checked: true });\n }}\n />\n <label\n htmlFor={value}\n className={`${props.helperLabel ? 'flex flex-col gap-[6px]' : ''} ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'}`}\n >\n <span\n className={`text-sm text-[var(--color-gray-800)] ${radioLabelClassName} `}\n style={{ fontSize: '16px', fontWeight: '400' }}\n >\n {label}\n </span>\n </label>\n </div>\n\n {props.helperLabel && (\n <span\n className={`text-xs text-[var(--color-gray-600)] ${props.maxWidth ? `max-w-[${props.maxWidth}]` : 'max-w-[20vw]'} break-words whitespace-normal`}\n style={{ fontSize: '14px', fontWeight: '400' }}\n >\n {props.helperLabel}\n </span>\n )}\n </div>\n </div>\n );\n}\n"],"names":["Radio","props","label","value","checked","disabled","name","onChange","width","radioLabelClassName","radioContainerClassName","radioRef","useRef","React","createElement","className","onClick","current","click","style","display","flexDirection","padding","gap","alignItems","ref","type","id","color","height","__spreadProps","__spreadValues","htmlFor","helperLabel","fontSize","fontWeight","maxWidth"],"mappings":";;;;;;;;;;;;;AAgBO,SAASA,EAAMC,GAAmB;AACjC,QAAA;AAAA,IACJC,OAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,SAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,MAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,OAAAA;AAAAA,IACAC,qBAAAA,IAAsB;AAAA,IACtBC,yBAAAA,IAA0B;AAAA,EAAA,IACxBT,GACEU,IAAWC,EAAyB,IAAI;AAG5CC,SAAAA,gBAAAA,EAAAC,cAAA,OAAA;AAAA,IACEC,WAAW,0BAA0BV,IAAW,uBAAuB,gBAAgB,mCAAmCD,IAAU,qBAAqB,kBAAkB,iDAAiDC,IAAW,eAAe,EAAE,IAAIK,CAAuB;AAAA,IACnRM,SAASA,MAAML;;AAAAA,cAAAA,IAAAA,EAASM,YAATN,gBAAAA,EAAkBO;AAAAA;AAAAA,IACjCC,OAAO;AAAA,MAAEX,OAAOA,KAAS;AAAA,IAAA;AAAA,EAAO,GAEhCM,gBAAAA,EAAAA,cAAA,OAAA;AAAA,IAAKK,OAAO;AAAA,MAAEX,OAAO;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5ClC,EAAMgC,WACH,CAEL,CACF;AAET;"}
package/dist/index38.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import n, { useState as b, useRef as $, useEffect as s, useMemo as z } from "react";
2
2
  import { Icon as N } from "./index5.js";
3
3
  import { LabelChip as D } from "./index9.js";
4
- import { debounce as F } from "./index141.js";
4
+ import { debounce as F } from "./index143.js";
5
5
  /* empty css */
6
6
  function q(o) {
7
7
  const {
package/dist/index44.js CHANGED
@@ -1,37 +1,40 @@
1
- import t, { useState as o, useRef as R, useEffect as C } from "react";
1
+ import t, { useState as o, useRef as $, useEffect as g } from "react";
2
2
  /* empty css */
3
- import c from "./index149.js";
4
- import { Icon as g } from "./index5.js";
5
- const O = ({
6
- onCountrycodeChange: E,
7
- onNumberChange: f,
3
+ import c from "./index151.js";
4
+ import { Icon as E } from "./index5.js";
5
+ const P = ({
6
+ onCountrycodeChange: f,
7
+ onNumberChange: N,
8
8
  error: m,
9
- errorMessage: N,
10
- value: s
9
+ errorMessage: v,
10
+ value: s,
11
+ label: u
11
12
  }) => {
12
- const [w, u] = o((s == null ? void 0 : s.countryCode) || c[0].dial_code), [r, i] = o(!1), [p, v] = o(c), [L, _] = o(""), [S, h] = o(""), l = R(null), a = c.find((e) => e.dial_code === w), b = (e) => {
13
- e && (u(e), E(e)), i(!1);
14
- }, V = (e) => {
13
+ const [w, p] = o((s == null ? void 0 : s.countryCode) || c[0].dial_code), [r, i] = o(!1), [h, L] = o(c), [_, S] = o(""), [b, C] = o(""), l = $(null), a = c.find((e) => e.dial_code === w), V = (e) => {
14
+ e && (p(e), f(e)), i(!1);
15
+ }, k = (e) => {
15
16
  const n = e.target.value;
16
- _(n);
17
- const y = c.filter((d) => d.name.toLowerCase().includes(n.toLowerCase()) || d.dial_code.toLowerCase().includes(n.toLowerCase()) || d.code.toLowerCase().includes(n.toLowerCase()));
18
- v(y);
17
+ S(n);
18
+ const R = c.filter((d) => d.name.toLowerCase().includes(n.toLowerCase()) || d.dial_code.toLowerCase().includes(n.toLowerCase()) || d.code.toLowerCase().includes(n.toLowerCase()));
19
+ L(R);
19
20
  };
20
- C(() => {
21
+ g(() => {
21
22
  const e = (n) => {
22
23
  l.current && !l.current.contains(n.target) && i(!1);
23
24
  };
24
25
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
25
- }, []), C(() => {
26
- s && (u(s.countryCode), h(s.number));
26
+ }, []), g(() => {
27
+ s && (p(s.countryCode), C(s.number));
27
28
  }, [s]);
28
- const k = (e) => {
29
+ const y = (e) => {
29
30
  const n = e.replace(/\D/g, "");
30
- console.log("numericValue", n), h(n), f(n);
31
+ console.log("numericValue", n), C(n), N(n);
31
32
  };
32
33
  return /* @__PURE__ */ t.createElement("div", {
33
34
  className: "phone-input-container-se-design-main-container"
34
- }, /* @__PURE__ */ t.createElement("div", {
35
+ }, u && /* @__PURE__ */ t.createElement("div", {
36
+ className: "label-container"
37
+ }, u), /* @__PURE__ */ t.createElement("div", {
35
38
  className: `phone-input-container-se-design-main ${m ? "error" : ""}`,
36
39
  ref: l
37
40
  }, /* @__PURE__ */ t.createElement("div", {
@@ -45,7 +48,7 @@ const O = ({
45
48
  src: `https://flagcdn.com/${a == null ? void 0 : a.code.toLowerCase()}.svg`,
46
49
  alt: a == null ? void 0 : a.name,
47
50
  width: "16"
48
- }), a == null ? void 0 : a.dial_code, /* @__PURE__ */ t.createElement(g, {
51
+ }), a == null ? void 0 : a.dial_code, /* @__PURE__ */ t.createElement(E, {
49
52
  name: "chevron",
50
53
  className: r ? "rotate-180" : ""
51
54
  })), /* @__PURE__ */ t.createElement("span", {
@@ -54,26 +57,26 @@ const O = ({
54
57
  type: "tel",
55
58
  placeholder: "Enter phone number",
56
59
  className: "phone-input-container-se-design-phone-number-input",
57
- onChange: (e) => k(e.target.value),
58
- value: S,
60
+ onChange: (e) => y(e.target.value),
61
+ value: b,
59
62
  pattern: "[0-9]*"
60
63
  })), r && /* @__PURE__ */ t.createElement("div", {
61
64
  className: "phone-input-container-se-design-country-code-list"
62
65
  }, /* @__PURE__ */ t.createElement("div", {
63
66
  className: "search-input-wrapper"
64
- }, /* @__PURE__ */ t.createElement(g, {
67
+ }, /* @__PURE__ */ t.createElement(E, {
65
68
  name: "search",
66
69
  className: "search-icon"
67
70
  }), /* @__PURE__ */ t.createElement("input", {
68
71
  type: "text",
69
72
  placeholder: "Search",
70
73
  className: "phone-input-container-se-design-country-code-list-item-input",
71
- onChange: V,
72
- value: L
73
- })), p.length > 0 ? p.map((e) => /* @__PURE__ */ t.createElement("div", {
74
+ onChange: k,
75
+ value: _
76
+ })), h.length > 0 ? h.map((e) => /* @__PURE__ */ t.createElement("div", {
74
77
  key: e.code,
75
78
  className: "phone-input-container-se-design-country-code-list-item",
76
- onClick: () => b(e.dial_code)
79
+ onClick: () => V(e.dial_code)
77
80
  }, /* @__PURE__ */ t.createElement("img", {
78
81
  src: `https://flagcdn.com/${e.code.toLowerCase()}.svg`,
79
82
  alt: e.name,
@@ -82,9 +85,9 @@ const O = ({
82
85
  className: "phone-input-container-se-design-country-code-list-item-no-resuts"
83
86
  }, "No results found"))), m && /* @__PURE__ */ t.createElement("div", {
84
87
  className: "error-message"
85
- }, N));
88
+ }, v));
86
89
  };
87
90
  export {
88
- O as PhoneInput
91
+ P as PhoneInput
89
92
  };
90
93
  //# sourceMappingURL=index44.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index44.js","sources":["../src/components/PhoneInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport './style.scss';\nimport countriesInfoJson from './countriesInfo.json';\nimport { Icon } from '../Icon';\n\nexport interface PhoneInputProps {\n onCountrycodeChange: (countryCode: string) => void;\n onNumberChange: (number: string) => void;\n error?: boolean;\n errorMessage?: string;\n value?: {\n countryCode: string;\n number: string;\n };\n}\n\nexport const PhoneInput: React.FC<PhoneInputProps> = ({\n onCountrycodeChange,\n onNumberChange,\n error,\n errorMessage,\n value\n}) => {\n const [countryCode, setCountryCode] = useState(value?.countryCode || countriesInfoJson[0].dial_code);\n const [displaySelectCountryCode, setDisplaySelectCountryCode] = useState(false);\n const [countriesInfo, setCountriesInfo] = useState(countriesInfoJson);\n const [searchValue, setSearchValue] = useState('');\n const [enteredNumber, setEnteredNumber] = useState('');\n const containerRef = useRef<HTMLDivElement>(null);\n\n const countryInfo = countriesInfoJson.find((country) => country.dial_code === countryCode);\n\n const handleCountryCodeSelect = (country: string) => {\n if (country) {\n setCountryCode(country);\n onCountrycodeChange(country);\n }\n setDisplaySelectCountryCode(false);\n };\n\n const handleCountryCodeSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n const searchValue = event.target.value;\n setSearchValue(searchValue);\n const filteredCountries = countriesInfoJson.filter(\n (country) =>\n country.name.toLowerCase().includes(searchValue.toLowerCase()) ||\n country.dial_code.toLowerCase().includes(searchValue.toLowerCase()) ||\n country.code.toLowerCase().includes(searchValue.toLowerCase())\n );\n setCountriesInfo(filteredCountries);\n };\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setDisplaySelectCountryCode(false);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, []);\n\n useEffect(() => {\n if (value) {\n setCountryCode(value.countryCode);\n setEnteredNumber(value.number);\n }\n }, [value]);\n\n const handleEnteredNumberChange = (value: string) => {\n const numericValue = value.replace(/\\D/g, ''); // Remove non-numeric characters\n console.log('numericValue', numericValue);\n setEnteredNumber(numericValue);\n onNumberChange(numericValue);\n };\n\n return (\n <div className=\"phone-input-container-se-design-main-container\">\n <div className={`phone-input-container-se-design-main ${error ? 'error' : ''}`} ref={containerRef}>\n <div className=\"phone-input-container-se-design\">\n <div\n className=\"phone-input-container-se-design-country-code\"\n onClick={() => {\n setDisplaySelectCountryCode(!displaySelectCountryCode);\n }}\n >\n <img\n src={`https://flagcdn.com/${countryInfo?.code.toLowerCase()}.svg`}\n alt={countryInfo?.name}\n width=\"16\"\n />\n {countryInfo?.dial_code}\n <Icon name=\"chevron\" className={!displaySelectCountryCode ? '' : 'rotate-180'} />\n </div>\n <span className=\"divider\" />\n <input\n type=\"tel\"\n placeholder=\"Enter phone number\"\n className=\"phone-input-container-se-design-phone-number-input\"\n onChange={(event) => handleEnteredNumberChange(event.target.value)}\n value={enteredNumber}\n pattern=\"[0-9]*\"\n />\n </div>\n\n {displaySelectCountryCode && (\n <div className=\"phone-input-container-se-design-country-code-list\">\n <div className=\"search-input-wrapper\">\n <Icon name=\"search\" className=\"search-icon\" />\n <input\n type=\"text\"\n placeholder=\"Search\"\n className=\"phone-input-container-se-design-country-code-list-item-input\"\n onChange={handleCountryCodeSearch}\n value={searchValue}\n />\n </div>\n {countriesInfo.length > 0 ? (\n countriesInfo.map((country) => (\n <div\n key={country.code}\n className=\"phone-input-container-se-design-country-code-list-item\"\n onClick={() => handleCountryCodeSelect(country.dial_code)}\n >\n <img src={`https://flagcdn.com/${country.code.toLowerCase()}.svg`} alt={country.name} width=\"16\" />\n <span>{country.name}</span>\n <span>({country.dial_code})</span>\n </div>\n ))\n ) : (\n <div className=\"phone-input-container-se-design-country-code-list-item-no-resuts\">No results found</div>\n )}\n </div>\n )}\n </div>\n {error && <div className=\"error-message\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["PhoneInput","onCountrycodeChange","onNumberChange","error","errorMessage","value","countryCode","setCountryCode","useState","countriesInfoJson","dial_code","displaySelectCountryCode","setDisplaySelectCountryCode","countriesInfo","setCountriesInfo","searchValue","setSearchValue","enteredNumber","setEnteredNumber","containerRef","useRef","countryInfo","find","country","handleCountryCodeSelect","handleCountryCodeSearch","event","target","filteredCountries","filter","name","toLowerCase","includes","code","useEffect","handleClickOutside","current","contains","addEventListener","document","removeEventListener","number","handleEnteredNumberChange","numericValue","replace","log","React","createElement","className","ref","onClick","src","alt","width","Icon","type","placeholder","onChange","pattern","length","map","key"],"mappings":";;;;AAgBO,MAAMA,IAAwCA,CAAC;AAAA,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+ {"version":3,"file":"index44.js","sources":["../src/components/PhoneInput/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport './style.scss';\nimport countriesInfoJson from './countriesInfo.json';\nimport { Icon } from '../Icon';\n\nexport interface PhoneInputProps {\n onCountrycodeChange: (countryCode: string) => void;\n onNumberChange: (number: string) => void;\n error?: boolean;\n errorMessage?: string;\n value?: {\n countryCode: string;\n number: string;\n };\n label?: string;\n}\n\nexport const PhoneInput: React.FC<PhoneInputProps> = ({\n onCountrycodeChange,\n onNumberChange,\n error,\n errorMessage,\n value,\n label\n}) => {\n const [countryCode, setCountryCode] = useState(value?.countryCode || countriesInfoJson[0].dial_code);\n const [displaySelectCountryCode, setDisplaySelectCountryCode] = useState(false);\n const [countriesInfo, setCountriesInfo] = useState(countriesInfoJson);\n const [searchValue, setSearchValue] = useState('');\n const [enteredNumber, setEnteredNumber] = useState('');\n const containerRef = useRef<HTMLDivElement>(null);\n\n const countryInfo = countriesInfoJson.find((country) => country.dial_code === countryCode);\n\n const handleCountryCodeSelect = (country: string) => {\n if (country) {\n setCountryCode(country);\n onCountrycodeChange(country);\n }\n setDisplaySelectCountryCode(false);\n };\n\n const handleCountryCodeSearch = (event: React.ChangeEvent<HTMLInputElement>) => {\n const searchValue = event.target.value;\n setSearchValue(searchValue);\n const filteredCountries = countriesInfoJson.filter(\n (country) =>\n country.name.toLowerCase().includes(searchValue.toLowerCase()) ||\n country.dial_code.toLowerCase().includes(searchValue.toLowerCase()) ||\n country.code.toLowerCase().includes(searchValue.toLowerCase())\n );\n setCountriesInfo(filteredCountries);\n };\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setDisplaySelectCountryCode(false);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, []);\n\n useEffect(() => {\n if (value) {\n setCountryCode(value.countryCode);\n setEnteredNumber(value.number);\n }\n }, [value]);\n\n const handleEnteredNumberChange = (value: string) => {\n const numericValue = value.replace(/\\D/g, ''); // Remove non-numeric characters\n console.log('numericValue', numericValue);\n setEnteredNumber(numericValue);\n onNumberChange(numericValue);\n };\n\n return (\n <div className=\"phone-input-container-se-design-main-container\">\n {label && <div className=\"label-container\">{label}</div>}\n <div className={`phone-input-container-se-design-main ${error ? 'error' : ''}`} ref={containerRef}>\n <div className=\"phone-input-container-se-design\">\n <div\n className=\"phone-input-container-se-design-country-code\"\n onClick={() => {\n setDisplaySelectCountryCode(!displaySelectCountryCode);\n }}\n >\n <img\n src={`https://flagcdn.com/${countryInfo?.code.toLowerCase()}.svg`}\n alt={countryInfo?.name}\n width=\"16\"\n />\n {countryInfo?.dial_code}\n <Icon name=\"chevron\" className={!displaySelectCountryCode ? '' : 'rotate-180'} />\n </div>\n <span className=\"divider\" />\n <input\n type=\"tel\"\n placeholder=\"Enter phone number\"\n className=\"phone-input-container-se-design-phone-number-input\"\n onChange={(event) => handleEnteredNumberChange(event.target.value)}\n value={enteredNumber}\n pattern=\"[0-9]*\"\n />\n </div>\n\n {displaySelectCountryCode && (\n <div className=\"phone-input-container-se-design-country-code-list\">\n <div className=\"search-input-wrapper\">\n <Icon name=\"search\" className=\"search-icon\" />\n <input\n type=\"text\"\n placeholder=\"Search\"\n className=\"phone-input-container-se-design-country-code-list-item-input\"\n onChange={handleCountryCodeSearch}\n value={searchValue}\n />\n </div>\n {countriesInfo.length > 0 ? (\n countriesInfo.map((country) => (\n <div\n key={country.code}\n className=\"phone-input-container-se-design-country-code-list-item\"\n onClick={() => handleCountryCodeSelect(country.dial_code)}\n >\n <img src={`https://flagcdn.com/${country.code.toLowerCase()}.svg`} alt={country.name} width=\"16\" />\n <span>{country.name}</span>\n <span>({country.dial_code})</span>\n </div>\n ))\n ) : (\n <div className=\"phone-input-container-se-design-country-code-list-item-no-resuts\">No results found</div>\n )}\n </div>\n )}\n </div>\n {error && <div className=\"error-message\">{errorMessage}</div>}\n </div>\n );\n};\n"],"names":["PhoneInput","onCountrycodeChange","onNumberChange","error","errorMessage","value","label","countryCode","setCountryCode","useState","countriesInfoJson","dial_code","displaySelectCountryCode","setDisplaySelectCountryCode","countriesInfo","setCountriesInfo","searchValue","setSearchValue","enteredNumber","setEnteredNumber","containerRef","useRef","countryInfo","find","country","handleCountryCodeSelect","handleCountryCodeSearch","event","target","filteredCountries","filter","name","toLowerCase","includes","code","useEffect","handleClickOutside","current","contains","addEventListener","document","removeEventListener","number","handleEnteredNumberChange","numericValue","replace","log","React","createElement","className","ref","onClick","src","alt","width","Icon","type","placeholder","onChange","pattern","length","map","key"],"mappings":";;;;AAiBO,MAAMA,IAAwCA,CAAC;AAAA,EACpDC,qBAAAA;AAAAA,EACAC,gBAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,cAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,OAAAA;AACF,MAAM;AACE,QAAA,CAACC,GAAaC,CAAc,IAAIC,GAASJ,KAAAA,gBAAAA,EAAOE,gBAAeG,EAAkB,CAAC,EAAEC,SAAS,GAC7F,CAACC,GAA0BC,CAA2B,IAAIJ,EAAS,EAAK,GACxE,CAACK,GAAeC,CAAgB,IAAIN,EAASC,CAAiB,GAC9D,CAACM,GAAaC,CAAc,IAAIR,EAAS,EAAE,GAC3C,CAACS,GAAeC,CAAgB,IAAIV,EAAS,EAAE,GAC/CW,IAAeC,EAAuB,IAAI,GAE1CC,IAAcZ,EAAkBa,KAAMC,CAAYA,MAAAA,EAAQb,cAAcJ,CAAW,GAEnFkB,IAA0BA,CAACD,MAAoB;AACnD,IAAIA,MACFhB,EAAegB,CAAO,GACtBvB,EAAoBuB,CAAO,IAE7BX,EAA4B,EAAK;AAAA,EACnC,GAEMa,IAA0BA,CAACC,MAA+C;AACxEX,UAAAA,IAAcW,EAAMC,OAAOvB;AACjCY,IAAAA,EAAeD,CAAW;AAC1B,UAAMa,IAAoBnB,EAAkBoB,OACzCN,CAAAA,MACCA,EAAQO,KA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