@geneui/components 2.11.1 → 2.12.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/{ActionableList.js → ActionableList/index.js} +83 -152
- package/{AdvancedSearch.js → AdvancedSearch/index.js} +291 -304
- package/{Alert.js → Alert/index.js} +19 -20
- package/Avatar/index.js +30 -0
- package/{Badge.js → Badge/index.js} +13 -14
- package/{Breadcrumb.js → Breadcrumb/index.js} +32 -31
- package/{BusyLoader.js → BusyLoader/index.js} +11 -12
- package/{Button.js → Button/index.js} +20 -21
- package/CHANGELOG.md +56 -0
- package/{Card.js → Card/index.js} +82 -94
- package/{CardList.js → CardList/index.js} +118 -165
- package/{CellMeasurerCache-c11cec83.js → CellMeasurerCache-bc2163c1.js} +2 -2
- package/{index-0cf65939.js → Charts/index.js} +17103 -30439
- package/{Checkbox.js → Checkbox/index.js} +37 -38
- package/{CheckboxGroup.js → CheckboxGroup/index.js} +41 -42
- package/{CheckboxGroupWithSearch.js → CheckboxGroupWithSearch/index.js} +64 -65
- package/{Collapse.js → Collapse/index.js} +28 -29
- package/{ColorPicker.js → ColorPicker/index.js} +16 -16
- package/ComboBox/index.js +525 -0
- package/Counter/index.js +310 -0
- package/{DateFilter.js → DateFilter/index.js} +46 -43
- package/{DatePicker.js → DatePicker/index.js} +106 -108
- package/{index-5e722d91.js → DatePickerInput/index.js} +103 -89
- package/{Divider.js → Divider/index.js} +9 -10
- package/{Drawer.js → Drawer/index.js} +40 -41
- package/Dropdown/index.js +41 -0
- package/{Editor.js → Editor/index.js} +165 -164
- package/{Empty.js → Empty/index.js} +12 -13
- package/{ExtendedInput.js → ExtendedInput/index.js} +83 -73
- package/Form/index.js +86 -0
- package/{FormContainer.js → FormContainer/index.js} +25 -26
- package/FormableCheckbox/index.js +26 -0
- package/FormableDatePicker/index.js +42 -0
- package/FormableDropdown/index.js +48 -0
- package/FormableEditor/index.js +24 -0
- package/{FormableHOC-21051057.js → FormableHOC-55263162.js} +3 -3
- package/FormableMultiSelectDropdown/index.js +48 -0
- package/FormableNumberInput/index.js +32 -0
- package/FormableRadio/index.js +22 -0
- package/FormableSwitcher/index.js +22 -0
- package/FormableTextInput/index.js +32 -0
- package/FormableUploader/index.js +42 -0
- package/GeneUIProvider/index.js +282 -0
- package/{Grid.js → Grid/index.js} +27 -27
- package/Holder/index.js +261 -0
- package/{Icon.js → Icon/index.js} +9 -10
- package/{Image.js → Image/index.js} +29 -30
- package/ImagePreview/index.js +481 -0
- package/{KeyValue.js → KeyValue/index.js} +11 -12
- package/LICENSE +21 -0
- package/{Label.js → Label/index.js} +8 -9
- package/LinkButton/index.js +67 -0
- package/{Menu.js → Menu/index.js} +39 -34
- package/{MobileNavigation.js → MobileNavigation/index.js} +19 -20
- package/{MobilePopup.js → MobilePopup/index.js} +42 -41
- package/{Modal.js → Modal/index.js} +39 -40
- package/ModuleTitle/index.js +143 -0
- package/{NavigationMenu.js → NavigationMenu/index.js} +44 -35
- package/{Notification.js → Notification/index.js} +24 -25
- package/{Option.js → Option/index.js} +37 -39
- package/Overlay/index.js +189 -0
- package/{Overspread.js → Overspread/index.js} +65 -121
- package/{Pagination.js → Pagination/index.js} +35 -34
- package/Paper/index.js +96 -0
- package/{index-a4635754.js → Popover/index.js} +48 -58
- package/{index-702bf24a.js → PopoverV2/index.js} +57 -1006
- package/{Portal.js → Portal/index.js} +7 -8
- package/{Products.js → Products/index.js} +20 -21
- package/Profile/index.js +585 -0
- package/{Progress.js → Progress/index.js} +24 -25
- package/{QRCode.js → QRCode/index.js} +4 -6
- package/{Radio.js → Radio/index.js} +25 -26
- package/{RadioGroup.js → RadioGroup/index.js} +17 -18
- package/{index-00fe8887.js → Range/index.js} +29 -32
- package/RichEditor/index.js +13 -0
- package/{RichEditor-b7928765.js → RichEditor-8b9c3afa.js} +18 -18
- package/{Scrollbar.js → Scrollbar/index.js} +15 -17
- package/{Search.js → Search/index.js} +25 -24
- package/{SearchWithDropdown.js → SearchWithDropdown/index.js} +47 -104
- package/{Section.js → Section/index.js} +15 -16
- package/{SkeletonLoader.js → SkeletonLoader/index.js} +13 -14
- package/{Slider.js → Slider/index.js} +46 -43
- package/{Status.js → Status/index.js} +23 -24
- package/{Steps.js → Steps/index.js} +42 -41
- package/{index-5cea9a7d.js → SuggestionList/index.js} +15 -38
- package/{Switcher.js → Switcher/index.js} +30 -31
- package/Table/index.js +53 -0
- package/{TableCompositions.js → TableCompositions/index.js} +132 -168
- package/{Tabs.js → Tabs/index.js} +27 -28
- package/{Tag.js → Tag/index.js} +17 -18
- package/{TextLink.js → TextLink/index.js} +3 -3
- package/{Textarea.js → Textarea/index.js} +66 -65
- package/{Time.js → Time/index.js} +13 -14
- package/TimePicker/index.js +556 -0
- package/{Timeline.js → Timeline/index.js} +19 -20
- package/{Title.js → Title/index.js} +13 -14
- package/{Toaster.js → Toaster/index.js} +19 -20
- package/{Tooltip.js → Tooltip/index.js} +27 -28
- package/{TransferList.js → TransferList/index.js} +44 -55
- package/{index-d9e8a888.js → Uploader/index.js} +119 -116
- package/{ValidatableCheckbox.js → ValidatableCheckbox/index.js} +23 -24
- package/{ValidatableDatePicker.js → ValidatableDatePicker/index.js} +45 -42
- package/ValidatableDropdown/index.js +139 -0
- package/ValidatableElements/index.js +68 -0
- package/ValidatableMultiSelectDropdown/index.js +150 -0
- package/{ValidatableNumberInput.js → ValidatableNumberInput/index.js} +34 -33
- package/{ValidatableRadio.js → ValidatableRadio/index.js} +19 -20
- package/{ValidatableSwitcher.js → ValidatableSwitcher/index.js} +19 -20
- package/{ValidatableTextInput.js → ValidatableTextInput/index.js} +32 -31
- package/{ValidatableTimeInput.js → ValidatableTimeInput/index.js} +31 -30
- package/{ValidatableUploader.js → ValidatableUploader/index.js} +36 -34
- package/Widget/index.js +227 -0
- package/config-0ca92874.js +31 -0
- package/{configs-91c86664.js → configs-fed6ac34.js} +28 -1
- package/hooks/useBodyScroll.js +16 -0
- package/hooks/useClick.js +18 -0
- package/{useClickOutside-5183e396.js → hooks/useClickOutside.js} +1 -1
- package/hooks/useDebounceHook.js +16 -0
- package/{useDeviceType-dd51db38.js → hooks/useDeviceType.js} +4 -3
- package/hooks/useDidMount.js +15 -0
- package/{useEllipsisDetection-ef536015.js → hooks/useEllipsisDetection.js} +1 -1
- package/hooks/useForceUpdate.js +8 -0
- package/hooks/useImgDownload.js +18 -0
- package/{useKeyDown-38102ae7.js → hooks/useKeyDown.js} +1 -1
- package/hooks/useMount.js +13 -0
- package/hooks/useMutationObserver.js +21 -0
- package/hooks/usePrevious.js +10 -0
- package/hooks/useThrottle.js +16 -0
- package/hooks/useToggle.js +11 -0
- package/hooks/useUpdatableRef.js +14 -0
- package/hooks/useUpdate.js +10 -0
- package/{useWidth-9f4647f8.js → hooks/useWidth.js} +2 -2
- package/{useWindowSize-80369d76.js → hooks/useWindowSize.js} +1 -1
- package/index-45eafea6.js +90 -0
- package/{index-a59530cd.js → index-583e0b30.js} +1 -1
- package/{index-67f4d4d1.js → index-78d2ea5b.js} +684 -752
- package/{index-ac59cb10.js → index-a0e4e333.js} +6 -6
- package/{index-e8776f3d.js → index-b1e429a7.js} +1 -1
- package/index-bd525a3a.js +10054 -0
- package/index.d.ts +115 -0
- package/index.js +138 -113
- package/index.mobile.d.ts +16 -0
- package/jsx-runtime-57b40d9e.js +957 -0
- package/lib/atoms/Avatar/Avatar.d.ts +34 -0
- package/lib/atoms/Avatar/index.d.ts +1 -0
- package/lib/atoms/LinkButton/LinkButton.d.ts +46 -0
- package/lib/atoms/LinkButton/index.d.ts +1 -0
- package/{objectWithoutPropertiesLoose-299691d8.js → objectWithoutPropertiesLoose-d8a4a68c.js} +12 -12
- package/package.json +42 -22
- package/{rangeAndSlider-20599da4.js → rangeAndSlider-0301a458.js} +220 -375
- package/{react-beautiful-dnd.esm-38c37304.js → react-beautiful-dnd.esm-04c14563.js} +9 -9
- package/react-lifecycles-compat.es-6e1f3768.js +158 -0
- package/Avatar.js +0 -77
- package/Charts.js +0 -99
- package/ComboBox.js +0 -99
- package/Counter.js +0 -99
- package/DatePickerInput.js +0 -30
- package/Dropdown.js +0 -99
- package/Form.js +0 -116
- package/FormableCheckbox.js +0 -27
- package/FormableDatePicker.js +0 -39
- package/FormableDropdown.js +0 -105
- package/FormableEditor.js +0 -24
- package/FormableMultiSelectDropdown.js +0 -105
- package/FormableNumberInput.js +0 -31
- package/FormableRadio.js +0 -23
- package/FormableSwitcher.js +0 -23
- package/FormableTextInput.js +0 -31
- package/FormableUploader.js +0 -40
- package/GeneUIProvider.js +0 -256
- package/Holder.js +0 -99
- package/ImagePreview.js +0 -99
- package/LinkButton.js +0 -104
- package/ModuleTitle.js +0 -99
- package/Overlay.js +0 -99
- package/Paper.js +0 -97
- package/Popover.js +0 -20
- package/PopoverV2.js +0 -19
- package/Profile.js +0 -99
- package/Range.js +0 -14
- package/RichEditor.js +0 -13
- package/SuggestionList.js +0 -15
- package/Table.js +0 -102
- package/TimePicker.js +0 -99
- package/Uploader.js +0 -32
- package/ValidatableDropdown.js +0 -99
- package/ValidatableElements.js +0 -99
- package/ValidatableMultiSelectDropdown.js +0 -99
- package/Widget.js +0 -99
- package/globalStyling-9c60a159.js +0 -4
- package/index-b7a33c58.js +0 -11
- package/index-e0af0caf.js +0 -1182
- package/useMount-6fef51a5.js +0 -9
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { _ as _extends } from '../_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
2
|
+
import React__default, { forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { f as fileSizeDisplay, n as noop } from '../index-a0e4e333.js';
|
|
5
|
+
import Portal from '../Portal/index.js';
|
|
6
|
+
import { c as classnames } from '../index-6ff23041.js';
|
|
7
|
+
import '../configs-fed6ac34.js';
|
|
8
|
+
import useImgDownload from '../hooks/useImgDownload.js';
|
|
9
|
+
import useEllipsisDetection from '../hooks/useEllipsisDetection.js';
|
|
10
|
+
import Icon from '../Icon/index.js';
|
|
11
|
+
import Switcher from '../Switcher/index.js';
|
|
12
|
+
import Tooltip from '../Tooltip/index.js';
|
|
13
|
+
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
14
|
+
import '../dateValidation-67caec66.js';
|
|
15
|
+
import '../_commonjsHelpers-24198af3.js';
|
|
16
|
+
import 'react-dom';
|
|
17
|
+
import '../GeneUIProvider/index.js';
|
|
18
|
+
import '../hooks/useKeyDown.js';
|
|
19
|
+
import '../checkboxRadioSwitcher-5b69d7bd.js';
|
|
20
|
+
import '../guid-8ddf77b3.js';
|
|
21
|
+
import '../Popover-f4d1cac0.js';
|
|
22
|
+
import '../hooks/useDeviceType.js';
|
|
23
|
+
import '../hooks/useWindowSize.js';
|
|
24
|
+
|
|
25
|
+
const magnifierAppearances = {
|
|
26
|
+
square: 'square',
|
|
27
|
+
circle: 'circle'
|
|
28
|
+
};
|
|
29
|
+
const bufferSize = 40;
|
|
30
|
+
const borderWidth = 2;
|
|
31
|
+
const Magnifier = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
32
|
+
let {
|
|
33
|
+
imgUrl,
|
|
34
|
+
className,
|
|
35
|
+
name,
|
|
36
|
+
withRotation,
|
|
37
|
+
withMagnifier,
|
|
38
|
+
showMagnifier,
|
|
39
|
+
zoom,
|
|
40
|
+
magnifierAppearance
|
|
41
|
+
} = _ref;
|
|
42
|
+
const imgRef = useRef(null);
|
|
43
|
+
const glassRef = useRef(null);
|
|
44
|
+
const [rotationDeg, setRotationDeg] = useState(0);
|
|
45
|
+
const [isCursorInScopeOfImage, setIsCursorInScopeOfImage] = useState(false);
|
|
46
|
+
const [glassPositionStyles, setGlassPositionStyles] = useState({});
|
|
47
|
+
const rotate = useCallback(function () {
|
|
48
|
+
let deg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 90;
|
|
49
|
+
if (!withRotation) return;
|
|
50
|
+
const newDeg = rotationDeg + deg;
|
|
51
|
+
setRotationDeg(Math.abs(newDeg) >= 360 ? 0 : newDeg);
|
|
52
|
+
}, [rotationDeg, withRotation]);
|
|
53
|
+
useImperativeHandle(ref, () => ({
|
|
54
|
+
rotate
|
|
55
|
+
}));
|
|
56
|
+
const onMouseMoveHandler = useCallback(e => {
|
|
57
|
+
var _glassRef$current, _glassRef$current2;
|
|
58
|
+
// Prevent any calculation in case of magnifier is turned off
|
|
59
|
+
if (!withMagnifier) return;
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
const img = imgRef.current;
|
|
62
|
+
const cnt = img.offsetParent;
|
|
63
|
+
const glassWidth = ((_glassRef$current = glassRef.current) === null || _glassRef$current === void 0 ? void 0 : _glassRef$current.offsetWidth) / 2;
|
|
64
|
+
const glassHeight = ((_glassRef$current2 = glassRef.current) === null || _glassRef$current2 === void 0 ? void 0 : _glassRef$current2.offsetHeight) / 2;
|
|
65
|
+
|
|
66
|
+
// Positive value of rotation deg
|
|
67
|
+
const absRotationDeg = Math.abs(rotationDeg);
|
|
68
|
+
const {
|
|
69
|
+
clientX,
|
|
70
|
+
clientY
|
|
71
|
+
} = e;
|
|
72
|
+
const stylesProps = {};
|
|
73
|
+
|
|
74
|
+
// @TODO need move to useMemo hooks for better performance
|
|
75
|
+
const {
|
|
76
|
+
bottom,
|
|
77
|
+
height,
|
|
78
|
+
left,
|
|
79
|
+
right,
|
|
80
|
+
top,
|
|
81
|
+
width
|
|
82
|
+
} = cnt.getBoundingClientRect();
|
|
83
|
+
let x = clientX - left - glassWidth;
|
|
84
|
+
let y = clientY - top - glassHeight;
|
|
85
|
+
|
|
86
|
+
// Calculate horizontal thresholds for img
|
|
87
|
+
if (clientX < left + bufferSize) x = -glassWidth + bufferSize;
|
|
88
|
+
if (clientX > right - bufferSize) x = width - bufferSize - glassWidth;
|
|
89
|
+
|
|
90
|
+
// Calculate vertical thresholds for img
|
|
91
|
+
if (clientY < top + bufferSize) y = -glassHeight + bufferSize;
|
|
92
|
+
if (clientY > bottom - bufferSize) y = height - glassHeight - bufferSize;
|
|
93
|
+
|
|
94
|
+
// Handle vertical rotation cases
|
|
95
|
+
if (rotationDeg === 0 || absRotationDeg === 180) {
|
|
96
|
+
if (rotationDeg === 0) {
|
|
97
|
+
// Adoption coordinates values to img sides
|
|
98
|
+
stylesProps.left = "".concat(x, "px");
|
|
99
|
+
stylesProps.top = "".concat(y, "px");
|
|
100
|
+
|
|
101
|
+
// Calculate zoomed image positions
|
|
102
|
+
const glassX = x * zoom + bufferSize * zoom + borderWidth * 2;
|
|
103
|
+
const glassY = y * zoom + bufferSize * zoom + borderWidth * 2;
|
|
104
|
+
stylesProps.backgroundPosition = "-".concat(glassX, "px -").concat(glassY, "px");
|
|
105
|
+
}
|
|
106
|
+
if (absRotationDeg === 180) {
|
|
107
|
+
// Adoption coordinates values to img sides
|
|
108
|
+
stylesProps.right = "".concat(x, "px");
|
|
109
|
+
stylesProps.bottom = "".concat(y, "px");
|
|
110
|
+
|
|
111
|
+
// Calculate zoomed image positions
|
|
112
|
+
const glassX = width * zoom - glassWidth - 40 * zoom - (x * zoom + 40 * zoom);
|
|
113
|
+
const glassY = height * zoom - glassHeight - 40 * zoom - (y * zoom + 40 * zoom);
|
|
114
|
+
stylesProps.backgroundPosition = "-".concat(glassX, "px -").concat(glassY, "px");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Handle horizontal rotation cases
|
|
119
|
+
if (absRotationDeg === 90 || absRotationDeg === 270) {
|
|
120
|
+
if (rotationDeg === 90 || rotationDeg === -270) {
|
|
121
|
+
// Adoption coordinates values to img sides
|
|
122
|
+
stylesProps.bottom = "".concat(x, "px"); // x
|
|
123
|
+
stylesProps.left = "".concat(y, "px"); // y
|
|
124
|
+
|
|
125
|
+
// Calculate zoomed image positions
|
|
126
|
+
const glassX = img.height * zoom - glassHeight - 40 * zoom - (x * zoom + 40 * zoom);
|
|
127
|
+
const glassY = y * zoom + 40 * zoom;
|
|
128
|
+
stylesProps.backgroundPosition = "-".concat(glassY, "px -").concat(glassX, "px");
|
|
129
|
+
}
|
|
130
|
+
if (rotationDeg === 270 || rotationDeg === -90) {
|
|
131
|
+
// Adoption coordinates values to img sides
|
|
132
|
+
stylesProps.top = "".concat(x, "px"); // x
|
|
133
|
+
stylesProps.right = "".concat(y, "px"); // y
|
|
134
|
+
|
|
135
|
+
// Calculate zoomed image positions
|
|
136
|
+
const glassX = x * zoom + 40 * zoom;
|
|
137
|
+
const glassY = img.width * zoom - glassWidth - 40 * zoom - (y * zoom + 40 * zoom);
|
|
138
|
+
stylesProps.backgroundPosition = "-".concat(glassY, "px -").concat(glassX, "px");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
setGlassPositionStyles(stylesProps);
|
|
142
|
+
}, [rotationDeg]);
|
|
143
|
+
const onMouseEnterHandler = useCallback(() => {
|
|
144
|
+
showMagnifier && setIsCursorInScopeOfImage(true);
|
|
145
|
+
}, [showMagnifier]);
|
|
146
|
+
const onMouseLeaveHandler = useCallback(e => {
|
|
147
|
+
if (e.relatedTarget !== glassRef.current) {
|
|
148
|
+
setIsCursorInScopeOfImage(false);
|
|
149
|
+
}
|
|
150
|
+
}, []);
|
|
151
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
152
|
+
className: "imgMagnifier",
|
|
153
|
+
style: {
|
|
154
|
+
transform: "rotateZ(".concat(rotationDeg, "deg)")
|
|
155
|
+
}
|
|
156
|
+
}, withMagnifier && showMagnifier && isCursorInScopeOfImage && /*#__PURE__*/React__default.createElement("div", {
|
|
157
|
+
ref: glassRef,
|
|
158
|
+
className: "imgMagnifier__glass",
|
|
159
|
+
style: {
|
|
160
|
+
borderRadius: "".concat(magnifierAppearance === magnifierAppearances.circle ? 50 : 0, "%"),
|
|
161
|
+
backgroundImage: "url(".concat(imgUrl, ")"),
|
|
162
|
+
backgroundRepeat: 'no-repeat',
|
|
163
|
+
backgroundSize: "".concat(imgRef.current.clientWidth * zoom, "px ").concat(imgRef.current.clientHeight * zoom, "px"),
|
|
164
|
+
...glassPositionStyles
|
|
165
|
+
},
|
|
166
|
+
onMouseLeave: onMouseLeaveHandler,
|
|
167
|
+
onMouseMove: onMouseMoveHandler
|
|
168
|
+
}), /*#__PURE__*/React__default.createElement("img", {
|
|
169
|
+
ref: imgRef,
|
|
170
|
+
src: imgUrl,
|
|
171
|
+
alt: name,
|
|
172
|
+
onMouseEnter: onMouseEnterHandler,
|
|
173
|
+
onMouseMove: e => showMagnifier && onMouseMoveHandler(e),
|
|
174
|
+
className: "imgMagnifier__img ".concat(className)
|
|
175
|
+
})));
|
|
176
|
+
});
|
|
177
|
+
Magnifier.propTypes = {
|
|
178
|
+
imgUrl: PropTypes.string.isRequired,
|
|
179
|
+
withRotation: PropTypes.bool,
|
|
180
|
+
withMagnifier: PropTypes.bool,
|
|
181
|
+
zoom: PropTypes.number,
|
|
182
|
+
showMagnifier: PropTypes.bool,
|
|
183
|
+
name: PropTypes.string,
|
|
184
|
+
className: PropTypes.string,
|
|
185
|
+
magnifierAppearance: PropTypes.oneOf(Object.keys(magnifierAppearances))
|
|
186
|
+
};
|
|
187
|
+
Magnifier.defaultProps = {
|
|
188
|
+
withRotation: false,
|
|
189
|
+
withMagnifier: false,
|
|
190
|
+
showMagnifier: false,
|
|
191
|
+
zoom: 1.5,
|
|
192
|
+
name: '',
|
|
193
|
+
className: '',
|
|
194
|
+
magnifierAppearance: magnifierAppearances.square
|
|
195
|
+
};
|
|
196
|
+
Magnifier.displayName = 'Magnifier';
|
|
197
|
+
|
|
198
|
+
var css_248z = "[data-gene-ui-version=\"2.12.1\"] .imagePreview{display:flex;flex-direction:column;max-height:100%;max-width:100%;min-width:320px}[data-gene-ui-version=\"2.12.1\"] .imagePreview__close{display:flex}[data-gene-ui-version=\"2.12.1\"] .imagePreview.mobile-view .imagePreview__close{margin-left:auto}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .imagePreview.mobile-view .imagePreview__close{margin-left:0;margin-right:auto}[data-gene-ui-version=\"2.12.1\"] .imagePreview__header{align-items:center;display:flex;justify-content:space-between;padding:16px;width:100%}[data-gene-ui-version=\"2.12.1\"] .imagePreview.mobile-view .imagePreview__header{align-items:flex-start;flex-direction:column-reverse;padding:8px}[data-gene-ui-version=\"2.12.1\"] .imagePreview__infoWrapper{align-items:center;align-self:stretch;display:flex;max-width:calc(100% - 250px)}[data-gene-ui-version=\"2.12.1\"] .imagePreview.mobile-view .imagePreview__infoWrapper{max-width:100%}[data-gene-ui-version=\"2.12.1\"] .imagePreview__info{display:flex;flex-direction:column;font-size:14px;font-weight:600;height:100%;justify-content:center;max-width:calc(100% - 28px);padding:4px 0}[data-gene-ui-version=\"2.12.1\"] .imagePreview__info-center{justify-content:center}[data-gene-ui-version=\"2.12.1\"] .imagePreview__imgIcon{opacity:.8}[data-gene-ui-version=\"2.12.1\"] .imagePreview__sizes{display:flex}[data-gene-ui-version=\"2.12.1\"] .imagePreview__weight{opacity:.8;padding-right:8px}[data-gene-ui-version=\"2.12.1\"] .imagePreview__resolution{opacity:.8;padding-left:8px}[data-gene-ui-version=\"2.12.1\"] .imagePreview__resolution--divider{opacity:.8;padding-left:0}[data-gene-ui-version=\"2.12.1\"] .imagePreview__resolution--separate{margin:0 5px}[data-gene-ui-version=\"2.12.1\"] .imagePreview__options{align-items:center;display:flex}[data-gene-ui-version=\"2.12.1\"] .imagePreview.mobile-view .imagePreview__options{width:100%}[data-gene-ui-version=\"2.12.1\"] .imagePreview__magnifier{min-width:-webkit-fit-content;min-width:-moz-fit-content;min-width:fit-content;padding-right:8px}[data-gene-ui-version=\"2.12.1\"] .imagePreview__rotate{display:flex}[data-gene-ui-version=\"2.12.1\"] .imagePreview__divider,[data-gene-ui-version=\"2.12.1\"] .imagePreview__divider-small{position:relative}[data-gene-ui-version=\"2.12.1\"] .imagePreview__divider-small:after{background:rgba(var(--background-sc-rgb),.3);content:\"\";height:12px;position:absolute;right:0;top:50%;transform:translateY(-50%);width:1px}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .imagePreview__divider-small{margin:0 5px}[data-gene-ui-version=\"2.12.1\"] .imagePreview.mobile-view .imagePreview__divider{margin-right:6px}[data-gene-ui-version=\"2.12.1\"] .imagePreview__icon{cursor:pointer;font-size:28px;font-weight:100;margin:6px}[data-gene-ui-version=\"2.12.1\"] .imagePreview.mobile-view .imagePreview__icon{margin-left:0}[data-gene-ui-version=\"2.12.1\"] .imagePreview__content{align-items:center;aspect-ratio:1;display:flex;justify-content:center}[data-gene-ui-version=\"2.12.1\"] .imagePreview__img{max-height:100%;max-width:100%}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .imagePreview__name{padding-right:8px}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view{height:100%;left:0;position:fixed;top:0;width:100%;z-index:500}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__header{background:#000}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__infoWrapper,[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__name{color:#fff}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__sizes{color:#fff9}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__options{color:#fff}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__magnifier .switcher-element{background:#ffffff61}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__magnifier .switcher-element.active{background:var(--hero)}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__divider:after{background:#ffffff4d;content:\"\";height:24px;position:absolute;right:0;top:50%;transform:translateY(-50%);width:1px}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__divider-small:after{background:#ffffff4d}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__content{height:100%;transform:translateZ(0);width:100%}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__background{background-color:#000c;height:100%;position:absolute;width:100%}[data-gene-ui-version=\"2.12.1\"] .imagePreview.modal-view .imagePreview__img{margin:0 auto;max-height:calc(100vh - 10rem);max-width:calc(100vh - 10rem)}[data-gene-ui-version=\"2.12.1\"] .imgMagnifier{position:relative}[data-gene-ui-version=\"2.12.1\"] .imgMagnifier__glass{border:2px solid #000;cursor:none;height:150px;position:absolute;width:150px;z-index:999999}[data-gene-ui-version=\"2.12.1\"] .imgMagnifier__img{width:100%}";
|
|
199
|
+
styleInject(css_248z);
|
|
200
|
+
|
|
201
|
+
function ImagePreview(_ref) {
|
|
202
|
+
let {
|
|
203
|
+
name,
|
|
204
|
+
path,
|
|
205
|
+
onClose,
|
|
206
|
+
showSize,
|
|
207
|
+
isMobile,
|
|
208
|
+
withModal,
|
|
209
|
+
showRotate,
|
|
210
|
+
showDownload,
|
|
211
|
+
customHeaders,
|
|
212
|
+
showDimensions,
|
|
213
|
+
withMagnifier,
|
|
214
|
+
magnifierDefaultValue,
|
|
215
|
+
...rest
|
|
216
|
+
} = _ref;
|
|
217
|
+
const magnifierRef = useRef();
|
|
218
|
+
const downloadImg = useImgDownload();
|
|
219
|
+
const [meta, setMeta] = useState({
|
|
220
|
+
size: 0,
|
|
221
|
+
width: 0,
|
|
222
|
+
height: 0
|
|
223
|
+
});
|
|
224
|
+
const [isMagnifierOn, setIsMagnifierOn] = useState(magnifierDefaultValue);
|
|
225
|
+
const [imageData, setImageData] = useState('');
|
|
226
|
+
const nameRef = useRef(null);
|
|
227
|
+
const isTruncated = useEllipsisDetection(nameRef);
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
!!path && fetch(path, {
|
|
230
|
+
headers: {
|
|
231
|
+
...customHeaders
|
|
232
|
+
}
|
|
233
|
+
}).then(r => r.arrayBuffer()).then(buffer => {
|
|
234
|
+
const img = new Image();
|
|
235
|
+
const blob = new Blob([buffer], {
|
|
236
|
+
type: 'image/jpeg'
|
|
237
|
+
});
|
|
238
|
+
img.src = URL.createObjectURL(blob);
|
|
239
|
+
img.onload = () => setMeta(val => ({
|
|
240
|
+
...val,
|
|
241
|
+
width: img.naturalWidth,
|
|
242
|
+
height: img.naturalHeight
|
|
243
|
+
}));
|
|
244
|
+
setMeta(val => ({
|
|
245
|
+
...val,
|
|
246
|
+
size: buffer.byteLength
|
|
247
|
+
}));
|
|
248
|
+
setImageData(img.src);
|
|
249
|
+
});
|
|
250
|
+
}, [path]);
|
|
251
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
252
|
+
className: classnames('imagePreview', {
|
|
253
|
+
'modal-view': withModal,
|
|
254
|
+
'mobile-view': isMobile
|
|
255
|
+
})
|
|
256
|
+
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
257
|
+
className: "imagePreview__header"
|
|
258
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
259
|
+
className: "imagePreview__infoWrapper"
|
|
260
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
261
|
+
type: "bc-icon-Image",
|
|
262
|
+
className: "imagePreview__icon imagePreview__imgIcon"
|
|
263
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
264
|
+
className: classnames('imagePreview__info', {
|
|
265
|
+
'imagePreview__info-center': !showSize && !showDimensions
|
|
266
|
+
})
|
|
267
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
268
|
+
text: name,
|
|
269
|
+
isVisible: isTruncated
|
|
270
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
271
|
+
className: "imagePreview__name ellipsis-text",
|
|
272
|
+
ref: nameRef
|
|
273
|
+
}, name)), /*#__PURE__*/React__default.createElement("div", {
|
|
274
|
+
className: "imagePreview__sizes"
|
|
275
|
+
}, showSize && /*#__PURE__*/React__default.createElement("span", {
|
|
276
|
+
className: "imagePreview__weight"
|
|
277
|
+
}, fileSizeDisplay(meta.size)), showSize && showDimensions && /*#__PURE__*/React__default.createElement("div", {
|
|
278
|
+
className: "imagePreview__divider-small"
|
|
279
|
+
}), showDimensions && /*#__PURE__*/React__default.createElement("span", {
|
|
280
|
+
className: classnames('imagePreview__resolution', {
|
|
281
|
+
'imagePreview__resolution--divider': !showSize
|
|
282
|
+
})
|
|
283
|
+
}, /*#__PURE__*/React__default.createElement("span", null, meta.width), /*#__PURE__*/React__default.createElement("span", {
|
|
284
|
+
className: "imagePreview__resolution--separate"
|
|
285
|
+
}, "x"), /*#__PURE__*/React__default.createElement("span", null, meta.height))))), /*#__PURE__*/React__default.createElement("div", {
|
|
286
|
+
className: "imagePreview__options"
|
|
287
|
+
}, withMagnifier && /*#__PURE__*/React__default.createElement("div", {
|
|
288
|
+
className: "imagePreview__magnifier"
|
|
289
|
+
}, /*#__PURE__*/React__default.createElement(Switcher, {
|
|
290
|
+
defaultChecked: magnifierDefaultValue,
|
|
291
|
+
value: isMagnifierOn,
|
|
292
|
+
onChange: e => setIsMagnifierOn(e.currentTarget.checked),
|
|
293
|
+
labelPosition: "left",
|
|
294
|
+
label: "Magnifier"
|
|
295
|
+
})), showRotate && /*#__PURE__*/React__default.createElement("div", {
|
|
296
|
+
className: "imagePreview__rotate"
|
|
297
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
298
|
+
type: "bc-icon-rotate-left",
|
|
299
|
+
className: "imagePreview__icon",
|
|
300
|
+
onClick: () => magnifierRef.current.rotate(-90)
|
|
301
|
+
}), /*#__PURE__*/React__default.createElement(Icon, {
|
|
302
|
+
type: "bc-icon-rotate-right",
|
|
303
|
+
className: "imagePreview__icon",
|
|
304
|
+
onClick: () => magnifierRef.current.rotate(90)
|
|
305
|
+
})), showDownload && /*#__PURE__*/React__default.createElement("div", {
|
|
306
|
+
className: "imagePreview__download"
|
|
307
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
308
|
+
type: "bc-icon-download",
|
|
309
|
+
className: "imagePreview__icon",
|
|
310
|
+
onClick: () => downloadImg(path, name, customHeaders)
|
|
311
|
+
})), withModal && /*#__PURE__*/React__default.createElement("div", {
|
|
312
|
+
className: "imagePreview__close"
|
|
313
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
314
|
+
className: "imagePreview__divider"
|
|
315
|
+
}), /*#__PURE__*/React__default.createElement(Icon, {
|
|
316
|
+
type: "bc-icon-close",
|
|
317
|
+
className: "imagePreview__icon",
|
|
318
|
+
onClick: onClose
|
|
319
|
+
})))), /*#__PURE__*/React__default.createElement("div", {
|
|
320
|
+
className: "imagePreview__content"
|
|
321
|
+
}, withModal ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
322
|
+
className: "imagePreview__background",
|
|
323
|
+
onClick: onClose
|
|
324
|
+
}), imageData && /*#__PURE__*/React__default.createElement(Magnifier, {
|
|
325
|
+
ref: magnifierRef,
|
|
326
|
+
imgUrl: imageData,
|
|
327
|
+
name: name,
|
|
328
|
+
zoom: 2,
|
|
329
|
+
showMagnifier: isMagnifierOn,
|
|
330
|
+
className: "imagePreview__img",
|
|
331
|
+
withRotation: true,
|
|
332
|
+
withMagnifier: true
|
|
333
|
+
})) : imageData && /*#__PURE__*/React__default.createElement(Magnifier, {
|
|
334
|
+
ref: magnifierRef,
|
|
335
|
+
imgUrl: imageData,
|
|
336
|
+
name: name,
|
|
337
|
+
zoom: 2,
|
|
338
|
+
showMagnifier: isMagnifierOn,
|
|
339
|
+
className: "imagePreview__img",
|
|
340
|
+
withRotation: true,
|
|
341
|
+
withMagnifier: true
|
|
342
|
+
})));
|
|
343
|
+
}
|
|
344
|
+
ImagePreview.defaultProps = {
|
|
345
|
+
onClose: noop,
|
|
346
|
+
showSize: true,
|
|
347
|
+
isMobile: false,
|
|
348
|
+
withModal: true,
|
|
349
|
+
showRotate: true,
|
|
350
|
+
showDownload: true,
|
|
351
|
+
withMagnifier: false,
|
|
352
|
+
showDimensions: true,
|
|
353
|
+
magnifierDefaultValue: false
|
|
354
|
+
};
|
|
355
|
+
ImagePreview.propTypes = {
|
|
356
|
+
/**
|
|
357
|
+
* Image file display name
|
|
358
|
+
*/
|
|
359
|
+
name: PropTypes.string,
|
|
360
|
+
/**
|
|
361
|
+
* Image path to display
|
|
362
|
+
*/
|
|
363
|
+
path: PropTypes.string.isRequired,
|
|
364
|
+
/**
|
|
365
|
+
* Event fires when click on close button
|
|
366
|
+
*/
|
|
367
|
+
onClose: PropTypes.func,
|
|
368
|
+
/**
|
|
369
|
+
* Need to size or not
|
|
370
|
+
*/
|
|
371
|
+
showSize: PropTypes.bool,
|
|
372
|
+
/**
|
|
373
|
+
* Need to download or not
|
|
374
|
+
*/
|
|
375
|
+
showDownload: PropTypes.bool,
|
|
376
|
+
/**
|
|
377
|
+
* Need to rotate or not
|
|
378
|
+
*/
|
|
379
|
+
showRotate: PropTypes.bool,
|
|
380
|
+
/**
|
|
381
|
+
* Need to dimensions or not
|
|
382
|
+
*/
|
|
383
|
+
showDimensions: PropTypes.bool,
|
|
384
|
+
/**
|
|
385
|
+
* With magnifier functionality
|
|
386
|
+
*/
|
|
387
|
+
withMagnifier: PropTypes.bool,
|
|
388
|
+
/**
|
|
389
|
+
* modal mode
|
|
390
|
+
*/
|
|
391
|
+
withModal: PropTypes.bool,
|
|
392
|
+
/**
|
|
393
|
+
* Default magnifier Value switched On
|
|
394
|
+
*/
|
|
395
|
+
magnifierDefaultValue: PropTypes.bool,
|
|
396
|
+
/**
|
|
397
|
+
* This is for fetch image for example through this prop you can pass token.
|
|
398
|
+
* Provide an Object that will spread in Request Headers:{...customHeaders} in second parameter for fetch function.
|
|
399
|
+
* For example { 'Content-Type': 'application/json'} it will convert fetch(URL,{headers{'Content-Type': 'application/json'}})
|
|
400
|
+
*/
|
|
401
|
+
customHeaders: PropTypes.object,
|
|
402
|
+
/**
|
|
403
|
+
* The prop is responsible for header view and alignment for mobile device
|
|
404
|
+
*/
|
|
405
|
+
isMobile: PropTypes.bool
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
function ImagePreviewWrapper(_ref) {
|
|
409
|
+
let {
|
|
410
|
+
withModal,
|
|
411
|
+
...restProps
|
|
412
|
+
} = _ref;
|
|
413
|
+
return withModal ? /*#__PURE__*/React__default.createElement(Portal, {
|
|
414
|
+
isOpen: true
|
|
415
|
+
}, /*#__PURE__*/React__default.createElement(ImagePreview, _extends({}, restProps, {
|
|
416
|
+
withModal: withModal
|
|
417
|
+
}))) : /*#__PURE__*/React__default.createElement(ImagePreview, _extends({}, restProps, {
|
|
418
|
+
withModal: withModal
|
|
419
|
+
}));
|
|
420
|
+
}
|
|
421
|
+
ImagePreviewWrapper.defaultProps = {
|
|
422
|
+
onClose: noop,
|
|
423
|
+
showSize: true,
|
|
424
|
+
withModal: true,
|
|
425
|
+
showRotate: true,
|
|
426
|
+
showDownload: true,
|
|
427
|
+
withMagnifier: false,
|
|
428
|
+
showDimensions: true,
|
|
429
|
+
magnifierDefaultValue: false
|
|
430
|
+
};
|
|
431
|
+
ImagePreviewWrapper.propTypes = {
|
|
432
|
+
/**
|
|
433
|
+
* Image file display name
|
|
434
|
+
*/
|
|
435
|
+
name: PropTypes.string,
|
|
436
|
+
/**
|
|
437
|
+
* Image path to display
|
|
438
|
+
*/
|
|
439
|
+
path: PropTypes.string.isRequired,
|
|
440
|
+
/**
|
|
441
|
+
* Event fires when click on close button
|
|
442
|
+
*/
|
|
443
|
+
onClose: PropTypes.func,
|
|
444
|
+
/**
|
|
445
|
+
* Need to size or not
|
|
446
|
+
*/
|
|
447
|
+
showSize: PropTypes.bool,
|
|
448
|
+
/**
|
|
449
|
+
* Need to download or not
|
|
450
|
+
*/
|
|
451
|
+
showDownload: PropTypes.bool,
|
|
452
|
+
/**
|
|
453
|
+
* Need to rotate or not
|
|
454
|
+
*/
|
|
455
|
+
showRotate: PropTypes.bool,
|
|
456
|
+
/**
|
|
457
|
+
* Need to dimensions or not
|
|
458
|
+
*/
|
|
459
|
+
showDimensions: PropTypes.bool,
|
|
460
|
+
/**
|
|
461
|
+
* With magnifier functionality
|
|
462
|
+
*/
|
|
463
|
+
withMagnifier: PropTypes.bool,
|
|
464
|
+
/**
|
|
465
|
+
* default Magnifier switched On
|
|
466
|
+
*/
|
|
467
|
+
magnifierDefaultValue: PropTypes.bool,
|
|
468
|
+
/**
|
|
469
|
+
* modal mode
|
|
470
|
+
*/
|
|
471
|
+
withModal: PropTypes.bool,
|
|
472
|
+
/**
|
|
473
|
+
* This is for fetch image for example through this prop you can pass token.
|
|
474
|
+
* Provide an Object that will spread in Request Headers:{...customHeaders} in second parameter for fetch function.
|
|
475
|
+
* For example { 'Content-Type': 'application/json'} it will convert fetch(URL,{headers{'Content-Type': 'application/json'}})
|
|
476
|
+
*/
|
|
477
|
+
customHeaders: PropTypes.object
|
|
478
|
+
};
|
|
479
|
+
ImagePreviewWrapper.displayName = 'ImagePreview';
|
|
480
|
+
|
|
481
|
+
export { ImagePreviewWrapper as default };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { _ as _extends } from '
|
|
1
|
+
import { _ as _extends } from '../_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { c as classnames } from '
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import '
|
|
8
|
-
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { c as classnames } from '../index-6ff23041.js';
|
|
5
|
+
import { k as keyValueConfig } from '../configs-fed6ac34.js';
|
|
6
|
+
import Icon from '../Icon/index.js';
|
|
7
|
+
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
9
8
|
|
|
10
|
-
var css_248z = "[data-gene-ui-version=\"2.
|
|
9
|
+
var css_248z = "[data-gene-ui-version=\"2.12.1\"] .geneKeyValue{align-items:flex-start;display:flex;flex-wrap:wrap;width:100%}[data-gene-ui-version=\"2.12.1\"] .geneKeyValue--horizontal{align-items:center;flex-wrap:nowrap}[data-gene-ui-version=\"2.12.1\"] .geneKeyValue__icon{padding:0 0 0 8px}[data-gene-ui-version=\"2.12.1\"] .geneKeyValue__label{color:#3c4043b3;flex:1 1;font-size:12px;font-weight:600;line-height:24px;margin:0 0 1rem 1rem;max-width:100%;width:100%}[data-gene-ui-version=\"2.12.1\"] .geneKeyValue__label--horizontal{flex:none;margin:0 0 0 1rem;max-width:50%;width:auto}[data-gene-ui-version=\"2.12.1\"] .geneKeyValue__value{font-size:14px;font-weight:600;line-height:24px;margin:0 1rem;max-width:100%;width:100%}[data-gene-ui-version=\"2.12.1\"] .geneKeyValue__value--horizontal{margin:0 1rem;max-width:50%}[data-gene-ui-version=\"2.12.1\"] .geneKeyValue__iconWrapper+p+p:not(.geneKeyValue__value--horizontal){margin:0 3.2rem 0 4.2rem}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .geneKeyValue__iconWrapper+p+p:not(.geneKeyValue__value--horizontal){margin:0 3.2rem 0 0}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .geneKeyValue__label{direction:ltr;margin:0 1rem 1rem 0}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .geneKeyValue__label--horizontal{margin:0 0 0 1rem}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .geneKeyValue__value{direction:ltr}[data-gene-ui-version=\"2.12.1\"] [dir=rtl] .geneKeyValue__iconWrapper+p:not(.geneKeyValue__label--horizontal){margin:0 0 1rem}";
|
|
11
10
|
styleInject(css_248z);
|
|
12
11
|
|
|
13
12
|
// TODO need to refine where is using restProps
|
|
@@ -40,19 +39,19 @@ KeyValue.propTypes = {
|
|
|
40
39
|
/**
|
|
41
40
|
* Label for 'KeyValue'.
|
|
42
41
|
*/
|
|
43
|
-
label:
|
|
42
|
+
label: PropTypes.node.isRequired,
|
|
44
43
|
/**
|
|
45
44
|
* Value for 'KeyValue'.
|
|
46
45
|
*/
|
|
47
|
-
value:
|
|
46
|
+
value: PropTypes.node,
|
|
48
47
|
/**
|
|
49
48
|
* External/Additional className that can be added to 'KeyValue' component.
|
|
50
49
|
*/
|
|
51
|
-
className:
|
|
50
|
+
className: PropTypes.string,
|
|
52
51
|
/**
|
|
53
52
|
* The way how the KeyValue should be displayed.
|
|
54
53
|
*/
|
|
55
|
-
appearance:
|
|
54
|
+
appearance: PropTypes.oneOf(Object.keys(keyValueConfig.appearance))
|
|
56
55
|
};
|
|
57
56
|
KeyValue.defaultProps = {
|
|
58
57
|
value: '',
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 SoftConstruct
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { c as classnames } from '
|
|
4
|
-
import '
|
|
5
|
-
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { c as classnames } from '../index-6ff23041.js';
|
|
4
|
+
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
6
5
|
|
|
7
|
-
var css_248z = "[data-gene-ui-version=\"2.
|
|
6
|
+
var css_248z = "[data-gene-ui-version=\"2.12.1\"] .label{display:inline-block;font-weight:400;max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:top;white-space:nowrap}[data-gene-ui-version=\"2.12.1\"] .label.bold{font-weight:bolder}[data-gene-ui-version=\"2.12.1\"] .label.semiBold{font-weight:700}";
|
|
8
7
|
styleInject(css_248z);
|
|
9
8
|
|
|
10
9
|
const labels = {
|
|
@@ -36,19 +35,19 @@ Label.propTypes = {
|
|
|
36
35
|
/**
|
|
37
36
|
* Any valid React node.
|
|
38
37
|
*/
|
|
39
|
-
children:
|
|
38
|
+
children: PropTypes.string.isRequired,
|
|
40
39
|
/**
|
|
41
40
|
* Label sizing
|
|
42
41
|
*/
|
|
43
|
-
size:
|
|
42
|
+
size: PropTypes.oneOf(['headingExtraLarge', 'headingLarge', 'headingBig', 'heading', 'bodyBig', 'body', 'bodySmall', 'content']),
|
|
44
43
|
/**
|
|
45
44
|
* Label font to be used
|
|
46
45
|
*/
|
|
47
|
-
font:
|
|
46
|
+
font: PropTypes.oneOf(['regular', 'semiBold', 'bold']),
|
|
48
47
|
/**
|
|
49
48
|
* Addional className
|
|
50
49
|
*/
|
|
51
|
-
className:
|
|
50
|
+
className: PropTypes.string
|
|
52
51
|
};
|
|
53
52
|
Label.defaultProps = {
|
|
54
53
|
size: 'content',
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React__default, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { c as classnames } from '../index-6ff23041.js';
|
|
3
|
+
import { n as noop } from '../index-a0e4e333.js';
|
|
4
|
+
import Icon from '../Icon/index.js';
|
|
5
|
+
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
|
|
6
|
+
import 'prop-types';
|
|
7
|
+
import '../dateValidation-67caec66.js';
|
|
8
|
+
import '../_commonjsHelpers-24198af3.js';
|
|
9
|
+
import 'react-dom';
|
|
10
|
+
import '../_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
11
|
+
|
|
12
|
+
/******************************************************************************
|
|
13
|
+
Copyright (c) Microsoft Corporation.
|
|
14
|
+
|
|
15
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
+
purpose with or without fee is hereby granted.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
+
***************************************************************************** */
|
|
26
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
function __rest(s, e) {
|
|
30
|
+
var t = {};
|
|
31
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
32
|
+
t[p] = s[p];
|
|
33
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
34
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
35
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
36
|
+
t[p[i]] = s[p[i]];
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
42
|
+
var e = new Error(message);
|
|
43
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var css_248z = "[data-gene-ui-version=\"2.12.1\"] .linkButton{align-items:center;color:var(--hero);cursor:pointer;display:flex;max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content;padding:0 .8rem}[data-gene-ui-version=\"2.12.1\"] .linkButton:focus-visible{border-radius:.4rem;outline:.2rem var(--hero) solid}[data-gene-ui-version=\"2.12.1\"] .linkButton__icon{display:inline-block}[data-gene-ui-version=\"2.12.1\"] .linkButton-disable{opacity:.3;pointer-events:none}";
|
|
47
|
+
styleInject(css_248z);
|
|
48
|
+
|
|
49
|
+
const LinkButton = (_a) => {
|
|
50
|
+
var { href, onClick, children, iconAfter, className, iconBefore, isDisabled, onMouseDown, ariaLabel } = _a, restProps = __rest(_a, ["href", "onClick", "children", "iconAfter", "className", "iconBefore", "isDisabled", "onMouseDown", "ariaLabel"]);
|
|
51
|
+
const onClickHandler = useCallback((e) => onClick === null || onClick === void 0 ? void 0 : onClick(e), [onClick]);
|
|
52
|
+
const onMouseDownHandler = useCallback((e) => onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e), [onMouseDown]);
|
|
53
|
+
const attributes = useMemo(() => (Object.assign(Object.assign({ className: classnames('linkButton', { 'linkButton-disable': isDisabled }, className), onMouseDown: onMouseDownHandler, onClick: onClickHandler }, (ariaLabel ? { 'aria-label': ariaLabel } : {})), restProps)), [isDisabled, className, onMouseDownHandler, onClickHandler, restProps]);
|
|
54
|
+
const content = useMemo(() => (React__default.createElement(React__default.Fragment, null,
|
|
55
|
+
iconBefore && React__default.createElement(Icon, { type: iconBefore, className: "linkButton__icon" }),
|
|
56
|
+
children,
|
|
57
|
+
iconAfter && React__default.createElement(Icon, { type: iconAfter, className: "linkButton__icon" }))), [iconBefore, children, iconAfter]);
|
|
58
|
+
return (React__default.createElement(React__default.Fragment, null, href ? (React__default.createElement("a", Object.assign({}, attributes, { href: href }), content)) : (React__default.createElement("button", Object.assign({}, attributes, { type: "button" }), content))));
|
|
59
|
+
};
|
|
60
|
+
LinkButton.defaultProps = {
|
|
61
|
+
children: 'LinkButton example',
|
|
62
|
+
isDisabled: false,
|
|
63
|
+
onMouseDown: noop
|
|
64
|
+
};
|
|
65
|
+
LinkButton.displayName = 'LinkButton';
|
|
66
|
+
|
|
67
|
+
export { LinkButton as default };
|