linear-react-components-ui 1.1.24-beta.8 → 1.1.24-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/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 +137 -32
- package/lib/assets/styles/datepicker2.scss +4 -1
- package/lib/assets/styles/file.scss +8 -0
- 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 +5 -14
- 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 +2 -3
- package/lib/dialog/base/Header.js +3 -4
- package/lib/dialog/base/index.js +10 -9
- package/lib/dialog/form/index.js +6 -6
- 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 +5 -6
- 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 +0 -4
- package/lib/form2/useForm/index.js +17 -13
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +1 -4
- package/lib/hint/index.js +1 -7
- package/lib/icons/index.js +9 -9
- package/lib/index-4b31b471.d.ts +15 -0
- package/lib/index-8a0c7463.d.ts +41 -0
- package/lib/index-9203efed.d.ts +26 -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 +31 -19
- 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/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 +1 -1
- package/lib/inputs/period/helper.js +1 -3
- package/lib/inputs/period/index.js +66 -40
- package/lib/inputs/period/types.d.ts +4 -1
- package/lib/inputs/search/index.js +2 -3
- 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/inputs2/checkboxfield/index.d.ts +1 -1
- package/lib/inputs2/checkboxfield/index.js +15 -15
- package/lib/inputs2/colorfield/index.js +5 -5
- package/lib/inputs2/date/base/constants.js +2 -1
- package/lib/inputs2/date/base/index.js +7 -7
- package/lib/inputs2/date/datefield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/datefield/calendarbox.js +3 -2
- package/lib/inputs2/date/datefield/index.js +37 -28
- package/lib/inputs2/date/datefield/triggers.js +1 -2
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +1 -1
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +8 -6
- package/lib/inputs2/date/dateperiodfield/index.js +61 -44
- package/lib/inputs2/date/dateperiodfield/triggers.js +19 -14
- package/lib/inputs2/filefield/index.js +33 -27
- package/lib/inputs2/index.d.ts +3 -3
- package/lib/inputs2/index.js +1 -2
- package/lib/inputs2/mask/BaseMask.js +7 -7
- package/lib/inputs2/mask/Cnpj.js +4 -5
- package/lib/inputs2/mask/Cpf.js +4 -5
- package/lib/inputs2/mask/Phone.js +1 -2
- package/lib/inputs2/mask/ZipCode.js +1 -2
- package/lib/inputs2/numberfield/currency.js +6 -6
- package/lib/inputs2/numberfield/decimal.js +6 -6
- package/lib/inputs2/numberfield/index.js +6 -6
- package/lib/inputs2/radiofield/index.d.ts +1 -1
- package/lib/inputs2/radiofield/index.js +14 -13
- package/lib/inputs2/selectfield/index.d.ts +1 -1
- package/lib/inputs2/selectfield/index.js +71 -54
- package/lib/inputs2/selectfield/item.d.ts +1 -1
- package/lib/inputs2/selectfield/item.js +4 -4
- package/lib/inputs2/selectfield/listbox.d.ts +1 -1
- package/lib/inputs2/selectfield/listbox.js +7 -4
- package/lib/inputs2/selectfield/options.d.ts +1 -1
- 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 +6 -5
- package/lib/inputs2/slot/index.d.ts +2 -2
- package/lib/inputs2/textareafield/index.js +21 -18
- package/lib/inputs2/textfield/index.js +15 -14
- 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 +1 -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 +2 -8
- 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/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-118afd58.d.ts +0 -26
- package/lib/index-8f540f57.d.ts +0 -41
- package/lib/index-b2ef36a6.d.ts +0 -15
|
@@ -13,8 +13,7 @@ var constants = _interopRequireWildcard(require("../../../internals/constants"))
|
|
|
13
13
|
var _helper = require("../helper");
|
|
14
14
|
var _InputTextBase = _interopRequireDefault(require("../../base/InputTextBase"));
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function
|
|
17
|
-
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 _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
17
|
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); }
|
|
19
18
|
const SimpleSelect = props => {
|
|
20
19
|
const {
|
|
@@ -55,7 +54,7 @@ const SimpleSelect = props => {
|
|
|
55
54
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
56
55
|
const [isTyping, setIsTyping] = (0, _react.useState)(false);
|
|
57
56
|
const dropdownRef = (0, _react.useRef)(null);
|
|
58
|
-
const componentId =
|
|
57
|
+
const componentId = "select-component-".concat(name, "-").concat(uuid.v1());
|
|
59
58
|
const componentRef = (0, _react.useRef)(null);
|
|
60
59
|
const selectWrapper = (0, _react.useRef)();
|
|
61
60
|
const gridElement = (0, _react.useRef)();
|
|
@@ -64,18 +63,20 @@ const SimpleSelect = props => {
|
|
|
64
63
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
65
64
|
};
|
|
66
65
|
const onClickOutside = event => {
|
|
66
|
+
var _selectWrapper$curren, _dropdownRef$current;
|
|
67
67
|
const {
|
|
68
68
|
target
|
|
69
69
|
} = event;
|
|
70
|
-
if (target !== selectWrapper.current && !selectWrapper.current
|
|
70
|
+
if (target !== selectWrapper.current && !((_selectWrapper$curren = selectWrapper.current) !== null && _selectWrapper$curren !== void 0 && _selectWrapper$curren.contains(target)) && !((_dropdownRef$current = dropdownRef.current) !== null && _dropdownRef$current !== void 0 && _dropdownRef$current.contains(target))) {
|
|
71
71
|
setOpened(false);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
const onMouseMove = event => {
|
|
75
|
+
var _dropdownRef$current2, _dropdownRef$current3;
|
|
75
76
|
const target = event.target;
|
|
76
|
-
const idDropdown = dropdownRef.current
|
|
77
|
+
const idDropdown = ((_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : (_dropdownRef$current3 = _dropdownRef$current2.parentElement) === null || _dropdownRef$current3 === void 0 ? void 0 : _dropdownRef$current3.id) || '';
|
|
77
78
|
const dropdownElement = document.getElementById(idDropdown);
|
|
78
|
-
const keepDropdownOpen = Boolean(dropdownElement
|
|
79
|
+
const keepDropdownOpen = Boolean(dropdownElement === null || dropdownElement === void 0 ? void 0 : dropdownElement.contains(target));
|
|
79
80
|
setInsideComponent(keepDropdownOpen);
|
|
80
81
|
};
|
|
81
82
|
const getSelectEvent = selectedEvent => ({
|
|
@@ -115,6 +116,7 @@ const SimpleSelect = props => {
|
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
const onSelect = selectedDropdown => {
|
|
119
|
+
var _dropdownRef$current4;
|
|
118
120
|
if (!selectedDropdown) return;
|
|
119
121
|
setSelected(selectedDropdown);
|
|
120
122
|
if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
|
|
@@ -124,7 +126,7 @@ const SimpleSelect = props => {
|
|
|
124
126
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
125
127
|
setOpened(false);
|
|
126
128
|
});
|
|
127
|
-
dropdownRef.current
|
|
129
|
+
(_dropdownRef$current4 = dropdownRef.current) === null || _dropdownRef$current4 === void 0 ? void 0 : _dropdownRef$current4.focus();
|
|
128
130
|
};
|
|
129
131
|
const onOpenClose = () => {
|
|
130
132
|
setOpened(prevState => !prevState);
|
|
@@ -160,7 +162,8 @@ const SimpleSelect = props => {
|
|
|
160
162
|
const onInputKeyDown = e => {
|
|
161
163
|
if (e.keyCode) {
|
|
162
164
|
if ((e.keyCode === constants.keyCodes.ENTER || e.key === constants.keys.TAB) && selected && opened) {
|
|
163
|
-
|
|
165
|
+
var _e$preventDefault;
|
|
166
|
+
if (e.keyCode === constants.keyCodes.ENTER) (_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
164
167
|
onSelect(selected);
|
|
165
168
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
166
169
|
if (!opened) setOpened(true);
|
|
@@ -168,7 +171,7 @@ const SimpleSelect = props => {
|
|
|
168
171
|
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
169
172
|
index = dataCombo && index === dataCombo.length - 1 ? 0 : index + 1;
|
|
170
173
|
} else {
|
|
171
|
-
index = dataCombo && index === 0 ? dataCombo
|
|
174
|
+
index = dataCombo && index === 0 ? (dataCombo === null || dataCombo === void 0 ? void 0 : dataCombo.length) - 1 : index - 1;
|
|
172
175
|
}
|
|
173
176
|
setSelected(dataCombo[index]);
|
|
174
177
|
if (descriptionKeyIsString) setInputText(dataCombo[index][descriptionKey]);
|
|
@@ -205,7 +208,7 @@ const SimpleSelect = props => {
|
|
|
205
208
|
}, []);
|
|
206
209
|
(0, _react.useEffect)(() => {
|
|
207
210
|
if (gridLayout) {
|
|
208
|
-
const gridEl = document.querySelector(
|
|
211
|
+
const gridEl = document.querySelector("#".concat(componentId, ">.-withinput.grid-container"));
|
|
209
212
|
if (gridElement.current !== gridEl && gridEl) gridElement.current = gridEl;
|
|
210
213
|
}
|
|
211
214
|
}, [gridLayout]);
|
|
@@ -213,7 +216,10 @@ const SimpleSelect = props => {
|
|
|
213
216
|
if (dataSourceWithAllOptions.length > 0) {
|
|
214
217
|
let newCurrent = null;
|
|
215
218
|
if (value || value === 0) {
|
|
216
|
-
newCurrent = dataSourceWithAllOptions.find(i =>
|
|
219
|
+
newCurrent = dataSourceWithAllOptions.find(i => {
|
|
220
|
+
var _i$idKey;
|
|
221
|
+
return (value || value === 0) && ((_i$idKey = i[idKey]) === null || _i$idKey === void 0 ? void 0 : _i$idKey.toString().toLowerCase()) === (value === null || value === void 0 ? void 0 : value.toString().toLowerCase());
|
|
222
|
+
});
|
|
217
223
|
} else if (dataSourceWithAllOptions.length > 0 && selectFirstOnEnter) {
|
|
218
224
|
newCurrent = dataSourceWithAllOptions[0];
|
|
219
225
|
}
|
|
@@ -270,8 +276,8 @@ const SimpleSelect = props => {
|
|
|
270
276
|
onClick: onFocus,
|
|
271
277
|
onKeyDown: onInputKeyDown,
|
|
272
278
|
customClassForLabel: customClassForLabel,
|
|
273
|
-
customClassForWrapper:
|
|
274
|
-
customClassForInputContent:
|
|
279
|
+
customClassForWrapper: "selectwrapper ".concat((undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable', " ").concat(customClassForWrapper),
|
|
280
|
+
customClassForInputContent: "multiselect ".concat(customClassForInputContent),
|
|
275
281
|
inputBaseRef: r => {
|
|
276
282
|
selectWrapper.current = r;
|
|
277
283
|
},
|
|
@@ -4,4 +4,4 @@ import '../../@types/ColorStyles.js';
|
|
|
4
4
|
import '../../tooltip/types.js';
|
|
5
5
|
import '../../@types/Position.js';
|
|
6
6
|
import '../../@types/PermissionAttr.js';
|
|
7
|
-
export { C as CheckboxFieldInputProps, I as Input } from '../../index-
|
|
7
|
+
export { C as CheckboxFieldInputProps, I as Input } from '../../index-8a0c7463.js';
|
|
@@ -14,14 +14,14 @@ var _popover = _interopRequireWildcard(require("../../popover"));
|
|
|
14
14
|
var _tooltip = require("../../tooltip");
|
|
15
15
|
var _permissionValidations = require("../../permissionValidations");
|
|
16
16
|
const _excluded = ["name", "label", "errors", "onChange", "size", "onDeniedActions", "permissionAttr", "variant", "customClass", "customClassLabel", "customClassWrapper", "labelUppercase", "rounded", "customClassInputContainer", "skeletonize", "hintPosition", "gridLayout", "themePopover", "popoverAlign", "tooltip", "tooltipPosition", "tooltipWidth"];
|
|
17
|
-
function
|
|
18
|
-
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; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
19
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
21
20
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
22
21
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
23
22
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
24
23
|
const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
24
|
+
var _props$checked, _props$hint;
|
|
25
25
|
const {
|
|
26
26
|
name,
|
|
27
27
|
label,
|
|
@@ -54,14 +54,14 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
54
54
|
hideContent,
|
|
55
55
|
unvisible
|
|
56
56
|
} = onDenied;
|
|
57
|
-
const inputId = _react.default.useMemo(() => props.id ||
|
|
57
|
+
const inputId = _react.default.useMemo(() => props.id || "checkboxfield-".concat(name), [props.id, name]);
|
|
58
58
|
const inputRootRef = _react.default.useRef(null);
|
|
59
|
-
const isChecked = props.checked
|
|
60
|
-
const hasLabel = !_lodash.default.isEmpty(props
|
|
59
|
+
const isChecked = (_props$checked = props.checked) !== null && _props$checked !== void 0 ? _props$checked : Boolean(props.value);
|
|
60
|
+
const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
|
|
61
61
|
const isReadOnly = Boolean(props.readOnly || onDenied.readOnly);
|
|
62
62
|
const isDisabled = Boolean(props.disabled || onDenied.disabled);
|
|
63
|
-
const hasHintMessages = Boolean(props.hint
|
|
64
|
-
const hasValidationErrors = Boolean(errors
|
|
63
|
+
const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
|
|
64
|
+
const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
65
65
|
const handleOnChange = _react.default.useCallback(event => {
|
|
66
66
|
if (isReadOnly || isDisabled) return;
|
|
67
67
|
Object.defineProperty(event.target, 'value', {
|
|
@@ -70,7 +70,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
70
70
|
enumerable: true,
|
|
71
71
|
configurable: true
|
|
72
72
|
});
|
|
73
|
-
onChange
|
|
73
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
74
74
|
}, [isReadOnly, isDisabled, onChange]);
|
|
75
75
|
if (unvisible || hideContent) return null;
|
|
76
76
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
|
|
@@ -78,11 +78,11 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
78
78
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
79
79
|
ref: inputRootRef,
|
|
80
80
|
"data-testid": "test-chebox-field-root",
|
|
81
|
-
className:
|
|
81
|
+
className: "checkbox-field-root ".concat(customClassWrapper),
|
|
82
82
|
"data-state-error": hasValidationErrors
|
|
83
83
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
84
84
|
"data-state-skeletonize": skeletonize,
|
|
85
|
-
className:
|
|
85
|
+
className: "container ".concat(customClassInputContainer)
|
|
86
86
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
87
87
|
className: "input-root"
|
|
88
88
|
}, /*#__PURE__*/_react.default.createElement("input", _extends({
|
|
@@ -91,7 +91,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
91
91
|
name: name,
|
|
92
92
|
readOnly: isReadOnly,
|
|
93
93
|
disabled: isDisabled,
|
|
94
|
-
className:
|
|
94
|
+
className: "input ".concat(customClass),
|
|
95
95
|
tabIndex: !isReadOnly ? 0 : -1,
|
|
96
96
|
"data-testid": "test-checkbox-field-input",
|
|
97
97
|
"data-state-size": size,
|
|
@@ -109,7 +109,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
109
109
|
name: "checkmark",
|
|
110
110
|
colorStyle: "default"
|
|
111
111
|
})), hasLabel && /*#__PURE__*/_react.default.createElement("label", {
|
|
112
|
-
className:
|
|
112
|
+
className: "label ".concat(customClassLabel),
|
|
113
113
|
title: label,
|
|
114
114
|
htmlFor: inputId,
|
|
115
115
|
"aria-readonly": isReadOnly,
|
|
@@ -126,7 +126,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
126
126
|
align: popoverAlign,
|
|
127
127
|
iconColor: "#03bde2"
|
|
128
128
|
}, /*#__PURE__*/_react.default.createElement(_popover.PopoverText, {
|
|
129
|
-
text: props
|
|
129
|
+
text: props === null || props === void 0 ? void 0 : props.hint
|
|
130
130
|
}))), hintPosition === 'below' && /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
131
131
|
customClass: "hint",
|
|
132
132
|
description: props.hint,
|
|
@@ -137,8 +137,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
137
137
|
className: "error",
|
|
138
138
|
"data-state-skeletonize": skeletonize,
|
|
139
139
|
"aria-describedby": String(name).concat('-errors')
|
|
140
|
-
}, errors
|
|
141
|
-
key:
|
|
140
|
+
}, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
141
|
+
key: "".concat(index + 1, "-").concat(error)
|
|
142
142
|
}, error, "\xA0"))))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
|
|
143
143
|
targetRef: inputRootRef,
|
|
144
144
|
text: tooltip,
|
|
@@ -23,8 +23,7 @@ var TextField = _interopRequireWildcard(require("../textfield"));
|
|
|
23
23
|
var _buttons = _interopRequireDefault(require("../../../lib/buttons"));
|
|
24
24
|
var _permissionValidations = require("../../../lib/permissionValidations");
|
|
25
25
|
const _excluded = ["name", "isTypeText", "defaultValue", "onChange", "permissionAttr", "onDeniedActions"];
|
|
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; }
|
|
@@ -64,15 +63,16 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
64
63
|
const handleTextInputChange = e => {
|
|
65
64
|
const newValue = e.target.value;
|
|
66
65
|
syncColorValues(newValue);
|
|
67
|
-
onChange
|
|
66
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
68
67
|
};
|
|
69
68
|
const handleColorInputChange = e => {
|
|
70
69
|
const newValue = e.target.value;
|
|
71
70
|
syncColorValues(newValue);
|
|
72
|
-
onChange
|
|
71
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
73
72
|
};
|
|
74
73
|
const onPaletteButtonClick = () => {
|
|
75
|
-
|
|
74
|
+
var _inputRefColor$curren;
|
|
75
|
+
(_inputRefColor$curren = inputRefColor.current) === null || _inputRefColor$curren === void 0 ? void 0 : _inputRefColor$curren.click();
|
|
76
76
|
};
|
|
77
77
|
_react.default.useLayoutEffect(() => {
|
|
78
78
|
syncColorValues(String(defaultValue));
|
|
@@ -10,7 +10,8 @@ const useCalendarPosition = (calendarBoxOpen, containerRef) => {
|
|
|
10
10
|
const [calendarBoxStyles, setCalendarBoxStyles] = _react.default.useState({});
|
|
11
11
|
_react.default.useEffect(() => {
|
|
12
12
|
const updatePosition = () => {
|
|
13
|
-
|
|
13
|
+
var _containerRef$current;
|
|
14
|
+
const selectPositionOnScreen = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getBoundingClientRect();
|
|
14
15
|
if (selectPositionOnScreen) {
|
|
15
16
|
const {
|
|
16
17
|
top,
|
|
@@ -13,8 +13,7 @@ const _excluded = ["children", "customClassWrapper", "hasValidationErrors"],
|
|
|
13
13
|
_excluded3 = ["children", "skeletonize", "customClassInputContainer"],
|
|
14
14
|
_excluded4 = ["customClass"],
|
|
15
15
|
_excluded5 = ["children", "isReadOnly", "isDisabled", "skeletonize", "inputFieldId", "calendarBoxOpen", "showCalendarButton", "showClearButton", "onClearSelectedDate", "onClickTriggerCalendar", "hasValidDateSelection", "hasValidPeriodSelected", "clearButtonTestId", "calendarButtonTestId"];
|
|
16
|
-
function
|
|
17
|
-
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 _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
18
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
20
19
|
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; }
|
|
@@ -29,7 +28,7 @@ const Root = exports.Root = /*#__PURE__*/_react.default.forwardRef((props, ref)
|
|
|
29
28
|
return /*#__PURE__*/_react.default.createElement("div", _extends({}, rest, {
|
|
30
29
|
ref: ref,
|
|
31
30
|
"data-state-error": hasValidationErrors,
|
|
32
|
-
className:
|
|
31
|
+
className: "date-field-root ".concat(customClassWrapper)
|
|
33
32
|
}), children);
|
|
34
33
|
});
|
|
35
34
|
Root.displayName = 'BaseDateRoot';
|
|
@@ -52,7 +51,7 @@ const Label = exports.Label = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
52
51
|
rest = _objectWithoutProperties(props, _excluded2);
|
|
53
52
|
return /*#__PURE__*/_react.default.createElement("span", _extends({}, rest, {
|
|
54
53
|
ref: ref,
|
|
55
|
-
className:
|
|
54
|
+
className: "root-label ".concat(customClassLabel),
|
|
56
55
|
"data-state-skeletonize": skeletonize
|
|
57
56
|
}), /*#__PURE__*/_react.default.createElement("label", {
|
|
58
57
|
className: "label",
|
|
@@ -83,7 +82,7 @@ const Container = exports.Container = /*#__PURE__*/_react.default.forwardRef((pr
|
|
|
83
82
|
return /*#__PURE__*/_react.default.createElement("div", _extends({}, rest, {
|
|
84
83
|
ref: ref,
|
|
85
84
|
"data-state-skeletonize": skeletonize,
|
|
86
|
-
className:
|
|
85
|
+
className: "container ".concat(customClassInputContainer)
|
|
87
86
|
}), children);
|
|
88
87
|
});
|
|
89
88
|
Container.displayName = 'BaseDateContainer';
|
|
@@ -98,7 +97,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
98
97
|
type: "text",
|
|
99
98
|
role: "combobox",
|
|
100
99
|
"aria-haspopup": "true",
|
|
101
|
-
className:
|
|
100
|
+
className: "input ".concat(customClass),
|
|
102
101
|
"aria-autocomplete": "list"
|
|
103
102
|
}));
|
|
104
103
|
});
|
|
@@ -148,7 +147,8 @@ const Triggers = exports.Triggers = /*#__PURE__*/_react.default.forwardRef((prop
|
|
|
148
147
|
"aria-controls": inputFieldId,
|
|
149
148
|
"data-state-read-only": isReadOnly,
|
|
150
149
|
"data-state-visible": showClearButton,
|
|
151
|
-
"data-state-valid-date-selected": hasValidDateSelection
|
|
150
|
+
"data-state-valid-date-selected": hasValidDateSelection,
|
|
151
|
+
"data-state-valid-period-selected": hasValidPeriodSelected,
|
|
152
152
|
onClick: handleOnClickClear,
|
|
153
153
|
onMouseDown: event => {
|
|
154
154
|
event.preventDefault();
|
|
@@ -2,6 +2,6 @@ import React__default from 'react';
|
|
|
2
2
|
|
|
3
3
|
interface DateFieldCalendarBoxProps extends React__default.ComponentProps<'div'> {
|
|
4
4
|
}
|
|
5
|
-
declare const CalendarBox: React__default.ForwardRefExoticComponent<Pick<DateFieldCalendarBoxProps, "
|
|
5
|
+
declare const CalendarBox: React__default.ForwardRefExoticComponent<Pick<DateFieldCalendarBoxProps, "key" | "style" | "children" | "slot" | "title" | "className" | "align" | "onClick" | "color" | "hidden" | "id" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React__default.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
|
|
7
7
|
export { CalendarBox, DateFieldCalendarBoxProps };
|
|
@@ -30,7 +30,8 @@ const CalendarBox = exports.CalendarBox = /*#__PURE__*/_react.default.forwardRef
|
|
|
30
30
|
} = (0, _constants.useCalendarPosition)(calendarBoxOpen, dateContainerRef);
|
|
31
31
|
const weeks = (0, _helpers.generateCalendarWeeks)(calendarDisplayDate);
|
|
32
32
|
const handleOnMouseDown = event => {
|
|
33
|
-
|
|
33
|
+
var _event$preventDefault;
|
|
34
|
+
event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);
|
|
34
35
|
};
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
37
|
ref: ref,
|
|
@@ -72,7 +73,7 @@ const CalendarBox = exports.CalendarBox = /*#__PURE__*/_react.default.forwardRef
|
|
|
72
73
|
className: "date-calendar-box-days-of-week"
|
|
73
74
|
}, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, _moment.default.weekdaysShort(true).map((day, idx) => /*#__PURE__*/_react.default.createElement("th", {
|
|
74
75
|
role: "columnheader",
|
|
75
|
-
key:
|
|
76
|
+
key: "day-of-week-".concat(idx + 1)
|
|
76
77
|
}, day))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
77
78
|
className: "date-calendar-box-grid-of-days"
|
|
78
79
|
}, /*#__PURE__*/_react.default.createElement("table", {
|
|
@@ -23,13 +23,13 @@ var _calendarbox = require("./calendarbox");
|
|
|
23
23
|
var _context = require("./context");
|
|
24
24
|
const _excluded = ["label", "errors", "tooltip", "tooltipPosition", "tooltipWidth", "onDeniedActions", "permissionAttr", "customClass", "customClassLabel", "customClassWrapper", "customClassInputContainer", "textAlign", "labelUppercase", "skeletonize", "hintPosition", "gridLayout", "themePopover", "popoverAlign", "showCalendarButton", "openCalendarOnFocus", "undigitable", "shouldCloseOnSelect", "showClearDateButton", "placeholder", "returnValueType"];
|
|
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, ref) => {
|
|
32
|
+
var _props$hint;
|
|
33
33
|
const {
|
|
34
34
|
label,
|
|
35
35
|
errors,
|
|
@@ -68,7 +68,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
68
68
|
const [calendarBoxOpen, setCalendarBoxOpen] = _react.default.useState(false);
|
|
69
69
|
const [activeDescendant, setActiveDescendant] = _react.default.useState((0, _moment.default)().format(_helpers2.TOKEN_ISO_FORMAT));
|
|
70
70
|
const [selectedDate, setSelectedDate] = _react.default.useState(null);
|
|
71
|
-
const [calendarDisplayDate, setCalendarDisplayDate] = _react.default.useState(selectedDate
|
|
71
|
+
const [calendarDisplayDate, setCalendarDisplayDate] = _react.default.useState(selectedDate !== null && selectedDate !== void 0 ? selectedDate : (0, _moment.default)());
|
|
72
72
|
const calendarRef = _react.default.useRef(null);
|
|
73
73
|
const inputRootRef = _react.default.useRef(null);
|
|
74
74
|
const dateInputRef = _react.default.useRef(null);
|
|
@@ -83,7 +83,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
83
83
|
placeholderChar: '_'
|
|
84
84
|
}, {
|
|
85
85
|
ref: dateInputRef,
|
|
86
|
-
defaultValue: selectedDate
|
|
86
|
+
defaultValue: selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.format(_helpers2.TOKEN_PTBR_FORMAT),
|
|
87
87
|
onComplete: value => {
|
|
88
88
|
const date = (0, _moment.default)(value, _helpers2.TOKEN_PTBR_FORMAT);
|
|
89
89
|
if (date.isValid()) {
|
|
@@ -92,18 +92,19 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
const inputId = _react.default.useMemo(() => props.id || props.name || (0, _uuid.v1)(), [props.id, props.name]);
|
|
95
|
-
const hasLabel = !_lodash.default.isEmpty(props
|
|
95
|
+
const hasLabel = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.label);
|
|
96
96
|
const isReadOnly = Boolean(props.readOnly || onDenied.readOnly);
|
|
97
97
|
const isDisabled = Boolean(props.disabled || onDenied.disabled);
|
|
98
|
-
const hasHintMessages = Boolean(props.hint
|
|
99
|
-
const hasValidationErrors = Boolean(errors
|
|
100
|
-
const hasValidDateSelected = !_lodash.default.isEmpty(props
|
|
98
|
+
const hasHintMessages = Boolean((_props$hint = props.hint) === null || _props$hint === void 0 ? void 0 : _props$hint.length);
|
|
99
|
+
const hasValidationErrors = Boolean(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
100
|
+
const hasValidDateSelected = !_lodash.default.isEmpty(props === null || props === void 0 ? void 0 : props.value);
|
|
101
101
|
const handleUpdateDateState = _react.default.useCallback(date => {
|
|
102
|
+
var _props$onChange;
|
|
102
103
|
const nonIsoDateFormat = date.format(_helpers2.TOKEN_ISO_FORMAT);
|
|
103
104
|
const isoDateFormat = date.toISOString();
|
|
104
105
|
setSelectedDate(date.clone());
|
|
105
106
|
setCalendarDisplayDate(date.clone());
|
|
106
|
-
props.onChange
|
|
107
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
107
108
|
target: {
|
|
108
109
|
name: props.name,
|
|
109
110
|
value: returnValueType === 'default' ? nonIsoDateFormat : isoDateFormat
|
|
@@ -118,7 +119,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
118
119
|
const handleChangeCalendarBoxState = _react.default.useCallback(() => {
|
|
119
120
|
setCalendarBoxOpen(prevState => {
|
|
120
121
|
if (dateInputRef.current !== document.activeElement) {
|
|
121
|
-
|
|
122
|
+
var _dateInputRef$current, _dateInputRef$current2;
|
|
123
|
+
dateInputRef === null || dateInputRef === void 0 ? void 0 : (_dateInputRef$current = dateInputRef.current) === null || _dateInputRef$current === void 0 ? void 0 : (_dateInputRef$current2 = _dateInputRef$current.focus) === null || _dateInputRef$current2 === void 0 ? void 0 : _dateInputRef$current2.call(_dateInputRef$current);
|
|
122
124
|
}
|
|
123
125
|
return !prevState;
|
|
124
126
|
});
|
|
@@ -140,7 +142,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
140
142
|
});
|
|
141
143
|
}, []);
|
|
142
144
|
const handleOnClickClearSelectedDate = _react.default.useCallback(() => {
|
|
143
|
-
|
|
145
|
+
var _props$onChange2;
|
|
146
|
+
(_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, {
|
|
144
147
|
target: {
|
|
145
148
|
name: props.name,
|
|
146
149
|
value: ''
|
|
@@ -151,21 +154,23 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
151
154
|
handleCloseCalendar();
|
|
152
155
|
}, [props.onChange]);
|
|
153
156
|
const handleOnBlur = event => {
|
|
154
|
-
|
|
157
|
+
var _props$onBlur;
|
|
158
|
+
props === null || props === void 0 ? void 0 : (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, event);
|
|
155
159
|
handleCloseCalendar();
|
|
156
|
-
setActiveDescendant((selectedDate
|
|
157
|
-
setCalendarDisplayDate(selectedDate
|
|
160
|
+
setActiveDescendant((selectedDate !== null && selectedDate !== void 0 ? selectedDate : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
161
|
+
setCalendarDisplayDate(selectedDate !== null && selectedDate !== void 0 ? selectedDate : (0, _moment.default)());
|
|
158
162
|
if (_lodash.default.size(unmaskedValue) !== 8) {
|
|
159
|
-
const date = (0, _moment.default)(_lodash.default.toString(props
|
|
163
|
+
const date = (0, _moment.default)(_lodash.default.toString(props === null || props === void 0 ? void 0 : props.value), _helpers2.TOKEN_ISO_FORMAT);
|
|
160
164
|
if (date.isValid()) {
|
|
161
165
|
setMaskValue(date.format('DD/MM/YYYY'));
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
};
|
|
165
169
|
const handleOnFocus = event => {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
var _props$onFocus;
|
|
171
|
+
props === null || props === void 0 ? void 0 : (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
|
|
172
|
+
setActiveDescendant((selectedDate !== null && selectedDate !== void 0 ? selectedDate : (0, _moment.default)()).format(_helpers2.TOKEN_ISO_FORMAT));
|
|
173
|
+
setCalendarDisplayDate(selectedDate !== null && selectedDate !== void 0 ? selectedDate : (0, _moment.default)());
|
|
169
174
|
if (!isReadOnly && openCalendarOnFocus) {
|
|
170
175
|
handleOpenCalendar();
|
|
171
176
|
}
|
|
@@ -174,18 +179,21 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
174
179
|
if (undigitable) {
|
|
175
180
|
event.preventDefault();
|
|
176
181
|
} else {
|
|
177
|
-
|
|
182
|
+
var _props$onPaste;
|
|
183
|
+
(_props$onPaste = props.onPaste) === null || _props$onPaste === void 0 ? void 0 : _props$onPaste.call(props, event);
|
|
178
184
|
}
|
|
179
185
|
};
|
|
180
186
|
const handleOnBeforeInput = event => {
|
|
181
187
|
if (undigitable) {
|
|
182
188
|
event.preventDefault();
|
|
183
189
|
} else {
|
|
184
|
-
|
|
190
|
+
var _props$onBeforeInput;
|
|
191
|
+
(_props$onBeforeInput = props.onBeforeInput) === null || _props$onBeforeInput === void 0 ? void 0 : _props$onBeforeInput.call(props, event);
|
|
185
192
|
}
|
|
186
193
|
};
|
|
187
194
|
const handleOnKeyDown = event => {
|
|
188
|
-
|
|
195
|
+
var _props$onKeyDown;
|
|
196
|
+
props === null || props === void 0 ? void 0 : (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
|
189
197
|
if (calendarBoxOpen && event.key && !event.shiftKey && !event.altKey && _helpers2.NAVIGATION_KEYS.includes(event.key)) {
|
|
190
198
|
event.preventDefault();
|
|
191
199
|
switch (event.key) {
|
|
@@ -225,11 +233,12 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
225
233
|
}
|
|
226
234
|
};
|
|
227
235
|
_react.default.useEffect(() => {
|
|
228
|
-
|
|
236
|
+
var _props$value;
|
|
237
|
+
const currentValue = (_props$value = props === null || props === void 0 ? void 0 : props.value) !== null && _props$value !== void 0 ? _props$value : null;
|
|
229
238
|
const date = (0, _moment.default)(_lodash.default.toString(currentValue), _helpers2.TOKEN_ISO_FORMAT);
|
|
230
239
|
setSelectedDate(date.isValid() ? date : null);
|
|
231
240
|
setMaskValue(date.format(_helpers2.TOKEN_PTBR_FORMAT));
|
|
232
|
-
}, [props
|
|
241
|
+
}, [props === null || props === void 0 ? void 0 : props.value]);
|
|
233
242
|
const contextValues = _react.default.useMemo(() => ({
|
|
234
243
|
label,
|
|
235
244
|
inputFieldId: inputId,
|
|
@@ -270,11 +279,11 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
270
279
|
"data-testid": "test-date-field-label",
|
|
271
280
|
label: label,
|
|
272
281
|
inputId: inputId,
|
|
273
|
-
hint: props
|
|
282
|
+
hint: props === null || props === void 0 ? void 0 : props.hint,
|
|
274
283
|
isDisabled: isDisabled,
|
|
275
284
|
isReadOnly: isReadOnly,
|
|
276
285
|
skeletonize: skeletonize,
|
|
277
|
-
required: props
|
|
286
|
+
required: props === null || props === void 0 ? void 0 : props.required,
|
|
278
287
|
hintPosition: hintPosition,
|
|
279
288
|
themePopover: themePopover,
|
|
280
289
|
popoverAlign: popoverAlign,
|
|
@@ -288,7 +297,7 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
288
297
|
}, /*#__PURE__*/_react.default.createElement(BaseDate.Input, _extends({}, rest, {
|
|
289
298
|
ref: (0, _helpers.mergeRefs)(ref, dateInputRef),
|
|
290
299
|
id: inputId,
|
|
291
|
-
name: props
|
|
300
|
+
name: props === null || props === void 0 ? void 0 : props.name,
|
|
292
301
|
value: maskedValue,
|
|
293
302
|
readOnly: isReadOnly,
|
|
294
303
|
disabled: isDisabled,
|
|
@@ -324,8 +333,8 @@ const Input = exports.Input = /*#__PURE__*/_react.default.forwardRef((props, ref
|
|
|
324
333
|
className: "error",
|
|
325
334
|
"data-state-skeletonize": skeletonize,
|
|
326
335
|
"aria-describedby": String(props.name).concat('-errors')
|
|
327
|
-
}, errors
|
|
328
|
-
key:
|
|
336
|
+
}, errors === null || errors === void 0 ? void 0 : errors.map((error, index) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
337
|
+
key: "".concat(index + 1, "-").concat(error)
|
|
329
338
|
}, error, "\xA0")))))), /*#__PURE__*/_react.default.createElement(_tooltip.Tooltip, {
|
|
330
339
|
targetRef: inputRootRef,
|
|
331
340
|
text: tooltip,
|
|
@@ -7,8 +7,7 @@ exports.Triggers = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _context = require("./context");
|
|
9
9
|
var BaseDate = _interopRequireWildcard(require("../base"));
|
|
10
|
-
function
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
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); }
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
const Triggers = () => {
|
|
14
13
|
const {
|