linear-react-components-ui 1.1.23 → 1.1.24-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/@types/ColorStyles.d.ts +2 -1
- package/lib/@types/Position.d.ts +2 -1
- package/lib/BaseMask-3d5d581d.d.ts +24 -0
- package/lib/BaseNumber-797088d7.d.ts +23 -0
- package/lib/Cnpj-1602be21.d.ts +18 -0
- package/lib/Cpf-4d6b9079.d.ts +18 -0
- package/lib/Currency-b33d3a22.d.ts +18 -0
- package/lib/Decimal-55e836d5.d.ts +13 -0
- package/lib/Number-9c6aceff.d.ts +20 -0
- package/lib/Phone-79e5e3b4.d.ts +18 -0
- package/lib/ZipCode-8c2e9d8b.d.ts +13 -0
- package/lib/assets/styles/checkbox2.scss +199 -0
- package/lib/assets/styles/colorpicker.scss +1 -6
- package/lib/assets/styles/colors.scss +48 -12
- package/lib/assets/styles/datepicker2.scss +338 -0
- package/lib/assets/styles/selectfield.scss +409 -0
- package/lib/assets/styles/slot.scss +34 -0
- package/lib/assets/styles/textfield.scss +148 -0
- package/lib/buttons/ActivateButton.d.ts +1 -0
- package/lib/buttons/AddButton.d.ts +1 -0
- package/lib/buttons/Button.d.ts +1 -0
- package/lib/buttons/CancelButton.d.ts +1 -0
- package/lib/buttons/DangerButton.d.ts +1 -0
- package/lib/buttons/DefaultButton.d.ts +1 -0
- package/lib/buttons/DefaultButton.js +16 -11
- package/lib/buttons/DestroyButton.d.ts +1 -0
- package/lib/buttons/EditButton.d.ts +1 -0
- package/lib/buttons/InactivateButton.d.ts +1 -0
- package/lib/buttons/InfoButton.d.ts +1 -0
- package/lib/buttons/PrimaryButton.d.ts +1 -0
- package/lib/buttons/RestoreButton.d.ts +1 -0
- package/lib/buttons/SaveButton.d.ts +1 -0
- package/lib/buttons/SuccessButton.d.ts +1 -0
- package/lib/buttons/WarningButton.d.ts +1 -0
- package/lib/buttons/index.d.ts +1 -0
- package/lib/buttons/split_button/index.d.ts +1 -0
- package/lib/buttons/types.d.ts +2 -5
- package/lib/form/Field.d.ts +1 -1
- package/lib/form/FieldArray.d.ts +1 -1
- package/lib/form/FieldNumber.d.ts +1 -1
- package/lib/form/FieldPeriod.d.ts +1 -1
- package/lib/form/helpers.d.ts +1 -1
- package/lib/form/index.d.ts +1 -1
- package/lib/form/types.d.ts +1 -1
- package/lib/form/withFieldHOC.d.ts +1 -1
- package/lib/form/withFormSecurity.d.ts +1 -1
- package/lib/form2/helpers.d.ts +8 -0
- package/lib/form2/helpers.js +41 -0
- package/lib/form2/index.d.ts +9 -0
- package/lib/form2/index.js +36 -0
- package/lib/form2/types.d.ts +125 -0
- package/lib/form2/types.js +5 -0
- package/lib/form2/useForm/index.d.ts +5 -0
- package/lib/form2/useForm/index.js +203 -0
- package/lib/icons/helper.d.ts +4 -0
- package/lib/icons/helper.js +4 -0
- package/lib/icons/index.d.ts +4 -6
- package/lib/icons/index.js +14 -9
- package/lib/icons/types.d.ts +3 -6
- package/lib/index-18a64236.d.ts +23 -0
- package/lib/index-368f781f.d.ts +15 -0
- package/lib/index-43ad8140.d.ts +41 -0
- package/lib/index-772f9f1a.d.ts +44 -0
- package/lib/index-8a59cf4b.d.ts +23 -0
- package/lib/index-c9247c1f.d.ts +15 -0
- package/lib/index.d.ts +1 -0
- package/lib/inputs/base/InputTextBase.d.ts +1 -1
- package/lib/inputs/base/InputTextBase.js +18 -8
- package/lib/inputs/base/helpers.d.ts +1 -1
- package/lib/inputs/base/types.d.ts +5 -16
- package/lib/inputs/color/index.js +1 -1
- package/lib/inputs/color/types.d.ts +1 -1
- package/lib/inputs/date/Dialog.d.ts +1 -1
- package/lib/inputs/date/Dropdown.d.ts +1 -1
- package/lib/inputs/date/index.d.ts +1 -1
- package/lib/inputs/date/types.d.ts +2 -2
- package/lib/inputs/errorMessage/index.d.ts +1 -1
- package/lib/inputs/file/DefaultFile.d.ts +1 -1
- package/lib/inputs/file/DefaultFile.js +1 -1
- package/lib/inputs/file/DragDropFile.d.ts +1 -1
- package/lib/inputs/file/File.d.ts +1 -1
- package/lib/inputs/file/FileButtonSettings.d.ts +1 -1
- package/lib/inputs/file/helpers.d.ts +1 -1
- package/lib/inputs/file/index.d.ts +1 -1
- package/lib/inputs/file/types.d.ts +1 -1
- package/lib/inputs/inputHOC.d.ts +1 -1
- package/lib/inputs/mask/BaseMask.d.ts +1 -1
- package/lib/inputs/mask/Cnpj.d.ts +1 -1
- package/lib/inputs/mask/Cpf.d.ts +1 -1
- package/lib/inputs/mask/Phone.d.ts +1 -1
- package/lib/inputs/mask/ZipCode.d.ts +1 -1
- package/lib/inputs/mask/helpers.d.ts +1 -1
- package/lib/inputs/mask/index.d.ts +1 -1
- package/lib/inputs/mask/types.d.ts +2 -2
- package/lib/inputs/multiSelect/ActionButtons.d.ts +1 -1
- package/lib/inputs/multiSelect/Dropdown.d.ts +1 -1
- package/lib/inputs/multiSelect/helper.d.ts +1 -1
- package/lib/inputs/multiSelect/index.d.ts +1 -1
- package/lib/inputs/multiSelect/types.d.ts +2 -2
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Decimal.d.ts +1 -1
- package/lib/inputs/number/index.d.ts +1 -1
- package/lib/inputs/number/types.d.ts +3 -3
- package/lib/inputs/period/Dialog.d.ts +1 -1
- package/lib/inputs/period/Dropdown.d.ts +1 -1
- package/lib/inputs/period/PeriodList.d.ts +1 -1
- package/lib/inputs/period/helper.d.ts +1 -1
- package/lib/inputs/period/index.d.ts +1 -1
- package/lib/inputs/period/index.js +8 -10
- package/lib/inputs/period/types.d.ts +2 -5
- package/lib/inputs/search/index.d.ts +1 -1
- package/lib/inputs/select/ActionButtons.d.ts +1 -1
- package/lib/inputs/select/Dropdown.d.ts +1 -1
- package/lib/inputs/select/helper.d.ts +1 -1
- package/lib/inputs/select/index.d.ts +1 -1
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
- package/lib/inputs/select/multiple/index.d.ts +1 -1
- package/lib/inputs/select/simple/index.d.ts +1 -1
- package/lib/inputs/select/types.d.ts +1 -1
- package/lib/inputs/text/index.d.ts +1 -1
- package/lib/inputs/text/types.d.ts +2 -3
- package/lib/inputs/textarea/index.d.ts +1 -1
- package/lib/inputs/textarea/types.d.ts +1 -1
- package/lib/inputs/types.d.ts +1 -1
- package/lib/inputs2/checkboxfield/index.d.ts +7 -0
- package/lib/inputs2/checkboxfield/index.js +146 -0
- package/lib/inputs2/colorfield/index.d.ts +9 -0
- package/lib/inputs2/colorfield/index.js +119 -0
- package/lib/inputs2/date/base/constants.d.ts +7 -0
- package/lib/inputs2/date/base/constants.js +43 -0
- package/lib/inputs2/date/base/index.d.ts +12 -0
- package/lib/inputs2/date/base/index.js +179 -0
- package/lib/inputs2/date/datefield/calendarbox.d.ts +7 -0
- package/lib/inputs2/date/datefield/calendarbox.js +115 -0
- package/lib/inputs2/date/datefield/context.d.ts +13 -0
- package/lib/inputs2/date/datefield/context.js +15 -0
- package/lib/inputs2/date/datefield/index.d.ts +9 -0
- package/lib/inputs2/date/datefield/index.js +334 -0
- package/lib/inputs2/date/datefield/triggers.d.ts +8 -0
- package/lib/inputs2/date/datefield/triggers.js +47 -0
- package/lib/inputs2/date/datefield/types.d.ts +61 -0
- package/lib/inputs2/date/datefield/types.js +5 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +7 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +136 -0
- package/lib/inputs2/date/dateperiodfield/context.d.ts +13 -0
- package/lib/inputs2/date/dateperiodfield/context.js +17 -0
- package/lib/inputs2/date/dateperiodfield/index.d.ts +9 -0
- package/lib/inputs2/date/dateperiodfield/index.js +592 -0
- package/lib/inputs2/date/dateperiodfield/triggers.d.ts +6 -0
- package/lib/inputs2/date/dateperiodfield/triggers.js +120 -0
- package/lib/inputs2/date/dateperiodfield/types.d.ts +99 -0
- package/lib/inputs2/date/dateperiodfield/types.js +19 -0
- package/lib/inputs2/date/helpers.d.ts +20 -0
- package/lib/inputs2/date/helpers.js +62 -0
- package/lib/inputs2/date/types.d.ts +59 -0
- package/lib/inputs2/date/types.js +19 -0
- package/lib/inputs2/index.d.ts +29 -0
- package/lib/inputs2/index.js +38 -0
- package/lib/inputs2/mask/BaseMask.d.ts +10 -0
- package/lib/inputs2/mask/BaseMask.js +95 -0
- package/lib/inputs2/mask/Cnpj.d.ts +11 -0
- package/lib/inputs2/mask/Cnpj.js +57 -0
- package/lib/inputs2/mask/Cpf.d.ts +11 -0
- package/lib/inputs2/mask/Cpf.js +53 -0
- package/lib/inputs2/mask/Phone.d.ts +11 -0
- package/lib/inputs2/mask/Phone.js +26 -0
- package/lib/inputs2/mask/ZipCode.d.ts +11 -0
- package/lib/inputs2/mask/ZipCode.js +23 -0
- package/lib/inputs2/mask/helpers.d.ts +4 -0
- package/lib/inputs2/mask/helpers.js +57 -0
- package/lib/inputs2/number/BaseNumber.d.ts +10 -0
- package/lib/inputs2/number/BaseNumber.js +86 -0
- package/lib/inputs2/number/Currency.d.ts +11 -0
- package/lib/inputs2/number/Currency.js +47 -0
- package/lib/inputs2/number/Decimal.d.ts +11 -0
- package/lib/inputs2/number/Decimal.js +36 -0
- package/lib/inputs2/number/Number.d.ts +9 -0
- package/lib/inputs2/number/Number.js +49 -0
- package/lib/inputs2/number/format_number.d.ts +5 -0
- package/lib/inputs2/number/format_number.js +29 -0
- package/lib/inputs2/selectfield/context.d.ts +38 -0
- package/lib/inputs2/selectfield/context.js +15 -0
- package/lib/inputs2/selectfield/helpers.d.ts +6 -0
- package/lib/inputs2/selectfield/helpers.js +25 -0
- package/lib/inputs2/selectfield/index.d.ts +10 -0
- package/lib/inputs2/selectfield/index.js +491 -0
- package/lib/inputs2/selectfield/item.d.ts +11 -0
- package/lib/inputs2/selectfield/item.js +85 -0
- package/lib/inputs2/selectfield/listbox.d.ts +7 -0
- package/lib/inputs2/selectfield/listbox.js +103 -0
- package/lib/inputs2/selectfield/search.d.ts +7 -0
- package/lib/inputs2/selectfield/search.js +71 -0
- package/lib/inputs2/selectfield/selections.d.ts +10 -0
- package/lib/inputs2/selectfield/selections.js +86 -0
- package/lib/inputs2/selectfield/triggers.d.ts +8 -0
- package/lib/inputs2/selectfield/triggers.js +100 -0
- package/lib/inputs2/selectfield/types.d.ts +55 -0
- package/lib/inputs2/selectfield/types.js +21 -0
- package/lib/inputs2/slot/index.d.ts +14 -0
- package/lib/inputs2/slot/index.js +47 -0
- package/lib/inputs2/textfield/index.d.ts +8 -0
- package/lib/inputs2/textfield/index.js +159 -0
- package/lib/internals/types.d.ts +1 -17
- package/lib/labels/DangerLabel.d.ts +1 -0
- package/lib/labels/DefaultLabel.d.ts +3 -5
- package/lib/labels/DefaultLabel.js +15 -7
- package/lib/labels/InfoLabel.d.ts +1 -0
- package/lib/labels/PrimaryLabel.d.ts +1 -0
- package/lib/labels/SuccessLabel.d.ts +1 -0
- package/lib/labels/WarningLabel.d.ts +1 -0
- package/lib/labels/index.d.ts +3 -2
- package/lib/labels/types.d.ts +2 -5
- package/lib/list/Header.d.ts +1 -0
- package/lib/list/Item.d.ts +3 -5
- package/lib/list/Item.js +17 -12
- package/lib/list/helpers.d.ts +1 -0
- package/lib/list/index.d.ts +1 -0
- package/lib/list/types.d.ts +4 -6
- package/lib/menus/sidenav/ExpandMenu.d.ts +2 -2
- package/lib/menus/sidenav/MenuLink.d.ts +4 -7
- package/lib/menus/sidenav/MenuLink.js +20 -11
- package/lib/menus/sidenav/NavMenuGroup.d.ts +2 -2
- package/lib/menus/sidenav/NavMenuItem.d.ts +4 -7
- package/lib/menus/sidenav/NavMenuItem.js +16 -12
- package/lib/menus/sidenav/NavSubMenuItem.d.ts +2 -2
- package/lib/menus/sidenav/helpers.d.ts +2 -2
- package/lib/menus/sidenav/index.d.ts +2 -2
- package/lib/menus/sidenav/popup_menu_search/EmptyList.d.ts +2 -2
- package/lib/menus/sidenav/popup_menu_search/index.d.ts +2 -2
- package/lib/menus/sidenav/types.d.ts +6 -6
- package/lib/popover/PopoverText.js +11 -2
- package/lib/popover/types.d.ts +1 -0
- package/lib/textContent/index.d.ts +6 -11
- package/lib/textContent/index.js +20 -11
- package/lib/tooltip/TooltipContent.d.ts +7 -0
- package/lib/tooltip/TooltipContent.js +65 -0
- package/lib/tooltip/index.d.ts +4 -3
- package/lib/tooltip/index.js +36 -53
- package/lib/tooltip/types.d.ts +25 -3
- package/lib/tooltip/useTooltip.d.ts +30 -0
- package/lib/tooltip/useTooltip.js +128 -0
- package/package.json +3 -2
- package/lib/inputs/base/Label.d.ts +0 -14
- package/lib/inputs/base/Label.js +0 -35
- package/lib/internals/withTooltip.d.ts +0 -12
- package/lib/internals/withTooltip.js +0 -172
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _helpers = require("./helpers");
|
|
9
|
+
var _BaseMask = require("./BaseMask");
|
|
10
|
+
const _excluded = ["onValidate", "onBlur", "onChange", "errors"];
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const CPF_INVALID_MESSAGE = 'CPF inválido';
|
|
17
|
+
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
18
|
+
const {
|
|
19
|
+
onValidate,
|
|
20
|
+
onBlur,
|
|
21
|
+
onChange,
|
|
22
|
+
errors: externalErrors = []
|
|
23
|
+
} = props,
|
|
24
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
25
|
+
const validateCpf = raw => {
|
|
26
|
+
const hasCpfError = externalErrors.includes(CPF_INVALID_MESSAGE);
|
|
27
|
+
const isValid = (0, _helpers.CPFValidation)(raw);
|
|
28
|
+
if (!isValid && hasCpfError) {
|
|
29
|
+
onValidate?.([CPF_INVALID_MESSAGE]);
|
|
30
|
+
}
|
|
31
|
+
if (isValid && !hasCpfError) {
|
|
32
|
+
onValidate?.([]);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const handleChange = e => {
|
|
36
|
+
const rawValue = e.target.value.replace(/\D/g, '');
|
|
37
|
+
validateCpf(rawValue);
|
|
38
|
+
onChange?.(e);
|
|
39
|
+
};
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_BaseMask.Input, _extends({}, rest, {
|
|
41
|
+
type: "text",
|
|
42
|
+
ref: ref,
|
|
43
|
+
maskOptions: {
|
|
44
|
+
mask: '000.000.000-00',
|
|
45
|
+
placeholderChar: '_',
|
|
46
|
+
lazy: false
|
|
47
|
+
},
|
|
48
|
+
onChange: handleChange,
|
|
49
|
+
errors: externalErrors,
|
|
50
|
+
onBlur: onBlur
|
|
51
|
+
}));
|
|
52
|
+
});
|
|
53
|
+
Input.displayName = 'CpfInputField';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../../BaseMask-3d5d581d.js';
|
|
3
|
+
export { I as Input, a as PhoneFieldProps } from '../../Phone-79e5e3b4.js';
|
|
4
|
+
import '../../index-772f9f1a.js';
|
|
5
|
+
import '../../@types/Align.js';
|
|
6
|
+
import '../../@types/ColorStyles.js';
|
|
7
|
+
import '../../@types/Position.js';
|
|
8
|
+
import '../../@types/PermissionAttr.js';
|
|
9
|
+
import '../slot/index.js';
|
|
10
|
+
import '../../tooltip/types.js';
|
|
11
|
+
import 'imask';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _BaseMask = require("./BaseMask");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
13
|
+
const {
|
|
14
|
+
isCellphone = false
|
|
15
|
+
} = props;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_BaseMask.Input, _extends({}, props, {
|
|
17
|
+
type: "text",
|
|
18
|
+
maskOptions: {
|
|
19
|
+
mask: isCellphone ? '(00) 00000-0000' : '(00) 0000-0000',
|
|
20
|
+
placeholderChar: '_',
|
|
21
|
+
lazy: false
|
|
22
|
+
},
|
|
23
|
+
ref: ref
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
Input.displayName = 'PhoneInputField';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../../BaseMask-3d5d581d.js';
|
|
3
|
+
export { I as Input } from '../../ZipCode-8c2e9d8b.js';
|
|
4
|
+
import '../../index-772f9f1a.js';
|
|
5
|
+
import '../../@types/Align.js';
|
|
6
|
+
import '../../@types/ColorStyles.js';
|
|
7
|
+
import '../../@types/Position.js';
|
|
8
|
+
import '../../@types/PermissionAttr.js';
|
|
9
|
+
import '../slot/index.js';
|
|
10
|
+
import '../../tooltip/types.js';
|
|
11
|
+
import 'imask';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _BaseMask = require("./BaseMask");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
13
|
+
return /*#__PURE__*/_react.default.createElement(_BaseMask.Input, _extends({}, props, {
|
|
14
|
+
type: "text",
|
|
15
|
+
maskOptions: {
|
|
16
|
+
mask: '00000-000',
|
|
17
|
+
placeholderChar: '_',
|
|
18
|
+
lazy: false
|
|
19
|
+
},
|
|
20
|
+
ref: ref
|
|
21
|
+
}));
|
|
22
|
+
});
|
|
23
|
+
Input.displayName = 'ZipCodeInputField';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CNPJValidation = CNPJValidation;
|
|
7
|
+
exports.CPFValidation = CPFValidation;
|
|
8
|
+
var _lodash = require("lodash");
|
|
9
|
+
const allEqualDigits = input => input.split('').every(char => char === input[0]);
|
|
10
|
+
function CPFValidation(cpf) {
|
|
11
|
+
const stringCpf = cpf ? cpf.replace(/[^\d]+/g, '') : '';
|
|
12
|
+
let sum = 0;
|
|
13
|
+
let split;
|
|
14
|
+
if (stringCpf === '' || stringCpf.length < 11) return false;
|
|
15
|
+
if (allEqualDigits(stringCpf)) return false;
|
|
16
|
+
for (let i = 0; i < 9; i++) {
|
|
17
|
+
sum += (0, _lodash.parseInt)(stringCpf.charAt(i), 10) * (10 - i);
|
|
18
|
+
}
|
|
19
|
+
split = sum * 10 % 11;
|
|
20
|
+
if (split === 10 || split === 11) split = 0;
|
|
21
|
+
if (split !== (0, _lodash.parseInt)(stringCpf.charAt(9), 10)) return false;
|
|
22
|
+
sum = 0;
|
|
23
|
+
for (let i = 0; i < 10; i++) {
|
|
24
|
+
sum += (0, _lodash.parseInt)(stringCpf.charAt(i), 10) * (11 - i);
|
|
25
|
+
}
|
|
26
|
+
split = sum * 10 % 11;
|
|
27
|
+
if (split === 10 || split === 11) split = 0;
|
|
28
|
+
if (split !== (0, _lodash.parseInt)(stringCpf.charAt(10), 10)) return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
function CNPJValidation(cnpj) {
|
|
32
|
+
const stringCnpj = cnpj ? cnpj.replace(/[^\d]+/g, '') : '';
|
|
33
|
+
if (stringCnpj === '' || stringCnpj.length !== 14) return false;
|
|
34
|
+
if (allEqualDigits(stringCnpj)) return false;
|
|
35
|
+
let length = stringCnpj.length - 2;
|
|
36
|
+
let numbers = stringCnpj.substring(0, length);
|
|
37
|
+
const digits = stringCnpj.substring(length);
|
|
38
|
+
let sum = 0;
|
|
39
|
+
let pos = length - 7;
|
|
40
|
+
for (let i = length; i >= 1; i--) {
|
|
41
|
+
sum += (0, _lodash.parseInt)(numbers.charAt(length - i), 10) * pos--;
|
|
42
|
+
if (pos < 2) pos = 9;
|
|
43
|
+
}
|
|
44
|
+
let result = sum % 11 < 2 ? 0 : 11 - sum % 11;
|
|
45
|
+
if (result.toString() !== digits.charAt(0)) return false;
|
|
46
|
+
length += 1;
|
|
47
|
+
numbers = stringCnpj.substring(0, length);
|
|
48
|
+
sum = 0;
|
|
49
|
+
pos = length - 7;
|
|
50
|
+
for (let i = length; i >= 1; i--) {
|
|
51
|
+
sum += (0, _lodash.parseInt)(numbers.charAt(length - i), 10) * pos--;
|
|
52
|
+
if (pos < 2) pos = 9;
|
|
53
|
+
}
|
|
54
|
+
result = sum % 11 < 2 ? 0 : 11 - sum % 11;
|
|
55
|
+
if (result.toString() !== digits.charAt(1)) return false;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import 'imask';
|
|
3
|
+
import '../../index-772f9f1a.js';
|
|
4
|
+
export { a as BaseNumberFieldProps, I as Input } from '../../BaseNumber-797088d7.js';
|
|
5
|
+
import '../../@types/Align.js';
|
|
6
|
+
import '../../@types/ColorStyles.js';
|
|
7
|
+
import '../../@types/Position.js';
|
|
8
|
+
import '../../@types/PermissionAttr.js';
|
|
9
|
+
import '../slot/index.js';
|
|
10
|
+
import '../../tooltip/types.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactImask = require("react-imask");
|
|
9
|
+
var _textfield = require("../textfield");
|
|
10
|
+
var _helpers = require("../../form2/helpers");
|
|
11
|
+
var _format_number = require("./format_number");
|
|
12
|
+
const _excluded = ["name", "value", "onComplete", "onChange", "textAlign", "maskOptions"],
|
|
13
|
+
_excluded2 = ["scale", "thousandsSeparator", "radix", "normalizeZeros", "padFractionalZeros", "min"];
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
24
|
+
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
25
|
+
const {
|
|
26
|
+
name,
|
|
27
|
+
value: valueFromProps,
|
|
28
|
+
onComplete,
|
|
29
|
+
onChange,
|
|
30
|
+
textAlign = 'right',
|
|
31
|
+
maskOptions
|
|
32
|
+
} = props,
|
|
33
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
const inputRef = (0, _react.useRef)(null);
|
|
35
|
+
const _ref = maskOptions,
|
|
36
|
+
{
|
|
37
|
+
scale = 0,
|
|
38
|
+
thousandsSeparator = '',
|
|
39
|
+
radix = ',',
|
|
40
|
+
normalizeZeros = false,
|
|
41
|
+
padFractionalZeros = false,
|
|
42
|
+
min = 0
|
|
43
|
+
} = _ref,
|
|
44
|
+
restMaskOptions = _objectWithoutProperties(_ref, _excluded2);
|
|
45
|
+
const {
|
|
46
|
+
value,
|
|
47
|
+
setValue: setMaskValue
|
|
48
|
+
} = (0, _reactImask.useIMask)(_objectSpread({
|
|
49
|
+
mask: Number,
|
|
50
|
+
scale,
|
|
51
|
+
thousandsSeparator,
|
|
52
|
+
radix,
|
|
53
|
+
normalizeZeros,
|
|
54
|
+
padFractionalZeros,
|
|
55
|
+
min
|
|
56
|
+
}, restMaskOptions), {
|
|
57
|
+
ref: inputRef,
|
|
58
|
+
onComplete: (__, maskRef) => {
|
|
59
|
+
onComplete?.(maskRef.value, maskRef);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
_react.default.useEffect(() => {
|
|
63
|
+
const currentValue = valueFromProps ?? '';
|
|
64
|
+
setMaskValue(currentValue);
|
|
65
|
+
}, [valueFromProps]);
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement(_textfield.Input, _extends({}, rest, {
|
|
67
|
+
ref: (0, _helpers.mergeRefs)(ref, inputRef),
|
|
68
|
+
name: name,
|
|
69
|
+
type: "text",
|
|
70
|
+
onBlur: e => {
|
|
71
|
+
const event = {
|
|
72
|
+
target: {
|
|
73
|
+
name,
|
|
74
|
+
value: e.target.value ? (0, _format_number.numberToEnUS)(e.target.value) : ''
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (props.onBlur) props.onBlur(event);
|
|
78
|
+
},
|
|
79
|
+
onChange: e => {
|
|
80
|
+
if (onChange) onChange(e);
|
|
81
|
+
},
|
|
82
|
+
value: value,
|
|
83
|
+
textAlign: textAlign
|
|
84
|
+
}));
|
|
85
|
+
});
|
|
86
|
+
Input.displayName = 'MaskNumberInputField';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../../BaseNumber-797088d7.js';
|
|
3
|
+
export { I as Input } from '../../Currency-b33d3a22.js';
|
|
4
|
+
import 'imask';
|
|
5
|
+
import '../../index-772f9f1a.js';
|
|
6
|
+
import '../../@types/Align.js';
|
|
7
|
+
import '../../@types/ColorStyles.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
9
|
+
import '../../@types/PermissionAttr.js';
|
|
10
|
+
import '../slot/index.js';
|
|
11
|
+
import '../../tooltip/types.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _slot = require("../slot");
|
|
9
|
+
var _BaseNumber = require("./BaseNumber");
|
|
10
|
+
const _excluded = ["currencySymbol", "min", "max", "maskOptions"];
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
currencySymbol = 'R$',
|
|
19
|
+
min,
|
|
20
|
+
max,
|
|
21
|
+
maskOptions = {
|
|
22
|
+
scale: 2,
|
|
23
|
+
thousandsSeparator: '',
|
|
24
|
+
radix: ',',
|
|
25
|
+
normalizeZeros: false,
|
|
26
|
+
padFractionalZeros: true,
|
|
27
|
+
min: 0
|
|
28
|
+
}
|
|
29
|
+
} = props,
|
|
30
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_BaseNumber.Input, _extends({}, rest, {
|
|
32
|
+
ref: ref,
|
|
33
|
+
min: min,
|
|
34
|
+
max: max,
|
|
35
|
+
maskOptions: maskOptions
|
|
36
|
+
}), /*#__PURE__*/_react.default.createElement(_slot.LeftSlot, {
|
|
37
|
+
style: {
|
|
38
|
+
placeContent: 'center'
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
41
|
+
style: {
|
|
42
|
+
padding: '0 5px'
|
|
43
|
+
},
|
|
44
|
+
className: "currency-symbol"
|
|
45
|
+
}, currencySymbol)));
|
|
46
|
+
});
|
|
47
|
+
Input.displayName = 'CurrencyInputField';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../../BaseNumber-797088d7.js';
|
|
3
|
+
export { I as Input } from '../../Decimal-55e836d5.js';
|
|
4
|
+
import 'imask';
|
|
5
|
+
import '../../index-772f9f1a.js';
|
|
6
|
+
import '../../@types/Align.js';
|
|
7
|
+
import '../../@types/ColorStyles.js';
|
|
8
|
+
import '../../@types/Position.js';
|
|
9
|
+
import '../../@types/PermissionAttr.js';
|
|
10
|
+
import '../slot/index.js';
|
|
11
|
+
import '../../tooltip/types.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _BaseNumber = require("./BaseNumber");
|
|
9
|
+
const _excluded = ["min", "max", "maskOptions"];
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
15
|
+
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
min,
|
|
18
|
+
max,
|
|
19
|
+
maskOptions = {
|
|
20
|
+
scale: 2,
|
|
21
|
+
normalizeZeros: false,
|
|
22
|
+
padFractionalZeros: true,
|
|
23
|
+
thousandsSeparator: '',
|
|
24
|
+
radix: ',',
|
|
25
|
+
min: 0
|
|
26
|
+
}
|
|
27
|
+
} = props,
|
|
28
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_BaseNumber.Input, _extends({}, rest, {
|
|
30
|
+
ref: ref,
|
|
31
|
+
min: min,
|
|
32
|
+
max: max,
|
|
33
|
+
maskOptions: maskOptions
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
Input.displayName = 'DecimalInputField';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../../index-772f9f1a.js';
|
|
3
|
+
export { I as Input, a as NumberFieldProps } from '../../Number-9c6aceff.js';
|
|
4
|
+
import '../../@types/Align.js';
|
|
5
|
+
import '../../@types/ColorStyles.js';
|
|
6
|
+
import '../../@types/Position.js';
|
|
7
|
+
import '../../@types/PermissionAttr.js';
|
|
8
|
+
import '../slot/index.js';
|
|
9
|
+
import '../../tooltip/types.js';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactImask = require("react-imask");
|
|
9
|
+
var _textfield = require("../textfield");
|
|
10
|
+
const _excluded = ["min", "max", "name", "defaultValue", "children"];
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
|
+
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
min,
|
|
19
|
+
max,
|
|
20
|
+
name,
|
|
21
|
+
defaultValue,
|
|
22
|
+
children = ''
|
|
23
|
+
} = props,
|
|
24
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
25
|
+
const defaultMaskOptions = {
|
|
26
|
+
min: min,
|
|
27
|
+
max: max,
|
|
28
|
+
mask: Number,
|
|
29
|
+
scale: 0,
|
|
30
|
+
normalizeZeros: false,
|
|
31
|
+
padFractionalZeros: false
|
|
32
|
+
};
|
|
33
|
+
const {
|
|
34
|
+
ref: maskInputRef
|
|
35
|
+
} = (0, _reactImask.useIMask)(defaultMaskOptions, {
|
|
36
|
+
defaultValue: defaultValue?.toString()
|
|
37
|
+
});
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_textfield.Input, _extends({}, rest, {
|
|
39
|
+
type: "text",
|
|
40
|
+
name: name,
|
|
41
|
+
textAlign: "right",
|
|
42
|
+
ref: el => {
|
|
43
|
+
if (maskInputRef) maskInputRef.current = el;
|
|
44
|
+
if (typeof ref === 'function') ref(el);else if (ref) ref.current = el;
|
|
45
|
+
},
|
|
46
|
+
defaultValue: defaultValue
|
|
47
|
+
}), children);
|
|
48
|
+
});
|
|
49
|
+
Input.displayName = 'NumberInputField';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const numberToPtBR: (value?: string | number) => string | undefined;
|
|
2
|
+
declare const numberToEnUS: (value: string | number) => string | number;
|
|
3
|
+
declare const formatOnlyNumbers: (value: string) => string;
|
|
4
|
+
|
|
5
|
+
export { formatOnlyNumbers, numberToEnUS, numberToPtBR };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.numberToPtBR = exports.numberToEnUS = exports.formatOnlyNumbers = void 0;
|
|
7
|
+
const ptBRRegex = /\b\d{1,3}(?:\.\d{3})*,\d+\b/;
|
|
8
|
+
const numberToPtBR = value => {
|
|
9
|
+
if (value !== undefined && typeof value === 'number') {
|
|
10
|
+
return value.toLocaleString('pt-BR');
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
exports.numberToPtBR = numberToPtBR;
|
|
15
|
+
const numberToEnUS = value => {
|
|
16
|
+
let formattedNumber;
|
|
17
|
+
const isPTBR = ptBRRegex.test(String(value));
|
|
18
|
+
if (isPTBR) {
|
|
19
|
+
formattedNumber = String(value).replaceAll('.', '').replaceAll(',', '.');
|
|
20
|
+
return formattedNumber;
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
exports.numberToEnUS = numberToEnUS;
|
|
25
|
+
const formatOnlyNumbers = value => {
|
|
26
|
+
const teste = value.replace(/[._\-/()\s+]/g, '');
|
|
27
|
+
return teste;
|
|
28
|
+
};
|
|
29
|
+
exports.formatOnlyNumbers = formatOnlyNumbers;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Position } from '../../@types/Position.js';
|
|
3
|
+
|
|
4
|
+
interface SelectFieldContextProps {
|
|
5
|
+
striped?: boolean;
|
|
6
|
+
listBoxOpen: boolean;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
showClearButton?: boolean;
|
|
9
|
+
searchOnDropdown?: boolean;
|
|
10
|
+
isMultipleSelect?: boolean;
|
|
11
|
+
isMultipleDefault?: boolean;
|
|
12
|
+
isMultipleWithCheckboxes?: boolean;
|
|
13
|
+
label?: string;
|
|
14
|
+
filterValue?: string;
|
|
15
|
+
nameSelect?: string;
|
|
16
|
+
valueSelect?: any;
|
|
17
|
+
selectFieldId: string;
|
|
18
|
+
activeDescendant?: string;
|
|
19
|
+
notFoundFilterLabel: string;
|
|
20
|
+
searchInputPlaceholder: string;
|
|
21
|
+
dropdownAlignButton?: Extract<Position, 'left' | 'right'>;
|
|
22
|
+
liSelectedRef: React__default.RefObject<HTMLLIElement | null>;
|
|
23
|
+
selectInputRef: React__default.RefObject<HTMLInputElement | null>;
|
|
24
|
+
selectContainerRef: React__default.RefObject<HTMLDivElement | null>;
|
|
25
|
+
selectSearchInputRef: React__default.RefObject<HTMLInputElement>;
|
|
26
|
+
handleOnSearch?: (event: React__default.ChangeEvent<HTMLInputElement>) => void;
|
|
27
|
+
handleOnChange?: (value?: string, label?: string, addOrRemove?: boolean) => void;
|
|
28
|
+
handleOnKeyDown?: (event: React__default.KeyboardEvent<HTMLInputElement>) => void;
|
|
29
|
+
handleClearValue?: () => void;
|
|
30
|
+
handleCloseListBox: () => void;
|
|
31
|
+
handleCheckMultiple: (checkOrUncheckAll?: boolean) => void;
|
|
32
|
+
handleChangeLiSelected: (liElement: HTMLLIElement | null) => void;
|
|
33
|
+
handleChangeListBoxState: () => void;
|
|
34
|
+
}
|
|
35
|
+
declare const SelectFieldContext: React__default.Context<SelectFieldContextProps>;
|
|
36
|
+
declare const useSelectFieldContext: () => SelectFieldContextProps;
|
|
37
|
+
|
|
38
|
+
export { SelectFieldContext, SelectFieldContextProps, useSelectFieldContext };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSelectFieldContext = exports.SelectFieldContext = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const SelectFieldContext = exports.SelectFieldContext = /*#__PURE__*/_react.default.createContext({});
|
|
10
|
+
const useSelectFieldContext = () => {
|
|
11
|
+
const context = _react.default.useContext(SelectFieldContext);
|
|
12
|
+
if (context === undefined) throw new Error('useSelectFieldContext must be used within a SelectFieldProvider');
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
exports.useSelectFieldContext = useSelectFieldContext;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const setFocusOnOffsetElement: (current: HTMLElement, nextOrBefore: 'next' | 'before') => void;
|
|
2
|
+
declare const options: string[];
|
|
3
|
+
declare const NAVIGATION_KEYS: string[];
|
|
4
|
+
declare const isTypingKey: (event: React.KeyboardEvent) => boolean;
|
|
5
|
+
|
|
6
|
+
export { NAVIGATION_KEYS, isTypingKey, options, setFocusOnOffsetElement };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setFocusOnOffsetElement = exports.options = exports.isTypingKey = exports.NAVIGATION_KEYS = void 0;
|
|
7
|
+
var _permissionValidations = require("../../permissionValidations");
|
|
8
|
+
var _types = require("./types");
|
|
9
|
+
const FOCUSABLE_SELECTOR = ['a[href]', 'button:not([disabled])', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', '[tabindex]:not([tabindex="-1"])'].join(',');
|
|
10
|
+
const setFocusOnOffsetElement = (current, nextOrBefore) => {
|
|
11
|
+
const elementFocusables = Array.from(document.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
12
|
+
const offsetElement = nextOrBefore === 'next' ? 1 : -1;
|
|
13
|
+
const elementIndex = elementFocusables.indexOf(current);
|
|
14
|
+
const nextElement = elementFocusables[elementIndex + offsetElement];
|
|
15
|
+
if (nextElement) nextElement.focus();
|
|
16
|
+
};
|
|
17
|
+
exports.setFocusOnOffsetElement = setFocusOnOffsetElement;
|
|
18
|
+
const options = exports.options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
19
|
+
const NAVIGATION_KEYS = exports.NAVIGATION_KEYS = [_types.Keys.escape, _types.Keys.arrowDown, _types.Keys.arrowUp, _types.Keys.enter];
|
|
20
|
+
const isTypingKey = event => {
|
|
21
|
+
if (event.ctrlKey || event.metaKey || event.altKey) return false;
|
|
22
|
+
const validKeys = [_types.Keys.backspace, _types.Keys.delete, _types.Keys.spaceBar];
|
|
23
|
+
return event.key.length === 1 || validKeys.includes(event.key);
|
|
24
|
+
};
|
|
25
|
+
exports.isTypingKey = isTypingKey;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
export { LeftSlot, RightSlot } from '../slot/index.js';
|
|
3
|
+
export { Item } from './item.js';
|
|
4
|
+
export { SelectFieldInputProps } from './types.js';
|
|
5
|
+
export { I as Input } from '../../index-18a64236.js';
|
|
6
|
+
import '../../@types/Align.js';
|
|
7
|
+
import '../../@types/ColorStyles.js';
|
|
8
|
+
import '../../tooltip/types.js';
|
|
9
|
+
import '../../@types/Position.js';
|
|
10
|
+
import '../../@types/PermissionAttr.js';
|