quicksnack 3.34.3 → 3.35.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/package.json +6 -1
- package/dist/UiProvider.d.ts +0 -8
- package/dist/UiStateProvider.d.ts +0 -9
- package/dist/UiWrapper.d.ts +0 -7
- package/dist/animation/SlideInFromTop/SlideInFromTop.d.ts +0 -4
- package/dist/animation/SlideOpen/SlideOpen.d.ts +0 -9
- package/dist/bundle.js +0 -2199
- package/dist/bundle.min.js +0 -910
- package/dist/components/Alert/Alert.d.ts +0 -8
- package/dist/components/AnimatedCheckmark/AnimatedCheckmark.d.ts +0 -2
- package/dist/components/Box/Box.d.ts +0 -23
- package/dist/components/BreadCrumbs/BreadCrumbs.d.ts +0 -522
- package/dist/components/CollapsiblePanel/CollapsiblePanel.d.ts +0 -7
- package/dist/components/ConfirmButton/ConfirmButton.d.ts +0 -8
- package/dist/components/ConfirmModal/ConfirmModal.d.ts +0 -15
- package/dist/components/ConfirmModal/hooks/useConfirmModal.d.ts +0 -11
- package/dist/components/Details/Details.d.ts +0 -7
- package/dist/components/Dropdown/Dropdown.d.ts +0 -530
- package/dist/components/Dropzone/Dropzone.d.ts +0 -8
- package/dist/components/Feedback/Feedback.d.ts +0 -10
- package/dist/components/Floater/Floater.d.ts +0 -14
- package/dist/components/Floater/FloaterItem.d.ts +0 -8
- package/dist/components/Footer/Footer.d.ts +0 -2
- package/dist/components/HorizontalScroller/HorizontalScroller.d.ts +0 -2
- package/dist/components/Menu/HamburgerButton.d.ts +0 -276
- package/dist/components/Menu/Menu.d.ts +0 -268
- package/dist/components/Menu/MenuCloseButton.d.ts +0 -276
- package/dist/components/Menu/MenuSlideOpenIndicator.d.ts +0 -2
- package/dist/components/Menu/SideBar.d.ts +0 -271
- package/dist/components/Menu/SideBarHeader.d.ts +0 -6
- package/dist/components/Menu/useCloseSidebarOnNavigate.d.ts +0 -1
- package/dist/components/Menu/useToggleMobileMenu.d.ts +0 -10
- package/dist/components/Modal/Modal.d.ts +0 -8
- package/dist/components/Overlay/Overlay.d.ts +0 -261
- package/dist/components/Paginator/Paginator.d.ts +0 -8
- package/dist/components/Panel/Panel.d.ts +0 -13
- package/dist/components/Section/Section.d.ts +0 -3
- package/dist/components/Statistic/Statistic.d.ts +0 -11
- package/dist/components/Table/Table.d.ts +0 -27
- package/dist/components/Tabs/Tab.d.ts +0 -12
- package/dist/components/Tabs/TabContent.d.ts +0 -3
- package/dist/components/Tabs/Tabs.d.ts +0 -279
- package/dist/components/Timeline/Timeline.d.ts +0 -18
- package/dist/components/TopBar/TopBar.d.ts +0 -7
- package/dist/fonts.d.ts +0 -1
- package/dist/form/Button/Button.d.ts +0 -13
- package/dist/form/Checkbox/Checkbox.d.ts +0 -8
- package/dist/form/FileField/FileField.d.ts +0 -8
- package/dist/form/PasswordStrengthField/PasswordStrenghField.d.ts +0 -9
- package/dist/form/ScaffoldForm/FormGrid/FormGrid.d.ts +0 -7
- package/dist/form/ScaffoldForm/FormGrid/FormGridCell.d.ts +0 -14
- package/dist/form/ScaffoldForm/FormGrid/FormGridWrapper.d.ts +0 -10
- package/dist/form/ScaffoldForm/ScaffoldField.d.ts +0 -9
- package/dist/form/ScaffoldForm/ScaffoldForm.d.ts +0 -10
- package/dist/form/ScaffoldForm/ScaffoldFormProvider.d.ts +0 -7
- package/dist/form/ScaffoldForm/hooks/useScaffoldFormContext.d.ts +0 -1
- package/dist/form/ScaffoldForm/scaffoldFormProps.d.ts +0 -80
- package/dist/form/ScaffoldForm/scaffoldPasswordProps.d.ts +0 -19
- package/dist/form/ScaffoldForm/types.d.ts +0 -34
- package/dist/form/ScaffoldForm/utils/FormPositioner.d.ts +0 -36
- package/dist/form/ScaffoldForm/utils/Grid.d.ts +0 -38
- package/dist/form/ScaffoldForm/utils/Grid.test.d.ts +0 -1
- package/dist/form/ScaffoldForm/utils/assertGridIsValid.d.ts +0 -6
- package/dist/form/ScaffoldForm/utils/assertGridIsValid.test.d.ts +0 -1
- package/dist/form/ScaffoldForm/utils/equalColumns.d.ts +0 -1
- package/dist/form/Select/Select.d.ts +0 -6
- package/dist/form/TextField/TextField.d.ts +0 -9
- package/dist/index.d.ts +0 -57
- package/dist/layouts/BasicLayout/BasicLayout.d.ts +0 -13
- package/dist/layouts/FloatingPanelLayout/FloatingPanelLayout.d.ts +0 -12
- package/dist/layouts/constants.d.ts +0 -2
- package/dist/responsiveness/responsiveProps.d.ts +0 -17
- package/dist/responsiveness/useResponsiveBreakpoints.d.ts +0 -6
- package/dist/theme.d.ts +0 -2
- package/dist/typography/Fonts.d.ts +0 -2
- package/dist/typography/Header/Header.d.ts +0 -6
- package/dist/typography/Paragraph/Paragraph.d.ts +0 -261
package/dist/bundle.js
DELETED
|
@@ -1,2199 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var styledComponents = require('styled-components');
|
|
5
|
-
var polished = require('polished');
|
|
6
|
-
var isPropValid = require('@emotion/is-prop-valid');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var immer = require('immer');
|
|
9
|
-
var _chunk = require('lodash.chunk');
|
|
10
|
-
var _difference = require('lodash.difference');
|
|
11
|
-
|
|
12
|
-
/*! *****************************************************************************
|
|
13
|
-
Copyright (c) Microsoft Corporation.
|
|
14
|
-
|
|
15
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
16
|
-
purpose with or without fee is hereby granted.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
19
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
20
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
21
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
22
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
24
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
25
|
-
***************************************************************************** */
|
|
26
|
-
/* global Reflect, Promise */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function __rest(s, e) {
|
|
30
|
-
var t = {};
|
|
31
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
32
|
-
t[p] = s[p];
|
|
33
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
34
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
35
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
36
|
-
t[p[i]] = s[p[i]];
|
|
37
|
-
}
|
|
38
|
-
return t;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const SPACING = 4;
|
|
42
|
-
const BLACK = 'rgba(0,0,0,.87)';
|
|
43
|
-
const WHITE = '#fff';
|
|
44
|
-
const darkenPalette = (amount, palette, colorsToDarken) => Object
|
|
45
|
-
.entries(palette)
|
|
46
|
-
.reduce((acc, [key, val]) => (Object.assign(Object.assign({}, acc), { [key]: colorsToDarken.includes(key)
|
|
47
|
-
? polished.shade(amount, val)
|
|
48
|
-
: val })), palette);
|
|
49
|
-
const createButtonPalette = (_a) => {
|
|
50
|
-
var { colorsToDarken } = _a, palette = __rest(_a, ["colorsToDarken"]);
|
|
51
|
-
return ({
|
|
52
|
-
idle: palette,
|
|
53
|
-
hover: darkenPalette(.1, palette, colorsToDarken),
|
|
54
|
-
active: darkenPalette(.2, palette, colorsToDarken),
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
const createPanePalette = (palette) => ({
|
|
58
|
-
main: {
|
|
59
|
-
idle: palette,
|
|
60
|
-
hover: darkenPalette(.05, palette, ['background'])
|
|
61
|
-
},
|
|
62
|
-
alternate: {
|
|
63
|
-
idle: darkenPalette(.02, palette, ['background']),
|
|
64
|
-
hover: darkenPalette(.05, palette, ['background']),
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const theme = {
|
|
68
|
-
spacing: (...args) => args.map(arg => `${arg * SPACING}px`).join(' '),
|
|
69
|
-
palette: {
|
|
70
|
-
common: {
|
|
71
|
-
black: BLACK,
|
|
72
|
-
white: WHITE,
|
|
73
|
-
},
|
|
74
|
-
colors: {
|
|
75
|
-
blue: '#007bff',
|
|
76
|
-
indigo: '#6610f2',
|
|
77
|
-
purple: '#6f42c1',
|
|
78
|
-
pink: '#e83e8c',
|
|
79
|
-
red: '#e83e3e',
|
|
80
|
-
orange: '#fd7e14',
|
|
81
|
-
yellow: '#ffc107',
|
|
82
|
-
green: '#23B294',
|
|
83
|
-
teal: '#20c997',
|
|
84
|
-
cyan: '#17a2b8',
|
|
85
|
-
gray: '#6c757d',
|
|
86
|
-
grayDark: '#343a40',
|
|
87
|
-
light: '#f8f9fa',
|
|
88
|
-
dark: '#343a40',
|
|
89
|
-
},
|
|
90
|
-
form: {
|
|
91
|
-
hint: '#C7C7C7',
|
|
92
|
-
error: '#9f3a38',
|
|
93
|
-
},
|
|
94
|
-
button: {
|
|
95
|
-
basic: createButtonPalette({
|
|
96
|
-
colorsToDarken: ['background', 'text'],
|
|
97
|
-
background: WHITE,
|
|
98
|
-
text: BLACK,
|
|
99
|
-
}),
|
|
100
|
-
default: createButtonPalette({
|
|
101
|
-
colorsToDarken: ['background', 'text'],
|
|
102
|
-
background: '#e0e1e2',
|
|
103
|
-
text: BLACK,
|
|
104
|
-
}),
|
|
105
|
-
text: {
|
|
106
|
-
idle: {
|
|
107
|
-
text: '#999c9e',
|
|
108
|
-
background: 'transparent'
|
|
109
|
-
},
|
|
110
|
-
active: {
|
|
111
|
-
text: BLACK,
|
|
112
|
-
background: 'transparent'
|
|
113
|
-
},
|
|
114
|
-
hover: {
|
|
115
|
-
text: BLACK,
|
|
116
|
-
background: 'transparent'
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
danger: createButtonPalette({
|
|
120
|
-
colorsToDarken: ['background'],
|
|
121
|
-
background: '#EC5969',
|
|
122
|
-
text: WHITE,
|
|
123
|
-
}),
|
|
124
|
-
primary: createButtonPalette({
|
|
125
|
-
colorsToDarken: ['background'],
|
|
126
|
-
background: '#2284C4',
|
|
127
|
-
text: WHITE,
|
|
128
|
-
}),
|
|
129
|
-
secondary: createButtonPalette({
|
|
130
|
-
colorsToDarken: ['background'],
|
|
131
|
-
background: '#23B294',
|
|
132
|
-
text: WHITE
|
|
133
|
-
}),
|
|
134
|
-
},
|
|
135
|
-
pane: {
|
|
136
|
-
basic: createPanePalette({
|
|
137
|
-
text: BLACK,
|
|
138
|
-
background: WHITE,
|
|
139
|
-
border: '#ddd'
|
|
140
|
-
}),
|
|
141
|
-
emphasized: createPanePalette({
|
|
142
|
-
text: BLACK,
|
|
143
|
-
background: '#f3f3f3',
|
|
144
|
-
border: '#ddd'
|
|
145
|
-
}),
|
|
146
|
-
info: createPanePalette({
|
|
147
|
-
text: '#0c5460',
|
|
148
|
-
background: '#d1ecf1',
|
|
149
|
-
border: '#bee5eb'
|
|
150
|
-
}),
|
|
151
|
-
negative: createPanePalette({
|
|
152
|
-
text: '#721c24',
|
|
153
|
-
background: '#f8d7da',
|
|
154
|
-
border: '#f5c6cb'
|
|
155
|
-
}),
|
|
156
|
-
positive: createPanePalette({
|
|
157
|
-
text: '#155724',
|
|
158
|
-
background: '#d4edda',
|
|
159
|
-
border: '#c3e6cb',
|
|
160
|
-
}),
|
|
161
|
-
warning: createPanePalette({
|
|
162
|
-
text: '#856404',
|
|
163
|
-
background: '#fff3cd',
|
|
164
|
-
border: '#ffeeba'
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
// Fix for styled-components with react-18.
|
|
171
|
-
// Can be removed once this issue is resolved.
|
|
172
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/59765#issuecomment-1092938253
|
|
173
|
-
const ThemeProviderFixed = styledComponents.ThemeProvider;
|
|
174
|
-
const UiProvider = ({ children, theme: themeOverride }) => (React.createElement(ThemeProviderFixed, { theme: themeOverride || theme }, children));
|
|
175
|
-
|
|
176
|
-
const noop$1 = () => { };
|
|
177
|
-
const UiState = React.createContext({
|
|
178
|
-
isSideMenuOpen: false,
|
|
179
|
-
closeSideMenu: noop$1,
|
|
180
|
-
openSideMenu: noop$1,
|
|
181
|
-
});
|
|
182
|
-
const useUiStateContext = () => React.useContext(UiState);
|
|
183
|
-
const UiStateProvider = ({ children }) => {
|
|
184
|
-
const [isSideMenuOpen, setIsSideMenuOpen] = React.useState(false);
|
|
185
|
-
const handleCloseSideMenu = React.useCallback(() => setIsSideMenuOpen(false), []);
|
|
186
|
-
const handleOpenSideMenu = React.useCallback(() => setIsSideMenuOpen(true), []);
|
|
187
|
-
return (React.createElement(UiState.Provider, { value: {
|
|
188
|
-
isSideMenuOpen,
|
|
189
|
-
closeSideMenu: handleCloseSideMenu,
|
|
190
|
-
openSideMenu: handleOpenSideMenu,
|
|
191
|
-
} }, children));
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
const Wrapper$d = styledComponents.styled.div `
|
|
195
|
-
display: flex;
|
|
196
|
-
flex-direction: column;
|
|
197
|
-
height: 100%;
|
|
198
|
-
font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
199
|
-
color: ${props => props.theme.palette.common.black};
|
|
200
|
-
font-size: 14px;
|
|
201
|
-
`;
|
|
202
|
-
const UiWrapper = ({ theme, children }) => (React.createElement(UiProvider, { theme: theme },
|
|
203
|
-
React.createElement(UiStateProvider, null,
|
|
204
|
-
React.createElement(Wrapper$d, null, children))));
|
|
205
|
-
|
|
206
|
-
const slideInFromTop = styledComponents.keyframes `
|
|
207
|
-
0% {
|
|
208
|
-
opacity: 0;
|
|
209
|
-
transform: translateY(-5px);
|
|
210
|
-
}
|
|
211
|
-
100% {
|
|
212
|
-
opacity: 1;
|
|
213
|
-
transform: translateY(0);
|
|
214
|
-
}
|
|
215
|
-
`;
|
|
216
|
-
const SlideInFromTop = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
217
|
-
animation: ${slideInFromTop} ${props => props.speed || '.3s'} ease-in 0s 1;
|
|
218
|
-
`;
|
|
219
|
-
|
|
220
|
-
const sharedStyles$1 = styledComponents.css `
|
|
221
|
-
margin: 0 0;
|
|
222
|
-
padding: 0 0;
|
|
223
|
-
font-weight: 700;
|
|
224
|
-
line-height: 1.28571429em;
|
|
225
|
-
`;
|
|
226
|
-
const H1 = styledComponents.styled.h1.withConfig({ shouldForwardProp: isPropValid }) `
|
|
227
|
-
font-size: 2rem;
|
|
228
|
-
min-height: 1rem;
|
|
229
|
-
${sharedStyles$1}
|
|
230
|
-
`;
|
|
231
|
-
const H2 = styledComponents.styled.h2.withConfig({ shouldForwardProp: isPropValid }) `
|
|
232
|
-
font-size: 1.71428571rem;
|
|
233
|
-
${sharedStyles$1}
|
|
234
|
-
`;
|
|
235
|
-
const H3 = styledComponents.styled.h3.withConfig({ shouldForwardProp: isPropValid }) `
|
|
236
|
-
font-size: 1.28571429rem;
|
|
237
|
-
${sharedStyles$1}
|
|
238
|
-
`;
|
|
239
|
-
const H4 = styledComponents.styled.h4.withConfig({ shouldForwardProp: isPropValid }) `
|
|
240
|
-
font-size: 1.07142857rem;
|
|
241
|
-
${sharedStyles$1}
|
|
242
|
-
`;
|
|
243
|
-
const H5 = styledComponents.styled.h5.withConfig({ shouldForwardProp: isPropValid }) `
|
|
244
|
-
font-size: 1rem;
|
|
245
|
-
${sharedStyles$1}
|
|
246
|
-
`;
|
|
247
|
-
const mapping = {
|
|
248
|
-
1: H1,
|
|
249
|
-
2: H2,
|
|
250
|
-
3: H3,
|
|
251
|
-
4: H4,
|
|
252
|
-
5: H5,
|
|
253
|
-
};
|
|
254
|
-
const Header = (_a) => {
|
|
255
|
-
var { level = 1 } = _a, restProps = __rest(_a, ["level"]);
|
|
256
|
-
const Component = mapping[level];
|
|
257
|
-
// @ts-ignore
|
|
258
|
-
return React.createElement(Component, Object.assign({}, restProps));
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const Paragraph = styledComponents.styled.p `
|
|
262
|
-
font-size: 14px;
|
|
263
|
-
line-height: 20px;
|
|
264
|
-
// margin: 0 0 1em;
|
|
265
|
-
margin: 0;
|
|
266
|
-
`;
|
|
267
|
-
|
|
268
|
-
const breakPoints = [
|
|
269
|
-
"mobile",
|
|
270
|
-
"tablet",
|
|
271
|
-
"laptop",
|
|
272
|
-
"desktop",
|
|
273
|
-
];
|
|
274
|
-
const BreakPointValues = {
|
|
275
|
-
mobile: 0,
|
|
276
|
-
tablet: 768,
|
|
277
|
-
laptop: 1024,
|
|
278
|
-
desktop: 1430,
|
|
279
|
-
};
|
|
280
|
-
/**
|
|
281
|
-
* Wraps given cssRules in the corresponding media-query:
|
|
282
|
-
*/
|
|
283
|
-
const mq = (bk, cssRules) => styledComponents.css `
|
|
284
|
-
@media screen and (min-width: ${BreakPointValues[bk]}px) {
|
|
285
|
-
${cssRules}
|
|
286
|
-
}
|
|
287
|
-
`;
|
|
288
|
-
const isResponsiveObject = (obj) => {
|
|
289
|
-
if (typeof obj !== "object") {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
const keys = Object.keys(obj);
|
|
293
|
-
for (const breakPoint of breakPoints) {
|
|
294
|
-
if (keys.includes(breakPoint)) {
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
return false;
|
|
299
|
-
};
|
|
300
|
-
/**
|
|
301
|
-
* Wraps 'responsive-props' in media-queries if necessary.
|
|
302
|
-
*/
|
|
303
|
-
const responsiveProps = (props, map) => {
|
|
304
|
-
const nonResponsiveRules = Object
|
|
305
|
-
.entries(map)
|
|
306
|
-
.filter(([key]) => props[key] !== undefined && !isResponsiveObject(props[key]))
|
|
307
|
-
.map(([key, fun]) => fun(props[key]));
|
|
308
|
-
const mediaQueries = breakPoints
|
|
309
|
-
.map(bp => {
|
|
310
|
-
// See if we can make css-rules for this breakpoint:
|
|
311
|
-
const responsiveCssRules = Object
|
|
312
|
-
.entries(map)
|
|
313
|
-
.filter(([key]) => { var _a; return ((_a = props === null || props === void 0 ? void 0 : props[key]) === null || _a === void 0 ? void 0 : _a[bp]) !== undefined; })
|
|
314
|
-
.map(([key, fun]) => fun(props[key][bp]));
|
|
315
|
-
return (responsiveCssRules.length > 0)
|
|
316
|
-
? mq(bp, responsiveCssRules) // Wrap css-rules in a mediaQuery
|
|
317
|
-
: undefined; // Undefined -> filter out later
|
|
318
|
-
})
|
|
319
|
-
.filter(_ => _ !== undefined);
|
|
320
|
-
return [
|
|
321
|
-
mediaQueries, ...nonResponsiveRules
|
|
322
|
-
];
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
const Box = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
326
|
-
box-sizing: border-box;
|
|
327
|
-
|
|
328
|
-
${(props) => responsiveProps(props, {
|
|
329
|
-
"p": unit => styledComponents.css `padding: ${props.theme.spacing(unit)};`,
|
|
330
|
-
"pt": unit => styledComponents.css `padding-top: ${props.theme.spacing(unit)};`,
|
|
331
|
-
"pr": unit => styledComponents.css `padding-right: ${props.theme.spacing(unit)};`,
|
|
332
|
-
"pb": unit => styledComponents.css `padding-bottom: ${props.theme.spacing(unit)};`,
|
|
333
|
-
"pl": unit => styledComponents.css `padding-left: ${props.theme.spacing(unit)};`,
|
|
334
|
-
"m": unit => styledComponents.css `margin: ${props.theme.spacing(unit)};`,
|
|
335
|
-
"mt": unit => styledComponents.css `margin-top: ${props.theme.spacing(unit)};`,
|
|
336
|
-
"mr": unit => styledComponents.css `margin-right: ${props.theme.spacing(unit)};`,
|
|
337
|
-
"mb": unit => styledComponents.css `margin-bottom: ${props.theme.spacing(unit)};`,
|
|
338
|
-
"ml": unit => styledComponents.css `margin-left: ${props.theme.spacing(unit)};`,
|
|
339
|
-
"display": unit => styledComponents.css `display: ${unit};`,
|
|
340
|
-
"flexGrow": unit => styledComponents.css `flex-grow: ${unit};`,
|
|
341
|
-
"flexShrink": unit => styledComponents.css `flex-shrink: ${unit};`,
|
|
342
|
-
"flexDirection": unit => styledComponents.css `flex-direction: ${unit};`,
|
|
343
|
-
"alignItems": unit => styledComponents.css `align-items: ${unit};`,
|
|
344
|
-
"textAlign": unit => styledComponents.css `text-align: ${unit};`,
|
|
345
|
-
"justifyContent": unit => styledComponents.css `justify-content: ${unit};`,
|
|
346
|
-
"width": unit => styledComponents.css `width: ${typeof unit === 'number' ? props.theme.spacing(unit) : unit};`,
|
|
347
|
-
})}
|
|
348
|
-
`;
|
|
349
|
-
|
|
350
|
-
const Wrapper$c = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
351
|
-
border-radius: 4px;
|
|
352
|
-
border: 1px solid ${props => props.theme.palette.pane[props.variant].main.idle.border};
|
|
353
|
-
background-color: ${props => props.theme.palette.pane[props.variant].main.idle.background};
|
|
354
|
-
color: ${props => props.theme.palette.pane[props.variant].main.idle.text};
|
|
355
|
-
`;
|
|
356
|
-
const Alert = ({ children, title, variant = "basic" }) => (React.createElement(Wrapper$c, { variant: variant },
|
|
357
|
-
React.createElement(Box, { p: 3 },
|
|
358
|
-
title && (React.createElement(Box, { pb: children ? 1 : 0 },
|
|
359
|
-
React.createElement(Header, { level: 4 }, title))),
|
|
360
|
-
children && React.createElement(Paragraph, null, children))));
|
|
361
|
-
|
|
362
|
-
const green = '#20c997';
|
|
363
|
-
const Mask = styledComponents.styled.g `
|
|
364
|
-
fill: none;
|
|
365
|
-
stroke: ${green};
|
|
366
|
-
stroke-width: 10;
|
|
367
|
-
`;
|
|
368
|
-
const polyLineAnimation = styledComponents.keyframes `
|
|
369
|
-
0% {
|
|
370
|
-
stroke-dashoffset: 100px
|
|
371
|
-
}
|
|
372
|
-
100% {
|
|
373
|
-
stroke-dashoffset: 0px
|
|
374
|
-
}
|
|
375
|
-
`;
|
|
376
|
-
const Polyline = styledComponents.styled.polyline `
|
|
377
|
-
stroke-dasharray: 100px, 100px;
|
|
378
|
-
stroke-dashoffset: 200px;
|
|
379
|
-
animation: ${polyLineAnimation} 0.42s ease-in-out 0.8s backwards;
|
|
380
|
-
stroke: ${green};
|
|
381
|
-
stroke-width: 10;
|
|
382
|
-
`;
|
|
383
|
-
const circleAnimation = styledComponents.keyframes `
|
|
384
|
-
0% {
|
|
385
|
-
stroke-dashoffset: 480px
|
|
386
|
-
}
|
|
387
|
-
100% {
|
|
388
|
-
stroke-dashoffset: 960px
|
|
389
|
-
}
|
|
390
|
-
`;
|
|
391
|
-
const Circle$1 = styledComponents.styled.circle `
|
|
392
|
-
stroke-dasharray: 480px, 480px;
|
|
393
|
-
stroke-dashoffset: 960px;
|
|
394
|
-
animation: ${circleAnimation} 0.6s ease-in-out backwards;
|
|
395
|
-
stroke: ${green};
|
|
396
|
-
stroke-width: 10;
|
|
397
|
-
`;
|
|
398
|
-
const circleColoredAnimation = styledComponents.keyframes `
|
|
399
|
-
0% {
|
|
400
|
-
opacity:0;
|
|
401
|
-
}
|
|
402
|
-
100% {
|
|
403
|
-
opacity:100;
|
|
404
|
-
}
|
|
405
|
-
`;
|
|
406
|
-
const CircleColored = styledComponents.styled.circle `
|
|
407
|
-
stroke-dasharray: 480px, 480px;
|
|
408
|
-
stroke-dashoffset: 960px;
|
|
409
|
-
animation: ${circleColoredAnimation} 1.2s ease-in-out 1.4s backwards;
|
|
410
|
-
fill: #effaf8;
|
|
411
|
-
`;
|
|
412
|
-
const AnimatedCheckmark = () => (React.createElement("svg", { viewBox: "0 0 154 154" },
|
|
413
|
-
React.createElement(Mask, null,
|
|
414
|
-
React.createElement(Circle$1, { cx: '77', cy: '77', r: '72' }),
|
|
415
|
-
React.createElement(CircleColored, { cx: '77', cy: '77', r: '72' }),
|
|
416
|
-
React.createElement(Polyline, { points: "43.5,77.8 63.7,97.9 112.2,49.4" }))));
|
|
417
|
-
|
|
418
|
-
const BreadCrumbs = styledComponents.styled.ul `
|
|
419
|
-
list-style: none;
|
|
420
|
-
padding: 0;
|
|
421
|
-
margin: 0;
|
|
422
|
-
display:flex;
|
|
423
|
-
`;
|
|
424
|
-
const Crumb = styledComponents.styled.li `
|
|
425
|
-
display: flex;
|
|
426
|
-
|
|
427
|
-
&:not(:last-of-type):after {
|
|
428
|
-
content: "/";
|
|
429
|
-
color: ${props => props.theme.palette.colors.gray};
|
|
430
|
-
line-height: 1em;
|
|
431
|
-
content: "/";
|
|
432
|
-
margin: auto auto;
|
|
433
|
-
padding: ${props => props.theme.spacing(0, 2, 0, 0)};
|
|
434
|
-
}
|
|
435
|
-
`;
|
|
436
|
-
|
|
437
|
-
const Wrapper$b = styledComponents.styled.div `
|
|
438
|
-
background-color: ${props => props.theme.palette.common.white};
|
|
439
|
-
border-radius: 4px;
|
|
440
|
-
border: 1px solid #DEDEDF;
|
|
441
|
-
box-shadow: 0px 2px 3px rgb(0 0 0 / 6%);
|
|
442
|
-
`;
|
|
443
|
-
const Meta = styledComponents.styled(Box) `
|
|
444
|
-
font-size: 12px;
|
|
445
|
-
font-style: italic;
|
|
446
|
-
`;
|
|
447
|
-
const Title = styledComponents.styled(Box) `
|
|
448
|
-
${(props) => props.panelHasChildren && styledComponents.css `
|
|
449
|
-
border-radius: 4px;
|
|
450
|
-
border-bottom: 1px solid rgba(34,36,38,.15);
|
|
451
|
-
`}
|
|
452
|
-
|
|
453
|
-
${(props) => !!props.onClick && styledComponents.css `
|
|
454
|
-
cursor: pointer;
|
|
455
|
-
user-select: none;
|
|
456
|
-
`}
|
|
457
|
-
`;
|
|
458
|
-
const Footer$1 = styledComponents.styled(Box) `
|
|
459
|
-
border-radius: 4px;
|
|
460
|
-
background-color: #FFF;
|
|
461
|
-
border-top: 1px solid rgba(34,36,38,.15);
|
|
462
|
-
`;
|
|
463
|
-
const Panel = ({ children, className, title, titleAction, titleMeta, onClickTitle, footer, p = 3, titleLevel = 5 }) => (React.createElement(Wrapper$b, { className: className },
|
|
464
|
-
title && (React.createElement(Title, { p: 3, panelHasChildren: !!children, display: "flex", alignItems: "center", onClick: onClickTitle },
|
|
465
|
-
React.createElement(Box, { flexGrow: 1 },
|
|
466
|
-
React.createElement(Header, { level: titleLevel }, title)),
|
|
467
|
-
titleMeta && React.createElement(Meta, null, titleMeta),
|
|
468
|
-
titleAction && React.createElement(Box, { pl: 5 }, titleAction))),
|
|
469
|
-
children && (React.createElement(Box, { p: p }, children)),
|
|
470
|
-
footer && (React.createElement(Footer$1, { p: 3 }, footer))));
|
|
471
|
-
|
|
472
|
-
const Animation = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
473
|
-
transform: ${props => props.isOpen ? `translate(0)` : `translateY(-101%)`};
|
|
474
|
-
transition-duration: ${props => props.duration || 0.25}s;
|
|
475
|
-
transition-property: transform;
|
|
476
|
-
}
|
|
477
|
-
`;
|
|
478
|
-
const Wrapper$a = styledComponents.styled.div `
|
|
479
|
-
overflow: hidden;
|
|
480
|
-
`;
|
|
481
|
-
const Hider = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
482
|
-
display: ${props => props.isHidden ? 'none' : 'block'};
|
|
483
|
-
`;
|
|
484
|
-
// Returns the boolean value in the next tick.
|
|
485
|
-
// Allows for transition to start when DOM is updated, it prevents a flickers.
|
|
486
|
-
const useOnNextTick = (val) => {
|
|
487
|
-
const [delayedVal, setDelayedVal] = React.useState(val);
|
|
488
|
-
React.useEffect(() => {
|
|
489
|
-
const timeout = setTimeout(() => setDelayedVal(val), 0);
|
|
490
|
-
return () => clearTimeout(timeout);
|
|
491
|
-
}, [val, setDelayedVal]);
|
|
492
|
-
return delayedVal;
|
|
493
|
-
};
|
|
494
|
-
const SlideOpen = ({ isOpen, children, duration, onChange }) => {
|
|
495
|
-
const isDelayedOpen = useOnNextTick(isOpen);
|
|
496
|
-
const [isHidden, setIsHidden] = React.useState(!isOpen);
|
|
497
|
-
const handleTransitionEnd = React.useCallback(() => {
|
|
498
|
-
if (!isOpen) {
|
|
499
|
-
setIsHidden(true);
|
|
500
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(false);
|
|
501
|
-
}
|
|
502
|
-
}, [isOpen, onChange]);
|
|
503
|
-
React.useEffect(() => {
|
|
504
|
-
if (isOpen) {
|
|
505
|
-
setIsHidden(false);
|
|
506
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(true);
|
|
507
|
-
}
|
|
508
|
-
}, [isOpen, onChange]);
|
|
509
|
-
return (React.createElement(Wrapper$a, null,
|
|
510
|
-
React.createElement(Animation, { isOpen: isDelayedOpen, onTransitionEndCapture: handleTransitionEnd, duration: duration },
|
|
511
|
-
React.createElement(Hider, { isHidden: isHidden }, children))));
|
|
512
|
-
};
|
|
513
|
-
|
|
514
|
-
const TitleActionWrapper = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
515
|
-
transform: scaleY( ${props => props.isOpen ? '-1' : '1'} );
|
|
516
|
-
`;
|
|
517
|
-
const StyledPanel$2 = styledComponents.styled(Panel) `
|
|
518
|
-
${props => !props.isOpen && styledComponents.css `border-bottom: 0;`}
|
|
519
|
-
`;
|
|
520
|
-
const CollapsiblePanel = (_a) => {
|
|
521
|
-
var { isInitiallyOpen, children, titleAction } = _a, rest = __rest(_a, ["isInitiallyOpen", "children", "titleAction"]);
|
|
522
|
-
const [isOpen, setIsOpen] = React.useState(isInitiallyOpen);
|
|
523
|
-
const toggleOpen = React.useCallback(() => setIsOpen(!isOpen), [setIsOpen, isOpen]);
|
|
524
|
-
return (React.createElement(StyledPanel$2, Object.assign({}, rest, { isOpen: isOpen, onClickTitle: toggleOpen, p: 0, titleAction: React.createElement(TitleActionWrapper, { isOpen: isOpen }, titleAction) }),
|
|
525
|
-
React.createElement(SlideOpen, { isOpen: isOpen },
|
|
526
|
-
React.createElement(Box, { p: 3 }, children))));
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
const useConfirmModal = ({ onConfirm }) => {
|
|
530
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
531
|
-
const onCancel = () => setIsOpen(false);
|
|
532
|
-
const handleOpen = () => setIsOpen(true);
|
|
533
|
-
const handleConfirm = () => {
|
|
534
|
-
onConfirm();
|
|
535
|
-
setIsOpen(false);
|
|
536
|
-
};
|
|
537
|
-
return [
|
|
538
|
-
{
|
|
539
|
-
onCancel,
|
|
540
|
-
onConfirm: handleConfirm,
|
|
541
|
-
isOpen,
|
|
542
|
-
},
|
|
543
|
-
handleOpen,
|
|
544
|
-
];
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
const delay = styledComponents.keyframes `
|
|
548
|
-
0% {
|
|
549
|
-
opacity: 0;
|
|
550
|
-
}
|
|
551
|
-
100% {
|
|
552
|
-
opacity: 1;
|
|
553
|
-
}
|
|
554
|
-
`;
|
|
555
|
-
const Overlay = styledComponents.styled.div `
|
|
556
|
-
position: fixed;
|
|
557
|
-
top: 0;
|
|
558
|
-
left: 0;
|
|
559
|
-
right: 0;
|
|
560
|
-
bottom: 0;
|
|
561
|
-
z-index: 10;
|
|
562
|
-
opacity: 0;
|
|
563
|
-
background-color: rgba(0,0,0,0.6);
|
|
564
|
-
animation: ${delay} 0.2s forwards;
|
|
565
|
-
`;
|
|
566
|
-
|
|
567
|
-
const Wrapper$9 = styledComponents.styled.div `
|
|
568
|
-
position: fixed;
|
|
569
|
-
top: 0;
|
|
570
|
-
left: 0;
|
|
571
|
-
right: 0;
|
|
572
|
-
bottom: 0;
|
|
573
|
-
|
|
574
|
-
display: flex;
|
|
575
|
-
align-items: center;
|
|
576
|
-
justify-content: center;
|
|
577
|
-
|
|
578
|
-
z-index: 50;
|
|
579
|
-
`;
|
|
580
|
-
const StyledPanel$1 = styledComponents.styled(Panel) `
|
|
581
|
-
box-shadow: 0 8px 8px 0 rgba(34,36,38,.15);
|
|
582
|
-
`;
|
|
583
|
-
const Content = styledComponents.styled.div `
|
|
584
|
-
line-height: ${props => props.theme.spacing(6)};
|
|
585
|
-
font-size: 15px;
|
|
586
|
-
`;
|
|
587
|
-
const Modal = (_a) => {
|
|
588
|
-
var { children, handleClickOverlay, buttons } = _a, panelProps = __rest(_a, ["children", "handleClickOverlay", "buttons"]);
|
|
589
|
-
return (React.createElement(React.Fragment, null,
|
|
590
|
-
React.createElement(Overlay, { onClick: handleClickOverlay }),
|
|
591
|
-
React.createElement(Wrapper$9, null,
|
|
592
|
-
React.createElement(SlideInFromTop, null,
|
|
593
|
-
React.createElement(StyledPanel$1, Object.assign({ footer: buttons ? (React.createElement(Box, { display: "flex", justifyContent: "flex-end" }, buttons)) : undefined }, panelProps), children && (React.createElement(Content, null, children)))))));
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
const Wrapper$8 = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
597
|
-
${props => props.stretch && `width: 100%;`}
|
|
598
|
-
${props => props.actionButton || props.stretch
|
|
599
|
-
? styledComponents.css `margin: 0;`
|
|
600
|
-
: styledComponents.css `margin: ${props => props.theme.spacing(0, 2, 0, 0)};`}
|
|
601
|
-
`;
|
|
602
|
-
const StyledButton$1 = styledComponents.styled.button.withConfig({ shouldForwardProp: isPropValid }) `
|
|
603
|
-
font-size: 14px;
|
|
604
|
-
font-weight: bold;
|
|
605
|
-
letter-spacing: 1px;
|
|
606
|
-
line-height: 1em;
|
|
607
|
-
outline: 0;
|
|
608
|
-
border: none;
|
|
609
|
-
border-radius: 4px;
|
|
610
|
-
cursor: pointer;
|
|
611
|
-
text-decoration: none;
|
|
612
|
-
font-family: "Open Sans", Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
613
|
-
transition: background-color .1s ease, color .1s ease;
|
|
614
|
-
display: flex;
|
|
615
|
-
flex-direction: row;
|
|
616
|
-
align-items: center;
|
|
617
|
-
user-select: none;
|
|
618
|
-
min-height: ${props => props.inline ? 'auto' : '38px'};
|
|
619
|
-
|
|
620
|
-
${props => props.stretch && styledComponents.css `
|
|
621
|
-
width: 100%;
|
|
622
|
-
display: block;
|
|
623
|
-
`}
|
|
624
|
-
|
|
625
|
-
${props => props.actionButton && styledComponents.css `
|
|
626
|
-
width: 100%;
|
|
627
|
-
${mq('laptop', `width: auto`)}
|
|
628
|
-
`}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
${props => props.variant !== 'text'
|
|
632
|
-
? !props.icon
|
|
633
|
-
? styledComponents.css `padding: ${props.theme.spacing(3, 5)}; min-width: ${props => props.theme.spacing(10)};`
|
|
634
|
-
: props.hasChildren && styledComponents.css `position: relative; padding: ${props.theme.spacing(3, 5, 3, 13)};`
|
|
635
|
-
: styledComponents.css `font-weight: 700; padding: 0;`}
|
|
636
|
-
|
|
637
|
-
&:disabled {
|
|
638
|
-
opacity: .5;
|
|
639
|
-
cursor: default;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
&:focus {
|
|
643
|
-
background-blend-mode: darken;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
${(props) => {
|
|
647
|
-
if (props.variant === "basic") {
|
|
648
|
-
return `
|
|
649
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
650
|
-
`;
|
|
651
|
-
}
|
|
652
|
-
}}
|
|
653
|
-
|
|
654
|
-
${(props) => {
|
|
655
|
-
var _a;
|
|
656
|
-
const { idle, hover, active } = theme.palette.button[(_a = props.variant) !== null && _a !== void 0 ? _a : 'default'];
|
|
657
|
-
return `
|
|
658
|
-
color: ${idle.text};
|
|
659
|
-
background-color: ${idle.background};
|
|
660
|
-
|
|
661
|
-
&:not(:disabled) {
|
|
662
|
-
&:hover, &:focus {
|
|
663
|
-
color: ${hover.text};
|
|
664
|
-
background-color: ${hover.background};
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
&:active {
|
|
668
|
-
color: ${active.text};
|
|
669
|
-
background-color: ${active.background};
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
`;
|
|
674
|
-
}}
|
|
675
|
-
`;
|
|
676
|
-
const IconWrapper$1 = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
|
|
677
|
-
${props => props.variant !== "text" && styledComponents.css `
|
|
678
|
-
min-width: ${props.theme.spacing(10)};
|
|
679
|
-
`}
|
|
680
|
-
|
|
681
|
-
${props => props.variant === "text"
|
|
682
|
-
? props.hasChildren && styledComponents.css `
|
|
683
|
-
padding-right: ${props.theme.spacing(2)};
|
|
684
|
-
`
|
|
685
|
-
: props.hasChildren && styledComponents.css `
|
|
686
|
-
position: absolute;
|
|
687
|
-
left: 0;
|
|
688
|
-
top: 0;
|
|
689
|
-
width: ${props => props.theme.spacing(10)};
|
|
690
|
-
height: 100%;
|
|
691
|
-
background-color: rgba(0,0,0,.05);
|
|
692
|
-
|
|
693
|
-
& > svg {
|
|
694
|
-
transform: translate(-50%, -50%);
|
|
695
|
-
position: absolute;
|
|
696
|
-
top: 50%;
|
|
697
|
-
left: 50%;
|
|
698
|
-
}
|
|
699
|
-
`}
|
|
700
|
-
`;
|
|
701
|
-
const Button$1 = React.forwardRef((_a, ref) => {
|
|
702
|
-
var { children, icon, stretch } = _a, props = __rest(_a, ["children", "icon", "stretch"]);
|
|
703
|
-
return (React.createElement(Wrapper$8, { actionButton: props.actionButton, stretch: stretch },
|
|
704
|
-
React.createElement(StyledButton$1, Object.assign({ ref: ref, icon: icon, hasChildren: !!children, stretch: stretch }, props),
|
|
705
|
-
icon && (React.createElement(IconWrapper$1, { variant: props.variant, hasChildren: !!children }, icon)),
|
|
706
|
-
children)));
|
|
707
|
-
});
|
|
708
|
-
|
|
709
|
-
const ConfirmModal = ({ title, children, cancelLabel = "Nee, annuleren", confirmLabel = "Ja", confirmVariant = 'secondary', confirmIcon, cancelIcon, isOpen, onCancel, onConfirm, }) => {
|
|
710
|
-
return isOpen ? (React.createElement(Modal, { title: title, handleClickOverlay: onCancel, buttons: React.createElement(React.Fragment, null,
|
|
711
|
-
React.createElement(Button$1, { "data-testid": "btn-cancel", onClick: onCancel, variant: "basic", icon: cancelIcon }, cancelLabel),
|
|
712
|
-
React.createElement(Button$1, { "data-testid": "btn-confirm", onClick: onConfirm, variant: confirmVariant, icon: confirmIcon }, confirmLabel)) }, children)) : null;
|
|
713
|
-
};
|
|
714
|
-
|
|
715
|
-
const noop = () => { };
|
|
716
|
-
const ConfirmButton = (_a) => {
|
|
717
|
-
var _b;
|
|
718
|
-
var { modalProps } = _a, buttonProps = __rest(_a, ["modalProps"]);
|
|
719
|
-
const [modalHandlerProps, openModal] = useConfirmModal({
|
|
720
|
-
onConfirm: (_b = modalProps.onConfirm) !== null && _b !== void 0 ? _b : noop
|
|
721
|
-
});
|
|
722
|
-
return React.createElement(React.Fragment, null,
|
|
723
|
-
React.createElement(Button$1, Object.assign({}, buttonProps, { onClick: openModal })),
|
|
724
|
-
React.createElement(ConfirmModal, Object.assign({ title: "Are you sure?" }, modalProps, modalHandlerProps)));
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
const StyledTable = styledComponents.styled.table.withConfig({ shouldForwardProp: isPropValid }) `
|
|
728
|
-
border-radius: 4px;
|
|
729
|
-
width: 100%;
|
|
730
|
-
border-collapse: separate;
|
|
731
|
-
border-spacing: 0;
|
|
732
|
-
|
|
733
|
-
${(props) => responsiveProps(props, {
|
|
734
|
-
"tableLayout": unit => styledComponents.css `table-layout: ${unit};`,
|
|
735
|
-
})}
|
|
736
|
-
`;
|
|
737
|
-
const StyledTableRow = styledComponents.styled.tr.withConfig({ shouldForwardProp: isPropValid }) `
|
|
738
|
-
& > td {
|
|
739
|
-
transition: background-color .1s ease, color .1s ease;
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
${props => Object.entries(props.theme.palette.pane).map(([variant, value]) => `
|
|
743
|
-
&:nth-child(odd) > td.${variant} {
|
|
744
|
-
color: ${value.main.idle.text};
|
|
745
|
-
background-color: ${value.main.idle.background};
|
|
746
|
-
}
|
|
747
|
-
&:nth-child(even) > td.${variant} {
|
|
748
|
-
color: ${value.alternate.idle.text};
|
|
749
|
-
background-color: ${value.alternate.idle.background};
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
${!props.disableHover && `
|
|
754
|
-
&:nth-child(odd):hover > td.${variant} {
|
|
755
|
-
color: ${value.main.hover.text};
|
|
756
|
-
background-color: ${value.main.hover.background};
|
|
757
|
-
}
|
|
758
|
-
&:nth-child(even):hover > td.${variant} {
|
|
759
|
-
color: ${value.alternate.hover.text};
|
|
760
|
-
background-color: ${value.alternate.hover.background};
|
|
761
|
-
}
|
|
762
|
-
`}
|
|
763
|
-
`)}
|
|
764
|
-
`;
|
|
765
|
-
const StyledTableCell = styledComponents.styled.td.withConfig({ shouldForwardProp: isPropValid }) `
|
|
766
|
-
border-top: 1px solid rgba(34,36,38,.1);
|
|
767
|
-
border-right: 1px solid rgba(34,36,38,.1);
|
|
768
|
-
padding: ${props => props.theme.spacing(2, 3)};
|
|
769
|
-
|
|
770
|
-
&:last-of-type {
|
|
771
|
-
border-right: 0;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
${(props) => responsiveProps(props, {
|
|
775
|
-
width: unit => styledComponents.css `width: ${unit};`,
|
|
776
|
-
})}
|
|
777
|
-
`;
|
|
778
|
-
const StyledTableHeadCell = styledComponents.styled.th.withConfig({ shouldForwardProp: isPropValid }) `
|
|
779
|
-
border-right: 1px solid rgba(34,36,38,.1);
|
|
780
|
-
text-align: left;
|
|
781
|
-
padding: ${props => props.theme.spacing(2, 3)};
|
|
782
|
-
font-weight: 700;
|
|
783
|
-
transition: background-color .1s ease, color .1s ease;
|
|
784
|
-
|
|
785
|
-
&:last-of-type {
|
|
786
|
-
border-right: 0;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
${props => !!props.variant && styledComponents.css `
|
|
790
|
-
color: ${props.theme.palette.pane[props.variant].main.idle.text};
|
|
791
|
-
background-color: ${props.theme.palette.pane[props.variant].main.idle.background};
|
|
792
|
-
|
|
793
|
-
&:hover {
|
|
794
|
-
color: ${props.theme.palette.pane[props.variant].main.hover.text};
|
|
795
|
-
background-color: ${props.theme.palette.pane[props.variant].main.hover.background};
|
|
796
|
-
}
|
|
797
|
-
`}
|
|
798
|
-
|
|
799
|
-
${props => props.width ? `width: ${props.width};` : ''}
|
|
800
|
-
|
|
801
|
-
${props => props.sortable && `
|
|
802
|
-
cursor: pointer;
|
|
803
|
-
user-select: none;
|
|
804
|
-
|
|
805
|
-
&:hover {
|
|
806
|
-
background-color: ${props.theme.palette.pane.basic.main.hover.background};
|
|
807
|
-
}
|
|
808
|
-
`}
|
|
809
|
-
|
|
810
|
-
${props => props.sortDirection && `
|
|
811
|
-
position:relative;
|
|
812
|
-
|
|
813
|
-
&:after {
|
|
814
|
-
content: " ";
|
|
815
|
-
position: absolute;
|
|
816
|
-
right: 15px;
|
|
817
|
-
top: 50%;
|
|
818
|
-
|
|
819
|
-
height: 0;
|
|
820
|
-
width: 0;
|
|
821
|
-
border: 5px solid transparent;
|
|
822
|
-
|
|
823
|
-
${props.sortDirection === 'asc' ? `
|
|
824
|
-
border-top-color: #000;
|
|
825
|
-
transform: translateY(-25%);
|
|
826
|
-
` : `
|
|
827
|
-
border-bottom-color: #000;
|
|
828
|
-
transform: translateY(-75%);
|
|
829
|
-
`}
|
|
830
|
-
}
|
|
831
|
-
`}
|
|
832
|
-
`;
|
|
833
|
-
// Wrapper to allow for dot notated components:
|
|
834
|
-
const Table = (props) => (React.createElement(StyledTable, Object.assign({}, props)));
|
|
835
|
-
const TableCell = (_a) => {
|
|
836
|
-
var { variant, className } = _a, rest = __rest(_a, ["variant", "className"]);
|
|
837
|
-
return (React.createElement(StyledTableCell, Object.assign({ className: `${className || ''} ${variant || 'basic'}` }, rest)));
|
|
838
|
-
};
|
|
839
|
-
Table.Row = StyledTableRow;
|
|
840
|
-
Table.HeadCell = StyledTableHeadCell;
|
|
841
|
-
Table.Cell = TableCell;
|
|
842
|
-
|
|
843
|
-
const StyledCell = styledComponents.styled(Table.Cell) `
|
|
844
|
-
${(props) => props.firstRow && styledComponents.css ` border-top: 0px !important;`}
|
|
845
|
-
${(props) => props.width && styledComponents.css ` width: ${props.width};`}
|
|
846
|
-
vertical-align: top;
|
|
847
|
-
`;
|
|
848
|
-
const Details = ({ details, firstColumnWidth }) => (React.createElement(Table, null,
|
|
849
|
-
React.createElement("tbody", null, Object.entries(details).map(([key, val], index) => (React.createElement(Table.Row, { key: key, disableHover: true },
|
|
850
|
-
React.createElement(StyledCell, { width: firstColumnWidth, firstRow: index === 0 }, key),
|
|
851
|
-
React.createElement(StyledCell, { firstRow: index === 0 }, val)))))));
|
|
852
|
-
|
|
853
|
-
const Wrapper$7 = styledComponents.styled.div `
|
|
854
|
-
position: relative;
|
|
855
|
-
`;
|
|
856
|
-
const Dropper = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
|
|
857
|
-
border-radius: 4px;
|
|
858
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
859
|
-
position: absolute;
|
|
860
|
-
box-shadow: 0 8px 8px 0 rgba(34,36,38,.15);
|
|
861
|
-
background-color: ${props => props.theme.palette.common.white};
|
|
862
|
-
z-index: 100;
|
|
863
|
-
|
|
864
|
-
${props => props.align === 'right' ? styledComponents.css `right: 0;` : styledComponents.css `left: 0;`}
|
|
865
|
-
`;
|
|
866
|
-
const DropdownMenu = styledComponents.styled.ul `
|
|
867
|
-
list-style: none;
|
|
868
|
-
margin: 0;
|
|
869
|
-
padding: ${props => props.theme.spacing(2, 0)};
|
|
870
|
-
`;
|
|
871
|
-
const DropdownMenuItem = styledComponents.styled.li `
|
|
872
|
-
cursor: pointer;
|
|
873
|
-
padding: ${props => props.theme.spacing(0, 3)};
|
|
874
|
-
&:hover {
|
|
875
|
-
background-color: #ddd;
|
|
876
|
-
}
|
|
877
|
-
`;
|
|
878
|
-
const Dropdown = ({ buttonProps, align, children, stayOpenOnClick }) => {
|
|
879
|
-
const dropper = React.useRef(null);
|
|
880
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
881
|
-
const handleOpen = React.useCallback(() => setIsOpen(true), [setIsOpen]);
|
|
882
|
-
const handleClose = React.useCallback((e) => {
|
|
883
|
-
var _a;
|
|
884
|
-
if (stayOpenOnClick && ((_a = dropper.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)))
|
|
885
|
-
return;
|
|
886
|
-
setIsOpen(false);
|
|
887
|
-
}, [setIsOpen, stayOpenOnClick]);
|
|
888
|
-
React.useEffect(() => {
|
|
889
|
-
if (isOpen) {
|
|
890
|
-
setTimeout(() => document.addEventListener('click', handleClose), 1);
|
|
891
|
-
}
|
|
892
|
-
return () => {
|
|
893
|
-
document.removeEventListener('click', handleClose);
|
|
894
|
-
};
|
|
895
|
-
}, [isOpen, handleClose]);
|
|
896
|
-
return (React.createElement(Wrapper$7, null,
|
|
897
|
-
React.createElement(Button$1, Object.assign({}, buttonProps, { onClick: handleOpen })),
|
|
898
|
-
isOpen && (React.createElement(SlideInFromTop, { speed: '.1s' },
|
|
899
|
-
React.createElement(Dropper, { ref: dropper, align: align || 'left' }, children)))));
|
|
900
|
-
};
|
|
901
|
-
|
|
902
|
-
const HiddenInput$1 = styledComponents.styled.input `
|
|
903
|
-
display: none;
|
|
904
|
-
`;
|
|
905
|
-
const StyledDropZone = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
906
|
-
display: flex;
|
|
907
|
-
flex-direction: column;
|
|
908
|
-
align-items: center;
|
|
909
|
-
justify-content: center;
|
|
910
|
-
border-radius: 4px;
|
|
911
|
-
height: ${props => props.theme.spacing(25)};
|
|
912
|
-
|
|
913
|
-
border-radius: 4px;
|
|
914
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
915
|
-
|
|
916
|
-
& > * {
|
|
917
|
-
pointerEvents: none;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
${props => props.isReadyToDrop && styledComponents.css `
|
|
921
|
-
background-color: #FAFAFA;
|
|
922
|
-
`}
|
|
923
|
-
`;
|
|
924
|
-
const Dropzone = (_a) => {
|
|
925
|
-
var { onChange, icon, label } = _a, rest = __rest(_a, ["onChange", "icon", "label"]);
|
|
926
|
-
const fileInput = React.useRef(null);
|
|
927
|
-
const dropzone = React.useRef(null);
|
|
928
|
-
const [isReadyToDrop, setIsReadyToDrop] = React.useState(false);
|
|
929
|
-
const handleChange = React.useCallback((fileList) => {
|
|
930
|
-
if (fileList && onChange) {
|
|
931
|
-
onChange(Array.from(fileList));
|
|
932
|
-
}
|
|
933
|
-
}, [onChange]);
|
|
934
|
-
const handleDragOver = React.useCallback((e) => {
|
|
935
|
-
e.preventDefault();
|
|
936
|
-
setIsReadyToDrop(true);
|
|
937
|
-
}, []);
|
|
938
|
-
const handleDragLeave = React.useCallback((e) => {
|
|
939
|
-
e.preventDefault();
|
|
940
|
-
setIsReadyToDrop(false);
|
|
941
|
-
}, []);
|
|
942
|
-
const handleDrop = React.useCallback((e) => {
|
|
943
|
-
var _a;
|
|
944
|
-
e.preventDefault();
|
|
945
|
-
setIsReadyToDrop(false);
|
|
946
|
-
handleChange((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files);
|
|
947
|
-
}, [handleChange]);
|
|
948
|
-
const handleClick = React.useCallback(() => {
|
|
949
|
-
var _a;
|
|
950
|
-
// We trigger the 'file pick' dialog by delegating the click to a hidden file-input.
|
|
951
|
-
(_a = fileInput.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
952
|
-
}, [fileInput]);
|
|
953
|
-
const handleInputChange = React.useCallback(() => {
|
|
954
|
-
var _a;
|
|
955
|
-
handleChange((_a = fileInput === null || fileInput === void 0 ? void 0 : fileInput.current) === null || _a === void 0 ? void 0 : _a.files);
|
|
956
|
-
}, [fileInput, handleChange]);
|
|
957
|
-
return (React.createElement(StyledDropZone, Object.assign({ ref: dropzone, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onClick: handleClick, isReadyToDrop: isReadyToDrop }, rest),
|
|
958
|
-
React.createElement(HiddenInput$1, { "data-testid": "dropzone-file-input", type: "file", ref: fileInput, onChange: handleInputChange, multiple: true }),
|
|
959
|
-
React.createElement(Box, null,
|
|
960
|
-
React.createElement(Button$1, { variant: "text", color: "secondary", type: "button", icon: icon }, label))));
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
const StyledBox$6 = styledComponents.styled(Box) `
|
|
964
|
-
width: 300px;
|
|
965
|
-
`;
|
|
966
|
-
const Feedback = ({ onConfirm, buttonLabel, buttonIcon, title, subtitle }) => (React.createElement(Modal, { handleClickOverlay: onConfirm, buttons: React.createElement(Button$1, { "data-testid": 'confirm', stretch: true, icon: buttonIcon, variant: 'secondary', onClick: onConfirm }, buttonLabel) },
|
|
967
|
-
React.createElement(StyledBox$6, { pt: 3, pb: 3 },
|
|
968
|
-
React.createElement(Box, { pb: 5, textAlign: "center" },
|
|
969
|
-
React.createElement(Header, null, title),
|
|
970
|
-
subtitle && React.createElement(Box, { pt: 5 },
|
|
971
|
-
React.createElement(Header, { level: 5 }, subtitle))),
|
|
972
|
-
React.createElement(Box, { pt: 5, pb: 5, pl: 7, pr: 7 },
|
|
973
|
-
React.createElement(AnimatedCheckmark, null)))));
|
|
974
|
-
|
|
975
|
-
const horizontalPadding = { laptop: 1 };
|
|
976
|
-
const verticalPadding = { mobile: 1, laptop: 0 };
|
|
977
|
-
const flexGrow = { laptop: 1 };
|
|
978
|
-
const FloaterItem = (_a) => {
|
|
979
|
-
var { stretch, laptopWidth } = _a, props = __rest(_a, ["stretch", "laptopWidth"]);
|
|
980
|
-
const width = React.useMemo(() => ({ laptop: laptopWidth }), [laptopWidth]);
|
|
981
|
-
return React.createElement(Box, Object.assign({ flexGrow: stretch ? flexGrow : undefined, width: width, pt: verticalPadding, pb: verticalPadding, pl: horizontalPadding, pr: horizontalPadding }, props));
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
const horizontalMargin = { laptop: -1 };
|
|
985
|
-
const verticalMargin = { mobile: -1, laptop: 0 };
|
|
986
|
-
const display = { mobile: "block", laptop: "flex" };
|
|
987
|
-
const hasElement = (item) => !!item.element;
|
|
988
|
-
const Floater = (_a) => {
|
|
989
|
-
var { items, forceEqualWidth = false, stretch = false } = _a, props = __rest(_a, ["items", "forceEqualWidth", "stretch"]);
|
|
990
|
-
return React.createElement(Box, Object.assign({ mb: verticalMargin, mt: verticalMargin, ml: horizontalMargin, mr: horizontalMargin, display: display }, props), items
|
|
991
|
-
.filter(Boolean)
|
|
992
|
-
.map((item, i) => hasElement(item)
|
|
993
|
-
? (React.createElement(FloaterItem, { key: i, laptopWidth: item.forceEqualWidth ? `${100 / items.length}%` : undefined, stretch: item.stretch || false }, item.element))
|
|
994
|
-
: React.createElement(FloaterItem, { key: i, laptopWidth: forceEqualWidth ? `${100 / items.length}%` : undefined, stretch: stretch }, item)));
|
|
995
|
-
};
|
|
996
|
-
|
|
997
|
-
const SIDEBAR_COLLAPSED_WIDTH = 15;
|
|
998
|
-
const StyledSidebar = styledComponents.styled(Box) `
|
|
999
|
-
float: left;
|
|
1000
|
-
|
|
1001
|
-
height: 100%;
|
|
1002
|
-
width: 100%;
|
|
1003
|
-
|
|
1004
|
-
background-color: #243646;
|
|
1005
|
-
|
|
1006
|
-
position: fixed;
|
|
1007
|
-
top: 0;
|
|
1008
|
-
left: 0;
|
|
1009
|
-
right: 0;
|
|
1010
|
-
bottom: 0;
|
|
1011
|
-
|
|
1012
|
-
z-index: 900;
|
|
1013
|
-
|
|
1014
|
-
display: ${props => props.isMobileMenuOpen ? 'block' : 'none'};
|
|
1015
|
-
pointer-events: auto;
|
|
1016
|
-
|
|
1017
|
-
${mq("laptop", styledComponents.css `
|
|
1018
|
-
position: static;
|
|
1019
|
-
display: block;
|
|
1020
|
-
width: auto;
|
|
1021
|
-
min-width: ${props => { var _a; return props.theme.spacing((_a = props.minWidth) !== null && _a !== void 0 ? _a : 75); }};
|
|
1022
|
-
box-shadow: 2px 0px 6px -1px rgba(0,0,0,0.74);
|
|
1023
|
-
|
|
1024
|
-
transition: transform .1s ease-out;
|
|
1025
|
-
transform: ${props => props.isDesktopMenuOpen
|
|
1026
|
-
? 'transform: translateX(0);'
|
|
1027
|
-
: styledComponents.css `translateX(calc(-100% + ${props => props.theme.spacing(SIDEBAR_COLLAPSED_WIDTH)}));`};
|
|
1028
|
-
|
|
1029
|
-
& ul {
|
|
1030
|
-
opacity: ${props => props.isDesktopMenuOpen ? '1' : '0'};
|
|
1031
|
-
}
|
|
1032
|
-
`)}
|
|
1033
|
-
`;
|
|
1034
|
-
const SideBar = (props) => {
|
|
1035
|
-
const { closeSideMenu, openSideMenu, isSideMenuOpen } = useUiStateContext();
|
|
1036
|
-
return React.createElement(StyledSidebar, Object.assign({ isDesktopMenuOpen: isSideMenuOpen }, props, { onMouseEnter: openSideMenu, onMouseLeave: closeSideMenu }));
|
|
1037
|
-
};
|
|
1038
|
-
|
|
1039
|
-
const StyledBox$5 = styledComponents.styled(Box) `
|
|
1040
|
-
background-color: ${props => props.theme.palette.common.white};
|
|
1041
|
-
border-top: 1px solid #DDDDDD;
|
|
1042
|
-
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.04);
|
|
1043
|
-
box-sizing: border-box;
|
|
1044
|
-
`;
|
|
1045
|
-
const Footer = ({ children }) => (React.createElement(StyledBox$5, { pt: 2, pb: 2, pr: 5, pl: { mobile: 5, laptop: SIDEBAR_COLLAPSED_WIDTH + 5 } }, children));
|
|
1046
|
-
|
|
1047
|
-
const Scroller = styledComponents.styled(Box) `
|
|
1048
|
-
overflow-x: auto;
|
|
1049
|
-
overflow-y: hidden;
|
|
1050
|
-
`;
|
|
1051
|
-
const HorizontalScroller = ({ children }) => (React.createElement(Scroller, null, children));
|
|
1052
|
-
|
|
1053
|
-
const HamburgerButton = styledComponents.styled(Button$1) `
|
|
1054
|
-
margin-right: ${props => props.theme.spacing(3)};
|
|
1055
|
-
${mq("laptop", `display: none;`)}
|
|
1056
|
-
`;
|
|
1057
|
-
|
|
1058
|
-
const Menu = styledComponents.styled.ul `
|
|
1059
|
-
padding: 0;
|
|
1060
|
-
margin: 0;
|
|
1061
|
-
list-style: none;
|
|
1062
|
-
`;
|
|
1063
|
-
const StyledMenuItem = styledComponents.styled.li.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1064
|
-
padding: ${props => props.theme.spacing(.5, 5)};
|
|
1065
|
-
|
|
1066
|
-
${props => props.isOpen && styledComponents.css `
|
|
1067
|
-
border-left: ${props.theme.spacing(1)} solid ${props.theme.palette.colors.blue};
|
|
1068
|
-
background: #293846;
|
|
1069
|
-
|
|
1070
|
-
& > * {
|
|
1071
|
-
margin-left: ${props.theme.spacing(-1)};
|
|
1072
|
-
}
|
|
1073
|
-
`}
|
|
1074
|
-
|
|
1075
|
-
& button:hover, & button:active, & button:focus {
|
|
1076
|
-
color: ${props => props.theme.palette.common.white} !important;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
& button {
|
|
1080
|
-
width: 100%;
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
${props => props.isActive && styledComponents.css `
|
|
1084
|
-
& button {
|
|
1085
|
-
color: ${props.theme.palette.common.white};
|
|
1086
|
-
}
|
|
1087
|
-
`}
|
|
1088
|
-
`;
|
|
1089
|
-
const MenuItem = ({ item, isOpen, isActive, children }) => {
|
|
1090
|
-
const [isDelayedOpen, setDelayedOpen] = React.useState(!!isOpen);
|
|
1091
|
-
return (React.createElement(StyledMenuItem, { isOpen: isDelayedOpen, isActive: !!isActive },
|
|
1092
|
-
item,
|
|
1093
|
-
children && (React.createElement(SlideOpen, { onChange: setDelayedOpen, isOpen: !!isOpen, duration: .25 }, children))));
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
const MenuCloseButton = styledComponents.styled(Button$1) `
|
|
1097
|
-
${mq("laptop", `display: none;`)}
|
|
1098
|
-
`;
|
|
1099
|
-
|
|
1100
|
-
const StyledBox$4 = styledComponents.styled(Box) `
|
|
1101
|
-
display: none;
|
|
1102
|
-
${mq("laptop", `display: flex;`)}
|
|
1103
|
-
|
|
1104
|
-
height: 100%;
|
|
1105
|
-
flex-direction: row;
|
|
1106
|
-
align-items: center;
|
|
1107
|
-
|
|
1108
|
-
width: ${props => props.theme.spacing(SIDEBAR_COLLAPSED_WIDTH)};
|
|
1109
|
-
|
|
1110
|
-
& > svg {
|
|
1111
|
-
margin: 0 auto;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
${StyledSidebar}:hover & {
|
|
1115
|
-
display:none;
|
|
1116
|
-
}
|
|
1117
|
-
`;
|
|
1118
|
-
const MenuSlideOpenIndicator = ({ children }) => (React.createElement(StyledBox$4, null, children));
|
|
1119
|
-
|
|
1120
|
-
const VerticalRhythmLaptop = 7;
|
|
1121
|
-
const VerticalRhythmMobile = 4;
|
|
1122
|
-
|
|
1123
|
-
const StyledBox$3 = styledComponents.styled(Box) `
|
|
1124
|
-
box-sizing: border-box;
|
|
1125
|
-
color: ${props => props.theme.palette.button.text.idle.text};
|
|
1126
|
-
font-weight: bold;
|
|
1127
|
-
|
|
1128
|
-
display: flex;
|
|
1129
|
-
text-align: center;
|
|
1130
|
-
|
|
1131
|
-
font-size: 14px;
|
|
1132
|
-
font-weight: bold;
|
|
1133
|
-
letter-spacing: 1px;
|
|
1134
|
-
line-height: 1em;
|
|
1135
|
-
|
|
1136
|
-
background-color: rgba(0,0,0,.2);
|
|
1137
|
-
|
|
1138
|
-
${mq('laptop', styledComponents.css `
|
|
1139
|
-
min-height: ${props => props.theme.spacing(12)};
|
|
1140
|
-
`)}
|
|
1141
|
-
`;
|
|
1142
|
-
const SideBarHeader = ({ children, right }) => (React.createElement(StyledBox$3, { mb: VerticalRhythmLaptop },
|
|
1143
|
-
React.createElement(Box, { flexGrow: 1, display: "flex" },
|
|
1144
|
-
React.createElement(Box, { flexGrow: 1, display: "flex", flexDirection: "column", justifyContent: "center" }, children)),
|
|
1145
|
-
right && React.createElement(Box, null, right)));
|
|
1146
|
-
|
|
1147
|
-
const useCloseSidebarOnNavigate = (pathName) => {
|
|
1148
|
-
const { closeSideMenu } = useUiStateContext();
|
|
1149
|
-
React.useEffect(() => {
|
|
1150
|
-
closeSideMenu();
|
|
1151
|
-
}, [pathName, closeSideMenu]);
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
const useToggleMobileMenu = ({ currentRoute }) => {
|
|
1155
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
1156
|
-
const toggle = React.useCallback(() => {
|
|
1157
|
-
setIsOpen((val) => !val);
|
|
1158
|
-
}, []);
|
|
1159
|
-
const open = React.useCallback(() => {
|
|
1160
|
-
setIsOpen(true);
|
|
1161
|
-
}, []);
|
|
1162
|
-
const close = React.useCallback(() => {
|
|
1163
|
-
setIsOpen(false);
|
|
1164
|
-
}, []);
|
|
1165
|
-
React.useEffect(() => {
|
|
1166
|
-
close();
|
|
1167
|
-
}, [currentRoute, close]);
|
|
1168
|
-
return {
|
|
1169
|
-
isOpen,
|
|
1170
|
-
open,
|
|
1171
|
-
close,
|
|
1172
|
-
toggle
|
|
1173
|
-
};
|
|
1174
|
-
};
|
|
1175
|
-
|
|
1176
|
-
const useResponsiveBreakpoints = () => {
|
|
1177
|
-
const [windowWidth, setWindowWidth] = React.useState(window.innerWidth);
|
|
1178
|
-
React.useEffect(() => {
|
|
1179
|
-
const onResize = () => setWindowWidth(window.innerWidth);
|
|
1180
|
-
window.addEventListener('resize', onResize);
|
|
1181
|
-
return () => window.removeEventListener('resize', onResize);
|
|
1182
|
-
}, []);
|
|
1183
|
-
const responsiveMap = React.useMemo(() => ({
|
|
1184
|
-
isMobile: windowWidth >= BreakPointValues.mobile,
|
|
1185
|
-
isTablet: windowWidth >= BreakPointValues.tablet,
|
|
1186
|
-
isLaptop: windowWidth >= BreakPointValues.laptop,
|
|
1187
|
-
isDesktop: windowWidth >= BreakPointValues.desktop
|
|
1188
|
-
}), [windowWidth]);
|
|
1189
|
-
return responsiveMap;
|
|
1190
|
-
};
|
|
1191
|
-
|
|
1192
|
-
const Wrapper$6 = styledComponents.styled.div `
|
|
1193
|
-
display: flex;
|
|
1194
|
-
`;
|
|
1195
|
-
const Button = styledComponents.styled.button.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1196
|
-
user-select:none;
|
|
1197
|
-
cursor: pointer;
|
|
1198
|
-
|
|
1199
|
-
min-height: ${props => props.theme.spacing(8)};
|
|
1200
|
-
padding: .2em 1.3em .2em;
|
|
1201
|
-
margin: 0;
|
|
1202
|
-
line-height: 1em;
|
|
1203
|
-
outline: 0;
|
|
1204
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
1205
|
-
|
|
1206
|
-
font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
1207
|
-
background-color: ${props => props.active ? '#F2F2F2' : '#fff'};
|
|
1208
|
-
|
|
1209
|
-
&:not(:first-of-type) {
|
|
1210
|
-
border-left: 0;
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
${props => !props.disabled && (`
|
|
1214
|
-
&:hover {
|
|
1215
|
-
background-color: #E9E9E9;
|
|
1216
|
-
}
|
|
1217
|
-
`)}
|
|
1218
|
-
`;
|
|
1219
|
-
const range = (start, end) => {
|
|
1220
|
-
let nums = [];
|
|
1221
|
-
for (let i = start; i < end; i++) {
|
|
1222
|
-
nums.push(i);
|
|
1223
|
-
}
|
|
1224
|
-
return nums;
|
|
1225
|
-
};
|
|
1226
|
-
const Paginator = (props) => {
|
|
1227
|
-
const { isTablet } = useResponsiveBreakpoints();
|
|
1228
|
-
const { pageCount, onChange } = props;
|
|
1229
|
-
const currentPage = Math.min(Math.max(props.currentPage, 0), pageCount);
|
|
1230
|
-
const clamSize = isTablet ? 2 : 0;
|
|
1231
|
-
const clamLower = Math.max(1, currentPage - clamSize);
|
|
1232
|
-
const clamUpper = Math.min(pageCount, currentPage + clamSize);
|
|
1233
|
-
return (React.createElement(Wrapper$6, null,
|
|
1234
|
-
React.createElement(Button, { "data-testid": "paginate-prev", disabled: currentPage === 1, onClick: () => onChange(currentPage - 1) }, "\u27E8"),
|
|
1235
|
-
clamLower > 1 && (React.createElement(Button, { "data-testid": "paginate-page-1", active: currentPage === 1, onClick: () => onChange(1) }, "1")),
|
|
1236
|
-
clamLower > 2 && (React.createElement(Button, { disabled: true }, "...")),
|
|
1237
|
-
range(clamLower, clamUpper + 1).map((pageNumber) => (React.createElement(Button, { "data-testid": `paginate-page-${pageNumber}`, key: pageNumber, active: currentPage === pageNumber, onClick: () => onChange(pageNumber) }, pageNumber))),
|
|
1238
|
-
clamUpper < pageCount - 1 && (React.createElement(Button, { disabled: true }, "...")),
|
|
1239
|
-
clamUpper < pageCount && (React.createElement(Button, { "data-testid": `paginate-page-${pageCount}`, active: currentPage === pageCount, onClick: () => onChange(pageCount) }, pageCount)),
|
|
1240
|
-
React.createElement(Button, { "data-testid": "paginate-next", disabled: currentPage === pageCount, onClick: () => onChange(currentPage + 1) }, "\u27E9")));
|
|
1241
|
-
};
|
|
1242
|
-
|
|
1243
|
-
const Section = (props) => (React.createElement(Box, Object.assign({ pb: { laptop: VerticalRhythmLaptop, mobile: VerticalRhythmMobile } }, props)));
|
|
1244
|
-
|
|
1245
|
-
const Wrapper$5 = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1246
|
-
display: flex;
|
|
1247
|
-
border-radius: ${props => props.theme.spacing(1)};
|
|
1248
|
-
padding: ${props => props.theme.spacing(4)};
|
|
1249
|
-
background-color: ${props => props.theme.palette.colors[props.backgroundColor]};
|
|
1250
|
-
box-sizing: border-box;
|
|
1251
|
-
height: 100%;
|
|
1252
|
-
`;
|
|
1253
|
-
const Label$2 = styledComponents.styled.div `
|
|
1254
|
-
text-transform: uppercase;
|
|
1255
|
-
color: ${props => props.theme.palette.common.white};
|
|
1256
|
-
font-size: ${props => props.theme.spacing(3)};
|
|
1257
|
-
`;
|
|
1258
|
-
const Value = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1259
|
-
color: ${props => props.theme.palette.common.white};
|
|
1260
|
-
font-weight: bold;
|
|
1261
|
-
font-size: ${props => props.theme.spacing(props.smallerValue ? 5.5 : 7.5)};
|
|
1262
|
-
`;
|
|
1263
|
-
const IconWrapper = styledComponents.styled.div `
|
|
1264
|
-
margin: ${props => props.theme.spacing(1)} 0 auto 0;
|
|
1265
|
-
& svg {
|
|
1266
|
-
height: 100%;
|
|
1267
|
-
width: ${props => props.theme.spacing(10)};
|
|
1268
|
-
color: white;
|
|
1269
|
-
}
|
|
1270
|
-
`;
|
|
1271
|
-
const Statistic = ({ icon, value, label, backgroundColor, smallerValue }) => (React.createElement(Wrapper$5, { backgroundColor: backgroundColor },
|
|
1272
|
-
React.createElement(IconWrapper, null, icon),
|
|
1273
|
-
React.createElement(Box, { flexGrow: 1, textAlign: "right" },
|
|
1274
|
-
React.createElement(Label$2, null, label),
|
|
1275
|
-
React.createElement(Value, { smallerValue: smallerValue }, value))));
|
|
1276
|
-
|
|
1277
|
-
const StyledBox$2 = styledComponents.styled(Box) `
|
|
1278
|
-
|
|
1279
|
-
padding: ${props => props.theme.spacing(2.5, 5)};
|
|
1280
|
-
|
|
1281
|
-
${props => !props.isActive && styledComponents.css `
|
|
1282
|
-
cursor: pointer;
|
|
1283
|
-
color: #337ab7;
|
|
1284
|
-
&:hover,
|
|
1285
|
-
&:focus {
|
|
1286
|
-
color: #23527c;
|
|
1287
|
-
text-decoration: underline;
|
|
1288
|
-
}
|
|
1289
|
-
`}
|
|
1290
|
-
|
|
1291
|
-
${props => props.isActive && styledComponents.css `
|
|
1292
|
-
font-weight: bold;
|
|
1293
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
1294
|
-
border-bottom: 0px;
|
|
1295
|
-
margin-bottom: -1px;
|
|
1296
|
-
border-top-left-radius: 4px;
|
|
1297
|
-
border-top-right-radius: 4px;
|
|
1298
|
-
background-color: ${props => props.theme.palette.common.white};
|
|
1299
|
-
`}
|
|
1300
|
-
|
|
1301
|
-
${props => props.variant && `
|
|
1302
|
-
font-weight: bold;
|
|
1303
|
-
color: ${props.theme.palette.form[props.variant]};
|
|
1304
|
-
&:hover {
|
|
1305
|
-
color: ${props.theme.palette.form[props.variant]};
|
|
1306
|
-
}
|
|
1307
|
-
`}
|
|
1308
|
-
|
|
1309
|
-
`;
|
|
1310
|
-
const Tab = (_a) => {
|
|
1311
|
-
var { id, isActive, onClick } = _a, restProps = __rest(_a, ["id", "isActive", "onClick"]);
|
|
1312
|
-
const handleClick = React.useCallback(() => {
|
|
1313
|
-
if (!isActive) {
|
|
1314
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(id);
|
|
1315
|
-
}
|
|
1316
|
-
}, [id, isActive, onClick]);
|
|
1317
|
-
return React.createElement(StyledBox$2, Object.assign({}, restProps, { onClick: handleClick, isActive: isActive }));
|
|
1318
|
-
};
|
|
1319
|
-
|
|
1320
|
-
const StyledBox$1 = styledComponents.styled(Box) `
|
|
1321
|
-
background-color: ${props => props.theme.palette.common.white};
|
|
1322
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
1323
|
-
border-top: 0px;
|
|
1324
|
-
`;
|
|
1325
|
-
const TabContent = (props) => React.createElement(StyledBox$1, Object.assign({ p: 3 }, props));
|
|
1326
|
-
|
|
1327
|
-
const Tabs = styledComponents.styled(Box) `
|
|
1328
|
-
display: flex;
|
|
1329
|
-
border-bottom: 1px solid rgba(34,36,38,.15);
|
|
1330
|
-
`;
|
|
1331
|
-
|
|
1332
|
-
const FlatPanel = styledComponents.styled(Panel) `
|
|
1333
|
-
box-shadow: none;
|
|
1334
|
-
`;
|
|
1335
|
-
const Wrapper$4 = styledComponents.styled(Box) `
|
|
1336
|
-
display: flex;
|
|
1337
|
-
|
|
1338
|
-
&:last-of-type .line:before {
|
|
1339
|
-
background: none;
|
|
1340
|
-
}
|
|
1341
|
-
`;
|
|
1342
|
-
const Line = styledComponents.styled(Box) `
|
|
1343
|
-
position: relative;
|
|
1344
|
-
margin-right: ${props => props.theme.spacing(4)};
|
|
1345
|
-
top: 4px;
|
|
1346
|
-
|
|
1347
|
-
&:before {
|
|
1348
|
-
background: #e7eaec;
|
|
1349
|
-
content: '';
|
|
1350
|
-
position: absolute;
|
|
1351
|
-
top: 0;
|
|
1352
|
-
left: ${props => props.theme.spacing(4.5)};
|
|
1353
|
-
height: 100%;
|
|
1354
|
-
width: ${props => props.theme.spacing(1)};
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
`;
|
|
1358
|
-
const Circle = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1359
|
-
position: relative;
|
|
1360
|
-
background-color: ${props => props.color};
|
|
1361
|
-
color: #fff;
|
|
1362
|
-
|
|
1363
|
-
left: 0;
|
|
1364
|
-
width: ${props => props.theme.spacing(10)};
|
|
1365
|
-
height: ${props => props.theme.spacing(10)};
|
|
1366
|
-
border-radius: 50%;
|
|
1367
|
-
font-size: ${props => props.theme.spacing(4)};
|
|
1368
|
-
|
|
1369
|
-
& > * {
|
|
1370
|
-
position: absolute;
|
|
1371
|
-
top: 50%;
|
|
1372
|
-
left: 50%;
|
|
1373
|
-
transform: translate(-50%, -50%);
|
|
1374
|
-
}
|
|
1375
|
-
`;
|
|
1376
|
-
const Timeline = ({ title, icon, color, isInitiallyOpen, titleMeta, chevron, children }) => (React.createElement(Wrapper$4, null,
|
|
1377
|
-
React.createElement(Line, null,
|
|
1378
|
-
React.createElement(Circle, { color: color }, icon)),
|
|
1379
|
-
React.createElement(Box, { pb: 4, flexGrow: 1 },
|
|
1380
|
-
React.createElement(CollapsiblePanel, { isInitiallyOpen: isInitiallyOpen, titleMeta: titleMeta, title: title, titleAction: chevron }, children))));
|
|
1381
|
-
const SimpleTimeline = ({ color, icon, title, titleMeta }) => (React.createElement(Wrapper$4, null,
|
|
1382
|
-
React.createElement(Line, { className: 'line' },
|
|
1383
|
-
React.createElement(Circle, { color: color }, icon)),
|
|
1384
|
-
React.createElement(Box, { pb: 4, flexGrow: 1 },
|
|
1385
|
-
React.createElement(FlatPanel, { titleMeta: titleMeta, title: title }))));
|
|
1386
|
-
|
|
1387
|
-
const StyledBox = styledComponents.styled(Box) `
|
|
1388
|
-
background-color: #FFFFFF;
|
|
1389
|
-
border-bottom: 1px solid #DDDDDD;
|
|
1390
|
-
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.04);
|
|
1391
|
-
box-sizing: border-box;
|
|
1392
|
-
`;
|
|
1393
|
-
const TopBar = ({ left, right }) => (React.createElement(StyledBox, null,
|
|
1394
|
-
React.createElement(Box, { display: "flex", alignItems: "center", pb: 1, pt: 1, pr: 5, pl: { mobile: 5, laptop: 5 + SIDEBAR_COLLAPSED_WIDTH } },
|
|
1395
|
-
React.createElement(Box, { flexGrow: 1, display: "flex", pl: 2 }, left),
|
|
1396
|
-
React.createElement(Box, { flexGrow: 1, display: "flex", justifyContent: 'flex-end' }, right))));
|
|
1397
|
-
|
|
1398
|
-
const Label$1 = styledComponents.styled.label `
|
|
1399
|
-
position: relative;
|
|
1400
|
-
`;
|
|
1401
|
-
const Input$1 = styledComponents.styled.input.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1402
|
-
position: absolute;
|
|
1403
|
-
top: 0;
|
|
1404
|
-
left: 0;
|
|
1405
|
-
|
|
1406
|
-
width: 17px;
|
|
1407
|
-
height: 17px;
|
|
1408
|
-
|
|
1409
|
-
z-index: 99;
|
|
1410
|
-
opacity: 0;
|
|
1411
|
-
margin-right: ${props => props.theme.spacing(2)};
|
|
1412
|
-
transform: translateY(1px);
|
|
1413
|
-
|
|
1414
|
-
&~span {
|
|
1415
|
-
user-select: none;
|
|
1416
|
-
padding-left: 1.85714em;
|
|
1417
|
-
cursor: pointer;
|
|
1418
|
-
font-size: .92857143em;
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
&~span:before, &~span:after {
|
|
1422
|
-
position: absolute;
|
|
1423
|
-
top: 0;
|
|
1424
|
-
left: 0;
|
|
1425
|
-
width: 17px;
|
|
1426
|
-
height: 17px;
|
|
1427
|
-
line-height: 17px;
|
|
1428
|
-
content: '';
|
|
1429
|
-
border-radius: 4px;
|
|
1430
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
1431
|
-
z-index:0;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
&:checked~span {
|
|
1435
|
-
font-style: italic;
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
&:checked~span:before {
|
|
1439
|
-
background: #fff;
|
|
1440
|
-
border-color: rgba(34,36,38,.35);
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
&:checked~span:after {
|
|
1444
|
-
font-style: normal;
|
|
1445
|
-
text-align: center;
|
|
1446
|
-
content: '\\2714';
|
|
1447
|
-
opacity: 1;
|
|
1448
|
-
color: ${props => props.theme.palette.common.black}
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
&:focus~span:before, &:focus~span:after {
|
|
1452
|
-
border-color: #85b7d9;
|
|
1453
|
-
border-radius: 4px;
|
|
1454
|
-
background: #fff;
|
|
1455
|
-
box-shadow: 0 0 0 0 rgba(34,36,38,.35) inset;
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
&.error~span {
|
|
1459
|
-
color: ${props => props.theme.palette.form.error};
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
&.error~span:before, &.error~span:after {
|
|
1463
|
-
background: #fff6f6;
|
|
1464
|
-
border-color: #e0b4b4;
|
|
1465
|
-
color: #9f3a38;
|
|
1466
|
-
}
|
|
1467
|
-
`;
|
|
1468
|
-
const Span = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1469
|
-
${props => props.dimmed ? styledComponents.css `color: #999c9e;` : ''}
|
|
1470
|
-
`;
|
|
1471
|
-
const Checkbox = React.forwardRef((_a, ref) => {
|
|
1472
|
-
var { options, spacing = 1, name, dimmed } = _a, restProps = __rest(_a, ["options", "spacing", "name", "dimmed"]);
|
|
1473
|
-
return (React.createElement(React.Fragment, null, Object.entries(options).map(([value, label]) => (React.createElement(Box, { key: value, mt: spacing, mb: spacing },
|
|
1474
|
-
React.createElement(Label$1, { key: value },
|
|
1475
|
-
React.createElement(Input$1, Object.assign({ type: "checkbox", value: value, name: name, ref: ref }, restProps)),
|
|
1476
|
-
React.createElement(Span, { dimmed: dimmed }, label)))))));
|
|
1477
|
-
});
|
|
1478
|
-
|
|
1479
|
-
const sharedStyles = styledComponents.css `
|
|
1480
|
-
padding: .67857143em 1em;
|
|
1481
|
-
line-height: 1.21428571em;
|
|
1482
|
-
border-radius: 4px;
|
|
1483
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
1484
|
-
|
|
1485
|
-
color: ${props => props.theme.palette.common.black};
|
|
1486
|
-
font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
1487
|
-
|
|
1488
|
-
font-size: 1em;
|
|
1489
|
-
outline: none;
|
|
1490
|
-
|
|
1491
|
-
&:disabled, &:read-only {
|
|
1492
|
-
background-color: #FAFAFA;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
&:focus {
|
|
1496
|
-
color: rgba(0,0,0,.95);
|
|
1497
|
-
border-color: #85b7d9;
|
|
1498
|
-
background: #fff;
|
|
1499
|
-
box-shadow: 0 0 0 0 rgba(34,36,38,.35) inset;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
&.error {
|
|
1503
|
-
background: #fff6f6;
|
|
1504
|
-
border-color: #e0b4b4;
|
|
1505
|
-
color: #9f3a38;
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
&.error:focus {
|
|
1509
|
-
background: #fff6f6;
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
&:focus::placeholder {
|
|
1513
|
-
color:rgba(115,115,115,.87)
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
&::placeholder {
|
|
1517
|
-
color:rgba(191,191,191,.87);
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
&.error::placeholder {
|
|
1521
|
-
color: #e7bdbc;
|
|
1522
|
-
}
|
|
1523
|
-
|
|
1524
|
-
&.error:focus::placeholder {
|
|
1525
|
-
color: #da9796;
|
|
1526
|
-
}
|
|
1527
|
-
`;
|
|
1528
|
-
const Input = styledComponents.styled.input.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1529
|
-
${sharedStyles}
|
|
1530
|
-
`;
|
|
1531
|
-
const Textarea = styledComponents.styled.textarea.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1532
|
-
${sharedStyles}
|
|
1533
|
-
height: 100%;
|
|
1534
|
-
`;
|
|
1535
|
-
const TextField = React.forwardRef((_a, ref) => {
|
|
1536
|
-
var { multiline = false } = _a, restProps = __rest(_a, ["multiline"]);
|
|
1537
|
-
return multiline
|
|
1538
|
-
? React.createElement(Textarea, Object.assign({ ref: ref }, restProps))
|
|
1539
|
-
: React.createElement(Input, Object.assign({ ref: ref, type: "text" }, restProps));
|
|
1540
|
-
});
|
|
1541
|
-
|
|
1542
|
-
const Wrapper$3 = styledComponents.styled.div `
|
|
1543
|
-
position: relative;
|
|
1544
|
-
display: flex;
|
|
1545
|
-
`;
|
|
1546
|
-
const HiddenInput = styledComponents.styled.input.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1547
|
-
position: absolute;
|
|
1548
|
-
left: 0;
|
|
1549
|
-
right: 0;
|
|
1550
|
-
top: 0;
|
|
1551
|
-
bottom: 0;
|
|
1552
|
-
width: 100%;
|
|
1553
|
-
opacity:0;
|
|
1554
|
-
`;
|
|
1555
|
-
const StyledButton = styledComponents.styled(Button$1) `
|
|
1556
|
-
height: 40px;
|
|
1557
|
-
|
|
1558
|
-
.has-error & {
|
|
1559
|
-
background: #fff6f6;
|
|
1560
|
-
border-color: #e0b4b4;
|
|
1561
|
-
color: #9f3a38;
|
|
1562
|
-
}
|
|
1563
|
-
`;
|
|
1564
|
-
const StyledTextField = styledComponents.styled(TextField) `
|
|
1565
|
-
flex: 1;
|
|
1566
|
-
padding-right: ${props => props.theme.spacing(8)}
|
|
1567
|
-
`;
|
|
1568
|
-
const DeleteButton = styledComponents.styled.button `
|
|
1569
|
-
background-color: transparent;
|
|
1570
|
-
border: 0;
|
|
1571
|
-
outline: 0;
|
|
1572
|
-
padding: 0;
|
|
1573
|
-
|
|
1574
|
-
position: absolute;
|
|
1575
|
-
right: 0;
|
|
1576
|
-
height: 100%;
|
|
1577
|
-
|
|
1578
|
-
cursor: pointer;
|
|
1579
|
-
|
|
1580
|
-
&:after {
|
|
1581
|
-
box-sizing: border-box;
|
|
1582
|
-
|
|
1583
|
-
color: rgba(0, 0, 0, .3);
|
|
1584
|
-
content: "×";
|
|
1585
|
-
|
|
1586
|
-
text-align: center;
|
|
1587
|
-
vertical-align: middle;
|
|
1588
|
-
display: table-cell;
|
|
1589
|
-
|
|
1590
|
-
font-size: 20px;
|
|
1591
|
-
height: 38px;
|
|
1592
|
-
width: 38px;
|
|
1593
|
-
line-height: 38px;
|
|
1594
|
-
padding: 0 8px;
|
|
1595
|
-
}
|
|
1596
|
-
`;
|
|
1597
|
-
const FileField = React.forwardRef((_a, ref) => {
|
|
1598
|
-
var { className, placeholder, chooseFileLabel = "Choose file", changeFileLabel = "Change file", onClear } = _a, props = __rest(_a, ["className", "placeholder", "chooseFileLabel", "changeFileLabel", "onClear"]);
|
|
1599
|
-
const [originalRef, setOriginalRef] = React.useState();
|
|
1600
|
-
const [fileName, setFilename] = React.useState("");
|
|
1601
|
-
const handleChange = React.useCallback((e) => {
|
|
1602
|
-
var _a;
|
|
1603
|
-
const files = (e === null || e === void 0 ? void 0 : e.target).files;
|
|
1604
|
-
setFilename(((_a = files === null || files === void 0 ? void 0 : files[0]) === null || _a === void 0 ? void 0 : _a.name) || "");
|
|
1605
|
-
}, []);
|
|
1606
|
-
const handleRemove = React.useCallback(() => {
|
|
1607
|
-
if (originalRef) {
|
|
1608
|
-
originalRef.value = '';
|
|
1609
|
-
originalRef.files = null;
|
|
1610
|
-
originalRef.dispatchEvent(new Event('change', { bubbles: true }));
|
|
1611
|
-
if (onClear) {
|
|
1612
|
-
onClear();
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
}, [originalRef, onClear]);
|
|
1616
|
-
const extendedRef = React.useMemo(() => (el) => {
|
|
1617
|
-
el === null || el === void 0 ? void 0 : el.addEventListener('change', handleChange);
|
|
1618
|
-
setOriginalRef(el);
|
|
1619
|
-
if (typeof ref === 'function') {
|
|
1620
|
-
ref === null || ref === void 0 ? void 0 : ref(el);
|
|
1621
|
-
}
|
|
1622
|
-
}, [ref, handleChange]);
|
|
1623
|
-
return (React.createElement(Wrapper$3, null,
|
|
1624
|
-
React.createElement(HiddenInput, Object.assign({ type: 'file', ref: extendedRef }, props)),
|
|
1625
|
-
React.createElement(StyledButton, { variant: 'basic' }, !!fileName ? changeFileLabel : chooseFileLabel),
|
|
1626
|
-
React.createElement(StyledTextField, { placeholder: placeholder, className: className, disabled: true, value: fileName }),
|
|
1627
|
-
!!fileName && onClear && React.createElement(DeleteButton, { "data-testid": 'file-clear', onClick: handleRemove })));
|
|
1628
|
-
});
|
|
1629
|
-
|
|
1630
|
-
const Wrapper$2 = styledComponents.styled.div `
|
|
1631
|
-
position: relative;
|
|
1632
|
-
`;
|
|
1633
|
-
const StyledSelect = styledComponents.styled.select.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1634
|
-
width: 100%;
|
|
1635
|
-
|
|
1636
|
-
padding: .67857143em 1em;
|
|
1637
|
-
line-height: 1.21428571em;
|
|
1638
|
-
border-radius: 4px;
|
|
1639
|
-
border: 1px solid rgba(34,36,38,.15);
|
|
1640
|
-
|
|
1641
|
-
color: ${props => props.theme.palette.common.black};
|
|
1642
|
-
font-family: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
1643
|
-
|
|
1644
|
-
font-size: 1em;
|
|
1645
|
-
outline: none;
|
|
1646
|
-
|
|
1647
|
-
appearance: none;
|
|
1648
|
-
|
|
1649
|
-
&.error {
|
|
1650
|
-
background: #fff6f6;
|
|
1651
|
-
border-color: #e0b4b4;
|
|
1652
|
-
color: #9f3a38;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
&.error~div {
|
|
1656
|
-
color: #9f3a38;
|
|
1657
|
-
}
|
|
1658
|
-
`;
|
|
1659
|
-
const PaddingOverlay = styledComponents.styled.div `
|
|
1660
|
-
pointer-events: none;
|
|
1661
|
-
padding: 0 1em;
|
|
1662
|
-
position:absolute;
|
|
1663
|
-
height: 100%;
|
|
1664
|
-
top: 0;
|
|
1665
|
-
right: 0;
|
|
1666
|
-
font-size: 17px;
|
|
1667
|
-
line-height: 40px;
|
|
1668
|
-
`;
|
|
1669
|
-
const Select = React.forwardRef((_a, ref) => {
|
|
1670
|
-
var { options } = _a, props = __rest(_a, ["options"]);
|
|
1671
|
-
const optionsArray = Array.isArray(options)
|
|
1672
|
-
? options
|
|
1673
|
-
: Object.entries(options);
|
|
1674
|
-
return (React.createElement(Wrapper$2, null,
|
|
1675
|
-
React.createElement(StyledSelect, Object.assign({ ref: ref }, props), optionsArray.map(([value, label]) => (React.createElement("option", { key: value, value: value }, label)))),
|
|
1676
|
-
React.createElement(PaddingOverlay, null, "\u25BE")));
|
|
1677
|
-
});
|
|
1678
|
-
|
|
1679
|
-
const passwordMinLength = (val) => val.length >= 8;
|
|
1680
|
-
const passwordHasNumbers = (val) => /\d/.test(val);
|
|
1681
|
-
const passwordHasLowerAndUppercase = (val) => /[a-z]/.test(val) && /[A-Z]/.test(val);
|
|
1682
|
-
const passwordHasSpecialChars = (val) => /[-’/`~!#*$@_%+=.,^&(){}[\]|;:”<>?\\]/.test(val);
|
|
1683
|
-
const checks = [passwordMinLength, passwordHasNumbers, passwordHasLowerAndUppercase, passwordHasSpecialChars];
|
|
1684
|
-
const maxScore = checks.length + 1;
|
|
1685
|
-
const calculatePasswordScore = (val) => checks
|
|
1686
|
-
.map((check) => check(val))
|
|
1687
|
-
.reduce((acc, value) => value
|
|
1688
|
-
? acc + 1
|
|
1689
|
-
: acc, 1);
|
|
1690
|
-
const Progress = styledComponents.styled.div `
|
|
1691
|
-
margin-top: ${props => props.theme.spacing(1)};
|
|
1692
|
-
height: 3px;
|
|
1693
|
-
background-color: #f5f5f5;
|
|
1694
|
-
border-radius: 4px;
|
|
1695
|
-
box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
|
|
1696
|
-
`;
|
|
1697
|
-
const ProgressBar = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1698
|
-
width: ${props => props.score ? (props.score / maxScore) * 100 : 0}%;
|
|
1699
|
-
height: 100%;
|
|
1700
|
-
background-color: ${props => props.score <= 2 ? '#e90f10' : props.score <= 3 ? '#ffad00' : '#02b502'} ;
|
|
1701
|
-
transition: width .6s ease, background-color .6s ease;
|
|
1702
|
-
`;
|
|
1703
|
-
const PasswordStrengthField = React.forwardRef((props, ref) => {
|
|
1704
|
-
const [score, setScore] = React.useState(0);
|
|
1705
|
-
const handleChange = React.useCallback((e) => {
|
|
1706
|
-
const target = e.target;
|
|
1707
|
-
setScore(target.value ? calculatePasswordScore(target.value) : 0);
|
|
1708
|
-
}, []);
|
|
1709
|
-
const extendedRef = React.useMemo(() => (el) => {
|
|
1710
|
-
el === null || el === void 0 ? void 0 : el.addEventListener('keyup', handleChange);
|
|
1711
|
-
if (typeof ref === 'function') {
|
|
1712
|
-
ref === null || ref === void 0 ? void 0 : ref(el);
|
|
1713
|
-
}
|
|
1714
|
-
}, [ref, handleChange]);
|
|
1715
|
-
return React.createElement(React.Fragment, null,
|
|
1716
|
-
React.createElement(TextField, Object.assign({}, props, { type: "password", ref: extendedRef })),
|
|
1717
|
-
React.createElement(Progress, null,
|
|
1718
|
-
React.createElement(ProgressBar, { score: score })));
|
|
1719
|
-
});
|
|
1720
|
-
|
|
1721
|
-
const NUM_ROWS_PER_FIELD = 2;
|
|
1722
|
-
// NOTE:
|
|
1723
|
-
//
|
|
1724
|
-
// We have to implement our own version of -ms-grid.
|
|
1725
|
-
// Styled-components does not automatically prefix it, as the specs do not completely overlap.
|
|
1726
|
-
// https://github.com/thysultan/stylis.js/issues/51
|
|
1727
|
-
//
|
|
1728
|
-
// We can achieve our goals using both specs though.
|
|
1729
|
-
const generateDimensionsCss = (position, rowOffset) => {
|
|
1730
|
-
const parts = [];
|
|
1731
|
-
if (position === undefined) {
|
|
1732
|
-
return parts;
|
|
1733
|
-
}
|
|
1734
|
-
if (position.row !== undefined) {
|
|
1735
|
-
parts.push(styledComponents.css `
|
|
1736
|
-
grid-row-start: ${(position.row * NUM_ROWS_PER_FIELD) + 1 + rowOffset};
|
|
1737
|
-
-ms-grid-row: ${(position.row * NUM_ROWS_PER_FIELD) + 1 + rowOffset};
|
|
1738
|
-
`);
|
|
1739
|
-
}
|
|
1740
|
-
if (position.rowSpan && rowOffset) {
|
|
1741
|
-
parts.push(styledComponents.css `
|
|
1742
|
-
grid-row-end: span ${(position.rowSpan * NUM_ROWS_PER_FIELD) - 1};
|
|
1743
|
-
-ms-grid-row-span: ${(position.rowSpan * NUM_ROWS_PER_FIELD) - 1};
|
|
1744
|
-
`);
|
|
1745
|
-
}
|
|
1746
|
-
if (position.column !== undefined) {
|
|
1747
|
-
parts.push(styledComponents.css `
|
|
1748
|
-
grid-column-start: ${position.column + 1};
|
|
1749
|
-
-ms-grid-column: ${position.column + 1};
|
|
1750
|
-
`);
|
|
1751
|
-
}
|
|
1752
|
-
if (position.columnSpan !== undefined) {
|
|
1753
|
-
parts.push(styledComponents.css `
|
|
1754
|
-
grid-column-end: span ${position.columnSpan};
|
|
1755
|
-
-ms-grid-column-span: ${position.columnSpan};
|
|
1756
|
-
`);
|
|
1757
|
-
}
|
|
1758
|
-
return parts;
|
|
1759
|
-
};
|
|
1760
|
-
const FormGridCell = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1761
|
-
margin: 0px 8px;
|
|
1762
|
-
|
|
1763
|
-
${props => props.rowOffset !== undefined && styledComponents.css `
|
|
1764
|
-
display: flex;
|
|
1765
|
-
flex-direction: column;
|
|
1766
|
-
margin-bottom: 16px;`}
|
|
1767
|
-
|
|
1768
|
-
align-self: ${props => props.rowOffset === undefined ? "end" : "initial"};
|
|
1769
|
-
-ms-grid-row-align: ${props => props.rowOffset === undefined ? "end" : "initial"};
|
|
1770
|
-
|
|
1771
|
-
${(props) => responsiveProps(props, {
|
|
1772
|
-
"align": unit => styledComponents.css `text-align: ${unit};`,
|
|
1773
|
-
"position": unit => { var _a; return generateDimensionsCss(unit, (_a = props.rowOffset) !== null && _a !== void 0 ? _a : 0); }
|
|
1774
|
-
})}
|
|
1775
|
-
`;
|
|
1776
|
-
FormGridCell.displayName = "FormGridCell";
|
|
1777
|
-
|
|
1778
|
-
const Label = styledComponents.styled.label.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1779
|
-
display: block;
|
|
1780
|
-
color: ${(props => !!props.error ? props.theme.palette.form.error : props.theme.palette.common.black)} ;
|
|
1781
|
-
font-weight: bold;
|
|
1782
|
-
margin: ${props => props.theme.spacing(0, 0, 1, 0)};
|
|
1783
|
-
line-height: 1.4em;
|
|
1784
|
-
font-size: .92857143em;
|
|
1785
|
-
`;
|
|
1786
|
-
const Hint = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1787
|
-
color: ${(props => !!props.error ? "#da9796;" : props.theme.palette.form.hint)};
|
|
1788
|
-
margin: ${props => props.theme.spacing(-1, 0, 1, 0)};
|
|
1789
|
-
line-height: 1.4em;
|
|
1790
|
-
font-size: .92857143em;
|
|
1791
|
-
`;
|
|
1792
|
-
const RequiredAsterisk = styledComponents.styled.span.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1793
|
-
color: ${props => props.theme.palette.form.hint};
|
|
1794
|
-
`;
|
|
1795
|
-
const Error$1 = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1796
|
-
color: ${props => props.theme.palette.form.error};
|
|
1797
|
-
margin: ${props => props.theme.spacing(1, 0, 0, 0)};
|
|
1798
|
-
font-weight: bold;
|
|
1799
|
-
font-style: italic;
|
|
1800
|
-
line-height: 1.4em;
|
|
1801
|
-
font-size: .92857143em;
|
|
1802
|
-
`;
|
|
1803
|
-
const getFormGridWrapperProps = ({ position, align, label, hint, error, isRequired }) => ({ position, align, label, hint, error, isRequired });
|
|
1804
|
-
const FormGridWrapper = ({ position, align, label, hint, error, isRequired, children }) => (React.createElement(React.Fragment, null,
|
|
1805
|
-
React.createElement(FormGridCell, { position: position, align: align, className: 'form-grid-cell__label-hint' },
|
|
1806
|
-
label && (React.createElement(Label, { error: error },
|
|
1807
|
-
label,
|
|
1808
|
-
isRequired && React.createElement(RequiredAsterisk, null, " *"))),
|
|
1809
|
-
hint && (React.createElement(Hint, { error: error }, hint))),
|
|
1810
|
-
React.createElement(FormGridCell, { position: position, align: align, rowOffset: 1, className: clsx({ 'form-grid-cell__field-error': true, 'has-error': !!error }) },
|
|
1811
|
-
children,
|
|
1812
|
-
error && (React.createElement(Error$1, null, error)))));
|
|
1813
|
-
|
|
1814
|
-
const FormGrid = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1815
|
-
margin: 0 -8px -16px -8px;
|
|
1816
|
-
|
|
1817
|
-
display: -ms-grid;
|
|
1818
|
-
display: grid;
|
|
1819
|
-
|
|
1820
|
-
-ms-grid-columns: 1fr;
|
|
1821
|
-
|
|
1822
|
-
${(props) => responsiveProps(props, {
|
|
1823
|
-
columns: (string) => styledComponents.css `
|
|
1824
|
-
-ms-grid-columns: ${string};
|
|
1825
|
-
grid-template-columns: ${string};
|
|
1826
|
-
`
|
|
1827
|
-
})}
|
|
1828
|
-
`;
|
|
1829
|
-
FormGrid.displayName = "FormGrid";
|
|
1830
|
-
|
|
1831
|
-
const Wrapper$1 = styledComponents.styled(Box) `
|
|
1832
|
-
background-color: #F3F3F4;
|
|
1833
|
-
`;
|
|
1834
|
-
const WrapperInner = styledComponents.styled(Box) `
|
|
1835
|
-
position: relative;
|
|
1836
|
-
`;
|
|
1837
|
-
const SidebarWrapper = styledComponents.styled(Box) `
|
|
1838
|
-
position: absolute;
|
|
1839
|
-
height: 100%;
|
|
1840
|
-
z-index: 50;
|
|
1841
|
-
pointer-events: none;
|
|
1842
|
-
`;
|
|
1843
|
-
const ContentBox = styledComponents.styled(Box) `
|
|
1844
|
-
height: 100%;
|
|
1845
|
-
`;
|
|
1846
|
-
const BasicLayout = ({ sideBarProps, topBarProps, footerProps, isLoading, loader, children }) => {
|
|
1847
|
-
return (React.createElement(Wrapper$1, { flexGrow: 1, display: "flex", flexDirection: "column" },
|
|
1848
|
-
React.createElement(WrapperInner, { flexGrow: 1, flexShrink: 0 },
|
|
1849
|
-
sideBarProps && (React.createElement(SidebarWrapper, null,
|
|
1850
|
-
React.createElement(SideBar, Object.assign({}, sideBarProps)))),
|
|
1851
|
-
React.createElement(ContentBox, { display: "flex", flexDirection: "column" },
|
|
1852
|
-
React.createElement(TopBar, Object.assign({}, topBarProps)),
|
|
1853
|
-
React.createElement(Box, { p: { laptop: VerticalRhythmLaptop, mobile: VerticalRhythmMobile }, pl: { laptop: VerticalRhythmLaptop + SIDEBAR_COLLAPSED_WIDTH }, flexGrow: 1 }, isLoading && loader
|
|
1854
|
-
? loader
|
|
1855
|
-
: children),
|
|
1856
|
-
React.createElement(Footer, Object.assign({}, footerProps))))));
|
|
1857
|
-
};
|
|
1858
|
-
|
|
1859
|
-
const Wrapper = styledComponents.styled(Box) `
|
|
1860
|
-
background-color: ${props => props.baseColor || 'white'};
|
|
1861
|
-
position: absolute;
|
|
1862
|
-
min-width: 100%;
|
|
1863
|
-
min-height: 100%;
|
|
1864
|
-
`;
|
|
1865
|
-
const Background = styledComponents.styled.div.withConfig({ shouldForwardProp: isPropValid }) `
|
|
1866
|
-
position: absolute;
|
|
1867
|
-
top: 0;
|
|
1868
|
-
left: 0;
|
|
1869
|
-
width: 100%;
|
|
1870
|
-
height: 100%;
|
|
1871
|
-
|
|
1872
|
-
opacity: ${props => { var _a; return (_a = props.opacity) !== null && _a !== void 0 ? _a : 1; }} ;
|
|
1873
|
-
background: url("${props => props.imageUrl}");
|
|
1874
|
-
background-size: cover;
|
|
1875
|
-
`;
|
|
1876
|
-
const StyledAnimation = styledComponents.styled(SlideInFromTop) `
|
|
1877
|
-
z-index: 10;
|
|
1878
|
-
margin: auto auto;
|
|
1879
|
-
`;
|
|
1880
|
-
const StyledPanel = styledComponents.styled(Panel) `
|
|
1881
|
-
box-shadow: 0 8px 8px 0 rgba(34,36,38,.15);
|
|
1882
|
-
min-width: 280px;
|
|
1883
|
-
`;
|
|
1884
|
-
const Logo = styledComponents.styled.img `
|
|
1885
|
-
display:none;
|
|
1886
|
-
position: absolute;
|
|
1887
|
-
left: 0;
|
|
1888
|
-
top: ${props => props.theme.spacing(8)};
|
|
1889
|
-
${mq("tablet", `display: block;`)}
|
|
1890
|
-
`;
|
|
1891
|
-
const FloatingPanelLayout = ({ panelProps, imageUrl, alert, logoUrl, backgroundBaseColor, backgroundOpacity }) => (React.createElement(Wrapper, { display: "flex", alignItems: "center", baseColor: backgroundBaseColor },
|
|
1892
|
-
React.createElement(Background, { imageUrl: imageUrl, opacity: backgroundOpacity }),
|
|
1893
|
-
logoUrl && (React.createElement(Logo, { src: logoUrl, alt: "Logo" })),
|
|
1894
|
-
React.createElement(StyledAnimation, null,
|
|
1895
|
-
alert && (React.createElement(Box, { pb: VerticalRhythmLaptop }, alert)),
|
|
1896
|
-
React.createElement(StyledPanel, Object.assign({}, panelProps)))));
|
|
1897
|
-
|
|
1898
|
-
/**
|
|
1899
|
-
* Two dimensional array grid.
|
|
1900
|
-
* Useful to position elements with.
|
|
1901
|
-
*
|
|
1902
|
-
* Example:
|
|
1903
|
-
*
|
|
1904
|
-
* new Grid([
|
|
1905
|
-
* [1,2,3],
|
|
1906
|
-
* [4,5,6],
|
|
1907
|
-
* [7,8,9]
|
|
1908
|
-
* ])
|
|
1909
|
-
*
|
|
1910
|
-
*/
|
|
1911
|
-
class Grid {
|
|
1912
|
-
constructor(grid) {
|
|
1913
|
-
this.grid = grid;
|
|
1914
|
-
}
|
|
1915
|
-
getValues() {
|
|
1916
|
-
return this.grid;
|
|
1917
|
-
}
|
|
1918
|
-
/**
|
|
1919
|
-
* Returns an array of distinct values in this grid
|
|
1920
|
-
*/
|
|
1921
|
-
getDistinctValues() {
|
|
1922
|
-
const values = [];
|
|
1923
|
-
this.grid.forEach((row) => {
|
|
1924
|
-
row.forEach((item) => {
|
|
1925
|
-
if (!values.includes(item)) {
|
|
1926
|
-
values.push(item);
|
|
1927
|
-
}
|
|
1928
|
-
});
|
|
1929
|
-
});
|
|
1930
|
-
return values;
|
|
1931
|
-
}
|
|
1932
|
-
sliceArea(topLeft, bottomRight) {
|
|
1933
|
-
if (topLeft.x > bottomRight.x || topLeft.y > bottomRight.y) {
|
|
1934
|
-
throw new Error("Coordinates are mixed up. Please ensure topLeft is actually in the top-left corner. And bottomRight is actually in the bottom-right corner");
|
|
1935
|
-
}
|
|
1936
|
-
return new Grid(this.grid
|
|
1937
|
-
.slice(topLeft.y, bottomRight.y + 1)
|
|
1938
|
-
.map(row => row.slice(topLeft.x, bottomRight.x + 1)));
|
|
1939
|
-
}
|
|
1940
|
-
getCoordinatesForValue(value) {
|
|
1941
|
-
const x = [];
|
|
1942
|
-
const y = [];
|
|
1943
|
-
this.grid.forEach((row, yIndex) => {
|
|
1944
|
-
row.forEach((item, xIndex) => {
|
|
1945
|
-
if (item === value) {
|
|
1946
|
-
x.push(xIndex);
|
|
1947
|
-
y.push(yIndex);
|
|
1948
|
-
}
|
|
1949
|
-
});
|
|
1950
|
-
});
|
|
1951
|
-
return {
|
|
1952
|
-
topLeft: { x: Math.min(...x), y: Math.min(...y) },
|
|
1953
|
-
bottomRight: { x: Math.max(...x), y: Math.max(...y) }
|
|
1954
|
-
};
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
/**
|
|
1959
|
-
* Makes sure all values in the grid have a rectangular shape.
|
|
1960
|
-
* We don't support Tetris types.
|
|
1961
|
-
*/
|
|
1962
|
-
const assertGridIsValid = (availableKeys, grid) => {
|
|
1963
|
-
const distinctValues = grid.getDistinctValues();
|
|
1964
|
-
// Check if all `availableKeys` have a place in the given grid
|
|
1965
|
-
if (distinctValues.length < availableKeys.length) {
|
|
1966
|
-
throw new Error(`Not all given fields are present in the grid. Please add these fields ${_difference(distinctValues, availableKeys).map(_ => `"${_}"`).join(", ")}`);
|
|
1967
|
-
}
|
|
1968
|
-
// We don't support tetris-shaped values:
|
|
1969
|
-
// E.g:
|
|
1970
|
-
// [
|
|
1971
|
-
// [1,1,1],
|
|
1972
|
-
// [0,1,0]
|
|
1973
|
-
// ]
|
|
1974
|
-
distinctValues.forEach((value) => {
|
|
1975
|
-
if (!availableKeys.includes(value)) {
|
|
1976
|
-
throw new Error(`${value} is not an existing field. Existing fields are ${availableKeys.map(_ => `"${_}"`).join(", ")}.`);
|
|
1977
|
-
}
|
|
1978
|
-
const coordinates = grid.getCoordinatesForValue(value);
|
|
1979
|
-
const subGrid = grid.sliceArea(coordinates.topLeft, coordinates.bottomRight);
|
|
1980
|
-
const subGridDistinctValues = subGrid.getDistinctValues();
|
|
1981
|
-
if (subGridDistinctValues.length !== 1 || subGridDistinctValues[0] !== value) {
|
|
1982
|
-
throw new Error(`Grid contains an unsupported shape. Please make sure "${value}" has a rectangular shape.`);
|
|
1983
|
-
}
|
|
1984
|
-
});
|
|
1985
|
-
return true;
|
|
1986
|
-
};
|
|
1987
|
-
|
|
1988
|
-
const equalColumns = (num, buttonGutter) => {
|
|
1989
|
-
const fractions = [...Array(num)].map(_ => "1fr");
|
|
1990
|
-
if (buttonGutter) {
|
|
1991
|
-
fractions.push("auto");
|
|
1992
|
-
}
|
|
1993
|
-
return fractions.join(" ");
|
|
1994
|
-
};
|
|
1995
|
-
|
|
1996
|
-
class FormPositioner {
|
|
1997
|
-
constructor(fields, columns = {} // -> ignore property, its used to pass along internally.
|
|
1998
|
-
) {
|
|
1999
|
-
this.fields = fields;
|
|
2000
|
-
this.columns = columns;
|
|
2001
|
-
}
|
|
2002
|
-
/**
|
|
2003
|
-
* Position form elements responsively in a grid.
|
|
2004
|
-
* Example usage:
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2007
|
-
* .setGrid("laptop", [ // Breakpoint from laptop to bigger
|
|
2008
|
-
* ["title", "title", "title"], // NOTE: title has a colspan of 3
|
|
2009
|
-
* ["street", "number", "city"],
|
|
2010
|
-
* ["code", "description", "description"], // NOTE: description has a colspan of 2, and a rowspan of 2
|
|
2011
|
-
* ["status", "description", "description"]
|
|
2012
|
-
* ])
|
|
2013
|
-
* .setVertical("mobileS", 1) // NOTE: align everything in a single column for mobileS until laptop
|
|
2014
|
-
*
|
|
2015
|
-
*/
|
|
2016
|
-
setGrid(breakPoint, columns, arrayGrid) {
|
|
2017
|
-
// We save the columns setting in a different prop.
|
|
2018
|
-
if (typeof this.columns === "object") {
|
|
2019
|
-
this.columns[breakPoint] = columns;
|
|
2020
|
-
}
|
|
2021
|
-
// Wrap array grid in a Grid object.
|
|
2022
|
-
// It has some nice utility functions to work with.
|
|
2023
|
-
const grid = new Grid(arrayGrid);
|
|
2024
|
-
// Make sure the given grid is a valid grid:
|
|
2025
|
-
assertGridIsValid(Object.keys(this.fields), grid);
|
|
2026
|
-
// Update position attributes for the given fields:
|
|
2027
|
-
const fields = immer.produce(this.fields, draftState => {
|
|
2028
|
-
Object
|
|
2029
|
-
.keys(this.fields)
|
|
2030
|
-
.forEach(key => {
|
|
2031
|
-
const fieldProps = draftState[key].props;
|
|
2032
|
-
const { topLeft, bottomRight } = grid.getCoordinatesForValue(key);
|
|
2033
|
-
if (fieldProps.position === undefined) {
|
|
2034
|
-
fieldProps.position = {};
|
|
2035
|
-
}
|
|
2036
|
-
if (!isResponsiveObject(fieldProps.position)) {
|
|
2037
|
-
// When there already was a position set, but it wasn't marked responsive,
|
|
2038
|
-
// We set that value to the lowest breakpoint:
|
|
2039
|
-
fieldProps.position = { mobile: fieldProps.position };
|
|
2040
|
-
}
|
|
2041
|
-
// Set values to breakpoint.
|
|
2042
|
-
// @ts-ignore
|
|
2043
|
-
fieldProps.position[breakPoint] = {
|
|
2044
|
-
column: topLeft.x,
|
|
2045
|
-
columnSpan: bottomRight.x - topLeft.x + 1,
|
|
2046
|
-
row: topLeft.y,
|
|
2047
|
-
rowSpan: bottomRight.y - topLeft.y + 1
|
|
2048
|
-
};
|
|
2049
|
-
});
|
|
2050
|
-
});
|
|
2051
|
-
// Return a new formPositioner.
|
|
2052
|
-
// It allows us to chain, while still being immutable.
|
|
2053
|
-
return new FormPositioner(fields, this.columns);
|
|
2054
|
-
}
|
|
2055
|
-
/**
|
|
2056
|
-
* Aligns all input-fields vertically.
|
|
2057
|
-
*/
|
|
2058
|
-
setVertical(breakPoint, numColumns = 1, columns) {
|
|
2059
|
-
return this.setGrid(breakPoint, columns !== null && columns !== void 0 ? columns : equalColumns(numColumns, false), _chunk(Object.keys(this.fields), numColumns));
|
|
2060
|
-
}
|
|
2061
|
-
/**
|
|
2062
|
-
* Aligns all input-fields horizontally.
|
|
2063
|
-
*/
|
|
2064
|
-
setHorizontal(breakPoint, columns) {
|
|
2065
|
-
const keys = Object.keys(this.fields);
|
|
2066
|
-
return this.setGrid(breakPoint, columns !== null && columns !== void 0 ? columns : equalColumns(keys.length, false), [keys]);
|
|
2067
|
-
}
|
|
2068
|
-
getColumns() {
|
|
2069
|
-
return this.columns;
|
|
2070
|
-
}
|
|
2071
|
-
getFields() {
|
|
2072
|
-
return this.fields;
|
|
2073
|
-
}
|
|
2074
|
-
getScaffoldProps() {
|
|
2075
|
-
return {
|
|
2076
|
-
fields: this.fields,
|
|
2077
|
-
columns: this.columns
|
|
2078
|
-
};
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
const ScaffoldFormContext = React.createContext({ factory: undefined });
|
|
2083
|
-
const ScaffoldFormProvider = ({ factory, children }) => (React.createElement(ScaffoldFormContext.Provider, { value: { factory: factory } }, children));
|
|
2084
|
-
|
|
2085
|
-
const useScaffoldFormContext = () => React.useContext(ScaffoldFormContext);
|
|
2086
|
-
|
|
2087
|
-
const getComponent = (field) => {
|
|
2088
|
-
switch (field.type) {
|
|
2089
|
-
case "Button":
|
|
2090
|
-
return Button$1;
|
|
2091
|
-
case "Checkbox":
|
|
2092
|
-
return Checkbox;
|
|
2093
|
-
case "Select":
|
|
2094
|
-
return Select;
|
|
2095
|
-
case "FileField":
|
|
2096
|
-
return FileField;
|
|
2097
|
-
case "PasswordStrengthField":
|
|
2098
|
-
return PasswordStrengthField;
|
|
2099
|
-
case "TextField":
|
|
2100
|
-
default:
|
|
2101
|
-
return TextField;
|
|
2102
|
-
}
|
|
2103
|
-
};
|
|
2104
|
-
const ScaffoldField = React.forwardRef((_a, ref) => {
|
|
2105
|
-
var { name, field } = _a, restProps = __rest(_a, ["name", "field"]);
|
|
2106
|
-
const { factory } = useScaffoldFormContext();
|
|
2107
|
-
const formGridWrapperProps = getFormGridWrapperProps(field.props);
|
|
2108
|
-
const Component = (factory === null || factory === void 0 ? void 0 : factory(field)) || getComponent(field);
|
|
2109
|
-
// @ts-ignore
|
|
2110
|
-
if (field.type === "TextField" && field.props.type === "hidden") {
|
|
2111
|
-
return React.createElement(Component, Object.assign({ ref: ref, name: name }, restProps, field.props));
|
|
2112
|
-
}
|
|
2113
|
-
return (React.createElement(FormGridWrapper, Object.assign({}, formGridWrapperProps),
|
|
2114
|
-
React.createElement(Component, Object.assign({ ref: ref, name: name, placeholder: field.props.placeholder || formGridWrapperProps.label, className: clsx(!!formGridWrapperProps.error && 'error', field.props.className) }, restProps, field.props))));
|
|
2115
|
-
});
|
|
2116
|
-
|
|
2117
|
-
const ScaffoldForm = React.forwardRef((_a, ref) => {
|
|
2118
|
-
var { children, columns, fields, prefixFieldNames } = _a, restProps = __rest(_a, ["children", "columns", "fields", "prefixFieldNames"]);
|
|
2119
|
-
return (React.createElement(FormGrid, { columns: columns },
|
|
2120
|
-
Object
|
|
2121
|
-
.entries(fields)
|
|
2122
|
-
.map(([key, fieldProps]) => (
|
|
2123
|
-
// @ts-ignore
|
|
2124
|
-
React.createElement(ScaffoldField, Object.assign({ name: `${prefixFieldNames !== null && prefixFieldNames !== void 0 ? prefixFieldNames : ''}${key}`, key: key, field: fieldProps, ref: ref }, restProps)))),
|
|
2125
|
-
children));
|
|
2126
|
-
});
|
|
2127
|
-
|
|
2128
|
-
exports.Alert = Alert;
|
|
2129
|
-
exports.AnimatedCheckmark = AnimatedCheckmark;
|
|
2130
|
-
exports.BasicLayout = BasicLayout;
|
|
2131
|
-
exports.Box = Box;
|
|
2132
|
-
exports.BreadCrumbs = BreadCrumbs;
|
|
2133
|
-
exports.BreakPointValues = BreakPointValues;
|
|
2134
|
-
exports.Button = Button$1;
|
|
2135
|
-
exports.Checkbox = Checkbox;
|
|
2136
|
-
exports.CollapsiblePanel = CollapsiblePanel;
|
|
2137
|
-
exports.ConfirmButton = ConfirmButton;
|
|
2138
|
-
exports.ConfirmModal = ConfirmModal;
|
|
2139
|
-
exports.Crumb = Crumb;
|
|
2140
|
-
exports.Details = Details;
|
|
2141
|
-
exports.Dropdown = Dropdown;
|
|
2142
|
-
exports.DropdownMenu = DropdownMenu;
|
|
2143
|
-
exports.DropdownMenuItem = DropdownMenuItem;
|
|
2144
|
-
exports.Dropzone = Dropzone;
|
|
2145
|
-
exports.Feedback = Feedback;
|
|
2146
|
-
exports.FileField = FileField;
|
|
2147
|
-
exports.Floater = Floater;
|
|
2148
|
-
exports.FloatingPanelLayout = FloatingPanelLayout;
|
|
2149
|
-
exports.Footer = Footer;
|
|
2150
|
-
exports.FormGrid = FormGrid;
|
|
2151
|
-
exports.FormGridWrapper = FormGridWrapper;
|
|
2152
|
-
exports.FormPositioner = FormPositioner;
|
|
2153
|
-
exports.HamburgerButton = HamburgerButton;
|
|
2154
|
-
exports.Header = Header;
|
|
2155
|
-
exports.HorizontalScroller = HorizontalScroller;
|
|
2156
|
-
exports.Menu = Menu;
|
|
2157
|
-
exports.MenuCloseButton = MenuCloseButton;
|
|
2158
|
-
exports.MenuItem = MenuItem;
|
|
2159
|
-
exports.MenuSlideOpenIndicator = MenuSlideOpenIndicator;
|
|
2160
|
-
exports.Modal = Modal;
|
|
2161
|
-
exports.Overlay = Overlay;
|
|
2162
|
-
exports.Paginator = Paginator;
|
|
2163
|
-
exports.Panel = Panel;
|
|
2164
|
-
exports.Paragraph = Paragraph;
|
|
2165
|
-
exports.PasswordStrengthField = PasswordStrengthField;
|
|
2166
|
-
exports.ScaffoldForm = ScaffoldForm;
|
|
2167
|
-
exports.ScaffoldFormContext = ScaffoldFormContext;
|
|
2168
|
-
exports.ScaffoldFormProvider = ScaffoldFormProvider;
|
|
2169
|
-
exports.Section = Section;
|
|
2170
|
-
exports.Select = Select;
|
|
2171
|
-
exports.SideBarHeader = SideBarHeader;
|
|
2172
|
-
exports.SimpleTimeline = SimpleTimeline;
|
|
2173
|
-
exports.SlideInFromTop = SlideInFromTop;
|
|
2174
|
-
exports.Statistic = Statistic;
|
|
2175
|
-
exports.StyledTable = StyledTable;
|
|
2176
|
-
exports.Tab = Tab;
|
|
2177
|
-
exports.TabContent = TabContent;
|
|
2178
|
-
exports.Table = Table;
|
|
2179
|
-
exports.Tabs = Tabs;
|
|
2180
|
-
exports.TextField = TextField;
|
|
2181
|
-
exports.Timeline = Timeline;
|
|
2182
|
-
exports.TopBar = TopBar;
|
|
2183
|
-
exports.UiProvider = UiProvider;
|
|
2184
|
-
exports.UiWrapper = UiWrapper;
|
|
2185
|
-
exports.VerticalRhythmLaptop = VerticalRhythmLaptop;
|
|
2186
|
-
exports.VerticalRhythmMobile = VerticalRhythmMobile;
|
|
2187
|
-
exports.calculatePasswordScore = calculatePasswordScore;
|
|
2188
|
-
exports.getFormGridWrapperProps = getFormGridWrapperProps;
|
|
2189
|
-
exports.isResponsiveObject = isResponsiveObject;
|
|
2190
|
-
exports.mq = mq;
|
|
2191
|
-
exports.passwordHasLowerAndUppercase = passwordHasLowerAndUppercase;
|
|
2192
|
-
exports.passwordHasNumbers = passwordHasNumbers;
|
|
2193
|
-
exports.passwordHasSpecialChars = passwordHasSpecialChars;
|
|
2194
|
-
exports.passwordMinLength = passwordMinLength;
|
|
2195
|
-
exports.responsiveProps = responsiveProps;
|
|
2196
|
-
exports.theme = theme;
|
|
2197
|
-
exports.useCloseSidebarOnNavigate = useCloseSidebarOnNavigate;
|
|
2198
|
-
exports.useResponsiveBreakpoints = useResponsiveBreakpoints;
|
|
2199
|
-
exports.useToggleMobileMenu = useToggleMobileMenu;
|