@activecollab/components 2.0.210 → 2.0.212
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/EditableContent/EditableContent.js +4 -2
- package/dist/cjs/components/EditableContent/EditableContent.js.map +1 -1
- package/dist/cjs/components/EditableContent/Styles.js +8 -2
- package/dist/cjs/components/EditableContent/Styles.js.map +1 -1
- package/dist/cjs/components/EditableCurrency/EditableCurrency.js +3 -1
- package/dist/cjs/components/EditableCurrency/EditableCurrency.js.map +1 -1
- package/dist/cjs/components/Input/InputPhone.js +10 -6
- package/dist/cjs/components/Input/InputPhone.js.map +1 -1
- package/dist/cjs/components/Input/InputSelect.js +4 -2
- package/dist/cjs/components/Input/InputSelect.js.map +1 -1
- package/dist/cjs/components/Input/Styles.js +14 -3
- package/dist/cjs/components/Input/Styles.js.map +1 -1
- package/dist/esm/components/EditableContent/EditableContent.d.ts +1 -0
- package/dist/esm/components/EditableContent/EditableContent.d.ts.map +1 -1
- package/dist/esm/components/EditableContent/EditableContent.js +3 -1
- package/dist/esm/components/EditableContent/EditableContent.js.map +1 -1
- package/dist/esm/components/EditableContent/Styles.d.ts.map +1 -1
- package/dist/esm/components/EditableContent/Styles.js +12 -2
- package/dist/esm/components/EditableContent/Styles.js.map +1 -1
- package/dist/esm/components/EditableCurrency/EditableCurrency.d.ts.map +1 -1
- package/dist/esm/components/EditableCurrency/EditableCurrency.js +2 -0
- package/dist/esm/components/EditableCurrency/EditableCurrency.js.map +1 -1
- package/dist/esm/components/Input/InputPhone.d.ts.map +1 -1
- package/dist/esm/components/Input/InputPhone.js +11 -7
- package/dist/esm/components/Input/InputPhone.js.map +1 -1
- package/dist/esm/components/Input/InputSelect.d.ts +2 -0
- package/dist/esm/components/Input/InputSelect.d.ts.map +1 -1
- package/dist/esm/components/Input/InputSelect.js +4 -2
- package/dist/esm/components/Input/InputSelect.js.map +1 -1
- package/dist/esm/components/Input/Styles.d.ts +4 -1
- package/dist/esm/components/Input/Styles.d.ts.map +1 -1
- package/dist/esm/components/Input/Styles.js +13 -2
- package/dist/esm/components/Input/Styles.js.map +1 -1
- package/dist/index.js +41 -15
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,17 +13,22 @@ export const StyledDiv = styled.div.withConfig({
|
|
|
13
13
|
export const StyledSpan = styled(Typography).withConfig({
|
|
14
14
|
displayName: "Styles__StyledSpan",
|
|
15
15
|
componentId: "sc-1wapx2a-1"
|
|
16
|
-
})(["visibility:hidden;display:block;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;position:relative;border:1px solid transparent;border-radius:6px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:pre;font-variant-numeric:tabular-nums;", " &:empty:before{content:\" \";}"], _ref => {
|
|
16
|
+
})(["visibility:hidden;display:block;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;position:relative;border:1px solid transparent;border-radius:6px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:pre;font-variant-numeric:tabular-nums;", " ", " &:empty:before{content:\" \";}"], _ref => {
|
|
17
17
|
let {
|
|
18
18
|
$disabled
|
|
19
19
|
} = _ref;
|
|
20
20
|
return $disabled && css(["visibility:visible;"]);
|
|
21
|
+
}, _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
invalid
|
|
24
|
+
} = _ref2;
|
|
25
|
+
return invalid && css(["border:1px solid var(--red-alert);"]);
|
|
21
26
|
});
|
|
22
27
|
StyledSpan.displayName = "StyledSpan";
|
|
23
28
|
export const StyledInput = styled(Typography).withConfig({
|
|
24
29
|
displayName: "Styles__StyledInput",
|
|
25
30
|
componentId: "sc-1wapx2a-2"
|
|
26
|
-
})(["", " background-color:inherit;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;text-overflow:ellipsis;font-variant-numeric:tabular-nums;&:focus-whitin{text-overflow:clip;}outline-width:0px;outline:none;&:disabled{opacity:0;}"], {
|
|
31
|
+
})(["", " background-color:inherit;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;text-overflow:ellipsis;font-variant-numeric:tabular-nums;&:focus-whitin{text-overflow:clip;}outline-width:0px;outline:none;&:disabled{opacity:0;}", ""], {
|
|
27
32
|
"position": "absolute",
|
|
28
33
|
"inset": "0px",
|
|
29
34
|
"boxSizing": "border-box",
|
|
@@ -41,6 +46,11 @@ export const StyledInput = styled(Typography).withConfig({
|
|
|
41
46
|
":hover": {
|
|
42
47
|
"borderColor": "var(--color-theme-700)"
|
|
43
48
|
}
|
|
49
|
+
}, _ref3 => {
|
|
50
|
+
let {
|
|
51
|
+
invalid
|
|
52
|
+
} = _ref3;
|
|
53
|
+
return invalid && css(["border-color:var(--red-alert) !important;"]);
|
|
44
54
|
});
|
|
45
55
|
StyledInput.displayName = "StyledInput";
|
|
46
56
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","Typography","StyledDiv","div","withConfig","displayName","componentId","StyledSpan","_ref","$disabled","StyledInput"],"sources":["../../../../src/components/EditableContent/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport const StyledDiv = styled.div`\n ${FontStyle}\n ${BoxSizingStyle}\n\n ${tw`tw-relative tw-inline-block tw-max-w-full`}\n`;\n\nexport const StyledSpan = styled(Typography)<{ $disabled?: boolean }>`\n visibility: hidden;\n display: block;\n padding-left: 4px;\n padding-right: 4px;\n padding-top: 1px;\n padding-bottom: 1px;\n position: relative;\n border: 1px solid transparent;\n border-radius: 6px;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre;\n font-variant-numeric: tabular-nums;\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n visibility: visible;\n `}\n\n &:empty:before {\n content: \" \";\n }\n`;\n\nStyledSpan.displayName = \"StyledSpan\";\n\nexport const StyledInput = styled(Typography)`\n ${tw`\n tw-absolute\n tw-inset-0\n tw-border\n tw-border-transparent\n tw-border-solid\n hover:tw-border-theme-700\n focus-within:tw-border-theme-700\n tw-rounded-md\n tw-box-border\n tw-overflow-hidden\n tw-whitespace-nowrap\n focus-within:tw-overflow-scroll\n tw-w-full`}\n\n background-color: inherit;\n padding-left: 4px;\n padding-right: 4px;\n padding-top: 1px;\n padding-bottom: 1px;\n text-overflow: ellipsis;\n font-variant-numeric: tabular-nums;\n &:focus-whitin {\n text-overflow: clip;\n }\n outline-width: 0px;\n outline: none;\n &:disabled {\n opacity: 0;\n }\n`;\n\nStyledInput.displayName = \"StyledInput\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAO,MAAMC,SAAS,GAAGL,MAAM,CAACM,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,uBAC/BN,SAAS,EACTD,cAAc,EAEZ;EAAA;EAAA;EAAA;AAA0C,CAAC,CAChD;AAED,OAAO,MAAMQ,UAAU,GAAGV,MAAM,CAACI,UAAU,CAAC,CAAAG,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","Typography","StyledDiv","div","withConfig","displayName","componentId","StyledSpan","_ref","$disabled","_ref2","invalid","StyledInput","_ref3"],"sources":["../../../../src/components/EditableContent/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport tw from \"twin.macro\";\n\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { Typography } from \"../Typography/Typography\";\n\nexport const StyledDiv = styled.div`\n ${FontStyle}\n ${BoxSizingStyle}\n\n ${tw`tw-relative tw-inline-block tw-max-w-full`}\n`;\n\nexport const StyledSpan = styled(Typography)<{ $disabled?: boolean }>`\n visibility: hidden;\n display: block;\n padding-left: 4px;\n padding-right: 4px;\n padding-top: 1px;\n padding-bottom: 1px;\n position: relative;\n border: 1px solid transparent;\n border-radius: 6px;\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: pre;\n font-variant-numeric: tabular-nums;\n\n ${({ $disabled }) =>\n $disabled &&\n css`\n visibility: visible;\n `}\n\n ${({ invalid }) =>\n invalid &&\n css`\n border: 1px solid var(--red-alert);\n `}\n\n &:empty:before {\n content: \" \";\n }\n`;\n\nStyledSpan.displayName = \"StyledSpan\";\n\nexport const StyledInput = styled(Typography)`\n ${tw`\n tw-absolute\n tw-inset-0\n tw-border\n tw-border-transparent\n tw-border-solid\n hover:tw-border-theme-700\n focus-within:tw-border-theme-700\n tw-rounded-md\n tw-box-border\n tw-overflow-hidden\n tw-whitespace-nowrap\n focus-within:tw-overflow-scroll\n tw-w-full`}\n\n background-color: inherit;\n padding-left: 4px;\n padding-right: 4px;\n padding-top: 1px;\n padding-bottom: 1px;\n text-overflow: ellipsis;\n font-variant-numeric: tabular-nums;\n &:focus-whitin {\n text-overflow: clip;\n }\n outline-width: 0px;\n outline: none;\n &:disabled {\n opacity: 0;\n }\n\n ${({ invalid }) =>\n invalid &&\n css`\n border-color: var(--red-alert) !important;\n `}\n`;\n\nStyledInput.displayName = \"StyledInput\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,UAAU,QAAQ,0BAA0B;AAErD,OAAO,MAAMC,SAAS,GAAGL,MAAM,CAACM,GAAG,CAAAC,UAAA;EAAAC,WAAA;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AAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"EditableCurrency.d.ts","sourceRoot":"","sources":["../../../../src/components/EditableCurrency/EditableCurrency.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAmB,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAG/E,MAAM,WAAW,qBACf,SAAQ,wBAAwB,EAC9B,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,QAAQ,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,8FAqG5B,CAAC"}
|
|
@@ -23,6 +23,7 @@ export const EditableCurrency = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
23
23
|
trimDecimals = true,
|
|
24
24
|
min,
|
|
25
25
|
max,
|
|
26
|
+
invalid,
|
|
26
27
|
...rest
|
|
27
28
|
} = _ref;
|
|
28
29
|
const inputRef = useRef(null);
|
|
@@ -66,6 +67,7 @@ export const EditableCurrency = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
66
67
|
disabled: disabled,
|
|
67
68
|
ref: handleRef,
|
|
68
69
|
className: className,
|
|
70
|
+
invalid: invalid,
|
|
69
71
|
inputProps: {
|
|
70
72
|
value: formattedValue,
|
|
71
73
|
onBlur: onBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableCurrency.js","names":["React","useMemo","useRef","useInputNumber","numberWithSeparator","useForkRef","EditableContent","Tooltip","EditableCurrency","forwardRef","_ref","ref","decimalLength","decimalSeparator","disableAbbreviation","disabled","disableMacros","step","thousandSeparator","value","defaultValue","onSave","onCancel","className","allowEmptyValue","onEnterKeyPress","externalEnterKeyPress","onClick","externalOnClick","onChange","externalOnChange","trimDecimals","min","max","rest","inputRef","handleRef","onBlur","onKeyDown","onDoubleClick","onFocus","focused","unformattedValue","shortenThreshold","formattedValue","createElement","title","disable","inputProps","displayName"],"sources":["../../../../src/components/EditableCurrency/EditableCurrency.tsx"],"sourcesContent":["import React, { useMemo, useRef } from \"react\";\n\nimport { IInputNumber, useInputNumber } from \"../../hooks\";\nimport { numberWithSeparator, useForkRef } from \"../../utils\";\nimport { EditableContent, EditableContentInterface } from \"../EditableContent\";\nimport { Tooltip } from \"../Tooltip\";\n\nexport interface EditableCurrencyProps\n extends EditableContentInterface,\n Omit<IInputNumber, \"limit\" | \"onBlur\"> {\n className?: string;\n}\n\nexport const EditableCurrency = React.forwardRef<\n HTMLDivElement,\n EditableCurrencyProps\n>(\n (\n {\n decimalLength = 2,\n decimalSeparator = \".\",\n disableAbbreviation = false,\n disabled,\n disableMacros = false,\n step = 1,\n thousandSeparator = \",\",\n value: defaultValue,\n onSave,\n onCancel,\n className,\n allowEmptyValue,\n onEnterKeyPress: externalEnterKeyPress,\n onClick: externalOnClick,\n onChange: externalOnChange,\n trimDecimals = true,\n min,\n max,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const handleRef = useForkRef(ref, inputRef);\n\n const {\n value,\n onBlur,\n onKeyDown,\n onChange,\n onClick,\n onDoubleClick,\n onFocus,\n focused,\n unformattedValue,\n } = useInputNumber(\n {\n decimalLength,\n decimalSeparator,\n disableAbbreviation,\n disableMacros,\n step,\n thousandSeparator,\n value: defaultValue,\n onSave,\n allowEmptyValue,\n onCancel,\n onChange: externalOnChange,\n onEnterKeyPress: externalEnterKeyPress,\n onClick: externalOnClick,\n trimDecimals,\n min,\n max,\n shortenThreshold: 10000,\n },\n inputRef\n );\n\n const formattedValue = useMemo(() => {\n return focused\n ? value\n : numberWithSeparator(value ?? \"\", \"\", decimalSeparator);\n }, [focused, value, decimalSeparator]);\n\n return (\n <Tooltip\n title={\n numberWithSeparator(\n unformattedValue ?? \"\",\n thousandSeparator,\n decimalSeparator\n ) as string\n }\n disable={focused}\n >\n <EditableContent\n disabled={disabled}\n ref={handleRef}\n className={className}\n inputProps={{\n value: formattedValue,\n onBlur: onBlur,\n onChange: onChange,\n onKeyDown: onKeyDown,\n onClick: onClick,\n onFocus: onFocus,\n onDoubleClick: onDoubleClick,\n ...rest,\n }}\n />\n </Tooltip>\n );\n }\n);\n\nEditableCurrency.displayName = \"EditableCurrency\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE9C,SAAuBC,cAAc,QAAQ,aAAa;AAC1D,SAASC,mBAAmB,EAAEC,UAAU,QAAQ,aAAa;AAC7D,SAASC,eAAe,QAAkC,oBAAoB;AAC9E,SAASC,OAAO,QAAQ,YAAY;AAQpC,OAAO,MAAMC,gBAAgB,gBAAGR,KAAK,CAACS,UAAU,CAI9C,CAAAC,IAAA,
|
|
1
|
+
{"version":3,"file":"EditableCurrency.js","names":["React","useMemo","useRef","useInputNumber","numberWithSeparator","useForkRef","EditableContent","Tooltip","EditableCurrency","forwardRef","_ref","ref","decimalLength","decimalSeparator","disableAbbreviation","disabled","disableMacros","step","thousandSeparator","value","defaultValue","onSave","onCancel","className","allowEmptyValue","onEnterKeyPress","externalEnterKeyPress","onClick","externalOnClick","onChange","externalOnChange","trimDecimals","min","max","invalid","rest","inputRef","handleRef","onBlur","onKeyDown","onDoubleClick","onFocus","focused","unformattedValue","shortenThreshold","formattedValue","createElement","title","disable","inputProps","displayName"],"sources":["../../../../src/components/EditableCurrency/EditableCurrency.tsx"],"sourcesContent":["import React, { useMemo, useRef } from \"react\";\n\nimport { IInputNumber, useInputNumber } from \"../../hooks\";\nimport { numberWithSeparator, useForkRef } from \"../../utils\";\nimport { EditableContent, EditableContentInterface } from \"../EditableContent\";\nimport { Tooltip } from \"../Tooltip\";\n\nexport interface EditableCurrencyProps\n extends EditableContentInterface,\n Omit<IInputNumber, \"limit\" | \"onBlur\"> {\n className?: string;\n}\n\nexport const EditableCurrency = React.forwardRef<\n HTMLDivElement,\n EditableCurrencyProps\n>(\n (\n {\n decimalLength = 2,\n decimalSeparator = \".\",\n disableAbbreviation = false,\n disabled,\n disableMacros = false,\n step = 1,\n thousandSeparator = \",\",\n value: defaultValue,\n onSave,\n onCancel,\n className,\n allowEmptyValue,\n onEnterKeyPress: externalEnterKeyPress,\n onClick: externalOnClick,\n onChange: externalOnChange,\n trimDecimals = true,\n min,\n max,\n invalid,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const handleRef = useForkRef(ref, inputRef);\n\n const {\n value,\n onBlur,\n onKeyDown,\n onChange,\n onClick,\n onDoubleClick,\n onFocus,\n focused,\n unformattedValue,\n } = useInputNumber(\n {\n decimalLength,\n decimalSeparator,\n disableAbbreviation,\n disableMacros,\n step,\n thousandSeparator,\n value: defaultValue,\n onSave,\n allowEmptyValue,\n onCancel,\n onChange: externalOnChange,\n onEnterKeyPress: externalEnterKeyPress,\n onClick: externalOnClick,\n trimDecimals,\n min,\n max,\n shortenThreshold: 10000,\n },\n inputRef\n );\n\n const formattedValue = useMemo(() => {\n return focused\n ? value\n : numberWithSeparator(value ?? \"\", \"\", decimalSeparator);\n }, [focused, value, decimalSeparator]);\n\n return (\n <Tooltip\n title={\n numberWithSeparator(\n unformattedValue ?? \"\",\n thousandSeparator,\n decimalSeparator\n ) as string\n }\n disable={focused}\n >\n <EditableContent\n disabled={disabled}\n ref={handleRef}\n className={className}\n invalid={invalid}\n inputProps={{\n value: formattedValue,\n onBlur: onBlur,\n onChange: onChange,\n onKeyDown: onKeyDown,\n onClick: onClick,\n onFocus: onFocus,\n onDoubleClick: onDoubleClick,\n ...rest,\n }}\n />\n </Tooltip>\n );\n }\n);\n\nEditableCurrency.displayName = \"EditableCurrency\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAE9C,SAAuBC,cAAc,QAAQ,aAAa;AAC1D,SAASC,mBAAmB,EAAEC,UAAU,QAAQ,aAAa;AAC7D,SAASC,eAA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nC,OAAOyC,OAAO,GACVvB,KAAK,GACLf,mBAAmB,CAACe,KAAK,WAALA,KAAK,GAAI,EAAE,EAAE,EAAE,EAAEN,gBAAgB,CAAC;EAC5D,CAAC,EAAE,CAAC6B,OAAO,EAAEvB,KAAK,EAAEN,gBAAgB,CAAC,CAAC;EAEtC,oBACEb,KAAA,CAAA8C,aAAA,CAACvC,OAAO;IACNwC,KAAK,EACH3C,mBAAmB,CACjBuC,gBAAgB,WAAhBA,gBAAgB,GAAI,EAAE,EACtBzB,iBAAiB,EACjBL,gBACF,CACD;IACDmC,OAAO,EAAEN;EAAQ,gBAEjB1C,KAAA,CAAA8C,aAAA,CAACxC,eAAe;IACdS,QAAQ,EAAEA,QAAS;IACnBJ,GAAG,EAAE0B,SAAU;IACfd,SAAS,EAAEA,SAAU;IACrBW,OAAO,EAAEA,OAAQ;IACjBe,UAAU,EAAE;MACV9B,KAAK,EAAE0B,cAAc;MACrBP,MAAM,EAAEA,MAAM;MACdT,QAAQ,EAAEA,QAAQ;MAClBU,SAAS,EAAEA,SAAS;MACpBZ,OAAO,EAAEA,OAAO;MAChBc,OAAO,EAAEA,OAAO;MAChBD,aAAa,EAAEA,aAAa;MAC5B,GAAGL;IACL;EAAE,CACH,CACM,CAAC;AAEd,CACF,CAAC;AAED3B,gBAAgB,CAAC0C,WAAW,GAAG,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputPhone.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/InputPhone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAUf,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"InputPhone.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/InputPhone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAUf,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAa5C,MAAM,WAAW,eACf,SAAQ,IAAI,CACV,UAAU,EACV,MAAM,GAAG,gBAAgB,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAC1D;IACD,kBAAkB;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,iBAAiB;IACjB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;CACpC;AAqBD,eAAO,MAAM,UAAU,0FAiJtB,CAAC"}
|
|
@@ -3,13 +3,13 @@ import React, { forwardRef, useCallback, useEffect, useRef, useState } from "rea
|
|
|
3
3
|
import { callingCodeToCountryCodeMap, countriesArraySortedByName, getCountryCallingCode, getCountryFlag } from "country-explorer";
|
|
4
4
|
import { Input } from "./Input";
|
|
5
5
|
import { InputSelect } from "./InputSelect";
|
|
6
|
-
import { StyledFlagTriggerLabel, StyledOptionFlag, StyledOptionName, StyledOptionWrapper } from "./Styles";
|
|
6
|
+
import { StyledFlagTriggerLabel, StyledOptionCode, StyledOptionFlag, StyledOptionName, StyledOptionRowEnd, StyledOptionWrapper } from "./Styles";
|
|
7
7
|
import { useForkRef } from "../../utils";
|
|
8
8
|
import { RadioButton } from "../RadioButton";
|
|
9
|
-
const renderOption = (option, data) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledOptionWrapper, null, /*#__PURE__*/React.createElement(StyledOptionFlag, null, getCountryFlag(option.id)), /*#__PURE__*/React.createElement(StyledOptionName, null, option.name)), /*#__PURE__*/React.createElement(RadioButton, {
|
|
9
|
+
const renderOption = (option, data) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledOptionWrapper, null, /*#__PURE__*/React.createElement(StyledOptionFlag, null, getCountryFlag(option.id)), /*#__PURE__*/React.createElement(StyledOptionName, null, option.name)), /*#__PURE__*/React.createElement(StyledOptionRowEnd, null, /*#__PURE__*/React.createElement(StyledOptionCode, null, option.additionalInfo), /*#__PURE__*/React.createElement(RadioButton, {
|
|
10
10
|
checked: data.checked,
|
|
11
11
|
onChange: data.onChange
|
|
12
|
-
}));
|
|
12
|
+
})));
|
|
13
13
|
export const InputPhone = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
14
14
|
let {
|
|
15
15
|
size = "regular",
|
|
@@ -25,7 +25,8 @@ export const InputPhone = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
25
25
|
const [value, setValue] = useState("");
|
|
26
26
|
const options = countriesArraySortedByName.map(country => ({
|
|
27
27
|
id: country.countryCode,
|
|
28
|
-
name:
|
|
28
|
+
name: country.name,
|
|
29
|
+
additionalInfo: "+" + country.callingCode
|
|
29
30
|
}));
|
|
30
31
|
const separatePrefixFromValue = fullValue => {
|
|
31
32
|
let newPrefix = prefix;
|
|
@@ -37,12 +38,11 @@ export const InputPhone = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
37
38
|
const code = digits.slice(0, i);
|
|
38
39
|
if (callingCodeToCountryCodeMap[code]) {
|
|
39
40
|
newPrefix = callingCodeToCountryCodeMap[code];
|
|
40
|
-
|
|
41
|
+
const dialCode = getCountryCallingCode(newPrefix);
|
|
42
|
+
newValue = fullValue.slice(prefixLength + dialCode.length);
|
|
41
43
|
break;
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
|
-
} else if (fullValue.startsWith(prefix)) {
|
|
45
|
-
newValue = fullValue.slice(prefix.length);
|
|
46
46
|
}
|
|
47
47
|
return {
|
|
48
48
|
newPrefix,
|
|
@@ -118,6 +118,10 @@ export const InputPhone = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
118
118
|
onChange: handleSelectChange,
|
|
119
119
|
options: options,
|
|
120
120
|
selected: prefix,
|
|
121
|
+
filterCriteria: (option, filter) => {
|
|
122
|
+
var _option$additionalInf;
|
|
123
|
+
return !!(option != null && (_option$additionalInf = option.additionalInfo) != null && _option$additionalInf.toLowerCase().includes(filter));
|
|
124
|
+
},
|
|
121
125
|
selectedLabel: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledFlagTriggerLabel, {
|
|
122
126
|
$size: size
|
|
123
127
|
}, getCountryFlag(prefix)), "+", getCountryCallingCode(prefix)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputPhone.js","names":["React","forwardRef","useCallback","useEffect","useRef","useState","callingCodeToCountryCodeMap","countriesArraySortedByName","getCountryCallingCode","getCountryFlag","Input","InputSelect","StyledFlagTriggerLabel","StyledOptionFlag","StyledOptionName","StyledOptionWrapper","useForkRef","RadioButton","renderOption","option","data","createElement","Fragment","id","name","checked","onChange","InputPhone","_ref","ref","size","disabled","value","defaultValue","defaultCountry","rest","inputRef","handleRef","prefix","setPrefix","setValue","options","map","country","countryCode","callingCode","separatePrefixFromValue","fullValue","newPrefix","newValue","startsWith","prefixLength","digits","slice","i","length","code","handleChange","e","inputValue","target","test","handleSelectChange","val","setTimeout","_inputRef$current","current","focus","handlePaste","preventDefault","paste","clipboardData","getData","filteredPaste","replace","inputElement","currentTarget","selectionStart","selectionEnd","currentValue","beforeSelection","afterSelection","newValueAfterPaste","_extends","type","onPaste","startAdornment","selected","selectedLabel","$size","keepSameOptionsOrder","search","displayName"],"sources":["../../../../src/components/Input/InputPhone.tsx"],"sourcesContent":["import React, {\n ChangeEventHandler,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n callingCodeToCountryCodeMap,\n countriesArraySortedByName,\n getCountryCallingCode,\n getCountryFlag,\n Country,\n} from \"country-explorer\";\n\nimport { Input, InputProps } from \"./Input\";\nimport { InputSelect } from \"./InputSelect\";\nimport {\n StyledFlagTriggerLabel,\n StyledOptionFlag,\n StyledOptionName,\n StyledOptionWrapper,\n} from \"./Styles\";\nimport { useForkRef } from \"../../utils\";\nimport { RadioButton } from \"../RadioButton\";\n\nexport interface InputPhoneProps\n extends Omit<\n InputProps,\n \"type\" | \"startAdornment\" | \"onChange\" | \"value\" | \"size\"\n > {\n /** Input value */\n value?: string;\n /** Default country code to be selected */\n defaultCountry?: string;\n /** onChange function */\n onChange?: (val: string) => void;\n /** Input size */\n size?: \"small\" | \"regular\" | \"big\";\n}\n\nconst renderOption = (\n option: Record<string, React.ReactNode>,\n data: Record<string, unknown>\n): React.ReactElement => (\n <>\n <StyledOptionWrapper>\n <StyledOptionFlag>{getCountryFlag(option.id)}</StyledOptionFlag>\n <StyledOptionName>{option.name}</StyledOptionName>\n </StyledOptionWrapper>\n <RadioButton\n checked={data.checked as boolean}\n onChange={data.onChange as ChangeEventHandler<HTMLInputElement>}\n />\n </>\n);\n\nexport const InputPhone = forwardRef<HTMLInputElement, InputPhoneProps>(\n (\n {\n size = \"regular\",\n disabled,\n value: defaultValue = \"\",\n onChange,\n defaultCountry = \"US\",\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const handleRef = useForkRef(ref, inputRef);\n const [prefix, setPrefix] = useState(defaultCountry);\n const [value, setValue] = useState<string>(\"\");\n\n const options = countriesArraySortedByName.map((country: Country) => ({\n id: country.countryCode,\n name: `+${country.callingCode} ${country.name}`,\n }));\n\n const separatePrefixFromValue = (\n fullValue: string\n ): { newPrefix: string; newValue: string } => {\n let newPrefix = prefix;\n let newValue = fullValue;\n\n if (fullValue.startsWith(\"+\") || fullValue.startsWith(\"00\")) {\n const prefixLength = fullValue.startsWith(\"+\") ? 1 : 2;\n const digits = fullValue.slice(prefixLength);\n\n for (let i = digits.length; i >= 1; i--) {\n const code = digits.slice(0, i);\n if (callingCodeToCountryCodeMap[code]) {\n newPrefix = callingCodeToCountryCodeMap[code];\n newValue = fullValue.slice(\n prefixLength + getCountryCallingCode(newPrefix).length\n );\n break;\n }\n }\n } else if (fullValue.startsWith(prefix)) {\n newValue = fullValue.slice(prefix.length);\n }\n\n return { newPrefix, newValue };\n };\n\n useEffect(() => {\n const { newPrefix, newValue } = separatePrefixFromValue(defaultValue);\n setPrefix(newPrefix);\n setValue(newValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [defaultValue]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n if (/[^0-9+]/.test(inputValue)) {\n return;\n }\n\n const { newPrefix, newValue } = separatePrefixFromValue(inputValue);\n setPrefix(newPrefix);\n setValue(newValue);\n\n typeof onChange === \"function\" &&\n onChange(`+${getCountryCallingCode(newPrefix)}${newValue}`);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [onChange, prefix]\n );\n\n const handleSelectChange = (val: string | number | (string | number)[]) => {\n setPrefix(val as string);\n setTimeout(() => {\n inputRef.current?.focus();\n }, 200);\n typeof onChange === \"function\" &&\n onChange(`+${getCountryCallingCode(val)}${value}`);\n };\n\n const handlePaste = (e: React.ClipboardEvent) => {\n e.preventDefault();\n\n const paste = e.clipboardData.getData(\"text\");\n const filteredPaste = paste.replace(/[^0-9+]/g, \"\");\n\n const inputElement = e.currentTarget as HTMLInputElement;\n const { selectionStart, selectionEnd } = inputElement;\n\n if (selectionStart !== null && selectionEnd !== null) {\n const currentValue = inputElement.value;\n const beforeSelection = currentValue.slice(0, selectionStart);\n const afterSelection = currentValue.slice(selectionEnd);\n\n const newValueAfterPaste =\n beforeSelection + filteredPaste + afterSelection;\n const { newPrefix, newValue } =\n separatePrefixFromValue(newValueAfterPaste);\n\n setPrefix(newPrefix);\n setValue(newValue);\n\n typeof onChange === \"function\" &&\n onChange(`+${getCountryCallingCode(newPrefix)}${newValue}`);\n }\n };\n\n return (\n <Input\n {...rest}\n ref={handleRef}\n size={size}\n value={value}\n disabled={disabled}\n type=\"text\"\n onPaste={handlePaste}\n onChange={handleChange}\n data-testid=\"InputPhone\"\n startAdornment={\n <InputSelect\n size={size}\n onChange={handleSelectChange}\n options={options}\n selected={prefix}\n selectedLabel={\n <>\n <StyledFlagTriggerLabel $size={size}>\n {getCountryFlag(prefix)}\n </StyledFlagTriggerLabel>\n +{getCountryCallingCode(prefix)}\n </>\n }\n disabled={disabled}\n keepSameOptionsOrder={false}\n search\n renderOption={renderOption}\n />\n }\n />\n );\n }\n);\n\nInputPhone.displayName = \"InputPhone\";\n"],"mappings":";AAAA,OAAOA,KAAK,IAEVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SACEC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,qBAAqB,EACrBC,cAAc,QAET,kBAAkB;AAEzB,SAASC,KAAK,QAAoB,SAAS;AAC3C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SACEC,sBAAsB,EACtBC,gBAAgB,EAChBC,gBAAgB,EAChBC,mBAAmB,QACd,UAAU;AACjB,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,WAAW,QAAQ,gBAAgB;AAiB5C,MAAMC,YAAY,GAAGA,CACnBC,MAAuC,EACvCC,IAA6B,kBAE7BpB,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,qBACEtB,KAAA,CAAAqB,aAAA,CAACN,mBAAmB,qBAClBf,KAAA,CAAAqB,aAAA,CAACR,gBAAgB,QAAEJ,cAAc,CAACU,MAAM,CAACI,EAAE,CAAoB,CAAC,eAChEvB,KAAA,CAAAqB,aAAA,CAACP,gBAAgB,QAAEK,MAAM,CAACK,IAAuB,CAC9B,CAAC,eACtBxB,KAAA,CAAAqB,aAAA,CAACJ,WAAW;EACVQ,OAAO,EAAEL,IAAI,CAACK,OAAmB;EACjCC,QAAQ,EAAEN,IAAI,CAACM;AAAiD,CACjE,CACD,CACH;AAED,OAAO,MAAMC,UAAU,gBAAG1B,UAAU,CAClC,CAAA2B,IAAA,EASEC,GAAG,KACA;EAAA,IATH;IACEC,IAAI,GAAG,SAAS;IAChBC,QAAQ;IACRC,KAAK,EAAEC,YAAY,GAAG,EA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,EAAEA,QAAS;IACnBqD,IAAI,EAAC,MAAM;IACXC,OAAO,EAAEjB,WAAY;IACrB1C,QAAQ,EAAE+B,YAAa;IACvB,eAAY,YAAY;IACxB6B,cAAc,eACZtF,KAAA,CAAAqB,aAAA,CAACV,WAAW;MACVmB,IAAI,EAAEA,IAAK;MACXJ,QAAQ,EAAEoC,kBAAmB;MAC7BrB,OAAO,EAAEA,OAAQ;MACjB8C,QAAQ,EAAEjD,MAAO;MACjBkD,aAAa,eACXxF,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,qBACEtB,KAAA,CAAAqB,aAAA,CAACT,sBAAsB;QAAC6E,KAAK,EAAE3D;MAAK,GACjCrB,cAAc,CAAC6B,MAAM,CACA,CAAC,KACxB,EAAC9B,qBAAqB,CAAC8B,MAAM,CAC9B,CACH;MACDP,QAAQ,EAAEA,QAAS;MACnB2D,oBAAoB,EAAE,KAAM;MAC5BC,MAAM;MACNzE,YAAY,EAAEA;IAAa,CAC5B;EACF,EACF,CAAC;AAEN,CACF,CAAC;AAEDS,UAAU,CAACiE,WAAW,GAAG,YAAY"}
|
|
1
|
+
{"version":3,"file":"InputPhone.js","names":["React","forwardRef","useCallback","useEffect","useRef","useState","callingCodeToCountryCodeMap","countriesArraySortedByName","getCountryCallingCode","getCountryFlag","Input","InputSelect","StyledFlagTriggerLabel","StyledOptionCode","StyledOptionFlag","StyledOptionName","StyledOptionRowEnd","StyledOptionWrapper","useForkRef","RadioButton","renderOption","option","data","createElement","Fragment","id","name","additionalInfo","checked","onChange","InputPhone","_ref","ref","size","disabled","value","defaultValue","defaultCountry","rest","inputRef","handleRef","prefix","setPrefix","setValue","options","map","country","countryCode","callingCode","separatePrefixFromValue","fullValue","newPrefix","newValue","startsWith","prefixLength","digits","slice","i","length","code","dialCode","handleChange","e","inputValue","target","test","handleSelectChange","val","setTimeout","_inputRef$current","current","focus","handlePaste","preventDefault","paste","clipboardData","getData","filteredPaste","replace","inputElement","currentTarget","selectionStart","selectionEnd","currentValue","beforeSelection","afterSelection","newValueAfterPaste","_extends","type","onPaste","startAdornment","selected","filterCriteria","filter","_option$additionalInf","toLowerCase","includes","selectedLabel","$size","keepSameOptionsOrder","search","displayName"],"sources":["../../../../src/components/Input/InputPhone.tsx"],"sourcesContent":["import React, {\n ChangeEventHandler,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n callingCodeToCountryCodeMap,\n countriesArraySortedByName,\n getCountryCallingCode,\n getCountryFlag,\n Country,\n} from \"country-explorer\";\n\nimport { Input, InputProps } from \"./Input\";\nimport { InputSelect } from \"./InputSelect\";\nimport {\n StyledFlagTriggerLabel,\n StyledOptionCode,\n StyledOptionFlag,\n StyledOptionName,\n StyledOptionRowEnd,\n StyledOptionWrapper,\n} from \"./Styles\";\nimport { useForkRef } from \"../../utils\";\nimport { RadioButton } from \"../RadioButton\";\n\nexport interface InputPhoneProps\n extends Omit<\n InputProps,\n \"type\" | \"startAdornment\" | \"onChange\" | \"value\" | \"size\"\n > {\n /** Input value */\n value?: string;\n /** Default country code to be selected */\n defaultCountry?: string;\n /** onChange function */\n onChange?: (val: string) => void;\n /** Input size */\n size?: \"small\" | \"regular\" | \"big\";\n}\n\nconst renderOption = (\n option: Record<string, React.ReactNode>,\n data: Record<string, unknown>\n): React.ReactElement => (\n <>\n <StyledOptionWrapper>\n <StyledOptionFlag>{getCountryFlag(option.id)}</StyledOptionFlag>\n <StyledOptionName>{option.name}</StyledOptionName>\n </StyledOptionWrapper>\n <StyledOptionRowEnd>\n <StyledOptionCode>{option.additionalInfo}</StyledOptionCode>\n <RadioButton\n checked={data.checked as boolean}\n onChange={data.onChange as ChangeEventHandler<HTMLInputElement>}\n />\n </StyledOptionRowEnd>\n </>\n);\n\nexport const InputPhone = forwardRef<HTMLInputElement, InputPhoneProps>(\n (\n {\n size = \"regular\",\n disabled,\n value: defaultValue = \"\",\n onChange,\n defaultCountry = \"US\",\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const handleRef = useForkRef(ref, inputRef);\n const [prefix, setPrefix] = useState(defaultCountry);\n const [value, setValue] = useState<string>(\"\");\n\n const options = countriesArraySortedByName.map((country: Country) => ({\n id: country.countryCode,\n name: country.name,\n additionalInfo: `+${country.callingCode}`,\n }));\n\n const separatePrefixFromValue = (\n fullValue: string\n ): { newPrefix: string; newValue: string } => {\n let newPrefix = prefix;\n let newValue = fullValue;\n\n if (fullValue.startsWith(\"+\") || fullValue.startsWith(\"00\")) {\n const prefixLength = fullValue.startsWith(\"+\") ? 1 : 2;\n const digits = fullValue.slice(prefixLength);\n\n for (let i = digits.length; i >= 1; i--) {\n const code = digits.slice(0, i);\n if (callingCodeToCountryCodeMap[code]) {\n newPrefix = callingCodeToCountryCodeMap[code];\n const dialCode = getCountryCallingCode(newPrefix);\n newValue = fullValue.slice(prefixLength + dialCode.length);\n break;\n }\n }\n }\n\n return { newPrefix, newValue };\n };\n\n useEffect(() => {\n const { newPrefix, newValue } = separatePrefixFromValue(defaultValue);\n setPrefix(newPrefix);\n setValue(newValue);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [defaultValue]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n if (/[^0-9+]/.test(inputValue)) {\n return;\n }\n\n const { newPrefix, newValue } = separatePrefixFromValue(inputValue);\n setPrefix(newPrefix);\n setValue(newValue);\n\n typeof onChange === \"function\" &&\n onChange(`+${getCountryCallingCode(newPrefix)}${newValue}`);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [onChange, prefix]\n );\n\n const handleSelectChange = (val: string | number | (string | number)[]) => {\n setPrefix(val as string);\n setTimeout(() => {\n inputRef.current?.focus();\n }, 200);\n typeof onChange === \"function\" &&\n onChange(`+${getCountryCallingCode(val)}${value}`);\n };\n\n const handlePaste = (e: React.ClipboardEvent) => {\n e.preventDefault();\n\n const paste = e.clipboardData.getData(\"text\");\n const filteredPaste = paste.replace(/[^0-9+]/g, \"\");\n\n const inputElement = e.currentTarget as HTMLInputElement;\n const { selectionStart, selectionEnd } = inputElement;\n\n if (selectionStart !== null && selectionEnd !== null) {\n const currentValue = inputElement.value;\n const beforeSelection = currentValue.slice(0, selectionStart);\n const afterSelection = currentValue.slice(selectionEnd);\n\n const newValueAfterPaste =\n beforeSelection + filteredPaste + afterSelection;\n const { newPrefix, newValue } =\n separatePrefixFromValue(newValueAfterPaste);\n\n setPrefix(newPrefix);\n setValue(newValue);\n\n typeof onChange === \"function\" &&\n onChange(`+${getCountryCallingCode(newPrefix)}${newValue}`);\n }\n };\n\n return (\n <Input\n {...rest}\n ref={handleRef}\n size={size}\n value={value}\n disabled={disabled}\n type=\"text\"\n onPaste={handlePaste}\n onChange={handleChange}\n data-testid=\"InputPhone\"\n startAdornment={\n <InputSelect\n size={size}\n onChange={handleSelectChange}\n options={options}\n selected={prefix}\n filterCriteria={(option, filter) => {\n return !!option?.additionalInfo?.toLowerCase().includes(filter);\n }}\n selectedLabel={\n <>\n <StyledFlagTriggerLabel $size={size}>\n {getCountryFlag(prefix)}\n </StyledFlagTriggerLabel>\n +{getCountryCallingCode(prefix)}\n </>\n }\n disabled={disabled}\n keepSameOptionsOrder={false}\n search\n renderOption={renderOption}\n />\n }\n />\n );\n }\n);\n\nInputPhone.displayName = \"InputPhone\";\n"],"mappings":";AAAA,OAAOA,KAAK,IAEVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SACEC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,qBAAqB,EACrBC,cAAc,QAET,kBAAkB;AAEzB,SAASC,KAAK,QAAoB,SAAS;AAC3C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SACEC,sBAAsB,EACtBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,kBAAkB,EAClBC,mBAAmB,QACd,UAAU;AACjB,SAASC,UAAU,QA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C;MACjE,CAAE;MACFI,aAAa,eACXjG,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAwB,QAAA,qBACExB,KAAA,CAAAuB,aAAA,CAACX,sBAAsB;QAACsF,KAAK,EAAEjE;MAAK,GACjCxB,cAAc,CAACgC,MAAM,CACA,CAAC,KACxB,EAACjC,qBAAqB,CAACiC,MAAM,CAC9B,CACH;MACDP,QAAQ,EAAEA,QAAS;MACnBiE,oBAAoB,EAAE,KAAM;MAC5BC,MAAM;MACNhF,YAAY,EAAEA;IAAa,CAC5B;EACF,EACF,CAAC;AAEN,CACF,CAAC;AAEDU,UAAU,CAACuE,WAAW,GAAG,YAAY"}
|
|
@@ -14,6 +14,8 @@ export interface InputSelectProps {
|
|
|
14
14
|
target?: ElementWithRef<Element>;
|
|
15
15
|
/** Render option */
|
|
16
16
|
renderOption?: (option: Record<string, ReactNode>, data: Record<string, unknown>) => string | ReactElement;
|
|
17
|
+
/** Custom filter function for additional filtering criteria */
|
|
18
|
+
filterCriteria?: (option: IOptionItemProps, filter: string) => boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare const InputSelect: React.FC<InputSelectProps>;
|
|
19
21
|
//# sourceMappingURL=InputSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/InputSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAU,MAAM,WAAW,CAAC;AAGrE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,gBAA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MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,MAAM,GAAG,YAAY,CAAC;IAC3B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CACxE;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAsClD,CAAC"}
|
|
@@ -15,7 +15,8 @@ export const InputSelect = _ref => {
|
|
|
15
15
|
disabledInternalSort = true,
|
|
16
16
|
keepSameOptionsOrder = true,
|
|
17
17
|
selectedLabel,
|
|
18
|
-
renderOption
|
|
18
|
+
renderOption,
|
|
19
|
+
filterCriteria
|
|
19
20
|
} = _ref;
|
|
20
21
|
return /*#__PURE__*/React.createElement(Select, {
|
|
21
22
|
onChange: onChange,
|
|
@@ -33,7 +34,8 @@ export const InputSelect = _ref => {
|
|
|
33
34
|
disabledInternalSort: disabledInternalSort,
|
|
34
35
|
keepSameOptionsOrder: keepSameOptionsOrder,
|
|
35
36
|
selected: selected,
|
|
36
|
-
renderOption: renderOption
|
|
37
|
+
renderOption: renderOption,
|
|
38
|
+
filterCriteria: filterCriteria
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
var _StyledStyledButton = _styled(StyledButton).withConfig({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSelect.js","names":["React","StyledInputSelectTrigger","ArrowDownIcon","ArrowDownSmallIcon","Select","StyledButton","InputSelect","_ref","onChange","size","selected","options","search","disabled","disabledInternalSort","keepSameOptionsOrder","selectedLabel","renderOption","createElement","forceCloseMenu","disableSearch","target","_StyledStyledButton","$disabled","$size","fill","_styled","withConfig","displayName","componentId"],"sources":["../../../../src/components/Input/InputSelect.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode } from \"react\";\n\nimport { StyledInputSelectTrigger } from \"./Styles\";\nimport { ArrowDownIcon, ArrowDownSmallIcon } from \"../Icons\";\nimport { ElementWithRef, IOptionItemProps, Select } from \"../Select\";\nimport { StyledButton } from \"../Trigger/Styles\";\n\nexport interface InputSelectProps {\n onChange: (val: string | number | (string | number)[]) => void;\n size: string;\n selected: string;\n options: IOptionItemProps[];\n disabled?: boolean;\n search?: boolean;\n // @ToDo: Fix this\n disabledInternalSort?: boolean;\n keepSameOptionsOrder?: boolean;\n selectedLabel?: ReactNode;\n /** Set select target element */\n target?: ElementWithRef<Element>;\n /** Render option */\n renderOption?: (\n option: Record<string, ReactNode>,\n data: Record<string, unknown>\n ) => string | ReactElement;\n}\n\nexport const InputSelect: React.FC<InputSelectProps> = ({\n onChange,\n size,\n selected,\n options,\n search = false,\n disabled = false,\n disabledInternalSort = true,\n keepSameOptionsOrder = true,\n selectedLabel,\n renderOption,\n}) => {\n return (\n <Select\n onChange={onChange}\n forceCloseMenu\n disableSearch={!search}\n target={\n <StyledButton css=\"flex-shrink:0\">\n <StyledInputSelectTrigger $disabled={disabled} $size={size}>\n {selectedLabel ? selectedLabel : selected}\n {size === \"big\" ? (\n <ArrowDownIcon fill=\"var(--color-theme-700)\" />\n ) : (\n <ArrowDownSmallIcon fill=\"var(--color-theme-700)\" />\n )}\n </StyledInputSelectTrigger>\n </StyledButton>\n }\n options={options}\n disabledInternalSort={disabledInternalSort}\n keepSameOptionsOrder={keepSameOptionsOrder}\n selected={selected}\n renderOption={renderOption}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAmC,OAAO;AAEtD,SAASC,wBAAwB,QAAQ,UAAU;AACnD,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,UAAU;AAC5D,SAA2CC,MAAM,QAAQ,WAAW;AACpE,SAASC,YAAY,QAAQ,mBAAmB;
|
|
1
|
+
{"version":3,"file":"InputSelect.js","names":["React","StyledInputSelectTrigger","ArrowDownIcon","ArrowDownSmallIcon","Select","StyledButton","InputSelect","_ref","onChange","size","selected","options","search","disabled","disabledInternalSort","keepSameOptionsOrder","selectedLabel","renderOption","filterCriteria","createElement","forceCloseMenu","disableSearch","target","_StyledStyledButton","$disabled","$size","fill","_styled","withConfig","displayName","componentId"],"sources":["../../../../src/components/Input/InputSelect.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode } from \"react\";\n\nimport { StyledInputSelectTrigger } from \"./Styles\";\nimport { ArrowDownIcon, ArrowDownSmallIcon } from \"../Icons\";\nimport { ElementWithRef, IOptionItemProps, Select } from \"../Select\";\nimport { StyledButton } from \"../Trigger/Styles\";\n\nexport interface InputSelectProps {\n onChange: (val: string | number | (string | number)[]) => void;\n size: string;\n selected: string;\n options: IOptionItemProps[];\n disabled?: boolean;\n search?: boolean;\n // @ToDo: Fix this\n disabledInternalSort?: boolean;\n keepSameOptionsOrder?: boolean;\n selectedLabel?: ReactNode;\n /** Set select target element */\n target?: ElementWithRef<Element>;\n /** Render option */\n renderOption?: (\n option: Record<string, ReactNode>,\n data: Record<string, unknown>\n ) => string | ReactElement;\n /** Custom filter function for additional filtering criteria */\n filterCriteria?: (option: IOptionItemProps, filter: string) => boolean;\n}\n\nexport const InputSelect: React.FC<InputSelectProps> = ({\n onChange,\n size,\n selected,\n options,\n search = false,\n disabled = false,\n disabledInternalSort = true,\n keepSameOptionsOrder = true,\n selectedLabel,\n renderOption,\n filterCriteria,\n}) => {\n return (\n <Select\n onChange={onChange}\n forceCloseMenu\n disableSearch={!search}\n target={\n <StyledButton css=\"flex-shrink:0\">\n <StyledInputSelectTrigger $disabled={disabled} $size={size}>\n {selectedLabel ? selectedLabel : selected}\n {size === \"big\" ? (\n <ArrowDownIcon fill=\"var(--color-theme-700)\" />\n ) : (\n <ArrowDownSmallIcon fill=\"var(--color-theme-700)\" />\n )}\n </StyledInputSelectTrigger>\n </StyledButton>\n }\n options={options}\n disabledInternalSort={disabledInternalSort}\n keepSameOptionsOrder={keepSameOptionsOrder}\n selected={selected}\n renderOption={renderOption}\n filterCriteria={filter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AtB,YAAA,EAAAuB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { InputProps } from "./Input";
|
|
2
3
|
import { InputMode, InputSize } from "./types";
|
|
3
4
|
interface StyledInputWrapperProps {
|
|
@@ -27,7 +28,9 @@ export declare const StyledFlagTriggerLabel: import("styled-components").StyledC
|
|
|
27
28
|
$size: "small" | "regular" | "big";
|
|
28
29
|
}, never>;
|
|
29
30
|
export declare const StyledOptionFlag: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
30
|
-
export declare const StyledOptionName: import("styled-components").StyledComponent<"
|
|
31
|
+
export declare const StyledOptionName: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../Typography").IBodyProps & Omit<import("../Typography/Typography").ITypographyProps, "variant" | "weight"> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
32
|
+
export declare const StyledOptionCode: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../Typography").IBodyProps & Omit<import("../Typography/Typography").ITypographyProps, "variant" | "weight"> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
33
|
+
export declare const StyledOptionRowEnd: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
31
34
|
export declare const StyledOptionWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
32
35
|
export {};
|
|
33
36
|
//# sourceMappingURL=Styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAM/C,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,yFAuE9B,CAAC;AAIF,UAAU,gBAAiB,SAAQ,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC;IAC1D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,oFA+DvB,CAAC;AAIF,eAAO,MAAM,8BAA8B,oEAK1C,CAAC;AAIF,eAAO,MAAM,uBAAuB;eACvB,MAAM;YACT,MAAM;SAoBf,CAAC;AAIF,eAAO,MAAM,wBAAwB;WAC5B,MAAM;;SAgCd,CAAC;AAIF,eAAO,MAAM,sBAAsB;WAC1B,OAAO,GAAG,SAAS,GAAG,KAAK;SAGnC,CAAC;AAIF,eAAO,MAAM,gBAAgB,qEAG5B,CAAC;AAIF,eAAO,MAAM,gBAAgB,8QAI5B,CAAC;AAIF,eAAO,MAAM,gBAAgB,8QAO5B,CAAC;AAIF,eAAO,MAAM,kBAAkB,qEAI9B,CAAC;AAIF,eAAO,MAAM,mBAAmB,qEAQ/B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { BoxSizingStyle } from "../BoxSizingStyle";
|
|
3
3
|
import { FontStyle } from "../FontStyle";
|
|
4
4
|
import { InputResetStyle } from "../InputResetStyle";
|
|
5
|
+
import { Body2 } from "../Typography";
|
|
5
6
|
export const StyledInputWrapper = styled.div.withConfig({
|
|
6
7
|
displayName: "Styles__StyledInputWrapper",
|
|
7
8
|
componentId: "sc-ce8kcp-0"
|
|
@@ -68,14 +69,24 @@ export const StyledOptionFlag = styled.span.withConfig({
|
|
|
68
69
|
componentId: "sc-ce8kcp-6"
|
|
69
70
|
})(["font-size:24px;margin-right:4px;"]);
|
|
70
71
|
StyledFlagTriggerLabel.displayName = "StyledOptionFlag";
|
|
71
|
-
export const StyledOptionName = styled.
|
|
72
|
+
export const StyledOptionName = styled(Body2).withConfig({
|
|
72
73
|
displayName: "Styles__StyledOptionName",
|
|
73
74
|
componentId: "sc-ce8kcp-7"
|
|
74
75
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
75
76
|
StyledOptionName.displayName = "StyledOptionName";
|
|
77
|
+
export const StyledOptionCode = styled(Body2).withConfig({
|
|
78
|
+
displayName: "Styles__StyledOptionCode",
|
|
79
|
+
componentId: "sc-ce8kcp-8"
|
|
80
|
+
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-left:auto;color:var(--color-theme-600);flex-shrink:0;"]);
|
|
81
|
+
StyledOptionCode.displayName = "StyledOptionCode";
|
|
82
|
+
export const StyledOptionRowEnd = styled.span.withConfig({
|
|
83
|
+
displayName: "Styles__StyledOptionRowEnd",
|
|
84
|
+
componentId: "sc-ce8kcp-9"
|
|
85
|
+
})(["display:flex;align-items:center;gap:8px;"]);
|
|
86
|
+
StyledOptionRowEnd.displayName = "StyledOptionRowEnd";
|
|
76
87
|
export const StyledOptionWrapper = styled.span.withConfig({
|
|
77
88
|
displayName: "Styles__StyledOptionWrapper",
|
|
78
|
-
componentId: "sc-ce8kcp-
|
|
89
|
+
componentId: "sc-ce8kcp-10"
|
|
79
90
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-right:8px;display:flex;justify-items:center;align-items:center;"]);
|
|
80
91
|
StyledOptionWrapper.displayName = "StyledOptionWrapper";
|
|
81
92
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","InputResetStyle","StyledInputWrapper","div","withConfig","displayName","componentId","props","$mode","$size","$disabled","$invalid","StyledInput","input","disabled","$loading","align","StyledPasswordIndicatorWrapper","StyledPasswordIndicator","$strength","$index","StyledInputSelectTrigger","StyledFlagTriggerLabel","span","_ref","StyledOptionFlag","StyledOptionName","StyledOptionWrapper"],"sources":["../../../../src/components/Input/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { InputProps } from \"./Input\";\nimport { InputMode, InputSize } from \"./types\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { InputResetStyle } from \"../InputResetStyle\";\n\ninterface StyledInputWrapperProps {\n $size?: InputSize;\n $invalid?: boolean;\n $disabled?: boolean;\n $mode?: InputMode;\n}\n\nexport const StyledInputWrapper = styled.div<StyledInputWrapperProps>`\n align-items: center;\n background-color: var(--input-background-color);\n border-color: var(--color-theme-500);\n border-radius: 8px;\n border-style: solid;\n border-width: 1px;\n cursor: text;\n display: flex;\n height: 32px;\n padding-block: 4px;\n padding-inline: 4px;\n transition: all 0.3s ease;\n width: 360px;\n\n ${FontStyle}\n ${BoxSizingStyle}\n\n\n ${(props) =>\n props.$mode === \"flat\" &&\n css`\n background-color: transparent;\n border: none;\n border-radius: none;\n `}\n\n\n ${(props) =>\n props.$size === \"small\" &&\n css`\n border-radius: 6px;\n height: 24px;\n `}\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n height: 40px;\n `}\n\n ${(props) =>\n props.$size === \"biggest\" &&\n css`\n height: 48px;\n `}\n\n ${(props) =>\n props.$disabled &&\n css`\n cursor: default;\n opacity: 50%;\n `}\n\n ${(props) =>\n !props.$disabled &&\n !props.$invalid &&\n css`\n &:focus-within,\n &:hover {\n border-color: var(--color-primary);\n }\n `}\n\n ${(props) =>\n !props.$disabled &&\n props.$invalid &&\n props.$mode === \"outlined\" &&\n css`\n border-color: var(--red-alert);\n `}\n`;\n\nStyledInputWrapper.displayName = \"StyledInputWrapper\";\n\ninterface StyledInputProps extends Pick<InputProps, \"align\"> {\n $size?: InputSize;\n $loading?: boolean;\n $mode?: InputMode;\n $invalid?: boolean;\n}\n\nexport const StyledInput = styled.input<StyledInputProps>`\n ${BoxSizingStyle}\n ${InputResetStyle}\n background-color: var(--input-background-color);\n border: none;\n color: var(--color-theme-900);\n /* @TODO: Prebaciti velicine fontova, weight, razmake, itd... u naše varijable. */\n font-size: 0.875rem;\n font-weight: 400;\n letter-spacing: 0.02em;\n margin-block: 0;\n margin-inline: 4px;\n outline: none;\n padding: 0;\n width: 100%;\n\n ${(props) =>\n props.$mode === \"flat\" &&\n css`\n background-color: transparent;\n `}\n\n &::placeholder {\n color: var(--color-theme-transparent-500);\n }\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n font-size: 1rem;\n `}\n\n ${(props) =>\n props.$size === \"biggest\" &&\n css`\n font-size: 1.25rem;\n font-weight: 700;\n `}\n\n ${(props) =>\n props.disabled &&\n css`\n cursor: default;\n `}\n\n ${(props) =>\n props.$loading &&\n css`\n cursor: progress;\n `}\n\n ${(props) =>\n props.align &&\n css`\n text-align: ${props.align};\n `}\n\n ${(props) =>\n props.$mode === \"flat\" &&\n props.$invalid &&\n css`\n color: var(--red-alert);\n `}\n`;\n\nStyledInput.displayName = \"StyledInput\";\n\nexport const StyledPasswordIndicatorWrapper = styled.div`\n display: flex;\n gap: 2px;\n margin-top: 6px;\n margin-bottom: 4px;\n`;\n\nStyledPasswordIndicatorWrapper.displayName = \"StyledPasswordIndicatorWrapper\";\n\nexport const StyledPasswordIndicator = styled.div<{\n $strength: number;\n $index: number;\n}>`\n width: 100%;\n height: 4px;\n border-radius: 6px;\n background-color: ${(props) => {\n const { $strength, $index } = props;\n\n if ($strength === 0) {\n return \"var(--color-theme-300)\";\n } else if ($strength === 1) {\n return $index === 0 ? \"var(--red-alert)\" : \"var(--color-theme-300)\";\n } else if ($strength === 2) {\n return $index < 2 ? \"var(--color-orange)\" : \"var(--color-theme-300)\";\n } else if ($strength === 3) {\n return $index < 3 ? \"var(--color-blue-sky)\" : \"var(--color-theme-300)\";\n } else {\n return \"var(--color-sucess-green)\";\n }\n }};\n`;\n\nStyledPasswordIndicator.displayName = \"StyledPasswordIndicator\";\n\nexport const StyledInputSelectTrigger = styled.div<{\n $size: string;\n $disabled?: boolean;\n}>`\n display: flex;\n gap: 6px;\n align-items: center;\n margin-right: 2px;\n margin-left: 8px;\n color: var(--color-theme-700);\n font-weight: 400;\n letter-spacing: 0.02em;\n font-size: 0.875rem;\n flex-shrink: 0;\n cursor: ${(props) => {\n if (props.$disabled) {\n return \"unset\";\n }\n return \"pointer\";\n }};\n\n pointer-events: ${(props) => {\n if (props.$disabled) {\n return \"none\";\n }\n return \"unset\";\n }};\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n font-size: 1rem;\n `}\n`;\n\nStyledInputSelectTrigger.displayName = \"StyledInputSelectTrigger\";\n\nexport const StyledFlagTriggerLabel = styled.span<{\n $size: \"small\" | \"regular\" | \"big\";\n}>`\n font-size: ${({ $size }) => ($size === \"small\" ? \"20px\" : \"24px\")};\n`;\n\nStyledFlagTriggerLabel.displayName = \"StyledFlagTriggerLabel\";\n\nexport const StyledOptionFlag = styled.span`\n font-size: 24px;\n margin-right: 4px;\n`;\n\nStyledFlagTriggerLabel.displayName = \"StyledOptionFlag\";\n\nexport const StyledOptionName = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nStyledOptionName.displayName = \"StyledOptionName\";\n\nexport const StyledOptionWrapper = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin-right: 8px;\n display: flex;\n justify-items: center;\n align-items: center;\n`;\n\nStyledOptionWrapper.displayName = \"StyledOptionWrapper\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG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AK;EACnB,IAAIA,KAAK,CAACG,SAAS,EAAE;IACnB,OAAO,OAAO;EAChB;EACA,OAAO,SAAS;AAClB,CAAC,EAEkBH,KAAK,IAAK;EAC3B,IAAIA,KAAK,CAACG,SAAS,EAAE;IACnB,OAAO,MAAM;EACf;EACA,OAAO,OAAO;AAChB,CAAC,EAEEH,KAAK,IACNA,KAAK,CAACE,KAAK,KAAK,KAAK,IACrBX,GAAG,qBAEF,CACJ;AAEDuB,wBAAwB,CAAChB,WAAW,GAAG,0BAA0B;AAEjE,OAAO,MAAMiB,sBAAsB,GAAGzB,MAAM,CAAC0B,IAAI,CAAAnB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wBAGlCkB,IAAA;EAAA,IAAC;IAAEf;EAAM,CAAC,GAAAe,IAAA;EAAA,OAAMf,KAAK,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM;AAAA,CAAC,CAClE;AAEDa,sBAAsB,CAACjB,WAAW,GAAG,wBAAwB;AAE7D,OAAO,MAAMoB,gBAAgB,GAAG5B,MAAM,CAAC0B,IAAI,CAAAnB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wCAG1C;AAEDgB,sBAAsB,CAACjB,WAAW,GAAG,kBAAkB;AAEvD,OAAO,MAAMqB,gBAAgB,GAAG7B,MAAM,CAAC0B,IAAI,CAAAnB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kEAI1C;AAEDoB,gBAAgB,CAACrB,WAAW,GAAG,kBAAkB;AAEjD,OAAO,MAAMsB,mBAAmB,GAAG9B,MAAM,CAAC0B,IAAI,CAAAnB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wIAQ7C;AAEDqB,mBAAmB,CAACtB,WAAW,GAAG,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","css","BoxSizingStyle","FontStyle","InputResetStyle","Body2","StyledInputWrapper","div","withConfig","displayName","componentId","props","$mode","$size","$disabled","$invalid","StyledInput","input","disabled","$loading","align","StyledPasswordIndicatorWrapper","StyledPasswordIndicator","$strength","$index","StyledInputSelectTrigger","StyledFlagTriggerLabel","span","_ref","StyledOptionFlag","StyledOptionName","StyledOptionCode","StyledOptionRowEnd","StyledOptionWrapper"],"sources":["../../../../src/components/Input/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\n\nimport { InputProps } from \"./Input\";\nimport { InputMode, InputSize } from \"./types\";\nimport { BoxSizingStyle } from \"../BoxSizingStyle\";\nimport { FontStyle } from \"../FontStyle\";\nimport { InputResetStyle } from \"../InputResetStyle\";\nimport { Body2 } from \"../Typography\";\n\ninterface StyledInputWrapperProps {\n $size?: InputSize;\n $invalid?: boolean;\n $disabled?: boolean;\n $mode?: InputMode;\n}\n\nexport const StyledInputWrapper = styled.div<StyledInputWrapperProps>`\n align-items: center;\n background-color: var(--input-background-color);\n border-color: var(--color-theme-500);\n border-radius: 8px;\n border-style: solid;\n border-width: 1px;\n cursor: text;\n display: flex;\n height: 32px;\n padding-block: 4px;\n padding-inline: 4px;\n transition: all 0.3s ease;\n width: 360px;\n\n ${FontStyle}\n ${BoxSizingStyle}\n\n\n ${(props) =>\n props.$mode === \"flat\" &&\n css`\n background-color: transparent;\n border: none;\n border-radius: none;\n `}\n\n\n ${(props) =>\n props.$size === \"small\" &&\n css`\n border-radius: 6px;\n height: 24px;\n `}\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n height: 40px;\n `}\n\n ${(props) =>\n props.$size === \"biggest\" &&\n css`\n height: 48px;\n `}\n\n ${(props) =>\n props.$disabled &&\n css`\n cursor: default;\n opacity: 50%;\n `}\n\n ${(props) =>\n !props.$disabled &&\n !props.$invalid &&\n css`\n &:focus-within,\n &:hover {\n border-color: var(--color-primary);\n }\n `}\n\n ${(props) =>\n !props.$disabled &&\n props.$invalid &&\n props.$mode === \"outlined\" &&\n css`\n border-color: var(--red-alert);\n `}\n`;\n\nStyledInputWrapper.displayName = \"StyledInputWrapper\";\n\ninterface StyledInputProps extends Pick<InputProps, \"align\"> {\n $size?: InputSize;\n $loading?: boolean;\n $mode?: InputMode;\n $invalid?: boolean;\n}\n\nexport const StyledInput = styled.input<StyledInputProps>`\n ${BoxSizingStyle}\n ${InputResetStyle}\n background-color: var(--input-background-color);\n border: none;\n color: var(--color-theme-900);\n /* @TODO: Prebaciti velicine fontova, weight, razmake, itd... u naše varijable. */\n font-size: 0.875rem;\n font-weight: 400;\n letter-spacing: 0.02em;\n margin-block: 0;\n margin-inline: 4px;\n outline: none;\n padding: 0;\n width: 100%;\n\n ${(props) =>\n props.$mode === \"flat\" &&\n css`\n background-color: transparent;\n `}\n\n &::placeholder {\n color: var(--color-theme-transparent-500);\n }\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n font-size: 1rem;\n `}\n\n ${(props) =>\n props.$size === \"biggest\" &&\n css`\n font-size: 1.25rem;\n font-weight: 700;\n `}\n\n ${(props) =>\n props.disabled &&\n css`\n cursor: default;\n `}\n\n ${(props) =>\n props.$loading &&\n css`\n cursor: progress;\n `}\n\n ${(props) =>\n props.align &&\n css`\n text-align: ${props.align};\n `}\n\n ${(props) =>\n props.$mode === \"flat\" &&\n props.$invalid &&\n css`\n color: var(--red-alert);\n `}\n`;\n\nStyledInput.displayName = \"StyledInput\";\n\nexport const StyledPasswordIndicatorWrapper = styled.div`\n display: flex;\n gap: 2px;\n margin-top: 6px;\n margin-bottom: 4px;\n`;\n\nStyledPasswordIndicatorWrapper.displayName = \"StyledPasswordIndicatorWrapper\";\n\nexport const StyledPasswordIndicator = styled.div<{\n $strength: number;\n $index: number;\n}>`\n width: 100%;\n height: 4px;\n border-radius: 6px;\n background-color: ${(props) => {\n const { $strength, $index } = props;\n\n if ($strength === 0) {\n return \"var(--color-theme-300)\";\n } else if ($strength === 1) {\n return $index === 0 ? \"var(--red-alert)\" : \"var(--color-theme-300)\";\n } else if ($strength === 2) {\n return $index < 2 ? \"var(--color-orange)\" : \"var(--color-theme-300)\";\n } else if ($strength === 3) {\n return $index < 3 ? \"var(--color-blue-sky)\" : \"var(--color-theme-300)\";\n } else {\n return \"var(--color-sucess-green)\";\n }\n }};\n`;\n\nStyledPasswordIndicator.displayName = \"StyledPasswordIndicator\";\n\nexport const StyledInputSelectTrigger = styled.div<{\n $size: string;\n $disabled?: boolean;\n}>`\n display: flex;\n gap: 6px;\n align-items: center;\n margin-right: 2px;\n margin-left: 8px;\n color: var(--color-theme-700);\n font-weight: 400;\n letter-spacing: 0.02em;\n font-size: 0.875rem;\n flex-shrink: 0;\n cursor: ${(props) => {\n if (props.$disabled) {\n return \"unset\";\n }\n return \"pointer\";\n }};\n\n pointer-events: ${(props) => {\n if (props.$disabled) {\n return \"none\";\n }\n return \"unset\";\n }};\n\n ${(props) =>\n props.$size === \"big\" &&\n css`\n font-size: 1rem;\n `}\n`;\n\nStyledInputSelectTrigger.displayName = \"StyledInputSelectTrigger\";\n\nexport const StyledFlagTriggerLabel = styled.span<{\n $size: \"small\" | \"regular\" | \"big\";\n}>`\n font-size: ${({ $size }) => ($size === \"small\" ? \"20px\" : \"24px\")};\n`;\n\nStyledFlagTriggerLabel.displayName = \"StyledFlagTriggerLabel\";\n\nexport const StyledOptionFlag = styled.span`\n font-size: 24px;\n margin-right: 4px;\n`;\n\nStyledFlagTriggerLabel.displayName = \"StyledOptionFlag\";\n\nexport const StyledOptionName = styled(Body2)`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n\nStyledOptionName.displayName = \"StyledOptionName\";\n\nexport const StyledOptionCode = styled(Body2)`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin-left: auto;\n color: var(--color-theme-600);\n flex-shrink: 0;\n`;\n\nStyledOptionCode.displayName = \"StyledOptionCode\";\n\nexport const StyledOptionRowEnd = styled.span`\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n\nStyledOptionRowEnd.displayName = \"StyledOptionRowEnd\";\n\nexport const StyledOptionWrapper = styled.span`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin-right: 8px;\n display: flex;\n justify-items: center;\n align-items: center;\n`;\n\nStyledOptionWrapper.displayName = \"StyledOptionWrapper\";\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAI/C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,KAAK,QAAQ,eAAe;AASrC,OAAO,MAAMC,kBAAkB,GAAGN,MAAM,CAACO,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gUAexCP,SAAS,EACTD,cAAc,EAGbS,KAAK,IACNA,KAAK,CAACC,KAAK,KAAK,MAAM,IACtBX,GAAG,kEAIF,EAGAU,KAAK,IACNA,KAAK,CAACE,KAAK,KAAK,OAAO,IACvBZ,GAAG,oCAGF,EAEAU,KAAK,IACNA,KAAK,CAACE,KAAK,KAAK,KAAK,IACrBZ,GAAG,kBAEF,EAEEU,KAAK,IACRA,KAAK,CAACE,KAAK,KAAK,SAAS,IACzBZ,GAAG,kBAEF,EAEAU,KAAK,IACNA,KAAK,CAACG,SAAS,IACfb,GAAG,iCAGF,EAEAU,KAAK,IACN,CAACA,KAAK,CAACG,SAAS,IAChB,CAACH,KAAK,CAACI,QAAQ,IACfd,GAAG,gEAKF,EAEAU,KAAK,IACN,CAACA,KAAK,CAACG,SAAS,IAChBH,KAAK,CAACI,QAAQ,IACdJ,KAAK,CAACC,KAAK,KAAK,UAAU,IAC1BX,GAAG,oCAEF,CACJ;AAEDK,kBAAkB,CAACG,WAAW,GAAG,oBAAoB;AASrD,OAAO,MAAMO,WAAW,GAAGhB,MAAM,CAACiB,KAAK,CAAAT,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,kUACnCR,cAAc,EACdE,eAAe,EAcdO,KAAK,IACNA,KAAK,CAACC,KAAK,KAAK,MAAM,IACtBX,GAAG,mCAEF,EAMAU,KAAK,IACN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gBAAgB,CAACtB,WAAW,GAAG,kBAAkB;AAEjD,OAAO,MAAMuB,kBAAkB,GAAGhC,MAAM,CAAC2B,IAAI,CAAAnB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gDAI5C;AAEDsB,kBAAkB,CAACvB,WAAW,GAAG,oBAAoB;AAErD,OAAO,MAAMwB,mBAAmB,GAAGjC,MAAM,CAAC2B,IAAI,CAAAnB,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,wIAQ7C;AAEDuB,mBAAmB,CAACxB,WAAW,GAAG,qBAAqB"}
|
package/dist/index.js
CHANGED
|
@@ -14274,14 +14274,24 @@
|
|
|
14274
14274
|
componentId: "sc-ce8kcp-6"
|
|
14275
14275
|
})(["font-size:24px;margin-right:4px;"]);
|
|
14276
14276
|
StyledFlagTriggerLabel.displayName = "StyledOptionFlag";
|
|
14277
|
-
var StyledOptionName = styled__default["default"].
|
|
14277
|
+
var StyledOptionName = styled__default["default"](Body2).withConfig({
|
|
14278
14278
|
displayName: "Styles__StyledOptionName",
|
|
14279
14279
|
componentId: "sc-ce8kcp-7"
|
|
14280
14280
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"]);
|
|
14281
14281
|
StyledOptionName.displayName = "StyledOptionName";
|
|
14282
|
+
var StyledOptionCode = styled__default["default"](Body2).withConfig({
|
|
14283
|
+
displayName: "Styles__StyledOptionCode",
|
|
14284
|
+
componentId: "sc-ce8kcp-8"
|
|
14285
|
+
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-left:auto;color:var(--color-theme-600);flex-shrink:0;"]);
|
|
14286
|
+
StyledOptionCode.displayName = "StyledOptionCode";
|
|
14287
|
+
var StyledOptionRowEnd = styled__default["default"].span.withConfig({
|
|
14288
|
+
displayName: "Styles__StyledOptionRowEnd",
|
|
14289
|
+
componentId: "sc-ce8kcp-9"
|
|
14290
|
+
})(["display:flex;align-items:center;gap:8px;"]);
|
|
14291
|
+
StyledOptionRowEnd.displayName = "StyledOptionRowEnd";
|
|
14282
14292
|
var StyledOptionWrapper = styled__default["default"].span.withConfig({
|
|
14283
14293
|
displayName: "Styles__StyledOptionWrapper",
|
|
14284
|
-
componentId: "sc-ce8kcp-
|
|
14294
|
+
componentId: "sc-ce8kcp-10"
|
|
14285
14295
|
})(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-right:8px;display:flex;justify-items:center;align-items:center;"]);
|
|
14286
14296
|
StyledOptionWrapper.displayName = "StyledOptionWrapper";
|
|
14287
14297
|
|
|
@@ -16659,7 +16669,8 @@
|
|
|
16659
16669
|
_ref$keepSameOptionsO = _ref.keepSameOptionsOrder,
|
|
16660
16670
|
keepSameOptionsOrder = _ref$keepSameOptionsO === void 0 ? true : _ref$keepSameOptionsO,
|
|
16661
16671
|
selectedLabel = _ref.selectedLabel,
|
|
16662
|
-
renderOption = _ref.renderOption
|
|
16672
|
+
renderOption = _ref.renderOption,
|
|
16673
|
+
filterCriteria = _ref.filterCriteria;
|
|
16663
16674
|
return /*#__PURE__*/React__default["default"].createElement(Select, {
|
|
16664
16675
|
onChange: onChange,
|
|
16665
16676
|
forceCloseMenu: true,
|
|
@@ -16676,7 +16687,8 @@
|
|
|
16676
16687
|
disabledInternalSort: disabledInternalSort,
|
|
16677
16688
|
keepSameOptionsOrder: keepSameOptionsOrder,
|
|
16678
16689
|
selected: selected,
|
|
16679
|
-
renderOption: renderOption
|
|
16690
|
+
renderOption: renderOption,
|
|
16691
|
+
filterCriteria: filterCriteria
|
|
16680
16692
|
});
|
|
16681
16693
|
};
|
|
16682
16694
|
var _StyledStyledButton = styled__default["default"](StyledButton).withConfig({
|
|
@@ -16830,10 +16842,10 @@
|
|
|
16830
16842
|
|
|
16831
16843
|
var _excluded$F = ["size", "disabled", "value", "onChange", "defaultCountry"];
|
|
16832
16844
|
var renderOption$2 = function renderOption(option, data) {
|
|
16833
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledOptionWrapper, null, /*#__PURE__*/React__default["default"].createElement(StyledOptionFlag, null, countryExplorer.getCountryFlag(option.id)), /*#__PURE__*/React__default["default"].createElement(StyledOptionName, null, option.name)), /*#__PURE__*/React__default["default"].createElement(RadioButton, {
|
|
16845
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledOptionWrapper, null, /*#__PURE__*/React__default["default"].createElement(StyledOptionFlag, null, countryExplorer.getCountryFlag(option.id)), /*#__PURE__*/React__default["default"].createElement(StyledOptionName, null, option.name)), /*#__PURE__*/React__default["default"].createElement(StyledOptionRowEnd, null, /*#__PURE__*/React__default["default"].createElement(StyledOptionCode, null, option.additionalInfo), /*#__PURE__*/React__default["default"].createElement(RadioButton, {
|
|
16834
16846
|
checked: data.checked,
|
|
16835
16847
|
onChange: data.onChange
|
|
16836
|
-
}));
|
|
16848
|
+
})));
|
|
16837
16849
|
};
|
|
16838
16850
|
var InputPhone = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
16839
16851
|
var _ref$size = _ref.size,
|
|
@@ -16858,7 +16870,8 @@
|
|
|
16858
16870
|
var options = countryExplorer.countriesArraySortedByName.map(function (country) {
|
|
16859
16871
|
return {
|
|
16860
16872
|
id: country.countryCode,
|
|
16861
|
-
name:
|
|
16873
|
+
name: country.name,
|
|
16874
|
+
additionalInfo: "+".concat(country.callingCode)
|
|
16862
16875
|
};
|
|
16863
16876
|
});
|
|
16864
16877
|
var separatePrefixFromValue = function separatePrefixFromValue(fullValue) {
|
|
@@ -16871,12 +16884,11 @@
|
|
|
16871
16884
|
var code = digits.slice(0, i);
|
|
16872
16885
|
if (countryExplorer.callingCodeToCountryCodeMap[code]) {
|
|
16873
16886
|
newPrefix = countryExplorer.callingCodeToCountryCodeMap[code];
|
|
16874
|
-
|
|
16887
|
+
var dialCode = countryExplorer.getCountryCallingCode(newPrefix);
|
|
16888
|
+
newValue = fullValue.slice(prefixLength + dialCode.length);
|
|
16875
16889
|
break;
|
|
16876
16890
|
}
|
|
16877
16891
|
}
|
|
16878
|
-
} else if (fullValue.startsWith(prefix)) {
|
|
16879
|
-
newValue = fullValue.slice(prefix.length);
|
|
16880
16892
|
}
|
|
16881
16893
|
return {
|
|
16882
16894
|
newPrefix,
|
|
@@ -16947,6 +16959,10 @@
|
|
|
16947
16959
|
onChange: handleSelectChange,
|
|
16948
16960
|
options: options,
|
|
16949
16961
|
selected: prefix,
|
|
16962
|
+
filterCriteria: function filterCriteria(option, filter) {
|
|
16963
|
+
var _option$additionalInf;
|
|
16964
|
+
return !!(option !== null && option !== void 0 && (_option$additionalInf = option.additionalInfo) !== null && _option$additionalInf !== void 0 && _option$additionalInf.toLowerCase().includes(filter));
|
|
16965
|
+
},
|
|
16950
16966
|
selectedLabel: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledFlagTriggerLabel, {
|
|
16951
16967
|
$size: size
|
|
16952
16968
|
}, countryExplorer.getCountryFlag(prefix)), "+", countryExplorer.getCountryCallingCode(prefix)),
|
|
@@ -20548,15 +20564,18 @@
|
|
|
20548
20564
|
var StyledSpan = styled__default["default"](Typography).withConfig({
|
|
20549
20565
|
displayName: "Styles__StyledSpan",
|
|
20550
20566
|
componentId: "sc-1wapx2a-1"
|
|
20551
|
-
})(["visibility:hidden;display:block;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;position:relative;border:1px solid transparent;border-radius:6px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:pre;font-variant-numeric:tabular-nums;", " &:empty:before{content:\" \";}"], function (_ref) {
|
|
20567
|
+
})(["visibility:hidden;display:block;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;position:relative;border:1px solid transparent;border-radius:6px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:pre;font-variant-numeric:tabular-nums;", " ", " &:empty:before{content:\" \";}"], function (_ref) {
|
|
20552
20568
|
var $disabled = _ref.$disabled;
|
|
20553
20569
|
return $disabled && styled.css(["visibility:visible;"]);
|
|
20570
|
+
}, function (_ref2) {
|
|
20571
|
+
var invalid = _ref2.invalid;
|
|
20572
|
+
return invalid && styled.css(["border:1px solid var(--red-alert);"]);
|
|
20554
20573
|
});
|
|
20555
20574
|
StyledSpan.displayName = "StyledSpan";
|
|
20556
20575
|
var StyledInput$1 = styled__default["default"](Typography).withConfig({
|
|
20557
20576
|
displayName: "Styles__StyledInput",
|
|
20558
20577
|
componentId: "sc-1wapx2a-2"
|
|
20559
|
-
})(["", " background-color:inherit;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;text-overflow:ellipsis;font-variant-numeric:tabular-nums;&:focus-whitin{text-overflow:clip;}outline-width:0px;outline:none;&:disabled{opacity:0;}"], {
|
|
20578
|
+
})(["", " background-color:inherit;padding-left:4px;padding-right:4px;padding-top:1px;padding-bottom:1px;text-overflow:ellipsis;font-variant-numeric:tabular-nums;&:focus-whitin{text-overflow:clip;}outline-width:0px;outline:none;&:disabled{opacity:0;}", ""], {
|
|
20560
20579
|
"position": "absolute",
|
|
20561
20580
|
"inset": "0px",
|
|
20562
20581
|
"boxSizing": "border-box",
|
|
@@ -20574,10 +20593,13 @@
|
|
|
20574
20593
|
":hover": {
|
|
20575
20594
|
"borderColor": "var(--color-theme-700)"
|
|
20576
20595
|
}
|
|
20596
|
+
}, function (_ref3) {
|
|
20597
|
+
var invalid = _ref3.invalid;
|
|
20598
|
+
return invalid && styled.css(["border-color:var(--red-alert) !important;"]);
|
|
20577
20599
|
});
|
|
20578
20600
|
StyledInput$1.displayName = "StyledInput";
|
|
20579
20601
|
|
|
20580
|
-
var _excluded$g = ["className", "variant", "weight", "disabled", "inputProps", "wrapRef", "children"];
|
|
20602
|
+
var _excluded$g = ["className", "variant", "weight", "disabled", "inputProps", "wrapRef", "children", "invalid"];
|
|
20581
20603
|
var EditableContent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
20582
20604
|
var className = _ref.className,
|
|
20583
20605
|
_ref$variant = _ref.variant,
|
|
@@ -20588,6 +20610,7 @@
|
|
|
20588
20610
|
inputProps = _ref.inputProps,
|
|
20589
20611
|
wrapRef = _ref.wrapRef,
|
|
20590
20612
|
children = _ref.children,
|
|
20613
|
+
invalid = _ref.invalid,
|
|
20591
20614
|
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
20592
20615
|
var intInputRef = React.useRef(null);
|
|
20593
20616
|
var handleRef = useForkRef(ref, intInputRef);
|
|
@@ -20614,7 +20637,8 @@
|
|
|
20614
20637
|
value: inputProps === null || inputProps === void 0 ? void 0 : inputProps.value,
|
|
20615
20638
|
onBlur: handleBlur,
|
|
20616
20639
|
disabled: disabled,
|
|
20617
|
-
"data-form-type": "other"
|
|
20640
|
+
"data-form-type": "other",
|
|
20641
|
+
invalid: invalid
|
|
20618
20642
|
})));
|
|
20619
20643
|
});
|
|
20620
20644
|
EditableContent.displayName = "EditableContent";
|
|
@@ -20785,7 +20809,7 @@
|
|
|
20785
20809
|
});
|
|
20786
20810
|
EditableHours.displayName = "EditableHours";
|
|
20787
20811
|
|
|
20788
|
-
var _excluded$d = ["decimalLength", "decimalSeparator", "disableAbbreviation", "disabled", "disableMacros", "step", "thousandSeparator", "value", "onSave", "onCancel", "className", "allowEmptyValue", "onEnterKeyPress", "onClick", "onChange", "trimDecimals", "min", "max"];
|
|
20812
|
+
var _excluded$d = ["decimalLength", "decimalSeparator", "disableAbbreviation", "disabled", "disableMacros", "step", "thousandSeparator", "value", "onSave", "onCancel", "className", "allowEmptyValue", "onEnterKeyPress", "onClick", "onChange", "trimDecimals", "min", "max", "invalid"];
|
|
20789
20813
|
var EditableCurrency = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
|
20790
20814
|
var _ref$decimalLength = _ref.decimalLength,
|
|
20791
20815
|
decimalLength = _ref$decimalLength === void 0 ? 2 : _ref$decimalLength,
|
|
@@ -20812,6 +20836,7 @@
|
|
|
20812
20836
|
trimDecimals = _ref$trimDecimals === void 0 ? true : _ref$trimDecimals,
|
|
20813
20837
|
min = _ref.min,
|
|
20814
20838
|
max = _ref.max,
|
|
20839
|
+
invalid = _ref.invalid,
|
|
20815
20840
|
rest = _objectWithoutProperties(_ref, _excluded$d);
|
|
20816
20841
|
var inputRef = React.useRef(null);
|
|
20817
20842
|
var handleRef = useForkRef(ref, inputRef);
|
|
@@ -20853,6 +20878,7 @@
|
|
|
20853
20878
|
disabled: disabled,
|
|
20854
20879
|
ref: handleRef,
|
|
20855
20880
|
className: className,
|
|
20881
|
+
invalid: invalid,
|
|
20856
20882
|
inputProps: _objectSpread2({
|
|
20857
20883
|
value: formattedValue,
|
|
20858
20884
|
onBlur: onBlur,
|