@cashub/ui 0.20.0 → 0.21.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/Tab/Tab.js +9 -13
- package/Tab/TabList.js +14 -32
- package/Tab/TabPanel.js +21 -58
- package/Tab/TabTab.js +20 -40
- package/Tab/index.js +2 -10
- package/Tab/subComponent/TabContext.js +2 -5
- package/animate/Collapse.js +26 -53
- package/animate/Loader.js +21 -26
- package/animate/NumberCounter.js +22 -44
- package/animate/PulseRing.js +9 -21
- package/animate/Spinner.js +2 -10
- package/animate/index.js +5 -11
- package/assets/css/autocomplete.css +16 -16
- package/assets/css/font.css +4 -4
- package/assets/css/global.css +3 -3
- package/assets/css/normalize.css +386 -386
- package/backdrop/BaseBackdrop.js +2 -9
- package/backdrop/LoadingBackdrop.js +2 -9
- package/backdrop/ModalBackdrop.js +2 -9
- package/backdrop/index.js +3 -7
- package/badge/Badge.js +2 -11
- package/badge/BadgeDot.js +2 -10
- package/badge/BadgeFill.js +15 -20
- package/badge/BadgeWithText.js +6 -13
- package/badge/index.js +4 -9
- package/billing/BarChart.js +10 -17
- package/billing/Grid.js +11 -15
- package/billing/Header2.js +6 -9
- package/billing/Header3.js +9 -16
- package/billing/Paragraph.js +8 -14
- package/billing/ParagraphGroup.js +6 -9
- package/billing/ParagraphText.js +7 -12
- package/billing/Section.js +13 -23
- package/billing/SectionBody.js +5 -8
- package/billing/SectionHeader.js +7 -12
- package/breadcrumb/Breadcrumb.js +11 -21
- package/breadcrumb/index.js +1 -3
- package/button/Button.js +41 -38
- package/button/ButtonGroup.js +21 -18
- package/button/IconButton.js +29 -29
- package/button/ScrollToTopButton.js +12 -39
- package/button/index.js +4 -9
- package/callout/Callout.js +13 -26
- package/callout/index.js +1 -3
- package/chart/BarChart.js +28 -53
- package/chart/DoughnutChart.js +23 -62
- package/chart/LineChart.js +33 -55
- package/chart/SingleBarChart.js +11 -17
- package/chart/index.js +5 -12
- package/chart/utils/customTooltip.js +26 -43
- package/chart/utils/htmlLegendPlugin.js +24 -30
- package/chart/utils/index.js +3 -7
- package/chart/utils/padEmptyChartBar.js +24 -22
- package/container/FlexContainer.js +9 -12
- package/container/index.js +1 -3
- package/cropper/Cropper.js +21 -34
- package/cropper/CropperModalHandler.js +15 -21
- package/cropper/index.js +2 -5
- package/cropper/subComponent/CropImageModal.js +23 -58
- package/datetimePicker/DatePicker.js +103 -217
- package/datetimePicker/DatePickerV2.js +116 -221
- package/datetimePicker/DatetimePicker.js +27 -48
- package/datetimePicker/DatetimePickerV2.js +115 -231
- package/datetimePicker/TimeInput.js +9 -22
- package/datetimePicker/TimePicker.js +94 -151
- package/datetimePicker/TimePickerStyle.js +14 -0
- package/datetimePicker/accordion/Month.js +70 -90
- package/datetimePicker/accordion/Year.js +91 -135
- package/datetimePicker/hooks/index.js +3 -7
- package/datetimePicker/hooks/useChangeNumber.js +14 -27
- package/datetimePicker/hooks/useDecrease.js +19 -35
- package/datetimePicker/hooks/useIncrease.js +19 -35
- package/datetimePicker/index.js +13 -13
- package/datetimePicker/provider/constant.js +2 -3
- package/datetimePicker/subComponent/Accordion.js +108 -158
- package/datetimePicker/subComponent/CustomTimeInput.js +18 -48
- package/datetimePicker/subComponent/DateTimePickerContext.js +2 -5
- package/datetimePicker/utils/GMTDate.js +3 -7
- package/datetimePicker/utils/pad.js +2 -6
- package/datetimePicker/utils/toUTC0.js +3 -6
- package/descriptionList/DescriptionDetail.js +5 -10
- package/descriptionList/DescriptionList.js +5 -10
- package/descriptionList/DescriptionTerm.js +2 -9
- package/descriptionList/index.js +3 -7
- package/divider/Divider.js +9 -12
- package/divider/index.js +1 -3
- package/dropdown/Dropdown.js +28 -65
- package/dropdown/DropdownButtonOption.js +2 -9
- package/dropdown/DropdownContent.js +33 -64
- package/dropdown/DropdownDivOption.js +2 -9
- package/dropdown/DropdownItem.js +10 -16
- package/dropdown/DropdownLinkOption.js +2 -9
- package/dropdown/DropdownToggle.js +18 -38
- package/dropdown/index.js +6 -17
- package/dropdown/subComponent/DropdownContext.js +2 -5
- package/dropzone/FileDropzone.js +148 -302
- package/dropzone/ImageDropzone.js +96 -171
- package/dropzone/index.js +2 -5
- package/dropzone/subComponent/Message.js +7 -14
- package/figure/IconFigure.js +9 -16
- package/figure/ImageFigure.js +11 -17
- package/figure/index.js +2 -5
- package/file/HiddenFileInput.js +5 -14
- package/file/index.js +1 -3
- package/form/Checkbox.js +34 -43
- package/form/FormItem.js +2 -9
- package/form/Input.js +13 -15
- package/form/Label.js +10 -13
- package/form/MutedText.js +5 -10
- package/form/RadioButton.js +20 -32
- package/form/Searchbox.js +21 -65
- package/form/Slider.js +14 -0
- package/form/SwitchButton.js +34 -39
- package/form/Textarea.js +2 -11
- package/form/index.js +9 -19
- package/grid/Column.js +17 -17
- package/grid/Grid.js +13 -14
- package/grid/index.js +2 -5
- package/heading/Heading1.js +5 -10
- package/heading/Heading2.js +9 -12
- package/heading/Heading3.js +21 -18
- package/heading/index.js +3 -7
- package/helmet/Helmet.js +6 -9
- package/helmet/index.js +2 -5
- package/iconbox/ApplicationIconBox.js +25 -31
- package/iconbox/IconBox.js +11 -24
- package/iconbox/IconBoxV2.js +14 -26
- package/iconbox/index.js +3 -7
- package/iconbox/subComponent/IconBoxFigure.js +25 -20
- package/iconbox/subComponent/IconBoxImage.js +15 -18
- package/image/ImageFluid.js +2 -10
- package/image/UploadImage.js +65 -113
- package/image/index.js +2 -5
- package/index.js +44 -130
- package/jsoneditor/JsonEditor.js +10 -32
- package/jsoneditor/index.js +1 -3
- package/keyframe/Pulse.js +2 -7
- package/keyframe/Spin.js +2 -7
- package/link/LinkSpan.js +22 -35
- package/link/index.js +1 -3
- package/map/GoogleMap.js +122 -175
- package/map/GoogleReverseGeolocation.js +79 -186
- package/map/LeafletMap.js +78 -132
- package/map/LeafletReverseGeolocation.js +49 -121
- package/map/index.js +4 -9
- package/map/subComponent/BasicLeafletMap.js +8 -14
- package/map/subComponent/GoogleMapContainer.js +5 -10
- package/map/subComponent/GoogleMapPopup.js +66 -123
- package/map/subComponent/GoogleMapWrapper.js +13 -32
- package/map/subComponent/GoogleMarkerSpiderfier.js +14 -24
- package/map/subComponent/LeafletDrawControl.js +47 -84
- package/map/subComponent/LeafletMapContainer.js +5 -10
- package/map/subComponent/MapSearchBoxControl.js +24 -70
- package/modal/StateModal.js +41 -100
- package/modal/TitleModal.js +89 -190
- package/modal/index.js +2 -5
- package/package.json +1 -1
- package/paginate/Paginate.js +40 -54
- package/paginate/index.js +1 -3
- package/popover/Popover.js +39 -87
- package/popover/index.js +1 -3
- package/qrcode/QRCode.js +10 -23
- package/qrcode/QRCodeContainter.js +8 -16
- package/qrcode/index.js +2 -5
- package/ribbon/Ribbon.js +4 -15
- package/ribbon/index.js +1 -3
- package/section/Section.js +57 -39
- package/section/SectionBody.js +15 -22
- package/section/SectionHeader.js +27 -27
- package/section/SectionToolbar.js +2 -9
- package/section/SectionToolbarItem.js +2 -9
- package/section/index.js +5 -11
- package/select/InputSelect.js +103 -215
- package/select/Select.js +204 -362
- package/select/index.js +2 -5
- package/select/subComponent/ListBox.js +9 -12
- package/select/subComponent/Option.js +8 -16
- package/select/subComponent/OptionGroup.js +2 -9
- package/select/subComponent/Options.js +5 -11
- package/select/subComponent/SearchBox.js +9 -29
- package/select/subComponent/SelectedMultiple.js +8 -16
- package/select/subComponent/SelectedSingle.js +2 -9
- package/styles/GlobalStyle.js +169 -91
- package/styles/config/breakpoint.style.js +2 -3
- package/styles/config/header.style.js +2 -3
- package/styles/config/sidebar.style.js +2 -3
- package/styles/index.js +2 -5
- package/styles/mixin/backgroundColor.js +17 -14
- package/styles/mixin/borderColor.js +17 -14
- package/styles/mixin/color.js +17 -14
- package/styles/mixin/colorOnBackground.js +17 -14
- package/styles/mixin/inputPlaceholder.js +3 -9
- package/styles/mixin/media.js +3 -11
- package/styles/mixin/rounded.js +13 -12
- package/styles/mixin/scrollbar.js +7 -13
- package/styles/theme/dark.theme.js +20 -20
- package/styles/theme/light.theme.js +20 -20
- package/styles/theme/white.theme.js +20 -20
- package/styles/themes.js +2 -8
- package/table/GridTable.js +105 -143
- package/table/ImageBox.js +8 -18
- package/table/PermissionTable.js +25 -25
- package/table/Table.js +137 -153
- package/table/__mock__/columns.js +2 -3
- package/table/__mock__/data.js +2 -3
- package/table/hooks/index.js +2 -5
- package/table/hooks/useCalculateDataRange.js +9 -36
- package/table/hooks/useGenerateSort.js +6 -17
- package/table/index.js +4 -9
- package/table/subComponent/BaseTableHeadCell.js +15 -21
- package/table/subComponent/GridTableFooter.js +5 -10
- package/table/subComponent/GridTableHeadCell.js +5 -10
- package/table/subComponent/Resizer.js +17 -44
- package/table/subComponent/TableFooter.js +5 -10
- package/table/subComponent/TableFooterInfo.js +2 -9
- package/table/subComponent/TableFooterPager.js +5 -12
- package/table/subComponent/TableHeadCell.js +2 -9
- package/table/subComponent/TableSort.js +13 -19
- package/tagify/TagifyStyle.js +14 -0
- package/tagify/Tags.js +15 -37
- package/tagify/index.js +8 -3
- package/text/Paragraph.js +25 -20
- package/text/index.js +1 -3
- package/timeline/Timeline.js +28 -37
- package/timeline/index.js +1 -3
- package/toast/CustomToastContainer.js +2 -9
- package/toast/MessageContainer.js +9 -18
- package/toast/index.js +3 -8
- package/toast/show.js +18 -28
- package/tooltip/Tooltip.js +48 -97
- package/tooltip/index.js +1 -3
- package/wizard/Wizard.js +63 -133
- package/wizard/index.js +1 -3
|
@@ -4,221 +4,151 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
|
|
12
9
|
var _fi = require("react-icons/fi");
|
|
13
|
-
|
|
14
10
|
var _md = require("react-icons/md");
|
|
15
|
-
|
|
16
11
|
var _utils = require("@cashub/utils");
|
|
17
|
-
|
|
18
12
|
var _HiddenFileInput = _interopRequireDefault(require("../file/HiddenFileInput"));
|
|
19
|
-
|
|
20
13
|
var _Message = _interopRequireDefault(require("./subComponent/Message"));
|
|
21
|
-
|
|
22
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
|
|
24
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
|
|
28
17
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
51
|
-
|
|
52
|
-
var ImageDropzone = function ImageDropzone(_ref) {
|
|
53
|
-
var _ref$width = _ref.width,
|
|
54
|
-
width = _ref$width === void 0 ? 180 : _ref$width,
|
|
55
|
-
_ref$height = _ref.height,
|
|
56
|
-
height = _ref$height === void 0 ? 320 : _ref$height,
|
|
57
|
-
_ref$fixedSize = _ref.fixedSize,
|
|
58
|
-
fixedSize = _ref$fixedSize === void 0 ? true : _ref$fixedSize,
|
|
59
|
-
maxFiles = _ref.maxFiles,
|
|
60
|
-
message = _ref.message,
|
|
61
|
-
accept = _ref.accept,
|
|
62
|
-
disabled = _ref.disabled,
|
|
63
|
-
onAddedFile = _ref.onAddedFile,
|
|
64
|
-
onRemovedFile = _ref.onRemovedFile,
|
|
65
|
-
setDropzoneFunc = _ref.setDropzoneFunc,
|
|
66
|
-
cropper = _ref.cropper,
|
|
67
|
-
onBlur = _ref.onBlur;
|
|
68
|
-
var inputRef = (0, _react.useRef)(null);
|
|
69
|
-
|
|
70
|
-
var _useState = (0, _react.useState)([]),
|
|
71
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
72
|
-
files = _useState2[0],
|
|
73
|
-
setFiles = _useState2[1];
|
|
74
|
-
|
|
75
|
-
var _useState3 = (0, _react.useState)(false),
|
|
76
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
77
|
-
dragging = _useState4[0],
|
|
78
|
-
setDragging = _useState4[1];
|
|
79
|
-
|
|
80
|
-
var _useState5 = (0, _react.useState)([]),
|
|
81
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
82
|
-
addedFiles = _useState6[0],
|
|
83
|
-
setAddedFiles = _useState6[1];
|
|
84
|
-
|
|
85
|
-
var _useState7 = (0, _react.useState)(false),
|
|
86
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
87
|
-
focus = _useState8[0],
|
|
88
|
-
setFocus = _useState8[1];
|
|
89
|
-
|
|
90
|
-
var handleClick = function handleClick() {
|
|
18
|
+
const ImageDropzone = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
width = 180,
|
|
21
|
+
height = 320,
|
|
22
|
+
fixedSize = true,
|
|
23
|
+
maxFiles,
|
|
24
|
+
message,
|
|
25
|
+
accept,
|
|
26
|
+
disabled,
|
|
27
|
+
onAddedFile,
|
|
28
|
+
onRemovedFile,
|
|
29
|
+
setDropzoneFunc,
|
|
30
|
+
cropper,
|
|
31
|
+
onBlur
|
|
32
|
+
} = _ref;
|
|
33
|
+
const inputRef = (0, _react.useRef)(null);
|
|
34
|
+
const [files, setFiles] = (0, _react.useState)([]);
|
|
35
|
+
const [dragging, setDragging] = (0, _react.useState)(false);
|
|
36
|
+
const [addedFiles, setAddedFiles] = (0, _react.useState)([]);
|
|
37
|
+
const [focus, setFocus] = (0, _react.useState)(false);
|
|
38
|
+
const handleClick = () => {
|
|
91
39
|
if (disabled || files.length >= maxFiles) return;
|
|
92
40
|
setFocus(false);
|
|
93
41
|
inputRef.current.click();
|
|
94
42
|
};
|
|
95
|
-
|
|
96
|
-
var handleDragEnter = function handleDragEnter(event) {
|
|
43
|
+
const handleDragEnter = event => {
|
|
97
44
|
event.preventDefault();
|
|
98
45
|
event.stopPropagation();
|
|
99
46
|
if (!disabled && files.length < maxFiles) setDragging(true);
|
|
100
47
|
};
|
|
101
|
-
|
|
102
|
-
var handleDragOver = function handleDragOver(event) {
|
|
48
|
+
const handleDragOver = event => {
|
|
103
49
|
event.preventDefault();
|
|
104
50
|
event.stopPropagation();
|
|
105
51
|
if (!disabled && files.length < maxFiles) setDragging(true);
|
|
106
52
|
};
|
|
107
|
-
|
|
108
|
-
var handleDragLeave = function handleDragLeave(event) {
|
|
53
|
+
const handleDragLeave = event => {
|
|
109
54
|
event.preventDefault();
|
|
110
55
|
event.stopPropagation();
|
|
111
56
|
setDragging(false);
|
|
112
57
|
};
|
|
113
|
-
|
|
114
|
-
var handleDrop = function handleDrop(event) {
|
|
58
|
+
const handleDrop = event => {
|
|
115
59
|
event.preventDefault();
|
|
116
60
|
event.stopPropagation();
|
|
117
|
-
|
|
118
61
|
if (!disabled && files.length < maxFiles) {
|
|
119
62
|
setDragging(false);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
63
|
+
const {
|
|
64
|
+
dataTransfer
|
|
65
|
+
} = event;
|
|
66
|
+
const {
|
|
67
|
+
files: [...newFiles]
|
|
68
|
+
} = dataTransfer;
|
|
125
69
|
if (files.length + newFiles.length > maxFiles) {
|
|
126
70
|
newFiles.splice(maxFiles - files.length);
|
|
127
71
|
}
|
|
128
|
-
|
|
129
|
-
for (var index = 0; index < newFiles.length; index += 1) {
|
|
72
|
+
for (let index = 0; index < newFiles.length; index += 1) {
|
|
130
73
|
newFiles[index].url = URL.createObjectURL(newFiles[index]);
|
|
131
74
|
}
|
|
132
|
-
|
|
133
|
-
setFiles([].concat(_toConsumableArray(files), _toConsumableArray(newFiles)));
|
|
75
|
+
setFiles([...files, ...newFiles]);
|
|
134
76
|
setAddedFiles(newFiles);
|
|
135
77
|
}
|
|
136
78
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
setFiles(function (previous) {
|
|
79
|
+
const handleAddFiles = (0, _react.useCallback)(newFiles => {
|
|
80
|
+
setFiles(previous => {
|
|
140
81
|
if (previous.length + newFiles.length > maxFiles) {
|
|
141
82
|
newFiles.splice(maxFiles - previous.length);
|
|
142
83
|
}
|
|
143
|
-
|
|
144
|
-
return [].concat(_toConsumableArray(previous), _toConsumableArray(newFiles));
|
|
84
|
+
return [...previous, ...newFiles];
|
|
145
85
|
});
|
|
146
|
-
|
|
147
|
-
for (var index = 0; index < newFiles.length; index += 1) {
|
|
86
|
+
for (let index = 0; index < newFiles.length; index += 1) {
|
|
148
87
|
newFiles[index].url = URL.createObjectURL(newFiles[index]);
|
|
149
88
|
}
|
|
150
|
-
|
|
151
89
|
setAddedFiles(newFiles);
|
|
152
90
|
}, [maxFiles]);
|
|
153
|
-
|
|
91
|
+
const handleRemoveFile = (0, _react.useCallback)((event, index) => {
|
|
154
92
|
if (event) {
|
|
155
93
|
event.stopPropagation();
|
|
156
94
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var newFiles = _toConsumableArray(previous);
|
|
160
|
-
|
|
95
|
+
setFiles(previous => {
|
|
96
|
+
const newFiles = [...previous];
|
|
161
97
|
newFiles.splice(index, 1);
|
|
162
98
|
return newFiles;
|
|
163
99
|
});
|
|
164
100
|
if (onRemovedFile) onRemovedFile(index);
|
|
165
101
|
}, [onRemovedFile]);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
102
|
+
const handleChangeFile = (0, _react.useCallback)(event => {
|
|
103
|
+
const {
|
|
104
|
+
files
|
|
105
|
+
} = event.target;
|
|
106
|
+
const newFiles = [];
|
|
107
|
+
for (let index = 0; index < files.length; index += 1) {
|
|
171
108
|
newFiles.push(files[index]);
|
|
172
109
|
}
|
|
173
|
-
|
|
174
110
|
handleAddFiles(newFiles);
|
|
175
111
|
inputRef.current.value = '';
|
|
176
112
|
}, [handleAddFiles]);
|
|
177
|
-
|
|
113
|
+
const handleCrop = (0, _react.useCallback)((event, index, file) => {
|
|
178
114
|
event.stopPropagation();
|
|
179
115
|
setFocus(false);
|
|
180
116
|
cropper.handler({
|
|
181
|
-
file
|
|
117
|
+
file,
|
|
182
118
|
src: file.url,
|
|
183
|
-
width
|
|
184
|
-
height
|
|
119
|
+
width,
|
|
120
|
+
height,
|
|
185
121
|
cropBoxResizable: cropper.cropBoxResizable ? cropper.cropBoxResizable : false,
|
|
186
|
-
onCrop:
|
|
187
|
-
|
|
122
|
+
onCrop: croppedSrc => {
|
|
123
|
+
const croppedImageFile = (0, _utils.dataURLtoFile)(croppedSrc, file.name);
|
|
188
124
|
croppedImageFile.url = croppedSrc;
|
|
189
125
|
cropper.onCrop(index, croppedImageFile);
|
|
190
|
-
setFiles(
|
|
191
|
-
|
|
192
|
-
|
|
126
|
+
setFiles(previousFiles => {
|
|
127
|
+
const newFiles = [...previousFiles];
|
|
193
128
|
newFiles[index] = croppedImageFile;
|
|
194
129
|
return newFiles;
|
|
195
130
|
});
|
|
196
131
|
}
|
|
197
132
|
});
|
|
198
133
|
}, [width, height, cropper]);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return files.map(function (file, index) {
|
|
134
|
+
const previewItem = () => {
|
|
135
|
+
return files.map((file, index) => {
|
|
202
136
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Image, {
|
|
203
137
|
width: width,
|
|
204
138
|
height: height,
|
|
205
139
|
fixedSize: fixedSize,
|
|
206
|
-
onClick:
|
|
140
|
+
onClick: event => {
|
|
207
141
|
event.stopPropagation();
|
|
208
142
|
},
|
|
209
143
|
children: [!disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(ButtonGroup, {
|
|
210
144
|
children: [cropper && /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
|
|
211
145
|
title: "Crop",
|
|
212
|
-
onClick:
|
|
213
|
-
return handleCrop(event, index, file);
|
|
214
|
-
},
|
|
146
|
+
onClick: event => handleCrop(event, index, file),
|
|
215
147
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_md.MdCrop, {})
|
|
216
148
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
|
|
217
149
|
danger: true,
|
|
218
150
|
title: "Remove",
|
|
219
|
-
onClick:
|
|
220
|
-
return handleRemoveFile(event, index);
|
|
221
|
-
},
|
|
151
|
+
onClick: event => handleRemoveFile(event, index),
|
|
222
152
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fi.FiX, {})
|
|
223
153
|
})]
|
|
224
154
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
@@ -229,40 +159,36 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
229
159
|
}, index);
|
|
230
160
|
});
|
|
231
161
|
};
|
|
232
|
-
|
|
233
|
-
var addFiles = (0, _react.useCallback)(function (files) {
|
|
162
|
+
const addFiles = (0, _react.useCallback)(files => {
|
|
234
163
|
handleAddFiles(files);
|
|
235
164
|
}, [handleAddFiles]);
|
|
236
|
-
|
|
165
|
+
const remove = (0, _react.useCallback)(index => {
|
|
237
166
|
handleRemoveFile(null, index);
|
|
238
167
|
}, [handleRemoveFile]);
|
|
239
|
-
|
|
240
|
-
var handleBlur = function handleBlur() {
|
|
168
|
+
const handleBlur = () => {
|
|
241
169
|
if (focus) {
|
|
242
170
|
if (onBlur) {
|
|
243
171
|
onBlur();
|
|
244
172
|
}
|
|
245
|
-
|
|
246
173
|
setFocus(false);
|
|
247
174
|
}
|
|
248
175
|
};
|
|
249
|
-
|
|
250
|
-
(0, _react.useEffect)(function () {
|
|
176
|
+
(0, _react.useEffect)(() => {
|
|
251
177
|
if (addedFiles.length > 0 && onAddedFile) {
|
|
252
|
-
|
|
253
|
-
addedFiles.forEach(
|
|
178
|
+
const startIndex = files.length - addedFiles.length;
|
|
179
|
+
addedFiles.forEach((file, index) => {
|
|
254
180
|
onAddedFile(file, startIndex + index);
|
|
255
181
|
});
|
|
256
182
|
setAddedFiles([]);
|
|
257
183
|
}
|
|
258
184
|
}, [addedFiles, onAddedFile, files]);
|
|
259
|
-
(0, _react.useEffect)(
|
|
185
|
+
(0, _react.useEffect)(() => {
|
|
260
186
|
setDropzoneFunc({
|
|
261
|
-
addFiles
|
|
262
|
-
remove
|
|
187
|
+
addFiles,
|
|
188
|
+
remove
|
|
263
189
|
});
|
|
264
190
|
}, [setDropzoneFunc, addFiles, remove]);
|
|
265
|
-
|
|
191
|
+
const messageItem = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Message.default, {
|
|
266
192
|
dragging: dragging,
|
|
267
193
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_fi.FiUpload, {
|
|
268
194
|
role: "img",
|
|
@@ -283,7 +209,7 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
283
209
|
onDrop: handleDrop,
|
|
284
210
|
reachedLimit: files.length >= maxFiles,
|
|
285
211
|
onBlur: handleBlur,
|
|
286
|
-
onFocus:
|
|
212
|
+
onFocus: () => {
|
|
287
213
|
setFocus(true);
|
|
288
214
|
},
|
|
289
215
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HiddenFileInput.default, {
|
|
@@ -295,46 +221,45 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
295
221
|
}), files.length === 0 ? messageItem : previewItem()]
|
|
296
222
|
});
|
|
297
223
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
224
|
+
const Wrapper = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n min-height: 200px;\n border: 4px dashed var(--border-color);\n border-radius: var(--border-radius-l);\n color: var(--font-on-background);\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n padding: var(--spacing-xs);\n cursor: pointer;\n\n ", ";\n\n ", ";\n\n ", ";\n\n &:focus {\n border-color: var(--color-primary);\n }\n"])), _ref2 => {
|
|
225
|
+
let {
|
|
226
|
+
reachedLimit
|
|
227
|
+
} = _ref2;
|
|
301
228
|
return reachedLimit && 'cursor:default;';
|
|
302
|
-
},
|
|
303
|
-
|
|
229
|
+
}, _ref3 => {
|
|
230
|
+
let {
|
|
231
|
+
disabled
|
|
232
|
+
} = _ref3;
|
|
304
233
|
return disabled && 'cursor:not-allowed; opacity: 0.5;';
|
|
305
|
-
},
|
|
306
|
-
|
|
234
|
+
}, _ref4 => {
|
|
235
|
+
let {
|
|
236
|
+
dragging
|
|
237
|
+
} = _ref4;
|
|
307
238
|
return dragging && 'border-color: var(--color-primary);';
|
|
308
239
|
});
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
240
|
+
const Image = _styledComponents.default.figure(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n margin: var(--spacing-xs);\n\n ", "\n\n > img {\n width: 100%;\n height: 100%;\n border-radius: var(--border-radius);\n }\n"])), _ref5 => {
|
|
241
|
+
let {
|
|
242
|
+
width,
|
|
243
|
+
height,
|
|
244
|
+
fixedSize
|
|
245
|
+
} = _ref5;
|
|
315
246
|
if (fixedSize) {
|
|
316
247
|
return "\n width: ".concat(width, "px;\n height: ").concat(height, "px;\n ");
|
|
317
248
|
}
|
|
318
|
-
|
|
319
249
|
if (width < height) {
|
|
320
250
|
return "\n width: ".concat(width, "px;\n max-width: ").concat(width, "px;\n max-height: ").concat(height, "px;\n ");
|
|
321
251
|
}
|
|
322
|
-
|
|
323
252
|
if (height < width) {
|
|
324
253
|
return "\n height: ".concat(height, "px;\n max-width: ").concat(width, "px;\n max-height: ").concat(height, "px;\n ");
|
|
325
254
|
}
|
|
326
255
|
});
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
};
|
|
334
|
-
})(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: inline-block;\n width: 32px;\n height: 32px;\n color: var(--color-white);\n background: var(--color-primary);\n border-radius: var(--border-radius-round);\n cursor: pointer;\n\n > svg {\n color: var(--color-white);\n margin: 0 auto;\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n margin: 0 auto;\n display: block;\n }\n\n &:not(:first-child) {\n margin-left: var(--spacing-xs);\n }\n\n ", "\n"])), function (_ref6) {
|
|
335
|
-
var danger = _ref6.danger;
|
|
256
|
+
const ButtonGroup = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n right: calc(var(--spacing-xs) * -1);\n top: calc(var(--spacing-xs) * -1);\n"])));
|
|
257
|
+
const Button = _styledComponents.default.div.attrs(() => ({
|
|
258
|
+
role: 'button'
|
|
259
|
+
}))(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: inline-block;\n width: 32px;\n height: 32px;\n color: var(--color-white);\n background: var(--color-primary);\n border-radius: var(--border-radius-round);\n cursor: pointer;\n\n > svg {\n color: var(--color-white);\n margin: 0 auto;\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n margin: 0 auto;\n display: block;\n }\n\n &:not(:first-child) {\n margin-left: var(--spacing-xs);\n }\n\n ", "\n"])), _ref6 => {
|
|
260
|
+
let {
|
|
261
|
+
danger
|
|
262
|
+
} = _ref6;
|
|
336
263
|
return danger && 'background: var(--color-danger);';
|
|
337
264
|
});
|
|
338
|
-
|
|
339
|
-
var _default = ImageDropzone;
|
|
340
|
-
exports.default = _default;
|
|
265
|
+
var _default = exports.default = ImageDropzone;
|
package/dropzone/index.js
CHANGED
|
@@ -5,19 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "FileDropzone", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _FileDropzone.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "ImageDropzone", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
14
|
+
get: function () {
|
|
15
15
|
return _ImageDropzone.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
var _FileDropzone = _interopRequireDefault(require("./FileDropzone"));
|
|
20
|
-
|
|
21
19
|
var _ImageDropzone = _interopRequireDefault(require("./ImageDropzone"));
|
|
22
|
-
|
|
23
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,23 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
|
|
10
8
|
var _templateObject;
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
var dragging = _ref.dragging;
|
|
11
|
+
const Message = _styledComponents.default.div.attrs(() => ({
|
|
12
|
+
'data-testid': 'message-container'
|
|
13
|
+
}))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n text-align: center;\n\n > svg {\n margin-bottom: var(--spacing-s);\n font-size: var(--font-h2);\n }\n\n ", ";\n"])), _ref => {
|
|
14
|
+
let {
|
|
15
|
+
dragging
|
|
16
|
+
} = _ref;
|
|
22
17
|
return dragging ? 'opacity: 0.5' : '';
|
|
23
18
|
});
|
|
24
|
-
|
|
25
|
-
var _default = Message;
|
|
26
|
-
exports.default = _default;
|
|
19
|
+
var _default = exports.default = Message;
|
package/figure/IconFigure.js
CHANGED
|
@@ -4,37 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
|
|
10
8
|
var _templateObject;
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const IconFigure = _styledComponents.default.figure.attrs(_ref => {
|
|
12
|
+
let {
|
|
13
|
+
size
|
|
14
|
+
} = _ref;
|
|
18
15
|
return {
|
|
19
16
|
size: size || 'medium'
|
|
20
17
|
};
|
|
21
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])),
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
size
|
|
21
|
+
} = _ref2;
|
|
24
22
|
switch (size) {
|
|
25
23
|
case 'small':
|
|
26
24
|
return "\n width: 16px;\n height: 16px;\n ";
|
|
27
|
-
|
|
28
25
|
case 'medium':
|
|
29
26
|
return "\n width: 24px;\n height: 24px;\n ";
|
|
30
|
-
|
|
31
27
|
case 'large':
|
|
32
28
|
return "\n width: 32px;\n height: 32px;\n ";
|
|
33
|
-
|
|
34
29
|
default:
|
|
35
30
|
break;
|
|
36
31
|
}
|
|
37
32
|
});
|
|
38
|
-
|
|
39
|
-
var _default = IconFigure;
|
|
40
|
-
exports.default = _default;
|
|
33
|
+
var _default = exports.default = IconFigure;
|
package/figure/ImageFigure.js
CHANGED
|
@@ -4,28 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
|
|
10
8
|
var _rounded = _interopRequireDefault(require("../styles/mixin/rounded"));
|
|
11
|
-
|
|
12
9
|
var _templateObject;
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
var small = _ref.small;
|
|
12
|
+
const ImageFigure = _styledComponents.default.figure.attrs(() => ({
|
|
13
|
+
rounded: true
|
|
14
|
+
}))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 160px;\n height: 160px;\n border: 4px dashed var(--border-color);\n padding: var(--spacing-xs);\n margin-left: var(--spacing);\n\n ", "\n\n ", "\n\n ", "\n"])), _ref => {
|
|
15
|
+
let {
|
|
16
|
+
small
|
|
17
|
+
} = _ref;
|
|
24
18
|
return small && "\n width: 40px;\n height: 40px;\n ";
|
|
25
|
-
}, _rounded.default,
|
|
26
|
-
|
|
19
|
+
}, _rounded.default, _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
noBorder
|
|
22
|
+
} = _ref2;
|
|
27
23
|
return noBorder && 'border: none;';
|
|
28
24
|
});
|
|
29
|
-
|
|
30
|
-
var _default = ImageFigure;
|
|
31
|
-
exports.default = _default;
|
|
25
|
+
var _default = exports.default = ImageFigure;
|
package/figure/index.js
CHANGED
|
@@ -5,19 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "IconFigure", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _IconFigure.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "ImageFigure", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function
|
|
14
|
+
get: function () {
|
|
15
15
|
return _ImageFigure.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
var _IconFigure = _interopRequireDefault(require("./IconFigure"));
|
|
20
|
-
|
|
21
19
|
var _ImageFigure = _interopRequireDefault(require("./ImageFigure"));
|
|
22
|
-
|
|
23
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/file/HiddenFileInput.js
CHANGED
|
@@ -4,21 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
-
|
|
10
8
|
var _templateObject;
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n"])));
|
|
22
|
-
|
|
23
|
-
var _default = HiddenFileInput;
|
|
24
|
-
exports.default = _default;
|
|
11
|
+
const HiddenFileInput = _styledComponents.default.input.attrs(() => ({
|
|
12
|
+
'data-testid': 'hiddenFileInput',
|
|
13
|
+
type: 'file'
|
|
14
|
+
}))(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: none;\n"])));
|
|
15
|
+
var _default = exports.default = HiddenFileInput;
|
package/file/index.js
CHANGED
|
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "HiddenFileInput", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _HiddenFileInput.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _HiddenFileInput = _interopRequireDefault(require("./HiddenFileInput"));
|
|
14
|
-
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|