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
|
@@ -21,15 +21,15 @@ var _helpers2 = require("../helpers");
|
|
|
21
21
|
var _triggers = require("./triggers");
|
|
22
22
|
var _calendarbox = require("./calendarbox");
|
|
23
23
|
var _context = require("./context");
|
|
24
|
-
const _excluded = ["label", "errors", "initialName", "finalName", "onDeniedActions", "permissionAttr", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "labelUppercase", "undigitable", "skeletonize", "hintPosition", "gridLayout", "themePopover", "popoverAlign", "showCalendarButton", "textAlign", "openCalendarOnFocus", "shouldCloseOnSelect", "showPredefinedPeriodsButton", "showClearDateButton", "placeholder", "tooltip", "tooltipPosition", "tooltipWidth"];
|
|
24
|
+
const _excluded = ["label", "errors", "initialName", "finalName", "onDeniedActions", "permissionAttr", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "labelUppercase", "undigitable", "skeletonize", "hintPosition", "gridLayout", "themePopover", "popoverAlign", "showCalendarButton", "textAlign", "openCalendarOnFocus", "shouldCloseOnSelect", "showPredefinedPeriodsButton", "showClearDateButton", "placeholder", "returnValueType", "tooltip", "tooltipPosition", "tooltipWidth"];
|
|
25
25
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
26
|
-
function
|
|
27
|
-
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; }
|
|
26
|
+
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); }
|
|
28
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
29
28
|
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); }
|
|
30
29
|
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; }
|
|
31
30
|
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; }
|
|
32
31
|
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __) => {
|
|
32
|
+
var _selectedDate$inicial, _selectedDate$final, _props$hint;
|
|
33
33
|
const {
|
|
34
34
|
label,
|
|
35
35
|
errors,
|
|
@@ -55,6 +55,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
55
55
|
showPredefinedPeriodsButton = true,
|
|
56
56
|
showClearDateButton = true,
|
|
57
57
|
placeholder = _helpers2.TOKEN_PTBR_FORMAT,
|
|
58
|
+
returnValueType = 'default',
|
|
58
59
|
tooltip,
|
|
59
60
|
tooltipPosition,
|
|
60
61
|
tooltipWidth
|
|
@@ -91,7 +92,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
91
92
|
placeholderChar: '_'
|
|
92
93
|
}, {
|
|
93
94
|
ref: initialInputRef,
|
|
94
|
-
defaultValue: selectedDate.inicial
|
|
95
|
+
defaultValue: (_selectedDate$inicial = selectedDate.inicial) === null || _selectedDate$inicial === void 0 ? void 0 : _selectedDate$inicial.format(_helpers2.TOKEN_PTBR_FORMAT),
|
|
95
96
|
onComplete: value => {
|
|
96
97
|
const date = (0, _moment.default)(value, _helpers2.TOKEN_PTBR_FORMAT);
|
|
97
98
|
if (date.isValid()) {
|
|
@@ -113,7 +114,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
113
114
|
placeholderChar: '_'
|
|
114
115
|
}, {
|
|
115
116
|
ref: finalInputRef,
|
|
116
|
-
defaultValue: selectedDate.final
|
|
117
|
+
defaultValue: (_selectedDate$final = selectedDate.final) === null || _selectedDate$final === void 0 ? void 0 : _selectedDate$final.format(_helpers2.TOKEN_PTBR_FORMAT),
|
|
117
118
|
onComplete: value => {
|
|
118
119
|
const date = (0, _moment.default)(value, _helpers2.TOKEN_PTBR_FORMAT);
|
|
119
120
|
if (date.isValid()) {
|
|
@@ -125,11 +126,11 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
});
|
|
128
|
-
const hasLabel = !_lodash.default.isEmpty(props
|
|
129
|
+
const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
|
|
129
130
|
const isReadOnly = Boolean(props.readOnly || onDenied.readOnly);
|
|
130
131
|
const isDisabled = Boolean(props.disabled || onDenied.disabled);
|
|
131
|
-
const hasHintMessages = Boolean(props.hint
|
|
132
|
-
const hasValidationErrors = Boolean(errors
|
|
132
|
+
const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
|
|
133
|
+
const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
133
134
|
const handleChangeSelectedDate = _react.default.useCallback(object => setSelectedDate(object), []);
|
|
134
135
|
const handleChangeCalendarBoxState = _react.default.useCallback(value => setCalendarBoxOpen(value), []);
|
|
135
136
|
const handleChangeActiveDescendant = _react.default.useCallback(value => setActiveDescendant(value), []);
|
|
@@ -153,13 +154,14 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
153
154
|
});
|
|
154
155
|
}, []);
|
|
155
156
|
const verifyPeriodSelectedIsValid = _react.default.useCallback(() => {
|
|
156
|
-
const objectValue = props
|
|
157
|
+
const objectValue = props === null || props === void 0 ? void 0 : props.value;
|
|
157
158
|
const isValidInitialValue = !_lodash.default.isEmpty(objectValue[initialName]);
|
|
158
159
|
const isValidFinalValue = !_lodash.default.isEmpty(objectValue[finalName]);
|
|
159
160
|
return isValidInitialValue && isValidFinalValue;
|
|
160
|
-
}, [props
|
|
161
|
+
}, [props === null || props === void 0 ? void 0 : props.value, initialName, finalName]);
|
|
161
162
|
const handleOnClickClearSelectedPeriod = _react.default.useCallback(() => {
|
|
162
|
-
|
|
163
|
+
var _props$onChange;
|
|
164
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
163
165
|
target: {
|
|
164
166
|
name: props.name,
|
|
165
167
|
value: {
|
|
@@ -184,8 +186,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
184
186
|
} = params;
|
|
185
187
|
const rawDate = date.clone();
|
|
186
188
|
const verifyDateRangeOrder = (initialDate, finalDate) => {
|
|
187
|
-
const inicial = initialDate
|
|
188
|
-
const final = initialDate
|
|
189
|
+
const inicial = initialDate !== null && initialDate !== void 0 && initialDate.isAfter(finalDate) ? finalDate : initialDate;
|
|
190
|
+
const final = initialDate !== null && initialDate !== void 0 && initialDate.isAfter(finalDate) ? initialDate : finalDate;
|
|
189
191
|
return {
|
|
190
192
|
inicial,
|
|
191
193
|
final
|
|
@@ -194,6 +196,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
194
196
|
switch (inputType) {
|
|
195
197
|
case 'initial':
|
|
196
198
|
{
|
|
199
|
+
var _props$onChange2;
|
|
197
200
|
setSelectedDate(prevSelectedDate => {
|
|
198
201
|
const {
|
|
199
202
|
inicial,
|
|
@@ -209,22 +212,24 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
209
212
|
inicial,
|
|
210
213
|
final
|
|
211
214
|
} = verifyDateRangeOrder(rawDate, selectedDate.final);
|
|
212
|
-
props.onChange
|
|
215
|
+
(_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, {
|
|
213
216
|
target: {
|
|
214
217
|
name: props.name,
|
|
215
218
|
value: {
|
|
216
|
-
[initialName]: inicial
|
|
217
|
-
[finalName]: final
|
|
219
|
+
[initialName]: returnValueType === 'default' ? inicial === null || inicial === void 0 ? void 0 : inicial.format(_helpers2.TOKEN_ISO_FORMAT) : inicial === null || inicial === void 0 ? void 0 : inicial.toISOString(),
|
|
220
|
+
[finalName]: returnValueType === 'default' ? final === null || final === void 0 ? void 0 : final.format(_helpers2.TOKEN_ISO_FORMAT) : final === null || final === void 0 ? void 0 : final.toISOString()
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
});
|
|
221
224
|
requestAnimationFrame(() => {
|
|
222
|
-
|
|
225
|
+
var _finalInputRef$curren, _finalInputRef$curren2;
|
|
226
|
+
if (!typing) (_finalInputRef$curren = finalInputRef.current) === null || _finalInputRef$curren === void 0 ? void 0 : (_finalInputRef$curren2 = _finalInputRef$curren.focus) === null || _finalInputRef$curren2 === void 0 ? void 0 : _finalInputRef$curren2.call(_finalInputRef$curren);
|
|
223
227
|
});
|
|
224
228
|
break;
|
|
225
229
|
}
|
|
226
230
|
case 'final':
|
|
227
231
|
{
|
|
232
|
+
var _props$onChange3;
|
|
228
233
|
setSelectedDate(prevSelectedDate => {
|
|
229
234
|
const {
|
|
230
235
|
inicial,
|
|
@@ -240,12 +245,12 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
240
245
|
inicial,
|
|
241
246
|
final
|
|
242
247
|
} = verifyDateRangeOrder(selectedDate.inicial, rawDate);
|
|
243
|
-
props.onChange
|
|
248
|
+
(_props$onChange3 = props.onChange) === null || _props$onChange3 === void 0 ? void 0 : _props$onChange3.call(props, {
|
|
244
249
|
target: {
|
|
245
250
|
name: props.name,
|
|
246
251
|
value: {
|
|
247
|
-
[initialName]: inicial
|
|
248
|
-
[finalName]: final
|
|
252
|
+
[initialName]: returnValueType === 'default' ? inicial === null || inicial === void 0 ? void 0 : inicial.format(_helpers2.TOKEN_ISO_FORMAT) : inicial === null || inicial === void 0 ? void 0 : inicial.toISOString(),
|
|
253
|
+
[finalName]: returnValueType === 'default' ? final === null || final === void 0 ? void 0 : final.format(_helpers2.TOKEN_ISO_FORMAT) : final === null || final === void 0 ? void 0 : final.toISOString()
|
|
249
254
|
}
|
|
250
255
|
}
|
|
251
256
|
});
|
|
@@ -258,10 +263,12 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
258
263
|
setCalendarDisplayDate(rawDate.clone());
|
|
259
264
|
}, [props.name, props.onChange, initialName, finalName, selectedDate, shouldCloseOnSelect]);
|
|
260
265
|
const handleChangeUpdateDateStateWithPredefinedPeriod = _react.default.useCallback(period => {
|
|
266
|
+
var _finalInputRef$curren3, _finalInputRef$curren4;
|
|
261
267
|
const localOnChange = (initialDate, finalDate) => {
|
|
268
|
+
var _props$onChange4;
|
|
262
269
|
const valueToUpdate = {
|
|
263
|
-
[initialName]: initialDate.format(_helpers2.TOKEN_ISO_FORMAT),
|
|
264
|
-
[finalName]: finalDate.format(_helpers2.TOKEN_ISO_FORMAT)
|
|
270
|
+
[initialName]: returnValueType === 'default' ? initialDate.format(_helpers2.TOKEN_ISO_FORMAT) : initialDate.toISOString(),
|
|
271
|
+
[finalName]: returnValueType === 'default' ? finalDate.format(_helpers2.TOKEN_ISO_FORMAT) : finalDate.toISOString()
|
|
265
272
|
};
|
|
266
273
|
setSelectedDate(() => {
|
|
267
274
|
const updatedState = {
|
|
@@ -270,7 +277,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
270
277
|
};
|
|
271
278
|
return updatedState;
|
|
272
279
|
});
|
|
273
|
-
props.onChange
|
|
280
|
+
(_props$onChange4 = props.onChange) === null || _props$onChange4 === void 0 ? void 0 : _props$onChange4.call(props, {
|
|
274
281
|
target: {
|
|
275
282
|
name: props.name,
|
|
276
283
|
value: valueToUpdate
|
|
@@ -322,16 +329,19 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
322
329
|
default:
|
|
323
330
|
break;
|
|
324
331
|
}
|
|
325
|
-
finalInputRef
|
|
332
|
+
finalInputRef === null || finalInputRef === void 0 ? void 0 : (_finalInputRef$curren3 = finalInputRef.current) === null || _finalInputRef$curren3 === void 0 ? void 0 : (_finalInputRef$curren4 = _finalInputRef$curren3.focus) === null || _finalInputRef$curren4 === void 0 ? void 0 : _finalInputRef$curren4.call(_finalInputRef$curren3);
|
|
326
333
|
if (shouldCloseOnSelect) handleChangeCalendarBoxState(false);
|
|
327
334
|
}, [props.name, props.onChange, initialName, finalName]);
|
|
328
335
|
const handleOnBlurMaskInput = (event, inputType) => {
|
|
329
|
-
|
|
336
|
+
var _props$onBlur;
|
|
337
|
+
props === null || props === void 0 ? void 0 : (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, event);
|
|
330
338
|
if (inputType === 'initial') {
|
|
331
|
-
|
|
339
|
+
var _event$relatedTarget;
|
|
340
|
+
if (((_event$relatedTarget = event.relatedTarget) === null || _event$relatedTarget === void 0 ? void 0 : _event$relatedTarget.id) !== finalInputName) handleChangeCalendarBoxState(false);
|
|
332
341
|
if (calendarBoxOpen) {
|
|
333
|
-
|
|
334
|
-
|
|
342
|
+
var _selectedDate$inicial2, _selectedDate$inicial3;
|
|
343
|
+
handleChangeActiveDescendant(((_selectedDate$inicial2 = selectedDate.inicial) !== null && _selectedDate$inicial2 !== void 0 ? _selectedDate$inicial2 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
344
|
+
setCalendarDisplayDate((_selectedDate$inicial3 = selectedDate.inicial) !== null && _selectedDate$inicial3 !== void 0 ? _selectedDate$inicial3 : (0, _moment.default)());
|
|
335
345
|
}
|
|
336
346
|
if (_lodash.default.size(initialUnmaskedValue) !== 8) {
|
|
337
347
|
const date = (0, _moment.default)(selectedDate.inicial, _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -341,10 +351,12 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
341
351
|
}
|
|
342
352
|
}
|
|
343
353
|
if (inputType === 'final') {
|
|
344
|
-
|
|
354
|
+
var _event$relatedTarget2;
|
|
355
|
+
if (((_event$relatedTarget2 = event.relatedTarget) === null || _event$relatedTarget2 === void 0 ? void 0 : _event$relatedTarget2.id) !== initialInputName) handleChangeCalendarBoxState(false);
|
|
345
356
|
if (calendarBoxOpen) {
|
|
346
|
-
|
|
347
|
-
|
|
357
|
+
var _selectedDate$final2, _selectedDate$final3;
|
|
358
|
+
handleChangeActiveDescendant(((_selectedDate$final2 = selectedDate.final) !== null && _selectedDate$final2 !== void 0 ? _selectedDate$final2 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
359
|
+
setCalendarDisplayDate((_selectedDate$final3 = selectedDate.final) !== null && _selectedDate$final3 !== void 0 ? _selectedDate$final3 : (0, _moment.default)());
|
|
348
360
|
}
|
|
349
361
|
if (_lodash.default.size(finalUnmaskedValue) !== 8) {
|
|
350
362
|
const date = (0, _moment.default)(selectedDate.final, _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -355,21 +367,25 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
355
367
|
}
|
|
356
368
|
};
|
|
357
369
|
const handleOnFocusMaskInput = (event, inputType) => {
|
|
358
|
-
|
|
359
|
-
|
|
370
|
+
var _props$onFocus;
|
|
371
|
+
props === null || props === void 0 ? void 0 : (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
|
|
372
|
+
if (!isReadOnly && !calendarBoxOpen && openCalendarOnFocus) {
|
|
360
373
|
setCalendarBoxOpen(true);
|
|
361
374
|
}
|
|
362
375
|
if (inputType === 'initial') {
|
|
363
|
-
|
|
364
|
-
|
|
376
|
+
var _selectedDate$inicial4, _selectedDate$inicial5;
|
|
377
|
+
handleChangeActiveDescendant(((_selectedDate$inicial4 = selectedDate.inicial) !== null && _selectedDate$inicial4 !== void 0 ? _selectedDate$inicial4 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
378
|
+
setCalendarDisplayDate((_selectedDate$inicial5 = selectedDate.inicial) !== null && _selectedDate$inicial5 !== void 0 ? _selectedDate$inicial5 : (0, _moment.default)());
|
|
365
379
|
}
|
|
366
380
|
if (inputType === 'final') {
|
|
367
|
-
|
|
368
|
-
|
|
381
|
+
var _selectedDate$final4, _selectedDate$final5;
|
|
382
|
+
handleChangeActiveDescendant(((_selectedDate$final4 = selectedDate.final) !== null && _selectedDate$final4 !== void 0 ? _selectedDate$final4 : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
383
|
+
setCalendarDisplayDate((_selectedDate$final5 = selectedDate.final) !== null && _selectedDate$final5 !== void 0 ? _selectedDate$final5 : (0, _moment.default)());
|
|
369
384
|
}
|
|
370
385
|
};
|
|
371
386
|
const handleOnKeyDownMaskInput = (event, inputType) => {
|
|
372
|
-
|
|
387
|
+
var _props$onKeyDown;
|
|
388
|
+
props === null || props === void 0 ? void 0 : (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
|
373
389
|
if (calendarBoxOpen && event.key && !event.shiftKey && !event.altKey && event.key === _types.Keys.enter) {
|
|
374
390
|
event.preventDefault();
|
|
375
391
|
const rawDate = (0, _moment.default)(_lodash.default.toString(activeDescendant), _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -383,14 +399,16 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
383
399
|
if (undigitable) {
|
|
384
400
|
event.preventDefault();
|
|
385
401
|
} else {
|
|
386
|
-
|
|
402
|
+
var _props$onPaste;
|
|
403
|
+
(_props$onPaste = props.onPaste) === null || _props$onPaste === void 0 ? void 0 : _props$onPaste.call(props, event);
|
|
387
404
|
}
|
|
388
405
|
};
|
|
389
406
|
const handleOnBeforeInput = event => {
|
|
390
407
|
if (undigitable) {
|
|
391
408
|
event.preventDefault();
|
|
392
409
|
} else {
|
|
393
|
-
|
|
410
|
+
var _props$onBeforeInput;
|
|
411
|
+
(_props$onBeforeInput = props.onBeforeInput) === null || _props$onBeforeInput === void 0 ? void 0 : _props$onBeforeInput.call(props, event);
|
|
394
412
|
}
|
|
395
413
|
};
|
|
396
414
|
const handleOnKeyDown = event => {
|
|
@@ -430,7 +448,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
430
448
|
}
|
|
431
449
|
};
|
|
432
450
|
_react.default.useEffect(() => {
|
|
433
|
-
if (props
|
|
451
|
+
if (props !== null && props !== void 0 && props.value) {
|
|
434
452
|
const objectValue = props.value;
|
|
435
453
|
const initialDate = (0, _moment.default)(_lodash.default.toString(objectValue[initialName]), _helpers2.TOKEN_ISO_FORMAT);
|
|
436
454
|
const finalDate = (0, _moment.default)(_lodash.default.toString(objectValue[finalName]), _helpers2.TOKEN_ISO_FORMAT);
|
|
@@ -441,7 +459,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
441
459
|
setInitialMaskValue(initialDate.format(_helpers2.TOKEN_PTBR_FORMAT));
|
|
442
460
|
setFinalMaskValue(finalDate.format(_helpers2.TOKEN_PTBR_FORMAT));
|
|
443
461
|
}
|
|
444
|
-
}, [props
|
|
462
|
+
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
445
463
|
const contextValues = _react.default.useMemo(() => ({
|
|
446
464
|
isReadOnly,
|
|
447
465
|
isDisabled,
|
|
@@ -486,11 +504,11 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
486
504
|
"data-testid": "test-date-period-field-label",
|
|
487
505
|
label: label,
|
|
488
506
|
inputId: initialInputName,
|
|
489
|
-
hint: props
|
|
507
|
+
hint: props === null || props === void 0 ? void 0 : props.hint,
|
|
490
508
|
isDisabled: isDisabled,
|
|
491
509
|
isReadOnly: isReadOnly,
|
|
492
510
|
skeletonize: skeletonize,
|
|
493
|
-
required: props
|
|
511
|
+
required: props === null || props === void 0 ? void 0 : props.required,
|
|
494
512
|
hintPosition: hintPosition,
|
|
495
513
|
themePopover: themePopover,
|
|
496
514
|
popoverAlign: popoverAlign,
|
|
@@ -504,7 +522,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
504
522
|
skeletonize: skeletonize,
|
|
505
523
|
customClassInputContainer: customClassInputContainer
|
|
506
524
|
}, /*#__PURE__*/_react.default.createElement(BaseDate.Input, _extends({}, _lodash.default.omit(rest, ['initialRef', 'finalRef']), {
|
|
507
|
-
ref: (0, _helpers.mergeRefs)(initialInputRef, props
|
|
525
|
+
ref: (0, _helpers.mergeRefs)(initialInputRef, props === null || props === void 0 ? void 0 : props.initialRef),
|
|
508
526
|
id: initialInputName,
|
|
509
527
|
name: initialInputName,
|
|
510
528
|
value: initialMaskedValue,
|
|
@@ -541,7 +559,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
541
559
|
name: "arrow_right",
|
|
542
560
|
size: 10
|
|
543
561
|
})), /*#__PURE__*/_react.default.createElement(BaseDate.Input, _extends({}, _lodash.default.omit(rest, ['initialRef', 'finalRef']), {
|
|
544
|
-
ref: (0, _helpers.mergeRefs)(finalInputRef, props
|
|
562
|
+
ref: (0, _helpers.mergeRefs)(finalInputRef, props === null || props === void 0 ? void 0 : props.finalRef),
|
|
545
563
|
id: finalInputName,
|
|
546
564
|
name: finalInputName,
|
|
547
565
|
value: finalMaskedValue,
|
|
@@ -580,8 +598,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, __)
|
|
|
580
598
|
className: "error",
|
|
581
599
|
"data-state-skeletonize": skeletonize,
|
|
582
600
|
"aria-describedby": String(label).concat('-errors')
|
|
583
|
-
}, errors
|
|
584
|
-
key:
|
|
601
|
+
}, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
602
|
+
key: "".concat(index + 1, "-").concat(error)
|
|
585
603
|
}, error, "\xA0")))))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
|
|
586
604
|
targetRef: inputRootRef,
|
|
587
605
|
text: tooltip,
|
|
@@ -11,8 +11,7 @@ var BaseDate = _interopRequireWildcard(require("../base"));
|
|
|
11
11
|
var _list = _interopRequireWildcard(require("../../../list"));
|
|
12
12
|
var _context = require("./context");
|
|
13
13
|
var _helpers = require("../helpers");
|
|
14
|
-
function
|
|
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; }
|
|
14
|
+
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); }
|
|
16
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
16
|
const Triggers = () => {
|
|
18
17
|
const {
|
|
@@ -36,31 +35,36 @@ const Triggers = () => {
|
|
|
36
35
|
} = (0, _context.useDatePeriodFieldContext)();
|
|
37
36
|
const shouldHavePermitClickOnTrigger = !isReadOnly && !isDisabled;
|
|
38
37
|
const handleOnClickTriggerSelectPredefinedPeriods = (event, periodSelected) => {
|
|
39
|
-
|
|
38
|
+
var _event$preventDefault;
|
|
39
|
+
if (!shouldHavePermitClickOnTrigger) event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);else {
|
|
40
40
|
if (periodSelected) handleChangeUpdateDateStateWithPredefinedPeriod(periodSelected);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
const handleOnClickTriggerCalendar = event => {
|
|
44
|
+
var _initialInputRef$curr, _finalInputRef$curren, _initialInputRef$curr3;
|
|
44
45
|
if (!shouldHavePermitClickOnTrigger) event.preventDefault();else {
|
|
45
46
|
handleChangeCalendarBoxState(!calendarBoxOpen);
|
|
46
47
|
if (!calendarBoxOpen) {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
var _document$activeEleme;
|
|
49
|
+
switch ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) {
|
|
50
|
+
case (_initialInputRef$curr = initialInputRef.current) === null || _initialInputRef$curr === void 0 ? void 0 : _initialInputRef$curr.id:
|
|
49
51
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
var _selectedDate$inicial, _selectedDate$inicial2, _initialInputRef$curr2;
|
|
53
|
+
handleChangeActiveDescendant(((_selectedDate$inicial = selectedDate.inicial) !== null && _selectedDate$inicial !== void 0 ? _selectedDate$inicial : (0, _moment.default)()).format(_helpers.TOKEN_ISO_FORMAT));
|
|
54
|
+
handleChangeCalendarDisplayDate((_selectedDate$inicial2 = selectedDate.inicial) !== null && _selectedDate$inicial2 !== void 0 ? _selectedDate$inicial2 : (0, _moment.default)());
|
|
55
|
+
(_initialInputRef$curr2 = initialInputRef.current) === null || _initialInputRef$curr2 === void 0 ? void 0 : _initialInputRef$curr2.focus();
|
|
53
56
|
break;
|
|
54
57
|
}
|
|
55
|
-
case finalInputRef.current
|
|
58
|
+
case (_finalInputRef$curren = finalInputRef.current) === null || _finalInputRef$curren === void 0 ? void 0 : _finalInputRef$curren.id:
|
|
56
59
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
var _selectedDate$final, _selectedDate$final2, _finalInputRef$curren2;
|
|
61
|
+
handleChangeActiveDescendant(((_selectedDate$final = selectedDate.final) !== null && _selectedDate$final !== void 0 ? _selectedDate$final : (0, _moment.default)()).format(_helpers.TOKEN_ISO_FORMAT));
|
|
62
|
+
handleChangeCalendarDisplayDate((_selectedDate$final2 = selectedDate.final) !== null && _selectedDate$final2 !== void 0 ? _selectedDate$final2 : (0, _moment.default)());
|
|
63
|
+
(_finalInputRef$curren2 = finalInputRef.current) === null || _finalInputRef$curren2 === void 0 ? void 0 : _finalInputRef$curren2.focus();
|
|
60
64
|
break;
|
|
61
65
|
}
|
|
62
66
|
default:
|
|
63
|
-
initialInputRef.current
|
|
67
|
+
(_initialInputRef$curr3 = initialInputRef.current) === null || _initialInputRef$curr3 === void 0 ? void 0 : _initialInputRef$curr3.focus();
|
|
64
68
|
break;
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -109,7 +113,8 @@ const Triggers = () => {
|
|
|
109
113
|
itemId: period.id,
|
|
110
114
|
text: period.label,
|
|
111
115
|
onMouseDown: event => {
|
|
112
|
-
|
|
116
|
+
var _event$preventDefault2;
|
|
117
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 ? void 0 : _event$preventDefault2.call(event);
|
|
113
118
|
},
|
|
114
119
|
onClick: event => {
|
|
115
120
|
handleOnClickTriggerSelectPredefinedPeriods(event, period.id);
|
|
@@ -5,6 +5,7 @@ import { ColorTheme } from '../../../@types/ColorStyles.js';
|
|
|
5
5
|
import { ITooltipCommonProps } from '../../../tooltip/types.js';
|
|
6
6
|
import { HintPosition, Position } from '../../../@types/Position.js';
|
|
7
7
|
import { PermissionAttr, OnDenied } from '../../../@types/PermissionAttr.js';
|
|
8
|
+
import { DateValueReturnType } from '../types.js';
|
|
8
9
|
|
|
9
10
|
type DatePeriodTypes = 'today' | 'week' | 'lastweek' | 'last15' | 'month' | 'lastmonth';
|
|
10
11
|
type PeriodOptions = {
|
|
@@ -47,6 +48,7 @@ interface DatePeriodFieldProps extends InputHTMLProps, ITooltipCommonProps {
|
|
|
47
48
|
shouldCloseOnSelect?: boolean;
|
|
48
49
|
showClearDateButton?: boolean;
|
|
49
50
|
showPredefinedPeriodsButton?: boolean;
|
|
51
|
+
returnValueType?: DateValueReturnType;
|
|
50
52
|
textAlign?: TextAlign;
|
|
51
53
|
hintPosition?: HintPosition;
|
|
52
54
|
themePopover?: ColorTheme;
|
|
@@ -7,6 +7,7 @@ import '../../@types/ColorStyles.js';
|
|
|
7
7
|
import '../../tooltip/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../../@types/PermissionAttr.js';
|
|
10
|
+
import './types.js';
|
|
10
11
|
|
|
11
12
|
declare const TOKEN_MASK = "00/00/0000";
|
|
12
13
|
declare const TOKEN_ISO_FORMAT = "YYYY-MM-DD";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ColorTheme } from '../../@types/ColorStyles.js';
|
|
2
2
|
import { HintPosition, Position } from '../../@types/Position.js';
|
|
3
3
|
|
|
4
|
+
type DateValueReturnType = 'default' | 'iso';
|
|
4
5
|
declare enum Keys {
|
|
5
6
|
arrowLeft = "ArrowLeft",
|
|
6
7
|
arrowRight = "ArrowRight",
|
|
@@ -56,4 +57,4 @@ interface BaseDateInputTriggersProps extends React.ComponentPropsWithoutRef<'div
|
|
|
56
57
|
onClickTriggerCalendar: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export { BaseDateInputContainerProps, BaseDateInputLabelProps, BaseDateInputProps, BaseDateInputRootProps, BaseDateInputTriggersProps, Keys };
|
|
60
|
+
export { BaseDateInputContainerProps, BaseDateInputLabelProps, BaseDateInputProps, BaseDateInputRootProps, BaseDateInputTriggersProps, DateValueReturnType, Keys };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
import '../../index-
|
|
3
|
-
export {
|
|
2
|
+
import '../../index-3b70931d.js';
|
|
3
|
+
export { F as FileFieldInputProps, I as Input } from '../../index-7dfa8924.js';
|
|
4
4
|
import '../../@types/Align.js';
|
|
5
5
|
import '../../@types/ColorStyles.js';
|
|
6
6
|
import '../../@types/Position.js';
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
require("../../assets/styles/filefield.scss");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
|
+
var _buttons = _interopRequireDefault(require("../../buttons"));
|
|
11
|
+
var TextField = _interopRequireWildcard(require("../textfield"));
|
|
12
|
+
var _list = _interopRequireWildcard(require("../../list"));
|
|
13
|
+
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); }
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
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); }
|
|
16
|
+
function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
|
|
17
|
+
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
18
|
+
var _props$value;
|
|
19
|
+
const rest = Object.assign({}, (_objectDestructuringEmpty(props), props));
|
|
20
|
+
const inputFileRef = _react.default.useRef(null);
|
|
21
|
+
const [internalFiles, setInternalFiles] = _react.default.useState([]);
|
|
22
|
+
const files = (_props$value = props === null || props === void 0 ? void 0 : props.value) !== null && _props$value !== void 0 ? _props$value : internalFiles;
|
|
23
|
+
const inputLabel = _lodash.default.isArray(files) && files.length > 0 ? "".concat(files.length, " arquivo(s) selecionado(s)") : 'Nenhum arquivo selecionado';
|
|
24
|
+
const handleSelect = event => {
|
|
25
|
+
var _props$onChange;
|
|
26
|
+
const fileList = event.target.files;
|
|
27
|
+
if (!fileList) return;
|
|
28
|
+
let selectedFiles = Array.from(fileList);
|
|
29
|
+
if (props !== null && props !== void 0 && props.maxSize) {
|
|
30
|
+
selectedFiles = selectedFiles.filter(file => file.size <= _lodash.default.toNumber(props.maxSize));
|
|
31
|
+
}
|
|
32
|
+
if (!(props !== null && props !== void 0 && props.multiple) && selectedFiles.length > 1) {
|
|
33
|
+
selectedFiles = [selectedFiles[0]];
|
|
34
|
+
}
|
|
35
|
+
if (_lodash.default.isNil(props === null || props === void 0 ? void 0 : props.value)) {
|
|
36
|
+
setInternalFiles(selectedFiles);
|
|
37
|
+
}
|
|
38
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
39
|
+
target: {
|
|
40
|
+
name: props.name,
|
|
41
|
+
value: selectedFiles
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
inputFileRef.current.value = '';
|
|
45
|
+
};
|
|
46
|
+
const handleClear = () => {
|
|
47
|
+
var _props$onChange2;
|
|
48
|
+
if (_lodash.default.isNil(props === null || props === void 0 ? void 0 : props.value)) {
|
|
49
|
+
setInternalFiles([]);
|
|
50
|
+
}
|
|
51
|
+
(_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, {
|
|
52
|
+
target: {
|
|
53
|
+
name: props.name,
|
|
54
|
+
value: ''
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
inputFileRef.current.value = '';
|
|
58
|
+
};
|
|
59
|
+
const openDialog = () => {
|
|
60
|
+
var _inputFileRef$current;
|
|
61
|
+
(_inputFileRef$current = inputFileRef.current) === null || _inputFileRef$current === void 0 ? void 0 : _inputFileRef$current.click();
|
|
62
|
+
};
|
|
63
|
+
const handleLockOnPaste = _react.default.useCallback(event => {
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
}, []);
|
|
66
|
+
const handleLockOnBeforeInput = _react.default.useCallback(event => {
|
|
67
|
+
var _props$onBeforeInput;
|
|
68
|
+
(_props$onBeforeInput = props.onBeforeInput) === null || _props$onBeforeInput === void 0 ? void 0 : _props$onBeforeInput.call(props, event);
|
|
69
|
+
}, []);
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TextField.Input, _extends({}, rest, {
|
|
71
|
+
ref: ref,
|
|
72
|
+
type: "text",
|
|
73
|
+
readOnly: false,
|
|
74
|
+
value: inputLabel,
|
|
75
|
+
customClass: "file-input",
|
|
76
|
+
onPaste: handleLockOnPaste,
|
|
77
|
+
onBeforeInput: handleLockOnBeforeInput,
|
|
78
|
+
customClassInputContainer: "file-container"
|
|
79
|
+
}), /*#__PURE__*/_react.default.createElement(TextField.LeftSlot, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
80
|
+
ref: inputFileRef,
|
|
81
|
+
type: "file",
|
|
82
|
+
name: props === null || props === void 0 ? void 0 : props.name,
|
|
83
|
+
accept: props === null || props === void 0 ? void 0 : props.accept,
|
|
84
|
+
multiple: props === null || props === void 0 ? void 0 : props.multiple,
|
|
85
|
+
onChange: handleSelect,
|
|
86
|
+
style: {
|
|
87
|
+
all: 'unset',
|
|
88
|
+
display: 'none'
|
|
89
|
+
}
|
|
90
|
+
})), /*#__PURE__*/_react.default.createElement(TextField.RightSlot, {
|
|
91
|
+
className: "file-right-slot"
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
93
|
+
className: "show-files-selected-list",
|
|
94
|
+
visible: true,
|
|
95
|
+
dropdown: true,
|
|
96
|
+
transparent: true,
|
|
97
|
+
boxShadow: false,
|
|
98
|
+
showIconDropdown: false,
|
|
99
|
+
type: "button",
|
|
100
|
+
title: "Arquivos Selecionados",
|
|
101
|
+
tabIndex: -1,
|
|
102
|
+
disabled: props === null || props === void 0 ? void 0 : props.disabled,
|
|
103
|
+
"aria-label": "Arquivos Selecionados",
|
|
104
|
+
"aria-readonly": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
105
|
+
"data-state-read-only": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
106
|
+
iconName: "information",
|
|
107
|
+
dropdownAlign: "right",
|
|
108
|
+
onMouseDown: event => {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
}
|
|
111
|
+
}, !_lodash.default.isArray(files) && /*#__PURE__*/_react.default.createElement(_list.default, {
|
|
112
|
+
condensed: true
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(_list.ListItem, {
|
|
114
|
+
key: "nenhum-selecionado",
|
|
115
|
+
itemId: "nenhum-selecionado",
|
|
116
|
+
text: "Nenhum arquivo selecionado",
|
|
117
|
+
onMouseDown: event => {
|
|
118
|
+
var _event$preventDefault;
|
|
119
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);
|
|
120
|
+
}
|
|
121
|
+
})), _lodash.default.isArray(files) && _lodash.default.size(files) > 0 && /*#__PURE__*/_react.default.createElement(_list.default, {
|
|
122
|
+
condensed: true
|
|
123
|
+
}, files.map((file, index) => {
|
|
124
|
+
const id = "".concat(file.name, "-").concat(index + 1);
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement(_list.ListItem, {
|
|
126
|
+
key: id,
|
|
127
|
+
itemId: id,
|
|
128
|
+
text: file.name,
|
|
129
|
+
onMouseDown: event => {
|
|
130
|
+
var _event$preventDefault2;
|
|
131
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 ? void 0 : _event$preventDefault2.call(event);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}))), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
135
|
+
"data-testid": "test-file-field-trigger-clear-files-selected",
|
|
136
|
+
className: "clear-files-selected",
|
|
137
|
+
visible: true,
|
|
138
|
+
transparent: true,
|
|
139
|
+
boxShadow: false,
|
|
140
|
+
showIconDropdown: false,
|
|
141
|
+
type: "button",
|
|
142
|
+
title: "Limpar",
|
|
143
|
+
tabIndex: -1,
|
|
144
|
+
disabled: props === null || props === void 0 ? void 0 : props.disabled,
|
|
145
|
+
"aria-label": "Limpar",
|
|
146
|
+
"aria-readonly": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
147
|
+
"data-state-read-only": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
148
|
+
iconName: "close",
|
|
149
|
+
onClick: handleClear,
|
|
150
|
+
onMouseDown: event => {
|
|
151
|
+
event.preventDefault();
|
|
152
|
+
}
|
|
153
|
+
}), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
154
|
+
"data-testid": "test-file-field-trigger-select-files",
|
|
155
|
+
className: "select-files",
|
|
156
|
+
visible: true,
|
|
157
|
+
boxShadow: false,
|
|
158
|
+
showIconDropdown: false,
|
|
159
|
+
type: "button",
|
|
160
|
+
title: "Selecionar",
|
|
161
|
+
label: "Selecionar",
|
|
162
|
+
tabIndex: -1,
|
|
163
|
+
disabled: props === null || props === void 0 ? void 0 : props.disabled,
|
|
164
|
+
"aria-label": "Selecionar",
|
|
165
|
+
"aria-readonly": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
166
|
+
"data-state-read-only": props === null || props === void 0 ? void 0 : props.readOnly,
|
|
167
|
+
iconName: "upload4",
|
|
168
|
+
onClick: openDialog,
|
|
169
|
+
onMouseDown: event => {
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
}
|
|
172
|
+
}))));
|
|
173
|
+
});
|
|
174
|
+
Input.displayName = 'FileFieldInput';
|