@bikdotai/bik-component-library 0.0.138 → 0.0.140

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 (38) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/assets/icons/file.svg.js +1 -0
  3. package/dist/cjs/assets/icons/upload.svg.js +1 -0
  4. package/dist/cjs/components/buttonGroup/ButtonGroup.d.ts +19 -0
  5. package/dist/cjs/components/buttonGroup/ButtonGroup.js +1 -0
  6. package/dist/cjs/components/buttonGroup/ButtonGroupStyle.d.ts +10 -0
  7. package/dist/cjs/components/buttonGroup/ButtonGroupStyle.js +32 -0
  8. package/dist/cjs/components/buttonGroup/index.d.ts +1 -0
  9. package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +1 -0
  10. package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
  11. package/dist/cjs/components/country-code-picker/CountryCodePicker.styled.d.ts +2 -0
  12. package/dist/cjs/components/country-code-picker/CountryCodePicker.styled.js +1 -1
  13. package/dist/cjs/components/file-uploader/FileUploader.d.ts +1 -2
  14. package/dist/cjs/components/file-uploader/FileUploader.js +1 -0
  15. package/dist/cjs/components/file-uploader/FileUploaderStyle.js +3 -3
  16. package/dist/cjs/components/input/Input.js +1 -1
  17. package/dist/cjs/components/input/Input.styled.js +1 -1
  18. package/dist/cjs/index.d.ts +1 -0
  19. package/dist/cjs/index.js +1 -1
  20. package/dist/esm/assets/icons/file.svg.js +1 -0
  21. package/dist/esm/assets/icons/upload.svg.js +1 -0
  22. package/dist/esm/components/buttonGroup/ButtonGroup.d.ts +19 -0
  23. package/dist/esm/components/buttonGroup/ButtonGroup.js +1 -0
  24. package/dist/esm/components/buttonGroup/ButtonGroupStyle.d.ts +10 -0
  25. package/dist/esm/components/buttonGroup/ButtonGroupStyle.js +32 -0
  26. package/dist/esm/components/buttonGroup/index.d.ts +1 -0
  27. package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +1 -0
  28. package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
  29. package/dist/esm/components/country-code-picker/CountryCodePicker.styled.d.ts +2 -0
  30. package/dist/esm/components/country-code-picker/CountryCodePicker.styled.js +1 -1
  31. package/dist/esm/components/file-uploader/FileUploader.d.ts +1 -2
  32. package/dist/esm/components/file-uploader/FileUploader.js +1 -0
  33. package/dist/esm/components/file-uploader/FileUploaderStyle.js +3 -3
  34. package/dist/esm/components/input/Input.js +1 -1
  35. package/dist/esm/components/input/Input.styled.js +1 -1
  36. package/dist/esm/index.d.ts +1 -0
  37. package/dist/esm/index.js +1 -1
  38. package/package.json +1 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @boilertown/react-ui-boilerplate
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 93e5422: First release ever!
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}var a=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32"},e),t||(t=r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 4c-.736 0-1.333.597-1.333 1.333v21.334C6.667 27.403 7.264 28 8 28h16c.736 0 1.333-.597 1.333-1.333V13.333H20a4 4 0 0 1-4-4V4H8Zm10.667 1.886 4.78 4.78H20a1.333 1.333 0 0 1-1.333-1.332V5.886ZM4 5.333a4 4 0 0 1 4-4h9.886L28 11.448v15.219a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4V5.333Z",clipRule:"evenodd"})));exports.default=a;
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r,a=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},n.apply(this,arguments)}var l=e=>a.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 18"},e),t||(t=a.createElement("path",{fill:"currentColor",d:"M9.09.911a.833.833 0 0 0-1.18 0L3.745 5.078a.833.833 0 1 0 1.179 1.178l2.744-2.744V11.5a.833.833 0 1 0 1.666 0V3.512l2.744 2.744a.833.833 0 1 0 1.179-1.178L9.089.91Z"})),r||(r=a.createElement("path",{fill:"currentColor",d:"M1.833 11.5a.833.833 0 0 0-1.666 0v3.334a2.5 2.5 0 0 0 2.5 2.5h11.666a2.5 2.5 0 0 0 2.5-2.5V11.5a.833.833 0 0 0-1.666 0v3.334a.833.833 0 0 1-.834.833H2.667a.833.833 0 0 1-.834-.833V11.5Z"})));exports.default=l;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export interface ButtonGroupInterface {
3
+ id: string;
4
+ title: string;
5
+ icon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
6
+ }
7
+ export interface ButtonGroupProps {
8
+ id?: string;
9
+ width?: string;
10
+ gap?: string;
11
+ iconWidth?: string;
12
+ iconHeight?: string;
13
+ iconPosition?: 'left' | 'right' | 'top';
14
+ onButtonClick: (buttonId: string) => void;
15
+ activeButtonId?: string;
16
+ buttonGroup: Array<ButtonGroupInterface>;
17
+ size: 'small' | 'medium' | 'large';
18
+ }
19
+ export declare const ButtonGroup: React.FC<ButtonGroupProps>;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react/jsx-runtime"),t=require("react"),e=require("../TypographyStyle.js"),n=require("../../constants/Theme.js"),o=require("./ButtonGroupStyle.js");exports.ButtonGroup=s=>{const[r,c]=t.useState(void 0);t.useEffect((()=>{c((null==s?void 0:s.activeButtonId)||void 0)}),[null==s?void 0:s.activeButtonId]);return i.jsx(o.ButtonGroupStyle,Object.assign({className:"button-group",width:s.width||"100%",gap:null==s?void 0:s.gap,size:null==s?void 0:s.size},{children:s.buttonGroup.map((t=>{const u=null==t?void 0:t.icon;return i.jsxs(o.Button,Object.assign({className:"button",isActive:r===t.id,onClick:()=>(i=>{c(i.id),s.onButtonClick(i.id)})(t),iconPosition:null==s?void 0:s.iconPosition,size:null==s?void 0:s.size},{children:[(null==s?void 0:s.iconPosition)&&u&&i.jsx("div",Object.assign({className:"button__image"},{children:i.jsx(u,{color:r===t.id?n.COLORS.background.inverseLight:n.COLORS.content.secondary,width:(null==s?void 0:s.iconWidth)||"18px",height:(null==s?void 0:s.iconHeight)||"18px"})})),i.jsx("div",Object.assign({className:"button__name"},{children:i.jsx(e.BodySecondary,Object.assign({style:{color:r===t.id?n.COLORS.background.inverseLight:n.COLORS.content.secondary}},{children:t.title}))}))]}),t.id)}))}))};
@@ -0,0 +1,10 @@
1
+ export declare const ButtonGroupStyle: import("styled-components").StyledComponent<"div", any, {
2
+ width: string | undefined;
3
+ size: 'small' | 'medium' | 'large';
4
+ gap: string | undefined;
5
+ }, never>;
6
+ export declare const Button: import("styled-components").StyledComponent<"div", any, {
7
+ isActive: boolean;
8
+ iconPosition?: "left" | "right" | "top" | undefined;
9
+ size: 'small' | 'medium' | 'large';
10
+ }, never>;
@@ -0,0 +1,32 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),i=require("../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e);const n={small:"8px 12px",medium:"10px 12px",large:"14px 12px"},r={small:"36px",medium:"40px",large:"48px"},l=o.default.div`
2
+ display: flex;
3
+ flex-direction: row;
4
+ width: ${e=>(null==e?void 0:e.width)||"100%"};
5
+ height: ${e=>(null==e?void 0:e.size)?r[e.size]:"36px"};
6
+ gap: ${e=>(null==e?void 0:e.gap)||"12px"};
7
+ `,s=o.default.div`
8
+ display: flex;
9
+ flex-direction: ${e=>(null==e?void 0:e.iconPosition)&&"top"!==e.iconPosition?"left"===e.iconPosition?"row":"row-reverse":"column"};
10
+ flex: 1;
11
+ height: 100%;
12
+ background: ${e=>(null==e?void 0:e.isActive)?i.COLORS.background.brandLight:i.COLORS.surface.subdued};
13
+ border: 1px solid
14
+ ${e=>(null==e?void 0:e.isActive)?i.COLORS.background.inverseLight:i.COLORS.stroke.primary};
15
+ border-radius: 4px;
16
+ align-items: center;
17
+ justify-content: center;
18
+ padding: ${e=>(null==e?void 0:e.size)?n[e.size]:"8px 10px"};
19
+ gap: ${e=>(null==e?void 0:e.iconPosition)&&"top"!==e.iconPosition?"10px":"2px"};
20
+ .button {
21
+ align-items: center;
22
+ justify-content: center;
23
+ &__image {
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ }
28
+ }
29
+ :hover {
30
+ cursor: pointer;
31
+ }
32
+ `;exports.Button=s,exports.ButtonGroupStyle=l;
@@ -0,0 +1 @@
1
+ export * from './ButtonGroup';
@@ -4,4 +4,5 @@ export declare const CountryCodePicker: React.FC<{
4
4
  onCountrySelect: (country: CountryCode) => void;
5
5
  selectedCountry: CountryCode;
6
6
  popoverWidth?: string;
7
+ height?: string;
7
8
  }>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/chevronDown.svg.js"),r=require("react"),n=require("./CountryCodePicker.modal.js"),t=require("./CountryCodePicker.styled.js");require("../dropdown/Dropdown.js");var s=require("../dropdown/DropdownPopover/index.js");require("../zeroState/ZeroState.js");var d=require("../TypographyStyle.js"),i=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../dropdown/OpenedDropdown/components/menu/SelectAllMenu.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");exports.CountryCodePicker=c=>{var p,u;const[l,a]=r.useState(null!==(p=c.selectedCountry)&&void 0!==p?p:{name:"India",dial:"+91",code:"IN"}),m=`https://flagcdn.com/${l.code.toLowerCase()}.svg`;return e.jsx(s.DropdownPopover,Object.assign({width:null!==(u=c.popoverWidth)&&void 0!==u?u:"130px",placement:"bottom-start",options:n.CountriesData.map((o=>{const r=`https://flagcdn.com/${o.code.toLowerCase()}.svg`;return{value:o.code,label:o.dial,customComponent:e.jsxs(t.StyledCountryPickerOption,{children:[e.jsx("img",{src:r,className:"country-flag__option",alt:o.name}),e.jsx(d.BodySecondary,{children:o.dial})]}),selected:l.code===o.code}})),onSelect:e=>{const o=n.CountriesData.filter((o=>o.code===e.value));a(o[0]),c.onCountrySelect(o[0])}},{children:e.jsxs(t.StyledCountryPickerWrapper,{children:[e.jsxs("div",Object.assign({className:"content__wrapper"},{children:[e.jsx("img",{src:m,className:"country-flag__selected-option",alt:l.name}),e.jsx(d.BodySecondary,{children:l.dial})]})),e.jsx(o.default,{width:24,height:24,color:i.COLORS.content.primary})]})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/chevronDown.svg.js"),r=require("react"),n=require("./CountryCodePicker.modal.js"),t=require("./CountryCodePicker.styled.js");require("../dropdown/Dropdown.js");var s=require("../dropdown/DropdownPopover/index.js");require("../zeroState/ZeroState.js");var d=require("../TypographyStyle.js"),i=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../dropdown/OpenedDropdown/components/menu/SelectAllMenu.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");exports.CountryCodePicker=c=>{var p,u,l;const[a,m]=r.useState(null!==(p=c.selectedCountry)&&void 0!==p?p:{name:"India",dial:"+91",code:"IN"}),j=`https://flagcdn.com/${null===(u=a.code)||void 0===u?void 0:u.toLowerCase()}.svg`;return e.jsx(s.DropdownPopover,Object.assign({width:null!==(l=c.popoverWidth)&&void 0!==l?l:"130px",placement:"bottom-start",options:n.CountriesData.map((o=>{var r;const n=`https://flagcdn.com/${null===(r=o.code)||void 0===r?void 0:r.toLowerCase()}.svg`;return{value:o.code,label:o.dial,customComponent:e.jsxs(t.StyledCountryPickerOption,{children:[e.jsx("img",{src:n,className:"country-flag__option",alt:o.name}),e.jsx(d.BodySecondary,{children:o.dial})]}),selected:a.code===o.code}})),onSelect:e=>{const o=n.CountriesData.filter((o=>o.code===e.value));m(o[0]),c.onCountrySelect(o[0])}},{children:e.jsxs(t.StyledCountryPickerWrapper,Object.assign({height:c.height},{children:[e.jsxs("div",Object.assign({className:"content__wrapper"},{children:[e.jsx("img",{src:j,className:"country-flag__selected-option",alt:a.name}),e.jsx(d.BodySecondary,{children:a.dial})]})),e.jsx(o.default,{width:24,height:24,color:i.COLORS.content.primary})]}))}))};
@@ -6,4 +6,6 @@ export declare const StyledCountryPickerOption: import("@emotion/styled").Styled
6
6
  export declare const StyledCountryPickerWrapper: import("@emotion/styled").StyledComponent<{
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
8
  as?: import("react").ElementType<any> | undefined;
9
+ } & {
10
+ height?: string | undefined;
9
11
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var l=require("@emotion/styled/base"),c=require("../../constants/Theme.js");function e(l){return l&&"object"==typeof l&&"default"in l?l:{default:l}}var t=e(l);const d=t.default("div","production"===process.env.NODE_ENV?{target:"efxlby21"}:{target:"efxlby21",label:"StyledCountryPickerOption"})("production"===process.env.NODE_ENV?{name:"bx4jlo",styles:"display:flex;align-items:center;gap:8px;.country-flag__option{width:24px;height:auto;}"}:{name:"bx4jlo",styles:"display:flex;align-items:center;gap:8px;.country-flag__option{width:24px;height:auto;}",map:"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRW9EIiwiZmlsZSI6IkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmltcG9ydCB7IENPTE9SUyB9IGZyb20gXCIuLi8uLi9jb25zdGFudHMvVGhlbWVcIjtcclxuZXhwb3J0IGNvbnN0IFN0eWxlZENvdW50cnlQaWNrZXJPcHRpb24gPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0YWxpZ24taXRlbXM6IGNlbnRlcjtcblx0Z2FwOiA4cHg7XG5cblx0LmNvdW50cnktZmxhZ19fb3B0aW9uIHtcblx0XHR3aWR0aDogMjRweDtcblx0XHRoZWlnaHQ6IGF1dG87XG5cdH1cbmA7XHJcbmV4cG9ydCBjb25zdCBTdHlsZWRDb3VudHJ5UGlja2VyV3JhcHBlciA9IHN0eWxlZC5kaXYgYFxuXHRkaXNwbGF5OiBmbGV4O1xuXHRqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cdGdhcDogOHB4O1xuXHRib3JkZXItcmFkaXVzOiA0cHg7XG5cdGJvcmRlcjogMXB4IHNvbGlkICR7Q09MT1JTLnN0cm9rZS5wcmltYXJ5fTtcblx0cGFkZGluZzogNnB4IDhweDtcblxuXHQuY29udGVudF9fd3JhcHBlciB7XG5cdFx0ZGlzcGxheTogZmxleDtcblx0XHRnYXA6IDhweDtcblx0fVxuXG5cdC5jb3VudHJ5LWZsYWdfX3NlbGVjdGVkLW9wdGlvbiB7XG5cdFx0d2lkdGg6IDI0cHg7XG5cdFx0aGVpZ2h0OiBhdXRvO1xuXHR9XG5gO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1Db3VudHJ5Q29kZVBpY2tlci5zdHlsZWQuanMubWFwIl19 */",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),b=t.default("div","production"===process.env.NODE_ENV?{target:"efxlby20"}:{target:"efxlby20",label:"StyledCountryPickerWrapper"})("display:flex;justify-content:space-between;align-items:center;gap:8px;border-radius:4px;border:1px solid ",c.COLORS.stroke.primary,";padding:6px 8px;.content__wrapper{display:flex;gap:8px;}.country-flag__selected-option{width:24px;height:auto;}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBWXFEIiwiZmlsZSI6IkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmltcG9ydCB7IENPTE9SUyB9IGZyb20gXCIuLi8uLi9jb25zdGFudHMvVGhlbWVcIjtcclxuZXhwb3J0IGNvbnN0IFN0eWxlZENvdW50cnlQaWNrZXJPcHRpb24gPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0YWxpZ24taXRlbXM6IGNlbnRlcjtcblx0Z2FwOiA4cHg7XG5cblx0LmNvdW50cnktZmxhZ19fb3B0aW9uIHtcblx0XHR3aWR0aDogMjRweDtcblx0XHRoZWlnaHQ6IGF1dG87XG5cdH1cbmA7XHJcbmV4cG9ydCBjb25zdCBTdHlsZWRDb3VudHJ5UGlja2VyV3JhcHBlciA9IHN0eWxlZC5kaXYgYFxuXHRkaXNwbGF5OiBmbGV4O1xuXHRqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cdGdhcDogOHB4O1xuXHRib3JkZXItcmFkaXVzOiA0cHg7XG5cdGJvcmRlcjogMXB4IHNvbGlkICR7Q09MT1JTLnN0cm9rZS5wcmltYXJ5fTtcblx0cGFkZGluZzogNnB4IDhweDtcblxuXHQuY29udGVudF9fd3JhcHBlciB7XG5cdFx0ZGlzcGxheTogZmxleDtcblx0XHRnYXA6IDhweDtcblx0fVxuXG5cdC5jb3VudHJ5LWZsYWdfX3NlbGVjdGVkLW9wdGlvbiB7XG5cdFx0d2lkdGg6IDI0cHg7XG5cdFx0aGVpZ2h0OiBhdXRvO1xuXHR9XG5gO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1Db3VudHJ5Q29kZVBpY2tlci5zdHlsZWQuanMubWFwIl19 */"));exports.StyledCountryPickerOption=d,exports.StyledCountryPickerWrapper=b;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var c=require("@emotion/styled/base"),l=require("../../constants/Theme.js");function e(c){return c&&"object"==typeof c&&"default"in c?c:{default:c}}var t=e(c);const d=t.default("div","production"===process.env.NODE_ENV?{target:"efxlby21"}:{target:"efxlby21",label:"StyledCountryPickerOption"})("production"===process.env.NODE_ENV?{name:"bx4jlo",styles:"display:flex;align-items:center;gap:8px;.country-flag__option{width:24px;height:auto;}"}:{name:"bx4jlo",styles:"display:flex;align-items:center;gap:8px;.country-flag__option{width:24px;height:auto;}",map:"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRW9EIiwiZmlsZSI6IkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmltcG9ydCB7IENPTE9SUyB9IGZyb20gXCIuLi8uLi9jb25zdGFudHMvVGhlbWVcIjtcclxuZXhwb3J0IGNvbnN0IFN0eWxlZENvdW50cnlQaWNrZXJPcHRpb24gPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0YWxpZ24taXRlbXM6IGNlbnRlcjtcblx0Z2FwOiA4cHg7XG5cblx0LmNvdW50cnktZmxhZ19fb3B0aW9uIHtcblx0XHR3aWR0aDogMjRweDtcblx0XHRoZWlnaHQ6IGF1dG87XG5cdH1cbmA7XHJcbmV4cG9ydCBjb25zdCBTdHlsZWRDb3VudHJ5UGlja2VyV3JhcHBlciA9IHN0eWxlZC5kaXYgYFxuXHRkaXNwbGF5OiBmbGV4O1xuXHRqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cdGdhcDogOHB4O1xuXHRib3JkZXItcmFkaXVzOiA0cHg7XG5cdGJvcmRlcjogMXB4IHNvbGlkICR7Q09MT1JTLnN0cm9rZS5wcmltYXJ5fTtcblx0cGFkZGluZzogNnB4IDhweDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gcHJvcHMuaGVpZ2h0fTtcblxuXHQuY29udGVudF9fd3JhcHBlciB7XG5cdFx0ZGlzcGxheTogZmxleDtcblx0XHRnYXA6IDhweDtcblx0fVxuXG5cdC5jb3VudHJ5LWZsYWdfX3NlbGVjdGVkLW9wdGlvbiB7XG5cdFx0d2lkdGg6IDI0cHg7XG5cdFx0aGVpZ2h0OiBhdXRvO1xuXHR9XG5gO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1Db3VudHJ5Q29kZVBpY2tlci5zdHlsZWQuanMubWFwIl19 */",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),b=t.default("div","production"===process.env.NODE_ENV?{target:"efxlby20"}:{target:"efxlby20",label:"StyledCountryPickerWrapper"})("display:flex;justify-content:space-between;align-items:center;gap:8px;border-radius:4px;border:1px solid ",l.COLORS.stroke.primary,";padding:6px 8px;height:",(c=>c.height),";.content__wrapper{display:flex;gap:8px;}.country-flag__selected-option{width:24px;height:auto;}"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBWXFEIiwiZmlsZSI6IkNvdW50cnlDb2RlUGlja2VyLnN0eWxlZC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmltcG9ydCB7IENPTE9SUyB9IGZyb20gXCIuLi8uLi9jb25zdGFudHMvVGhlbWVcIjtcclxuZXhwb3J0IGNvbnN0IFN0eWxlZENvdW50cnlQaWNrZXJPcHRpb24gPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0YWxpZ24taXRlbXM6IGNlbnRlcjtcblx0Z2FwOiA4cHg7XG5cblx0LmNvdW50cnktZmxhZ19fb3B0aW9uIHtcblx0XHR3aWR0aDogMjRweDtcblx0XHRoZWlnaHQ6IGF1dG87XG5cdH1cbmA7XHJcbmV4cG9ydCBjb25zdCBTdHlsZWRDb3VudHJ5UGlja2VyV3JhcHBlciA9IHN0eWxlZC5kaXYgYFxuXHRkaXNwbGF5OiBmbGV4O1xuXHRqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5cdGdhcDogOHB4O1xuXHRib3JkZXItcmFkaXVzOiA0cHg7XG5cdGJvcmRlcjogMXB4IHNvbGlkICR7Q09MT1JTLnN0cm9rZS5wcmltYXJ5fTtcblx0cGFkZGluZzogNnB4IDhweDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gcHJvcHMuaGVpZ2h0fTtcblxuXHQuY29udGVudF9fd3JhcHBlciB7XG5cdFx0ZGlzcGxheTogZmxleDtcblx0XHRnYXA6IDhweDtcblx0fVxuXG5cdC5jb3VudHJ5LWZsYWdfX3NlbGVjdGVkLW9wdGlvbiB7XG5cdFx0d2lkdGg6IDI0cHg7XG5cdFx0aGVpZ2h0OiBhdXRvO1xuXHR9XG5gO1xyXG4vLyMgc291cmNlTWFwcGluZ1VSTD1Db3VudHJ5Q29kZVBpY2tlci5zdHlsZWQuanMubWFwIl19 */"));exports.StyledCountryPickerOption=d,exports.StyledCountryPickerWrapper=b;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
2
  import { FileUploaderProps } from "./Models";
3
- declare const FileUploader: React.FC<FileUploaderProps>;
4
- export default FileUploader;
3
+ export declare const FileUploader: React.FC<FileUploaderProps>;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),l=require("../button/Button.js"),i=require("../curtain/Curtain.js"),t=require("../curtain/CurtainHelper.js"),a=require("./FileUploaderStyle.js"),o=require("../input/Input.js"),d=require("../progress-bar/ProgressBarComponent.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),c=require("../../constants/Theme.js"),u=require("../../assets/icons/check.svg.js"),p=require("../../assets/icons/file.svg.js"),j=require("../../assets/icons/filePdf.svg.js"),h=require("../../assets/icons/image.svg.js"),v=require("../../assets/icons/triangle_error.svg.js"),f=require("../../assets/icons/upload.svg.js"),_=require("../../assets/icons/videoRecorder.svg.js");const g={PDF:"PDF",JPG:"IMAGE",JPEG:"IMAGE",PNG:"IMAGE",GIF:"IMAGE",SVG:"IMAGE",MP4:"VIDEO",MKV:"VIDEO",AVI:"VIDEO",WMV:"VIDEO",FILE:"FILE"};exports.FileUploader=b=>{var x,m;const[y,O]=s.useState(""),[U,w]=s.useState(""),[N,C]=s.useState(null),[S,I]=s.useState(!1),[F,L]=s.useState(),[T,E]=s.useState((null===(x=b.fileUploadRules.allowedFormats.split(",").map((e=>{var s,l;return null===(l=null===(s=null==e?void 0:e.split("/"))||void 0===s?void 0:s.at(-1))||void 0===l?void 0:l.toUpperCase()})))||void 0===x?void 0:x.join("/"))||"FILE"),M=e=>{const s=e.split(".").pop();if(null==b?void 0:b.fileName)return`${b.fileName}.${s}`;const l=new Date;return e.split(".")[0]+"_"+l.getTime().toString()+"."+s},R=e=>{if(!e)return"0 Bytes";const s=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,s)).toFixed(2))} ${["Bytes","KB","MB"][s]}`},P=e=>{var s;O("");const l=null===(s=null==e?void 0:e.files)||void 0===s?void 0:s[0],i=(e=>{if(!e)return"Please upload an file before saving!";const s=b.fileUploadRules.allowedSize[e.type.toLowerCase()];return s?e.size>s?`Max file size that can be added is ${R(s)}`:"":"Uploaded file type is not supported!"})(l);O(i),i?b.onError(i):(C(l),q(l),I(!0))},q=e=>{var s,l;if(!y){const i=M(e.name),t=(null===(s=i.split(".").at(-1))||void 0===s?void 0:s.toUpperCase())||"FILE";E(t),null===(l=b.uploadFile)||void 0===l||l.call(b,e,i).then((s=>{const l=((e,s,l)=>{const i=new Date;return{fileId:i.getTime().toString(),fileName:l,fileSize:R(e.size),fileType:e.type,fileUrl:s,uploadType:"FileUpload",uploadDate:i}})(e,s,i);I(!1),L(l)})).catch((e=>{const s=(null==e?void 0:e.message)||"Unknown technical error occured while uploading file!";b.onError(s)}))}},B=e=>{var s;e&&((e=>{try{return new URL(e),!0}catch(e){return!1}})(e)?null===(s=b.getFileMetaFromUrl)||void 0===s||s.call(b,e).then((s=>{var l,i;if(s&&s.type&&(null===(l=s.type.split("/").at(-1))||void 0===l?void 0:l.toLowerCase())===T.toLowerCase()){const l=b.fileUploadRules.allowedSize[s.type.toLowerCase()];if(l)if(s.size>l)w(`Max file size that can be added is ${R(l)}`);else{const l=(null===(i=s.type.split("/").at(-1))||void 0===i?void 0:i.toUpperCase())||"FILE";E(l);const t=M(`file.${l.toLowerCase()}`),a=new Date;L({fileId:a.getTime().toString(),fileName:t,fileSize:R(s.size),fileType:s.type,fileUrl:e,uploadType:"URL",uploadDate:a}),C(null)}else w("Uploaded file type is not supported!")}else w(`Please enter a valid ${T.toLowerCase()} URL`)}),(e=>{var s;return w(null!==(s=null==e?void 0:e.message)&&void 0!==s?s:"Please enter a valid image URL")})):w(`Please enter a valid ${T.toLowerCase()} URL`))},D=(s,l,i)=>"IMAGE"===g[T]?e.jsx(h.default,{color:s,height:l,width:i}):"VIDEO"===g[T]?e.jsx(_.default,{color:s,height:l,width:i}):"PDF"===g[T]?e.jsx(j.default,{color:s,height:l,width:i}):e.jsx(p.default,{color:s,height:l,width:i});return e.jsx(e.Fragment,{children:F&&(null===(m=Object.keys(F))||void 0===m?void 0:m.length)?e.jsxs(a.FileUploadedStyle,Object.assign({className:"fileUploaded"},{children:[e.jsxs("div",Object.assign({className:"fileUploaded__header"},{children:[e.jsx("div",Object.assign({className:"fileUploaded__header__icon"},{children:e.jsx(u.default,{color:c.COLORS.content.primaryInverse,height:46,width:40})})),e.jsx("div",Object.assign({className:"fileUploaded__header__title"},{children:e.jsxs(n.TitleMedium,{children:[T," uploaded successfully"]})}))]})),e.jsxs("div",Object.assign({className:"fileUploaded__body"},{children:[e.jsxs("div",Object.assign({className:"fileUploaded__body__file-detail"},{children:[e.jsx("div",Object.assign({className:"fileUploaded__body__file-detail__icon"},{children:D(c.COLORS.content.secondary,22,18)})),e.jsx("div",Object.assign({className:"fileUploaded__body__file-detail__name"},{children:e.jsx(n.BodySecondary,Object.assign({style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},{children:null==F?void 0:F.fileName}))})),e.jsx("div",Object.assign({className:"fileUploaded__body__file-detail__size"},{children:null==F?void 0:F.fileSize}))]})),e.jsxs("div",Object.assign({className:"fileUploaded__body__buttons"},{children:[e.jsx("div",Object.assign({className:"fileUploaded__body__buttons__edit"},{children:e.jsx(l.Button,{buttonText:"Edit",buttonType:"secondary",matchParentWidth:!0,onClick:()=>{var e;L({}),null===(e=b.fileUploadRules.allowedFormats.split(",").map((e=>{var s,l;return null===(l=null===(s=null==e?void 0:e.split("/"))||void 0===s?void 0:s.at(-1))||void 0===l?void 0:l.toUpperCase()})))||void 0===e||e.join("/")}})})),e.jsx("div",Object.assign({className:"fileUploaded__body__buttons__done"},{children:e.jsx(l.Button,{buttonText:"Done",buttonType:"primary",matchParentWidth:!0,onClick:()=>b.onSuccess(N,F)})}))]}))]}))]})):e.jsxs(a.FileUploaderStyle,Object.assign({showProgressBar:S},{children:[e.jsxs("div",Object.assign({className:"fileUploader"},{children:[e.jsxs("div",Object.assign({className:"fileUploader__header"},{children:[e.jsx("div",Object.assign({className:"fileUploader__header__icon"},{children:D(c.COLORS.content.secondary,36,30)})),e.jsx(r.Tooltip,Object.assign({body:T,placement:"top"},{children:e.jsx("div",Object.assign({className:"fileUploader__header__title"},{children:e.jsx(n.TitleMedium,Object.assign({style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:S?"Document upload in progress":`Upload ${T}`}))}))})),e.jsx("div",Object.assign({className:"fileUploader__header__caption"},{children:e.jsx(n.BodySecondary,Object.assign({style:{color:c.COLORS.content.secondary}},{children:S?`Your ${T} is getting loaded. This may take a couple of minutes.`:`${T.includes("/")?"Files":T+" format"} • Max ${R(Math.max(...Object.values(b.fileUploadRules.allowedSize)))}`}))}))]})),e.jsx("div",Object.assign({className:"fileUploader__body"},{children:S?e.jsxs(e.Fragment,{children:[e.jsx("div",Object.assign({className:"fileUploader__body__progress-bar"},{children:e.jsx(d.ProgressBarComponent,{completed:b.uploadProgress,isAnimated:!0})})),e.jsx("div",Object.assign({className:"fileUploader__body__cancel-button"},{children:e.jsx(l.Button,{buttonType:"tertiaryGray",buttonText:"cancel",onClick:()=>{I(!1),C(null),L({})}})}))]}):e.jsxs(e.Fragment,{children:[e.jsx("div",Object.assign({className:"fileUploader__body__link"},{children:e.jsx(o.Input,{type:"text",onChangeText:()=>w(""),placeholder:`Enter URL of the ${T.includes("/")?"file":T.toLowerCase()}`,width:"100%",height:"48px",labelText:`${T.includes("/")?"File":T} link`,errorMessage:U,onBlur:e=>B(e.target.value)})})),e.jsxs("div",Object.assign({className:"fileUploader__body__divider"},{children:[e.jsx("div",{className:"left"}),e.jsx("div",Object.assign({className:"title"},{children:e.jsx(n.BodyCaption,Object.assign({style:{color:c.COLORS.content.secondary}},{children:"Or upload from device"}))})),e.jsx("div",{className:"right"})]})),e.jsxs("div",Object.assign({className:"fileUploader__body__upload"},{children:[e.jsx("label",Object.assign({htmlFor:"file-upload-button",className:"file-upload-label"},{children:e.jsxs("div",Object.assign({className:"file-uploader"},{children:[e.jsx("div",{children:e.jsx(f.default,{height:18,width:18})}),e.jsx("div",{children:e.jsx(n.ButtonLarge,Object.assign({style:{color:c.COLORS.content.brand}},{children:"Upload"}))})]}))})),e.jsx("input",{id:"file-upload-button",type:"file",accept:b.fileUploadRules.allowedFormats,style:{opacity:0,position:"absolute",zIndex:-1},onChange:e=>P(e.target)})]}))]})}))]})),y&&e.jsx("div",Object.assign({className:"fileUploadError"},{children:e.jsx(i.Curtain,{type:t.CURTAIN_TYPES.NEGATIVE,mode:t.CURTAIN_MODE.LIGHT,text:y,hideCrossIcon:!0,icon:()=>e.jsx(v.default,{height:16,width:19,color:c.COLORS.content.negative})})}))]}))})};
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("styled-components"),i=require("../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e);r.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),i=require("../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e);const d=r.default.div`
2
2
  height: 100%;
3
3
  width: 440px;
4
4
  border: 1px dashed ${i.COLORS.stroke.primary};
@@ -91,7 +91,7 @@
91
91
  width: 100%;
92
92
  position: relative;
93
93
  }
94
- `,r.default.div`
94
+ `,o=r.default.div`
95
95
  display: flex;
96
96
  flex-direction: column;
97
97
  height: 100%;
@@ -163,4 +163,4 @@
163
163
  }
164
164
  }
165
165
  }
166
- `;
166
+ `;exports.FileUploadedStyle=o,exports.FileUploaderStyle=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),l=require("../../assets/icons/errorInfo.svg.js"),s=require("./context/InputStyleProvider.js"),a=require("./Input.styled.js");const o=o=>{var u,c,d,v;const{placeholder:h,leftIcon:x,rightIcon:p,labelText:f,maxCharLimit:j,isRequired:g,hintText:y,type:I,state:b,validate:C,variant:m,button:S,suffixText:E,prefixText:O,onChangeText:q,value:w,noErrorHint:F,reset:H,rangeValidation:T}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),k=null==x?void 0:x.icon,B=null==p?void 0:p.icon,[A,R]=t.useState(!1),[z,L]=t.useState(!1),[M,D]=t.useState(),P="small"===m?"18px":"22px",K=t.useContext(s.InputStyleContext),[W,_]=t.useState(),N=t.useRef();t.useEffect((()=>{_(w)}),[w]),t.useEffect((()=>{var e;N.current&&(null===(e=o.onReferenceInit)||void 0===e||e.call(o,N.current))}),[N]),t.useEffect((()=>{H&&_("")}),[H]),t.useEffect((()=>{var e;L(!!o.isActive),o.isActive&&(null===(e=N.current)||void 0===e||e.focus())}),[o.isActive]),t.useEffect((()=>{D(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{var e;R(!1),("invalid"===o.state||M)&&R(!0),"active"===o.state&&(null===(e=N.current)||void 0===e||e.focus())}),[o.state,M]),t.useEffect((()=>{R(!!M)}),[M]);const V=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},G=e=>{const t=j||("zip"===I?6:60);q(w||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},J=e=>{const t=e.target.value;q(t,e),_(t);const n=C||i.validateInput;if(!n||!i.isFunction(n))return;const[r,l]=n(t,I,T);R(!r),D(l)},Q=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==I&&e.jsx("input",{id:o.id,style:null!==(t=null==K?void 0:K.input)&&void 0!==t?t:{},ref:N,type:["phonenumber","zip","number"].includes(I)?"number":I,value:W,onFocus:()=>(L(!0),void V(o.onFocus)),onBlur:e=>(e=>{var t;L(!1),V(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))})(e),placeholder:h||"Enter here",onChange:J,onKeyDown:e=>G(e)}),"multiline"===I&&e.jsx("textarea",{value:W,ref:N,onFocus:()=>L(!0),onBlur:()=>L(!1),placeholder:h||"Enter here",onChange:J,onKeyDown:e=>G(e)})]})};return e.jsxs(a.RootContainer,Object.assign({width:o.width,height:o.height,state:b,type:I,style:null!==(u=null==K?void 0:K.RootContainer)&&void 0!==u?u:{}},{children:[!F&&(!!y||!!M)&&e.jsxs(a.InputFooter,Object.assign({invalid:!!M},{children:[!!M&&e.jsx(l.default,{width:16,height:16}),M||y]})),e.jsxs(a.InputWrapper,Object.assign({variant:m,state:b,width:o.width,isActive:"active"===b||z,isInvalid:A,style:null!==(c=null==K?void 0:K.InputWrapper)&&void 0!==c?c:{}},{children:[!!k&&e.jsx(a.IconHolder,Object.assign({variant:m,iconSize:P,onClick:()=>V(null==x?void 0:x.callback),isLeft:!0,style:null!==(d=null==K?void 0:K.IconHolder)&&void 0!==d?d:{}},{children:e.jsx(k,{})})),!!O&&e.jsx(a.PrefixHolder,Object.assign({variant:m},{children:O})),"default"===m&&e.jsx(a.InputContainer,{children:Q()}),"small"===m&&e.jsx(a.InputContainerSmall,{children:Q()}),!!B&&e.jsx(a.IconHolder,Object.assign({variant:m,iconSize:P,onClick:()=>V(null==p?void 0:p.callback),isLeft:!1},{children:e.jsx(B,{})})),!!E&&e.jsx(a.SuffixHolder,Object.assign({variant:m},{children:E})),S&&S.text&&e.jsx(n.Button,{buttonText:S.text,onClick:()=>V(null==S?void 0:S.onClick)})]})),(!!f||!!j)&&"default"===m&&e.jsxs(a.InputHeader,Object.assign({invalid:A},{children:[e.jsxs(r.BodySecondary,{children:[f,g?e.jsx("span",{children:"*"}):""]}),j>0&&e.jsxs(a.MaxCharStyle,{children:[null===(v=o.value)||void 0===v?void 0:v.length,"/",j]})]}))]}))};o.displayName="Input",exports.Input=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),l=require("../../assets/icons/errorInfo.svg.js"),s=require("./context/InputStyleProvider.js"),a=require("./Input.styled.js");const o=o=>{var u,c,d,v;const{placeholder:h,leftIcon:x,rightIcon:p,labelText:f,maxCharLimit:j,isRequired:g,hintText:y,type:I,state:b,validate:C,variant:m,button:S,suffixText:E,prefixText:O,onChangeText:q,value:w,noErrorHint:F,reset:H,rangeValidation:T}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),k=null==x?void 0:x.icon,B=null==p?void 0:p.icon,[A,R]=t.useState(!1),[z,L]=t.useState(!1),[M,D]=t.useState(),P="small"===m?"18px":"22px",K=t.useContext(s.InputStyleContext),[W,_]=t.useState(),N=t.useRef();t.useEffect((()=>{_(w)}),[w]),t.useEffect((()=>{var e;N.current&&(null===(e=o.onReferenceInit)||void 0===e||e.call(o,N.current))}),[N]),t.useEffect((()=>{H&&_("")}),[H]),t.useEffect((()=>{var e;L(!!o.isActive),o.isActive&&(null===(e=N.current)||void 0===e||e.focus())}),[o.isActive]),t.useEffect((()=>{D(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{var e;R(!1),("invalid"===o.state||M)&&R(!0),"active"===o.state&&(null===(e=N.current)||void 0===e||e.focus())}),[o.state,M]),t.useEffect((()=>{R(!!M)}),[M]);const V=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},G=e=>{const t=j||("zip"===I?6:60);q(w||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},J=e=>{const t=e.target.value;q(t,e),_(t);const n=C||i.validateInput;if(!n||!i.isFunction(n))return;const[r,l]=n(t,I,T);R(!r),D(l)},Q=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==I&&e.jsx("input",{id:o.id,style:null!==(t=null==K?void 0:K.input)&&void 0!==t?t:{},ref:N,type:["phonenumber","zip","number"].includes(I)?"number":I,value:W,onFocus:()=>(L(!0),void V(o.onFocus)),onBlur:e=>(e=>{var t;L(!1),V(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))})(e),placeholder:h||"Enter here",onChange:J,onKeyDown:e=>G(e)}),"multiline"===I&&e.jsx("textarea",{value:W,ref:N,onFocus:()=>L(!0),onBlur:()=>L(!1),placeholder:h||"Enter here",onChange:J,onKeyDown:e=>G(e)})]})};return e.jsxs(a.RootContainer,Object.assign({width:o.width,height:o.height,state:b,type:I,style:null!==(u=null==K?void 0:K.RootContainer)&&void 0!==u?u:{}},{children:[!F&&(!!y||!!M)&&e.jsxs(a.InputFooter,Object.assign({invalid:!!M},{children:[!!M&&e.jsx(l.default,{width:16,height:16}),M||y]})),e.jsxs(a.InputWrapper,Object.assign({variant:m,state:b,width:o.width,isActive:"active"===b||z,isInvalid:A,style:null!==(c=null==K?void 0:K.InputWrapper)&&void 0!==c?c:{}},{children:[!!k&&e.jsx(a.IconHolder,Object.assign({variant:m,iconSize:P,onClick:()=>V(null==x?void 0:x.callback),isLeft:!0,style:null!==(d=null==K?void 0:K.IconHolder)&&void 0!==d?d:{}},{children:e.jsx(k,{})})),!!O&&e.jsx(a.PrefixHolder,Object.assign({variant:m},{children:O})),"default"===m&&e.jsx(a.InputContainer,{children:Q()}),"small"===m&&e.jsx(a.InputContainerSmall,{children:Q()}),!!B&&e.jsx(a.IconHolder,Object.assign({variant:m,iconSize:P,onClick:()=>V(null==p?void 0:p.callback),isLeft:!1},{children:e.jsx(B,{})})),!!E&&e.jsx(a.SuffixHolder,Object.assign({variant:m},{children:E})),S&&S.text&&e.jsx(n.Button,{buttonText:S.text,onClick:()=>V(null==S?void 0:S.onClick)})]})),(!!f||!!j)&&e.jsxs(a.InputHeader,Object.assign({invalid:A},{children:[e.jsxs(r.BodySecondary,{children:[f,g?e.jsx("span",{children:"*"}):""]}),j>0&&e.jsxs(a.MaxCharStyle,{children:[null===(v=o.value)||void 0===v?void 0:v.length,"/",j]})]}))]}))};o.displayName="Input",exports.Input=o;