linear-react-components-ui 1.1.24-beta.4 → 1.1.25-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/@types/ColorStyles.d.ts +1 -2
- package/lib/@types/Position.d.ts +1 -2
- package/lib/assets/styles/calendar.scss +137 -32
- package/lib/assets/styles/colorpicker.scss +6 -1
- package/lib/assets/styles/colors.scss +12 -48
- package/lib/assets/styles/file.scss +8 -0
- package/lib/assets/styles/table.scss +6 -0
- package/lib/buttons/ActivateButton.d.ts +0 -1
- package/lib/buttons/AddButton.d.ts +0 -1
- package/lib/buttons/Button.d.ts +0 -1
- package/lib/buttons/CancelButton.d.ts +0 -1
- package/lib/buttons/DangerButton.d.ts +0 -1
- package/lib/buttons/DefaultButton.d.ts +0 -1
- package/lib/buttons/DefaultButton.js +17 -32
- package/lib/buttons/DestroyButton.d.ts +0 -1
- package/lib/buttons/EditButton.d.ts +0 -1
- package/lib/buttons/InactivateButton.d.ts +0 -1
- package/lib/buttons/InfoButton.d.ts +0 -1
- package/lib/buttons/PrimaryButton.d.ts +0 -1
- package/lib/buttons/RestoreButton.d.ts +0 -1
- package/lib/buttons/SaveButton.d.ts +0 -1
- package/lib/buttons/SuccessButton.d.ts +0 -1
- package/lib/buttons/WarningButton.d.ts +0 -1
- package/lib/buttons/index.d.ts +0 -1
- package/lib/buttons/split_button/index.d.ts +0 -1
- package/lib/buttons/types.d.ts +5 -2
- package/lib/calendar/base/index.js +113 -40
- package/lib/dialog/base/index.js +2 -2
- package/lib/form/Field.d.ts +1 -1
- package/lib/form/FieldArray.d.ts +1 -1
- package/lib/form/FieldNumber.d.ts +1 -1
- package/lib/form/FieldPeriod.d.ts +1 -1
- package/lib/form/helpers.d.ts +1 -1
- package/lib/form/index.d.ts +1 -1
- package/lib/form/types.d.ts +1 -1
- package/lib/form/withFieldHOC.d.ts +1 -1
- package/lib/form/withFormSecurity.d.ts +1 -1
- package/lib/icons/helper.d.ts +0 -20
- package/lib/icons/helper.js +0 -20
- package/lib/icons/index.d.ts +6 -4
- package/lib/icons/index.js +9 -14
- package/lib/icons/types.d.ts +6 -3
- package/lib/index.d.ts +0 -1
- package/lib/inputs/base/InputTextBase.d.ts +1 -1
- package/lib/inputs/base/InputTextBase.js +8 -18
- package/lib/inputs/base/Label.d.ts +14 -0
- package/lib/inputs/base/Label.js +35 -0
- package/lib/inputs/base/helpers.d.ts +1 -1
- package/lib/inputs/base/types.d.ts +17 -6
- package/lib/inputs/color/index.js +1 -1
- package/lib/inputs/color/types.d.ts +1 -1
- package/lib/inputs/date/Dialog.d.ts +1 -1
- package/lib/inputs/date/Dropdown.d.ts +1 -1
- package/lib/inputs/date/index.d.ts +1 -1
- package/lib/inputs/date/types.d.ts +2 -2
- package/lib/inputs/errorMessage/index.d.ts +1 -1
- package/lib/inputs/file/DefaultFile.d.ts +1 -1
- package/lib/inputs/file/DefaultFile.js +27 -27
- package/lib/inputs/file/DragDropFile.d.ts +1 -1
- package/lib/inputs/file/File.d.ts +1 -1
- package/lib/inputs/file/File.js +1 -0
- package/lib/inputs/file/FileButtonSettings.d.ts +1 -1
- package/lib/inputs/file/FileButtonSettings.js +0 -1
- package/lib/inputs/file/helpers.d.ts +1 -1
- package/lib/inputs/file/index.d.ts +1 -1
- package/lib/inputs/file/types.d.ts +1 -1
- package/lib/inputs/inputHOC.d.ts +1 -1
- package/lib/inputs/mask/BaseMask.d.ts +1 -1
- package/lib/inputs/mask/Cnpj.d.ts +1 -1
- package/lib/inputs/mask/Cpf.d.ts +1 -1
- package/lib/inputs/mask/Phone.d.ts +1 -1
- package/lib/inputs/mask/ZipCode.d.ts +1 -1
- package/lib/inputs/mask/helpers.d.ts +1 -1
- package/lib/inputs/mask/index.d.ts +1 -1
- package/lib/inputs/mask/types.d.ts +2 -2
- package/lib/inputs/multiSelect/ActionButtons.d.ts +1 -1
- package/lib/inputs/multiSelect/Dropdown.d.ts +1 -1
- package/lib/inputs/multiSelect/helper.d.ts +1 -1
- package/lib/inputs/multiSelect/index.d.ts +1 -1
- package/lib/inputs/multiSelect/types.d.ts +2 -2
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Decimal.d.ts +1 -1
- package/lib/inputs/number/index.d.ts +1 -1
- package/lib/inputs/number/types.d.ts +3 -3
- package/lib/inputs/period/Dialog.d.ts +1 -1
- package/lib/inputs/period/Dropdown.d.ts +1 -1
- package/lib/inputs/period/PeriodList.d.ts +1 -1
- package/lib/inputs/period/helper.d.ts +1 -1
- package/lib/inputs/period/index.d.ts +1 -1
- package/lib/inputs/period/index.js +10 -8
- package/lib/inputs/period/types.d.ts +5 -2
- package/lib/inputs/search/index.d.ts +1 -1
- package/lib/inputs/search/index.js +6 -2
- package/lib/inputs/select/ActionButtons.d.ts +1 -1
- package/lib/inputs/select/Dropdown.d.ts +1 -1
- package/lib/inputs/select/helper.d.ts +1 -1
- package/lib/inputs/select/index.d.ts +1 -1
- package/lib/inputs/select/multiple/Selecteds.d.ts +1 -1
- package/lib/inputs/select/multiple/index.d.ts +1 -1
- package/lib/inputs/select/simple/index.d.ts +1 -1
- package/lib/inputs/select/types.d.ts +1 -1
- package/lib/inputs/text/index.d.ts +1 -1
- package/lib/inputs/text/types.d.ts +3 -2
- package/lib/inputs/textarea/index.d.ts +1 -1
- package/lib/inputs/textarea/types.d.ts +1 -1
- package/lib/inputs/types.d.ts +2 -1
- package/lib/internals/types.d.ts +17 -1
- package/lib/internals/withTooltip.d.ts +12 -0
- package/lib/internals/withTooltip.js +172 -0
- package/lib/labels/DangerLabel.d.ts +0 -1
- package/lib/labels/DefaultLabel.d.ts +5 -3
- package/lib/labels/DefaultLabel.js +7 -15
- package/lib/labels/InfoLabel.d.ts +0 -1
- package/lib/labels/PrimaryLabel.d.ts +0 -1
- package/lib/labels/SuccessLabel.d.ts +0 -1
- package/lib/labels/WarningLabel.d.ts +0 -1
- package/lib/labels/index.d.ts +2 -3
- package/lib/labels/types.d.ts +5 -2
- package/lib/list/Header.d.ts +0 -1
- package/lib/list/Item.d.ts +5 -3
- package/lib/list/Item.js +12 -17
- package/lib/list/helpers.d.ts +0 -1
- package/lib/list/index.d.ts +0 -1
- package/lib/list/types.d.ts +6 -4
- package/lib/menus/sidenav/ExpandMenu.d.ts +2 -2
- package/lib/menus/sidenav/MenuLink.d.ts +7 -4
- package/lib/menus/sidenav/MenuLink.js +11 -20
- package/lib/menus/sidenav/NavMenuGroup.d.ts +2 -2
- package/lib/menus/sidenav/NavMenuItem.d.ts +7 -4
- package/lib/menus/sidenav/NavMenuItem.js +12 -16
- package/lib/menus/sidenav/NavSubMenuItem.d.ts +2 -2
- package/lib/menus/sidenav/helpers.d.ts +2 -2
- package/lib/menus/sidenav/index.d.ts +2 -2
- package/lib/menus/sidenav/popup_menu_search/EmptyList.d.ts +2 -2
- package/lib/menus/sidenav/popup_menu_search/index.d.ts +2 -2
- package/lib/menus/sidenav/types.d.ts +6 -6
- package/lib/popover/PopoverText.js +2 -11
- package/lib/popover/index.js +0 -1
- package/lib/popover/types.d.ts +0 -1
- package/lib/table/index.js +18 -8
- package/lib/table/types.d.ts +1 -0
- package/lib/textContent/index.d.ts +11 -6
- package/lib/textContent/index.js +11 -20
- package/lib/tooltip/index.d.ts +3 -4
- package/lib/tooltip/index.js +53 -36
- package/lib/tooltip/types.d.ts +3 -25
- package/package.json +2 -3
- package/lib/BaseMask-0c14ef51.d.ts +0 -24
- package/lib/Cnpj-bde01dd0.d.ts +0 -18
- package/lib/Cpf-3fa496ad.d.ts +0 -18
- package/lib/Phone-2bb0b397.d.ts +0 -18
- package/lib/ZipCode-09460e18.d.ts +0 -13
- package/lib/assets/styles/checkbox2.scss +0 -199
- package/lib/assets/styles/datepicker2.scss +0 -338
- package/lib/assets/styles/numberfield.scss +0 -18
- package/lib/assets/styles/radiofield.scss +0 -185
- package/lib/assets/styles/selectfield.scss +0 -409
- package/lib/assets/styles/slot.scss +0 -34
- package/lib/assets/styles/textfield.scss +0 -147
- package/lib/calendar/base/Day.d.ts +0 -8
- package/lib/calendar/base/Day.js +0 -36
- package/lib/calendar/base/Month.d.ts +0 -8
- package/lib/calendar/base/Month.js +0 -39
- package/lib/calendar/base/Week.d.ts +0 -8
- package/lib/calendar/base/Week.js +0 -35
- package/lib/form2/helpers.d.ts +0 -8
- package/lib/form2/helpers.js +0 -41
- package/lib/form2/index.d.ts +0 -9
- package/lib/form2/index.js +0 -36
- package/lib/form2/types.d.ts +0 -125
- package/lib/form2/types.js +0 -5
- package/lib/form2/useForm/index.d.ts +0 -5
- package/lib/form2/useForm/index.js +0 -202
- package/lib/index-368f781f.d.ts +0 -15
- package/lib/index-3b70931d.d.ts +0 -44
- package/lib/index-789dd9a5.d.ts +0 -41
- package/lib/index-7ad68789.d.ts +0 -15
- package/lib/index-9e576346.d.ts +0 -23
- package/lib/index-c512803d.d.ts +0 -23
- package/lib/index-c9247c1f.d.ts +0 -15
- package/lib/index-ecafc8c6.d.ts +0 -30
- package/lib/inputs2/checkboxfield/index.d.ts +0 -7
- package/lib/inputs2/checkboxfield/index.js +0 -146
- package/lib/inputs2/colorfield/index.d.ts +0 -9
- package/lib/inputs2/colorfield/index.js +0 -119
- package/lib/inputs2/date/base/constants.d.ts +0 -7
- package/lib/inputs2/date/base/constants.js +0 -43
- package/lib/inputs2/date/base/index.d.ts +0 -12
- package/lib/inputs2/date/base/index.js +0 -179
- package/lib/inputs2/date/datefield/calendarbox.d.ts +0 -7
- package/lib/inputs2/date/datefield/calendarbox.js +0 -115
- package/lib/inputs2/date/datefield/context.d.ts +0 -14
- package/lib/inputs2/date/datefield/context.js +0 -15
- package/lib/inputs2/date/datefield/index.d.ts +0 -10
- package/lib/inputs2/date/datefield/index.js +0 -336
- package/lib/inputs2/date/datefield/triggers.d.ts +0 -8
- package/lib/inputs2/date/datefield/triggers.js +0 -47
- package/lib/inputs2/date/datefield/types.d.ts +0 -63
- package/lib/inputs2/date/datefield/types.js +0 -5
- package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +0 -7
- package/lib/inputs2/date/dateperiodfield/calendarbox.js +0 -136
- package/lib/inputs2/date/dateperiodfield/context.d.ts +0 -14
- package/lib/inputs2/date/dateperiodfield/context.js +0 -17
- package/lib/inputs2/date/dateperiodfield/index.d.ts +0 -10
- package/lib/inputs2/date/dateperiodfield/index.js +0 -593
- package/lib/inputs2/date/dateperiodfield/triggers.d.ts +0 -6
- package/lib/inputs2/date/dateperiodfield/triggers.js +0 -120
- package/lib/inputs2/date/dateperiodfield/types.d.ts +0 -101
- package/lib/inputs2/date/dateperiodfield/types.js +0 -19
- package/lib/inputs2/date/helpers.d.ts +0 -21
- package/lib/inputs2/date/helpers.js +0 -62
- package/lib/inputs2/date/types.d.ts +0 -60
- package/lib/inputs2/date/types.js +0 -19
- package/lib/inputs2/index.d.ts +0 -32
- package/lib/inputs2/index.js +0 -34
- package/lib/inputs2/mask/BaseMask.d.ts +0 -10
- package/lib/inputs2/mask/BaseMask.js +0 -95
- package/lib/inputs2/mask/Cnpj.d.ts +0 -11
- package/lib/inputs2/mask/Cnpj.js +0 -57
- package/lib/inputs2/mask/Cpf.d.ts +0 -11
- package/lib/inputs2/mask/Cpf.js +0 -53
- package/lib/inputs2/mask/Phone.d.ts +0 -11
- package/lib/inputs2/mask/Phone.js +0 -26
- package/lib/inputs2/mask/ZipCode.d.ts +0 -11
- package/lib/inputs2/mask/ZipCode.js +0 -23
- package/lib/inputs2/mask/helpers.d.ts +0 -4
- package/lib/inputs2/mask/helpers.js +0 -57
- package/lib/inputs2/numberfield/currency.d.ts +0 -13
- package/lib/inputs2/numberfield/currency.js +0 -91
- package/lib/inputs2/numberfield/decimal.d.ts +0 -13
- package/lib/inputs2/numberfield/decimal.js +0 -85
- package/lib/inputs2/numberfield/helpers.d.ts +0 -30
- package/lib/inputs2/numberfield/helpers.js +0 -53
- package/lib/inputs2/numberfield/index.d.ts +0 -12
- package/lib/inputs2/numberfield/index.js +0 -104
- package/lib/inputs2/numberfield/types.d.ts +0 -36
- package/lib/inputs2/numberfield/types.js +0 -5
- package/lib/inputs2/radiofield/index.d.ts +0 -9
- package/lib/inputs2/radiofield/index.js +0 -143
- package/lib/inputs2/radiofield/types.d.ts +0 -33
- package/lib/inputs2/radiofield/types.js +0 -5
- package/lib/inputs2/selectfield/context.d.ts +0 -38
- package/lib/inputs2/selectfield/context.js +0 -15
- package/lib/inputs2/selectfield/helpers.d.ts +0 -6
- package/lib/inputs2/selectfield/helpers.js +0 -25
- package/lib/inputs2/selectfield/index.d.ts +0 -10
- package/lib/inputs2/selectfield/index.js +0 -491
- package/lib/inputs2/selectfield/item.d.ts +0 -11
- package/lib/inputs2/selectfield/item.js +0 -85
- package/lib/inputs2/selectfield/listbox.d.ts +0 -7
- package/lib/inputs2/selectfield/listbox.js +0 -103
- package/lib/inputs2/selectfield/search.d.ts +0 -7
- package/lib/inputs2/selectfield/search.js +0 -71
- package/lib/inputs2/selectfield/selections.d.ts +0 -10
- package/lib/inputs2/selectfield/selections.js +0 -86
- package/lib/inputs2/selectfield/triggers.d.ts +0 -8
- package/lib/inputs2/selectfield/triggers.js +0 -100
- package/lib/inputs2/selectfield/types.d.ts +0 -54
- package/lib/inputs2/selectfield/types.js +0 -21
- package/lib/inputs2/slot/index.d.ts +0 -14
- package/lib/inputs2/slot/index.js +0 -47
- package/lib/inputs2/textfield/index.d.ts +0 -8
- package/lib/inputs2/textfield/index.js +0 -159
- package/lib/tooltip/TooltipContent.d.ts +0 -7
- package/lib/tooltip/TooltipContent.js +0 -65
- package/lib/tooltip/useTooltip.d.ts +0 -30
- package/lib/tooltip/useTooltip.js +0 -128
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _Day = _interopRequireDefault(require("./Day"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
const Week = _ref => {
|
|
11
|
-
let {
|
|
12
|
-
weekStartDate,
|
|
13
|
-
currentDate
|
|
14
|
-
} = _ref;
|
|
15
|
-
const renderDays = () => {
|
|
16
|
-
let days = [];
|
|
17
|
-
let dayIndex = 0;
|
|
18
|
-
let dayDate = weekStartDate;
|
|
19
|
-
while (dayIndex < 7) {
|
|
20
|
-
const day = /*#__PURE__*/_react.default.createElement(_Day.default, {
|
|
21
|
-
currentDate: currentDate,
|
|
22
|
-
day: dayDate,
|
|
23
|
-
key: dayDate.format('YYYYMMDD')
|
|
24
|
-
});
|
|
25
|
-
days = [...days, day];
|
|
26
|
-
dayIndex += 1;
|
|
27
|
-
dayDate = dayDate.clone().add(1, 'day');
|
|
28
|
-
}
|
|
29
|
-
return days;
|
|
30
|
-
};
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
-
className: "monthweek"
|
|
33
|
-
}, renderDays());
|
|
34
|
-
};
|
|
35
|
-
var _default = exports.default = Week;
|
package/lib/form2/helpers.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { DeepPartial } from './types.js';
|
|
3
|
-
|
|
4
|
-
declare const mergeRefs: <T>(...refs: (React__default.Ref<T> | undefined)[]) => (fieldElement: T) => void;
|
|
5
|
-
declare const deepMergeValues: <T>(current: T, incoming: DeepPartial<T>) => T;
|
|
6
|
-
declare const flattenValidators: (validators: Record<string, any>, prefix?: string) => Record<string, any>;
|
|
7
|
-
|
|
8
|
-
export { deepMergeValues, flattenValidators, mergeRefs };
|
package/lib/form2/helpers.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mergeRefs = exports.flattenValidators = exports.deepMergeValues = void 0;
|
|
7
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const mergeRefs = function () {
|
|
10
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11
|
-
refs[_key] = arguments[_key];
|
|
12
|
-
}
|
|
13
|
-
return fieldElement => {
|
|
14
|
-
refs.forEach(ref => {
|
|
15
|
-
if (_lodash.default.isFunction(ref)) ref(fieldElement);else if (ref && _lodash.default.isObject(ref)) ref.current = fieldElement;
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
exports.mergeRefs = mergeRefs;
|
|
20
|
-
const deepMergeValues = (current, incoming) => {
|
|
21
|
-
return _lodash.default.mergeWith(_lodash.default.cloneDeep(current), incoming, (objValue, srcValue) => _lodash.default.isPlainObject(objValue) && _lodash.default.isPlainObject(srcValue) ? undefined : srcValue);
|
|
22
|
-
};
|
|
23
|
-
exports.deepMergeValues = deepMergeValues;
|
|
24
|
-
const flattenValidators = function (validators) {
|
|
25
|
-
let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
26
|
-
const flattened = {};
|
|
27
|
-
Object.entries(validators).forEach(_ref => {
|
|
28
|
-
let [key, value] = _ref;
|
|
29
|
-
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
30
|
-
if (Array.isArray(value)) {
|
|
31
|
-
flattened[fullPath] = value;
|
|
32
|
-
} else if (typeof value === 'object' && value !== null) {
|
|
33
|
-
const nestedFlattened = flattenValidators(value, fullPath);
|
|
34
|
-
Object.assign(flattened, nestedFlattened);
|
|
35
|
-
} else {
|
|
36
|
-
flattened[fullPath] = [value];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return flattened;
|
|
40
|
-
};
|
|
41
|
-
exports.flattenValidators = flattenValidators;
|
package/lib/form2/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
export { default as useForm } from './useForm/index.js';
|
|
3
|
-
import './types.js';
|
|
4
|
-
|
|
5
|
-
interface FormElementProps extends React__default.ComponentProps<'form'> {
|
|
6
|
-
}
|
|
7
|
-
declare const Form: React__default.ForwardRefExoticComponent<Pick<FormElementProps, "className" | "onClick" | "color" | "children" | "style" | "id" | "key" | "slot" | "title" | "name" | "hidden" | "onKeyPress" | "role" | "tabIndex" | "align" | "target" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "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" | "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" | "rel" | "autoComplete" | "acceptCharset" | "action" | "encType" | "method" | "noValidate"> & React__default.RefAttributes<HTMLFormElement>>;
|
|
8
|
-
|
|
9
|
-
export { Form as default };
|
package/lib/form2/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
Object.defineProperty(exports, "useForm", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _useForm.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _useForm = _interopRequireDefault(require("./useForm"));
|
|
15
|
-
const _excluded = ["noValidate", "autoComplete", "translate"];
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); }
|
|
18
|
-
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; }
|
|
19
|
-
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; }
|
|
20
|
-
const Form = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
21
|
-
const {
|
|
22
|
-
noValidate = true,
|
|
23
|
-
autoComplete = 'off',
|
|
24
|
-
translate = 'no'
|
|
25
|
-
} = props,
|
|
26
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
27
|
-
return /*#__PURE__*/_react.default.createElement("form", _extends({
|
|
28
|
-
ref: ref,
|
|
29
|
-
className: "form-container",
|
|
30
|
-
translate: translate,
|
|
31
|
-
noValidate: noValidate,
|
|
32
|
-
autoComplete: autoComplete
|
|
33
|
-
}, rest));
|
|
34
|
-
});
|
|
35
|
-
Form.displayName = 'Form';
|
|
36
|
-
var _default = exports.default = Form;
|
package/lib/form2/types.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
type DeepPartial<T> = {
|
|
2
|
-
[K in keyof T]?: T[K] extends Array<infer U> ? Array<DeepPartial<U>> : T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
3
|
-
};
|
|
4
|
-
type NestedState<T, R = any> = {
|
|
5
|
-
[K in keyof T]?: [T[K]] extends [readonly any[]] ? R : T[K] extends object ? NestedState<T[K], R> : R;
|
|
6
|
-
};
|
|
7
|
-
type FieldChanged<T> = NestedState<T, boolean>;
|
|
8
|
-
type FieldTouched<T> = NestedState<T, boolean>;
|
|
9
|
-
type FieldErrors<T> = NestedState<T, string[]>;
|
|
10
|
-
type FieldFocusOptions = Partial<{
|
|
11
|
-
shouldSelect: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
type ValidatorFunction<T> = (value: T, data?: Record<string, any>) => string | null;
|
|
14
|
-
type ValidatorsSchema = Record<string, ValidatorFunction<any>[]>;
|
|
15
|
-
type ValidationMode = 'default' | 'onSubmit';
|
|
16
|
-
type UseFormOptionsProps = Partial<{
|
|
17
|
-
validationMode: ValidationMode;
|
|
18
|
-
}>;
|
|
19
|
-
type RegisterFunction = (name: string, externalRef?: React.Ref<HTMLInputElement>) => {
|
|
20
|
-
name: string;
|
|
21
|
-
value: any;
|
|
22
|
-
ref: (fieldElement: HTMLInputElement) => void;
|
|
23
|
-
onBlur: () => void;
|
|
24
|
-
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
25
|
-
};
|
|
26
|
-
interface UseFormProps<T> {
|
|
27
|
-
initialValues: T;
|
|
28
|
-
validators?: ValidatorsSchema;
|
|
29
|
-
options?: UseFormOptionsProps;
|
|
30
|
-
}
|
|
31
|
-
interface UseFormReturn<T> {
|
|
32
|
-
/**
|
|
33
|
-
* Reseta os campos especificados ou todo o formulário para seus valores iniciais.
|
|
34
|
-
* Também limpa estados de `errors`, `touched` e `changed`.
|
|
35
|
-
* @param fields - Lista de nomes de campos a serem resetados. Se não informado, todos os campos são resetados.
|
|
36
|
-
*/
|
|
37
|
-
reset: (fields?: string[]) => void;
|
|
38
|
-
/**
|
|
39
|
-
* Objeto que indica quais campos foram modificados em relação ao `initialValues`.
|
|
40
|
-
*/
|
|
41
|
-
changed: FieldChanged<T>;
|
|
42
|
-
/**
|
|
43
|
-
* Objeto com os valores atuais dos campos do formulário.
|
|
44
|
-
*/
|
|
45
|
-
values: Record<string, any>;
|
|
46
|
-
/**
|
|
47
|
-
* Objeto contendo arrays de mensagens de erro por campo.
|
|
48
|
-
*/
|
|
49
|
-
errors: FieldErrors<T>;
|
|
50
|
-
/**
|
|
51
|
-
* Objeto que indica se os campos foram tocados (interagidos via blur).
|
|
52
|
-
*/
|
|
53
|
-
touched: FieldTouched<T>;
|
|
54
|
-
/**
|
|
55
|
-
* Indica se o formulário está válido com base nos validadores definidos.
|
|
56
|
-
*/
|
|
57
|
-
isValid: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Registra um campo no formulário, integrando com `ref`, `value`, `onChange` e `onBlur`.
|
|
60
|
-
* @param name - Nome do campo.
|
|
61
|
-
* @param externalRef - Referência externa para o input.
|
|
62
|
-
*/
|
|
63
|
-
register: (name: string, externalRef?: React.Ref<HTMLInputElement>) => {
|
|
64
|
-
name: string;
|
|
65
|
-
ref: React.RefCallback<HTMLInputElement>;
|
|
66
|
-
value: any;
|
|
67
|
-
onBlur: () => void;
|
|
68
|
-
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Limpa mensagens de erro de campos especificados, ou de todos os campos se nenhum for informado.
|
|
72
|
-
* @param fields - Lista de campos a limpar.
|
|
73
|
-
*/
|
|
74
|
-
cleanErrors: (fields?: string[]) => void;
|
|
75
|
-
/**
|
|
76
|
-
* Altera os valores dos campos do formulário com base em dados externos (ex: dados assíncronos).
|
|
77
|
-
* Preserva os dados atuais para campos não especificados.
|
|
78
|
-
* @param values - Novo objeto de dados com valores para atualizar no estado do formulário.
|
|
79
|
-
*/
|
|
80
|
-
changeValues: (values: DeepPartial<T>) => void;
|
|
81
|
-
/**
|
|
82
|
-
* Compara o valor atual de um campo com um valor fornecido, retornando true se forem iguais.
|
|
83
|
-
* @param name - Nome do campo.
|
|
84
|
-
* @param value - Valor a ser comparado.
|
|
85
|
-
*/
|
|
86
|
-
compareField: (name: string, value: any) => boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Gera uma função de submit que é executada ao chamar a callback fornecida.
|
|
89
|
-
* @param callback - Função de submit executada em caso de formulário válido e retornando objeto de valores do formulário.
|
|
90
|
-
*/
|
|
91
|
-
handleSubmit: (callback: (data: T) => void) => (event: React.FormEvent) => void;
|
|
92
|
-
/**
|
|
93
|
-
* Retorna o valor atual de um campo específico.
|
|
94
|
-
* @param name - Nome do campo.
|
|
95
|
-
*/
|
|
96
|
-
getFieldValue: (name: string) => any;
|
|
97
|
-
/**
|
|
98
|
-
* Retorna as mensagens de erro associadas a um campo específico.
|
|
99
|
-
* @param name - Nome do campo.
|
|
100
|
-
*/
|
|
101
|
-
getFieldError: (name: string) => string[];
|
|
102
|
-
/**
|
|
103
|
-
* Define o foco programaticamente em um campo registrado.
|
|
104
|
-
* @param name - Nome do campo.
|
|
105
|
-
* @param options - Opções adicionais como selecionar o texto ao focar.
|
|
106
|
-
*/
|
|
107
|
-
setFieldFocus: (name: string, options?: FieldFocusOptions) => void;
|
|
108
|
-
/**
|
|
109
|
-
* Atualiza o valor de um campo específico e dispara validações quando apropriado.
|
|
110
|
-
* @param name - Nome do campo.
|
|
111
|
-
* @param value - Novo valor.
|
|
112
|
-
*/
|
|
113
|
-
setFieldValue: (name: string, value: any) => void;
|
|
114
|
-
/**
|
|
115
|
-
* Objeto original passado como `initialValues`. Utilizado para reset e comparações.
|
|
116
|
-
*/
|
|
117
|
-
initialValues: Record<string, any>;
|
|
118
|
-
/**
|
|
119
|
-
* Define erros manualmente em campos do formulário, útil para erros externos (ex: backend).
|
|
120
|
-
* @param errors - Objeto contendo mensagens de erro para campos.
|
|
121
|
-
*/
|
|
122
|
-
setExternalErrors: (errors: Record<string, string[]>) => void;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export { DeepPartial, FieldChanged, FieldErrors, FieldFocusOptions, FieldTouched, NestedState, RegisterFunction, UseFormOptionsProps, UseFormProps, UseFormReturn, ValidationMode, ValidatorFunction, ValidatorsSchema };
|
package/lib/form2/types.js
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
var _helpers = require("../helpers");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const useForm = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
initialValues,
|
|
14
|
-
validators = {},
|
|
15
|
-
options = {
|
|
16
|
-
validationMode: 'default'
|
|
17
|
-
}
|
|
18
|
-
} = _ref;
|
|
19
|
-
const [values, setValues] = _react.default.useState(initialValues);
|
|
20
|
-
const [errors, setErrors] = _react.default.useState({});
|
|
21
|
-
const [changed, setChanged] = _react.default.useState({});
|
|
22
|
-
const [touched, setTouched] = _react.default.useState({});
|
|
23
|
-
const fieldsRef = _react.default.useRef({});
|
|
24
|
-
const initialValuesRef = _react.default.useRef(initialValues);
|
|
25
|
-
const valuesToCompareInChangedRef = _react.default.useRef(initialValues);
|
|
26
|
-
const flattenedValidators = _react.default.useMemo(() => {
|
|
27
|
-
return (0, _helpers.flattenValidators)(validators);
|
|
28
|
-
}, [validators]);
|
|
29
|
-
const validateField = (name, value) => {
|
|
30
|
-
const validatorsForField = _lodash.default.get(flattenedValidators, name) ?? [];
|
|
31
|
-
const fieldErrors = validatorsForField.map(validator => validator(value, values)).filter(message => Boolean(message));
|
|
32
|
-
setErrors(prevErrorsState => {
|
|
33
|
-
const updatedErrorsState = _lodash.default.cloneDeep(prevErrorsState);
|
|
34
|
-
_lodash.default.set(updatedErrorsState, name, fieldErrors);
|
|
35
|
-
return updatedErrorsState;
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
const validateAllFields = () => {
|
|
39
|
-
const allValidationErrors = {};
|
|
40
|
-
Object.keys(flattenedValidators).forEach(path => {
|
|
41
|
-
const value = _lodash.default.get(values, path);
|
|
42
|
-
const fieldValidators = _lodash.default.get(flattenedValidators, path) ?? [];
|
|
43
|
-
const fieldErrors = fieldValidators.map(validator => validator(value, values)).filter(message => Boolean(message));
|
|
44
|
-
if (fieldErrors.length) {
|
|
45
|
-
_lodash.default.set(allValidationErrors, path, fieldErrors);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
setErrors(allValidationErrors);
|
|
49
|
-
return allValidationErrors;
|
|
50
|
-
};
|
|
51
|
-
const checkFormIsValid = _react.default.useCallback(() => {
|
|
52
|
-
return Object.keys(flattenedValidators).every(path => {
|
|
53
|
-
const value = _lodash.default.get(values, path);
|
|
54
|
-
const fieldValidators = _lodash.default.get(flattenedValidators, path) ?? [];
|
|
55
|
-
return fieldValidators.every(validator => !validator(value, values));
|
|
56
|
-
});
|
|
57
|
-
}, [values, flattenedValidators]);
|
|
58
|
-
const getFieldError = name => {
|
|
59
|
-
const fieldErrors = _lodash.default.get(errors, name) ?? [];
|
|
60
|
-
return fieldErrors;
|
|
61
|
-
};
|
|
62
|
-
const setExternalErrors = externalErrors => {
|
|
63
|
-
setErrors(prevStateErrors => {
|
|
64
|
-
const newErrorsState = _lodash.default.cloneDeep(prevStateErrors);
|
|
65
|
-
Object.entries(externalErrors).forEach(_ref2 => {
|
|
66
|
-
let [key, value] = _ref2;
|
|
67
|
-
_lodash.default.set(newErrorsState, key, value);
|
|
68
|
-
});
|
|
69
|
-
return newErrorsState;
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
const getFieldValue = name => {
|
|
73
|
-
return _lodash.default.get(values, name);
|
|
74
|
-
};
|
|
75
|
-
const setFieldValue = (name, value) => {
|
|
76
|
-
setValues(prevStateValues => {
|
|
77
|
-
const updatedValuesState = _lodash.default.cloneDeep(prevStateValues);
|
|
78
|
-
_lodash.default.set(updatedValuesState, name, value);
|
|
79
|
-
const valueToCompare = _lodash.default.get(valuesToCompareInChangedRef.current, name);
|
|
80
|
-
const hasChanged = !_lodash.default.isEqual(valueToCompare, value);
|
|
81
|
-
setChanged(prevStateChanged => {
|
|
82
|
-
const updatedChangedState = _lodash.default.cloneDeep(prevStateChanged);
|
|
83
|
-
_lodash.default.set(updatedChangedState, name, hasChanged);
|
|
84
|
-
return updatedChangedState;
|
|
85
|
-
});
|
|
86
|
-
return updatedValuesState;
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
const setFieldFocus = (name, fieldFocusOptions) => {
|
|
90
|
-
const field = fieldsRef.current[name];
|
|
91
|
-
field?.focus?.();
|
|
92
|
-
if (fieldFocusOptions?.shouldSelect) {
|
|
93
|
-
field?.select?.();
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const compareField = _react.default.useCallback((name, valueToCompare) => {
|
|
97
|
-
return _lodash.default.isEqual(_lodash.default.get(values, name), valueToCompare);
|
|
98
|
-
}, [values]);
|
|
99
|
-
const cleanErrors = fieldsToClean => {
|
|
100
|
-
const newErrorsState = _lodash.default.cloneDeep(errors);
|
|
101
|
-
const fields = fieldsToClean ?? Object.keys(errors);
|
|
102
|
-
fields.forEach(key => {
|
|
103
|
-
_lodash.default.set(newErrorsState, key, []);
|
|
104
|
-
});
|
|
105
|
-
setErrors(newErrorsState);
|
|
106
|
-
};
|
|
107
|
-
const reset = (inputsToReset, internalReset) => {
|
|
108
|
-
const newValuesState = _lodash.default.cloneDeep(values);
|
|
109
|
-
const newTouchedState = _lodash.default.cloneDeep(touched);
|
|
110
|
-
const newChangedState = _lodash.default.cloneDeep(changed);
|
|
111
|
-
const newErrorsState = _lodash.default.cloneDeep(errors);
|
|
112
|
-
const inputs = inputsToReset ?? Object.keys(initialValuesRef.current);
|
|
113
|
-
inputs.forEach(key => {
|
|
114
|
-
const initialValue = _lodash.default.get(initialValuesRef.current, key);
|
|
115
|
-
_lodash.default.set(newValuesState, key, initialValue);
|
|
116
|
-
_lodash.default.set(newTouchedState, key, false);
|
|
117
|
-
_lodash.default.set(newChangedState, key, false);
|
|
118
|
-
_lodash.default.set(newErrorsState, key, []);
|
|
119
|
-
});
|
|
120
|
-
setValues(newValuesState);
|
|
121
|
-
setTouched(newTouchedState);
|
|
122
|
-
setChanged(newChangedState);
|
|
123
|
-
setErrors(newErrorsState);
|
|
124
|
-
if (!internalReset) {
|
|
125
|
-
valuesToCompareInChangedRef.current = initialValuesRef.current;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
const changeValues = _react.default.useCallback(fieldValues => {
|
|
129
|
-
reset(undefined, true);
|
|
130
|
-
setValues(prevStateValues => {
|
|
131
|
-
const newValuesState = (0, _helpers.deepMergeValues)(prevStateValues, fieldValues);
|
|
132
|
-
valuesToCompareInChangedRef.current = newValuesState;
|
|
133
|
-
return newValuesState;
|
|
134
|
-
});
|
|
135
|
-
}, []);
|
|
136
|
-
const register = (name, externalRef) => {
|
|
137
|
-
return {
|
|
138
|
-
name,
|
|
139
|
-
ref: (0, _helpers.mergeRefs)(inputElement => {
|
|
140
|
-
fieldsRef.current[name] = inputElement;
|
|
141
|
-
}, externalRef),
|
|
142
|
-
value: _lodash.default.get(values, name, _lodash.default.get(initialValuesRef.current, name, '')),
|
|
143
|
-
onChange: event => {
|
|
144
|
-
const {
|
|
145
|
-
value
|
|
146
|
-
} = event.target;
|
|
147
|
-
setValues(prevStateValues => {
|
|
148
|
-
const updatedValues = _lodash.default.cloneDeep(prevStateValues);
|
|
149
|
-
_lodash.default.set(updatedValues, name, value);
|
|
150
|
-
const hasChanged = !_lodash.default.isEqual(_lodash.default.get(valuesToCompareInChangedRef.current, name), value);
|
|
151
|
-
setChanged(prevStateChanged => {
|
|
152
|
-
const updatedChangedState = _lodash.default.cloneDeep(prevStateChanged);
|
|
153
|
-
_lodash.default.set(updatedChangedState, name, hasChanged);
|
|
154
|
-
return updatedChangedState;
|
|
155
|
-
});
|
|
156
|
-
if (options.validationMode === 'default' && _lodash.default.get(touched, name)) {
|
|
157
|
-
validateField(name, value);
|
|
158
|
-
}
|
|
159
|
-
return updatedValues;
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
onBlur: () => {
|
|
163
|
-
setTouched(prevStateTouched => {
|
|
164
|
-
const updated = _lodash.default.cloneDeep(prevStateTouched);
|
|
165
|
-
_lodash.default.set(updated, name, true);
|
|
166
|
-
return updated;
|
|
167
|
-
});
|
|
168
|
-
if (options.validationMode === 'default') {
|
|
169
|
-
validateField(name, _lodash.default.get(values, name));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
const handleSubmit = callback => event => {
|
|
175
|
-
event.preventDefault();
|
|
176
|
-
const validationErrors = validateAllFields();
|
|
177
|
-
const hasErrors = !_lodash.default.isEmpty(validationErrors);
|
|
178
|
-
if (hasErrors) return;
|
|
179
|
-
callback(values);
|
|
180
|
-
};
|
|
181
|
-
const isValid = _react.default.useMemo(() => checkFormIsValid(), [checkFormIsValid]);
|
|
182
|
-
return {
|
|
183
|
-
reset,
|
|
184
|
-
changed,
|
|
185
|
-
values,
|
|
186
|
-
errors,
|
|
187
|
-
touched,
|
|
188
|
-
isValid,
|
|
189
|
-
register,
|
|
190
|
-
cleanErrors,
|
|
191
|
-
changeValues,
|
|
192
|
-
compareField,
|
|
193
|
-
handleSubmit,
|
|
194
|
-
getFieldValue,
|
|
195
|
-
getFieldError,
|
|
196
|
-
setFieldFocus,
|
|
197
|
-
setFieldValue,
|
|
198
|
-
setExternalErrors,
|
|
199
|
-
initialValues: initialValuesRef.current
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
var _default = exports.default = useForm;
|
package/lib/index-368f781f.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { DateFieldInputProps } from './inputs2/date/datefield/types.js';
|
|
3
|
-
|
|
4
|
-
declare const Input: React__default.ForwardRefExoticComponent<DateFieldInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
5
|
-
|
|
6
|
-
declare const index_DateFieldInputProps: typeof DateFieldInputProps;
|
|
7
|
-
declare const index_Input: typeof Input;
|
|
8
|
-
declare namespace index {
|
|
9
|
-
export {
|
|
10
|
-
index_DateFieldInputProps as DateFieldInputProps,
|
|
11
|
-
index_Input as Input,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { Input as I, index as i };
|
package/lib/index-3b70931d.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { TextAlign } from './@types/Align.js';
|
|
3
|
-
import { ColorTheme } from './@types/ColorStyles.js';
|
|
4
|
-
import { HintPosition, Position } from './@types/Position.js';
|
|
5
|
-
import { PermissionAttr, OnDenied } from './@types/PermissionAttr.js';
|
|
6
|
-
import { LeftSlot, RightSlot } from './inputs2/slot/index.js';
|
|
7
|
-
import { ITooltipCommonProps } from './tooltip/types.js';
|
|
8
|
-
|
|
9
|
-
interface TextFieldInputProps extends React__default.ComponentPropsWithoutRef<'input'>, ITooltipCommonProps {
|
|
10
|
-
hint?: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
errors?: string[];
|
|
13
|
-
gridLayout?: string;
|
|
14
|
-
customClass?: string;
|
|
15
|
-
customClassLabel?: string;
|
|
16
|
-
customClassWrapper?: string;
|
|
17
|
-
customClassInputContainer?: string;
|
|
18
|
-
rounded?: boolean;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
skeletonize?: boolean;
|
|
21
|
-
labelUppercase?: boolean;
|
|
22
|
-
textAlign?: TextAlign;
|
|
23
|
-
hintPosition?: HintPosition;
|
|
24
|
-
themePopover?: ColorTheme;
|
|
25
|
-
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
26
|
-
permissionAttr?: PermissionAttr;
|
|
27
|
-
onDeniedActions?: OnDenied;
|
|
28
|
-
}
|
|
29
|
-
declare const Input: React__default.ForwardRefExoticComponent<TextFieldInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
30
|
-
|
|
31
|
-
declare const index_Input: typeof Input;
|
|
32
|
-
declare const index_LeftSlot: typeof LeftSlot;
|
|
33
|
-
declare const index_RightSlot: typeof RightSlot;
|
|
34
|
-
type index_TextFieldInputProps = TextFieldInputProps;
|
|
35
|
-
declare namespace index {
|
|
36
|
-
export {
|
|
37
|
-
index_Input as Input,
|
|
38
|
-
index_LeftSlot as LeftSlot,
|
|
39
|
-
index_RightSlot as RightSlot,
|
|
40
|
-
index_TextFieldInputProps as TextFieldInputProps,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { Input as I, TextFieldInputProps as T, index as i };
|
package/lib/index-789dd9a5.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { Size } from './@types/Size.js';
|
|
3
|
-
import { ColorTheme } from './@types/ColorStyles.js';
|
|
4
|
-
import { ITooltipCommonProps } from './tooltip/types.js';
|
|
5
|
-
import { HintPosition, Position } from './@types/Position.js';
|
|
6
|
-
import { PermissionAttr, OnDenied } from './@types/PermissionAttr.js';
|
|
7
|
-
|
|
8
|
-
type InputHTMLProps = Omit<React__default.ComponentProps<'input'>, 'size' | 'type'>;
|
|
9
|
-
interface CheckboxFieldInputProps extends InputHTMLProps, ITooltipCommonProps {
|
|
10
|
-
hint?: string;
|
|
11
|
-
label?: string;
|
|
12
|
-
size?: Exclude<Size, 'mini'>;
|
|
13
|
-
variant?: 'default' | 'secondary';
|
|
14
|
-
errors?: string[];
|
|
15
|
-
gridLayout?: string;
|
|
16
|
-
customClass?: string;
|
|
17
|
-
customClassLabel?: string;
|
|
18
|
-
customClassWrapper?: string;
|
|
19
|
-
customClassInputContainer?: string;
|
|
20
|
-
rounded?: boolean;
|
|
21
|
-
readOnly?: boolean;
|
|
22
|
-
skeletonize?: boolean;
|
|
23
|
-
labelUppercase?: boolean;
|
|
24
|
-
hintPosition?: HintPosition;
|
|
25
|
-
themePopover?: ColorTheme;
|
|
26
|
-
popoverAlign?: Extract<Position, 'left' | 'right'>;
|
|
27
|
-
permissionAttr?: PermissionAttr;
|
|
28
|
-
onDeniedActions?: OnDenied;
|
|
29
|
-
}
|
|
30
|
-
declare const Input: React__default.ForwardRefExoticComponent<Pick<CheckboxFieldInputProps, "className" | "disabled" | "size" | "onClick" | "width" | "height" | "color" | "src" | "children" | "customClass" | "label" | "style" | "id" | "key" | "form" | "slot" | "title" | "pattern" | "name" | "tooltip" | "tooltipPosition" | "tooltipWidth" | "list" | "hidden" | "multiple" | "onKeyPress" | "role" | "tabIndex" | "alt" | "align" | "value" | "readOnly" | "permissionAttr" | "skeletonize" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "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" | "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" | "step" | "labelUppercase" | "maxLength" | "required" | "hint" | "hintPosition" | "rounded" | "onDeniedActions" | "gridLayout" | "accept" | "autoComplete" | "themePopover" | "popoverAlign" | "checked" | "max" | "min" | "errors" | "capture" | "crossOrigin" | "enterKeyHint" | "minLength" | "customClassLabel" | "customClassWrapper" | "customClassInputContainer" | "variant"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
31
|
-
|
|
32
|
-
type index_CheckboxFieldInputProps = CheckboxFieldInputProps;
|
|
33
|
-
declare const index_Input: typeof Input;
|
|
34
|
-
declare namespace index {
|
|
35
|
-
export {
|
|
36
|
-
index_CheckboxFieldInputProps as CheckboxFieldInputProps,
|
|
37
|
-
index_Input as Input,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { CheckboxFieldInputProps as C, Input as I, index as i };
|
package/lib/index-7ad68789.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { RadioFieldInputProps } from './inputs2/radiofield/types.js';
|
|
3
|
-
|
|
4
|
-
declare const Input: React__default.ForwardRefExoticComponent<Pick<RadioFieldInputProps, "className" | "disabled" | "size" | "onClick" | "width" | "height" | "color" | "src" | "children" | "customClass" | "label" | "style" | "id" | "key" | "form" | "slot" | "title" | "pattern" | "name" | "tooltip" | "tooltipPosition" | "tooltipWidth" | "list" | "hidden" | "onKeyPress" | "role" | "tabIndex" | "alt" | "align" | "value" | "readOnly" | "permissionAttr" | "skeletonize" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "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" | "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" | "step" | "labelUppercase" | "maxLength" | "required" | "hint" | "hintPosition" | "textAlign" | "onDeniedActions" | "gridLayout" | "accept" | "autoComplete" | "themePopover" | "popoverAlign" | "checked" | "max" | "min" | "errors" | "capture" | "crossOrigin" | "enterKeyHint" | "minLength" | "customClassLabel" | "customClassWrapper" | "customClassInputContainer" | "getFieldValue"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
5
|
-
|
|
6
|
-
declare const index_Input: typeof Input;
|
|
7
|
-
declare const index_RadioFieldInputProps: typeof RadioFieldInputProps;
|
|
8
|
-
declare namespace index {
|
|
9
|
-
export {
|
|
10
|
-
index_Input as Input,
|
|
11
|
-
index_RadioFieldInputProps as RadioFieldInputProps,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { Input as I, index as i };
|