linear-react-components-ui 1.1.20-beta.2 → 1.1.20-beta.20
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/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/buttons/DefaultButton.js +2 -1
- package/lib/checkbox/index.js +46 -19
- package/lib/checkbox/types.d.ts +4 -0
- package/lib/dialog/Custom.js +3 -1
- package/lib/dialog/Question.js +20 -2
- package/lib/dialog/base/Content.d.ts +1 -1
- package/lib/dialog/base/Content.js +3 -2
- package/lib/dialog/base/index.js +6 -6
- 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/form/FieldNumber.js +1 -1
- package/lib/form/types.d.ts +14 -1
- package/lib/icons/helper.d.ts +8 -0
- package/lib/icons/helper.js +8 -0
- package/lib/inputs/base/InputTextBase.js +36 -9
- package/lib/inputs/base/types.d.ts +3 -0
- package/lib/inputs/color/types.d.ts +5 -0
- package/lib/inputs/date/types.d.ts +4 -0
- package/lib/inputs/file/DragDropFile.js +2 -1
- package/lib/inputs/file/types.d.ts +3 -0
- package/lib/inputs/mask/helpers.d.ts +4 -0
- package/lib/inputs/mask/imaskHOC.js +203 -0
- package/lib/inputs/mask/types.d.ts +4 -0
- 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/index.js +32 -5
- package/lib/inputs/period/types.d.ts +3 -0
- package/lib/inputs/select/multiple/index.js +13 -4
- package/lib/inputs/select/simple/index.js +5 -3
- package/lib/inputs/select/types.d.ts +7 -0
- package/lib/list/Header.d.ts +1 -0
- package/lib/list/Item.d.ts +6 -2
- package/lib/list/Item.js +15 -3
- package/lib/list/helpers.d.ts +1 -0
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +2 -2
- package/lib/list/types.d.ts +6 -0
- package/lib/menus/sidenav/popup_menu_help/index.js +85 -0
- package/lib/popover/index.js +3 -5
- package/lib/popover/types.d.ts +2 -1
- package/lib/radio/index.d.ts +1 -1
- package/lib/radio/index.js +34 -3
- package/lib/radio/types.d.ts +8 -1
- package/lib/table/HeaderColumn.js +7 -7
- package/lib/table/types.d.ts +0 -2
- package/lib/tabs/DropdownItems.js +62 -0
- package/lib/tabs/MenuItems.js +70 -0
- package/lib/textContent/index.d.ts +18 -4
- package/lib/textContent/index.js +14 -4
- package/lib/treetable/Row.d.ts +1 -1
- package/lib/treetable/Row.js +7 -6
- package/lib/treetable/helpers.d.ts +1 -1
- package/lib/treetable/index.d.ts +2 -2
- package/lib/treeview_old/Header.js +29 -0
- package/lib/treeview_old/Node.js +68 -0
- package/lib/treeview_old/index.js +43 -0
- package/lib/{types.d-73cece43.d.ts → types.d-b477e076.d.ts} +1 -0
- package/package.json +1 -1
- package/lib/checkbox/Label.d.ts +0 -11
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
@import "fonts.scss";
|
|
3
3
|
@import "colors.scss";
|
|
4
4
|
@import "effects";
|
|
5
|
-
.input-base-component > .labelcontainer {
|
|
5
|
+
.input-base-component > .labelcontainer > .text-content {
|
|
6
6
|
margin: 0;
|
|
7
7
|
padding: 0;
|
|
8
8
|
line-height: 14px;
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.input-base-component.-skeletonized {
|
|
118
|
-
> .labelcontainer > .label,
|
|
118
|
+
> .labelcontainer > .text-content > .label,
|
|
119
119
|
> .hint {
|
|
120
120
|
@extend %skeleton-component;
|
|
121
121
|
color: transparent;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@import "colors.scss";
|
|
2
|
+
|
|
3
|
+
.wizard-dialog {
|
|
4
|
+
.wizard-wrapper {
|
|
5
|
+
.wizard-content {
|
|
6
|
+
display: flex !important;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
.wizard-progresbar {
|
|
9
|
+
width: 100%;
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-auto-columns: 1fr;
|
|
12
|
+
grid-auto-flow: column;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
padding: 20px;
|
|
15
|
+
margin-bottom: 20px;
|
|
16
|
+
border-bottom: 2px solid $component-border-color;
|
|
17
|
+
gap: 10px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
> .title {
|
|
20
|
+
font-size: 16px;
|
|
21
|
+
font-weight: 600;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
position: relative;
|
|
26
|
+
flex: 1;
|
|
27
|
+
text-align: center;
|
|
28
|
+
&:first-child {
|
|
29
|
+
.step {
|
|
30
|
+
align-self: flex-start;
|
|
31
|
+
}
|
|
32
|
+
.step-title {
|
|
33
|
+
align-self: flex-start;
|
|
34
|
+
text-align: left;
|
|
35
|
+
}
|
|
36
|
+
&:before {
|
|
37
|
+
right: auto;
|
|
38
|
+
left: 45px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
&:last-child {
|
|
42
|
+
.step {
|
|
43
|
+
align-self: flex-end;
|
|
44
|
+
}
|
|
45
|
+
.step-title {
|
|
46
|
+
align-self: flex-end;
|
|
47
|
+
text-align: right;
|
|
48
|
+
}
|
|
49
|
+
&:after {
|
|
50
|
+
left: auto;
|
|
51
|
+
right: 45px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
&::after, &::before {
|
|
55
|
+
content: "";
|
|
56
|
+
position: absolute;
|
|
57
|
+
height: 2px;
|
|
58
|
+
background-color: $component-border-color;
|
|
59
|
+
top: 18px;
|
|
60
|
+
width: calc(100% - 25px);
|
|
61
|
+
transition: all 0.2s ease-in-out;
|
|
62
|
+
}
|
|
63
|
+
&::after {
|
|
64
|
+
left: calc(50% + 18px);
|
|
65
|
+
}
|
|
66
|
+
&::before {
|
|
67
|
+
right: calc(50% + 18px);
|
|
68
|
+
}
|
|
69
|
+
&[data-completed="true"] {
|
|
70
|
+
&::after {
|
|
71
|
+
background-color: $success-color !important;
|
|
72
|
+
}
|
|
73
|
+
+ .title::before {
|
|
74
|
+
background-color: $success-color !important;
|
|
75
|
+
}
|
|
76
|
+
&:first-child::before {
|
|
77
|
+
background-color: $success-color !important;
|
|
78
|
+
}
|
|
79
|
+
& + .title:after {
|
|
80
|
+
background-color: $success-color !important;
|
|
81
|
+
}
|
|
82
|
+
> .step {
|
|
83
|
+
> .number {
|
|
84
|
+
background-color: $success-color;
|
|
85
|
+
border-color: $success-color;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
&[data-disabled="true"] .step {
|
|
90
|
+
opacity: 0.3;
|
|
91
|
+
}
|
|
92
|
+
> .step {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
width: 54px;
|
|
98
|
+
> .number {
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
font-size: 20px;
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
width: 36px;
|
|
105
|
+
height: 36px;
|
|
106
|
+
border-radius: 100%;
|
|
107
|
+
color: #fff;
|
|
108
|
+
background-color: $color-light-dark;
|
|
109
|
+
z-index: 1;
|
|
110
|
+
transition: all 0.2s ease-in-out;
|
|
111
|
+
border: 2px solid $color-light-dark;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
> .step-title {
|
|
115
|
+
max-width: 150px;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
margin-top: 6px;
|
|
118
|
+
font-weight: 500;
|
|
119
|
+
color: $font-color-soft;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -89,8 +89,9 @@ const DefaultButton = _ref => {
|
|
|
89
89
|
}
|
|
90
90
|
if (dropdown && showIconDropdown) {
|
|
91
91
|
const openDropDownRule = isDropdownOpened ? 'mini_up' : 'mini_down';
|
|
92
|
+
const dropdownIcon = iconName || openDropDownRule;
|
|
92
93
|
return /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
93
|
-
name:
|
|
94
|
+
name: dropdownIcon,
|
|
94
95
|
size: 16,
|
|
95
96
|
customClass: "dropdown-icon",
|
|
96
97
|
pointerEvents: "none",
|
package/lib/checkbox/index.js
CHANGED
|
@@ -5,12 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _Label = _interopRequireDefault(require("./Label"));
|
|
9
8
|
var _gridlayout = _interopRequireDefault(require("../gridlayout"));
|
|
10
9
|
var _permissionValidations = require("../permissionValidations");
|
|
11
10
|
require("../assets/styles/checkbox.scss");
|
|
12
11
|
var _errorMessage = require("../inputs/errorMessage");
|
|
13
12
|
var _ = require("..");
|
|
13
|
+
var _textContent = _interopRequireDefault(require("../textContent"));
|
|
14
|
+
var _popover = _interopRequireDefault(require("../popover"));
|
|
15
|
+
var _hint = _interopRequireDefault(require("../hint"));
|
|
14
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
17
|
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); }
|
|
16
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; }
|
|
@@ -40,7 +42,11 @@ const CheckBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
40
42
|
tooltipWidth = 'auto',
|
|
41
43
|
skeletonize,
|
|
42
44
|
targetRef,
|
|
43
|
-
errorMessages
|
|
45
|
+
errorMessages,
|
|
46
|
+
customClassForLabel,
|
|
47
|
+
hintPosition = 'below',
|
|
48
|
+
themePopover = 'light',
|
|
49
|
+
popoverAlign = 'left'
|
|
44
50
|
} = _ref;
|
|
45
51
|
const [isChecked, setIsChecked] = (0, _react.useState)(checked);
|
|
46
52
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
@@ -52,7 +58,7 @@ const CheckBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
52
58
|
}, [checked]);
|
|
53
59
|
const shouldDisable = () => disabled || onDenied.disabled;
|
|
54
60
|
const getProps = () => {
|
|
55
|
-
if (
|
|
61
|
+
if (shouldDisable()) return null;
|
|
56
62
|
const target = {
|
|
57
63
|
checked: !isChecked,
|
|
58
64
|
id,
|
|
@@ -61,26 +67,30 @@ const CheckBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
61
67
|
};
|
|
62
68
|
return {
|
|
63
69
|
onClick: () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
if (!shouldDisable() && !skeletonize) {
|
|
71
|
+
setIsChecked(!isChecked);
|
|
72
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
73
|
+
target
|
|
74
|
+
});
|
|
75
|
+
}
|
|
67
76
|
},
|
|
68
77
|
onKeyDown: undefined,
|
|
69
78
|
role: 'checkbox',
|
|
70
79
|
tabIndex: -1
|
|
71
80
|
};
|
|
72
81
|
};
|
|
73
|
-
const renderInput = () => /*#__PURE__*/_react.default.createElement("div",
|
|
82
|
+
const renderInput = () => /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
|
|
83
|
+
"data-skeletonized": skeletonize,
|
|
74
84
|
className: "checkbox-component",
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
style: {
|
|
86
|
+
display: 'flex',
|
|
87
|
+
alignItems: 'center'
|
|
88
|
+
}
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement("span", _extends({
|
|
77
90
|
"data-testid": "checkbox-container",
|
|
78
91
|
className: "inputcontent",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
role: "checkbox",
|
|
82
|
-
"aria-checked": "false"
|
|
83
|
-
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
92
|
+
"aria-checked": isChecked
|
|
93
|
+
}, getProps()), /*#__PURE__*/_react.default.createElement("input", {
|
|
84
94
|
id: id || undefined,
|
|
85
95
|
ref: r => {
|
|
86
96
|
if (targetRef) targetRef(r);
|
|
@@ -98,14 +108,31 @@ const CheckBox = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
98
108
|
}), /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_.Icon, {
|
|
99
109
|
size: 12,
|
|
100
110
|
name: "checkmark"
|
|
101
|
-
})), label && /*#__PURE__*/_react.default.createElement(
|
|
102
|
-
|
|
111
|
+
})), label && /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
className: "description"
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(_textContent.default, {
|
|
114
|
+
required: required,
|
|
115
|
+
disabled: shouldDisable(),
|
|
116
|
+
className: customClassForLabel,
|
|
103
117
|
tooltip: tooltip,
|
|
104
118
|
tooltipWidth: tooltipWidth,
|
|
105
|
-
tooltipPosition: tooltipPosition
|
|
119
|
+
tooltipPosition: tooltipPosition
|
|
120
|
+
}), label, /*#__PURE__*/_react.default.createElement(_textContent.default, null), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
106
121
|
disabled: disabled,
|
|
107
|
-
|
|
108
|
-
|
|
122
|
+
visible: !!hint && hintPosition === 'below',
|
|
123
|
+
description: hint,
|
|
124
|
+
customClass: "hint"
|
|
125
|
+
}))), !!hint && hintPosition === 'onLabelRight' && !skeletonize && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
126
|
+
theme: themePopover,
|
|
127
|
+
align: popoverAlign,
|
|
128
|
+
customClass: "-hint",
|
|
129
|
+
iconColor: "#03bde2",
|
|
130
|
+
style: {
|
|
131
|
+
margin: '0px 5px',
|
|
132
|
+
height: 'auto',
|
|
133
|
+
width: 20
|
|
134
|
+
}
|
|
135
|
+
}, hint)), /*#__PURE__*/_react.default.createElement(_errorMessage.ErrorMessage, {
|
|
109
136
|
messages: errorMessages
|
|
110
137
|
}));
|
|
111
138
|
if (onDenied.unvisible) return null;
|
package/lib/checkbox/types.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ interface ICheckBoxProps {
|
|
|
29
29
|
children?: ReactElement;
|
|
30
30
|
autofocus?: boolean;
|
|
31
31
|
hint?: string;
|
|
32
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
32
33
|
gridLayout?: string;
|
|
33
34
|
permissionAttr?: PermissionAttr | PermissionAttr[];
|
|
34
35
|
tooltip?: string;
|
|
@@ -38,6 +39,9 @@ interface ICheckBoxProps {
|
|
|
38
39
|
targetRef?: (ref: HTMLInputElement | null) => void;
|
|
39
40
|
targetSpanRef?: (ref: HTMLSpanElement | null) => void;
|
|
40
41
|
errorMessages?: string[] | undefined;
|
|
42
|
+
customClassForLabel?: string;
|
|
43
|
+
themePopover?: 'light' | 'dark';
|
|
44
|
+
popoverAlign?: 'right' | 'left';
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
export { ChangeEvent, ICheckBoxProps };
|
package/lib/dialog/Custom.js
CHANGED
|
@@ -30,9 +30,11 @@ const Custom = props => {
|
|
|
30
30
|
const {
|
|
31
31
|
width = '35%',
|
|
32
32
|
height = 'auto',
|
|
33
|
-
iconName = null
|
|
33
|
+
iconName = null,
|
|
34
|
+
open
|
|
34
35
|
} = props;
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement(_base.default, _extends({
|
|
37
|
+
open: open,
|
|
36
38
|
width: width,
|
|
37
39
|
height: height
|
|
38
40
|
}, props, {
|
package/lib/dialog/Question.js
CHANGED
|
@@ -4,21 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _buttons = _interopRequireWildcard(require("../buttons"));
|
|
9
9
|
var _Custom = _interopRequireDefault(require("./Custom"));
|
|
10
10
|
var _icons = _interopRequireDefault(require("../icons"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
15
|
const Question = props => {
|
|
16
16
|
const {
|
|
17
17
|
visible = true,
|
|
18
|
+
closeOnEsc = false,
|
|
18
19
|
isWaiting,
|
|
19
20
|
onConfirmClick,
|
|
20
21
|
onUnconfirmClick
|
|
21
22
|
} = props;
|
|
23
|
+
const idUnconfirm = 'botao-unconfirm-click';
|
|
22
24
|
const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.DangerButton, {
|
|
23
25
|
key: "yes-buttom",
|
|
24
26
|
disabled: isWaiting,
|
|
@@ -26,14 +28,30 @@ const Question = props => {
|
|
|
26
28
|
isLoading: isWaiting,
|
|
27
29
|
label: "Sim"
|
|
28
30
|
}), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
31
|
+
id: idUnconfirm,
|
|
29
32
|
key: "no-buttom",
|
|
30
33
|
disabled: isWaiting,
|
|
31
34
|
onClick: onUnconfirmClick,
|
|
32
35
|
label: "N\xE3o"
|
|
33
36
|
})];
|
|
37
|
+
(0, _react.useLayoutEffect)(() => {
|
|
38
|
+
const lastElementActive = document.activeElement;
|
|
39
|
+
return () => {
|
|
40
|
+
var _lastElementActive$fo;
|
|
41
|
+
lastElementActive === null || lastElementActive === void 0 ? void 0 : (_lastElementActive$fo = lastElementActive.focus) === null || _lastElementActive$fo === void 0 ? void 0 : _lastElementActive$fo.call(lastElementActive);
|
|
42
|
+
};
|
|
43
|
+
}, [visible]);
|
|
44
|
+
(0, _react.useEffect)(() => {
|
|
45
|
+
var _buttonUnconfirm$focu;
|
|
46
|
+
const buttonUnconfirm = document.getElementById(idUnconfirm);
|
|
47
|
+
buttonUnconfirm === null || buttonUnconfirm === void 0 ? void 0 : (_buttonUnconfirm$focu = buttonUnconfirm.focus) === null || _buttonUnconfirm$focu === void 0 ? void 0 : _buttonUnconfirm$focu.call(buttonUnconfirm);
|
|
48
|
+
}, [visible, document.activeElement]);
|
|
34
49
|
if (!visible) return null;
|
|
35
50
|
return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
|
|
51
|
+
open: visible,
|
|
36
52
|
buttons: buttons,
|
|
53
|
+
closeOnEsc: closeOnEsc,
|
|
54
|
+
handlerClose: onUnconfirmClick,
|
|
37
55
|
icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
38
56
|
name: "question",
|
|
39
57
|
color: "#3498db",
|
|
@@ -4,6 +4,6 @@ import '../../@types/Align.js';
|
|
|
4
4
|
import '../../@types/Icon.js';
|
|
5
5
|
import '../../icons/helper.js';
|
|
6
6
|
|
|
7
|
-
declare const Content: ({ children, styleForContent }: IContentProps) => JSX.Element;
|
|
7
|
+
declare const Content: ({ children, styleForContent, className }: IContentProps) => JSX.Element;
|
|
8
8
|
|
|
9
9
|
export { Content as default };
|
|
@@ -10,11 +10,12 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
10
10
|
const Content = _ref => {
|
|
11
11
|
let {
|
|
12
12
|
children,
|
|
13
|
-
styleForContent
|
|
13
|
+
styleForContent,
|
|
14
|
+
className = ''
|
|
14
15
|
} = _ref;
|
|
15
16
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
16
17
|
id: "modal-dialog-content",
|
|
17
|
-
className: "dialog-content",
|
|
18
|
+
className: "dialog-content ".concat(className),
|
|
18
19
|
style: styleForContent
|
|
19
20
|
}, children);
|
|
20
21
|
};
|
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.key === 'Escape') {
|
|
58
|
+
if ((event === null || event === void 0 ? void 0 : event.key) === 'Escape') {
|
|
59
|
+
event.stopPropagation();
|
|
60
60
|
handleClose();
|
|
61
61
|
}
|
|
62
62
|
};
|
|
@@ -112,7 +112,7 @@ const BaseDialog = props => {
|
|
|
112
112
|
className: "modal-overlay",
|
|
113
113
|
"data-testid": "modal-overlay"
|
|
114
114
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
115
|
-
className: "dialog",
|
|
115
|
+
className: "dialog ".concat(className),
|
|
116
116
|
"data-testid": "dialog-component"
|
|
117
117
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
118
118
|
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: "dialog-form-wrapper"
|
|
62
|
+
wrapperClassName: "dialog-form-wrapper ".concat(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;
|