@telefonica/mistica 10.5.1 → 10.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/button-group.d.ts +9 -0
- package/dist/button-group.js +67 -0
- package/dist/button-group.js.flow +11 -0
- package/dist/button.d.ts +1 -1
- package/dist/button.js +1 -1
- package/dist/button.js.flow +1 -1
- package/dist/callout.d.ts +2 -1
- package/dist/callout.js +15 -21
- package/dist/callout.js.flow +2 -3
- package/dist/card.d.ts +1 -1
- package/dist/card.js +41 -48
- package/dist/date-field.js +8 -0
- package/dist/date-time-field.js +8 -0
- package/dist/date-time-picker.d.ts +1 -0
- package/dist/date-time-picker.js +55 -20
- package/dist/date-time-picker.js.flow +1 -0
- package/dist/decimal-field.d.ts +1 -0
- package/dist/decimal-field.js.flow +1 -0
- package/dist/empty-state-card.d.ts +4 -3
- package/dist/empty-state-card.js +18 -24
- package/dist/empty-state-card.js.flow +2 -3
- package/dist/empty-state.d.ts +2 -2
- package/dist/empty-state.js +51 -9
- package/dist/feedback.d.ts +2 -7
- package/dist/feedback.js +38 -60
- package/dist/feedback.js.flow +2 -6
- package/dist/header.js +37 -67
- package/dist/index.d.ts +4 -1
- package/dist/index.js +28 -0
- package/dist/index.js.flow +4 -0
- package/dist/month-field.d.ts +9 -0
- package/dist/month-field.js +192 -0
- package/dist/month-field.js.flow +13 -0
- package/dist/navigation-bar.js +102 -72
- package/dist/progress-bar.d.ts +1 -0
- package/dist/progress-bar.js +11 -6
- package/dist/progress-bar.js.flow +4 -1
- package/dist/skins/blau.d.ts +37 -0
- package/dist/skins/blau.js +238 -0
- package/dist/skins/blau.js.flow +39 -0
- package/dist/skins/constants.d.ts +1 -0
- package/dist/skins/constants.js +4 -2
- package/dist/skins/constants.js.flow +1 -0
- package/dist/skins/telefonica.js +1 -1
- package/dist/skins/types.d.ts +1 -1
- package/dist/skins/types.js.flow +7 -1
- package/dist/skins/utils.js +5 -0
- package/dist/stepper.js +1 -1
- package/dist/text-field-base.js +8 -1
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +8 -4
- package/dist/theme.js.flow +1 -0
- package/dist/utils/time.d.ts +1 -0
- package/dist/utils/time.js +9 -1
- package/dist/utils/time.js.flow +1 -0
- package/dist-es/button-group.js +54 -0
- package/dist-es/button.js +1 -1
- package/dist-es/callout.js +15 -21
- package/dist-es/card.js +40 -47
- package/dist-es/date-field.js +7 -0
- package/dist-es/date-time-field.js +7 -0
- package/dist-es/date-time-picker.js +56 -22
- package/dist-es/empty-state-card.js +17 -23
- package/dist-es/empty-state.js +16 -9
- package/dist-es/feedback.js +37 -60
- package/dist-es/header.js +37 -67
- package/dist-es/index.js +4 -1
- package/dist-es/month-field.js +120 -0
- package/dist-es/navigation-bar.js +102 -72
- package/dist-es/progress-bar.js +11 -6
- package/dist-es/skins/blau.js +225 -0
- package/dist-es/skins/constants.js +2 -1
- package/dist-es/skins/telefonica.js +1 -1
- package/dist-es/skins/utils.js +5 -1
- package/dist-es/stepper.js +1 -1
- package/dist-es/text-field-base.js +8 -1
- package/dist-es/theme.js +8 -4
- package/dist-es/utils/time.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
# [10.9.0](https://github.com/Telefonica/mistica-web/compare/v10.8.1...v10.9.0) (2021-10-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **MonthField:** new form field to select months ([#356](https://github.com/Telefonica/mistica-web/issues/356)) ([1a949a5](https://github.com/Telefonica/mistica-web/commit/1a949a5fa4d2f9e7a0141afd7c920741faf36c49))
|
|
7
|
+
|
|
8
|
+
## [10.8.1](https://github.com/Telefonica/mistica-web/compare/v10.8.0...v10.8.1) (2021-10-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **blau:** some color bad naming ([#358](https://github.com/Telefonica/mistica-web/issues/358)) ([64a3a87](https://github.com/Telefonica/mistica-web/commit/64a3a87a23cdbb16ca60c0639976c5fe84275905))
|
|
14
|
+
|
|
15
|
+
# [10.8.0](https://github.com/Telefonica/mistica-web/compare/v10.7.0...v10.8.0) (2021-10-18)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **ButtonGroup:** new component (private) ([#351](https://github.com/Telefonica/mistica-web/issues/351)) ([fe00dd7](https://github.com/Telefonica/mistica-web/commit/fe00dd7372e6bec8222bf7456b28fb523d40d2c9))
|
|
21
|
+
|
|
22
|
+
# [10.7.0](https://github.com/Telefonica/mistica-web/compare/v10.6.0...v10.7.0) (2021-10-18)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **colors:** fix some dark colors ([#354](https://github.com/Telefonica/mistica-web/issues/354)) ([7ecb12b](https://github.com/Telefonica/mistica-web/commit/7ecb12b502a4a634d4cd0686f205e448db3a7b7f))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **ProgressBar:** allow custom color ([#353](https://github.com/Telefonica/mistica-web/issues/353)) ([1f7be87](https://github.com/Telefonica/mistica-web/commit/1f7be87b4c9297fa273f69b612333224f05750aa))
|
|
33
|
+
|
|
34
|
+
# [10.6.0](https://github.com/Telefonica/mistica-web/compare/v10.5.1...v10.6.0) (2021-10-14)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* **Blau:** new skin ([#311](https://github.com/Telefonica/mistica-web/issues/311)) ([235017b](https://github.com/Telefonica/mistica-web/commit/235017bb80fd87956ce84257c2042862d53b6f85))
|
|
40
|
+
|
|
1
41
|
## [10.5.1](https://github.com/Telefonica/mistica-web/compare/v10.5.0...v10.5.1) (2021-10-05)
|
|
2
42
|
|
|
3
43
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonLink, ButtonLinkProps, ButtonPrimary, ButtonProps, ButtonSecondary } from './button';
|
|
3
|
+
export interface ButtonGroupProps {
|
|
4
|
+
primaryButton?: React.ReactElement<ButtonProps, typeof ButtonPrimary>;
|
|
5
|
+
secondaryButton?: React.ReactElement<ButtonProps, typeof ButtonSecondary>;
|
|
6
|
+
link?: React.ReactElement<ButtonLinkProps, typeof ButtonLink>;
|
|
7
|
+
}
|
|
8
|
+
declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
9
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _jss = require("./jss");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
var buttonLayoutSpacing = 16;
|
|
17
|
+
var buttonLinkPadding = 6;
|
|
18
|
+
var useStyles = (0, _jss.createUseStyles)(function () {
|
|
19
|
+
return {
|
|
20
|
+
inline: {
|
|
21
|
+
display: 'inline-flex',
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
flexWrap: 'wrap',
|
|
24
|
+
alignItems: 'center'
|
|
25
|
+
},
|
|
26
|
+
container: {
|
|
27
|
+
marginTop: -buttonLayoutSpacing,
|
|
28
|
+
marginLeft: -buttonLayoutSpacing - buttonLinkPadding
|
|
29
|
+
},
|
|
30
|
+
buttons: {
|
|
31
|
+
marginLeft: buttonLinkPadding,
|
|
32
|
+
'& > div': {
|
|
33
|
+
marginTop: buttonLayoutSpacing,
|
|
34
|
+
marginLeft: buttonLayoutSpacing
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
link: {
|
|
38
|
+
marginTop: buttonLayoutSpacing,
|
|
39
|
+
marginLeft: buttonLayoutSpacing,
|
|
40
|
+
width: function width(_ref) {
|
|
41
|
+
var bothButtons = _ref.bothButtons;
|
|
42
|
+
return bothButtons ? '100%' : 'auto';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
var ButtonGroup = function ButtonGroup(_ref2) {
|
|
49
|
+
var primaryButton = _ref2.primaryButton,
|
|
50
|
+
secondaryButton = _ref2.secondaryButton,
|
|
51
|
+
link = _ref2.link;
|
|
52
|
+
var anyAction = !!primaryButton || !!secondaryButton || !!link;
|
|
53
|
+
var bothButtons = !!primaryButton && !!secondaryButton;
|
|
54
|
+
var classes = useStyles({
|
|
55
|
+
bothButtons: bothButtons
|
|
56
|
+
});
|
|
57
|
+
return anyAction ? /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
+
className: (0, _classnames.default)(classes.inline, classes.container)
|
|
59
|
+
}, (primaryButton || secondaryButton) && /*#__PURE__*/_react.default.createElement("div", {
|
|
60
|
+
className: (0, _classnames.default)(classes.inline, classes.buttons)
|
|
61
|
+
}, primaryButton && /*#__PURE__*/_react.default.createElement("div", null, primaryButton), secondaryButton && /*#__PURE__*/_react.default.createElement("div", null, secondaryButton)), link && /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
+
className: classes.link
|
|
63
|
+
}, link)) : null;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
var _default = ButtonGroup;
|
|
67
|
+
exports.default = _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ButtonLink, ButtonPrimary, ButtonSecondary } from "./button";
|
|
5
|
+
export type ButtonGroupProps = {|
|
|
6
|
+
primaryButton?: React.Element<typeof ButtonPrimary>,
|
|
7
|
+
secondaryButton?: React.Element<typeof ButtonSecondary>,
|
|
8
|
+
link?: React.Element<typeof ButtonLink>,
|
|
9
|
+
|};
|
|
10
|
+
declare var ButtonGroup: React.ComponentType<ButtonGroupProps>;
|
|
11
|
+
declare export default typeof ButtonGroup;
|
package/dist/button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { DataAttributes, TrackingEvent } from './utils/types';
|
|
3
3
|
import type { Location } from 'history';
|
|
4
|
-
export declare const BUTTON_MIN_WIDTH =
|
|
4
|
+
export declare const BUTTON_MIN_WIDTH = 136;
|
|
5
5
|
interface CommonProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
className?: string;
|
package/dist/button.js
CHANGED
|
@@ -165,7 +165,7 @@ function _defineProperty(obj, key, value) {
|
|
|
165
165
|
return obj;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
var BUTTON_MIN_WIDTH =
|
|
168
|
+
var BUTTON_MIN_WIDTH = 136;
|
|
169
169
|
exports.BUTTON_MIN_WIDTH = BUTTON_MIN_WIDTH;
|
|
170
170
|
var transitionTiming = '0.3s cubic-bezier(0.77, 0, 0.175, 1)';
|
|
171
171
|
var BORDER_PX = 1.5;
|
package/dist/button.js.flow
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import type { DataAttributes, TrackingEvent } from "./utils/types";
|
|
5
5
|
import type { Location } from "history";
|
|
6
|
-
declare export var BUTTON_MIN_WIDTH:
|
|
6
|
+
declare export var BUTTON_MIN_WIDTH: 136;
|
|
7
7
|
declare type CommonProps = {|
|
|
8
8
|
children: React.Node,
|
|
9
9
|
className?: string,
|
package/dist/callout.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ declare type Props = {
|
|
|
6
6
|
description: string;
|
|
7
7
|
onClose?: () => void;
|
|
8
8
|
icon?: React.ReactElement;
|
|
9
|
-
button?: React.ReactElement<ButtonProps, typeof ButtonPrimary
|
|
9
|
+
button?: React.ReactElement<ButtonProps, typeof ButtonPrimary>;
|
|
10
|
+
secondaryButton?: React.ReactElement<ButtonProps, typeof ButtonSecondary>;
|
|
10
11
|
buttonLink?: React.ReactElement<ButtonLinkProps, typeof ButtonLink>;
|
|
11
12
|
children?: void;
|
|
12
13
|
'aria-label'?: string;
|
package/dist/callout.js
CHANGED
|
@@ -25,7 +25,7 @@ var _iconButton = _interopRequireDefault(require("./icon-button"));
|
|
|
25
25
|
|
|
26
26
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _buttonGroup = _interopRequireDefault(require("./button-group"));
|
|
29
29
|
|
|
30
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
31
|
|
|
@@ -72,24 +72,19 @@ var useStyles = (0, _jss.createUseStyles)(function (_ref) {
|
|
|
72
72
|
},
|
|
73
73
|
overInverse: {
|
|
74
74
|
background: colors.backgroundContainer
|
|
75
|
-
},
|
|
76
|
-
actions: {
|
|
77
|
-
marginLeft: function marginLeft(_ref2) {
|
|
78
|
-
var needsButtonLinkAlignment = _ref2.needsButtonLinkAlignment;
|
|
79
|
-
return needsButtonLinkAlignment ? -6 : 0;
|
|
80
|
-
}
|
|
81
75
|
}
|
|
82
76
|
};
|
|
83
77
|
});
|
|
84
78
|
|
|
85
|
-
var Callout = function Callout(
|
|
86
|
-
var title =
|
|
87
|
-
description =
|
|
88
|
-
icon =
|
|
89
|
-
onClose =
|
|
90
|
-
button =
|
|
91
|
-
|
|
92
|
-
|
|
79
|
+
var Callout = function Callout(_ref2) {
|
|
80
|
+
var title = _ref2.title,
|
|
81
|
+
description = _ref2.description,
|
|
82
|
+
icon = _ref2.icon,
|
|
83
|
+
onClose = _ref2.onClose,
|
|
84
|
+
button = _ref2.button,
|
|
85
|
+
secondaryButton = _ref2.secondaryButton,
|
|
86
|
+
buttonLink = _ref2.buttonLink,
|
|
87
|
+
ariaLabel = _ref2['aria-label'];
|
|
93
88
|
var needsButtonLinkAlignment = buttonLink && !button;
|
|
94
89
|
var isInverse = (0, _themeVariantContext.useIsInverseVariant)();
|
|
95
90
|
var classes = useStyles({
|
|
@@ -118,12 +113,11 @@ var Callout = function Callout(_ref3) {
|
|
|
118
113
|
as: "p",
|
|
119
114
|
regular: true,
|
|
120
115
|
color: colors.textSecondary
|
|
121
|
-
}, description)), (button || buttonLink) && /*#__PURE__*/React.createElement(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}, button, buttonLink)))), onClose && /*#__PURE__*/React.createElement(_iconButton.default, {
|
|
116
|
+
}, description)), (button || secondaryButton || buttonLink) && /*#__PURE__*/React.createElement(_buttonGroup.default, {
|
|
117
|
+
primaryButton: button,
|
|
118
|
+
secondaryButton: secondaryButton,
|
|
119
|
+
link: buttonLink
|
|
120
|
+
}))), onClose && /*#__PURE__*/React.createElement(_iconButton.default, {
|
|
127
121
|
size: 40,
|
|
128
122
|
style: {
|
|
129
123
|
display: 'flex',
|
package/dist/callout.js.flow
CHANGED
|
@@ -7,9 +7,8 @@ declare type Props = {
|
|
|
7
7
|
description: string,
|
|
8
8
|
onClose?: () => void,
|
|
9
9
|
icon?: React.Element<any>,
|
|
10
|
-
button?:
|
|
11
|
-
|
|
12
|
-
| React.Element<typeof ButtonSecondary>,
|
|
10
|
+
button?: React.Element<typeof ButtonPrimary>,
|
|
11
|
+
secondaryButton?: React.Element<typeof ButtonSecondary>,
|
|
13
12
|
buttonLink?: React.Element<typeof ButtonLink>,
|
|
14
13
|
"aria-label"?: string,
|
|
15
14
|
};
|
package/dist/card.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare type MediaCardProps = {
|
|
|
25
25
|
description?: string;
|
|
26
26
|
extra?: React.ReactNode;
|
|
27
27
|
button?: React.ReactElement<ButtonProps, typeof ButtonPrimary>;
|
|
28
|
-
buttonLink?: React.ReactElement<
|
|
28
|
+
buttonLink?: React.ReactElement<ButtonLinkProps, typeof ButtonLink>;
|
|
29
29
|
children?: void;
|
|
30
30
|
'aria-label'?: string;
|
|
31
31
|
};
|
package/dist/card.js
CHANGED
|
@@ -21,10 +21,10 @@ var _text = require("./text");
|
|
|
21
21
|
|
|
22
22
|
var _jss = require("./jss");
|
|
23
23
|
|
|
24
|
-
var _inline = _interopRequireDefault(require("./inline"));
|
|
25
|
-
|
|
26
24
|
var _boxed = require("./boxed");
|
|
27
25
|
|
|
26
|
+
var _buttonGroup = _interopRequireDefault(require("./button-group"));
|
|
27
|
+
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
30
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -34,10 +34,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
34
|
var useCardContentStyles = (0, _jss.createUseStyles)(function () {
|
|
35
35
|
return {
|
|
36
36
|
actions: {
|
|
37
|
-
marginLeft: function marginLeft(_ref) {
|
|
38
|
-
var needsButtonLinkAlignment = _ref.needsButtonLinkAlignment;
|
|
39
|
-
return needsButtonLinkAlignment ? -6 : 0;
|
|
40
|
-
},
|
|
41
37
|
flex: 1,
|
|
42
38
|
display: 'flex',
|
|
43
39
|
alignItems: 'flex-end',
|
|
@@ -46,20 +42,17 @@ var useCardContentStyles = (0, _jss.createUseStyles)(function () {
|
|
|
46
42
|
};
|
|
47
43
|
});
|
|
48
44
|
|
|
49
|
-
var CardContent = function CardContent(
|
|
50
|
-
var headline =
|
|
51
|
-
pretitle =
|
|
52
|
-
title =
|
|
53
|
-
subtitle =
|
|
54
|
-
description =
|
|
55
|
-
extra =
|
|
56
|
-
button =
|
|
57
|
-
buttonLink =
|
|
45
|
+
var CardContent = function CardContent(_ref) {
|
|
46
|
+
var headline = _ref.headline,
|
|
47
|
+
pretitle = _ref.pretitle,
|
|
48
|
+
title = _ref.title,
|
|
49
|
+
subtitle = _ref.subtitle,
|
|
50
|
+
description = _ref.description,
|
|
51
|
+
extra = _ref.extra,
|
|
52
|
+
button = _ref.button,
|
|
53
|
+
buttonLink = _ref.buttonLink;
|
|
58
54
|
var theme = (0, _hooks.useTheme)();
|
|
59
|
-
var
|
|
60
|
-
var classes = useCardContentStyles({
|
|
61
|
-
needsButtonLinkAlignment: needsButtonLinkAlignment
|
|
62
|
-
});
|
|
55
|
+
var classes = useCardContentStyles();
|
|
63
56
|
|
|
64
57
|
var renderHeadline = function renderHeadline() {
|
|
65
58
|
if (!headline) {
|
|
@@ -97,10 +90,10 @@ var CardContent = function CardContent(_ref2) {
|
|
|
97
90
|
color: theme.colors.textSecondary
|
|
98
91
|
}, description)), extra && /*#__PURE__*/React.createElement("div", null, extra)), (button || buttonLink) && /*#__PURE__*/React.createElement("div", {
|
|
99
92
|
className: classes.actions
|
|
100
|
-
}, /*#__PURE__*/React.createElement(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
93
|
+
}, /*#__PURE__*/React.createElement(_buttonGroup.default, {
|
|
94
|
+
primaryButton: button,
|
|
95
|
+
link: buttonLink
|
|
96
|
+
})));
|
|
104
97
|
};
|
|
105
98
|
|
|
106
99
|
var useMediaCardStyles = (0, _jss.createUseStyles)(function () {
|
|
@@ -115,8 +108,8 @@ var useMediaCardStyles = (0, _jss.createUseStyles)(function () {
|
|
|
115
108
|
},
|
|
116
109
|
media: {
|
|
117
110
|
width: '100%',
|
|
118
|
-
paddingTop: function paddingTop(
|
|
119
|
-
var media =
|
|
111
|
+
paddingTop: function paddingTop(_ref2) {
|
|
112
|
+
var media = _ref2.media;
|
|
120
113
|
|
|
121
114
|
if (media.height) {
|
|
122
115
|
return media.height;
|
|
@@ -129,8 +122,8 @@ var useMediaCardStyles = (0, _jss.createUseStyles)(function () {
|
|
|
129
122
|
|
|
130
123
|
return '56.25%'; // 16/9 aspect ratio
|
|
131
124
|
},
|
|
132
|
-
backgroundImage: function backgroundImage(
|
|
133
|
-
var media =
|
|
125
|
+
backgroundImage: function backgroundImage(_ref3) {
|
|
126
|
+
var media = _ref3.media;
|
|
134
127
|
return "url(".concat(media.src, ")");
|
|
135
128
|
},
|
|
136
129
|
backgroundSize: 'cover',
|
|
@@ -146,16 +139,16 @@ var useMediaCardStyles = (0, _jss.createUseStyles)(function () {
|
|
|
146
139
|
};
|
|
147
140
|
});
|
|
148
141
|
|
|
149
|
-
var MediaCard = function MediaCard(
|
|
150
|
-
var media =
|
|
151
|
-
headline =
|
|
152
|
-
pretitle =
|
|
153
|
-
title =
|
|
154
|
-
description =
|
|
155
|
-
extra =
|
|
156
|
-
button =
|
|
157
|
-
buttonLink =
|
|
158
|
-
ariaLabel =
|
|
142
|
+
var MediaCard = function MediaCard(_ref4) {
|
|
143
|
+
var media = _ref4.media,
|
|
144
|
+
headline = _ref4.headline,
|
|
145
|
+
pretitle = _ref4.pretitle,
|
|
146
|
+
title = _ref4.title,
|
|
147
|
+
description = _ref4.description,
|
|
148
|
+
extra = _ref4.extra,
|
|
149
|
+
button = _ref4.button,
|
|
150
|
+
buttonLink = _ref4.buttonLink,
|
|
151
|
+
ariaLabel = _ref4['aria-label'];
|
|
159
152
|
var classes = useMediaCardStyles({
|
|
160
153
|
media: media
|
|
161
154
|
});
|
|
@@ -194,17 +187,17 @@ var useDataCardStyles = (0, _jss.createUseStyles)(function () {
|
|
|
194
187
|
};
|
|
195
188
|
});
|
|
196
189
|
|
|
197
|
-
var DataCard = function DataCard(
|
|
198
|
-
var icon =
|
|
199
|
-
headline =
|
|
200
|
-
title =
|
|
201
|
-
subtitle =
|
|
202
|
-
description =
|
|
203
|
-
extra =
|
|
204
|
-
button =
|
|
205
|
-
buttonLink =
|
|
206
|
-
dataAttributes =
|
|
207
|
-
ariaLabel =
|
|
190
|
+
var DataCard = function DataCard(_ref5) {
|
|
191
|
+
var icon = _ref5.icon,
|
|
192
|
+
headline = _ref5.headline,
|
|
193
|
+
title = _ref5.title,
|
|
194
|
+
subtitle = _ref5.subtitle,
|
|
195
|
+
description = _ref5.description,
|
|
196
|
+
extra = _ref5.extra,
|
|
197
|
+
button = _ref5.button,
|
|
198
|
+
buttonLink = _ref5.buttonLink,
|
|
199
|
+
dataAttributes = _ref5.dataAttributes,
|
|
200
|
+
ariaLabel = _ref5['aria-label'];
|
|
208
201
|
var classes = useDataCardStyles();
|
|
209
202
|
return /*#__PURE__*/React.createElement(_boxed.Boxed, {
|
|
210
203
|
className: classes.boxed,
|
package/dist/date-field.js
CHANGED
|
@@ -23,6 +23,8 @@ var _time = require("./utils/time");
|
|
|
23
23
|
|
|
24
24
|
var _hooks = require("./hooks");
|
|
25
25
|
|
|
26
|
+
var _platform = require("./utils/platform");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -112,6 +114,11 @@ var DateField = function DateField(_ref) {
|
|
|
112
114
|
};
|
|
113
115
|
|
|
114
116
|
var hasNativePicker = React.useMemo(function () {
|
|
117
|
+
if ((0, _platform.isFirefox)()) {
|
|
118
|
+
// disabled in firefox because it shows a close button over the icon and can't be styled
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
|
|
115
122
|
return (0, _dom.isInputTypeSupported)('date');
|
|
116
123
|
}, []);
|
|
117
124
|
|
|
@@ -180,6 +187,7 @@ var DateField = function DateField(_ref) {
|
|
|
180
187
|
return /*#__PURE__*/React.createElement(React.Suspense, {
|
|
181
188
|
fallback: nativePicker
|
|
182
189
|
}, /*#__PURE__*/React.createElement(ReactDateTimePicker, _extends({}, rest, fieldProps, {
|
|
190
|
+
optional: optional,
|
|
183
191
|
isValidDate: function isValidDate(currentDate) {
|
|
184
192
|
return isInRange((0, _time.getLocalDateString)(currentDate.toDate()));
|
|
185
193
|
}
|
package/dist/date-time-field.js
CHANGED
|
@@ -21,6 +21,8 @@ var _time = require("./utils/time");
|
|
|
21
21
|
|
|
22
22
|
var _iconCalendarRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-calendar-regular"));
|
|
23
23
|
|
|
24
|
+
var _platform = require("./utils/platform");
|
|
25
|
+
|
|
24
26
|
var _hooks = require("./hooks");
|
|
25
27
|
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -108,6 +110,11 @@ var FormDateField = function FormDateField(_ref) {
|
|
|
108
110
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
109
111
|
|
|
110
112
|
var hasNativePicker = React.useMemo(function () {
|
|
113
|
+
if ((0, _platform.isFirefox)()) {
|
|
114
|
+
// disabled for firefox because the picker has no option to select time
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
111
118
|
return (0, _dom.isInputTypeSupported)('datetime-local');
|
|
112
119
|
}, []);
|
|
113
120
|
|
|
@@ -182,6 +189,7 @@ var FormDateField = function FormDateField(_ref) {
|
|
|
182
189
|
return /*#__PURE__*/React.createElement(React.Suspense, {
|
|
183
190
|
fallback: nativePicker
|
|
184
191
|
}, /*#__PURE__*/React.createElement(ReactDateTimePicker, _extends({}, rest, fieldProps, {
|
|
192
|
+
optional: optional,
|
|
185
193
|
withTime: true,
|
|
186
194
|
isValidDate: function isValidDate(currentDate) {
|
|
187
195
|
return isInRange((0, _time.getLocalDateTimeString)(currentDate.toDate()));
|
|
@@ -5,6 +5,7 @@ export interface DateTimePickerProps extends CommonFormFieldProps {
|
|
|
5
5
|
inputRef: (field: HTMLInputElement | null) => void;
|
|
6
6
|
isValidDate?: (currentDate: Moment.Moment, selectedDate: Moment.Moment) => boolean;
|
|
7
7
|
withTime?: boolean;
|
|
8
|
+
mode?: 'year-month';
|
|
8
9
|
}
|
|
9
10
|
declare const DateTimePicker: React.FC<DateTimePickerProps>;
|
|
10
11
|
export default DateTimePicker;
|
package/dist/date-time-picker.js
CHANGED
|
@@ -27,13 +27,15 @@ var _jss = require("./jss");
|
|
|
27
27
|
|
|
28
28
|
var _hooks = require("./hooks");
|
|
29
29
|
|
|
30
|
+
var _iconCloseRegular = _interopRequireDefault(require("./generated/mistica-icons/icon-close-regular"));
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
35
|
|
|
34
36
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
37
|
|
|
36
|
-
var _excluded = ["withTime", "isValidDate"];
|
|
38
|
+
var _excluded = ["withTime", "mode", "isValidDate", "optional"];
|
|
37
39
|
|
|
38
40
|
function _extends() {
|
|
39
41
|
_extends = Object.assign || function (target) {
|
|
@@ -344,7 +346,9 @@ var useStyles = (0, _jss.createUseStyles)(function () {
|
|
|
344
346
|
|
|
345
347
|
var DateTimePicker = function DateTimePicker(_ref) {
|
|
346
348
|
var withTime = _ref.withTime,
|
|
349
|
+
mode = _ref.mode,
|
|
347
350
|
isValidDate = _ref.isValidDate,
|
|
351
|
+
optional = _ref.optional,
|
|
348
352
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
349
353
|
|
|
350
354
|
var _React$useState = React.useState(false),
|
|
@@ -353,20 +357,17 @@ var DateTimePicker = function DateTimePicker(_ref) {
|
|
|
353
357
|
setShowPicker = _React$useState2[1];
|
|
354
358
|
|
|
355
359
|
var classes = useStyles();
|
|
360
|
+
|
|
361
|
+
var _useTheme = (0, _hooks.useTheme)(),
|
|
362
|
+
texts = _useTheme.texts;
|
|
363
|
+
|
|
356
364
|
var fieldRef = React.useRef(null);
|
|
357
365
|
|
|
358
366
|
var _useElementDimensions = (0, _hooks.useElementDimensions)(),
|
|
359
367
|
pickerContainerHeight = _useElementDimensions.height,
|
|
360
368
|
pickerContainerRef = _useElementDimensions.ref;
|
|
361
369
|
|
|
362
|
-
var
|
|
363
|
-
var _rest$onFocus;
|
|
364
|
-
|
|
365
|
-
setShowPicker(true);
|
|
366
|
-
(_rest$onFocus = rest.onFocus) === null || _rest$onFocus === void 0 ? void 0 : _rest$onFocus.call(rest, event);
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
var getCalendarContainerStyles = function getCalendarContainerStyles() {
|
|
370
|
+
var getPickerContainerStyles = function getPickerContainerStyles() {
|
|
370
371
|
var _fieldRef$current;
|
|
371
372
|
|
|
372
373
|
var _ref2 = ((_fieldRef$current = fieldRef.current) === null || _fieldRef$current === void 0 ? void 0 : _fieldRef$current.getBoundingClientRect()) || {},
|
|
@@ -399,8 +400,20 @@ var DateTimePicker = function DateTimePicker(_ref) {
|
|
|
399
400
|
return value ? new Date(value) : undefined;
|
|
400
401
|
};
|
|
401
402
|
|
|
403
|
+
var formatMoment = function formatMoment(moment) {
|
|
404
|
+
if (withTime) {
|
|
405
|
+
return moment.format('yyyy-MM-DD HH:mm');
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if (mode === 'year-month') {
|
|
409
|
+
return moment.format('yyyy-MM');
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return moment.format('yyyy-MM-DD');
|
|
413
|
+
};
|
|
414
|
+
|
|
402
415
|
var setValue = function setValue(moment) {
|
|
403
|
-
var value = typeof moment === 'string' ? moment : moment
|
|
416
|
+
var value = typeof moment === 'string' ? moment : formatMoment(moment);
|
|
404
417
|
|
|
405
418
|
if (fieldRef.current) {
|
|
406
419
|
var _rest$onChange;
|
|
@@ -410,12 +423,21 @@ var DateTimePicker = function DateTimePicker(_ref) {
|
|
|
410
423
|
}
|
|
411
424
|
};
|
|
412
425
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
426
|
+
var renderEndIcon = function renderEndIcon() {
|
|
427
|
+
if (getValue() && optional) {
|
|
428
|
+
return /*#__PURE__*/React.createElement(_iconButton.default, {
|
|
429
|
+
"aria-label": texts.clearButton,
|
|
430
|
+
size: 32,
|
|
431
|
+
onPress: function onPress(event) {
|
|
432
|
+
event.stopPropagation();
|
|
433
|
+
setValue('');
|
|
434
|
+
}
|
|
435
|
+
}, /*#__PURE__*/React.createElement(_iconCloseRegular.default, {
|
|
436
|
+
size: 24
|
|
437
|
+
}));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return /*#__PURE__*/React.createElement(_iconButton.default, {
|
|
419
441
|
"aria-label": "",
|
|
420
442
|
size: 32,
|
|
421
443
|
onPress: function onPress() {
|
|
@@ -423,7 +445,18 @@ var DateTimePicker = function DateTimePicker(_ref) {
|
|
|
423
445
|
}
|
|
424
446
|
}, /*#__PURE__*/React.createElement(_iconCalendarRegular.default, {
|
|
425
447
|
size: 24
|
|
426
|
-
}))
|
|
448
|
+
}));
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_textFieldBase.default, _extends({}, rest, {
|
|
452
|
+
style: {
|
|
453
|
+
cursor: 'default'
|
|
454
|
+
},
|
|
455
|
+
required: !optional,
|
|
456
|
+
type: "text",
|
|
457
|
+
autoComplete: "off",
|
|
458
|
+
shrinkLabel: !!getValue(),
|
|
459
|
+
endIcon: renderEndIcon(),
|
|
427
460
|
inputRef: function inputRef(e) {
|
|
428
461
|
var _rest$inputRef;
|
|
429
462
|
|
|
@@ -435,7 +468,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
|
|
|
435
468
|
return setShowPicker(true);
|
|
436
469
|
},
|
|
437
470
|
onClick: function onClick() {
|
|
438
|
-
|
|
471
|
+
setShowPicker(true);
|
|
439
472
|
}
|
|
440
473
|
})), showPicker && /*#__PURE__*/React.createElement(_overlay.default, {
|
|
441
474
|
onPress: function onPress(e) {
|
|
@@ -445,11 +478,13 @@ var DateTimePicker = function DateTimePicker(_ref) {
|
|
|
445
478
|
disableScroll: true
|
|
446
479
|
}, /*#__PURE__*/React.createElement("div", {
|
|
447
480
|
ref: pickerContainerRef,
|
|
448
|
-
style:
|
|
481
|
+
style: getPickerContainerStyles(),
|
|
449
482
|
className: classes.reactDatePicker
|
|
450
483
|
}, /*#__PURE__*/React.createElement(_reactDatetime.default, {
|
|
451
|
-
|
|
484
|
+
initialViewMode: mode === 'year-month' ? 'months' : undefined,
|
|
485
|
+
dateFormat: mode === 'year-month' ? 'YYYY-MM' : undefined,
|
|
452
486
|
timeFormat: withTime ? 'HH:mm' : false,
|
|
487
|
+
initialValue: getValue(),
|
|
453
488
|
locale: browserLocale,
|
|
454
489
|
input: false,
|
|
455
490
|
onChange: setValue,
|
|
@@ -9,6 +9,7 @@ export type DateTimePickerProps = {|
|
|
|
9
9
|
inputRef: (field: HTMLInputElement | null) => void,
|
|
10
10
|
isValidDate?: (currentDate: Moment, selectedDate: Moment) => boolean,
|
|
11
11
|
withTime?: boolean,
|
|
12
|
+
mode?: "year-month",
|
|
12
13
|
|};
|
|
13
14
|
declare var DateTimePicker: React.ComponentType<DateTimePickerProps>;
|
|
14
15
|
declare export default typeof DateTimePicker;
|
package/dist/decimal-field.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare type DecimalInputProps = any;
|
|
|
12
12
|
export declare const DecimalInput: React.FC<DecimalInputProps>;
|
|
13
13
|
export interface DecimalFieldProps extends CommonFormFieldProps {
|
|
14
14
|
onChangeValue?: (value: string, rawValue: string) => void;
|
|
15
|
+
prefix?: React.ReactNode;
|
|
15
16
|
}
|
|
16
17
|
declare const DecimalField: React.FC<DecimalFieldProps>;
|
|
17
18
|
export default DecimalField;
|
|
@@ -17,6 +17,7 @@ export type DecimalFieldProps = {|
|
|
|
17
17
|
...$Exact<CommonFormFieldProps>,
|
|
18
18
|
|
|
19
19
|
onChangeValue?: (value: string, rawValue: string) => void,
|
|
20
|
+
prefix?: React.Node,
|
|
20
21
|
|};
|
|
21
22
|
declare var DecimalField: React.ComponentType<DecimalFieldProps>;
|
|
22
23
|
declare export default typeof DecimalField;
|