@widergy/energy-ui 3.22.3 → 3.22.4
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/CHANGELOG.md +7 -0
- package/dist/components/Loading/index.js +2 -2
- package/dist/components/UTActionCard/components/AdditionalMessage/index.js +1 -1
- package/dist/components/UTActionCard/components/BottomActions/index.js +3 -3
- package/dist/components/UTActionCard/components/Header/index.js +3 -3
- package/dist/components/UTActionCard/components/Header/utils.js +2 -2
- package/dist/components/UTActionCard/components/HeaderActions/index.js +5 -4
- package/dist/components/UTActionCard/components/HeaderActions/utils.js +2 -2
- package/dist/components/UTActionCard/index.js +6 -6
- package/dist/components/UTAlert/index.js +2 -2
- package/dist/components/UTAlert/theme.js +5 -4
- package/dist/components/UTAttachment/components/Preview/index.js +3 -3
- package/dist/components/UTAttachment/index.js +7 -5
- package/dist/components/UTAttachment/layout.js +2 -2
- package/dist/components/UTAttachment/utils.js +9 -8
- package/dist/components/UTAttachmentList/components/Preview/index.js +3 -3
- package/dist/components/UTAttachmentList/components/PreviewModal/index.js +3 -3
- package/dist/components/UTAttachmentList/index.js +14 -11
- package/dist/components/UTAttachmentList/layout.js +5 -5
- package/dist/components/UTAttachmentList/theme.js +9 -8
- package/dist/components/UTAttachmentList/utils.js +10 -9
- package/dist/components/UTAutocomplete/components/ListBox/utils.js +1 -1
- package/dist/components/UTAutocomplete/index.js +2 -2
- package/dist/components/UTAutocomplete/theme.js +52 -50
- package/dist/components/UTBadge/index.js +1 -1
- package/dist/components/UTBadge/theme.js +2 -1
- package/dist/components/UTBanner/index.js +1 -1
- package/dist/components/UTBanner/theme.js +2 -1
- package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +5 -5
- package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +2 -2
- package/dist/components/UTBarChart/components/Bars/index.js +2 -2
- package/dist/components/UTBarChart/components/Legend/index.js +6 -6
- package/dist/components/UTBarChart/components/Pagination/index.js +2 -1
- package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +4 -3
- package/dist/components/UTBarChart/components/XAxis/index.js +2 -2
- package/dist/components/UTBarChart/components/YAxis/index.js +2 -1
- package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +5 -4
- package/dist/components/UTBarChart/index.js +3 -3
- package/dist/components/UTBarChart/theme.js +7 -6
- package/dist/components/UTBarChart/utils.js +26 -20
- package/dist/components/UTBreadcrumbs/index.js +3 -3
- package/dist/components/UTBreadcrumbs/theme.js +2 -1
- package/dist/components/UTButton/index.js +4 -8
- package/dist/components/UTButton/theme.js +18 -14
- package/dist/components/UTButton/utils.js +1 -6
- package/dist/components/UTButtonGroup/index.js +1 -1
- package/dist/components/UTButtonGroup/theme.js +2 -1
- package/dist/components/UTCard/components/UTCardFooter/index.js +2 -2
- package/dist/components/UTCard/index.js +4 -4
- package/dist/components/UTCard/theme.js +1 -1
- package/dist/components/UTCarousel/components/Button/index.js +2 -2
- package/dist/components/UTCarousel/components/Legend/index.js +1 -1
- package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +5 -5
- package/dist/components/UTCarousel/components/Slider/index.js +9 -8
- package/dist/components/UTCarousel/components/Slider/layout.js +6 -6
- package/dist/components/UTCheckList/index.js +5 -7
- package/dist/components/UTCheckList/theme.js +3 -2
- package/dist/components/UTCheckbox/index.js +4 -4
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +4 -4
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicatorTop/index.js +2 -2
- package/dist/components/UTConsumptionBar/index.js +8 -8
- package/dist/components/UTCuit/theme.js +6 -6
- package/dist/components/UTDatePicker/components/Day/index.js +1 -5
- package/dist/components/UTDatePicker/index.js +6 -5
- package/dist/components/UTDatePicker/theme.js +160 -157
- package/dist/components/UTDialog/index.js +8 -8
- package/dist/components/UTDialog/theme.js +2 -1
- package/dist/components/UTEmojiPicker/index.js +6 -11
- package/dist/components/UTEmojiPicker/theme.js +24 -23
- package/dist/components/UTExternalLink/index.js +1 -1
- package/dist/components/UTExternalLink/theme.js +2 -1
- package/dist/components/UTFileInput/layout.js +5 -11
- package/dist/components/UTGoogleAutocomplete/theme.js +2 -1
- package/dist/components/UTHeader/index.js +5 -5
- package/dist/components/UTHeader/theme.js +3 -2
- package/dist/components/UTIcon/theme.js +11 -9
- package/dist/components/UTIconButton/index.js +2 -2
- package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +6 -6
- package/dist/components/UTImageRadio/index.js +3 -3
- package/dist/components/UTImageRadio/theme.js +14 -13
- package/dist/components/UTLabel/index.js +1 -1
- package/dist/components/UTLabel/theme.js +8 -6
- package/dist/components/UTList/index.js +1 -1
- package/dist/components/UTMap/components/GoogleMaps/styles.js +2 -2
- package/dist/components/UTMenu/index.js +3 -3
- package/dist/components/UTMenu/theme.js +31 -27
- package/dist/components/UTMenu/utils.js +1 -1
- package/dist/components/UTModal/index.js +5 -9
- package/dist/components/UTModal/theme.js +2 -1
- package/dist/components/UTOnboarding/index.js +24 -16
- package/dist/components/UTOnboarding/theme.js +14 -12
- package/dist/components/UTPagination/components/PageSizeSelector/index.js +2 -2
- package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +1 -4
- package/dist/components/UTPagination/components/Pagination/index.js +3 -3
- package/dist/components/UTPagination/index.js +2 -2
- package/dist/components/UTPagination/theme.js +10 -9
- package/dist/components/UTPanel/versions/V0/index.js +5 -5
- package/dist/components/UTPanel/versions/V1/components/DataItem/index.js +1 -1
- package/dist/components/UTPanel/versions/V1/index.js +6 -8
- package/dist/components/UTPanel/versions/V1/theme.js +1 -1
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +1 -1
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +2 -2
- package/dist/components/UTPasswordField/components/PasswordValidations/index.js +2 -2
- package/dist/components/UTPasswordField/theme.js +6 -5
- package/dist/components/UTPhoneInput/index.js +11 -10
- package/dist/components/UTPhoneInput/theme.js +10 -10
- package/dist/components/UTPieChart/components/ArrowLabel/index.js +2 -2
- package/dist/components/UTPieChart/components/Legend/index.js +4 -4
- package/dist/components/UTPieChart/index.js +5 -5
- package/dist/components/UTProductItem/index.js +3 -3
- package/dist/components/UTProductItem/theme.js +4 -3
- package/dist/components/UTProgressBar/index.js +1 -1
- package/dist/components/UTProgressBar/theme.js +12 -11
- package/dist/components/UTRadioGroup/index.js +5 -11
- package/dist/components/UTRadioGroup/theme.js +17 -17
- package/dist/components/UTRating/components/Circle/index.js +5 -5
- package/dist/components/UTRating/components/Faces/index.js +4 -8
- package/dist/components/UTRating/components/Star/index.js +3 -3
- package/dist/components/UTRating/index.js +2 -2
- package/dist/components/UTRating/theme.js +21 -21
- package/dist/components/UTRipple/Ripple.js +2 -2
- package/dist/components/UTSelect/components/Option/index.js +1 -1
- package/dist/components/UTSelect/index.js +1 -1
- package/dist/components/UTSelect/theme.js +14 -14
- package/dist/components/UTSelectableCard/index.js +5 -9
- package/dist/components/UTSelectableCard/theme.js +20 -19
- package/dist/components/UTSidebar/components/ListOption/index.js +4 -1
- package/dist/components/UTSidebar/components/LogosContainer/index.js +3 -3
- package/dist/components/UTSidebar/components/Option/index.js +9 -31
- package/dist/components/UTSidebar/components/Toggler/index.js +2 -2
- package/dist/components/UTSidebar/index.js +3 -7
- package/dist/components/UTSidebar/theme.js +17 -16
- package/dist/components/UTSkeleton/index.js +3 -2
- package/dist/components/UTStatus/index.js +2 -2
- package/dist/components/UTStepper/components/Connectors/index.js +5 -7
- package/dist/components/UTStepper/components/Step/index.js +6 -16
- package/dist/components/UTStepper/index.js +1 -1
- package/dist/components/UTStepper/theme.js +12 -11
- package/dist/components/UTSwitch/index.js +6 -6
- package/dist/components/UTSwitch/theme.js +2 -2
- package/dist/components/UTTable/components/ActionIcons/index.js +3 -8
- package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +2 -1
- package/dist/components/UTTable/components/Cell/index.js +2 -2
- package/dist/components/UTTable/components/HeaderCell/index.js +5 -16
- package/dist/components/UTTable/components/PrimaryAction/index.js +1 -1
- package/dist/components/UTTable/components/ResponsiveCell/index.js +4 -4
- package/dist/components/UTTable/components/Status/index.js +2 -2
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +2 -2
- package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +1 -6
- package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +2 -6
- package/dist/components/UTTable/components/TableFooter/index.js +1 -1
- package/dist/components/UTTable/components/TableHeader/index.js +3 -3
- package/dist/components/UTTable/components/TableRow/index.js +13 -42
- package/dist/components/UTTable/components/TableRow/utils.js +7 -1
- package/dist/components/UTTable/hook.js +4 -1
- package/dist/components/UTTable/index.js +19 -22
- package/dist/components/UTTable/theme.js +33 -32
- package/dist/components/UTTable/utils.js +14 -14
- package/dist/components/UTTabs/components/TooltipTab/index.js +1 -1
- package/dist/components/UTTabs/index.js +7 -7
- package/dist/components/UTTabs/theme.js +2 -2
- package/dist/components/UTTextArea/index.js +6 -6
- package/dist/components/UTTextArea/theme.js +22 -21
- package/dist/components/UTTextInput/index.js +6 -10
- package/dist/components/UTTextInput/theme.js +12 -12
- package/dist/components/UTToggle/components/ToggleOption/index.js +3 -3
- package/dist/components/UTToggle/index.js +2 -2
- package/dist/components/UTToggle/theme.js +2 -2
- package/dist/components/UTTooltip/index.js +2 -2
- package/dist/components/UTTooltip/theme.js +10 -9
- package/dist/components/UTTopbar/components/Notifications/index.js +1 -1
- package/dist/components/UTTopbar/components/UserMenu/index.js +4 -8
- package/dist/components/UTTopbar/index.js +3 -3
- package/dist/components/UTTopbar/theme.js +41 -40
- package/dist/components/UTTouchableWithoutFeedback/index.js +1 -1
- package/dist/components/UTTracker/components/Step/index.js +6 -22
- package/dist/components/UTTracker/index.js +23 -20
- package/dist/components/UTTracker/theme.js +6 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +5 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -3
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +1 -1
- package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +3 -2
- package/dist/components/UTVirtualizedList/index.js +1 -1
- package/dist/components/UTWizard/index.js +3 -3
- package/dist/components/UTWizard/theme.js +2 -2
- package/dist/components/UTWorkflowContainer/versions/V0/components/ActionButton/index.js +3 -6
- package/dist/components/UTWorkflowContainer/versions/V0/index.js +9 -14
- package/dist/components/UTWorkflowContainer/versions/V0/theme.js +5 -4
- package/dist/components/UTWorkflowContainer/versions/V1/components/NavActions/index.js +8 -8
- package/dist/components/UTWorkflowContainer/versions/V1/index.js +7 -7
- package/dist/components/UTWorkflowContainer/versions/V1/theme.js +7 -6
- package/dist/components/WithGoogleMaps/index.js +2 -2
- package/dist/components/WithTouch/index.js +1 -1
- package/dist/utils/classesUtils.js +2 -2
- package/dist/utils/componentUtils.js +3 -3
- package/dist/utils/shadowUtils.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.22.4](https://github.com/widergy/energy-ui/compare/v3.22.3...v3.22.4) (2024-10-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* fixes workflow icon ([#504](https://github.com/widergy/energy-ui/issues/504)) ([51e34f1](https://github.com/widergy/energy-ui/commit/51e34f1b8f5669955dc0f6cf189d536b49fb06d6))
|
|
7
|
+
|
|
1
8
|
## [3.22.3](https://github.com/widergy/energy-ui/compare/v3.22.2...v3.22.3) (2024-10-01)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -27,13 +27,13 @@ const Loading = _ref => {
|
|
|
27
27
|
const defaultSize = (0, _seamlessImmutable.getIn)(theme, ['Loading', 'base', 'size'], 85);
|
|
28
28
|
const defaultThickness = (0, _seamlessImmutable.getIn)(theme, ['Loading', 'base', 'thickness'], 1.5);
|
|
29
29
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
30
|
-
className:
|
|
30
|
+
className: "".concat(_stylesModule.default.container, " ").concat(className)
|
|
31
31
|
}, /*#__PURE__*/_react.default.createElement(_CircularProgress.default, {
|
|
32
32
|
className: classes.base,
|
|
33
33
|
size: size || defaultSize,
|
|
34
34
|
thickness: thickness || defaultThickness
|
|
35
35
|
}), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
36
|
-
className:
|
|
36
|
+
className: "".concat(_stylesModule.default.text, " ").concat(classes.text, " ").concat(textClassName)
|
|
37
37
|
}, text || _constants.DEFAULT_LOADING_TEXT));
|
|
38
38
|
};
|
|
39
39
|
Loading.propTypes = {
|
|
@@ -23,7 +23,7 @@ const AdditionalMessage = _ref => {
|
|
|
23
23
|
size
|
|
24
24
|
} = _ref;
|
|
25
25
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
-
className:
|
|
26
|
+
className: "".concat(_stylesModule.default.additionalMessageContainer, " ").concat(_stylesModule.default[size])
|
|
27
27
|
}, icon && /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
|
|
28
28
|
colorTheme: "gray",
|
|
29
29
|
name: icon
|
|
@@ -31,9 +31,9 @@ const BottomActions = _ref => {
|
|
|
31
31
|
} = _ref2;
|
|
32
32
|
return /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
33
33
|
classNames: {
|
|
34
|
-
childrenContainer:
|
|
35
|
-
root:
|
|
36
|
-
text:
|
|
34
|
+
childrenContainer: "".concat(type === _constants.ACTION_TYPES.REDIRECTION && _stylesModule.default.redirectionChildrenContainer, " "),
|
|
35
|
+
root: "".concat(_stylesModule.default.actionButton, " ").concat(type === _constants.ACTION_TYPES.REDIRECTION ? _stylesModule.default.fullWidth : ''),
|
|
36
|
+
text: "".concat(type === _constants.ACTION_TYPES.REDIRECTION ? _stylesModule.default.redirectionText : _stylesModule.default.defaultText)
|
|
37
37
|
},
|
|
38
38
|
colorTheme: colorTheme,
|
|
39
39
|
disabled: disabled,
|
|
@@ -33,15 +33,15 @@ const Header = _ref => {
|
|
|
33
33
|
titleProps
|
|
34
34
|
} = _ref;
|
|
35
35
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
-
className:
|
|
36
|
+
className: "".concat(_stylesModule.default.header, " ").concat(_stylesModule.default[size])
|
|
37
37
|
}, (0, _utils.renderAdornment)(adornment, 'left', size), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
-
className:
|
|
38
|
+
className: "".concat(_stylesModule.default.headerTitles, " ").concat(_stylesModule.default["gap-".concat(size)])
|
|
39
39
|
}, (0, _utils.renderAdornment)(adornment, 'top', size), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
40
40
|
weight: "medium"
|
|
41
41
|
}, titleProps), title), description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
42
42
|
colorTheme: "gray"
|
|
43
43
|
}, descriptionProps), description)), status ? /*#__PURE__*/_react.default.createElement(_UTStatus.default, _extends({
|
|
44
|
-
className:
|
|
44
|
+
className: "".concat(_stylesModule.default["placeSelf-".concat(statusAlignment)]),
|
|
45
45
|
type: "light"
|
|
46
46
|
}, (0, _utils.statusPropsMapper)(status)), statusLabel || status) : null, !(0, _array.isEmpty)(headerActions) && /*#__PURE__*/_react.default.createElement(_HeaderActions.default, {
|
|
47
47
|
headerActions,
|
|
@@ -138,7 +138,7 @@ const statusPropsMapper = status => ({
|
|
|
138
138
|
variant: 'warning',
|
|
139
139
|
withoutIcon: true
|
|
140
140
|
}
|
|
141
|
-
})[status
|
|
141
|
+
})[status === null || status === void 0 ? void 0 : status.toLowerCase()] || {
|
|
142
142
|
variant: 'error',
|
|
143
143
|
withoutIcon: true
|
|
144
144
|
};
|
|
@@ -148,7 +148,7 @@ const renderAdornment = (adornment, position, size) => {
|
|
|
148
148
|
const AdornmentComponent = _constants2.ADORNMENT_COMPONENT_MAPPER[adornment.type];
|
|
149
149
|
const defaultPlaceSelf = adornment.position === 'left' ? _constants.PLACE_SELF_TYPES.CENTER : _constants.PLACE_SELF_TYPES.START;
|
|
150
150
|
return /*#__PURE__*/_react.default.createElement(AdornmentComponent, _extends({
|
|
151
|
-
className:
|
|
151
|
+
className: "".concat(_stylesModule.default["placeSelf-".concat(adornment.alignment || defaultPlaceSelf)], " ").concat(position === 'top' ? _stylesModule.default["gap-".concat(size)] : '')
|
|
152
152
|
}, adornment.props || {}));
|
|
153
153
|
};
|
|
154
154
|
exports.renderAdornment = renderAdornment;
|
|
@@ -19,6 +19,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
19
19
|
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; }
|
|
20
20
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } /* eslint-disable jsx-a11y/no-static-element-interactions */ /* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
21
21
|
const HeaderActions = _ref => {
|
|
22
|
+
var _secondaryActions$;
|
|
22
23
|
let {
|
|
23
24
|
headerActions,
|
|
24
25
|
headerActionsProps,
|
|
@@ -30,8 +31,8 @@ const HeaderActions = _ref => {
|
|
|
30
31
|
const {
|
|
31
32
|
colorTheme: buttonGroupColorTheme = 'secondary',
|
|
32
33
|
shape: buttonGroupShape
|
|
33
|
-
} = headerActionsProps
|
|
34
|
-
const maxNumberOfPrimaryActions = headerActionsProps
|
|
34
|
+
} = (headerActionsProps === null || headerActionsProps === void 0 ? void 0 : headerActionsProps.buttonGroupProps) || {};
|
|
35
|
+
const maxNumberOfPrimaryActions = (headerActionsProps === null || headerActionsProps === void 0 ? void 0 : headerActionsProps.maxNumberOfPrimaryActions) || _constants2.DEFAULT_MAX_NUMBER_OF_PRIMARY_ACTIONS;
|
|
35
36
|
const handleSetMainActionHoverVisible = () => setMainActionHoverVisible(true);
|
|
36
37
|
const handleSetMainActionHoverHidden = () => setMainActionHoverVisible(false);
|
|
37
38
|
const openMenu = event => setMenu(event.currentTarget);
|
|
@@ -42,7 +43,7 @@ const HeaderActions = _ref => {
|
|
|
42
43
|
const primaryActions = (0, _utils.mapActions)(headerActions, true).slice(0, maxNumberOfPrimaryActions);
|
|
43
44
|
const secondaryActions = (0, _utils.mapActions)(headerActions, false, !showButtonGroup ? closeMenu : null);
|
|
44
45
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
-
className:
|
|
46
|
+
className: "".concat(_stylesModule.default.headerActionsContainer, " ").concat(_stylesModule.default["placeSelf-".concat(headerActionsProps.alignment)]),
|
|
46
47
|
onClick: e => e.stopPropagation(),
|
|
47
48
|
onMouseEnter: handleSetMainActionHoverHidden,
|
|
48
49
|
onMouseLeave: handleSetMainActionHoverVisible
|
|
@@ -84,7 +85,7 @@ const HeaderActions = _ref => {
|
|
|
84
85
|
}
|
|
85
86
|
})),
|
|
86
87
|
colorTheme: buttonGroupColorTheme,
|
|
87
|
-
selected: selectedAction || secondaryActions[0]
|
|
88
|
+
selected: selectedAction || ((_secondaryActions$ = secondaryActions[0]) === null || _secondaryActions$ === void 0 ? void 0 : _secondaryActions$.id),
|
|
88
89
|
shape: buttonGroupShape
|
|
89
90
|
})));
|
|
90
91
|
};
|
|
@@ -8,10 +8,10 @@ const mapActions = function () {
|
|
|
8
8
|
let actions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9
9
|
let isPrimary = arguments.length > 1 ? arguments[1] : undefined;
|
|
10
10
|
let onClickHandler = arguments.length > 2 ? arguments[2] : undefined;
|
|
11
|
-
return actions.filter(action => (action
|
|
11
|
+
return actions.filter(action => ((action === null || action === void 0 ? void 0 : action.isPrimary) || false) === isPrimary).map(action => ({
|
|
12
12
|
...action,
|
|
13
13
|
onClick: e => {
|
|
14
|
-
e
|
|
14
|
+
e === null || e === void 0 || e.stopPropagation();
|
|
15
15
|
if (onClickHandler) onClickHandler();
|
|
16
16
|
action.onClick();
|
|
17
17
|
}
|
|
@@ -43,14 +43,14 @@ const UTActionCard = _ref => {
|
|
|
43
43
|
} = _ref;
|
|
44
44
|
const [mainActionHoverVisible, setMainActionHoverVisible] = (0, _react.useState)(true);
|
|
45
45
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
-
className:
|
|
46
|
+
className: "".concat(_stylesModule.default.cardContainer, " ").concat(classNames.container)
|
|
47
47
|
}, /*#__PURE__*/_react.default.createElement(_UTTouchableWithoutFeedback.default, {
|
|
48
|
-
className:
|
|
49
|
-
onClick: () => mainAction
|
|
48
|
+
className: "".concat(_stylesModule.default.innerContainer, " ").concat(classNames.innerContainer, " ").concat(!mainAction ? _stylesModule.default.withoutMainAction : "".concat(_stylesModule.default.withMainAction, " ").concat(mainActionHoverVisible && "".concat(_stylesModule.default.mainActionHover, " ").concat(classNames.mainActionHover))),
|
|
49
|
+
onClick: () => mainAction === null || mainAction === void 0 ? void 0 : mainAction()
|
|
50
50
|
}, BackgroundImage && /*#__PURE__*/_react.default.createElement(BackgroundImage, {
|
|
51
|
-
className:
|
|
51
|
+
className: "".concat(_stylesModule.default.backgroundImage, " ").concat(classNames.backgroundImage)
|
|
52
52
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
53
|
-
className:
|
|
53
|
+
className: "".concat(_stylesModule.default.headerAndChildrenContainer, " ").concat(classNames.headerAndChildrenContainer)
|
|
54
54
|
}, /*#__PURE__*/_react.default.createElement(_Header.default, {
|
|
55
55
|
adornment,
|
|
56
56
|
description,
|
|
@@ -66,7 +66,7 @@ const UTActionCard = _ref => {
|
|
|
66
66
|
title,
|
|
67
67
|
titleProps
|
|
68
68
|
}), children && /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
-
className:
|
|
69
|
+
className: "".concat(withBodyPadding ? _stylesModule.default["bodyPadding-".concat(size)] : _stylesModule.default["withoutBodyPadding-".concat(size)])
|
|
70
70
|
}, children))), !(0, _object.objectIsEmpty)(additionalMessage) && /*#__PURE__*/_react.default.createElement(_AdditionalMessage.default, {
|
|
71
71
|
icon: additionalMessage.icon,
|
|
72
72
|
iconProps: additionalMessage.iconProps,
|
|
@@ -85,14 +85,14 @@ class UTAlert extends _react.PureComponent {
|
|
|
85
85
|
root: _stylesModule.default.snackbarRoot
|
|
86
86
|
},
|
|
87
87
|
ContentProps: {
|
|
88
|
-
className:
|
|
88
|
+
className: "".concat(_stylesModule.default.snackbarContent, " ").concat(classes.snackbarContent, " ").concat(this.selectAlertType()),
|
|
89
89
|
classes: {
|
|
90
90
|
action: _stylesModule.default.action,
|
|
91
91
|
message: _stylesModule.default.message
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
message: /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
-
className:
|
|
95
|
+
className: "".concat(_stylesModule.default.content, " ").concat(classes.content)
|
|
96
96
|
}, !withoutIcon && AlertTypeIcon && /*#__PURE__*/_react.default.createElement(AlertTypeIcon, {
|
|
97
97
|
classes: {
|
|
98
98
|
root: _stylesModule.default.alertTypeIcon
|
|
@@ -9,21 +9,22 @@ var _styles = require("@material-ui/core/styles");
|
|
|
9
9
|
var _colorsModule = _interopRequireDefault(require("../../scss/variables/colors.module.scss"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
const retrieveStyle = _ref => {
|
|
12
|
+
var _theme$Palette, _theme$Palette2, _theme$Palette3, _theme$Palette4;
|
|
12
13
|
let {
|
|
13
14
|
theme
|
|
14
15
|
} = _ref;
|
|
15
16
|
return {
|
|
16
17
|
error: {
|
|
17
|
-
backgroundColor: theme.Palette
|
|
18
|
+
backgroundColor: ((_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette.error['04']) || _colorsModule.default.notificationError
|
|
18
19
|
},
|
|
19
20
|
info: {
|
|
20
|
-
backgroundColor: theme.Palette
|
|
21
|
+
backgroundColor: ((_theme$Palette2 = theme.Palette) === null || _theme$Palette2 === void 0 ? void 0 : _theme$Palette2.information['04']) || _colorsModule.default.notificationInfo
|
|
21
22
|
},
|
|
22
23
|
success: {
|
|
23
|
-
backgroundColor: theme.Palette
|
|
24
|
+
backgroundColor: ((_theme$Palette3 = theme.Palette) === null || _theme$Palette3 === void 0 ? void 0 : _theme$Palette3.success['04']) || _colorsModule.default.notificationSuccess
|
|
24
25
|
},
|
|
25
26
|
warning: {
|
|
26
|
-
backgroundColor: theme.Palette
|
|
27
|
+
backgroundColor: ((_theme$Palette4 = theme.Palette) === null || _theme$Palette4 === void 0 ? void 0 : _theme$Palette4.warning['04']) || _colorsModule.default.notificationWarning
|
|
27
28
|
},
|
|
28
29
|
action: {
|
|
29
30
|
padding: (0, _seamlessImmutable.getIn)(theme, ['UTAlert', 'action', 'padding']),
|
|
@@ -22,11 +22,11 @@ const Preview = _ref => {
|
|
|
22
22
|
src: preview.src,
|
|
23
23
|
className: _stylesModule.default.previewImage,
|
|
24
24
|
alt: ""
|
|
25
|
-
}, previewProps
|
|
25
|
+
}, previewProps === null || previewProps === void 0 ? void 0 : previewProps.image)), (0, _utils.isAudio)(preview) && /*#__PURE__*/_react.default.createElement("audio", _extends({
|
|
26
26
|
controls: true,
|
|
27
27
|
controlsList: "nodownload",
|
|
28
28
|
className: _stylesModule.default.previewAudio
|
|
29
|
-
}, previewProps
|
|
29
|
+
}, previewProps === null || previewProps === void 0 ? void 0 : previewProps.audio), /*#__PURE__*/_react.default.createElement("source", {
|
|
30
30
|
src: preview.src,
|
|
31
31
|
type: preview.type
|
|
32
32
|
})), (0, _utils.isVideo)(preview) && /*#__PURE__*/_react.default.createElement("video", _extends({
|
|
@@ -34,7 +34,7 @@ const Preview = _ref => {
|
|
|
34
34
|
disablePictureInPicture: true,
|
|
35
35
|
controlsList: "nodownload",
|
|
36
36
|
className: _stylesModule.default.previewVideo
|
|
37
|
-
}, previewProps
|
|
37
|
+
}, previewProps === null || previewProps === void 0 ? void 0 : previewProps.video), /*#__PURE__*/_react.default.createElement("source", {
|
|
38
38
|
src: preview.src,
|
|
39
39
|
type: preview.type
|
|
40
40
|
})));
|
|
@@ -30,7 +30,7 @@ class AttachmentContainer extends _react.Component {
|
|
|
30
30
|
onLoaded
|
|
31
31
|
} = this.props;
|
|
32
32
|
(0, _utils.getBlobFromUrl)(input.value, response => {
|
|
33
|
-
if (response
|
|
33
|
+
if (response !== null && response !== void 0 && response.type) {
|
|
34
34
|
const fileType = response.type.substring(response.type.indexOf('/') + 1);
|
|
35
35
|
this.setState({
|
|
36
36
|
name: this.getDefaultAttachment(input.value, fileType)
|
|
@@ -52,7 +52,7 @@ class AttachmentContainer extends _react.Component {
|
|
|
52
52
|
href: url,
|
|
53
53
|
target: "_blank",
|
|
54
54
|
rel: "noopener noreferrer"
|
|
55
|
-
}, _constants.DEFAULT_ATTACHMENT_NAME, fileType &&
|
|
55
|
+
}, _constants.DEFAULT_ATTACHMENT_NAME, fileType && ".".concat(fileType)) || '');
|
|
56
56
|
_defineProperty(this, "hasDefaultValueToLoad", () => this.props.input.value && typeof this.props.input.value === 'string');
|
|
57
57
|
_defineProperty(this, "hasDefaultFileObjectToLoad", () => {
|
|
58
58
|
const {
|
|
@@ -61,6 +61,7 @@ class AttachmentContainer extends _react.Component {
|
|
|
61
61
|
return input.value && typeof input.value === 'object' && (0, _utils.isValidFile)(input.value.file);
|
|
62
62
|
});
|
|
63
63
|
_defineProperty(this, "onChange", async ev => {
|
|
64
|
+
var _this$props$allowedPD;
|
|
64
65
|
let file = ev.target.files[0];
|
|
65
66
|
const {
|
|
66
67
|
resizeConfig,
|
|
@@ -68,8 +69,8 @@ class AttachmentContainer extends _react.Component {
|
|
|
68
69
|
} = this.props;
|
|
69
70
|
const fileErrorTexts = {
|
|
70
71
|
formatError: _constants.FORMAT_ERROR_TEXT,
|
|
71
|
-
sizeError:
|
|
72
|
-
aspectRatioError:
|
|
72
|
+
sizeError: "".concat(_constants.SIZE_ERROR_TEXT, " ").concat(Math.round(this.props.maxFileSize / 1048576), "MB."),
|
|
73
|
+
aspectRatioError: "".concat(_constants.ASPECT_RATIO_ERROR_TEXT, " ").concat((_this$props$allowedPD = this.props.allowedPDFUploadSizes) === null || _this$props$allowedPD === void 0 ? void 0 : _this$props$allowedPD.map(aspectRatio => aspectRatio.name).join(' - '), ")")
|
|
73
74
|
};
|
|
74
75
|
this.setState({
|
|
75
76
|
error: false
|
|
@@ -147,11 +148,12 @@ class AttachmentContainer extends _react.Component {
|
|
|
147
148
|
this.loadDefaultValues();
|
|
148
149
|
}
|
|
149
150
|
componentDidUpdate(prevProps) {
|
|
151
|
+
var _prevProps$fieldTypes;
|
|
150
152
|
const {
|
|
151
153
|
fieldTypes,
|
|
152
154
|
input
|
|
153
155
|
} = this.props;
|
|
154
|
-
if (prevProps.fieldTypes
|
|
156
|
+
if (((_prevProps$fieldTypes = prevProps.fieldTypes) === null || _prevProps$fieldTypes === void 0 ? void 0 : _prevProps$fieldTypes[0]) !== (fieldTypes === null || fieldTypes === void 0 ? void 0 : fieldTypes[0])) this.removeValue();else if ((0, _utils.isNewFile)(prevProps.input.value, input.value)) this.loadDefaultValues();
|
|
155
157
|
}
|
|
156
158
|
render() {
|
|
157
159
|
const {
|
|
@@ -41,7 +41,7 @@ const Attachment = _ref => {
|
|
|
41
41
|
const fieldType = acceptedFileTypes || fieldTypes.map(type => _files.inputFiles[type].inputType).join();
|
|
42
42
|
const Icon = RemoveIcon || _DeleteForever.default;
|
|
43
43
|
return name && !loading ? /*#__PURE__*/_react.default.createElement("div", {
|
|
44
|
-
className:
|
|
44
|
+
className: "".concat(_stylesModule.default.previewContainer, " ").concat(previewClassname)
|
|
45
45
|
}, /*#__PURE__*/_react.default.createElement(_Preview.default, {
|
|
46
46
|
preview: preview,
|
|
47
47
|
previewProps: previewProps
|
|
@@ -53,7 +53,7 @@ const Attachment = _ref => {
|
|
|
53
53
|
className: _stylesModule.default.name
|
|
54
54
|
}, name), /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
55
55
|
classNames: {
|
|
56
|
-
root:
|
|
56
|
+
root: "".concat(_stylesModule.default.removeIconContainer, " ").concat(removeFileClassname)
|
|
57
57
|
},
|
|
58
58
|
disabled: disabled,
|
|
59
59
|
Icon: Icon,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.pdfAspectRatioValidation = exports.isVideo = exports.isValidFile = exports.isPDF = exports.isNewFile = exports.isImage = exports.isHTML = exports.isAudio = exports.hasPreview = exports.getBlobFromUrl = void 0;
|
|
7
7
|
var _files = require("@widergy/web-utils/lib/constants/files");
|
|
8
|
-
if (window['pdfjs-dist/build/pdf']) window['pdfjs-dist/build/pdf'].GlobalWorkerOptions.workerSrc =
|
|
8
|
+
if (window['pdfjs-dist/build/pdf']) window['pdfjs-dist/build/pdf'].GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(window['pdfjs-dist/build/pdf'].version, "/pdf.worker.js");
|
|
9
9
|
const getImage = async imageUrl => fetch(imageUrl, {
|
|
10
10
|
method: 'GET'
|
|
11
11
|
}).catch(error => console.error(error)); // eslint-disable-line no-console
|
|
@@ -13,7 +13,7 @@ const getImage = async imageUrl => fetch(imageUrl, {
|
|
|
13
13
|
const getBlobFromUrl = async (imageUrl, callback) => {
|
|
14
14
|
if (!imageUrl || !callback) return false;
|
|
15
15
|
const response = await getImage(imageUrl);
|
|
16
|
-
if (response
|
|
16
|
+
if (response !== null && response !== void 0 && response.ok) response.blob().then(blob => callback(blob));else callback(null);
|
|
17
17
|
};
|
|
18
18
|
exports.getBlobFromUrl = getBlobFromUrl;
|
|
19
19
|
const lengthMatches = (length1, length2, toleranceInPercentage) => {
|
|
@@ -38,27 +38,28 @@ const pdfAspectRatioValidation = async (file, allowedPDFUploadSizes) => {
|
|
|
38
38
|
return pages.every(page => pageMatches(page, allowedPDFUploadSizes));
|
|
39
39
|
};
|
|
40
40
|
exports.pdfAspectRatioValidation = pdfAspectRatioValidation;
|
|
41
|
-
const isImage = file => _files.inputFiles.image.validType.includes(file
|
|
41
|
+
const isImage = file => _files.inputFiles.image.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
42
42
|
exports.isImage = isImage;
|
|
43
|
-
const isPDF = file => _files.inputFiles.pdf.validType.includes(file
|
|
43
|
+
const isPDF = file => _files.inputFiles.pdf.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
44
44
|
exports.isPDF = isPDF;
|
|
45
|
-
const isAudio = file => _files.inputFiles.audio.validType.includes(file
|
|
45
|
+
const isAudio = file => _files.inputFiles.audio.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
46
46
|
exports.isAudio = isAudio;
|
|
47
|
-
const isVideo = file => _files.inputFiles.video.validType.includes(file
|
|
47
|
+
const isVideo = file => _files.inputFiles.video.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
48
48
|
exports.isVideo = isVideo;
|
|
49
|
-
const isHTML = file => _files.inputFiles.html.validType.includes(file
|
|
49
|
+
const isHTML = file => _files.inputFiles.html.validType.includes(file === null || file === void 0 ? void 0 : file.type);
|
|
50
50
|
exports.isHTML = isHTML;
|
|
51
51
|
const hasPreview = file => isImage(file) || isAudio(file) || isVideo(file);
|
|
52
52
|
exports.hasPreview = hasPreview;
|
|
53
53
|
const isValidFile = file => hasPreview(file) || isPDF(file) || isHTML(file);
|
|
54
54
|
exports.isValidFile = isValidFile;
|
|
55
55
|
const isNewFile = (newFile, oldFile) => {
|
|
56
|
+
var _newFile$file, _oldFile$file;
|
|
56
57
|
if (!newFile && !oldFile) return false;
|
|
57
58
|
if (!newFile || !oldFile) return true;
|
|
58
59
|
const newFileType = typeof newFile;
|
|
59
60
|
const oldFileType = typeof oldFile;
|
|
60
61
|
if (newFileType !== oldFileType) return true;
|
|
61
62
|
if (newFileType === 'string') return newFile !== oldFile;
|
|
62
|
-
return newFile.file
|
|
63
|
+
return ((_newFile$file = newFile.file) === null || _newFile$file === void 0 ? void 0 : _newFile$file.lastModified) !== ((_oldFile$file = oldFile.file) === null || _oldFile$file === void 0 ? void 0 : _oldFile$file.lastModified);
|
|
63
64
|
};
|
|
64
65
|
exports.isNewFile = isNewFile;
|
|
@@ -55,10 +55,10 @@ const Preview = _ref => {
|
|
|
55
55
|
src: preview.src,
|
|
56
56
|
className: _stylesModule.default.previewImage,
|
|
57
57
|
alt: ""
|
|
58
|
-
}, previewProps
|
|
59
|
-
className: classes
|
|
58
|
+
}, previewProps === null || previewProps === void 0 ? void 0 : previewProps.image)), (0, _utils.isAudio)(preview) && /*#__PURE__*/_react.default.createElement(AudioIcon, {
|
|
59
|
+
className: classes === null || classes === void 0 ? void 0 : classes.actionAccentIcon
|
|
60
60
|
}), (0, _utils.isVideo)(preview) && /*#__PURE__*/_react.default.createElement(VideoIcon, {
|
|
61
|
-
className: classes
|
|
61
|
+
className: classes === null || classes === void 0 ? void 0 : classes.actionAccentIcon
|
|
62
62
|
}));
|
|
63
63
|
};
|
|
64
64
|
Preview.propTypes = {
|
|
@@ -30,11 +30,11 @@ const PreviewModal = _ref => {
|
|
|
30
30
|
src: preview.src,
|
|
31
31
|
className: _stylesModule.default.previewImage,
|
|
32
32
|
alt: ""
|
|
33
|
-
}, previewProps
|
|
33
|
+
}, previewProps === null || previewProps === void 0 ? void 0 : previewProps.image)), (0, _utils.isAudio)(preview) && /*#__PURE__*/_react.default.createElement("audio", _extends({
|
|
34
34
|
controls: true,
|
|
35
35
|
controlsList: "nodownload",
|
|
36
36
|
className: _stylesModule.default.previewAudio
|
|
37
|
-
}, previewProps
|
|
37
|
+
}, previewProps === null || previewProps === void 0 ? void 0 : previewProps.audio), /*#__PURE__*/_react.default.createElement("source", {
|
|
38
38
|
src: preview.src,
|
|
39
39
|
type: preview.type
|
|
40
40
|
})), (0, _utils.isVideo)(preview) && /*#__PURE__*/_react.default.createElement("video", _extends({
|
|
@@ -42,7 +42,7 @@ const PreviewModal = _ref => {
|
|
|
42
42
|
disablePictureInPicture: true,
|
|
43
43
|
controlsList: "nodownload",
|
|
44
44
|
className: _stylesModule.default.previewVideo
|
|
45
|
-
}, previewProps
|
|
45
|
+
}, previewProps === null || previewProps === void 0 ? void 0 : previewProps.video), /*#__PURE__*/_react.default.createElement("source", {
|
|
46
46
|
src: preview.src,
|
|
47
47
|
type: preview.type
|
|
48
48
|
})));
|
|
@@ -19,6 +19,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
19
19
|
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); }
|
|
20
20
|
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; }
|
|
21
21
|
const AttachmentContainer = _ref => {
|
|
22
|
+
var _field$configuration, _field$configuration2, _field$configuration3, _field$configuration4, _input$value;
|
|
22
23
|
let {
|
|
23
24
|
acceptedFileTypes: defaultAcceptedFileTypes,
|
|
24
25
|
allowedPDFUploadSizes,
|
|
@@ -38,15 +39,15 @@ const AttachmentContainer = _ref => {
|
|
|
38
39
|
resizeConfig,
|
|
39
40
|
sanitize
|
|
40
41
|
} = _ref;
|
|
41
|
-
const helpText = field
|
|
42
|
-
const maxFileSize = field
|
|
43
|
-
const acceptedFileTypes = field
|
|
44
|
-
const maxFiles = field
|
|
42
|
+
const helpText = field === null || field === void 0 || (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.help_text;
|
|
43
|
+
const maxFileSize = (field === null || field === void 0 || (_field$configuration2 = field.configuration) === null || _field$configuration2 === void 0 ? void 0 : _field$configuration2.max_file_size) || defaultMaxFileSize;
|
|
44
|
+
const acceptedFileTypes = (field === null || field === void 0 || (_field$configuration3 = field.configuration) === null || _field$configuration3 === void 0 ? void 0 : _field$configuration3.accepted_file_types) || defaultAcceptedFileTypes;
|
|
45
|
+
const maxFiles = (field === null || field === void 0 || (_field$configuration4 = field.configuration) === null || _field$configuration4 === void 0 ? void 0 : _field$configuration4.max_files) || _constants.DEFAULT_MAX_FILES;
|
|
45
46
|
const [preview, setPreview] = (0, _react.useState)([]);
|
|
46
47
|
const [error, setError] = (0, _react.useState)(false);
|
|
47
48
|
const [errorText, setErrorText] = (0, _react.useState)(_constants.FORMAT_ERROR_TEXT);
|
|
48
49
|
const fileInputRef = (0, _react.useRef)(null);
|
|
49
|
-
const [updatedFiles, setUpdatedFiles] = (0, _react.useState)(input
|
|
50
|
+
const [updatedFiles, setUpdatedFiles] = (0, _react.useState)((input === null || input === void 0 || (_input$value = input.value) === null || _input$value === void 0 ? void 0 : _input$value.files) || []);
|
|
50
51
|
const removePreviewItem = fileName => {
|
|
51
52
|
if (fileName) setPreview(prevPreview => prevPreview.filter(item => item.name !== fileName));
|
|
52
53
|
setUpdatedFiles(prevFiles => {
|
|
@@ -63,10 +64,10 @@ const AttachmentContainer = _ref => {
|
|
|
63
64
|
};
|
|
64
65
|
const onFailValidation = (errorMessage, dynamicData) => {
|
|
65
66
|
setError(true);
|
|
66
|
-
setErrorText(dynamicData ?
|
|
67
|
+
setErrorText(dynamicData ? "".concat(errorMessage, "(").concat(dynamicData, ")") : errorMessage);
|
|
67
68
|
};
|
|
68
69
|
const buildPreviews = async files => {
|
|
69
|
-
const prevPreviews = preview
|
|
70
|
+
const prevPreviews = preview !== null && preview !== void 0 ? preview : [];
|
|
70
71
|
const loadPreview = file => new Promise((resolve, reject) => {
|
|
71
72
|
const reader = new FileReader();
|
|
72
73
|
reader.onload = e => {
|
|
@@ -109,12 +110,13 @@ const AttachmentContainer = _ref => {
|
|
|
109
110
|
}
|
|
110
111
|
};
|
|
111
112
|
const onChange = async ev => {
|
|
112
|
-
|
|
113
|
+
var _input$value2;
|
|
114
|
+
const prevFiles = ((_input$value2 = input.value) === null || _input$value2 === void 0 ? void 0 : _input$value2.files) || updatedFiles;
|
|
113
115
|
const files = Object.values((0, _isEmpty.default)(prevFiles) ? ev.target.files : (0, _utils.getNotRepeatedFiles)([...prevFiles, ...ev.target.files]));
|
|
114
116
|
const fileErrorTexts = {
|
|
115
117
|
formatError: _constants.FORMAT_ERROR_TEXT,
|
|
116
|
-
sizeError:
|
|
117
|
-
aspectRatioError:
|
|
118
|
+
sizeError: "".concat(_constants.SIZE_ERROR_TEXT, " ").concat((0, _utils.getSizeInMB)(maxFileSize), "MB."),
|
|
119
|
+
aspectRatioError: "".concat(_constants.ASPECT_RATIO_ERROR_TEXT, " ").concat(allowedPDFUploadSizes === null || allowedPDFUploadSizes === void 0 ? void 0 : allowedPDFUploadSizes.map(aspectRatio => aspectRatio.name).join(' - '), ")")
|
|
118
120
|
};
|
|
119
121
|
setError(false);
|
|
120
122
|
const processFiles = async index => {
|
|
@@ -164,6 +166,7 @@ const AttachmentContainer = _ref => {
|
|
|
164
166
|
await processFiles(0);
|
|
165
167
|
};
|
|
166
168
|
const loadDefaultValues = async function () {
|
|
169
|
+
var _input$value$index;
|
|
167
170
|
let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
168
171
|
let accumulatedFiles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
169
172
|
const length = Array.isArray(input.value) ? input.value.length : 1;
|
|
@@ -176,7 +179,7 @@ const AttachmentContainer = _ref => {
|
|
|
176
179
|
buildPreviews(accumulatedFiles);
|
|
177
180
|
return;
|
|
178
181
|
}
|
|
179
|
-
const imageUrl = Array.isArray(input.value) ? input.value[index]
|
|
182
|
+
const imageUrl = Array.isArray(input.value) ? (_input$value$index = input.value[index]) === null || _input$value$index === void 0 ? void 0 : _input$value$index.url : input.value;
|
|
180
183
|
(0, _utils.getBlobFromUrl)(imageUrl, async response => {
|
|
181
184
|
if (response) {
|
|
182
185
|
const newFile = new File([response], (0, _utils.getDefaultAttachment)(response.type.substring(response.type.indexOf('/') + 1), index + 1), {
|
|
@@ -136,9 +136,9 @@ const Attachment = _ref => {
|
|
|
136
136
|
};
|
|
137
137
|
const closePreviewModal = () => setPreviewModalIsOpen(false);
|
|
138
138
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
139
|
-
className:
|
|
139
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classes.container, " ").concat(error && classes.errorContainer)
|
|
140
140
|
}, !previewIsEmpty && preview.map(previewItem => /*#__PURE__*/_react.default.createElement("div", {
|
|
141
|
-
className:
|
|
141
|
+
className: "".concat(_stylesModule.default.previewContainer, " ").concat(classes.previewContainer)
|
|
142
142
|
}, previewItem.src ? /*#__PURE__*/_react.default.createElement(_Preview.default, {
|
|
143
143
|
classes: classes,
|
|
144
144
|
preview: previewItem,
|
|
@@ -178,9 +178,9 @@ const Attachment = _ref => {
|
|
|
178
178
|
size: "small",
|
|
179
179
|
variant: "text"
|
|
180
180
|
}))), previewIsEmpty && /*#__PURE__*/_react.default.createElement(FilesIcon, {
|
|
181
|
-
className:
|
|
181
|
+
className: "".concat(_stylesModule.default.filesIcon, " ").concat(classes.filesIcon)
|
|
182
182
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
183
|
-
className:
|
|
183
|
+
className: "".concat(_stylesModule.default.labelAndInputContainer, " ").concat(!previewIsEmpty && _stylesModule.default.positionRelative)
|
|
184
184
|
}, previewIsEmpty && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
185
185
|
colorTheme: "accent"
|
|
186
186
|
}, _constants.INDICATIONS), /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
@@ -204,7 +204,7 @@ const Attachment = _ref => {
|
|
|
204
204
|
colorTheme: "gray",
|
|
205
205
|
variant: "small",
|
|
206
206
|
className: _stylesModule.default.aclaration
|
|
207
|
-
},
|
|
207
|
+
}, "".concat(_constants.FORMAT_FILE_LABEL).concat((0, _utils.getAvailableFileTypesLabel)(fieldType), "."), " ", /*#__PURE__*/_react.default.createElement("br", null), "".concat(_constants.MAX_SIZE_FILE_LABEL).concat(maxFileSize, "MB"))), helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
208
208
|
className: _stylesModule.default.helpText,
|
|
209
209
|
colorTheme: "gray",
|
|
210
210
|
variant: "small"
|
|
@@ -5,31 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.retrieveStyle = void 0;
|
|
7
7
|
const retrieveStyle = _ref => {
|
|
8
|
+
var _theme$Palette, _theme$Palette2, _theme$Palette3, _theme$Palette4, _theme$Palette5, _theme$Palette6, _theme$Palette7, _theme$Palette8;
|
|
8
9
|
let {
|
|
9
10
|
theme
|
|
10
11
|
} = _ref;
|
|
11
12
|
return {
|
|
12
13
|
container: {
|
|
13
|
-
backgroundColor: theme.Palette
|
|
14
|
-
border:
|
|
14
|
+
backgroundColor: (_theme$Palette = theme.Palette) === null || _theme$Palette === void 0 ? void 0 : _theme$Palette.light['03'],
|
|
15
|
+
border: "1px dashed ".concat((_theme$Palette2 = theme.Palette) === null || _theme$Palette2 === void 0 ? void 0 : _theme$Palette2.actions.accent['04'])
|
|
15
16
|
},
|
|
16
17
|
errorContainer: {
|
|
17
|
-
border:
|
|
18
|
+
border: "2px solid ".concat((_theme$Palette3 = theme.Palette) === null || _theme$Palette3 === void 0 ? void 0 : _theme$Palette3.error['04'])
|
|
18
19
|
},
|
|
19
20
|
filesIcon: {
|
|
20
|
-
fill: theme.Palette
|
|
21
|
+
fill: (_theme$Palette4 = theme.Palette) === null || _theme$Palette4 === void 0 ? void 0 : _theme$Palette4.actions.accent['03']
|
|
21
22
|
},
|
|
22
23
|
previewContainer: {
|
|
23
|
-
backgroundColor: theme.Palette
|
|
24
|
+
backgroundColor: (_theme$Palette5 = theme.Palette) === null || _theme$Palette5 === void 0 ? void 0 : _theme$Palette5.light['01']
|
|
24
25
|
},
|
|
25
26
|
actionAccentIcon: {
|
|
26
|
-
fill: theme.Palette
|
|
27
|
+
fill: (_theme$Palette6 = theme.Palette) === null || _theme$Palette6 === void 0 ? void 0 : _theme$Palette6.actions.accent['04']
|
|
27
28
|
},
|
|
28
29
|
uploadIcon: {
|
|
29
|
-
fill: theme.Palette
|
|
30
|
+
fill: (_theme$Palette7 = theme.Palette) === null || _theme$Palette7 === void 0 ? void 0 : _theme$Palette7.actions.accent['05']
|
|
30
31
|
},
|
|
31
32
|
actionNeutralIcon: {
|
|
32
|
-
fill: theme.Palette
|
|
33
|
+
fill: (_theme$Palette8 = theme.Palette) === null || _theme$Palette8 === void 0 ? void 0 : _theme$Palette8.actions.neutral['05']
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
};
|