@cashub/ui 0.48.13 → 0.48.15
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/Tab/TabTab.js +7 -3
- package/modal/StateModal.js +42 -26
- package/package.json +1 -1
package/Tab/TabTab.js
CHANGED
|
@@ -10,7 +10,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
10
10
|
var _TabContext = _interopRequireDefault(require("./subComponent/TabContext"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
var _templateObject, _templateObject2, _templateObject3;
|
|
13
|
-
const _excluded = ["children", "name", "title"];
|
|
13
|
+
const _excluded = ["children", "name", "title", "onClick"];
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -24,7 +24,8 @@ const TabTab = _ref => {
|
|
|
24
24
|
let {
|
|
25
25
|
children,
|
|
26
26
|
name,
|
|
27
|
-
title
|
|
27
|
+
title,
|
|
28
|
+
onClick
|
|
28
29
|
} = _ref,
|
|
29
30
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
31
|
const {
|
|
@@ -39,7 +40,10 @@ const TabTab = _ref => {
|
|
|
39
40
|
if (selected !== name) {
|
|
40
41
|
onChange(name);
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
if (onClick && typeof onClick === 'function') {
|
|
44
|
+
onClick();
|
|
45
|
+
}
|
|
46
|
+
}, [name, selected, onChange, onClick]);
|
|
43
47
|
const handleDoubleClick = () => {
|
|
44
48
|
if (mode !== 'modify') return;
|
|
45
49
|
setIsModify(true);
|
package/modal/StateModal.js
CHANGED
|
@@ -16,7 +16,8 @@ var _Button = _interopRequireDefault(require("../button/Button"));
|
|
|
16
16
|
var _ModalBackdrop = _interopRequireDefault(require("../backdrop/ModalBackdrop"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
19
|
-
const _excluded = ["onClose"]
|
|
19
|
+
const _excluded = ["onClose"],
|
|
20
|
+
_excluded2 = ["text", "children", "type", "onClick", "closeOnClick"];
|
|
20
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
22
|
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); }
|
|
22
23
|
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; }
|
|
@@ -51,6 +52,7 @@ const ModalContent = _ref2 => {
|
|
|
51
52
|
type,
|
|
52
53
|
title,
|
|
53
54
|
text,
|
|
55
|
+
buttons,
|
|
54
56
|
confirmButtonText,
|
|
55
57
|
cancelButtonText,
|
|
56
58
|
showConfirmButton = true,
|
|
@@ -68,18 +70,30 @@ const ModalContent = _ref2 => {
|
|
|
68
70
|
if (type === 'error') Icon = _fa.FaRegTimesCircle;
|
|
69
71
|
if (type === 'danger') Icon = _bs.BsExclamationTriangle;
|
|
70
72
|
if (type === 'warning') Icon = _bs.BsExclamationCircle;
|
|
73
|
+
const getButtonTypeProps = buttonType => _objectSpread(_objectSpread(_objectSpread({}, buttonType === 'danger' && {
|
|
74
|
+
danger: true
|
|
75
|
+
}), buttonType === 'warning' && {
|
|
76
|
+
warning: true
|
|
77
|
+
}), buttonType === 'success' && {
|
|
78
|
+
success: true
|
|
79
|
+
});
|
|
71
80
|
const handleDismiss = event => {
|
|
72
81
|
if (event.target === refWrapper.current && allowDismiss === true) {
|
|
73
82
|
onClose();
|
|
74
83
|
}
|
|
75
84
|
};
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
const modalButtons = buttons || [showCancelButton === true && {
|
|
86
|
+
text: cancelButtonText || 'Cancel',
|
|
87
|
+
type: cancelButtonType,
|
|
88
|
+
onClick: onCancel
|
|
89
|
+
}, showConfirmButton === true && {
|
|
90
|
+
text: confirmButtonText || 'Confirm',
|
|
91
|
+
type: confirmButtonType,
|
|
92
|
+
onClick: onConfirm
|
|
93
|
+
}].filter(Boolean);
|
|
94
|
+
const handleButtonClick = button => {
|
|
95
|
+
if (button.onClick) button.onClick();
|
|
96
|
+
if (button.closeOnClick !== false) onClose();
|
|
83
97
|
};
|
|
84
98
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
|
|
85
99
|
ref: refWrapper,
|
|
@@ -96,33 +110,35 @@ const ModalContent = _ref2 => {
|
|
|
96
110
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
|
|
97
111
|
children: text
|
|
98
112
|
})]
|
|
99
|
-
}),
|
|
113
|
+
}), modalButtons.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
|
|
100
114
|
alignRight: true,
|
|
101
|
-
children:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
children: modalButtons.map((_ref3, index) => {
|
|
116
|
+
let {
|
|
117
|
+
text: buttonText,
|
|
118
|
+
children,
|
|
119
|
+
type: buttonType,
|
|
120
|
+
onClick,
|
|
121
|
+
closeOnClick
|
|
122
|
+
} = _ref3,
|
|
123
|
+
buttonProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
124
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, _objectSpread(_objectSpread(_objectSpread({}, getButtonTypeProps(buttonType)), buttonProps), {}, {
|
|
125
|
+
onClick: () => handleButtonClick({
|
|
126
|
+
onClick,
|
|
127
|
+
closeOnClick
|
|
128
|
+
}),
|
|
129
|
+
children: children || buttonText
|
|
130
|
+
}), "".concat(id, "-Button-").concat(index));
|
|
131
|
+
})
|
|
116
132
|
})]
|
|
117
133
|
})
|
|
118
134
|
});
|
|
119
135
|
};
|
|
120
136
|
const Wrapper = (0, _styledComponents.default)(_ModalBackdrop.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n z-index: 90;\n"])));
|
|
121
137
|
const Container = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 500px;\n max-width: 90%;\n background: var(--color-background2);\n box-shadow: var(--box-shadow);\n padding: var(--spacing);\n border-radius: var(--border-radius);\n color: var(--font-on-background);\n border: var(--border-width) solid var(--border-color);\n text-align: center;\n"])));
|
|
122
|
-
const Body = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-bottom: var(--spacing);\n\n > svg {\n font-size: 120px;\n margin-bottom: var(--spacing);\n\n ", "\n }\n"])),
|
|
138
|
+
const Body = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-bottom: var(--spacing);\n\n > svg {\n font-size: 120px;\n margin-bottom: var(--spacing);\n\n ", "\n }\n"])), _ref4 => {
|
|
123
139
|
let {
|
|
124
140
|
type
|
|
125
|
-
} =
|
|
141
|
+
} = _ref4;
|
|
126
142
|
switch (type) {
|
|
127
143
|
case 'error':
|
|
128
144
|
case 'danger':
|