@pingux/astro 2.116.0 → 2.116.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Link/Link.stories.js +3 -1
- package/lib/cjs/components/Messages/utils/messagesReducer.d.ts +19 -24
- package/lib/cjs/components/Messages/utils/messagesReducer.js +19 -8
- package/lib/cjs/components/Messages/utils/multiMessagesReducer.d.ts +21 -23
- package/lib/cjs/components/Messages/utils/multiMessagesReducer.js +7 -4
- package/lib/cjs/components/Messages/utils/tests/messagesReducer.test.js +11 -0
- package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +82 -0
- package/lib/cjs/styles/themes/next-gen/variants/links.d.ts +82 -0
- package/lib/cjs/styles/themes/next-gen/variants/links.js +10 -1
- package/lib/cjs/types/messages.d.ts +1 -0
- package/lib/components/Link/Link.stories.js +3 -1
- package/lib/components/Messages/utils/messagesReducer.js +17 -7
- package/lib/components/Messages/utils/multiMessagesReducer.js +7 -4
- package/lib/components/Messages/utils/tests/messagesReducer.test.js +11 -0
- package/lib/styles/themes/next-gen/variants/links.js +10 -1
- package/package.json +1 -1
@@ -8,6 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
exports["default"] = exports.Default = void 0;
|
9
9
|
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectDestructuringEmpty"));
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
11
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
11
12
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
12
13
|
var _react = _interopRequireDefault(require("react"));
|
13
14
|
var _storybookAddonDesigns = require("storybook-addon-designs");
|
@@ -18,6 +19,7 @@ var _htmlElements = require("../../utils/devUtils/constants/htmlElements");
|
|
18
19
|
var _Link = _interopRequireDefault(require("./Link.mdx"));
|
19
20
|
var _Link2 = _interopRequireDefault(require("./Link.styles"));
|
20
21
|
var _react2 = require("@emotion/react");
|
22
|
+
var _context;
|
21
23
|
var _default = {
|
22
24
|
title: 'Components/Link',
|
23
25
|
component: _index.Link,
|
@@ -55,7 +57,7 @@ var _default = {
|
|
55
57
|
variant: {
|
56
58
|
control: {
|
57
59
|
type: 'select',
|
58
|
-
options: (0, _keys["default"])(_Link2["default"])
|
60
|
+
options: (0, _concat["default"])(_context = []).call(_context, (0, _keys["default"])(_Link2["default"]), ['button'])
|
59
61
|
}
|
60
62
|
}
|
61
63
|
},
|
@@ -15,32 +15,27 @@ export declare const messagesActions: {
|
|
15
15
|
MULTI_SHOW_CRITICAL_MESSAGE: string;
|
16
16
|
MULTI_SHOW_WARNING_MESSAGE: string;
|
17
17
|
};
|
18
|
-
|
19
|
-
isHidden?: boolean;
|
20
|
-
}
|
21
|
-
type MessageAction = {
|
22
|
-
message?: Message;
|
23
|
-
key?: Key;
|
24
|
-
};
|
25
|
-
export interface AddMessageAction extends MessageAction {
|
18
|
+
interface AddMessageAction {
|
26
19
|
type: typeof messagesActions.ADD_MESSAGE;
|
20
|
+
message: MessageItem;
|
27
21
|
}
|
28
|
-
|
22
|
+
interface HideMessageAction {
|
29
23
|
type: typeof messagesActions.HIDE_MESSAGE;
|
24
|
+
key: Key;
|
30
25
|
}
|
31
|
-
|
26
|
+
interface RemoveMessageAction {
|
32
27
|
type: typeof messagesActions.REMOVE_MESSAGE;
|
28
|
+
key: Key;
|
33
29
|
}
|
34
|
-
|
35
|
-
type
|
30
|
+
interface ClearMessagesAction {
|
31
|
+
type: typeof messagesActions.CLEAR_MESSAGES;
|
36
32
|
}
|
37
33
|
export type MessageActions = AddMessageAction | HideMessageAction | RemoveMessageAction | ClearMessagesAction;
|
38
|
-
export type MessagesState = Message[];
|
39
34
|
/**
|
40
35
|
* Create an action to add a message
|
41
36
|
* The message object to be added
|
42
37
|
*/
|
43
|
-
export declare const addMessage: (message:
|
38
|
+
export declare const addMessage: (message: MessageItem) => AddMessageAction;
|
44
39
|
/**
|
45
40
|
* Create an action to hide a message by key
|
46
41
|
*/
|
@@ -52,55 +47,55 @@ export declare const removeMessage: (key: Key) => RemoveMessageAction;
|
|
52
47
|
/**
|
53
48
|
* Create an action to add a message and then remove it if there's a timeout
|
54
49
|
*/
|
55
|
-
export declare const showMessage: (messageArg:
|
56
|
-
isHidden?: boolean | undefined;
|
50
|
+
export declare const showMessage: (messageArg: MessageItem, timeout?: number) => (dispatch: (action: MessageActions) => void) => {
|
57
51
|
text?: string | undefined;
|
58
52
|
node?: import("react").ReactNode;
|
59
53
|
key: Key;
|
60
54
|
props?: import("../../../types").MessageItemProps | undefined;
|
61
55
|
status?: Status | undefined;
|
56
|
+
isHidden?: boolean | undefined;
|
62
57
|
};
|
63
58
|
/** Create an action to clear all messages */
|
64
59
|
export declare const clearMessages: () => ClearMessagesAction;
|
65
60
|
/** Reducer to store a list of messages */
|
66
|
-
declare const messagesReducer: {
|
67
|
-
(state:
|
61
|
+
export declare const messagesReducer: {
|
62
|
+
(state: MessageItem[] | undefined, action: MessageActions): Array<MessageItem>;
|
68
63
|
actions: {
|
69
|
-
addMessage: (message:
|
64
|
+
addMessage: (message: MessageItem) => AddMessageAction;
|
70
65
|
hideMessage: (key: Key) => HideMessageAction;
|
71
66
|
removeMessage: (key: Key) => RemoveMessageAction;
|
72
|
-
showMessage: (messageArg:
|
73
|
-
isHidden?: boolean | undefined;
|
67
|
+
showMessage: (messageArg: MessageItem, timeout?: number) => (dispatch: (action: MessageActions) => void) => {
|
74
68
|
text?: string | undefined;
|
75
69
|
node?: import("react").ReactNode;
|
76
70
|
key: Key;
|
77
71
|
props?: import("../../../types").MessageItemProps | undefined;
|
78
72
|
status?: Status | undefined;
|
73
|
+
isHidden?: boolean | undefined;
|
79
74
|
};
|
80
75
|
clearMessages: () => ClearMessagesAction;
|
81
76
|
showSuccessMessage: (text: string) => (dispatch: (action: MessageActions) => void) => {
|
82
|
-
isHidden?: boolean | undefined;
|
83
77
|
text?: string | undefined;
|
84
78
|
node?: import("react").ReactNode;
|
85
79
|
key: Key;
|
86
80
|
props?: import("../../../types").MessageItemProps | undefined;
|
87
81
|
status?: Status | undefined;
|
82
|
+
isHidden?: boolean | undefined;
|
88
83
|
};
|
89
84
|
showErrorMessage: (text: string) => (dispatch: (action: MessageActions) => void) => {
|
90
|
-
isHidden?: boolean | undefined;
|
91
85
|
text?: string | undefined;
|
92
86
|
node?: import("react").ReactNode;
|
93
87
|
key: Key;
|
94
88
|
props?: import("../../../types").MessageItemProps | undefined;
|
95
89
|
status?: Status | undefined;
|
90
|
+
isHidden?: boolean | undefined;
|
96
91
|
};
|
97
92
|
showWarningMessage: (text: string) => (dispatch: (action: MessageActions) => void) => {
|
98
|
-
isHidden?: boolean | undefined;
|
99
93
|
text?: string | undefined;
|
100
94
|
node?: import("react").ReactNode;
|
101
95
|
key: Key;
|
102
96
|
props?: import("../../../types").MessageItemProps | undefined;
|
103
97
|
status?: Status | undefined;
|
98
|
+
isHidden?: boolean | undefined;
|
104
99
|
};
|
105
100
|
};
|
106
101
|
};
|
@@ -12,7 +12,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
12
12
|
_Object$defineProperty(exports, "__esModule", {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
exports.showMessage = exports.removeMessage = exports.messagesActions = exports.hideMessage = exports["default"] = exports.clearMessages = exports.addMessage = void 0;
|
15
|
+
exports.showMessage = exports.removeMessage = exports.messagesReducer = exports.messagesActions = exports.hideMessage = exports["default"] = exports.clearMessages = exports.addMessage = void 0;
|
16
16
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
17
17
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
18
18
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
@@ -114,14 +114,20 @@ var makeShowMessage = function makeShowMessage(status, timeout) {
|
|
114
114
|
};
|
115
115
|
|
116
116
|
/** Reducer to store a list of messages */
|
117
|
-
var messagesReducer = function messagesReducer(
|
118
|
-
var
|
117
|
+
var messagesReducer = function messagesReducer() {
|
118
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
119
|
+
var action = arguments.length > 1 ? arguments[1] : undefined;
|
119
120
|
switch (action.type) {
|
120
121
|
case messagesActions.ADD_MESSAGE:
|
121
|
-
|
122
|
+
{
|
123
|
+
var _context;
|
124
|
+
var _ref = action,
|
125
|
+
message = _ref.message;
|
126
|
+
return (0, _concat["default"])(_context = []).call(_context, state, [_objectSpread({}, message !== null && message !== void 0 ? message : {})]);
|
127
|
+
}
|
122
128
|
case messagesActions.HIDE_MESSAGE:
|
123
129
|
return (0, _map["default"])(state).call(state, function (search) {
|
124
|
-
if (search.key === action.key) {
|
130
|
+
if ('key' in action && search.key === action.key) {
|
125
131
|
return _objectSpread(_objectSpread({}, search), {}, {
|
126
132
|
isHidden: true
|
127
133
|
});
|
@@ -129,15 +135,20 @@ var messagesReducer = function messagesReducer(state, action) {
|
|
129
135
|
return search;
|
130
136
|
});
|
131
137
|
case messagesActions.REMOVE_MESSAGE:
|
132
|
-
|
133
|
-
|
134
|
-
|
138
|
+
{
|
139
|
+
var _ref2 = action,
|
140
|
+
key = _ref2.key;
|
141
|
+
return (0, _filter["default"])(state).call(state, function (search) {
|
142
|
+
return key !== search.key;
|
143
|
+
});
|
144
|
+
}
|
135
145
|
case messagesActions.CLEAR_MESSAGES:
|
136
146
|
return [];
|
137
147
|
default:
|
138
148
|
return state;
|
139
149
|
}
|
140
150
|
};
|
151
|
+
exports.messagesReducer = messagesReducer;
|
141
152
|
messagesReducer.actions = {
|
142
153
|
addMessage: addMessage,
|
143
154
|
hideMessage: hideMessage,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import {
|
2
|
+
import { MessageItem } from '../../../types';
|
3
|
+
import { MessageActions } from './messagesReducer';
|
3
4
|
export declare const withContainer: (container: any, action: any) => any;
|
4
5
|
export declare const createMultiple: (actionCreator: any) => (container: any, ...args: any[]) => any;
|
5
6
|
/**
|
@@ -21,62 +22,59 @@ export declare const clearMessages: (container: any, ...args: any[]) => any;
|
|
21
22
|
/**
|
22
23
|
* Create an action to add a message and then remove it if there's a timeout
|
23
24
|
*/
|
24
|
-
export declare const showMessage: (container: any, messageArg:
|
25
|
-
isHidden?: boolean | undefined;
|
25
|
+
export declare const showMessage: (container: any, messageArg: MessageItem, timeout?: number) => (dispatch: any) => {
|
26
26
|
text?: string | undefined;
|
27
27
|
node?: import("react").ReactNode;
|
28
28
|
key: import("react").Key;
|
29
|
-
props?: import("
|
30
|
-
status?: import("
|
29
|
+
props?: import("../../../types").MessageItemProps | undefined;
|
30
|
+
status?: import("../../../types").Status | undefined;
|
31
|
+
isHidden?: boolean | undefined;
|
31
32
|
};
|
32
33
|
export interface MultiMessagesReducerState {
|
33
34
|
container?: string;
|
34
35
|
}
|
35
36
|
export interface MultiMessagesReducerActions {
|
36
37
|
container?: string;
|
37
|
-
action
|
38
|
+
action?: MessageActions;
|
38
39
|
}
|
39
40
|
declare const multiMessagesReducer: {
|
40
|
-
(state: any,
|
41
|
-
[x: string]: any;
|
42
|
-
container: any;
|
43
|
-
}): any;
|
41
|
+
(state: any, action: any): any;
|
44
42
|
actions: {
|
45
43
|
removeMessage: (container: any, ...args: any[]) => any;
|
46
44
|
addMessage: (container: any, ...args: any[]) => any;
|
47
45
|
hideMessage: (container: any, ...args: any[]) => any;
|
48
46
|
clearMessages: (container: any, ...args: any[]) => any;
|
49
|
-
showMessage: (container: any, messageArg:
|
50
|
-
isHidden?: boolean | undefined;
|
47
|
+
showMessage: (container: any, messageArg: MessageItem, timeout?: number) => (dispatch: any) => {
|
51
48
|
text?: string | undefined;
|
52
49
|
node?: import("react").ReactNode;
|
53
50
|
key: import("react").Key;
|
54
|
-
props?: import("
|
55
|
-
status?: import("
|
51
|
+
props?: import("../../../types").MessageItemProps | undefined;
|
52
|
+
status?: import("../../../types").Status | undefined;
|
53
|
+
isHidden?: boolean | undefined;
|
56
54
|
};
|
57
55
|
showSuccessMessage: (container: any, text: any) => (dispatch: any) => {
|
58
|
-
isHidden?: boolean | undefined;
|
59
56
|
text?: string | undefined;
|
60
57
|
node?: import("react").ReactNode;
|
61
58
|
key: import("react").Key;
|
62
|
-
props?: import("
|
63
|
-
status?: import("
|
59
|
+
props?: import("../../../types").MessageItemProps | undefined;
|
60
|
+
status?: import("../../../types").Status | undefined;
|
61
|
+
isHidden?: boolean | undefined;
|
64
62
|
};
|
65
63
|
showCriticalMessage: (container: any, text: any) => (dispatch: any) => {
|
66
|
-
isHidden?: boolean | undefined;
|
67
64
|
text?: string | undefined;
|
68
65
|
node?: import("react").ReactNode;
|
69
66
|
key: import("react").Key;
|
70
|
-
props?: import("
|
71
|
-
status?: import("
|
67
|
+
props?: import("../../../types").MessageItemProps | undefined;
|
68
|
+
status?: import("../../../types").Status | undefined;
|
69
|
+
isHidden?: boolean | undefined;
|
72
70
|
};
|
73
71
|
showWarningMessage: (container: any, text: any) => (dispatch: any) => {
|
74
|
-
isHidden?: boolean | undefined;
|
75
72
|
text?: string | undefined;
|
76
73
|
node?: import("react").ReactNode;
|
77
74
|
key: import("react").Key;
|
78
|
-
props?: import("
|
79
|
-
status?: import("
|
75
|
+
props?: import("../../../types").MessageItemProps | undefined;
|
76
|
+
status?: import("../../../types").Status | undefined;
|
77
|
+
isHidden?: boolean | undefined;
|
80
78
|
};
|
81
79
|
};
|
82
80
|
};
|
@@ -92,10 +92,13 @@ var makeMultiShowMessage = function makeMultiShowMessage(status, timeout) {
|
|
92
92
|
}, timeout);
|
93
93
|
};
|
94
94
|
};
|
95
|
-
var multiMessagesReducer = function multiMessagesReducer(state,
|
96
|
-
var container =
|
97
|
-
|
98
|
-
|
95
|
+
var multiMessagesReducer = function multiMessagesReducer(state, action) {
|
96
|
+
var container = action.container,
|
97
|
+
rest = (0, _objectWithoutProperties2["default"])(action, _excluded);
|
98
|
+
if (container) {
|
99
|
+
return _objectSpread(_objectSpread({}, state), {}, (0, _defineProperty2["default"])({}, container, (0, _messagesReducer["default"])(state[container], rest)));
|
100
|
+
}
|
101
|
+
return state;
|
99
102
|
};
|
100
103
|
multiMessagesReducer.actions = {
|
101
104
|
removeMessage: removeMessage,
|
@@ -83,4 +83,15 @@ test('should show and hide a message', function () {
|
|
83
83
|
jest.runAllTimers();
|
84
84
|
});
|
85
85
|
expect((_screen$queryByTestId2 = _testWrapper.screen.queryByTestId(testId)) === null || _screen$queryByTestId2 === void 0 ? void 0 : _screen$queryByTestId2.children.length).toBe(0);
|
86
|
+
});
|
87
|
+
test('should initialize the reducer as an empty array', function () {
|
88
|
+
var state = (0, _messagesReducer["default"])(undefined, {});
|
89
|
+
expect(state.length).toBe(0);
|
90
|
+
});
|
91
|
+
test('should add message in empty state', function () {
|
92
|
+
var state = (0, _messagesReducer["default"])(undefined, (0, _messagesReducer.addMessage)({
|
93
|
+
key: 1,
|
94
|
+
text: 'quatro'
|
95
|
+
}));
|
96
|
+
expect(state.length).toBe(1);
|
86
97
|
});
|
@@ -1827,6 +1827,88 @@ declare const _default: {
|
|
1827
1827
|
color: string;
|
1828
1828
|
};
|
1829
1829
|
};
|
1830
|
+
button: {
|
1831
|
+
textDecoration: string;
|
1832
|
+
backgroundColor: string;
|
1833
|
+
borderColor: string;
|
1834
|
+
color: string;
|
1835
|
+
'&.is-pressed': {
|
1836
|
+
backgroundColor: string;
|
1837
|
+
borderColor: string;
|
1838
|
+
color: string;
|
1839
|
+
};
|
1840
|
+
'&.is-hovered': {
|
1841
|
+
backgroundColor: string;
|
1842
|
+
color: string;
|
1843
|
+
};
|
1844
|
+
alignItems: string;
|
1845
|
+
justifyContent: string;
|
1846
|
+
minWidth: string;
|
1847
|
+
cursor: string;
|
1848
|
+
display: string;
|
1849
|
+
maxWidth: string;
|
1850
|
+
fontFamily: string;
|
1851
|
+
fontSize: string;
|
1852
|
+
flexGrow: string;
|
1853
|
+
fontWeight: number;
|
1854
|
+
textAlign: string;
|
1855
|
+
verticalAlign: string;
|
1856
|
+
lineHeight: number;
|
1857
|
+
borderRadius: string;
|
1858
|
+
border: string;
|
1859
|
+
px: string;
|
1860
|
+
py: string;
|
1861
|
+
height: string;
|
1862
|
+
'&.is-disabled': {
|
1863
|
+
opacity: number;
|
1864
|
+
};
|
1865
|
+
'&.is-focused': {
|
1866
|
+
outline: string;
|
1867
|
+
outlineColor: string;
|
1868
|
+
outlineOffset: string;
|
1869
|
+
};
|
1870
|
+
transition: string;
|
1871
|
+
};
|
1872
|
+
primaryButton: {
|
1873
|
+
textDecoration: string;
|
1874
|
+
color: string;
|
1875
|
+
backgroundColor: string;
|
1876
|
+
borderColor: string;
|
1877
|
+
'&.is-pressed': {
|
1878
|
+
backgroundColor: string;
|
1879
|
+
borderColor: string;
|
1880
|
+
};
|
1881
|
+
'&.is-hovered': {
|
1882
|
+
backgroundColor: string;
|
1883
|
+
};
|
1884
|
+
alignItems: string;
|
1885
|
+
justifyContent: string;
|
1886
|
+
minWidth: string;
|
1887
|
+
cursor: string;
|
1888
|
+
display: string;
|
1889
|
+
maxWidth: string;
|
1890
|
+
fontFamily: string;
|
1891
|
+
fontSize: string;
|
1892
|
+
flexGrow: string;
|
1893
|
+
fontWeight: number;
|
1894
|
+
textAlign: string;
|
1895
|
+
verticalAlign: string;
|
1896
|
+
lineHeight: number;
|
1897
|
+
borderRadius: string;
|
1898
|
+
border: string;
|
1899
|
+
px: string;
|
1900
|
+
py: string;
|
1901
|
+
height: string;
|
1902
|
+
'&.is-disabled': {
|
1903
|
+
opacity: number;
|
1904
|
+
};
|
1905
|
+
'&.is-focused': {
|
1906
|
+
outline: string;
|
1907
|
+
outlineColor: string;
|
1908
|
+
outlineOffset: string;
|
1909
|
+
};
|
1910
|
+
transition: string;
|
1911
|
+
};
|
1830
1912
|
};
|
1831
1913
|
cards: {
|
1832
1914
|
interactive: {
|
@@ -147,5 +147,87 @@ declare const _default: {
|
|
147
147
|
color: string;
|
148
148
|
};
|
149
149
|
};
|
150
|
+
button: {
|
151
|
+
textDecoration: string;
|
152
|
+
backgroundColor: string;
|
153
|
+
borderColor: string;
|
154
|
+
color: string;
|
155
|
+
'&.is-pressed': {
|
156
|
+
backgroundColor: string;
|
157
|
+
borderColor: string;
|
158
|
+
color: string;
|
159
|
+
};
|
160
|
+
'&.is-hovered': {
|
161
|
+
backgroundColor: string;
|
162
|
+
color: string;
|
163
|
+
};
|
164
|
+
alignItems: string;
|
165
|
+
justifyContent: string;
|
166
|
+
minWidth: string;
|
167
|
+
cursor: string;
|
168
|
+
display: string;
|
169
|
+
maxWidth: string;
|
170
|
+
fontFamily: string;
|
171
|
+
fontSize: string;
|
172
|
+
flexGrow: string;
|
173
|
+
fontWeight: number;
|
174
|
+
textAlign: string;
|
175
|
+
verticalAlign: string;
|
176
|
+
lineHeight: number;
|
177
|
+
borderRadius: string;
|
178
|
+
border: string;
|
179
|
+
px: string;
|
180
|
+
py: string;
|
181
|
+
height: string;
|
182
|
+
'&.is-disabled': {
|
183
|
+
opacity: number;
|
184
|
+
};
|
185
|
+
'&.is-focused': {
|
186
|
+
outline: string;
|
187
|
+
outlineColor: string;
|
188
|
+
outlineOffset: string;
|
189
|
+
};
|
190
|
+
transition: string;
|
191
|
+
};
|
192
|
+
primaryButton: {
|
193
|
+
textDecoration: string;
|
194
|
+
color: string;
|
195
|
+
backgroundColor: string;
|
196
|
+
borderColor: string;
|
197
|
+
'&.is-pressed': {
|
198
|
+
backgroundColor: string;
|
199
|
+
borderColor: string;
|
200
|
+
};
|
201
|
+
'&.is-hovered': {
|
202
|
+
backgroundColor: string;
|
203
|
+
};
|
204
|
+
alignItems: string;
|
205
|
+
justifyContent: string;
|
206
|
+
minWidth: string;
|
207
|
+
cursor: string;
|
208
|
+
display: string;
|
209
|
+
maxWidth: string;
|
210
|
+
fontFamily: string;
|
211
|
+
fontSize: string;
|
212
|
+
flexGrow: string;
|
213
|
+
fontWeight: number;
|
214
|
+
textAlign: string;
|
215
|
+
verticalAlign: string;
|
216
|
+
lineHeight: number;
|
217
|
+
borderRadius: string;
|
218
|
+
border: string;
|
219
|
+
px: string;
|
220
|
+
py: string;
|
221
|
+
height: string;
|
222
|
+
'&.is-disabled': {
|
223
|
+
opacity: number;
|
224
|
+
};
|
225
|
+
'&.is-focused': {
|
226
|
+
outline: string;
|
227
|
+
outlineColor: string;
|
228
|
+
outlineOffset: string;
|
229
|
+
};
|
230
|
+
transition: string;
|
231
|
+
};
|
150
232
|
};
|
151
233
|
export default _default;
|
@@ -14,6 +14,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
14
14
|
});
|
15
15
|
exports["default"] = void 0;
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
17
|
+
var _button = _interopRequireDefault(require("./button"));
|
17
18
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
18
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
19
20
|
var nextGen = {
|
@@ -62,11 +63,19 @@ var footerLinks = _objectSpread({}, sideNav);
|
|
62
63
|
var footerHeader = _objectSpread(_objectSpread({}, footerLinks), {}, {
|
63
64
|
fontWeight: '2'
|
64
65
|
});
|
66
|
+
var button = _objectSpread(_objectSpread({}, _button["default"]["default"]), {}, {
|
67
|
+
textDecoration: 'none'
|
68
|
+
});
|
69
|
+
var primaryButton = _objectSpread(_objectSpread({}, _button["default"].primary), {}, {
|
70
|
+
textDecoration: 'none'
|
71
|
+
});
|
65
72
|
var _default = {
|
66
73
|
nextGen: nextGen,
|
67
74
|
onyx: onyx,
|
68
75
|
sideNav: sideNav,
|
69
76
|
footerLinks: footerLinks,
|
70
|
-
footerHeader: footerHeader
|
77
|
+
footerHeader: footerHeader,
|
78
|
+
button: button,
|
79
|
+
primaryButton: primaryButton
|
71
80
|
};
|
72
81
|
exports["default"] = _default;
|
@@ -17,6 +17,7 @@ export interface MessageItem {
|
|
17
17
|
key?: Key;
|
18
18
|
props?: MessageItemProps;
|
19
19
|
status?: Status;
|
20
|
+
isHidden?: boolean;
|
20
21
|
}
|
21
22
|
export interface CollectionOptions<T, C extends Collection<Node<T>>> extends Omit<CollectionStateBase<T, C>, 'children'> {
|
22
23
|
children?: ReactElement | ReactElement[] | ((item: T) => ReactElement);
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/esm/objectDestructuringEmpty";
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
|
+
var _context;
|
4
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
3
5
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
4
6
|
import React from 'react';
|
5
7
|
import { withDesign } from 'storybook-addon-designs';
|
@@ -47,7 +49,7 @@ export default {
|
|
47
49
|
variant: {
|
48
50
|
control: {
|
49
51
|
type: 'select',
|
50
|
-
options: _Object$keys(variants)
|
52
|
+
options: _concatInstanceProperty(_context = []).call(_context, _Object$keys(variants), ['button'])
|
51
53
|
}
|
52
54
|
}
|
53
55
|
},
|
@@ -101,14 +101,20 @@ var makeShowMessage = function makeShowMessage(status, timeout) {
|
|
101
101
|
};
|
102
102
|
|
103
103
|
/** Reducer to store a list of messages */
|
104
|
-
var messagesReducer = function messagesReducer(
|
105
|
-
var
|
104
|
+
export var messagesReducer = function messagesReducer() {
|
105
|
+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
106
|
+
var action = arguments.length > 1 ? arguments[1] : undefined;
|
106
107
|
switch (action.type) {
|
107
108
|
case messagesActions.ADD_MESSAGE:
|
108
|
-
|
109
|
+
{
|
110
|
+
var _context;
|
111
|
+
var _ref = action,
|
112
|
+
message = _ref.message;
|
113
|
+
return _concatInstanceProperty(_context = []).call(_context, state, [_objectSpread({}, message !== null && message !== void 0 ? message : {})]);
|
114
|
+
}
|
109
115
|
case messagesActions.HIDE_MESSAGE:
|
110
116
|
return _mapInstanceProperty(state).call(state, function (search) {
|
111
|
-
if (search.key === action.key) {
|
117
|
+
if ('key' in action && search.key === action.key) {
|
112
118
|
return _objectSpread(_objectSpread({}, search), {}, {
|
113
119
|
isHidden: true
|
114
120
|
});
|
@@ -116,9 +122,13 @@ var messagesReducer = function messagesReducer(state, action) {
|
|
116
122
|
return search;
|
117
123
|
});
|
118
124
|
case messagesActions.REMOVE_MESSAGE:
|
119
|
-
|
120
|
-
|
121
|
-
|
125
|
+
{
|
126
|
+
var _ref2 = action,
|
127
|
+
key = _ref2.key;
|
128
|
+
return _filterInstanceProperty(state).call(state, function (search) {
|
129
|
+
return key !== search.key;
|
130
|
+
});
|
131
|
+
}
|
122
132
|
case messagesActions.CLEAR_MESSAGES:
|
123
133
|
return [];
|
124
134
|
default:
|
@@ -78,10 +78,13 @@ var makeMultiShowMessage = function makeMultiShowMessage(status, timeout) {
|
|
78
78
|
}, timeout);
|
79
79
|
};
|
80
80
|
};
|
81
|
-
var multiMessagesReducer = function multiMessagesReducer(state,
|
82
|
-
var container =
|
83
|
-
|
84
|
-
|
81
|
+
var multiMessagesReducer = function multiMessagesReducer(state, action) {
|
82
|
+
var container = action.container,
|
83
|
+
rest = _objectWithoutProperties(action, _excluded);
|
84
|
+
if (container) {
|
85
|
+
return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, container, messagesReducer(state[container], rest)));
|
86
|
+
}
|
87
|
+
return state;
|
85
88
|
};
|
86
89
|
multiMessagesReducer.actions = {
|
87
90
|
removeMessage: removeMessage,
|
@@ -74,4 +74,15 @@ test('should show and hide a message', function () {
|
|
74
74
|
jest.runAllTimers();
|
75
75
|
});
|
76
76
|
expect((_screen$queryByTestId2 = screen.queryByTestId(testId)) === null || _screen$queryByTestId2 === void 0 ? void 0 : _screen$queryByTestId2.children.length).toBe(0);
|
77
|
+
});
|
78
|
+
test('should initialize the reducer as an empty array', function () {
|
79
|
+
var state = messagesReducer(undefined, {});
|
80
|
+
expect(state.length).toBe(0);
|
81
|
+
});
|
82
|
+
test('should add message in empty state', function () {
|
83
|
+
var state = messagesReducer(undefined, addMessage({
|
84
|
+
key: 1,
|
85
|
+
text: 'quatro'
|
86
|
+
}));
|
87
|
+
expect(state.length).toBe(1);
|
77
88
|
});
|
@@ -9,6 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
9
9
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
10
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
12
|
+
import buttons from './button';
|
12
13
|
var nextGen = {
|
13
14
|
color: 'gray-800',
|
14
15
|
fontSize: 'md',
|
@@ -55,10 +56,18 @@ var footerLinks = _objectSpread({}, sideNav);
|
|
55
56
|
var footerHeader = _objectSpread(_objectSpread({}, footerLinks), {}, {
|
56
57
|
fontWeight: '2'
|
57
58
|
});
|
59
|
+
var button = _objectSpread(_objectSpread({}, buttons["default"]), {}, {
|
60
|
+
textDecoration: 'none'
|
61
|
+
});
|
62
|
+
var primaryButton = _objectSpread(_objectSpread({}, buttons.primary), {}, {
|
63
|
+
textDecoration: 'none'
|
64
|
+
});
|
58
65
|
export default {
|
59
66
|
nextGen: nextGen,
|
60
67
|
onyx: onyx,
|
61
68
|
sideNav: sideNav,
|
62
69
|
footerLinks: footerLinks,
|
63
|
-
footerHeader: footerHeader
|
70
|
+
footerHeader: footerHeader,
|
71
|
+
button: button,
|
72
|
+
primaryButton: primaryButton
|
64
73
|
};
|