@widergy/energy-ui 3.22.3 → 3.22.5
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 +14 -0
- package/dist/components/Loading/index.js +2 -2
- package/dist/components/UTActionCard/README.md +2 -2
- package/dist/components/UTActionCard/components/AdditionalMessage/index.js +4 -2
- package/dist/components/UTActionCard/components/BottomActions/index.js +7 -5
- package/dist/components/UTActionCard/components/BottomActions/styles.module.scss +4 -0
- package/dist/components/UTActionCard/components/Header/constants.js +14 -1
- package/dist/components/UTActionCard/components/Header/index.js +6 -4
- package/dist/components/UTActionCard/components/Header/styles.module.scss +6 -8
- package/dist/components/UTActionCard/components/Header/utils.js +2 -2
- package/dist/components/UTActionCard/components/HeaderActions/index.js +13 -9
- package/dist/components/UTActionCard/components/HeaderActions/utils.js +26 -15
- package/dist/components/UTActionCard/index.js +13 -15
- 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/styles.module.scss +0 -1
- 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/dist/components/UTActionCard/components/HeaderActions/constants.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.22.5](https://github.com/widergy/energy-ui/compare/v3.22.4...v3.22.5) (2024-10-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* ut action card minor fixes ([#502](https://github.com/widergy/energy-ui/issues/502)) ([a0b41b5](https://github.com/widergy/energy-ui/commit/a0b41b5b7bc9608892b87af8c6946d37aa56e782))
|
|
7
|
+
|
|
8
|
+
## [3.22.4](https://github.com/widergy/energy-ui/compare/v3.22.3...v3.22.4) (2024-10-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fixes workflow icon ([#504](https://github.com/widergy/energy-ui/issues/504)) ([51e34f1](https://github.com/widergy/energy-ui/commit/51e34f1b8f5669955dc0f6cf189d536b49fb06d6))
|
|
14
|
+
|
|
1
15
|
## [3.22.3](https://github.com/widergy/energy-ui/compare/v3.22.2...v3.22.3) (2024-10-01)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -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 = {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
| `description` | `string` | | Description text to be displayed. |
|
|
15
15
|
| `descriptionProps` | `shape({ colorTheme: string, variant: string })` | | Props to customize the description's style. |
|
|
16
16
|
| `headerActions` | `arrayOf(shape({ Icon: oneOfType([elementType, string]), iconProps: string, id: oneOfType([number, string]), label: string, loading: bool, onClick: func }))` | | List of actions available in the header section. |
|
|
17
|
-
| `headerActionsProps` | `shape({ alignment: oneOf(['center', 'end', 'start']), buttonGroupProps: shape({ colorTheme: string, shape: string }),
|
|
17
|
+
| `headerActionsProps` | `shape({ alignment: oneOf(['center', 'end', 'start']), buttonGroupProps: shape({ colorTheme: string, shape: string }), variant: oneOf(['default', 'buttonGroup']) })` | | Props to configure header actions alignment, button group, etc. |
|
|
18
18
|
| `mainAction` | `func` | | Main action function for the card. |
|
|
19
19
|
| `size` | `oneOf(['medium', 'small'])` | `'medium'` | Size of the card, either small or medium. |
|
|
20
20
|
| `status` | `string` | | Status text to be displayed. |
|
|
21
21
|
| `statusLabel` | `string` | | Status label for additional status info. |
|
|
22
22
|
| `statusAlignment` | `oneOf(['center', 'end', 'start'])` | | Alignment of the status element. |
|
|
23
|
-
| `title` | `string
|
|
23
|
+
| `title` | `string` | | The title of the card. |
|
|
24
24
|
| `titleProps` | `shape({ variant: string, weight: string })` | | Props to configure the title style. |
|
|
25
25
|
| `withBodyPadding` | `bool` | `false` | Adds padding to the card body if`true`. |
|
|
@@ -23,10 +23,12 @@ 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
|
+
area: true,
|
|
28
29
|
colorTheme: "gray",
|
|
29
|
-
name: icon
|
|
30
|
+
name: icon,
|
|
31
|
+
size: 16
|
|
30
32
|
}, iconProps)), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
31
33
|
colorTheme: "gray",
|
|
32
34
|
variant: "small",
|
|
@@ -15,7 +15,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
15
15
|
const BottomActions = _ref => {
|
|
16
16
|
let {
|
|
17
17
|
actions = [],
|
|
18
|
-
bottomActionsVariant
|
|
18
|
+
bottomActionsVariant,
|
|
19
|
+
size
|
|
19
20
|
} = _ref;
|
|
20
21
|
const type = actions.length > 2 ? _constants.ACTION_TYPES.REDIRECTION : bottomActionsVariant || _constants.ACTION_TYPES.DEFAULT;
|
|
21
22
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -31,9 +32,9 @@ const BottomActions = _ref => {
|
|
|
31
32
|
} = _ref2;
|
|
32
33
|
return /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
33
34
|
classNames: {
|
|
34
|
-
childrenContainer:
|
|
35
|
-
root:
|
|
36
|
-
text:
|
|
35
|
+
childrenContainer: "".concat(type === _constants.ACTION_TYPES.REDIRECTION && _stylesModule.default.redirectionChildrenContainer, " "),
|
|
36
|
+
root: "".concat(_stylesModule.default.actionButton, " ").concat(type === _constants.ACTION_TYPES.REDIRECTION && _stylesModule.default.fullWidth, " ").concat(size === _constants.SIZES.MEDIUM && _stylesModule.default.mediumPadding),
|
|
37
|
+
text: "".concat(type === _constants.ACTION_TYPES.REDIRECTION ? _stylesModule.default.redirectionText : _stylesModule.default.defaultText)
|
|
37
38
|
},
|
|
38
39
|
colorTheme: colorTheme,
|
|
39
40
|
disabled: disabled,
|
|
@@ -56,6 +57,7 @@ BottomActions.propTypes = {
|
|
|
56
57
|
loading: _propTypes.bool,
|
|
57
58
|
onClick: _propTypes.func
|
|
58
59
|
})),
|
|
59
|
-
bottomActionsVariant: _propTypes.string
|
|
60
|
+
bottomActionsVariant: _propTypes.string,
|
|
61
|
+
size: _propTypes.string
|
|
60
62
|
};
|
|
61
63
|
var _default = exports.default = /*#__PURE__*/(0, _react.memo)(BottomActions);
|
|
@@ -7,11 +7,24 @@ exports.ADORNMENT_COMPONENT_MAPPER = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _UTAvatar = _interopRequireDefault(require("../../../UTAvatar"));
|
|
9
9
|
var _UTIcon = _interopRequireDefault(require("../../../UTIcon"));
|
|
10
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
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); }
|
|
12
13
|
const ADORNMENT_COMPONENT_MAPPER = exports.ADORNMENT_COMPONENT_MAPPER = {
|
|
13
14
|
icon: _UTIcon.default,
|
|
14
|
-
avatar:
|
|
15
|
+
avatar: _ref => {
|
|
16
|
+
let {
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_UTAvatar.default, _extends({
|
|
21
|
+
className: "".concat(_stylesModule.default.defaultAvatar, " ").concat(className),
|
|
22
|
+
labelProps: {
|
|
23
|
+
variant: 'title1',
|
|
24
|
+
weight: 'medium'
|
|
25
|
+
}
|
|
26
|
+
}, props));
|
|
27
|
+
},
|
|
15
28
|
image: props => /*#__PURE__*/_react.default.createElement("img", _extends({
|
|
16
29
|
alt: ""
|
|
17
30
|
}, props))
|
|
@@ -20,6 +20,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
20
20
|
const Header = _ref => {
|
|
21
21
|
let {
|
|
22
22
|
adornment,
|
|
23
|
+
classNames,
|
|
23
24
|
description,
|
|
24
25
|
descriptionProps,
|
|
25
26
|
headerActions,
|
|
@@ -33,15 +34,16 @@ const Header = _ref => {
|
|
|
33
34
|
titleProps
|
|
34
35
|
} = _ref;
|
|
35
36
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
36
|
-
className:
|
|
37
|
+
className: "".concat(_stylesModule.default.header, " ").concat(_stylesModule.default[size], " ").concat(classNames.header)
|
|
37
38
|
}, (0, _utils.renderAdornment)(adornment, 'left', size), /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
-
className:
|
|
39
|
+
className: _stylesModule.default.headerTitles
|
|
39
40
|
}, (0, _utils.renderAdornment)(adornment, 'top', size), /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
41
|
+
variant: "title3",
|
|
40
42
|
weight: "medium"
|
|
41
43
|
}, titleProps), title), description && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
|
|
42
44
|
colorTheme: "gray"
|
|
43
45
|
}, descriptionProps), description)), status ? /*#__PURE__*/_react.default.createElement(_UTStatus.default, _extends({
|
|
44
|
-
className:
|
|
46
|
+
className: "".concat(_stylesModule.default["placeSelf-".concat(statusAlignment)]),
|
|
45
47
|
type: "light"
|
|
46
48
|
}, (0, _utils.statusPropsMapper)(status)), statusLabel || status) : null, !(0, _array.isEmpty)(headerActions) && /*#__PURE__*/_react.default.createElement(_HeaderActions.default, {
|
|
47
49
|
headerActions,
|
|
@@ -55,6 +57,7 @@ Header.propTypes = {
|
|
|
55
57
|
props: _propTypes.object,
|
|
56
58
|
type: _propTypes.string
|
|
57
59
|
}),
|
|
60
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
58
61
|
description: _propTypes.string,
|
|
59
62
|
descriptionProps: (0, _propTypes.shape)({
|
|
60
63
|
colorTheme: _propTypes.string,
|
|
@@ -74,7 +77,6 @@ Header.propTypes = {
|
|
|
74
77
|
colorTheme: _propTypes.string,
|
|
75
78
|
shape: _propTypes.string
|
|
76
79
|
}),
|
|
77
|
-
maxNumberOfPrimaryActions: _propTypes.number,
|
|
78
80
|
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
79
81
|
}),
|
|
80
82
|
setMainActionHoverVisible: _propTypes.string,
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
.headerTitles {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
|
+
grid-gap: 8px;
|
|
10
11
|
margin-right: auto;
|
|
11
12
|
overflow-wrap: anywhere;
|
|
12
13
|
}
|
|
@@ -15,18 +16,10 @@
|
|
|
15
16
|
padding: 24px;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
.gap-medium {
|
|
19
|
-
grid-gap: 16px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
19
|
.small {
|
|
23
20
|
padding: 16px;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
.gap-small {
|
|
27
|
-
grid-gap: 8px;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
23
|
.placeSelf-center {
|
|
31
24
|
place-self: center;
|
|
32
25
|
}
|
|
@@ -38,3 +31,8 @@
|
|
|
38
31
|
.placeSelf-end {
|
|
39
32
|
place-self: flex-end;
|
|
40
33
|
}
|
|
34
|
+
|
|
35
|
+
.defaultAvatar {
|
|
36
|
+
height: 64px;
|
|
37
|
+
width: 64px;
|
|
38
|
+
}
|
|
@@ -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;
|
|
@@ -12,13 +12,13 @@ var _UTButtonGroup = _interopRequireDefault(require("../../../UTButtonGroup"));
|
|
|
12
12
|
var _UTMenu = _interopRequireDefault(require("../../../UTMenu"));
|
|
13
13
|
var _constants = require("../../constants");
|
|
14
14
|
var _utils = require("./utils");
|
|
15
|
-
var _constants2 = require("./constants");
|
|
16
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
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); }
|
|
19
18
|
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
19
|
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
20
|
const HeaderActions = _ref => {
|
|
21
|
+
var _secondaryActions$;
|
|
22
22
|
let {
|
|
23
23
|
headerActions,
|
|
24
24
|
headerActionsProps,
|
|
@@ -30,8 +30,7 @@ const HeaderActions = _ref => {
|
|
|
30
30
|
const {
|
|
31
31
|
colorTheme: buttonGroupColorTheme = 'secondary',
|
|
32
32
|
shape: buttonGroupShape
|
|
33
|
-
} = headerActionsProps
|
|
34
|
-
const maxNumberOfPrimaryActions = headerActionsProps?.maxNumberOfPrimaryActions || _constants2.DEFAULT_MAX_NUMBER_OF_PRIMARY_ACTIONS;
|
|
33
|
+
} = (headerActionsProps === null || headerActionsProps === void 0 ? void 0 : headerActionsProps.buttonGroupProps) || {};
|
|
35
34
|
const handleSetMainActionHoverVisible = () => setMainActionHoverVisible(true);
|
|
36
35
|
const handleSetMainActionHoverHidden = () => setMainActionHoverVisible(false);
|
|
37
36
|
const openMenu = event => setMenu(event.currentTarget);
|
|
@@ -39,10 +38,12 @@ const HeaderActions = _ref => {
|
|
|
39
38
|
handleSetMainActionHoverVisible();
|
|
40
39
|
setMenu();
|
|
41
40
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
41
|
+
const {
|
|
42
|
+
primaryActions,
|
|
43
|
+
secondaryActions
|
|
44
|
+
} = (0, _utils.processActions)(headerActions, !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
|
|
@@ -71,7 +72,11 @@ const HeaderActions = _ref => {
|
|
|
71
72
|
Icon: "IconDots",
|
|
72
73
|
onClick: e => {
|
|
73
74
|
e.stopPropagation();
|
|
74
|
-
|
|
75
|
+
if (menu) {
|
|
76
|
+
setMenu();
|
|
77
|
+
} else {
|
|
78
|
+
openMenu(e);
|
|
79
|
+
}
|
|
75
80
|
},
|
|
76
81
|
size: "medium",
|
|
77
82
|
variant: "text"
|
|
@@ -84,7 +89,7 @@ const HeaderActions = _ref => {
|
|
|
84
89
|
}
|
|
85
90
|
})),
|
|
86
91
|
colorTheme: buttonGroupColorTheme,
|
|
87
|
-
selected: selectedAction || secondaryActions[0]
|
|
92
|
+
selected: selectedAction || ((_secondaryActions$ = secondaryActions[0]) === null || _secondaryActions$ === void 0 ? void 0 : _secondaryActions$.id),
|
|
88
93
|
shape: buttonGroupShape
|
|
89
94
|
})));
|
|
90
95
|
};
|
|
@@ -103,7 +108,6 @@ HeaderActions.propTypes = {
|
|
|
103
108
|
colorTheme: _propTypes.string,
|
|
104
109
|
shape: _propTypes.string
|
|
105
110
|
}),
|
|
106
|
-
maxNumberOfPrimaryActions: _propTypes.number,
|
|
107
111
|
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
108
112
|
}),
|
|
109
113
|
setMainActionHoverVisible: _propTypes.func
|
|
@@ -3,18 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
exports.processActions = void 0;
|
|
7
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const mapAction = (action, onClickHandler) => ({
|
|
10
|
+
...action,
|
|
11
|
+
onClick: e => {
|
|
12
|
+
var _action$onClick;
|
|
13
|
+
e === null || e === void 0 || e.stopPropagation();
|
|
14
|
+
if (onClickHandler) onClickHandler();
|
|
15
|
+
action === null || action === void 0 || (_action$onClick = action.onClick) === null || _action$onClick === void 0 || _action$onClick.call(action);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const processActions = (headerActions, onClickHandler) => headerActions.reduce((final, current) => {
|
|
19
|
+
if (current.isPrimary && (0, _isEmpty.default)(final.primaryActions)) return {
|
|
20
|
+
...final,
|
|
21
|
+
primaryActions: [current]
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
...final,
|
|
25
|
+
secondaryActions: [...final.secondaryActions, mapAction(current, onClickHandler)]
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
primaryActions: [],
|
|
29
|
+
secondaryActions: []
|
|
30
|
+
});
|
|
31
|
+
exports.processActions = processActions;
|
|
@@ -17,6 +17,7 @@ var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
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); }
|
|
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
|
+
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); }
|
|
20
21
|
const UTActionCard = _ref => {
|
|
21
22
|
let {
|
|
22
23
|
additionalMessage,
|
|
@@ -43,16 +44,17 @@ const UTActionCard = _ref => {
|
|
|
43
44
|
} = _ref;
|
|
44
45
|
const [mainActionHoverVisible, setMainActionHoverVisible] = (0, _react.useState)(true);
|
|
45
46
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
-
className:
|
|
47
|
+
className: "".concat(_stylesModule.default.cardContainer, " ").concat(classNames.container)
|
|
47
48
|
}, /*#__PURE__*/_react.default.createElement(_UTTouchableWithoutFeedback.default, {
|
|
48
|
-
className:
|
|
49
|
-
onClick: () => mainAction
|
|
49
|
+
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))),
|
|
50
|
+
onClick: () => mainAction === null || mainAction === void 0 ? void 0 : mainAction()
|
|
50
51
|
}, BackgroundImage && /*#__PURE__*/_react.default.createElement(BackgroundImage, {
|
|
51
|
-
className:
|
|
52
|
+
className: "".concat(_stylesModule.default.backgroundImage, " ").concat(classNames.backgroundImage)
|
|
52
53
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
53
|
-
className:
|
|
54
|
+
className: "".concat(_stylesModule.default.headerAndChildrenContainer, " ").concat(classNames.headerAndChildrenContainer)
|
|
54
55
|
}, /*#__PURE__*/_react.default.createElement(_Header.default, {
|
|
55
56
|
adornment,
|
|
57
|
+
classNames,
|
|
56
58
|
description,
|
|
57
59
|
descriptionProps,
|
|
58
60
|
headerActions,
|
|
@@ -66,16 +68,13 @@ const UTActionCard = _ref => {
|
|
|
66
68
|
title,
|
|
67
69
|
titleProps
|
|
68
70
|
}), children && /*#__PURE__*/_react.default.createElement("div", {
|
|
69
|
-
className:
|
|
70
|
-
}, children))), !(0, _object.objectIsEmpty)(additionalMessage) && /*#__PURE__*/_react.default.createElement(_AdditionalMessage.default, {
|
|
71
|
-
icon: additionalMessage.icon,
|
|
72
|
-
iconProps: additionalMessage.iconProps,
|
|
73
|
-
labelProps: additionalMessage.labelProps,
|
|
74
|
-
message: additionalMessage.message,
|
|
71
|
+
className: "".concat(withBodyPadding ? _stylesModule.default["bodyPadding-".concat(size)] : _stylesModule.default["withoutBodyPadding-".concat(size)])
|
|
72
|
+
}, children))), !(0, _object.objectIsEmpty)(additionalMessage) && /*#__PURE__*/_react.default.createElement(_AdditionalMessage.default, _extends({}, additionalMessage, {
|
|
75
73
|
size: size
|
|
76
|
-
}), !(0, _array.isEmpty)(bottomActions) && /*#__PURE__*/_react.default.createElement(_BottomActions.default, {
|
|
74
|
+
})), !(0, _array.isEmpty)(bottomActions) && /*#__PURE__*/_react.default.createElement(_BottomActions.default, {
|
|
77
75
|
actions: bottomActions,
|
|
78
|
-
bottomActionsVariant: bottomActionsVariant
|
|
76
|
+
bottomActionsVariant: bottomActionsVariant,
|
|
77
|
+
size: size
|
|
79
78
|
}));
|
|
80
79
|
};
|
|
81
80
|
UTActionCard.propTypes = {
|
|
@@ -127,7 +126,6 @@ UTActionCard.propTypes = {
|
|
|
127
126
|
colorTheme: _propTypes.string,
|
|
128
127
|
shape: _propTypes.string
|
|
129
128
|
}),
|
|
130
|
-
maxNumberOfPrimaryActions: _propTypes.number,
|
|
131
129
|
variant: (0, _propTypes.oneOf)([_constants.HEADER_ACTIONS_VARIANTS.DEFAULT, _constants.HEADER_ACTIONS_VARIANTS.BUTTON_GROUP])
|
|
132
130
|
}),
|
|
133
131
|
mainAction: _propTypes.func,
|
|
@@ -135,7 +133,7 @@ UTActionCard.propTypes = {
|
|
|
135
133
|
status: _propTypes.string,
|
|
136
134
|
statusLabel: _propTypes.string,
|
|
137
135
|
statusAlignment: (0, _propTypes.oneOf)([_constants.PLACE_SELF_TYPES.CENTER, _constants.PLACE_SELF_TYPES.END, _constants.PLACE_SELF_TYPES.START]),
|
|
138
|
-
title: _propTypes.string
|
|
136
|
+
title: _propTypes.string,
|
|
139
137
|
titleProps: (0, _propTypes.shape)({
|
|
140
138
|
variant: _propTypes.string,
|
|
141
139
|
weight: _propTypes.string
|
|
@@ -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;
|