linear-react-components-ui 1.1.20-beta.2 → 1.1.20-beta.21
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/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +1 -1
- package/lib/assets/styles/input.scss +2 -2
- package/lib/assets/styles/popover.scss +3 -0
- package/lib/assets/styles/select.scss +2 -1
- package/lib/assets/styles/wizard.scss +125 -0
- package/lib/avatar/index.js +9 -8
- package/lib/badge/index.js +4 -4
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +13 -3
- 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 +1 -1
- package/lib/calendar/base/Day.js +1 -1
- package/lib/calendar/base/Month.js +1 -1
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +1 -1
- package/lib/checkbox/index.js +46 -19
- package/lib/checkbox/types.d.ts +4 -0
- package/lib/dialog/Custom.js +4 -2
- package/lib/dialog/Question.js +18 -2
- package/lib/dialog/base/Content.d.ts +1 -1
- package/lib/dialog/base/Content.js +3 -2
- package/lib/dialog/base/Header.js +2 -2
- package/lib/dialog/base/index.js +8 -9
- package/lib/dialog/form/index.js +8 -3
- package/lib/dialog/types.d.ts +38 -4
- package/lib/dialog/wizard/index.d.ts +13 -0
- package/lib/dialog/wizard/index.js +74 -0
- package/lib/dialog/wizard/progressbar.d.ts +13 -0
- package/lib/dialog/wizard/progressbar.js +36 -0
- package/lib/dialog/wizard/step.d.ts +9 -0
- package/lib/dialog/wizard/step.js +22 -0
- package/lib/dialog/wizard/useWizard.d.ts +9 -0
- package/lib/dialog/wizard/useWizard.js +48 -0
- package/lib/drawer/Drawer.js +3 -3
- package/lib/drawer/Header.js +1 -1
- package/lib/dropdown/Popup.js +6 -6
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/withDropdown.js +2 -2
- package/lib/fieldset/index.js +7 -7
- package/lib/form/FieldArray.js +1 -1
- package/lib/form/FieldNumber.js +4 -4
- package/lib/form/FieldPeriod.js +2 -2
- package/lib/form/index.js +2 -2
- package/lib/form/types.d.ts +14 -1
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +4 -1
- package/lib/hint/index.js +7 -1
- package/lib/icons/helper.d.ts +8 -0
- package/lib/icons/helper.js +8 -0
- package/lib/icons/index.js +24 -27
- package/lib/inputs/base/InputTextBase.js +41 -16
- package/lib/inputs/base/Label.js +1 -1
- package/lib/inputs/base/helpers.js +7 -3
- package/lib/inputs/base/types.d.ts +3 -0
- package/lib/inputs/color/types.d.ts +5 -0
- package/lib/inputs/date/helpers.js +4 -1
- package/lib/inputs/date/index.js +9 -15
- package/lib/inputs/date/types.d.ts +4 -0
- package/lib/inputs/errorMessage/index.js +1 -1
- package/lib/inputs/file/DefaultFile.js +5 -6
- package/lib/inputs/file/DragDropFile.js +17 -18
- package/lib/inputs/file/File.js +3 -4
- package/lib/inputs/file/types.d.ts +3 -0
- package/lib/inputs/mask/BaseMask.js +1 -1
- package/lib/inputs/mask/helpers.d.ts +4 -0
- package/lib/inputs/mask/types.d.ts +4 -0
- package/lib/inputs/multiSelect/Dropdown.js +9 -10
- package/lib/inputs/multiSelect/helper.js +1 -2
- package/lib/inputs/multiSelect/index.js +7 -9
- package/lib/inputs/multiSelect/types.d.ts +4 -0
- 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/index.js +7 -3
- package/lib/inputs/number/types.d.ts +14 -2
- package/lib/inputs/period/PeriodList.js +1 -1
- package/lib/inputs/period/helper.js +3 -1
- package/lib/inputs/period/index.js +40 -18
- package/lib/inputs/period/types.d.ts +3 -0
- package/lib/inputs/search/index.js +1 -1
- package/lib/inputs/select/Dropdown.js +1 -1
- package/lib/inputs/select/helper.js +10 -13
- package/lib/inputs/select/multiple/Selecteds.js +1 -1
- package/lib/inputs/select/multiple/index.js +22 -18
- package/lib/inputs/select/simple/index.js +15 -20
- package/lib/inputs/select/types.d.ts +7 -0
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/internals/withTooltip.js +9 -9
- package/lib/labelMessages/index.js +4 -3
- package/lib/labels/DefaultLabel.js +4 -1
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.d.ts +1 -0
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.d.ts +6 -2
- package/lib/list/Item.js +24 -10
- package/lib/list/helpers.d.ts +1 -0
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +3 -2
- package/lib/list/types.d.ts +6 -0
- package/lib/menus/float/MenuItem.js +2 -2
- package/lib/menus/float/SubMenuContainer.js +1 -1
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/NavMenuGroup.js +1 -1
- package/lib/menus/sidenav/NavMenuItem.js +7 -9
- package/lib/menus/sidenav/NavSubMenuItem.js +1 -1
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +5 -5
- package/lib/panel/Content.js +5 -7
- package/lib/panel/Default.js +2 -2
- package/lib/panel/Header.js +3 -3
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/index.js +4 -6
- package/lib/popover/types.d.ts +2 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.d.ts +1 -1
- package/lib/radio/index.js +36 -5
- package/lib/radio/types.d.ts +8 -1
- package/lib/shortcuts/index.js +1 -1
- package/lib/skeleton/SkeletonContainer.js +2 -1
- package/lib/skeleton/index.js +4 -1
- package/lib/spinner/index.js +2 -2
- package/lib/split/Split.js +1 -1
- package/lib/split/SplitSide.js +3 -3
- package/lib/table/Body.js +3 -3
- package/lib/table/Header.js +8 -11
- package/lib/table/HeaderColumn.js +7 -7
- package/lib/table/Row.js +3 -3
- package/lib/table/RowColumn.js +1 -1
- package/lib/table/index.js +6 -1
- package/lib/table/types.d.ts +0 -2
- package/lib/tabs/DropdownTabs.js +1 -1
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuTabs.js +2 -2
- package/lib/tabs/Panel.js +5 -7
- package/lib/tabs/context.js +3 -6
- package/lib/textContent/index.d.ts +18 -4
- package/lib/textContent/index.js +15 -5
- package/lib/toolbar/ButtonBar.js +1 -1
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/index.js +7 -7
- package/lib/treetable/Body.js +1 -1
- package/lib/treetable/Header.js +2 -2
- package/lib/treetable/Row.js +10 -13
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -5
- package/lib/treeview/index.js +4 -4
- package/lib/uitour/index.js +6 -8
- package/package.json +1 -1
- package/lib/checkbox/Label.d.ts +0 -11
- package/lib/checkbox/Label.js +0 -31
package/lib/dialog/base/index.js
CHANGED
|
@@ -21,7 +21,8 @@ const BaseDialog = props => {
|
|
|
21
21
|
overlay = true,
|
|
22
22
|
closeOnEsc,
|
|
23
23
|
closeOnOutsideClick,
|
|
24
|
-
wrapperClassName,
|
|
24
|
+
wrapperClassName = '',
|
|
25
|
+
className = '',
|
|
25
26
|
children,
|
|
26
27
|
open: openProp,
|
|
27
28
|
onOpenChange,
|
|
@@ -42,9 +43,7 @@ const BaseDialog = props => {
|
|
|
42
43
|
onOpenChange(false);
|
|
43
44
|
} else {
|
|
44
45
|
if (handlerClose) handlerClose();
|
|
45
|
-
if (onOpenChange)
|
|
46
|
-
onOpenChange(false);
|
|
47
|
-
}
|
|
46
|
+
if (onOpenChange) onOpenChange(false);
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
49
|
const handleClickOutside = event => {
|
|
@@ -56,7 +55,8 @@ const BaseDialog = props => {
|
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
57
|
const handleCloseOnEsc = event => {
|
|
59
|
-
if (event
|
|
58
|
+
if (event?.key === 'Escape') {
|
|
59
|
+
event.stopPropagation();
|
|
60
60
|
handleClose();
|
|
61
61
|
}
|
|
62
62
|
};
|
|
@@ -74,7 +74,7 @@ const BaseDialog = props => {
|
|
|
74
74
|
let y = positionY <= 0 ? 0 : positionY;
|
|
75
75
|
if (x + width >= window.innerWidth) x = window.innerWidth - width;
|
|
76
76
|
if (y + height >= window.innerHeight) y = window.innerHeight - height;
|
|
77
|
-
wrapperEl.current.style.transform =
|
|
77
|
+
wrapperEl.current.style.transform = `translate(${x}px, ${y}px)`;
|
|
78
78
|
wrapperEl.current.style.transition = 'none';
|
|
79
79
|
wrapperEl.current.style.left = '0';
|
|
80
80
|
wrapperEl.current.style.top = '0';
|
|
@@ -94,9 +94,8 @@ const BaseDialog = props => {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
const onMouseDown = event => {
|
|
97
|
-
var _headerRef$current;
|
|
98
97
|
const element = event.target;
|
|
99
|
-
const isHeader = headerRef
|
|
98
|
+
const isHeader = headerRef?.current?.contains(element);
|
|
100
99
|
if (wrapperEl.current && isHeader) setIsDragging(true);
|
|
101
100
|
};
|
|
102
101
|
const onMouseUp = () => {
|
|
@@ -112,7 +111,7 @@ const BaseDialog = props => {
|
|
|
112
111
|
className: "modal-overlay",
|
|
113
112
|
"data-testid": "modal-overlay"
|
|
114
113
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
115
|
-
className:
|
|
114
|
+
className: `dialog ${className}`,
|
|
116
115
|
"data-testid": "dialog-component"
|
|
117
116
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
118
117
|
className: wrapperClassName,
|
package/lib/dialog/form/index.js
CHANGED
|
@@ -29,7 +29,10 @@ const ModalForm = props => {
|
|
|
29
29
|
width = '50%',
|
|
30
30
|
height = '50%',
|
|
31
31
|
content,
|
|
32
|
-
children
|
|
32
|
+
children,
|
|
33
|
+
className = '',
|
|
34
|
+
wrapperClassName = '',
|
|
35
|
+
contentClassName = ''
|
|
33
36
|
} = props;
|
|
34
37
|
const headerRef = (0, _react.useRef)(null);
|
|
35
38
|
const context = (0, _react.useContext)(_withFormSecurity.FormSecurityContext);
|
|
@@ -56,7 +59,8 @@ const ModalForm = props => {
|
|
|
56
59
|
width: width,
|
|
57
60
|
height: height
|
|
58
61
|
}, props, {
|
|
59
|
-
wrapperClassName:
|
|
62
|
+
wrapperClassName: `dialog-form-wrapper ${wrapperClassName}`,
|
|
63
|
+
className: className
|
|
60
64
|
}), props.title && /*#__PURE__*/_react.default.createElement("div", {
|
|
61
65
|
className: "header-form"
|
|
62
66
|
}, /*#__PURE__*/_react.default.createElement(_Header.default, {
|
|
@@ -64,7 +68,8 @@ const ModalForm = props => {
|
|
|
64
68
|
handlerClose: props.handlerClose,
|
|
65
69
|
icon: props.icon
|
|
66
70
|
})), /*#__PURE__*/_react.default.createElement(_Content.default, {
|
|
67
|
-
styleForContent: _objectSpread(_objectSpread({}, props.styleForContent), overlayStyle)
|
|
71
|
+
styleForContent: _objectSpread(_objectSpread({}, props.styleForContent), overlayStyle),
|
|
72
|
+
className: contentClassName
|
|
68
73
|
}, content || children), getSpinner(), showFooter && props.buttons && /*#__PURE__*/_react.default.createElement(_Footer.default, null, /*#__PURE__*/_react.default.createElement(_index.ButtonContainer, _extends({}, props, {
|
|
69
74
|
style: _objectSpread({}, overlayStyle)
|
|
70
75
|
}), _react.default.Children.toArray(props.buttons.map(button => {
|
package/lib/dialog/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties, ReactElement } from 'react';
|
|
1
|
+
import { ReactNode, CSSProperties, ReactElement, Dispatch } from 'react';
|
|
2
2
|
import { TextAlign } from '../@types/Align.js';
|
|
3
3
|
import { IconNames } from '../@types/Icon.js';
|
|
4
4
|
import '../icons/helper.js';
|
|
@@ -6,6 +6,7 @@ import '../icons/helper.js';
|
|
|
6
6
|
interface IContentProps {
|
|
7
7
|
children: ReactNode | ReactNode[];
|
|
8
8
|
styleForContent?: CSSProperties;
|
|
9
|
+
className?: string;
|
|
9
10
|
}
|
|
10
11
|
interface IFooterProps {
|
|
11
12
|
children: ReactElement | ReactElement[];
|
|
@@ -18,10 +19,11 @@ interface IHeaderProps {
|
|
|
18
19
|
titleIcon?: IconNames;
|
|
19
20
|
}
|
|
20
21
|
interface IBaseProps {
|
|
21
|
-
wrapperClassName
|
|
22
|
+
wrapperClassName?: string;
|
|
22
23
|
width?: string;
|
|
23
24
|
height?: string;
|
|
24
25
|
children: ReactNode | ReactNode[];
|
|
26
|
+
className?: string;
|
|
25
27
|
closeOnEsc?: boolean;
|
|
26
28
|
closeOnOutsideClick?: boolean;
|
|
27
29
|
overlay?: boolean;
|
|
@@ -31,7 +33,7 @@ interface IBaseProps {
|
|
|
31
33
|
onOpenChange?: (open: boolean) => void;
|
|
32
34
|
handlerClose?: () => void;
|
|
33
35
|
}
|
|
34
|
-
interface IFormProps extends Omit<IBaseProps, 'textAlign' | 'zIndex'
|
|
36
|
+
interface IFormProps extends Omit<IBaseProps, 'textAlign' | 'zIndex'> {
|
|
35
37
|
buttons?: JSX.Element[];
|
|
36
38
|
styleForContent?: CSSProperties;
|
|
37
39
|
title?: string;
|
|
@@ -39,6 +41,7 @@ interface IFormProps extends Omit<IBaseProps, 'textAlign' | 'zIndex' | 'wrapperC
|
|
|
39
41
|
isWaiting?: boolean;
|
|
40
42
|
icon?: JSX.Element;
|
|
41
43
|
content?: ReactNode;
|
|
44
|
+
contentClassName?: string;
|
|
42
45
|
}
|
|
43
46
|
interface ICommonDialogProps {
|
|
44
47
|
onConfirmClick?: () => void;
|
|
@@ -53,6 +56,7 @@ interface IQuestionProps {
|
|
|
53
56
|
text?: string;
|
|
54
57
|
title?: string;
|
|
55
58
|
zIndex?: number | string;
|
|
59
|
+
closeOnEsc?: boolean;
|
|
56
60
|
}
|
|
57
61
|
interface ICustomProps {
|
|
58
62
|
icon: ReactElement;
|
|
@@ -62,9 +66,39 @@ interface ICustomProps {
|
|
|
62
66
|
height?: string;
|
|
63
67
|
width?: string;
|
|
64
68
|
iconName?: IconNames | null;
|
|
69
|
+
open?: boolean;
|
|
70
|
+
closeOnEsc?: boolean;
|
|
71
|
+
handlerClose?: () => void;
|
|
65
72
|
}
|
|
66
73
|
interface IFormDialogContext {
|
|
67
74
|
headerRef?: React.RefObject<HTMLDivElement>;
|
|
68
75
|
}
|
|
76
|
+
interface WizardComponentProps extends Omit<IFormProps, 'content'> {
|
|
77
|
+
children: React.ReactNode;
|
|
78
|
+
buttons?: JSX.Element[];
|
|
79
|
+
showProgressbar?: boolean;
|
|
80
|
+
title?: string;
|
|
81
|
+
handlerClose?: () => void;
|
|
82
|
+
controls: WizardControls;
|
|
83
|
+
}
|
|
84
|
+
interface WizardStepComponentProps {
|
|
85
|
+
children: React.ReactNode;
|
|
86
|
+
title: string;
|
|
87
|
+
customClass?: string;
|
|
88
|
+
customStyle?: CSSProperties;
|
|
89
|
+
}
|
|
90
|
+
interface WizardControls extends Omit<UseWizardReturn, 'controls'> {
|
|
91
|
+
setTotalSteps: Dispatch<React.SetStateAction<number>>;
|
|
92
|
+
}
|
|
93
|
+
interface UseWizardReturn {
|
|
94
|
+
changeStep: (nextStep: number) => void;
|
|
95
|
+
nextStep: () => void;
|
|
96
|
+
hasNextStep: boolean;
|
|
97
|
+
previousStep: () => void;
|
|
98
|
+
hasPreviousStep: boolean;
|
|
99
|
+
currentStep: number;
|
|
100
|
+
totalSteps: number;
|
|
101
|
+
controls: WizardControls;
|
|
102
|
+
}
|
|
69
103
|
|
|
70
|
-
export { IBaseProps, ICommonDialogProps, IContentProps, ICustomProps, IFooterProps, IFormDialogContext, IFormProps, IHeaderProps, IQuestionProps };
|
|
104
|
+
export { IBaseProps, ICommonDialogProps, IContentProps, ICustomProps, IFooterProps, IFormDialogContext, IFormProps, IHeaderProps, IQuestionProps, UseWizardReturn, WizardComponentProps, WizardControls, WizardStepComponentProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { WizardControls, WizardComponentProps } from '../types.js';
|
|
3
|
+
export { WizardStep as Step } from './step.js';
|
|
4
|
+
export { useWizard } from './useWizard.js';
|
|
5
|
+
import '../../@types/Align.js';
|
|
6
|
+
import '../../@types/Icon.js';
|
|
7
|
+
import '../../icons/helper.js';
|
|
8
|
+
|
|
9
|
+
declare const WizardContext: React__default.Context<WizardControls | null>;
|
|
10
|
+
declare const useWizardContext: () => WizardControls | null;
|
|
11
|
+
declare function Wizard({ children, controls, showProgressbar, ...dialogProps }: Readonly<WizardComponentProps>): JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Wizard as Container, WizardContext, Wizard as default, useWizardContext };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Container = Wizard;
|
|
7
|
+
Object.defineProperty(exports, "Step", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _step.WizardStep;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.default = exports.WizardContext = void 0;
|
|
14
|
+
Object.defineProperty(exports, "useWizard", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _useWizard.useWizard;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
exports.useWizardContext = void 0;
|
|
21
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
22
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
23
|
+
var _form = _interopRequireDefault(require("../form/"));
|
|
24
|
+
var _progressbar = require("./progressbar");
|
|
25
|
+
require("../../assets/styles/wizard.scss");
|
|
26
|
+
var _step = require("./step");
|
|
27
|
+
var _useWizard = require("./useWizard");
|
|
28
|
+
const _excluded = ["children", "controls", "showProgressbar"];
|
|
29
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
31
|
+
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; }
|
|
32
|
+
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); }
|
|
33
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
34
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
35
|
+
const WizardContext = exports.WizardContext = /*#__PURE__*/_react.default.createContext(null);
|
|
36
|
+
const useWizardContext = () => _react.default.useContext(WizardContext);
|
|
37
|
+
exports.useWizardContext = useWizardContext;
|
|
38
|
+
function Wizard(_ref) {
|
|
39
|
+
let {
|
|
40
|
+
children,
|
|
41
|
+
controls,
|
|
42
|
+
showProgressbar = true
|
|
43
|
+
} = _ref,
|
|
44
|
+
dialogProps = _objectWithoutProperties(_ref, _excluded);
|
|
45
|
+
const {
|
|
46
|
+
currentStep,
|
|
47
|
+
setTotalSteps
|
|
48
|
+
} = controls;
|
|
49
|
+
const steps = _react.default.Children.toArray(children);
|
|
50
|
+
const stepsTitle = steps.map((step, index) => {
|
|
51
|
+
return {
|
|
52
|
+
title: String(step.props.title),
|
|
53
|
+
number: index + 1,
|
|
54
|
+
completed: index < currentStep - 1 && index !== currentStep
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
const currentStepElement = steps[currentStep - 1];
|
|
58
|
+
if (!controls || _lodash.default.isEmpty(controls)) throw new Error('Wizard must be have controls by using useWizard hook or creating manually.');
|
|
59
|
+
(0, _react.useEffect)(() => {
|
|
60
|
+
setTotalSteps(steps.length);
|
|
61
|
+
}, [steps.length]);
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(WizardContext.Provider, {
|
|
63
|
+
value: controls
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement(_form.default, _extends({
|
|
65
|
+
className: "wizard-dialog",
|
|
66
|
+
wrapperClassName: "wizard-wrapper",
|
|
67
|
+
contentClassName: "wizard-content"
|
|
68
|
+
}, dialogProps), showProgressbar && /*#__PURE__*/_react.default.createElement(_progressbar.Progressbar, {
|
|
69
|
+
stepsTitle: stepsTitle
|
|
70
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
71
|
+
className: "wizard-body"
|
|
72
|
+
}, currentStepElement)));
|
|
73
|
+
}
|
|
74
|
+
var _default = exports.default = Wizard;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
declare function Progressbar({ customClass, customStyle, stepsTitle }: Readonly<{
|
|
4
|
+
customClass?: string;
|
|
5
|
+
stepsTitle: {
|
|
6
|
+
title: string;
|
|
7
|
+
number: number;
|
|
8
|
+
completed: boolean;
|
|
9
|
+
}[];
|
|
10
|
+
customStyle?: CSSProperties;
|
|
11
|
+
}>): JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { Progressbar };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Progressbar = Progressbar;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = require(".");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function Progressbar(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
customClass,
|
|
13
|
+
customStyle,
|
|
14
|
+
stepsTitle
|
|
15
|
+
} = _ref;
|
|
16
|
+
const context = (0, _.useWizardContext)();
|
|
17
|
+
if (!context) throw new Error('WizardProgressbar must be used within a Wizard component');
|
|
18
|
+
const {
|
|
19
|
+
currentStep
|
|
20
|
+
} = context;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
+
className: `wizard-progresbar ${customClass}`,
|
|
23
|
+
style: customStyle
|
|
24
|
+
}, stepsTitle.map(step => /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
key: step.number,
|
|
26
|
+
className: "title",
|
|
27
|
+
"data-completed": step.completed,
|
|
28
|
+
"data-disabled": step.number > currentStep
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
+
className: "step"
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
32
|
+
className: "number"
|
|
33
|
+
}, step.number)), /*#__PURE__*/_react.default.createElement("span", {
|
|
34
|
+
className: "step-title"
|
|
35
|
+
}, step.title))));
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WizardStepComponentProps } from '../types.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../../@types/Align.js';
|
|
4
|
+
import '../../@types/Icon.js';
|
|
5
|
+
import '../../icons/helper.js';
|
|
6
|
+
|
|
7
|
+
declare function WizardStep({ children, customClass, customStyle }: Readonly<WizardStepComponentProps>): JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { WizardStep };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WizardStep = WizardStep;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ = require(".");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function WizardStep(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
customClass = '',
|
|
14
|
+
customStyle
|
|
15
|
+
} = _ref;
|
|
16
|
+
const context = (0, _.useWizardContext)();
|
|
17
|
+
if (!context) throw new Error('WizardStep must be used within a Wizard component');
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
19
|
+
className: `wizard-step-component ${customClass}`,
|
|
20
|
+
style: customStyle
|
|
21
|
+
}, children);
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWizard = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
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
|
+
const useWizard = () => {
|
|
11
|
+
const [totalSteps, setTotalSteps] = (0, _react.useState)(0);
|
|
12
|
+
const [currentStep, setCurrentStep] = _react.default.useState(1);
|
|
13
|
+
const hasNextStep = currentStep < totalSteps;
|
|
14
|
+
const hasPreviousStep = currentStep > 1;
|
|
15
|
+
const changeStep = nextStep => {
|
|
16
|
+
setCurrentStep(state => state + nextStep);
|
|
17
|
+
};
|
|
18
|
+
const nextStep = () => {
|
|
19
|
+
if (hasNextStep) {
|
|
20
|
+
changeStep(1);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const previousStep = () => {
|
|
24
|
+
if (hasPreviousStep) {
|
|
25
|
+
changeStep(-1);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
changeStep,
|
|
30
|
+
nextStep,
|
|
31
|
+
hasNextStep,
|
|
32
|
+
previousStep,
|
|
33
|
+
hasPreviousStep,
|
|
34
|
+
currentStep,
|
|
35
|
+
totalSteps,
|
|
36
|
+
controls: {
|
|
37
|
+
changeStep,
|
|
38
|
+
nextStep,
|
|
39
|
+
hasNextStep,
|
|
40
|
+
previousStep,
|
|
41
|
+
hasPreviousStep,
|
|
42
|
+
currentStep,
|
|
43
|
+
totalSteps,
|
|
44
|
+
setTotalSteps
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.useWizard = useWizard;
|
package/lib/drawer/Drawer.js
CHANGED
|
@@ -83,7 +83,7 @@ const BaseDrawer = _ref => {
|
|
|
83
83
|
};
|
|
84
84
|
const closeDrawerOnEsc = e => {
|
|
85
85
|
if (closeOnEsc && e.key === 'Escape') {
|
|
86
|
-
handlerClose
|
|
86
|
+
handlerClose?.();
|
|
87
87
|
e.stopPropagation();
|
|
88
88
|
}
|
|
89
89
|
};
|
|
@@ -124,12 +124,12 @@ const BaseDrawer = _ref => {
|
|
|
124
124
|
value: contextValues
|
|
125
125
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
126
126
|
"data-testid": "drawercontainer-component",
|
|
127
|
-
className:
|
|
127
|
+
className: `${position} ${customClass}`,
|
|
128
128
|
style: style
|
|
129
129
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
130
130
|
style: overlayStyle,
|
|
131
131
|
"data-testid": "drawercontent",
|
|
132
|
-
className:
|
|
132
|
+
className: `drawercontent ${skeletonize ? '-skeletonized' : ''} ${customClassForContent}`
|
|
133
133
|
}, title && /*#__PURE__*/_react.default.createElement(_.DrawerHeader, _extends({}, headerProps, {
|
|
134
134
|
customClass: customClassForDrawer
|
|
135
135
|
})), content ? /*#__PURE__*/_react.default.createElement(_.DrawerContent, null, content) : children, getSpinner())));
|
package/lib/drawer/Header.js
CHANGED
|
@@ -61,7 +61,7 @@ const Header = _ref => {
|
|
|
61
61
|
};
|
|
62
62
|
const checkHandlerClose = () => handlerClose ? handlerClose() : undefined;
|
|
63
63
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
64
|
-
className:
|
|
64
|
+
className: `drawerheader ${customClass}`,
|
|
65
65
|
"data-testid": "drawerheader"
|
|
66
66
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
67
67
|
className: "left"
|
package/lib/dropdown/Popup.js
CHANGED
|
@@ -20,11 +20,11 @@ const getCalendarDropdownStyle = _ref => {
|
|
|
20
20
|
isFloatMenu,
|
|
21
21
|
minWidth
|
|
22
22
|
} = _ref;
|
|
23
|
-
let style =
|
|
23
|
+
let style = `top: ${topPosition + (isFloatMenu ? 6 : 2)}px; min-width: ${minWidth}px;`;
|
|
24
24
|
if (align === 'left') {
|
|
25
|
-
style +=
|
|
25
|
+
style += `left: ${leftPosition}px;`;
|
|
26
26
|
} else if (align === 'right') {
|
|
27
|
-
style +=
|
|
27
|
+
style += `right: ${rightPosition}px;`;
|
|
28
28
|
}
|
|
29
29
|
return style;
|
|
30
30
|
};
|
|
@@ -42,7 +42,7 @@ const DropdownPopup = _ref2 => {
|
|
|
42
42
|
} = _ref2,
|
|
43
43
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
44
44
|
const popup = (0, _react.useRef)(document.createElement('div'));
|
|
45
|
-
popup.current.className =
|
|
45
|
+
popup.current.className = `dropdown-component ${customClassForDropdown}`;
|
|
46
46
|
popup.current.dataset.testid = 'dropdown-component';
|
|
47
47
|
popup.current.style.cssText = getCalendarDropdownStyle({
|
|
48
48
|
topPosition,
|
|
@@ -55,11 +55,11 @@ const DropdownPopup = _ref2 => {
|
|
|
55
55
|
if (popup && popup.current) {
|
|
56
56
|
const modalContainers = document.body.getElementsByClassName('modalcontainer');
|
|
57
57
|
const lastModalContainer = modalContainers[modalContainers.length - 1];
|
|
58
|
-
popup.current.style.zIndex =
|
|
58
|
+
popup.current.style.zIndex = `${modalContainers.length ? Number(lastModalContainer.style.zIndex) + 1 : 99999}`;
|
|
59
59
|
}
|
|
60
60
|
(0, _react.useEffect)(() => {
|
|
61
61
|
body.appendChild(popup.current);
|
|
62
|
-
popup.current.id = id ||
|
|
62
|
+
popup.current.id = id || `dropdown-component-${(0, _uuid.v1)()}`;
|
|
63
63
|
return () => {
|
|
64
64
|
body.removeChild(popup.current);
|
|
65
65
|
};
|
package/lib/dropdown/helper.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getDropdownItemCssClass = exports.contentClass = void 0;
|
|
7
|
-
const contentClass = showClearButton =>
|
|
7
|
+
const contentClass = showClearButton => `content ${showClearButton ? '' : 'noclear'}`;
|
|
8
8
|
exports.contentClass = contentClass;
|
|
9
9
|
const getDropdownItemCssClass = (selected, disabled, striped) => {
|
|
10
10
|
let className = 'item';
|
|
@@ -38,7 +38,7 @@ const withDropdown = WrappedComponent => {
|
|
|
38
38
|
const {
|
|
39
39
|
target
|
|
40
40
|
} = event;
|
|
41
|
-
if (popupRef
|
|
41
|
+
if (popupRef?.current && target !== popupRef?.current && !event.composedPath().includes(popupRef.current) && wrappedComponentRef.current !== target) {
|
|
42
42
|
setOpened(false);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
@@ -86,7 +86,7 @@ const withDropdown = WrappedComponent => {
|
|
|
86
86
|
value: contextValues
|
|
87
87
|
}, /*#__PURE__*/_react.default.createElement(WrappedComponent, _extends({}, props, newProps)));
|
|
88
88
|
};
|
|
89
|
-
EnhancedComponent.displayName =
|
|
89
|
+
EnhancedComponent.displayName = `withDropdown(${getDisplayName(WrappedComponent)})`;
|
|
90
90
|
return EnhancedComponent;
|
|
91
91
|
};
|
|
92
92
|
var _default = exports.default = withDropdown;
|
package/lib/fieldset/index.js
CHANGED
|
@@ -43,9 +43,9 @@ const Fieldset = props => {
|
|
|
43
43
|
customClass,
|
|
44
44
|
hasError
|
|
45
45
|
} = _ref;
|
|
46
|
-
let cssClass =
|
|
47
|
-
if (type) cssClass =
|
|
48
|
-
if (hasError) cssClass =
|
|
46
|
+
let cssClass = `fieldset-component ${customClass}`;
|
|
47
|
+
if (type) cssClass = `${cssClass} -${type}`;
|
|
48
|
+
if (hasError) cssClass = `${cssClass} -witherror`;
|
|
49
49
|
return cssClass;
|
|
50
50
|
};
|
|
51
51
|
const getContentStyle = _ref2 => {
|
|
@@ -55,11 +55,11 @@ const Fieldset = props => {
|
|
|
55
55
|
} = _ref2;
|
|
56
56
|
if (template === 'rows') {
|
|
57
57
|
return {
|
|
58
|
-
gridTemplateRows:
|
|
58
|
+
gridTemplateRows: `repeat(${rowsCount}, 1fr)`
|
|
59
59
|
};
|
|
60
60
|
} else if (template === 'columns') {
|
|
61
61
|
return {
|
|
62
|
-
gridTemplateColumns:
|
|
62
|
+
gridTemplateColumns: `repeat(${colsCount}, 1fr)`
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
return {};
|
|
@@ -70,9 +70,9 @@ const Fieldset = props => {
|
|
|
70
70
|
}, onDenied.hideContent ? /*#__PURE__*/_react.default.createElement(_noPermission.default, null) : /*#__PURE__*/_react.default.createElement(_react.Fragment, null, title && /*#__PURE__*/_react.default.createElement("legend", {
|
|
71
71
|
style: styleTitle,
|
|
72
72
|
align: titleAlign,
|
|
73
|
-
className:
|
|
73
|
+
className: `legend ${titleCustomClass}`
|
|
74
74
|
}, leftElements, title, rightElements), /*#__PURE__*/_react.default.createElement("div", {
|
|
75
|
-
className:
|
|
75
|
+
className: `contentfieldset -template${template} `,
|
|
76
76
|
style: Object.assign(getContentStyle(props), styleContent)
|
|
77
77
|
}, children)));
|
|
78
78
|
if (onDenied.unvisible) return null;
|
package/lib/form/FieldArray.js
CHANGED
|
@@ -77,7 +77,7 @@ const FieldArray = props => {
|
|
|
77
77
|
if (!skipLabel && label) {
|
|
78
78
|
content = /*#__PURE__*/_react.default.createElement(_fieldset.default, {
|
|
79
79
|
title: label,
|
|
80
|
-
customClass:
|
|
80
|
+
customClass: `arraycontainer ${bordered && '-bordered'}`,
|
|
81
81
|
style: labelContainerStyle,
|
|
82
82
|
titleCustomClass: "label"
|
|
83
83
|
}, /*#__PURE__*/_react.default.createElement(Component, _extends({}, rest, getDefaultProps(props), {
|
package/lib/form/FieldNumber.js
CHANGED
|
@@ -31,24 +31,24 @@ const getEventProps = _ref => {
|
|
|
31
31
|
} = _ref;
|
|
32
32
|
return {
|
|
33
33
|
onBlur: e => {
|
|
34
|
-
if (handlerFieldChange) handlerFieldChange(e);
|
|
34
|
+
if (component?.name !== 'NumberField' && handlerFieldChange) handlerFieldChange(e);
|
|
35
35
|
if (validators && handlerFieldValidate) handlerFieldValidate(name, e.target.value, validators);
|
|
36
36
|
if (onBlur) onBlur(e);
|
|
37
37
|
},
|
|
38
38
|
onKeyDown: e => {
|
|
39
39
|
if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
|
|
40
|
-
if (validators) handlerFieldValidate
|
|
40
|
+
if (validators) handlerFieldValidate?.(name, e.target.value, validators);
|
|
41
41
|
if (onKeyDown) onKeyDown(e);
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
onChange: e => {
|
|
45
|
-
if (
|
|
45
|
+
if (component?.name === 'NumberField') {
|
|
46
46
|
if (validators && e.target && handlerFieldValidate) {
|
|
47
47
|
handlerFieldValidate(name, e.target.value, validators);
|
|
48
48
|
}
|
|
49
49
|
if (handlerFieldChange) handlerFieldChange(e);
|
|
50
|
-
if (onChange) onChange(e);
|
|
51
50
|
}
|
|
51
|
+
if (onChange) onChange(e);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
};
|
package/lib/form/FieldPeriod.js
CHANGED
|
@@ -79,8 +79,8 @@ const FieldPeriod = props => {
|
|
|
79
79
|
});
|
|
80
80
|
},
|
|
81
81
|
value: {
|
|
82
|
-
initial: _lodash.default.get(data,
|
|
83
|
-
final: _lodash.default.get(data,
|
|
82
|
+
initial: _lodash.default.get(data, `${name}.${nameDateInitial}`),
|
|
83
|
+
final: _lodash.default.get(data, `${name}.${nameDateFinal}`)
|
|
84
84
|
}
|
|
85
85
|
}));
|
|
86
86
|
}
|
package/lib/form/index.js
CHANGED
|
@@ -237,7 +237,7 @@ const Form = _ref => {
|
|
|
237
237
|
}
|
|
238
238
|
}, [submitOnPressEnterKey]);
|
|
239
239
|
(0, _react.useEffect)(() => {
|
|
240
|
-
const validatorsQuantity = Object.values(fieldsValidators.current).reduce((acc, currentValue) => acc + (
|
|
240
|
+
const validatorsQuantity = Object.values(fieldsValidators.current).reduce((acc, currentValue) => acc + (currentValue?.length || 0), 0);
|
|
241
241
|
if (fieldsValidators.current && onValidateForm && oldFieldsValidatorsQuantity !== validatorsQuantity) {
|
|
242
242
|
setOldFieldsValidatorsQuantity(validatorsQuantity);
|
|
243
243
|
onValidateForm(checkIsValid(usedData, true, fieldsValidators.current));
|
|
@@ -265,7 +265,7 @@ const Form = _ref => {
|
|
|
265
265
|
style: style
|
|
266
266
|
}, formProps(), {
|
|
267
267
|
role: "presentation",
|
|
268
|
-
className:
|
|
268
|
+
className: `form-component ${customClass}`
|
|
269
269
|
}), children)), /*#__PURE__*/_react.default.createElement(_dialog.DialogQuestion, {
|
|
270
270
|
zIndex: "99999999",
|
|
271
271
|
title: securityTitle || 'Dados Alterados',
|