linear-react-components-ui 1.1.24-beta.4 → 1.1.25-rc.1
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 +1 -2
- package/lib/@types/Position.d.ts +1 -2
- package/lib/assets/styles/calendar.scss +137 -32
- package/lib/assets/styles/colorpicker.scss +6 -1
- package/lib/assets/styles/colors.scss +12 -48
- package/lib/assets/styles/file.scss +8 -0
- package/lib/assets/styles/table.scss +6 -0
- package/lib/buttons/ActivateButton.d.ts +0 -1
- package/lib/buttons/AddButton.d.ts +0 -1
- package/lib/buttons/Button.d.ts +0 -1
- package/lib/buttons/CancelButton.d.ts +0 -1
- package/lib/buttons/DangerButton.d.ts +0 -1
- package/lib/buttons/DefaultButton.d.ts +0 -1
- package/lib/buttons/DefaultButton.js +17 -32
- package/lib/buttons/DestroyButton.d.ts +0 -1
- package/lib/buttons/EditButton.d.ts +0 -1
- package/lib/buttons/InactivateButton.d.ts +0 -1
- package/lib/buttons/InfoButton.d.ts +0 -1
- package/lib/buttons/PrimaryButton.d.ts +0 -1
- package/lib/buttons/RestoreButton.d.ts +0 -1
- package/lib/buttons/SaveButton.d.ts +0 -1
- package/lib/buttons/SuccessButton.d.ts +0 -1
- package/lib/buttons/WarningButton.d.ts +0 -1
- package/lib/buttons/index.d.ts +0 -1
- package/lib/buttons/split_button/index.d.ts +0 -1
- package/lib/buttons/types.d.ts +5 -2
- package/lib/calendar/base/index.js +113 -40
- package/lib/dialog/base/index.js +2 -2
- 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/icons/helper.d.ts +0 -20
- package/lib/icons/helper.js +0 -20
- package/lib/icons/index.d.ts +6 -4
- package/lib/icons/index.js +9 -14
- package/lib/icons/types.d.ts +6 -3
- package/lib/index.d.ts +0 -1
- package/lib/inputs/base/InputTextBase.d.ts +1 -1
- package/lib/inputs/base/InputTextBase.js +8 -18
- package/lib/inputs/base/Label.d.ts +14 -0
- package/lib/inputs/base/Label.js +35 -0
- package/lib/inputs/base/helpers.d.ts +1 -1
- package/lib/inputs/base/types.d.ts +17 -6
- 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 +27 -27
- package/lib/inputs/file/DragDropFile.d.ts +1 -1
- package/lib/inputs/file/File.d.ts +1 -1
- package/lib/inputs/file/File.js +1 -0
- package/lib/inputs/file/FileButtonSettings.d.ts +1 -1
- package/lib/inputs/file/FileButtonSettings.js +0 -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 +10 -8
- package/lib/inputs/period/types.d.ts +5 -2
- package/lib/inputs/search/index.d.ts +1 -1
- package/lib/inputs/search/index.js +6 -2
- 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 +3 -2
- package/lib/inputs/textarea/index.d.ts +1 -1
- package/lib/inputs/textarea/types.d.ts +1 -1
- package/lib/inputs/types.d.ts +2 -1
- package/lib/internals/types.d.ts +17 -1
- package/lib/internals/withTooltip.d.ts +12 -0
- package/lib/internals/withTooltip.js +172 -0
- package/lib/labels/DangerLabel.d.ts +0 -1
- package/lib/labels/DefaultLabel.d.ts +5 -3
- package/lib/labels/DefaultLabel.js +7 -15
- package/lib/labels/InfoLabel.d.ts +0 -1
- package/lib/labels/PrimaryLabel.d.ts +0 -1
- package/lib/labels/SuccessLabel.d.ts +0 -1
- package/lib/labels/WarningLabel.d.ts +0 -1
- package/lib/labels/index.d.ts +2 -3
- package/lib/labels/types.d.ts +5 -2
- package/lib/list/Header.d.ts +0 -1
- package/lib/list/Item.d.ts +5 -3
- package/lib/list/Item.js +12 -17
- package/lib/list/helpers.d.ts +0 -1
- package/lib/list/index.d.ts +0 -1
- package/lib/list/types.d.ts +6 -4
- package/lib/menus/sidenav/ExpandMenu.d.ts +2 -2
- package/lib/menus/sidenav/MenuLink.d.ts +7 -4
- package/lib/menus/sidenav/MenuLink.js +11 -20
- package/lib/menus/sidenav/NavMenuGroup.d.ts +2 -2
- package/lib/menus/sidenav/NavMenuItem.d.ts +7 -4
- package/lib/menus/sidenav/NavMenuItem.js +12 -16
- 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 +2 -11
- package/lib/popover/index.js +0 -1
- package/lib/popover/types.d.ts +0 -1
- package/lib/table/index.js +18 -8
- package/lib/table/types.d.ts +1 -0
- package/lib/textContent/index.d.ts +11 -6
- package/lib/textContent/index.js +11 -20
- package/lib/tooltip/index.d.ts +3 -4
- package/lib/tooltip/index.js +53 -36
- package/lib/tooltip/types.d.ts +3 -25
- package/package.json +2 -3
- package/lib/BaseMask-0c14ef51.d.ts +0 -24
- package/lib/Cnpj-bde01dd0.d.ts +0 -18
- package/lib/Cpf-3fa496ad.d.ts +0 -18
- package/lib/Phone-2bb0b397.d.ts +0 -18
- package/lib/ZipCode-09460e18.d.ts +0 -13
- package/lib/assets/styles/checkbox2.scss +0 -199
- package/lib/assets/styles/datepicker2.scss +0 -338
- package/lib/assets/styles/numberfield.scss +0 -18
- package/lib/assets/styles/radiofield.scss +0 -185
- package/lib/assets/styles/selectfield.scss +0 -409
- package/lib/assets/styles/slot.scss +0 -34
- package/lib/assets/styles/textfield.scss +0 -147
- 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/form2/helpers.d.ts +0 -8
- package/lib/form2/helpers.js +0 -41
- package/lib/form2/index.d.ts +0 -9
- package/lib/form2/index.js +0 -36
- package/lib/form2/types.d.ts +0 -125
- package/lib/form2/types.js +0 -5
- package/lib/form2/useForm/index.d.ts +0 -5
- package/lib/form2/useForm/index.js +0 -202
- package/lib/index-368f781f.d.ts +0 -15
- package/lib/index-3b70931d.d.ts +0 -44
- package/lib/index-789dd9a5.d.ts +0 -41
- package/lib/index-7ad68789.d.ts +0 -15
- package/lib/index-9e576346.d.ts +0 -23
- package/lib/index-c512803d.d.ts +0 -23
- package/lib/index-c9247c1f.d.ts +0 -15
- package/lib/index-ecafc8c6.d.ts +0 -30
- package/lib/inputs2/checkboxfield/index.d.ts +0 -7
- package/lib/inputs2/checkboxfield/index.js +0 -146
- package/lib/inputs2/colorfield/index.d.ts +0 -9
- package/lib/inputs2/colorfield/index.js +0 -119
- package/lib/inputs2/date/base/constants.d.ts +0 -7
- package/lib/inputs2/date/base/constants.js +0 -43
- package/lib/inputs2/date/base/index.d.ts +0 -12
- package/lib/inputs2/date/base/index.js +0 -179
- package/lib/inputs2/date/datefield/calendarbox.d.ts +0 -7
- package/lib/inputs2/date/datefield/calendarbox.js +0 -115
- package/lib/inputs2/date/datefield/context.d.ts +0 -14
- package/lib/inputs2/date/datefield/context.js +0 -15
- package/lib/inputs2/date/datefield/index.d.ts +0 -10
- package/lib/inputs2/date/datefield/index.js +0 -336
- package/lib/inputs2/date/datefield/triggers.d.ts +0 -8
- package/lib/inputs2/date/datefield/triggers.js +0 -47
- package/lib/inputs2/date/datefield/types.d.ts +0 -63
- package/lib/inputs2/date/datefield/types.js +0 -5
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +0 -7
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +0 -136
- package/lib/inputs2/date/dateperiodfield/context.d.ts +0 -14
- package/lib/inputs2/date/dateperiodfield/context.js +0 -17
- package/lib/inputs2/date/dateperiodfield/index.d.ts +0 -10
- package/lib/inputs2/date/dateperiodfield/index.js +0 -593
- package/lib/inputs2/date/dateperiodfield/triggers.d.ts +0 -6
- package/lib/inputs2/date/dateperiodfield/triggers.js +0 -120
- package/lib/inputs2/date/dateperiodfield/types.d.ts +0 -101
- package/lib/inputs2/date/dateperiodfield/types.js +0 -19
- package/lib/inputs2/date/helpers.d.ts +0 -21
- package/lib/inputs2/date/helpers.js +0 -62
- package/lib/inputs2/date/types.d.ts +0 -60
- package/lib/inputs2/date/types.js +0 -19
- package/lib/inputs2/index.d.ts +0 -32
- package/lib/inputs2/index.js +0 -34
- package/lib/inputs2/mask/BaseMask.d.ts +0 -10
- package/lib/inputs2/mask/BaseMask.js +0 -95
- package/lib/inputs2/mask/Cnpj.d.ts +0 -11
- package/lib/inputs2/mask/Cnpj.js +0 -57
- package/lib/inputs2/mask/Cpf.d.ts +0 -11
- package/lib/inputs2/mask/Cpf.js +0 -53
- package/lib/inputs2/mask/Phone.d.ts +0 -11
- package/lib/inputs2/mask/Phone.js +0 -26
- package/lib/inputs2/mask/ZipCode.d.ts +0 -11
- package/lib/inputs2/mask/ZipCode.js +0 -23
- package/lib/inputs2/mask/helpers.d.ts +0 -4
- package/lib/inputs2/mask/helpers.js +0 -57
- package/lib/inputs2/numberfield/currency.d.ts +0 -13
- package/lib/inputs2/numberfield/currency.js +0 -91
- package/lib/inputs2/numberfield/decimal.d.ts +0 -13
- package/lib/inputs2/numberfield/decimal.js +0 -85
- package/lib/inputs2/numberfield/helpers.d.ts +0 -30
- package/lib/inputs2/numberfield/helpers.js +0 -53
- package/lib/inputs2/numberfield/index.d.ts +0 -12
- package/lib/inputs2/numberfield/index.js +0 -104
- package/lib/inputs2/numberfield/types.d.ts +0 -36
- package/lib/inputs2/numberfield/types.js +0 -5
- package/lib/inputs2/radiofield/index.d.ts +0 -9
- package/lib/inputs2/radiofield/index.js +0 -143
- package/lib/inputs2/radiofield/types.d.ts +0 -33
- package/lib/inputs2/radiofield/types.js +0 -5
- package/lib/inputs2/selectfield/context.d.ts +0 -38
- package/lib/inputs2/selectfield/context.js +0 -15
- package/lib/inputs2/selectfield/helpers.d.ts +0 -6
- package/lib/inputs2/selectfield/helpers.js +0 -25
- package/lib/inputs2/selectfield/index.d.ts +0 -10
- package/lib/inputs2/selectfield/index.js +0 -491
- package/lib/inputs2/selectfield/item.d.ts +0 -11
- package/lib/inputs2/selectfield/item.js +0 -85
- package/lib/inputs2/selectfield/listbox.d.ts +0 -7
- package/lib/inputs2/selectfield/listbox.js +0 -103
- package/lib/inputs2/selectfield/search.d.ts +0 -7
- package/lib/inputs2/selectfield/search.js +0 -71
- package/lib/inputs2/selectfield/selections.d.ts +0 -10
- package/lib/inputs2/selectfield/selections.js +0 -86
- package/lib/inputs2/selectfield/triggers.d.ts +0 -8
- package/lib/inputs2/selectfield/triggers.js +0 -100
- package/lib/inputs2/selectfield/types.d.ts +0 -54
- package/lib/inputs2/selectfield/types.js +0 -21
- package/lib/inputs2/slot/index.d.ts +0 -14
- package/lib/inputs2/slot/index.js +0 -47
- package/lib/inputs2/textfield/index.d.ts +0 -8
- package/lib/inputs2/textfield/index.js +0 -159
- package/lib/tooltip/TooltipContent.d.ts +0 -7
- package/lib/tooltip/TooltipContent.js +0 -65
- package/lib/tooltip/useTooltip.d.ts +0 -30
- package/lib/tooltip/useTooltip.js +0 -128
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Triggers = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
9
|
-
var _buttons = _interopRequireDefault(require("../../../buttons"));
|
|
10
|
-
var BaseDate = _interopRequireWildcard(require("../base"));
|
|
11
|
-
var _list = _interopRequireWildcard(require("../../../list"));
|
|
12
|
-
var _context = require("./context");
|
|
13
|
-
var _helpers = require("../helpers");
|
|
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 _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
const Triggers = () => {
|
|
18
|
-
const {
|
|
19
|
-
initialInputId,
|
|
20
|
-
initialInputRef,
|
|
21
|
-
finalInputRef,
|
|
22
|
-
isReadOnly,
|
|
23
|
-
isDisabled,
|
|
24
|
-
selectedDate,
|
|
25
|
-
calendarBoxOpen,
|
|
26
|
-
showCalendarButton,
|
|
27
|
-
skeletonize,
|
|
28
|
-
showPredefinedPeriodsButton,
|
|
29
|
-
showClearDateButton,
|
|
30
|
-
hasValidPeriodSelected,
|
|
31
|
-
handleChangeCalendarBoxState,
|
|
32
|
-
handleChangeActiveDescendant,
|
|
33
|
-
handleChangeCalendarDisplayDate,
|
|
34
|
-
handleOnClickClearSelectedPeriod,
|
|
35
|
-
handleChangeUpdateDateStateWithPredefinedPeriod
|
|
36
|
-
} = (0, _context.useDatePeriodFieldContext)();
|
|
37
|
-
const shouldHavePermitClickOnTrigger = !isReadOnly && !isDisabled;
|
|
38
|
-
const handleOnClickTriggerSelectPredefinedPeriods = (event, periodSelected) => {
|
|
39
|
-
if (!shouldHavePermitClickOnTrigger) event?.preventDefault?.();else {
|
|
40
|
-
if (periodSelected) handleChangeUpdateDateStateWithPredefinedPeriod(periodSelected);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const handleOnClickTriggerCalendar = event => {
|
|
44
|
-
if (!shouldHavePermitClickOnTrigger) event.preventDefault();else {
|
|
45
|
-
handleChangeCalendarBoxState(!calendarBoxOpen);
|
|
46
|
-
if (!calendarBoxOpen) {
|
|
47
|
-
switch (document.activeElement?.id) {
|
|
48
|
-
case initialInputRef.current?.id:
|
|
49
|
-
{
|
|
50
|
-
handleChangeActiveDescendant((selectedDate.inicial ?? (0, _moment.default)()).format(_helpers.TOKEN_ISO_FORMAT));
|
|
51
|
-
handleChangeCalendarDisplayDate(selectedDate.inicial ?? (0, _moment.default)());
|
|
52
|
-
initialInputRef.current?.focus();
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
case finalInputRef.current?.id:
|
|
56
|
-
{
|
|
57
|
-
handleChangeActiveDescendant((selectedDate.final ?? (0, _moment.default)()).format(_helpers.TOKEN_ISO_FORMAT));
|
|
58
|
-
handleChangeCalendarDisplayDate(selectedDate.final ?? (0, _moment.default)());
|
|
59
|
-
finalInputRef.current?.focus();
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
default:
|
|
63
|
-
initialInputRef.current?.focus();
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
return /*#__PURE__*/_react.default.createElement(BaseDate.Triggers, {
|
|
70
|
-
clearButtonTestId: "test-date-period-field-trigger-clean-selected-period",
|
|
71
|
-
calendarButtonTestId: "test-date-period-field-trigger-open-calendar",
|
|
72
|
-
isDisabled: isDisabled,
|
|
73
|
-
isReadOnly: isReadOnly,
|
|
74
|
-
skeletonize: skeletonize,
|
|
75
|
-
inputFieldId: initialInputId,
|
|
76
|
-
calendarBoxOpen: calendarBoxOpen,
|
|
77
|
-
showClearButton: showClearDateButton,
|
|
78
|
-
showCalendarButton: showCalendarButton,
|
|
79
|
-
hasValidDateSelection: false,
|
|
80
|
-
hasValidPeriodSelected: hasValidPeriodSelected,
|
|
81
|
-
onClearSelectedDate: handleOnClickClearSelectedPeriod,
|
|
82
|
-
onClickTriggerCalendar: handleOnClickTriggerCalendar
|
|
83
|
-
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
84
|
-
"data-testid": "test-date-period-field-trigger-select-predefined-periods",
|
|
85
|
-
className: "select-predefined-periods",
|
|
86
|
-
dropdown: true,
|
|
87
|
-
transparent: true,
|
|
88
|
-
boxShadow: false,
|
|
89
|
-
showIconDropdown: false,
|
|
90
|
-
visible: showPredefinedPeriodsButton,
|
|
91
|
-
type: "button",
|
|
92
|
-
title: "Selecionar Periodos Pr\xE9 Definidos",
|
|
93
|
-
tabIndex: -1,
|
|
94
|
-
disabled: isDisabled,
|
|
95
|
-
"aria-label": "Selecionar Periodos Pr\xE9 Definidos",
|
|
96
|
-
"aria-controls": initialInputId,
|
|
97
|
-
"aria-readonly": isReadOnly,
|
|
98
|
-
"data-state-read-only": isReadOnly,
|
|
99
|
-
"data-state-visible": showPredefinedPeriodsButton,
|
|
100
|
-
iconName: "more1",
|
|
101
|
-
dropdownAlign: "right",
|
|
102
|
-
onMouseDown: event => {
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
}
|
|
105
|
-
}, /*#__PURE__*/_react.default.createElement(_list.default, {
|
|
106
|
-
condensed: true
|
|
107
|
-
}, _helpers.PERIOD_OPTIONS_LIST.map(period => /*#__PURE__*/_react.default.createElement(_list.ListItem, {
|
|
108
|
-
key: period.id,
|
|
109
|
-
itemId: period.id,
|
|
110
|
-
text: period.label,
|
|
111
|
-
onMouseDown: event => {
|
|
112
|
-
event?.preventDefault?.();
|
|
113
|
-
},
|
|
114
|
-
onClick: event => {
|
|
115
|
-
handleOnClickTriggerSelectPredefinedPeriods(event, period.id);
|
|
116
|
-
}
|
|
117
|
-
})))));
|
|
118
|
-
};
|
|
119
|
-
exports.Triggers = Triggers;
|
|
120
|
-
Triggers.displayName = 'DatePeriodFieldTriggers';
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { Moment } from 'moment';
|
|
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
|
-
import { DateValueReturnType } from '../types.js';
|
|
9
|
-
|
|
10
|
-
type DatePeriodTypes = 'today' | 'week' | 'lastweek' | 'last15' | 'month' | 'lastmonth';
|
|
11
|
-
type PeriodOptions = {
|
|
12
|
-
id: DatePeriodTypes;
|
|
13
|
-
label?: string;
|
|
14
|
-
};
|
|
15
|
-
type InputType = 'initial' | 'final';
|
|
16
|
-
type SelectedDateType = {
|
|
17
|
-
inicial: Moment | null;
|
|
18
|
-
final: Moment | null;
|
|
19
|
-
};
|
|
20
|
-
type UpdateDateStateParams = {
|
|
21
|
-
date: Moment;
|
|
22
|
-
inputType: InputType;
|
|
23
|
-
typing?: boolean;
|
|
24
|
-
};
|
|
25
|
-
type InputHTMLProps = Omit<React__default.ComponentPropsWithoutRef<'input'>, 'type' | 'multiple' | 'value'>;
|
|
26
|
-
interface DatePeriodFieldProps extends InputHTMLProps, ITooltipCommonProps {
|
|
27
|
-
value?: any;
|
|
28
|
-
initialName?: string;
|
|
29
|
-
initialRef?: React__default.MutableRefObject<HTMLInputElement | null>;
|
|
30
|
-
finalName?: string;
|
|
31
|
-
finalRef?: React__default.MutableRefObject<HTMLInputElement | null>;
|
|
32
|
-
hint?: string;
|
|
33
|
-
label?: string;
|
|
34
|
-
errors?: string[];
|
|
35
|
-
gridLayout?: string;
|
|
36
|
-
customClass?: string;
|
|
37
|
-
customClassLabel?: string;
|
|
38
|
-
customClassWrapper?: string;
|
|
39
|
-
customClassInputContainer?: string;
|
|
40
|
-
required?: boolean;
|
|
41
|
-
disabled?: boolean;
|
|
42
|
-
readOnly?: boolean;
|
|
43
|
-
undigitable?: boolean;
|
|
44
|
-
skeletonize?: boolean;
|
|
45
|
-
labelUppercase?: boolean;
|
|
46
|
-
showCalendarButton?: boolean;
|
|
47
|
-
openCalendarOnFocus?: boolean;
|
|
48
|
-
shouldCloseOnSelect?: boolean;
|
|
49
|
-
showClearDateButton?: boolean;
|
|
50
|
-
showPredefinedPeriodsButton?: boolean;
|
|
51
|
-
returnValueType?: DateValueReturnType;
|
|
52
|
-
textAlign?: TextAlign;
|
|
53
|
-
hintPosition?: HintPosition;
|
|
54
|
-
themePopover?: ColorTheme;
|
|
55
|
-
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
56
|
-
permissionAttr?: PermissionAttr;
|
|
57
|
-
onDeniedActions?: OnDenied;
|
|
58
|
-
}
|
|
59
|
-
interface DatePeriodContextProps {
|
|
60
|
-
initialInputId: string;
|
|
61
|
-
finalInputId: string;
|
|
62
|
-
activeDescendant: string;
|
|
63
|
-
isReadOnly: boolean;
|
|
64
|
-
isDisabled: boolean;
|
|
65
|
-
undigitable: boolean;
|
|
66
|
-
skeletonize: boolean;
|
|
67
|
-
calendarBoxOpen: boolean;
|
|
68
|
-
showCalendarButton: boolean;
|
|
69
|
-
openCalendarOnFocus: boolean;
|
|
70
|
-
hasValidationErrors: boolean;
|
|
71
|
-
showClearDateButton: boolean;
|
|
72
|
-
hasValidPeriodSelected: boolean;
|
|
73
|
-
showPredefinedPeriodsButton: boolean;
|
|
74
|
-
selectedDate: SelectedDateType;
|
|
75
|
-
calendarDisplayDate: Moment;
|
|
76
|
-
initialInputRef: React__default.RefObject<HTMLInputElement | null>;
|
|
77
|
-
finalInputRef: React__default.RefObject<HTMLInputElement | null>;
|
|
78
|
-
dateContainerRef: React__default.RefObject<HTMLDivElement | null>;
|
|
79
|
-
handleChangeUpdateDateState: (params: UpdateDateStateParams) => void;
|
|
80
|
-
handleChangeNextMonth: () => void;
|
|
81
|
-
handleChangePreviousMonth: () => void;
|
|
82
|
-
handleChangeCalendarBoxState: (value: boolean) => void;
|
|
83
|
-
handleChangeActiveDescendant: (value: string) => void;
|
|
84
|
-
handleChangeCalendarDisplayDate: (value: Moment) => void;
|
|
85
|
-
handleOnClickClearSelectedPeriod: () => void;
|
|
86
|
-
handleChangeUpdateDateStateWithPredefinedPeriod: (period: DatePeriodTypes) => void;
|
|
87
|
-
}
|
|
88
|
-
declare enum Keys {
|
|
89
|
-
arrowLeft = "ArrowLeft",
|
|
90
|
-
arrowRight = "ArrowRight",
|
|
91
|
-
arrowUp = "ArrowUp",
|
|
92
|
-
arrowDown = "ArrowDown",
|
|
93
|
-
pageUp = "PageUp",
|
|
94
|
-
pageDown = "PageDown",
|
|
95
|
-
home = "Home",
|
|
96
|
-
end = "End",
|
|
97
|
-
escape = "Escape",
|
|
98
|
-
enter = "Enter"
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { DatePeriodContextProps, DatePeriodFieldProps, DatePeriodTypes, InputType, Keys, PeriodOptions, SelectedDateType, UpdateDateStateParams };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Keys = void 0;
|
|
7
|
-
let Keys = exports.Keys = /*#__PURE__*/function (Keys) {
|
|
8
|
-
Keys["arrowLeft"] = "ArrowLeft";
|
|
9
|
-
Keys["arrowRight"] = "ArrowRight";
|
|
10
|
-
Keys["arrowUp"] = "ArrowUp";
|
|
11
|
-
Keys["arrowDown"] = "ArrowDown";
|
|
12
|
-
Keys["pageUp"] = "PageUp";
|
|
13
|
-
Keys["pageDown"] = "PageDown";
|
|
14
|
-
Keys["home"] = "Home";
|
|
15
|
-
Keys["end"] = "End";
|
|
16
|
-
Keys["escape"] = "Escape";
|
|
17
|
-
Keys["enter"] = "Enter";
|
|
18
|
-
return Keys;
|
|
19
|
-
}({});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as lodash from 'lodash';
|
|
2
|
-
import { Moment } from 'moment';
|
|
3
|
-
import { PeriodOptions } from './dateperiodfield/types.js';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '../../@types/Align.js';
|
|
6
|
-
import '../../@types/ColorStyles.js';
|
|
7
|
-
import '../../tooltip/types.js';
|
|
8
|
-
import '../../@types/Position.js';
|
|
9
|
-
import '../../@types/PermissionAttr.js';
|
|
10
|
-
import './types.js';
|
|
11
|
-
|
|
12
|
-
declare const TOKEN_MASK = "00/00/0000";
|
|
13
|
-
declare const TOKEN_ISO_FORMAT = "YYYY-MM-DD";
|
|
14
|
-
declare const TOKEN_PTBR_FORMAT = "DD/MM/YYYY";
|
|
15
|
-
declare const options: string[];
|
|
16
|
-
declare const NAVIGATION_KEYS: string[];
|
|
17
|
-
declare const PERIOD_OPTIONS_LIST: PeriodOptions[];
|
|
18
|
-
declare const isWithinBounds: (date: Moment, minDate?: string, maxDate?: string) => boolean;
|
|
19
|
-
declare const generateCalendarWeeks: ((monthSelected: Moment) => Moment[][]) & lodash.MemoizedFunction;
|
|
20
|
-
|
|
21
|
-
export { NAVIGATION_KEYS, PERIOD_OPTIONS_LIST, TOKEN_ISO_FORMAT, TOKEN_MASK, TOKEN_PTBR_FORMAT, generateCalendarWeeks, isWithinBounds, options };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.options = exports.isWithinBounds = exports.generateCalendarWeeks = exports.TOKEN_PTBR_FORMAT = exports.TOKEN_MASK = exports.TOKEN_ISO_FORMAT = exports.PERIOD_OPTIONS_LIST = exports.NAVIGATION_KEYS = void 0;
|
|
7
|
-
var _moment = _interopRequireDefault(require("moment"));
|
|
8
|
-
var _memoize = _interopRequireDefault(require("lodash/memoize"));
|
|
9
|
-
var _permissionValidations = require("../../permissionValidations");
|
|
10
|
-
var _types = require("./types");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const TOKEN_MASK = exports.TOKEN_MASK = '00/00/0000';
|
|
13
|
-
const TOKEN_ISO_FORMAT = exports.TOKEN_ISO_FORMAT = 'YYYY-MM-DD';
|
|
14
|
-
const TOKEN_PTBR_FORMAT = exports.TOKEN_PTBR_FORMAT = 'DD/MM/YYYY';
|
|
15
|
-
const options = exports.options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
16
|
-
const NAVIGATION_KEYS = exports.NAVIGATION_KEYS = [_types.Keys.arrowLeft, _types.Keys.arrowRight, _types.Keys.arrowUp, _types.Keys.arrowDown, _types.Keys.pageUp, _types.Keys.pageDown, _types.Keys.home, _types.Keys.end, _types.Keys.escape, _types.Keys.enter];
|
|
17
|
-
const PERIOD_OPTIONS_LIST = exports.PERIOD_OPTIONS_LIST = [{
|
|
18
|
-
id: 'today',
|
|
19
|
-
label: 'Hoje'
|
|
20
|
-
}, {
|
|
21
|
-
id: 'week',
|
|
22
|
-
label: 'Semana Atual'
|
|
23
|
-
}, {
|
|
24
|
-
id: 'lastweek',
|
|
25
|
-
label: 'Última Semana'
|
|
26
|
-
}, {
|
|
27
|
-
id: 'last15',
|
|
28
|
-
label: 'Últimos 15 dias'
|
|
29
|
-
}, {
|
|
30
|
-
id: 'month',
|
|
31
|
-
label: 'Mês atual'
|
|
32
|
-
}, {
|
|
33
|
-
id: 'lastmonth',
|
|
34
|
-
label: 'Último Mês'
|
|
35
|
-
}];
|
|
36
|
-
const isWithinBounds = (date, minDate, maxDate) => {
|
|
37
|
-
if (minDate) {
|
|
38
|
-
const min = (0, _moment.default)(minDate, TOKEN_ISO_FORMAT);
|
|
39
|
-
if (date.isBefore(min, 'day')) return false;
|
|
40
|
-
}
|
|
41
|
-
if (maxDate) {
|
|
42
|
-
const max = (0, _moment.default)(maxDate, TOKEN_ISO_FORMAT);
|
|
43
|
-
if (date.isAfter(max, 'day')) return false;
|
|
44
|
-
}
|
|
45
|
-
return true;
|
|
46
|
-
};
|
|
47
|
-
exports.isWithinBounds = isWithinBounds;
|
|
48
|
-
const generateCalendarWeeks = exports.generateCalendarWeeks = (0, _memoize.default)(monthSelected => {
|
|
49
|
-
const startOfCalendar = monthSelected.clone().startOf('month').startOf('week');
|
|
50
|
-
const endOfCalendar = monthSelected.clone().endOf('month').endOf('week');
|
|
51
|
-
const weeks = [];
|
|
52
|
-
let currentWeek = startOfCalendar.clone();
|
|
53
|
-
while (currentWeek.isSameOrBefore(endOfCalendar, 'day')) {
|
|
54
|
-
const week = [];
|
|
55
|
-
for (let days = 0; days < 7; days++) {
|
|
56
|
-
week.push(currentWeek.clone());
|
|
57
|
-
currentWeek.add(1, 'day');
|
|
58
|
-
}
|
|
59
|
-
weeks.push(week);
|
|
60
|
-
}
|
|
61
|
-
return weeks;
|
|
62
|
-
}, monthSelected => monthSelected.format('YYYY-MM'));
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ColorTheme } from '../../@types/ColorStyles.js';
|
|
2
|
-
import { HintPosition, Position } from '../../@types/Position.js';
|
|
3
|
-
|
|
4
|
-
type DateValueReturnType = 'default' | 'iso';
|
|
5
|
-
declare enum Keys {
|
|
6
|
-
arrowLeft = "ArrowLeft",
|
|
7
|
-
arrowRight = "ArrowRight",
|
|
8
|
-
arrowUp = "ArrowUp",
|
|
9
|
-
arrowDown = "ArrowDown",
|
|
10
|
-
pageUp = "PageUp",
|
|
11
|
-
pageDown = "PageDown",
|
|
12
|
-
home = "Home",
|
|
13
|
-
end = "End",
|
|
14
|
-
escape = "Escape",
|
|
15
|
-
enter = "Enter"
|
|
16
|
-
}
|
|
17
|
-
interface BaseDateInputRootProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
18
|
-
customClassWrapper?: string;
|
|
19
|
-
hasValidationErrors?: boolean;
|
|
20
|
-
}
|
|
21
|
-
interface BaseDateInputLabelProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
22
|
-
hint?: string;
|
|
23
|
-
customClassLabel?: string;
|
|
24
|
-
skeletonize?: boolean;
|
|
25
|
-
label?: string;
|
|
26
|
-
inputId?: string;
|
|
27
|
-
isDisabled?: boolean;
|
|
28
|
-
isReadOnly?: boolean;
|
|
29
|
-
required?: boolean;
|
|
30
|
-
labelUppercase?: boolean;
|
|
31
|
-
hasHintMessages?: boolean;
|
|
32
|
-
hintPosition?: HintPosition;
|
|
33
|
-
themePopover?: ColorTheme;
|
|
34
|
-
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
35
|
-
}
|
|
36
|
-
interface BaseDateInputContainerProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
37
|
-
skeletonize?: boolean;
|
|
38
|
-
customClassInputContainer?: string;
|
|
39
|
-
}
|
|
40
|
-
type InputHTMLProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'multiple'>;
|
|
41
|
-
interface BaseDateInputProps extends InputHTMLProps {
|
|
42
|
-
customClass?: string;
|
|
43
|
-
}
|
|
44
|
-
interface BaseDateInputTriggersProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
45
|
-
isDisabled?: boolean;
|
|
46
|
-
isReadOnly?: boolean;
|
|
47
|
-
skeletonize?: boolean;
|
|
48
|
-
inputFieldId?: string;
|
|
49
|
-
calendarBoxOpen?: boolean;
|
|
50
|
-
showClearButton?: boolean;
|
|
51
|
-
showCalendarButton?: boolean;
|
|
52
|
-
hasValidDateSelection?: boolean;
|
|
53
|
-
hasValidPeriodSelected?: boolean;
|
|
54
|
-
clearButtonTestId?: string;
|
|
55
|
-
calendarButtonTestId?: string;
|
|
56
|
-
onClearSelectedDate: () => void;
|
|
57
|
-
onClickTriggerCalendar: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export { BaseDateInputContainerProps, BaseDateInputLabelProps, BaseDateInputProps, BaseDateInputRootProps, BaseDateInputTriggersProps, DateValueReturnType, Keys };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Keys = void 0;
|
|
7
|
-
let Keys = exports.Keys = /*#__PURE__*/function (Keys) {
|
|
8
|
-
Keys["arrowLeft"] = "ArrowLeft";
|
|
9
|
-
Keys["arrowRight"] = "ArrowRight";
|
|
10
|
-
Keys["arrowUp"] = "ArrowUp";
|
|
11
|
-
Keys["arrowDown"] = "ArrowDown";
|
|
12
|
-
Keys["pageUp"] = "PageUp";
|
|
13
|
-
Keys["pageDown"] = "PageDown";
|
|
14
|
-
Keys["home"] = "Home";
|
|
15
|
-
Keys["end"] = "End";
|
|
16
|
-
Keys["escape"] = "Escape";
|
|
17
|
-
Keys["enter"] = "Enter";
|
|
18
|
-
return Keys;
|
|
19
|
-
}({});
|
package/lib/inputs2/index.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export { i as TextField } from '../index-3b70931d.js';
|
|
2
|
-
export { i as NumberField } from '../index-ecafc8c6.js';
|
|
3
|
-
export { i as DateField } from '../index-368f781f.js';
|
|
4
|
-
export { i as RadioField } from '../index-7ad68789.js';
|
|
5
|
-
export { i as SelectField } from '../index-c512803d.js';
|
|
6
|
-
export { i as ColorField } from '../index-9e576346.js';
|
|
7
|
-
export { B as MaskField } from '../BaseMask-0c14ef51.js';
|
|
8
|
-
export { C as CpfField } from '../Cpf-3fa496ad.js';
|
|
9
|
-
export { C as CnpjField } from '../Cnpj-bde01dd0.js';
|
|
10
|
-
export { P as PhoneField } from '../Phone-2bb0b397.js';
|
|
11
|
-
export { Z as ZipCodeField } from '../ZipCode-09460e18.js';
|
|
12
|
-
export { i as CheckboxField } from '../index-789dd9a5.js';
|
|
13
|
-
export { i as DatePeriodField } from '../index-c9247c1f.js';
|
|
14
|
-
import 'react';
|
|
15
|
-
import '../@types/Align.js';
|
|
16
|
-
import '../@types/ColorStyles.js';
|
|
17
|
-
import '../@types/Position.js';
|
|
18
|
-
import '../@types/PermissionAttr.js';
|
|
19
|
-
import './slot/index.js';
|
|
20
|
-
import '../tooltip/types.js';
|
|
21
|
-
import './numberfield/decimal.js';
|
|
22
|
-
import './numberfield/types.js';
|
|
23
|
-
import './numberfield/currency.js';
|
|
24
|
-
import './date/datefield/types.js';
|
|
25
|
-
import 'moment';
|
|
26
|
-
import './date/types.js';
|
|
27
|
-
import './radiofield/types.js';
|
|
28
|
-
import '../@types/Size.js';
|
|
29
|
-
import './selectfield/item.js';
|
|
30
|
-
import './selectfield/types.js';
|
|
31
|
-
import 'imask';
|
|
32
|
-
import './date/dateperiodfield/types.js';
|
package/lib/inputs2/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ZipCodeField = exports.TextField = exports.SelectField = exports.RadioField = exports.PhoneField = exports.NumberField = exports.MaskField = exports.DatePeriodField = exports.DateField = exports.CpfField = exports.ColorField = exports.CnpjField = exports.CheckboxField = void 0;
|
|
7
|
-
var TextField = _interopRequireWildcard(require("./textfield"));
|
|
8
|
-
exports.TextField = TextField;
|
|
9
|
-
var NumberField = _interopRequireWildcard(require("./numberfield"));
|
|
10
|
-
exports.NumberField = NumberField;
|
|
11
|
-
var DateField = _interopRequireWildcard(require("./date/datefield"));
|
|
12
|
-
exports.DateField = DateField;
|
|
13
|
-
var RadioField = _interopRequireWildcard(require("./radiofield"));
|
|
14
|
-
exports.RadioField = RadioField;
|
|
15
|
-
var SelectField = _interopRequireWildcard(require("./selectfield"));
|
|
16
|
-
exports.SelectField = SelectField;
|
|
17
|
-
var ColorField = _interopRequireWildcard(require("./colorfield"));
|
|
18
|
-
exports.ColorField = ColorField;
|
|
19
|
-
var MaskField = _interopRequireWildcard(require("./mask/BaseMask"));
|
|
20
|
-
exports.MaskField = MaskField;
|
|
21
|
-
var CpfField = _interopRequireWildcard(require("./mask/Cpf"));
|
|
22
|
-
exports.CpfField = CpfField;
|
|
23
|
-
var CnpjField = _interopRequireWildcard(require("./mask/Cnpj"));
|
|
24
|
-
exports.CnpjField = CnpjField;
|
|
25
|
-
var PhoneField = _interopRequireWildcard(require("./mask/Phone"));
|
|
26
|
-
exports.PhoneField = PhoneField;
|
|
27
|
-
var ZipCodeField = _interopRequireWildcard(require("./mask/ZipCode"));
|
|
28
|
-
exports.ZipCodeField = ZipCodeField;
|
|
29
|
-
var CheckboxField = _interopRequireWildcard(require("./checkboxfield"));
|
|
30
|
-
exports.CheckboxField = CheckboxField;
|
|
31
|
-
var DatePeriodField = _interopRequireWildcard(require("./date/dateperiodfield"));
|
|
32
|
-
exports.DatePeriodField = DatePeriodField;
|
|
33
|
-
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); }
|
|
34
|
-
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; }
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
import '../../index-3b70931d.js';
|
|
3
|
-
import 'imask';
|
|
4
|
-
export { I as Input, M as MaskFieldProps } from '../../BaseMask-0c14ef51.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';
|
|
@@ -1,95 +0,0 @@
|
|
|
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
|
-
const _excluded = ["maskOptions", "autoCompleteMask", "name", "value", "onComplete", "onChange", "onBlur", "onAccept"];
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
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); }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
18
|
-
const {
|
|
19
|
-
maskOptions = {
|
|
20
|
-
mask: '',
|
|
21
|
-
lazy: false,
|
|
22
|
-
placeholderChar: '_'
|
|
23
|
-
},
|
|
24
|
-
autoCompleteMask = '',
|
|
25
|
-
name,
|
|
26
|
-
value: valueFromProps,
|
|
27
|
-
onComplete,
|
|
28
|
-
onChange,
|
|
29
|
-
onBlur,
|
|
30
|
-
onAccept
|
|
31
|
-
} = props,
|
|
32
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
33
|
-
const inputRef = (0, _react.useRef)(null);
|
|
34
|
-
const {
|
|
35
|
-
value,
|
|
36
|
-
unmaskedValue,
|
|
37
|
-
setValue: setMaskValue,
|
|
38
|
-
maskRef: refMask
|
|
39
|
-
} = (0, _reactImask.useIMask)(maskOptions, {
|
|
40
|
-
ref: inputRef,
|
|
41
|
-
onComplete: (__, maskRef) => {
|
|
42
|
-
onComplete?.(maskRef.value, maskRef);
|
|
43
|
-
},
|
|
44
|
-
onAccept: (__, maskRef) => {
|
|
45
|
-
const syntheticEvent = {
|
|
46
|
-
target: {
|
|
47
|
-
name,
|
|
48
|
-
value: maskRef.unmaskedValue
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
onChange?.(syntheticEvent);
|
|
52
|
-
onAccept?.(maskRef.value);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
_react.default.useEffect(() => {
|
|
56
|
-
const currentValue = valueFromProps ?? '';
|
|
57
|
-
if (currentValue === '') {
|
|
58
|
-
if (refMask.current) {
|
|
59
|
-
refMask.current.value = '';
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
setMaskValue(currentValue);
|
|
63
|
-
}
|
|
64
|
-
}, [valueFromProps]);
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(_textfield.Input, _extends({}, rest, {
|
|
66
|
-
type: "text",
|
|
67
|
-
name: name,
|
|
68
|
-
value: value,
|
|
69
|
-
onBlur: e => {
|
|
70
|
-
if (unmaskedValue.trim().length && autoCompleteMask) {
|
|
71
|
-
const currentValue = unmaskedValue;
|
|
72
|
-
const sizeMask = maskOptions?.mask?.toString().replace(/\D+/g, '').length;
|
|
73
|
-
if (sizeMask && sizeMask > currentValue.length) {
|
|
74
|
-
switch (autoCompleteMask) {
|
|
75
|
-
case 'left':
|
|
76
|
-
setMaskValue(currentValue.padStart(sizeMask, '0'));
|
|
77
|
-
break;
|
|
78
|
-
case 'right':
|
|
79
|
-
setMaskValue(currentValue.padEnd(sizeMask, '0'));
|
|
80
|
-
break;
|
|
81
|
-
default:
|
|
82
|
-
setMaskValue(currentValue);
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (onBlur) onBlur(e);
|
|
88
|
-
},
|
|
89
|
-
onChange: e => {
|
|
90
|
-
if (onChange) onChange(e);
|
|
91
|
-
},
|
|
92
|
-
ref: (0, _helpers.mergeRefs)(ref, inputRef)
|
|
93
|
-
}));
|
|
94
|
-
});
|
|
95
|
-
Input.displayName = 'MaskInputField';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
import '../../BaseMask-0c14ef51.js';
|
|
3
|
-
export { a as CnpjFieldProps, I as Input } from '../../Cnpj-bde01dd0.js';
|
|
4
|
-
import '../../index-3b70931d.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';
|
package/lib/inputs2/mask/Cnpj.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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("../../../lib/form2/helpers");
|
|
9
|
-
var _helpers2 = require("./helpers");
|
|
10
|
-
var _BaseMask = require("./BaseMask");
|
|
11
|
-
const _excluded = ["name", "onValidate", "onChange", "onBlur", "errors"];
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
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); }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
const CNPJ_INVALID_MESSAGE = 'CNPJ inválido';
|
|
18
|
-
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
19
|
-
const {
|
|
20
|
-
name,
|
|
21
|
-
onValidate,
|
|
22
|
-
onChange,
|
|
23
|
-
onBlur,
|
|
24
|
-
errors: externalErrors = []
|
|
25
|
-
} = props,
|
|
26
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
27
|
-
const inputRef = (0, _react.useRef)(null);
|
|
28
|
-
const validateCnpj = raw => {
|
|
29
|
-
const hasCnpjError = externalErrors.includes(CNPJ_INVALID_MESSAGE);
|
|
30
|
-
const isValid = (0, _helpers2.CNPJValidation)(raw);
|
|
31
|
-
if (!isValid && hasCnpjError) {
|
|
32
|
-
onValidate?.([CNPJ_INVALID_MESSAGE]);
|
|
33
|
-
}
|
|
34
|
-
if (isValid && !hasCnpjError) {
|
|
35
|
-
onValidate?.([]);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const handleChange = e => {
|
|
39
|
-
const rawValue = e.target.value.replace(/\D/g, '');
|
|
40
|
-
validateCnpj(rawValue);
|
|
41
|
-
onChange?.(e);
|
|
42
|
-
};
|
|
43
|
-
return /*#__PURE__*/_react.default.createElement(_BaseMask.Input, _extends({}, rest, {
|
|
44
|
-
type: "text",
|
|
45
|
-
name: name,
|
|
46
|
-
errors: externalErrors,
|
|
47
|
-
maskOptions: {
|
|
48
|
-
mask: '00.000.000/0000-00',
|
|
49
|
-
placeholderChar: '_',
|
|
50
|
-
lazy: false
|
|
51
|
-
},
|
|
52
|
-
onBlur: onBlur,
|
|
53
|
-
onChange: handleChange,
|
|
54
|
-
ref: (0, _helpers.mergeRefs)(ref, inputRef)
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
Input.displayName = 'CnpjInputField';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import 'react';
|
|
2
|
-
import '../../BaseMask-0c14ef51.js';
|
|
3
|
-
export { a as CpfFieldProps, I as Input } from '../../Cpf-3fa496ad.js';
|
|
4
|
-
import '../../index-3b70931d.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';
|