linear-react-components-ui 2.0.0-rc.6 → 2.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/inputs/number/Currency.js +17 -11
- package/lib/inputs/number/Currency.js.map +1 -1
- package/lib/inputs/number/Decimal.js +17 -11
- package/lib/inputs/number/Decimal.js.map +1 -1
- package/lib/inputs/number/index.js +15 -9
- package/lib/inputs/number/index.js.map +1 -1
- package/lib/menus/float/SubMenuContainer.d.ts +10 -28
- package/lib/menus/float/SubMenuContainer.js +97 -83
- package/lib/menus/float/SubMenuContainer.js.map +1 -1
- package/package.json +1 -1
- package/lib/_virtual/index.js +0 -8
- package/lib/_virtual/index.js.map +0 -1
- package/lib/_virtual/index2.js +0 -5
- package/lib/_virtual/index2.js.map +0 -1
- package/lib/_virtual/index3.js +0 -5
- package/lib/_virtual/index3.js.map +0 -1
- package/lib/_virtual/react-is.development.js +0 -5
- package/lib/_virtual/react-is.development.js.map +0 -1
- package/lib/_virtual/react-is.production.min.js +0 -5
- package/lib/_virtual/react-is.production.min.js.map +0 -1
- package/lib/node_modules/object-assign/index.js +0 -79
- package/lib/node_modules/object-assign/index.js.map +0 -1
- package/lib/node_modules/prop-types/checkPropTypes.js +0 -69
- package/lib/node_modules/prop-types/checkPropTypes.js.map +0 -1
- package/lib/node_modules/prop-types/factoryWithThrowingShims.js +0 -59
- package/lib/node_modules/prop-types/factoryWithThrowingShims.js.map +0 -1
- package/lib/node_modules/prop-types/factoryWithTypeCheckers.js +0 -452
- package/lib/node_modules/prop-types/factoryWithTypeCheckers.js.map +0 -1
- package/lib/node_modules/prop-types/index.js +0 -21
- package/lib/node_modules/prop-types/index.js.map +0 -1
- package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -13
- package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +0 -1
- package/lib/node_modules/prop-types/lib/has.js +0 -12
- package/lib/node_modules/prop-types/lib/has.js.map +0 -1
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -166
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +0 -1
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -107
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +0 -1
- package/lib/node_modules/prop-types/node_modules/react-is/index.js +0 -18
- package/lib/node_modules/prop-types/node_modules/react-is/index.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef, useEffect } from "react";
|
|
3
3
|
import _ from "../../_virtual/lodash.js";
|
|
4
4
|
import { useIMask } from "react-imask";
|
|
5
|
-
import {
|
|
5
|
+
import { numberToPtBR } from "./format_number.js";
|
|
6
6
|
import InputTextBase from "../base/InputTextBase.js";
|
|
7
7
|
import { mergeRefs } from "../../form2/helpers.js";
|
|
8
8
|
const CurrencyField = (props) => {
|
|
@@ -26,7 +26,8 @@ const CurrencyField = (props) => {
|
|
|
26
26
|
const leftElements = displayCurrencySymbol ? /* @__PURE__ */ jsx("span", { className: "currency-symbol", children: currencySymbol }) : [];
|
|
27
27
|
const {
|
|
28
28
|
value: maskedValue,
|
|
29
|
-
setValue: setMaskedValue
|
|
29
|
+
setValue: setMaskedValue,
|
|
30
|
+
typedValue
|
|
30
31
|
} = useIMask({
|
|
31
32
|
mask: Number,
|
|
32
33
|
unmask,
|
|
@@ -40,26 +41,25 @@ const CurrencyField = (props) => {
|
|
|
40
41
|
thousandsSeparator: "."
|
|
41
42
|
}, {
|
|
42
43
|
ref: currencyNumberInputRef,
|
|
43
|
-
onAccept: (__,
|
|
44
|
+
onAccept: (__, maskRef, event) => {
|
|
44
45
|
if (isResetting.current) {
|
|
45
46
|
isResetting.current = false;
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
const parsedValue = numberToEnUS(options.unmaskedValue);
|
|
49
49
|
props?.onChange?.({
|
|
50
50
|
...event,
|
|
51
51
|
target: {
|
|
52
52
|
...event?.target,
|
|
53
53
|
name: props?.name,
|
|
54
|
-
value:
|
|
54
|
+
value: maskRef.typedValue
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
const handleBlur = (event_0) => {
|
|
60
|
+
const currentValue = typedValue;
|
|
60
61
|
if (!_.isNil(min)) {
|
|
61
|
-
|
|
62
|
-
if (_.isNaN(currentValue) || currentValue < min) {
|
|
62
|
+
if (_.isNil(currentValue) || _.isNaN(currentValue) || currentValue < min) {
|
|
63
63
|
setMaskedValue(numberToPtBR(min) ?? _.toString(min));
|
|
64
64
|
props?.onChange?.({
|
|
65
65
|
...event_0,
|
|
@@ -71,7 +71,13 @@ const CurrencyField = (props) => {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
props?.onBlur?.(
|
|
74
|
+
props?.onBlur?.({
|
|
75
|
+
...event_0,
|
|
76
|
+
target: {
|
|
77
|
+
...event_0?.target,
|
|
78
|
+
value: currentValue
|
|
79
|
+
}
|
|
80
|
+
});
|
|
75
81
|
};
|
|
76
82
|
useEffect(() => {
|
|
77
83
|
if (_.isNil(props?.value)) {
|
|
@@ -81,9 +87,9 @@ const CurrencyField = (props) => {
|
|
|
81
87
|
}
|
|
82
88
|
return;
|
|
83
89
|
}
|
|
84
|
-
const
|
|
85
|
-
if (!_.isEqual(
|
|
86
|
-
setMaskedValue(
|
|
90
|
+
const numericValue = typeof props.value === "string" ? parseFloat(props.value) : props.value;
|
|
91
|
+
if (!_.isEqual(typedValue, numericValue)) {
|
|
92
|
+
setMaskedValue(numberToPtBR(props?.value) ?? "");
|
|
87
93
|
}
|
|
88
94
|
}, [props?.value]);
|
|
89
95
|
return /* @__PURE__ */ jsx(InputTextBase, { ...props, inputRef: mergeRefs(currencyNumberInputRef, inputRef), type: "text", onChange: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.js","sources":["../../../src/lib/inputs/number/Currency.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport _ from 'lodash';\nimport { useIMask } from 'react-imask';\nimport { ICurrencyProps } from './types';\nimport {
|
|
1
|
+
{"version":3,"file":"Currency.js","sources":["../../../src/lib/inputs/number/Currency.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport _ from 'lodash';\nimport { useIMask } from 'react-imask';\nimport { ICurrencyProps } from './types';\nimport { numberToPtBR } from './format_number';\nimport InputTextBase from '../base/InputTextBase';\nimport { mergeRefs } from '../../form2/helpers';\nimport type { CustomInputEvent } from '../base/types';\n\nconst CurrencyField = (props: ICurrencyProps) => {\n const {\n inputRef = undefined, textAlign = 'left', themePopover = 'light', popoverAlign = 'left',\n min = undefined, max = undefined, allowNegative = false, scale = 2, normalizeZeros = true,\n padFractionalZeros = true, unmask = true, currencySymbol = 'R$', displayCurrencySymbol = true,\n } = props;\n const currencyNumberInputRef = useRef<HTMLInputElement | null>(null);\n const isResetting = useRef(false);\n const leftElements = displayCurrencySymbol ?\n <span className=\"currency-symbol\">{currencySymbol}</span>\n : [];\n\n const { value: maskedValue, setValue: setMaskedValue, typedValue } = useIMask({\n mask: Number,\n unmask,\n scale,\n normalizeZeros,\n padFractionalZeros,\n max,\n min: !_.isNil(min) ? min : (allowNegative ? undefined : 0),\n radix: ',',\n mapToRadix: ['.'],\n thousandsSeparator: '.',\n }, {\n ref: currencyNumberInputRef,\n onAccept: (__, maskRef, event) => {\n if (isResetting.current) {\n isResetting.current = false;\n return;\n }\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: maskRef.typedValue as any,\n },\n } as React.ChangeEvent<HTMLInputElement>);\n },\n });\n\n /**\n * Função sobrescrevendo o evento onBlur para tratar o valor mínimo ao sair do campo, \n * garantindo que o valor não seja menor que o mínimo definido.\n */\n const handleBlur = (event: CustomInputEvent) => {\n const currentValue = typedValue as number;\n if (!_.isNil(min)) {\n if (_.isNil(currentValue) || _.isNaN(currentValue) || currentValue < min) {\n setMaskedValue(numberToPtBR(min) ?? _.toString(min));\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: min as any,\n },\n } as CustomInputEvent);\n }\n }\n props?.onBlur?.({ \n ...event, \n target: { \n ...event?.target, \n value: currentValue as any, \n }, \n });\n };\n\n useEffect(() => {\n if (_.isNil(props?.value)) {\n if (maskedValue !== '') {\n isResetting.current = true;\n setMaskedValue('');\n }\n return;\n }\n const numericValue = typeof props.value === 'string' ? parseFloat(props.value) : props.value;\n if (!_.isEqual(typedValue, numericValue)) {\n setMaskedValue(numberToPtBR(props?.value) ?? '');\n }\n }, [props?.value]);\n\n return (\n <InputTextBase\n {...props}\n inputRef={mergeRefs(currencyNumberInputRef, inputRef) as any}\n type=\"text\"\n onChange={() => { }}\n leftElements={leftElements}\n onBlur={handleBlur}\n value={maskedValue}\n textAlign={textAlign}\n themePopover={themePopover}\n popoverAlign={popoverAlign} />\n );\n};\n\nexport default CurrencyField;\n"],"names":["CurrencyField","props","inputRef","undefined","textAlign","themePopover","popoverAlign","min","max","allowNegative","scale","normalizeZeros","padFractionalZeros","unmask","currencySymbol","displayCurrencySymbol","currencyNumberInputRef","useRef","isResetting","leftElements","value","maskedValue","setValue","setMaskedValue","typedValue","useIMask","mask","Number","_","isNil","radix","mapToRadix","thousandsSeparator","ref","onAccept","__","maskRef","event","current","onChange","target","name","handleBlur","currentValue","isNaN","numberToPtBR","toString","onBlur","useEffect","numericValue","parseFloat","isEqual","mergeRefs"],"mappings":";;;;;;;AASA,MAAMA,gBAAgBA,CAACC,UAA0B;AAC/C,QAAM;AAAA,IACJC,WAAWC;AAAAA,IAAWC,YAAY;AAAA,IAAQC,eAAe;AAAA,IAASC,eAAe;AAAA,IACjFC,MAAMJ;AAAAA,IAAWK,MAAML;AAAAA,IAAWM,gBAAgB;AAAA,IAAOC,QAAQ;AAAA,IAAGC,iBAAiB;AAAA,IACrFC,qBAAqB;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B,GAAGF;AAAAA,UACHG,QAAQ;AAAA,YACN,GAAGH,SAAOG;AAAAA,YACVC,MAAMxC,OAAOwC;AAAAA,YACbrB,OAAOb;AAAAA,UAAAA;AAAAA,QACT,CACmB;AAAA,MACvB;AAAA,IACF;AACAN,WAAO8C,SAAS;AAAA,MACd,GAAGV;AAAAA,MACHG,QAAQ;AAAA,QACN,GAAGH,SAAOG;AAAAA,QACVpB,OAAOuB;AAAAA,MAAAA;AAAAA,IACT,CACD;AAAA,EACH;AAEAK,YAAU,MAAM;AACd,QAAIpB,EAAEC,MAAM5B,OAAOmB,KAAK,GAAG;AACzB,UAAIC,gBAAgB,IAAI;AACtBH,oBAAYoB,UAAU;AACtBf,uBAAe,EAAE;AAAA,MACnB;AACA;AAAA,IACF;AACA,UAAM0B,eAAe,OAAOhD,MAAMmB,UAAU,WAAW8B,WAAWjD,MAAMmB,KAAK,IAAInB,MAAMmB;AACvF,QAAI,CAACQ,EAAEuB,QAAQ3B,YAAYyB,YAAY,GAAG;AACxC1B,qBAAesB,aAAa5C,OAAOmB,KAAK,KAAK,EAAE;AAAA,IACjD;AAAA,EACF,GAAG,CAACnB,OAAOmB,KAAK,CAAC;AAEjB,SACE,oBAAC,eAAA,EACC,GAAInB,OACJ,UAAUmD,UAAUpC,wBAAwBd,QAAQ,GACpD,MAAK,QACL,UAAU,MAAM;AAAA,EAAE,GAClB,cACA,QAAQwC,YACR,OAAOrB,aACP,WACA,cACA,cAA2B;AAEjC;"}
|
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import _ from "../../_virtual/lodash.js";
|
|
3
3
|
import { useRef, useEffect } from "react";
|
|
4
4
|
import { useIMask } from "react-imask";
|
|
5
|
-
import {
|
|
5
|
+
import { numberToPtBR } from "./format_number.js";
|
|
6
6
|
import InputTextBase from "../base/InputTextBase.js";
|
|
7
7
|
import { mergeRefs } from "../../form2/helpers.js";
|
|
8
8
|
const DecimalField = (props) => {
|
|
@@ -23,7 +23,8 @@ const DecimalField = (props) => {
|
|
|
23
23
|
const isResetting = useRef(false);
|
|
24
24
|
const {
|
|
25
25
|
value: maskedValue,
|
|
26
|
-
setValue: setMaskedValue
|
|
26
|
+
setValue: setMaskedValue,
|
|
27
|
+
typedValue
|
|
27
28
|
} = useIMask({
|
|
28
29
|
mask: Number,
|
|
29
30
|
unmask,
|
|
@@ -37,26 +38,25 @@ const DecimalField = (props) => {
|
|
|
37
38
|
thousandsSeparator: "."
|
|
38
39
|
}, {
|
|
39
40
|
ref: decimalNumberInputRef,
|
|
40
|
-
onAccept: (__,
|
|
41
|
+
onAccept: (__, maskRef, event) => {
|
|
41
42
|
if (isResetting.current) {
|
|
42
43
|
isResetting.current = false;
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
|
-
const parsedValue = numberToEnUS(options.unmaskedValue);
|
|
46
46
|
props?.onChange?.({
|
|
47
47
|
...event,
|
|
48
48
|
target: {
|
|
49
49
|
...event?.target,
|
|
50
50
|
name: props?.name,
|
|
51
|
-
value:
|
|
51
|
+
value: maskRef.typedValue
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
const handleBlur = (event_0) => {
|
|
57
|
+
const currentValue = typedValue;
|
|
57
58
|
if (!_.isNil(min)) {
|
|
58
|
-
|
|
59
|
-
if (_.isNaN(currentValue) || currentValue < min) {
|
|
59
|
+
if (_.isNil(currentValue) || _.isNaN(currentValue) || currentValue < min) {
|
|
60
60
|
setMaskedValue(numberToPtBR(min) ?? _.toString(min));
|
|
61
61
|
props?.onChange?.({
|
|
62
62
|
...event_0,
|
|
@@ -68,7 +68,13 @@ const DecimalField = (props) => {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
props?.onBlur?.(
|
|
71
|
+
props?.onBlur?.({
|
|
72
|
+
...event_0,
|
|
73
|
+
target: {
|
|
74
|
+
...event_0?.target,
|
|
75
|
+
value: currentValue
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
};
|
|
73
79
|
useEffect(() => {
|
|
74
80
|
if (_.isNil(props?.value)) {
|
|
@@ -78,9 +84,9 @@ const DecimalField = (props) => {
|
|
|
78
84
|
}
|
|
79
85
|
return;
|
|
80
86
|
}
|
|
81
|
-
const
|
|
82
|
-
if (!_.isEqual(
|
|
83
|
-
setMaskedValue(
|
|
87
|
+
const numericValue = typeof props.value === "string" ? parseFloat(props.value) : props.value;
|
|
88
|
+
if (!_.isEqual(typedValue, numericValue)) {
|
|
89
|
+
setMaskedValue(numberToPtBR(props?.value) ?? "");
|
|
84
90
|
}
|
|
85
91
|
}, [props?.value]);
|
|
86
92
|
return /* @__PURE__ */ jsx(InputTextBase, { ...props, inputRef: mergeRefs(decimalNumberInputRef, inputRef), type: "text", onChange: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Decimal.js","sources":["../../../src/lib/inputs/number/Decimal.tsx"],"sourcesContent":["import _ from 'lodash';\nimport React, { useEffect, useRef } from 'react';\nimport { useIMask } from 'react-imask';\nimport { IDecimalProps } from './types';\nimport {
|
|
1
|
+
{"version":3,"file":"Decimal.js","sources":["../../../src/lib/inputs/number/Decimal.tsx"],"sourcesContent":["import _ from 'lodash';\nimport React, { useEffect, useRef } from 'react';\nimport { useIMask } from 'react-imask';\nimport { IDecimalProps } from './types';\nimport { numberToPtBR } from './format_number';\nimport InputTextBase from '../base/InputTextBase';\nimport type { CustomInputEvent } from '../base/types';\nimport { mergeRefs } from '../../form2/helpers';\n\nconst DecimalField = (props: IDecimalProps) => {\n const {\n textAlign = 'left', themePopover = 'light', popoverAlign = 'left', min = undefined,\n max = undefined, allowNegative = false, scale = 2, normalizeZeros = true,\n padFractionalZeros = true, unmask = true, inputRef = undefined,\n } = props;\n const decimalNumberInputRef = useRef<HTMLInputElement | null>(null);\n const isResetting = useRef(false);\n\n const { value: maskedValue, setValue: setMaskedValue, typedValue } = useIMask({\n mask: Number,\n unmask,\n scale,\n normalizeZeros,\n padFractionalZeros,\n max,\n min: !_.isNil(min) ? min : (allowNegative ? undefined : 0),\n radix: ',',\n mapToRadix: ['.'],\n thousandsSeparator: '.',\n }, {\n ref: decimalNumberInputRef,\n onAccept: (__, maskRef, event) => {\n if (isResetting.current) {\n isResetting.current = false;\n return;\n }\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: maskRef.typedValue as any,\n },\n } as React.ChangeEvent<HTMLInputElement>);\n },\n });\n\n /**\n * Função sobrescrevendo o evento onBlur para tratar o valor mínimo ao sair do campo, \n * garantindo que o valor não seja menor que o mínimo definido.\n */\n const handleBlur = (event: CustomInputEvent) => {\n const currentValue = typedValue as number;\n if (!_.isNil(min)) {\n if (_.isNil(currentValue) || _.isNaN(currentValue) || currentValue < min) {\n setMaskedValue(numberToPtBR(min) ?? _.toString(min));\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: min as any,\n },\n } as CustomInputEvent);\n }\n }\n props?.onBlur?.({ \n ...event, \n target: { \n ...event?.target, \n value: currentValue as any, \n }, \n });\n };\n\n useEffect(() => {\n if (_.isNil(props?.value)) {\n if (maskedValue !== '') {\n isResetting.current = true;\n setMaskedValue('');\n }\n return;\n }\n const numericValue = typeof props.value === 'string' ? parseFloat(props.value) : props.value;\n if (!_.isEqual(typedValue, numericValue)) {\n setMaskedValue(numberToPtBR(props?.value) ?? '');\n }\n }, [props?.value]);\n\n return (\n <InputTextBase\n {...props}\n inputRef={mergeRefs(decimalNumberInputRef, inputRef) as any}\n type=\"text\"\n onChange={() => { }}\n onBlur={handleBlur}\n value={maskedValue}\n textAlign={textAlign}\n themePopover={themePopover}\n popoverAlign={popoverAlign} />\n );\n};\n\nexport default DecimalField;\n"],"names":["DecimalField","props","textAlign","themePopover","popoverAlign","min","undefined","max","allowNegative","scale","normalizeZeros","padFractionalZeros","unmask","inputRef","decimalNumberInputRef","useRef","isResetting","value","maskedValue","setValue","setMaskedValue","typedValue","useIMask","mask","Number","_","isNil","radix","mapToRadix","thousandsSeparator","ref","onAccept","__","maskRef","event","current","onChange","target","name","handleBlur","currentValue","isNaN","numberToPtBR","toString","onBlur","useEffect","numericValue","parseFloat","isEqual","mergeRefs"],"mappings":";;;;;;;AASA,MAAMA,eAAeA,CAACC,UAAyB;AAC7C,QAAM;AAAA,IACJC,YAAY;AAAA,IAAQC,eAAe;AAAA,IAASC,eAAe;AAAA,IAAQC,MAAMC;AAAAA,IACzEC,MAAMD;AAAAA,IAAWE,gBAAgB;AAAA,IAAOC,QAAQ;AAAA,IAAGC,iBAAiB;AAAA,IACpEC,qBAAqB;AAAA,IAAMC,SAAS;AAAA,IAAMC,WAAWP;AAAAA,EAAAA,IACnDL;AACJ,QAAMa,wBAAwBC,OAAgC,IAAI;AAClE,QAAMC,cAAcD,OAAO,KAAK;AAEhC,QAAM;AAAA,IAAEE,OAAOC;AAAAA,IAAaC,UAAUC;AAAAA,IAAgBC;AAAAA,EAAAA,IAAeC,SAAS;AAAA,IAC5EC,MAAMC;AAAAA,IACNZ;AAAAA,IACAH;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAJ;AAAAA,IACAF,KAAK,CAACoB,EAAEC,MAAMrB,GAAG,IAAIA,MAAOG,gBAAgBF,SAAY;AAAA,IACxDqB,OAAO;AAAA,IACPC,YAAY,CAAC,GAAG;AAAA,IAChBC,oBAAoB;AAAA,EAAA,GACnB;AAAA,IACDC,KAAKhB;AAAAA,IACLiB,UAAUA,CAACC,IAAIC,SAASC,UAAU;AAChC,UAAIlB,YAAYmB,SAAS;AACvBnB,oBAAYmB,UAAU;AACtB;AAAA,MACF;AACAlC,aAAOmC,WAAW;AAAA,QAChB,GAAGF;AAAAA,QACHG,QAAQ;AAAA,UACN,GAAGH,OAAOG;AAAAA,UACVC,MAAMrC,OAAOqC;AAAAA,UACbrB,OAAOgB,QAAQZ;AAAAA,QAAAA;AAAAA,MACjB,CACsC;AAAA,IAC1C;AAAA,EAAA,CACD;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(props) => {
|
|
|
20
20
|
const isResetting = useRef(false);
|
|
21
21
|
const {
|
|
22
22
|
value: maskedValue,
|
|
23
|
-
setValue: setMaskedValue
|
|
23
|
+
setValue: setMaskedValue,
|
|
24
|
+
typedValue
|
|
24
25
|
} = useIMask({
|
|
25
26
|
mask: Number,
|
|
26
27
|
max,
|
|
@@ -33,26 +34,25 @@ const NumberField = (props) => {
|
|
|
33
34
|
padFractionalZeros: false
|
|
34
35
|
}, {
|
|
35
36
|
ref: numberInputRef,
|
|
36
|
-
onAccept: (
|
|
37
|
+
onAccept: (__, maskRef, event) => {
|
|
37
38
|
if (isResetting.current) {
|
|
38
39
|
isResetting.current = false;
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
|
-
const parsedValue = parseInt(value, 10);
|
|
42
42
|
props?.onChange?.({
|
|
43
43
|
...event,
|
|
44
44
|
target: {
|
|
45
45
|
...event?.target,
|
|
46
46
|
name: props?.name,
|
|
47
|
-
value:
|
|
47
|
+
value: maskRef.typedValue
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
const handleBlur = (event_0) => {
|
|
53
|
+
const currentValue = typedValue;
|
|
53
54
|
if (!_.isNil(min)) {
|
|
54
|
-
|
|
55
|
-
if (_.isNaN(currentValue) || currentValue < min) {
|
|
55
|
+
if (_.isNil(currentValue) || _.isNaN(currentValue) || currentValue < min) {
|
|
56
56
|
setMaskedValue(_.toString(min));
|
|
57
57
|
props?.onChange?.({
|
|
58
58
|
...event_0,
|
|
@@ -64,7 +64,13 @@ const NumberField = (props) => {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
props?.onBlur?.(
|
|
67
|
+
props?.onBlur?.({
|
|
68
|
+
...event_0,
|
|
69
|
+
target: {
|
|
70
|
+
...event_0?.target,
|
|
71
|
+
value: currentValue
|
|
72
|
+
}
|
|
73
|
+
});
|
|
68
74
|
};
|
|
69
75
|
useEffect(() => {
|
|
70
76
|
if (_.isNil(props?.value)) {
|
|
@@ -74,8 +80,8 @@ const NumberField = (props) => {
|
|
|
74
80
|
}
|
|
75
81
|
return;
|
|
76
82
|
}
|
|
77
|
-
const
|
|
78
|
-
if (!_.isEqual(
|
|
83
|
+
const numericValue = typeof props.value === "string" ? Number(props.value) : props.value;
|
|
84
|
+
if (!_.isEqual(typedValue, numericValue)) {
|
|
79
85
|
setMaskedValue(_.toString(props?.value));
|
|
80
86
|
}
|
|
81
87
|
}, [props?.value]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/lib/inputs/number/index.tsx"],"sourcesContent":["import '../../assets/styles/numbers.scss';\n\nimport React, { useEffect, useRef } from 'react';\nimport _ from 'lodash';\nimport { useIMask } from 'react-imask';\nimport DecimalField from './Decimal';\nimport CurrencyField from './Currency';\nimport { INumberFieldProps } from './types';\nimport InputTextBase from '../base/InputTextBase';\nimport { CustomInputEvent } from '../base/types';\nimport { mergeRefs } from '../../form2/helpers';\n\nconst NumberField = (props: INumberFieldProps) => {\n const {\n textAlign = 'left', themePopover = 'light', popoverAlign = 'left', min = undefined, \n max = undefined, inputRef = undefined,\n } = props;\n const numberInputRef = useRef<HTMLInputElement | null>(null);\n const isResetting = useRef(false);\n\n const { value: maskedValue, setValue: setMaskedValue } = useIMask({\n mask: Number,\n max,\n min,\n scale: 0,\n enum: undefined,\n to: undefined,\n from: undefined,\n normalizeZeros: true,\n padFractionalZeros: false,\n }, {\n ref: numberInputRef,\n onAccept: (
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/lib/inputs/number/index.tsx"],"sourcesContent":["import '../../assets/styles/numbers.scss';\n\nimport React, { useEffect, useRef } from 'react';\nimport _ from 'lodash';\nimport { useIMask } from 'react-imask';\nimport DecimalField from './Decimal';\nimport CurrencyField from './Currency';\nimport { INumberFieldProps } from './types';\nimport InputTextBase from '../base/InputTextBase';\nimport { CustomInputEvent } from '../base/types';\nimport { mergeRefs } from '../../form2/helpers';\n\nconst NumberField = (props: INumberFieldProps) => {\n const {\n textAlign = 'left', themePopover = 'light', popoverAlign = 'left', min = undefined, \n max = undefined, inputRef = undefined,\n } = props;\n const numberInputRef = useRef<HTMLInputElement | null>(null);\n const isResetting = useRef(false);\n\n const { value: maskedValue, setValue: setMaskedValue, typedValue } = useIMask({\n mask: Number,\n max,\n min,\n scale: 0,\n enum: undefined,\n to: undefined,\n from: undefined,\n normalizeZeros: true,\n padFractionalZeros: false,\n }, {\n ref: numberInputRef,\n onAccept: (__, maskRef, event) => {\n if (isResetting.current) {\n isResetting.current = false;\n return;\n }\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: maskRef.typedValue as any,\n },\n } as CustomInputEvent);\n },\n });\n\n /**\n * Função sobrescrevendo o evento onBlur para tratar o valor mínimo ao sair do campo, \n * garantindo que o valor não seja menor que o mínimo definido.\n */\n const handleBlur = (event: CustomInputEvent) => {\n const currentValue = typedValue as number;\n if (!_.isNil(min)) {\n if (_.isNil(currentValue) || _.isNaN(currentValue) || currentValue < min) {\n setMaskedValue(_.toString(min));\n props?.onChange?.({\n ...event,\n target: {\n ...event?.target,\n name: props?.name,\n value: min as any,\n },\n } as CustomInputEvent);\n }\n }\n props?.onBlur?.({ \n ...event, \n target: { \n ...event?.target, \n value: currentValue as any, \n }, \n });\n };\n\n useEffect(() => {\n if (_.isNil(props?.value)) {\n if (maskedValue !== '') {\n isResetting.current = true;\n setMaskedValue('');\n }\n return;\n }\n const numericValue = typeof props.value === 'string' ? Number(props.value) : props.value;\n if (!_.isEqual(typedValue, numericValue)) {\n setMaskedValue(_.toString(props?.value));\n }\n }, [props?.value]);\n\n return (\n <InputTextBase\n {...props}\n inputRef={mergeRefs(numberInputRef, inputRef) as any}\n type=\"number\"\n onChange={() => {}}\n onBlur={handleBlur}\n value={maskedValue}\n textAlign={textAlign}\n themePopover={themePopover}\n popoverAlign={popoverAlign} />\n );\n};\n\nexport default NumberField;\nexport {\n CurrencyField,\n DecimalField,\n};\n"],"names":["NumberField","props","textAlign","themePopover","popoverAlign","min","undefined","max","inputRef","numberInputRef","useRef","isResetting","value","maskedValue","setValue","setMaskedValue","typedValue","useIMask","mask","Number","scale","enum","to","from","normalizeZeros","padFractionalZeros","ref","onAccept","__","maskRef","event","current","onChange","target","name","handleBlur","currentValue","_","isNil","isNaN","toString","onBlur","useEffect","numericValue","isEqual","mergeRefs"],"mappings":";;;;;;;;;AAYA,MAAMA,cAAcA,CAACC,UAA6B;AAChD,QAAM;AAAA,IACJC,YAAY;AAAA,IAAQC,eAAe;AAAA,IAASC,eAAe;AAAA,IAAQC,MAAMC;AAAAA,IACzEC,MAAMD;AAAAA,IAAWE,WAAWF;AAAAA,EAAAA,IAC1BL;AACJ,QAAMQ,iBAAiBC,OAAgC,IAAI;AAC3D,QAAMC,cAAcD,OAAO,KAAK;AAEhC,QAAM;AAAA,IAAEE,OAAOC;AAAAA,IAAaC,UAAUC;AAAAA,IAAgBC;AAAAA,EAAAA,IAAeC,SAAS;AAAA,IAC5EC,MAAMC;AAAAA,IACNZ;AAAAA,IACAF;AAAAA,IACAe,OAAO;AAAA,IACPC,MAAMf;AAAAA,IACNgB,IAAIhB;AAAAA,IACJiB,MAAMjB;AAAAA,IACNkB,gBAAgB;AAAA,IAChBC,oBAAoB;AAAA,EAAA,GACnB;AAAA,IACDC,KAAKjB;AAAAA,IACLkB,UAAUA,CAACC,IAAIC,SAASC,UAAU;AAChC,UAAInB,YAAYoB,SAAS;AACvBpB,oBAAYoB,UAAU;AACtB;AAAA,MACF;AACA9B,aAAO+B,WAAW;AAAA,QAChB,GAAGF;AAAAA,QACHG,QAAQ;AAAA,UACN,GAAGH,OAAOG;AAAAA,UACVC,MAAMjC,OAAOiC;AAAAA,UACbtB,OAAOiB,QAAQb;AAAAA,QAAAA;AAAAA,MACjB,CACmB;AAAA,IACvB;AAAA,EAAA,CACD;AAMD,QAAMmB,aAAaA,CAACL,YAA4B;AAC9C,UAAMM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|
-
skeletonize
|
|
7
|
-
skeletonQtty
|
|
8
|
-
children:
|
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
declare namespace SubMenuContainer {
|
|
11
|
-
namespace propTypes {
|
|
12
|
-
let children: any;
|
|
13
|
-
let handlerGoBack: any;
|
|
14
|
-
let title: any;
|
|
15
|
-
let customClass: any;
|
|
16
|
-
let skeletonize: any;
|
|
17
|
-
let skeletonQtty: any;
|
|
18
|
-
}
|
|
19
|
-
namespace defaultProps {
|
|
20
|
-
let title_1: undefined;
|
|
21
|
-
export { title_1 as title };
|
|
22
|
-
let customClass_1: undefined;
|
|
23
|
-
export { customClass_1 as customClass };
|
|
24
|
-
let skeletonize_1: boolean;
|
|
25
|
-
export { skeletonize_1 as skeletonize };
|
|
26
|
-
let skeletonQtty_1: number;
|
|
27
|
-
export { skeletonQtty_1 as skeletonQtty };
|
|
28
|
-
}
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface SubMenuContainerProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
customClass?: string;
|
|
5
|
+
handlerGoBack: () => void;
|
|
6
|
+
skeletonize?: boolean;
|
|
7
|
+
skeletonQtty?: number;
|
|
8
|
+
children: ReactNode;
|
|
29
9
|
}
|
|
10
|
+
declare const SubMenuContainer: ({ title, customClass, handlerGoBack, skeletonize, skeletonQtty, children, }: SubMenuContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default SubMenuContainer;
|
|
@@ -1,138 +1,152 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c as compilerRuntimeExports } from "../../_virtual/compiler-runtime.js";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
|
-
import PropTypes from "../../_virtual/index.js";
|
|
5
4
|
import Icon from "../../icons/index.js";
|
|
6
5
|
import Skeleton from "../../skeleton/index.js";
|
|
7
6
|
import SkeletonContainer from "../../skeleton/SkeletonContainer.js";
|
|
8
|
-
const
|
|
7
|
+
const SubMenuContent = (t0) => {
|
|
8
|
+
const $ = compilerRuntimeExports.c(5);
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
skeletonize,
|
|
12
|
+
skeletonQtty
|
|
13
|
+
} = t0;
|
|
9
14
|
if (skeletonize && skeletonQtty) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== skeletonQtty) {
|
|
17
|
+
t1 = Array.from({
|
|
18
|
+
length: skeletonQtty
|
|
19
|
+
}, _temp);
|
|
20
|
+
$[0] = skeletonQtty;
|
|
21
|
+
$[1] = t1;
|
|
22
|
+
} else {
|
|
23
|
+
t1 = $[1];
|
|
24
|
+
}
|
|
25
|
+
const skeletons = t1;
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
28
|
+
t2 = {
|
|
29
|
+
flexDirection: "row",
|
|
30
|
+
flexFlow: "row wrap"
|
|
31
|
+
};
|
|
32
|
+
$[2] = t2;
|
|
33
|
+
} else {
|
|
34
|
+
t2 = $[2];
|
|
35
|
+
}
|
|
36
|
+
let t3;
|
|
37
|
+
if ($[3] !== skeletons) {
|
|
38
|
+
t3 = /* @__PURE__ */ jsx(SkeletonContainer, { style: t2, children: skeletons.map(_temp2) });
|
|
39
|
+
$[3] = skeletons;
|
|
40
|
+
$[4] = t3;
|
|
41
|
+
} else {
|
|
42
|
+
t3 = $[4];
|
|
43
|
+
}
|
|
44
|
+
return t3;
|
|
20
45
|
}
|
|
21
46
|
return children;
|
|
22
47
|
};
|
|
23
48
|
const SubMenuContainer = (t0) => {
|
|
24
|
-
const $ = compilerRuntimeExports.c(
|
|
49
|
+
const $ = compilerRuntimeExports.c(19);
|
|
25
50
|
const {
|
|
26
51
|
title,
|
|
27
52
|
customClass,
|
|
28
53
|
handlerGoBack,
|
|
29
|
-
skeletonize,
|
|
30
|
-
skeletonQtty,
|
|
54
|
+
skeletonize: t1,
|
|
55
|
+
skeletonQtty: t2,
|
|
31
56
|
children
|
|
32
57
|
} = t0;
|
|
33
|
-
|
|
58
|
+
const skeletonize = t1 === void 0 ? false : t1;
|
|
59
|
+
const skeletonQtty = t2 === void 0 ? 3 : t2;
|
|
60
|
+
let t3;
|
|
34
61
|
if ($[0] !== handlerGoBack) {
|
|
35
|
-
|
|
62
|
+
t3 = () => () => {
|
|
36
63
|
handlerGoBack();
|
|
37
64
|
};
|
|
38
65
|
$[0] = handlerGoBack;
|
|
39
|
-
$[1] =
|
|
66
|
+
$[1] = t3;
|
|
40
67
|
} else {
|
|
41
|
-
|
|
68
|
+
t3 = $[1];
|
|
42
69
|
}
|
|
43
|
-
let
|
|
70
|
+
let t4;
|
|
44
71
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
45
|
-
|
|
46
|
-
$[2] =
|
|
72
|
+
t4 = [];
|
|
73
|
+
$[2] = t4;
|
|
47
74
|
} else {
|
|
48
|
-
|
|
75
|
+
t4 = $[2];
|
|
49
76
|
}
|
|
50
|
-
useEffect(
|
|
51
|
-
const
|
|
52
|
-
let
|
|
77
|
+
useEffect(t3, t4);
|
|
78
|
+
const t5 = `floatsubmenu ${customClass}`;
|
|
79
|
+
let t6;
|
|
53
80
|
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
54
|
-
|
|
81
|
+
t6 = {
|
|
55
82
|
cursor: "pointer"
|
|
56
83
|
};
|
|
57
|
-
$[3] =
|
|
84
|
+
$[3] = t6;
|
|
58
85
|
} else {
|
|
59
|
-
|
|
86
|
+
t6 = $[3];
|
|
60
87
|
}
|
|
61
|
-
let
|
|
88
|
+
let t7;
|
|
62
89
|
if ($[4] !== handlerGoBack) {
|
|
63
|
-
|
|
90
|
+
t7 = /* @__PURE__ */ jsx(Icon, { onClick: handlerGoBack, name: "arrowBack", pointerEvents: "all", style: t6 });
|
|
64
91
|
$[4] = handlerGoBack;
|
|
65
|
-
$[5] =
|
|
92
|
+
$[5] = t7;
|
|
66
93
|
} else {
|
|
67
|
-
|
|
94
|
+
t7 = $[5];
|
|
68
95
|
}
|
|
69
|
-
let
|
|
96
|
+
let t8;
|
|
70
97
|
if ($[6] !== title) {
|
|
71
|
-
|
|
98
|
+
t8 = title && /* @__PURE__ */ jsx("span", { children: title });
|
|
72
99
|
$[6] = title;
|
|
73
|
-
$[7] =
|
|
100
|
+
$[7] = t8;
|
|
74
101
|
} else {
|
|
75
|
-
|
|
102
|
+
t8 = $[7];
|
|
76
103
|
}
|
|
77
|
-
let
|
|
78
|
-
if ($[8] !==
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
104
|
+
let t9;
|
|
105
|
+
if ($[8] !== t7 || $[9] !== t8) {
|
|
106
|
+
t9 = /* @__PURE__ */ jsxs("div", { className: "submenuheader", children: [
|
|
107
|
+
t7,
|
|
108
|
+
t8
|
|
82
109
|
] });
|
|
83
|
-
$[8] =
|
|
84
|
-
$[9] =
|
|
85
|
-
$[10] =
|
|
110
|
+
$[8] = t7;
|
|
111
|
+
$[9] = t8;
|
|
112
|
+
$[10] = t9;
|
|
86
113
|
} else {
|
|
87
|
-
|
|
114
|
+
t9 = $[10];
|
|
88
115
|
}
|
|
89
|
-
let
|
|
116
|
+
let t10;
|
|
90
117
|
if ($[11] !== children || $[12] !== skeletonQtty || $[13] !== skeletonize) {
|
|
91
|
-
|
|
118
|
+
t10 = /* @__PURE__ */ jsx("div", { className: "submenucontent", children: /* @__PURE__ */ jsx(SubMenuContent, { skeletonize, skeletonQtty, children }) });
|
|
92
119
|
$[11] = children;
|
|
93
120
|
$[12] = skeletonQtty;
|
|
94
121
|
$[13] = skeletonize;
|
|
95
|
-
$[14] =
|
|
122
|
+
$[14] = t10;
|
|
96
123
|
} else {
|
|
97
|
-
|
|
124
|
+
t10 = $[14];
|
|
98
125
|
}
|
|
99
|
-
let
|
|
100
|
-
if ($[15] !==
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} else {
|
|
105
|
-
t9 = $[16];
|
|
106
|
-
}
|
|
107
|
-
let t10;
|
|
108
|
-
if ($[17] !== t3 || $[18] !== t7 || $[19] !== t9) {
|
|
109
|
-
t10 = /* @__PURE__ */ jsxs("div", { className: t3, children: [
|
|
110
|
-
t7,
|
|
111
|
-
t9
|
|
126
|
+
let t11;
|
|
127
|
+
if ($[15] !== t10 || $[16] !== t5 || $[17] !== t9) {
|
|
128
|
+
t11 = /* @__PURE__ */ jsxs("div", { className: t5, children: [
|
|
129
|
+
t9,
|
|
130
|
+
t10
|
|
112
131
|
] });
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
132
|
+
$[15] = t10;
|
|
133
|
+
$[16] = t5;
|
|
134
|
+
$[17] = t9;
|
|
135
|
+
$[18] = t11;
|
|
117
136
|
} else {
|
|
118
|
-
|
|
137
|
+
t11 = $[18];
|
|
119
138
|
}
|
|
120
|
-
return
|
|
121
|
-
};
|
|
122
|
-
SubMenuContainer.propTypes = {
|
|
123
|
-
children: PropTypes.node.isRequired,
|
|
124
|
-
handlerGoBack: PropTypes.func.isRequired,
|
|
125
|
-
title: PropTypes.string,
|
|
126
|
-
customClass: PropTypes.string,
|
|
127
|
-
skeletonize: PropTypes.bool,
|
|
128
|
-
skeletonQtty: PropTypes.number
|
|
129
|
-
};
|
|
130
|
-
SubMenuContainer.defaultProps = {
|
|
131
|
-
title: void 0,
|
|
132
|
-
customClass: void 0,
|
|
133
|
-
skeletonize: false,
|
|
134
|
-
skeletonQtty: 3
|
|
139
|
+
return t11;
|
|
135
140
|
};
|
|
141
|
+
function _temp(_, i) {
|
|
142
|
+
return i + 1;
|
|
143
|
+
}
|
|
144
|
+
function _temp2(id) {
|
|
145
|
+
return /* @__PURE__ */ jsx(Skeleton, { height: 88, width: 88, style: {
|
|
146
|
+
flexGrow: "unset",
|
|
147
|
+
marginBottom: 5
|
|
148
|
+
} }, id);
|
|
149
|
+
}
|
|
136
150
|
export {
|
|
137
151
|
SubMenuContainer as default
|
|
138
152
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubMenuContainer.js","sources":["../../../src/lib/menus/float/SubMenuContainer.
|
|
1
|
+
{"version":3,"file":"SubMenuContainer.js","sources":["../../../src/lib/menus/float/SubMenuContainer.tsx"],"sourcesContent":["import { ReactNode, useEffect } from 'react';\nimport Icon from '../../icons';\nimport Skeleton, { SkeletonContainer } from '../../skeleton';\n\ninterface SubMenuContainerProps {\n title?: string;\n customClass?: string;\n handlerGoBack: () => void;\n skeletonize?: boolean;\n skeletonQtty?: number;\n children: ReactNode;\n}\n\nconst SubMenuContent = ({ \n children, skeletonize, skeletonQtty, \n}: { children: ReactNode; skeletonize: boolean; skeletonQtty: number }) => {\n if (skeletonize && skeletonQtty) {\n const skeletons = Array.from({ length: skeletonQtty }, (_, i) => i + 1);\n return (\n <SkeletonContainer style={{ flexDirection: 'row', flexFlow: 'row wrap' }}>\n {skeletons.map(id => (\n <Skeleton\n key={id}\n height={88}\n width={88}\n style={{\n flexGrow: 'unset',\n marginBottom: 5,\n }} />\n ))}\n </SkeletonContainer>\n );\n }\n\n return children;\n};\n\nconst SubMenuContainer = ({\n title, customClass, handlerGoBack, skeletonize = false, skeletonQtty = 3, children,\n}: SubMenuContainerProps) => {\n useEffect(() => () => {\n handlerGoBack();\n }, []);\n\n return (\n <div className={`floatsubmenu ${customClass}`}>\n <div className=\"submenuheader\">\n <Icon onClick={handlerGoBack} name=\"arrowBack\" pointerEvents=\"all\" style={{ cursor: 'pointer' }} />\n {title && <span>{title}</span>}\n </div>\n <div className=\"submenucontent\">\n <SubMenuContent skeletonize={skeletonize} skeletonQtty={skeletonQtty}>\n {children}\n </SubMenuContent>\n </div>\n </div>\n );\n};\n\nexport default SubMenuContainer;\n"],"names":["SubMenuContent","t0","$","_c","children","skeletonize","skeletonQtty","t1","Array","from","length","_temp","skeletons","t2","Symbol","for","flexDirection","flexFlow","t3","map","_temp2","SubMenuContainer","title","customClass","handlerGoBack","undefined","t4","useEffect","t5","t6","cursor","t7","t8","t9","t10","t11","_","i","id","flexGrow","marginBottom"],"mappings":";;;;;;AAaA,MAAMA,iBAAiBC,CAAAA,OAAA;AAAA,QAAAC,IAAAC,uBAAAA,EAAA,CAAA;AAAC,QAAA;AAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,EAAAA,IAAAL;AAGtB,MAAII,eAAAC,cAA2B;AAAA,QAAAC;AAAA,QAAAL,SAAAI,cAAA;AACXC,WAAAC,MAAKC,KAAM;AAAA,QAAAC,QAAUJ;AAAAA,MAAAA,GAAgBK,KAAe;AAACT,aAAAI;AAAAJ,aAAAK;AAAAA,IAAA,OAAA;AAAAA,WAAAL,EAAA,CAAA;AAAA,IAAA;AAAvE,UAAAU,YAAkBL;AAAsD,QAAAM;AAAA,QAAAX,EAAA,CAAA,MAAAY,OAAAC,IAAA,2BAAA,GAAA;AAE5CF,WAAA;AAAA,QAAAG,eAAiB;AAAA,QAAKC,UAAY;AAAA,MAAA;AAAYf,aAAAW;AAAAA,IAAA,OAAA;AAAAA,WAAAX,EAAA,CAAA;AAAA,IAAA;AAAA,QAAAgB;AAAA,QAAAhB,SAAAU,WAAA;AAAxEM,+BAAC,mBAAA,EAAyB,OAAAL,IACvBD,UAAAA,UAASO,IAAKC,MASd,GACH;AAAoBlB,aAAAU;AAAAV,aAAAgB;AAAAA,IAAA,OAAA;AAAAA,WAAAhB,EAAA,CAAA;AAAA,IAAA;AAAA,WAXpBgB;AAAAA,EAWoB;AAEvB,SAEMd;AAAQ;AAGjB,MAAMiB,mBAAmBpB,CAAAA,OAAA;AAAA,QAAAC,IAAAC,uBAAAA,EAAA,EAAA;AAAC,QAAA;AAAA,IAAAmB;AAAAA,IAAAC;AAAAA,IAAAC;AAAAA,IAAAnB,aAAAE;AAAAA,IAAA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