linear-react-components-ui 1.1.24-beta.0 → 1.1.24-beta.10
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/BaseMask-0c14ef51.d.ts +24 -0
- package/lib/Cnpj-bde01dd0.d.ts +18 -0
- package/lib/Cpf-3fa496ad.d.ts +18 -0
- package/lib/Phone-2bb0b397.d.ts +18 -0
- package/lib/ZipCode-09460e18.d.ts +13 -0
- package/lib/alerts/AlertProvider.js +1 -2
- package/lib/alerts/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +2 -3
- package/lib/alerts/withAlert.js +1 -2
- package/lib/assets/styles/calendar.scss +140 -35
- package/lib/assets/styles/datepicker2.scss +3 -9
- package/lib/assets/styles/file.scss +8 -0
- package/lib/assets/styles/filefield.scss +42 -0
- package/lib/assets/styles/numberfield.scss +18 -0
- package/lib/assets/styles/periodpicker.scss +1 -1
- package/lib/assets/styles/radiofield.scss +185 -0
- package/lib/assets/styles/selectfield.scss +1 -3
- package/lib/assets/styles/table.scss +6 -0
- package/lib/assets/styles/textfield.scss +61 -27
- package/lib/avatar/index.js +9 -11
- package/lib/badge/index.js +4 -4
- package/lib/buttons/Button.js +1 -2
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +22 -21
- package/lib/buttons/InfoButton.js +1 -1
- package/lib/buttons/PrimaryButton.js +1 -1
- package/lib/buttons/SuccessButton.js +1 -1
- package/lib/buttons/WarningButton.js +1 -1
- package/lib/buttons/button_container/index.js +1 -1
- package/lib/buttons/split_button/index.js +2 -2
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +123 -44
- package/lib/checkbox/index.js +2 -3
- package/lib/dialog/Custom.js +2 -3
- package/lib/dialog/Question.js +5 -4
- package/lib/dialog/base/Content.js +5 -6
- package/lib/dialog/base/Header.js +3 -4
- package/lib/dialog/base/index.js +33 -23
- package/lib/dialog/form/index.js +52 -12
- package/lib/dialog/types.d.ts +4 -0
- package/lib/dialog/wizard/index.js +1 -2
- package/lib/dialog/wizard/progressbar.js +1 -1
- package/lib/dialog/wizard/step.js +1 -1
- package/lib/dialog/wizard/useWizard.js +1 -2
- package/lib/drawer/Content.js +1 -2
- package/lib/drawer/Drawer.js +6 -7
- package/lib/drawer/Header.js +2 -3
- package/lib/dropdown/Popup.js +7 -7
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/withDropdown.js +3 -4
- package/lib/fieldset/index.js +8 -9
- package/lib/form/Field.js +2 -3
- package/lib/form/FieldArray.js +2 -3
- package/lib/form/FieldNumber.js +4 -5
- package/lib/form/FieldPeriod.js +3 -4
- package/lib/form/index.js +3 -4
- package/lib/form/withFieldHOC.js +1 -2
- package/lib/form/withFormSecurity.js +1 -2
- package/lib/form2/helpers.js +1 -1
- package/lib/form2/index.d.ts +1 -1
- package/lib/form2/types.d.ts +7 -3
- package/lib/form2/useForm/index.js +22 -15
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +1 -4
- package/lib/hint/index.js +1 -7
- package/lib/icons/helper.d.ts +16 -0
- package/lib/icons/helper.js +16 -0
- package/lib/icons/index.js +9 -9
- package/lib/index-208e7f62.d.ts +44 -0
- package/lib/index-3b70931d.d.ts +44 -0
- package/lib/index-442d51a2.d.ts +15 -0
- package/lib/index-4e511971.d.ts +26 -0
- package/lib/index-7dfa8924.d.ts +22 -0
- package/lib/index-9e576346.d.ts +23 -0
- package/lib/index-d3b6a19a.d.ts +41 -0
- package/lib/index-ecafc8c6.d.ts +30 -0
- package/lib/inputs/base/InputTextBase.js +9 -8
- package/lib/inputs/base/helpers.js +3 -7
- package/lib/inputs/base/types.d.ts +1 -1
- package/lib/inputs/color/index.js +2 -3
- package/lib/inputs/date/Dropdown.js +6 -4
- package/lib/inputs/date/index.js +34 -22
- package/lib/inputs/errorMessage/index.js +2 -3
- package/lib/inputs/file/DefaultFile.js +31 -31
- package/lib/inputs/file/DragDropFile.js +18 -17
- package/lib/inputs/file/File.js +6 -5
- package/lib/inputs/file/FileButtonSettings.js +0 -1
- package/lib/inputs/file/index.js +0 -1
- package/lib/inputs/inputHOC.js +1 -2
- package/lib/inputs/mask/BaseMask.js +1 -2
- package/lib/inputs/mask/Cnpj.js +1 -2
- package/lib/inputs/mask/Cpf.js +1 -2
- package/lib/inputs/multiSelect/ActionButtons.js +1 -2
- package/lib/inputs/multiSelect/Dropdown.js +11 -11
- package/lib/inputs/multiSelect/helper.js +2 -1
- package/lib/inputs/multiSelect/index.js +10 -9
- package/lib/inputs/number/BaseNumber.js +1 -1
- package/lib/inputs/number/index.js +3 -3
- package/lib/inputs/period/Dropdown.js +7 -4
- package/lib/inputs/period/PeriodList.js +3 -12
- package/lib/inputs/period/helper.js +1 -3
- package/lib/inputs/period/index.js +116 -113
- package/lib/inputs/period/types.d.ts +4 -1
- package/lib/inputs/search/index.js +8 -5
- package/lib/inputs/select/ActionButtons.js +1 -1
- package/lib/inputs/select/Dropdown.js +3 -4
- package/lib/inputs/select/helper.js +13 -10
- package/lib/inputs/select/multiple/Selecteds.js +2 -2
- package/lib/inputs/select/multiple/index.js +14 -11
- package/lib/inputs/select/simple/index.js +19 -13
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/inputs/types.d.ts +1 -0
- package/lib/inputs2/checkboxfield/index.d.ts +1 -1
- package/lib/inputs2/checkboxfield/index.js +18 -15
- package/lib/inputs2/colorfield/index.d.ts +2 -2
- package/lib/inputs2/colorfield/index.js +5 -5
- package/lib/inputs2/date/base/constants.js +2 -1
- package/lib/inputs2/date/base/index.js +6 -8
- package/lib/inputs2/date/datefield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/datefield/calendarbox.js +3 -2
- package/lib/inputs2/date/datefield/context.d.ts +1 -0
- package/lib/inputs2/date/datefield/index.d.ts +1 -0
- package/lib/inputs2/date/datefield/index.js +44 -33
- package/lib/inputs2/date/datefield/triggers.js +1 -2
- package/lib/inputs2/date/datefield/types.d.ts +2 -0
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +8 -6
- package/lib/inputs2/date/dateperiodfield/context.d.ts +1 -0
- package/lib/inputs2/date/dateperiodfield/index.d.ts +1 -0
- package/lib/inputs2/date/dateperiodfield/index.js +66 -48
- package/lib/inputs2/date/dateperiodfield/triggers.js +19 -14
- package/lib/inputs2/date/dateperiodfield/types.d.ts +2 -0
- package/lib/inputs2/date/helpers.d.ts +1 -0
- package/lib/inputs2/date/types.d.ts +2 -1
- package/lib/inputs2/{number/Number.d.ts → filefield/index.d.ts} +2 -2
- package/lib/inputs2/filefield/index.js +174 -0
- package/lib/inputs2/index.d.ts +20 -14
- package/lib/inputs2/index.js +10 -11
- package/lib/inputs2/mask/BaseMask.d.ts +2 -2
- package/lib/inputs2/mask/BaseMask.js +7 -7
- package/lib/inputs2/mask/Cnpj.d.ts +3 -3
- package/lib/inputs2/mask/Cnpj.js +4 -5
- package/lib/inputs2/mask/Cpf.d.ts +3 -3
- package/lib/inputs2/mask/Cpf.js +4 -5
- package/lib/inputs2/mask/Phone.d.ts +3 -3
- package/lib/inputs2/mask/Phone.js +1 -2
- package/lib/inputs2/mask/ZipCode.d.ts +3 -3
- package/lib/inputs2/mask/ZipCode.js +1 -2
- package/lib/inputs2/numberfield/currency.d.ts +13 -0
- package/lib/inputs2/numberfield/currency.js +91 -0
- package/lib/inputs2/numberfield/decimal.d.ts +13 -0
- package/lib/inputs2/{number/BaseNumber.js → numberfield/decimal.js} +57 -58
- package/lib/inputs2/numberfield/helpers.d.ts +30 -0
- package/lib/inputs2/numberfield/helpers.js +53 -0
- package/lib/inputs2/numberfield/index.d.ts +12 -0
- package/lib/inputs2/numberfield/index.js +104 -0
- package/lib/inputs2/numberfield/types.d.ts +36 -0
- package/lib/inputs2/numberfield/types.js +5 -0
- package/lib/inputs2/{number/BaseNumber.d.ts → radiofield/index.d.ts} +4 -5
- package/lib/inputs2/radiofield/index.js +144 -0
- package/lib/inputs2/radiofield/types.d.ts +33 -0
- package/lib/inputs2/radiofield/types.js +5 -0
- package/lib/inputs2/selectfield/context.d.ts +1 -0
- package/lib/inputs2/selectfield/index.d.ts +2 -1
- package/lib/inputs2/selectfield/index.js +118 -58
- package/lib/inputs2/selectfield/item.d.ts +2 -1
- package/lib/inputs2/selectfield/item.js +8 -4
- package/lib/inputs2/selectfield/listbox.d.ts +1 -1
- package/lib/inputs2/selectfield/listbox.js +24 -10
- package/lib/inputs2/selectfield/options.d.ts +9 -0
- package/lib/inputs2/selectfield/options.js +26 -0
- package/lib/inputs2/selectfield/search.d.ts +1 -1
- package/lib/inputs2/selectfield/search.js +3 -4
- package/lib/inputs2/selectfield/selections.d.ts +1 -1
- package/lib/inputs2/selectfield/selections.js +3 -2
- package/lib/inputs2/selectfield/triggers.js +17 -8
- package/lib/inputs2/selectfield/types.d.ts +0 -1
- package/lib/inputs2/slot/index.d.ts +2 -2
- package/lib/inputs2/{number/Decimal.d.ts → textareafield/index.d.ts} +2 -5
- package/lib/inputs2/textareafield/index.js +194 -0
- package/lib/inputs2/textfield/index.d.ts +1 -1
- package/lib/inputs2/textfield/index.js +18 -17
- package/lib/labelMessages/index.js +4 -6
- package/lib/labels/DefaultLabel.js +2 -6
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.js +10 -12
- package/lib/list/index.js +2 -4
- package/lib/menus/float/MenuItem.js +3 -4
- package/lib/menus/float/SubMenuContainer.js +2 -3
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/MenuLink.js +1 -2
- package/lib/menus/sidenav/NavMenuGroup.js +2 -3
- package/lib/menus/sidenav/NavMenuItem.js +10 -9
- package/lib/menus/sidenav/NavSubMenuItem.js +2 -3
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +6 -7
- package/lib/menus/sidenav/popup_menu_search/index.js +1 -2
- package/lib/panel/Content.js +9 -8
- package/lib/panel/Default.js +3 -4
- package/lib/panel/Header.js +4 -5
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/PopoverText.js +1 -2
- package/lib/popover/index.js +2 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.js +3 -4
- package/lib/shortcuts/index.js +1 -1
- package/lib/skeleton/SkeletonContainer.js +1 -2
- package/lib/skeleton/index.js +1 -4
- package/lib/spinner/index.js +3 -4
- package/lib/split/Split.js +2 -3
- package/lib/split/SplitSide.js +4 -5
- package/lib/table/Body.js +4 -5
- package/lib/table/Header.js +9 -7
- package/lib/table/HeaderColumn.js +2 -3
- package/lib/table/Row.js +4 -5
- package/lib/table/RowColumn.js +2 -3
- package/lib/table/index.js +20 -16
- package/lib/table/types.d.ts +1 -0
- package/lib/tabs/DropdownTabs.js +2 -3
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuTabs.js +4 -9
- package/lib/tabs/Panel.js +8 -7
- package/lib/tabs/context.js +7 -5
- package/lib/tabs/index.js +1 -2
- package/lib/textContent/index.js +2 -3
- package/lib/toolbar/ButtonBar.js +2 -3
- package/lib/toolbar/LabelBar.js +1 -2
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/TooltipContent.js +8 -9
- package/lib/tooltip/useTooltip.js +8 -8
- package/lib/treetable/Body.js +2 -3
- package/lib/treetable/Header.js +3 -4
- package/lib/treetable/Row.js +9 -10
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -6
- package/lib/treeview/index.js +5 -6
- package/lib/uitour/index.js +9 -8
- package/package.json +1 -1
- package/lib/BaseMask-3d5d581d.d.ts +0 -24
- package/lib/BaseNumber-797088d7.d.ts +0 -23
- package/lib/Cnpj-1602be21.d.ts +0 -18
- package/lib/Cpf-4d6b9079.d.ts +0 -18
- package/lib/Currency-b33d3a22.d.ts +0 -18
- package/lib/Decimal-55e836d5.d.ts +0 -13
- package/lib/Number-9c6aceff.d.ts +0 -20
- package/lib/Phone-79e5e3b4.d.ts +0 -18
- package/lib/ZipCode-8c2e9d8b.d.ts +0 -13
- package/lib/calendar/base/Day.d.ts +0 -8
- package/lib/calendar/base/Day.js +0 -36
- package/lib/calendar/base/Month.d.ts +0 -8
- package/lib/calendar/base/Month.js +0 -39
- package/lib/calendar/base/Week.d.ts +0 -8
- package/lib/calendar/base/Week.js +0 -35
- package/lib/index-18a64236.d.ts +0 -23
- package/lib/index-43ad8140.d.ts +0 -41
- package/lib/index-772f9f1a.d.ts +0 -44
- package/lib/index-8a59cf4b.d.ts +0 -23
- package/lib/inputs2/number/Currency.d.ts +0 -11
- package/lib/inputs2/number/Currency.js +0 -47
- package/lib/inputs2/number/Decimal.js +0 -36
- package/lib/inputs2/number/Number.js +0 -49
- package/lib/inputs2/number/format_number.d.ts +0 -5
- package/lib/inputs2/number/format_number.js +0 -29
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.convertToSafeNumber = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Converte um valor string para um número seguro ou retorna como string limpa.
|
|
9
|
+
*
|
|
10
|
+
* Esta função sanitiza a entrada removendo todos os caracteres não-dígitos exceto hífens,
|
|
11
|
+
* e então converte para número se estiver dentro do intervalo seguro de inteiros do JavaScript.
|
|
12
|
+
* Se o valor exceder o intervalo seguro ou a conversão falhar, retorna a string limpa.
|
|
13
|
+
*
|
|
14
|
+
* @param stringValue - A string de entrada a ser convertida. Pode conter qualquer caractere.
|
|
15
|
+
* @param returnAsString - Se true, retorna a string limpa sem tentar conversão para número. Se false,
|
|
16
|
+
* tenta converter para número dentro dos limites seguros de inteiros.
|
|
17
|
+
*
|
|
18
|
+
* @returns {number | string} Retorna:
|
|
19
|
+
* - String vazia ('') ou 0 se a entrada estiver vazia/nula (baseado na prop "returnAsString")
|
|
20
|
+
* - String limpa se "returnAsString" for true
|
|
21
|
+
* - Número se a conversão for bem-sucedida e dentro do intervalo seguro de inteiros
|
|
22
|
+
* - String limpa se o número exceder o intervalo seguro ou a conversão falhar
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* convertToSafeNumber("123abc", false); // Retorna: 123
|
|
27
|
+
* convertToSafeNumber("123abc", true); // Retorna: "123"
|
|
28
|
+
* convertToSafeNumber("-456def", false); // Retorna: -456
|
|
29
|
+
* convertToSafeNumber("999999999999999999999", false); // Retorna: "999999999999999999999" (excede intervalo seguro)
|
|
30
|
+
* convertToSafeNumber("", false); // Retorna: 0
|
|
31
|
+
* convertToSafeNumber("", true); // Retorna: ""
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
const convertToSafeNumber = (stringValue, returnAsString) => {
|
|
35
|
+
if (!stringValue || stringValue === '') return returnAsString ? '' : 0;
|
|
36
|
+
const cleanValue = stringValue.replace(/[^\d-]/g, '');
|
|
37
|
+
if (returnAsString) {
|
|
38
|
+
return cleanValue;
|
|
39
|
+
}
|
|
40
|
+
const {
|
|
41
|
+
MAX_SAFE_INTEGER
|
|
42
|
+
} = Number;
|
|
43
|
+
try {
|
|
44
|
+
const numValue = BigInt(cleanValue);
|
|
45
|
+
if (numValue > BigInt(MAX_SAFE_INTEGER) || numValue < BigInt(-MAX_SAFE_INTEGER)) {
|
|
46
|
+
return cleanValue;
|
|
47
|
+
}
|
|
48
|
+
return Number(cleanValue);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return cleanValue;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
exports.convertToSafeNumber = convertToSafeNumber;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
export { LeftSlot, RightSlot } from '../slot/index.js';
|
|
3
|
+
export { Decimal } from './decimal.js';
|
|
4
|
+
export { Currency } from './currency.js';
|
|
5
|
+
export { CurrencyFieldInputProps, DecimalFieldInputProps, NumberFieldInputProps } from './types.js';
|
|
6
|
+
export { I as Input } from '../../index-ecafc8c6.js';
|
|
7
|
+
import '../../index-3b70931d.js';
|
|
8
|
+
import '../../@types/Align.js';
|
|
9
|
+
import '../../@types/ColorStyles.js';
|
|
10
|
+
import '../../@types/Position.js';
|
|
11
|
+
import '../../@types/PermissionAttr.js';
|
|
12
|
+
import '../../tooltip/types.js';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Currency", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _currency.Currency;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Decimal", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _decimal.Decimal;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
exports.Input = void 0;
|
|
19
|
+
Object.defineProperty(exports, "LeftSlot", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _slot.LeftSlot;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "RightSlot", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _slot.RightSlot;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var _react = _interopRequireDefault(require("react"));
|
|
32
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
33
|
+
var _reactImask = require("react-imask");
|
|
34
|
+
var _2 = require("..");
|
|
35
|
+
var _helpers = require("../../form2/helpers");
|
|
36
|
+
var _slot = require("../slot");
|
|
37
|
+
var _decimal = require("./decimal");
|
|
38
|
+
var _currency = require("./currency");
|
|
39
|
+
var _helpers2 = require("./helpers");
|
|
40
|
+
const _excluded = ["min", "max", "to", "from", "enum", "onChange", "allowNegative", "returnAsString", "textAlign", "children"];
|
|
41
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
|
+
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); }
|
|
43
|
+
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; }
|
|
44
|
+
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; }
|
|
45
|
+
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; }
|
|
46
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
47
|
+
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); }
|
|
48
|
+
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; }
|
|
49
|
+
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; }
|
|
50
|
+
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
51
|
+
const {
|
|
52
|
+
min = undefined,
|
|
53
|
+
max = undefined,
|
|
54
|
+
to = undefined,
|
|
55
|
+
from = undefined,
|
|
56
|
+
enum: interval = undefined,
|
|
57
|
+
onChange = null,
|
|
58
|
+
allowNegative = true,
|
|
59
|
+
returnAsString = false,
|
|
60
|
+
textAlign = 'right',
|
|
61
|
+
children = null
|
|
62
|
+
} = props,
|
|
63
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
64
|
+
const numberInputRef = _react.default.useRef(null);
|
|
65
|
+
const {
|
|
66
|
+
value: maskedValue,
|
|
67
|
+
setValue: setMaskedValue,
|
|
68
|
+
unmaskedValue
|
|
69
|
+
} = (0, _reactImask.useIMask)({
|
|
70
|
+
mask: Number,
|
|
71
|
+
scale: 0,
|
|
72
|
+
min: !_lodash.default.isNil(min) ? min : allowNegative ? undefined : 0,
|
|
73
|
+
enum: interval,
|
|
74
|
+
max,
|
|
75
|
+
to,
|
|
76
|
+
from
|
|
77
|
+
}, {
|
|
78
|
+
ref: numberInputRef,
|
|
79
|
+
onAccept: (value, __, event) => {
|
|
80
|
+
const parsedValue = (0, _helpers2.convertToSafeNumber)(value, returnAsString);
|
|
81
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread(_objectSpread({}, event), {}, {
|
|
82
|
+
target: _objectSpread(_objectSpread({}, event === null || event === void 0 ? void 0 : event.target), {}, {
|
|
83
|
+
name: props === null || props === void 0 ? void 0 : props.name,
|
|
84
|
+
value: parsedValue
|
|
85
|
+
})
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
_react.default.useEffect(() => {
|
|
90
|
+
const floatUnmaskedValue = Number(unmaskedValue || '0');
|
|
91
|
+
if (!_lodash.default.isNil(props === null || props === void 0 ? void 0 : props.value) && (!_lodash.default.isEqual(props === null || props === void 0 ? void 0 : props.value, floatUnmaskedValue) || _lodash.default.isEqual(props === null || props === void 0 ? void 0 : props.value, 0))) {
|
|
92
|
+
setMaskedValue(_lodash.default.toString(props === null || props === void 0 ? void 0 : props.value));
|
|
93
|
+
}
|
|
94
|
+
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement(_2.TextField.Input, _extends({}, rest, {
|
|
96
|
+
ref: (0, _helpers.mergeRefs)(ref, numberInputRef),
|
|
97
|
+
type: "text",
|
|
98
|
+
inputMode: "numeric",
|
|
99
|
+
value: maskedValue,
|
|
100
|
+
textAlign: textAlign,
|
|
101
|
+
onChange: () => {}
|
|
102
|
+
}), children);
|
|
103
|
+
});
|
|
104
|
+
Input.displayName = 'NumberFieldInput';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { T as TextFieldInputProps } from '../../index-3b70931d.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../../@types/Align.js';
|
|
4
|
+
import '../../@types/ColorStyles.js';
|
|
5
|
+
import '../../@types/Position.js';
|
|
6
|
+
import '../../@types/PermissionAttr.js';
|
|
7
|
+
import '../slot/index.js';
|
|
8
|
+
import '../../tooltip/types.js';
|
|
9
|
+
|
|
10
|
+
type BaseInputProps = Omit<TextFieldInputProps, 'type' | 'max' | 'min' | 'enum'>;
|
|
11
|
+
type BaseMaskNumberInputProps = {
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
to?: number;
|
|
15
|
+
from?: number;
|
|
16
|
+
enum?: string[];
|
|
17
|
+
};
|
|
18
|
+
interface NumberFieldInputProps extends BaseInputProps, BaseMaskNumberInputProps {
|
|
19
|
+
allowNegative?: boolean;
|
|
20
|
+
returnAsString?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface DecimalFieldInputProps extends BaseInputProps, BaseMaskNumberInputProps {
|
|
23
|
+
scale?: number;
|
|
24
|
+
allowNegative?: boolean;
|
|
25
|
+
normalizeZeros?: boolean;
|
|
26
|
+
padFractionalZeros?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface CurrencyFieldInputProps extends BaseInputProps, BaseMaskNumberInputProps {
|
|
29
|
+
currencySymbol?: string;
|
|
30
|
+
scale?: number;
|
|
31
|
+
allowNegative?: boolean;
|
|
32
|
+
normalizeZeros?: boolean;
|
|
33
|
+
padFractionalZeros?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { BaseInputProps, BaseMaskNumberInputProps, CurrencyFieldInputProps, DecimalFieldInputProps, NumberFieldInputProps };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export { RadioFieldInputProps } from './types.js';
|
|
3
|
+
export { I as Input } from '../../index-442d51a2.js';
|
|
4
|
+
import '../../@types/Size.js';
|
|
5
5
|
import '../../@types/Align.js';
|
|
6
6
|
import '../../@types/ColorStyles.js';
|
|
7
|
+
import '../../tooltip/types.js';
|
|
7
8
|
import '../../@types/Position.js';
|
|
8
9
|
import '../../@types/PermissionAttr.js';
|
|
9
|
-
import '../slot/index.js';
|
|
10
|
-
import '../../tooltip/types.js';
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
require("../../assets/styles/radiofield.scss");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
|
+
var _uuid = require("uuid");
|
|
11
|
+
var _hint = _interopRequireDefault(require("../../hint"));
|
|
12
|
+
var _popover = _interopRequireDefault(require("../../popover"));
|
|
13
|
+
var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
|
|
14
|
+
var Tooltip = _interopRequireWildcard(require("../../tooltip"));
|
|
15
|
+
var _permissionValidations = require("../../permissionValidations");
|
|
16
|
+
const _excluded = ["label", "errors", "tooltip", "tooltipPosition", "tooltipWidth", "hint", "gridLayout", "size", "onDeniedActions", "permissionAttr", "labelUppercase", "customClassLabel", "customClassInputContainer", "customClass", "customClassWrapper", "textAlign", "skeletonize", "hintPosition", "themePopover", "popoverAlign"];
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
23
|
+
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
24
|
+
const {
|
|
25
|
+
label,
|
|
26
|
+
errors,
|
|
27
|
+
tooltip,
|
|
28
|
+
tooltipPosition,
|
|
29
|
+
tooltipWidth,
|
|
30
|
+
hint,
|
|
31
|
+
gridLayout,
|
|
32
|
+
size = 'medium',
|
|
33
|
+
onDeniedActions = undefined,
|
|
34
|
+
permissionAttr = undefined,
|
|
35
|
+
labelUppercase = false,
|
|
36
|
+
customClassLabel = '',
|
|
37
|
+
customClassInputContainer = '',
|
|
38
|
+
customClass = '',
|
|
39
|
+
customClassWrapper = '',
|
|
40
|
+
textAlign = 'left',
|
|
41
|
+
skeletonize = false,
|
|
42
|
+
hintPosition = 'below',
|
|
43
|
+
themePopover = 'light',
|
|
44
|
+
popoverAlign = 'left'
|
|
45
|
+
} = props,
|
|
46
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
47
|
+
const onDenied = _react.default.useMemo(() => {
|
|
48
|
+
return onDeniedActions || (0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr);
|
|
49
|
+
}, [onDeniedActions, permissionAttr]);
|
|
50
|
+
const {
|
|
51
|
+
hideContent,
|
|
52
|
+
unvisible
|
|
53
|
+
} = onDenied;
|
|
54
|
+
const inputContainerRef = _react.default.useRef(null);
|
|
55
|
+
const inputId = _react.default.useMemo(() => props.id || props.name || (0, _uuid.v1)(), [props.id, props.name]);
|
|
56
|
+
const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
|
|
57
|
+
const isReadOnly = Boolean(props.readOnly || onDenied.readOnly);
|
|
58
|
+
const isDisabled = Boolean(props.disabled || onDenied.disabled);
|
|
59
|
+
const hasHintMessages = Boolean(hint === null || hint === void 0 ? void 0 : hint.length);
|
|
60
|
+
const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
61
|
+
const handleOnChange = event => {
|
|
62
|
+
var _rest$onChange;
|
|
63
|
+
if (isReadOnly) {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 ? void 0 : _rest$onChange.call(rest, event);
|
|
69
|
+
};
|
|
70
|
+
const handleOnClick = event => {
|
|
71
|
+
var _rest$onClick;
|
|
72
|
+
if (isReadOnly) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
(_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 ? void 0 : _rest$onClick.call(rest, event);
|
|
78
|
+
};
|
|
79
|
+
if (unvisible || hideContent) return null;
|
|
80
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
|
|
81
|
+
cols: gridLayout
|
|
82
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
83
|
+
"data-testid": "test-radio-field-root",
|
|
84
|
+
"data-state-error": hasValidationErrors,
|
|
85
|
+
className: "radio-field-root ".concat(customClassWrapper)
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
87
|
+
ref: inputContainerRef,
|
|
88
|
+
"data-state-skeletonize": skeletonize,
|
|
89
|
+
className: "container ".concat(customClassInputContainer)
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
91
|
+
"data-testid": "test-radio-field-input"
|
|
92
|
+
}, rest, {
|
|
93
|
+
ref: ref,
|
|
94
|
+
id: inputId,
|
|
95
|
+
type: "radio",
|
|
96
|
+
readOnly: isReadOnly,
|
|
97
|
+
disabled: isDisabled || isReadOnly,
|
|
98
|
+
className: "input ".concat(customClass),
|
|
99
|
+
tabIndex: !isReadOnly ? 0 : -1,
|
|
100
|
+
placeholder: rest.placeholder,
|
|
101
|
+
"data-state-size": size,
|
|
102
|
+
"data-state-error": hasValidationErrors,
|
|
103
|
+
"data-state-read-only": isReadOnly,
|
|
104
|
+
"data-state-text-align": textAlign,
|
|
105
|
+
"data-state-skeletonize": skeletonize,
|
|
106
|
+
onClick: handleOnClick,
|
|
107
|
+
onChange: handleOnChange
|
|
108
|
+
})), hasLabel && /*#__PURE__*/_react.default.createElement("span", {
|
|
109
|
+
className: "root-label ".concat(customClassLabel),
|
|
110
|
+
"data-state-skeletonize": skeletonize
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement("label", {
|
|
112
|
+
className: "label",
|
|
113
|
+
title: label,
|
|
114
|
+
htmlFor: inputId,
|
|
115
|
+
"data-state-disabled": isDisabled,
|
|
116
|
+
"data-state-read-only": isReadOnly,
|
|
117
|
+
"data-state-input-required": props.required,
|
|
118
|
+
"data-state-label-uppercase": labelUppercase
|
|
119
|
+
}, label), hasHintMessages && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
120
|
+
customClass: "label-popover",
|
|
121
|
+
theme: themePopover,
|
|
122
|
+
align: popoverAlign,
|
|
123
|
+
iconColor: "#03bde2"
|
|
124
|
+
}, hint))), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
125
|
+
customClass: "hint",
|
|
126
|
+
description: hint,
|
|
127
|
+
disabled: isDisabled,
|
|
128
|
+
skeletonize: skeletonize,
|
|
129
|
+
visible: hasHintMessages
|
|
130
|
+
}), hasValidationErrors && /*#__PURE__*/_react.default.createElement("span", {
|
|
131
|
+
"data-testid": "test-radio-field-list-errors",
|
|
132
|
+
className: "error",
|
|
133
|
+
"data-state-skeletonize": skeletonize,
|
|
134
|
+
"aria-describedby": String(props.name).concat('-errors')
|
|
135
|
+
}, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
136
|
+
key: "".concat(index + 1, "-").concat(error)
|
|
137
|
+
}, error, "\xA0"))))), /*#__PURE__*/_react.default.createElement(Tooltip.Tooltip, {
|
|
138
|
+
targetRef: inputContainerRef,
|
|
139
|
+
text: tooltip,
|
|
140
|
+
width: tooltipWidth,
|
|
141
|
+
position: tooltipPosition
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
144
|
+
Input.displayName = 'RadioFieldInput';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Size } from '../../@types/Size.js';
|
|
3
|
+
import { TextAlign } from '../../@types/Align.js';
|
|
4
|
+
import { ColorTheme } from '../../@types/ColorStyles.js';
|
|
5
|
+
import { ITooltipCommonProps } from '../../tooltip/types.js';
|
|
6
|
+
import { HintPosition, Position } from '../../@types/Position.js';
|
|
7
|
+
import { PermissionAttr, OnDenied } from '../../@types/PermissionAttr.js';
|
|
8
|
+
|
|
9
|
+
type RadioValue = string | number | boolean | null;
|
|
10
|
+
type InputHTMLProps = Omit<React__default.ComponentPropsWithRef<'input'>, 'multiple' | 'type' | 'size'>;
|
|
11
|
+
interface RadioFieldInputProps extends InputHTMLProps, ITooltipCommonProps {
|
|
12
|
+
hint?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
errors?: string[];
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
customClass?: string;
|
|
17
|
+
skeletonize?: boolean;
|
|
18
|
+
labelUppercase?: boolean;
|
|
19
|
+
customClassLabel?: string;
|
|
20
|
+
customClassWrapper?: string;
|
|
21
|
+
gridLayout?: string;
|
|
22
|
+
customClassInputContainer?: string;
|
|
23
|
+
getFieldValue?: (name: string) => any;
|
|
24
|
+
size?: Extract<Size, 'small' | 'medium' | 'large'>;
|
|
25
|
+
textAlign?: TextAlign;
|
|
26
|
+
hintPosition?: HintPosition;
|
|
27
|
+
themePopover?: ColorTheme;
|
|
28
|
+
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
29
|
+
permissionAttr?: PermissionAttr;
|
|
30
|
+
onDeniedActions?: OnDenied;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { RadioFieldInputProps, RadioValue };
|
|
@@ -18,6 +18,7 @@ interface SelectFieldContextProps {
|
|
|
18
18
|
activeDescendant?: string;
|
|
19
19
|
notFoundFilterLabel: string;
|
|
20
20
|
searchInputPlaceholder: string;
|
|
21
|
+
optionItens: React__default.ReactNode[];
|
|
21
22
|
dropdownAlignButton?: Extract<Position, 'left' | 'right'>;
|
|
22
23
|
liSelectedRef: React__default.RefObject<HTMLLIElement | null>;
|
|
23
24
|
selectInputRef: React__default.RefObject<HTMLInputElement | null>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
export { LeftSlot, RightSlot } from '../slot/index.js';
|
|
3
|
+
export { Options } from './options.js';
|
|
3
4
|
export { Item } from './item.js';
|
|
4
5
|
export { SelectFieldInputProps } from './types.js';
|
|
5
|
-
export { I as Input } from '../../index-
|
|
6
|
+
export { I as Input } from '../../index-4e511971.js';
|
|
6
7
|
import '../../@types/Align.js';
|
|
7
8
|
import '../../@types/ColorStyles.js';
|
|
8
9
|
import '../../tooltip/types.js';
|