@cashub/ui 0.6.7 → 0.7.0
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/image/UploadImage.js +43 -4
- package/package.json +1 -1
- package/section/SectionToolbar.js +4 -7
- package/section/SectionToolbarItem.js +19 -0
- package/section/index.js +14 -17
- package/table/Table.js +1 -1
package/image/UploadImage.js
CHANGED
|
@@ -56,7 +56,13 @@ var UploadImage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
56
56
|
alt = _ref$alt === void 0 ? 'user avatar' : _ref$alt,
|
|
57
57
|
_ref$roundedCircle = _ref.roundedCircle,
|
|
58
58
|
roundedCircle = _ref$roundedCircle === void 0 ? false : _ref$roundedCircle,
|
|
59
|
-
cropperHandler = _ref.cropperHandler
|
|
59
|
+
cropperHandler = _ref.cropperHandler,
|
|
60
|
+
onBlur = _ref.onBlur;
|
|
61
|
+
|
|
62
|
+
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
63
|
+
t = _useTranslation.t;
|
|
64
|
+
|
|
65
|
+
var refWrapper = (0, _react.useRef)();
|
|
60
66
|
|
|
61
67
|
var _useState = (0, _react.useState)(src),
|
|
62
68
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -68,8 +74,10 @@ var UploadImage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
68
74
|
currentFile = _useState4[0],
|
|
69
75
|
setCurrentFile = _useState4[1];
|
|
70
76
|
|
|
71
|
-
var
|
|
72
|
-
|
|
77
|
+
var _useState5 = (0, _react.useState)(0),
|
|
78
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
79
|
+
focusCount = _useState6[0],
|
|
80
|
+
setFocusCount = _useState6[1];
|
|
73
81
|
|
|
74
82
|
var handleAvatarRemove = function handleAvatarRemove() {
|
|
75
83
|
setCurrentSrc(src);
|
|
@@ -142,11 +150,42 @@ var UploadImage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
142
150
|
}
|
|
143
151
|
});
|
|
144
152
|
}, [cropperHandler, handleImageFile]);
|
|
153
|
+
|
|
154
|
+
var handleFocus = function handleFocus(e) {
|
|
155
|
+
e.preventDefault();
|
|
156
|
+
e.stopPropagation();
|
|
157
|
+
|
|
158
|
+
if (e.target.tagName === 'BUTTON') {
|
|
159
|
+
setFocusCount(focusCount + 1);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var handleBlur = function handleBlur(e) {
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
if (refWrapper.current.contains(e.relatedTarget)) return;
|
|
167
|
+
|
|
168
|
+
if (e.target === refWrapper.current && onBlur) {
|
|
169
|
+
onBlur();
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
145
173
|
(0, _react.useEffect)(function () {
|
|
146
174
|
setCurrentSrc(src);
|
|
147
|
-
}, [src, ref]);
|
|
175
|
+
}, [src, ref]); // if click button icon,can focus figure element
|
|
176
|
+
|
|
177
|
+
(0, _react.useEffect)(function () {
|
|
178
|
+
if (focusCount === 2) {
|
|
179
|
+
refWrapper.current.focus();
|
|
180
|
+
setFocusCount(0);
|
|
181
|
+
}
|
|
182
|
+
}, [ref, focusCount]);
|
|
148
183
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
|
|
184
|
+
ref: refWrapper,
|
|
149
185
|
roundedCircle: roundedCircle,
|
|
186
|
+
onBlur: handleBlur,
|
|
187
|
+
onFocus: handleFocus,
|
|
188
|
+
tabIndex: "0",
|
|
150
189
|
children: [currentSrc && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageFluid.default, {
|
|
151
190
|
crossOrigin: "anonymous",
|
|
152
191
|
src: currentSrc,
|
package/package.json
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _templateObject
|
|
10
|
+
var _templateObject;
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
@@ -15,8 +15,5 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
15
15
|
|
|
16
16
|
var SectionToolbar = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n > *:not(:first-child) {\n margin-left: var(--spacing-s);\n }\n"])));
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var SectionToolbarItem = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n\n > *:not(:first-child) {\n margin-left: var(--spacing-s);\n }\n"])));
|
|
21
|
-
|
|
22
|
-
exports.SectionToolbarItem = SectionToolbarItem;
|
|
18
|
+
var _default = SectionToolbar;
|
|
19
|
+
exports.default = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
|
|
10
|
+
var _templateObject;
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
+
|
|
16
|
+
var SectionToolbarItem = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n\n > *:not(:first-child) {\n margin-left: var(--spacing-s);\n }\n"])));
|
|
17
|
+
|
|
18
|
+
var _default = SectionToolbarItem;
|
|
19
|
+
exports.default = _default;
|
package/section/index.js
CHANGED
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
Section: true,
|
|
8
|
-
SectionBody: true,
|
|
9
|
-
SectionHeader: true
|
|
10
|
-
};
|
|
11
6
|
Object.defineProperty(exports, "Section", {
|
|
12
7
|
enumerable: true,
|
|
13
8
|
get: function get() {
|
|
@@ -26,6 +21,18 @@ Object.defineProperty(exports, "SectionHeader", {
|
|
|
26
21
|
return _SectionHeader.default;
|
|
27
22
|
}
|
|
28
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "SectionToolbar", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _SectionToolbar.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "SectionToolbarItem", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _SectionToolbarItem.default;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
29
36
|
|
|
30
37
|
var _Section = _interopRequireDefault(require("./Section"));
|
|
31
38
|
|
|
@@ -33,18 +40,8 @@ var _SectionBody = _interopRequireDefault(require("./SectionBody"));
|
|
|
33
40
|
|
|
34
41
|
var _SectionHeader = _interopRequireDefault(require("./SectionHeader"));
|
|
35
42
|
|
|
36
|
-
var _SectionToolbar = require("./SectionToolbar");
|
|
43
|
+
var _SectionToolbar = _interopRequireDefault(require("./SectionToolbar"));
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
if (key === "default" || key === "__esModule") return;
|
|
40
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
41
|
-
if (key in exports && exports[key] === _SectionToolbar[key]) return;
|
|
42
|
-
Object.defineProperty(exports, key, {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _SectionToolbar[key];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
45
|
+
var _SectionToolbarItem = _interopRequireDefault(require("./SectionToolbarItem"));
|
|
49
46
|
|
|
50
47
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/table/Table.js
CHANGED
|
@@ -122,7 +122,7 @@ var Table = function Table(_ref) {
|
|
|
122
122
|
var containerLength = event.target.offsetWidth;
|
|
123
123
|
var textLength = event.target.scrollWidth;
|
|
124
124
|
|
|
125
|
-
if (textLength
|
|
125
|
+
if (textLength >= containerLength) {
|
|
126
126
|
event.stopPropagation();
|
|
127
127
|
(0, _Popover.default)({
|
|
128
128
|
id: id,
|