pallote-react 0.3.10 → 0.4.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/README.md +0 -8
- package/dist/index.js +1411 -385
- package/package.json +40 -78
- package/LICENSE +0 -21
- package/dist/components/Accordion.js +0 -70
- package/dist/components/AccordionItem.js +0 -90
- package/dist/components/Alert.js +0 -86
- package/dist/components/Breadcrumbs.js +0 -40
- package/dist/components/Button.js +0 -64
- package/dist/components/Buttons.js +0 -43
- package/dist/components/Card.js +0 -75
- package/dist/components/CardActions.js +0 -34
- package/dist/components/CardContent.js +0 -34
- package/dist/components/CardHeader.js +0 -83
- package/dist/components/CardMedia.js +0 -48
- package/dist/components/Checkbox.js +0 -55
- package/dist/components/Checkboxes.js +0 -62
- package/dist/components/Chip.js +0 -59
- package/dist/components/Component.js +0 -38
- package/dist/components/Divider.js +0 -39
- package/dist/components/Grid.js +0 -73
- package/dist/components/Input.js +0 -89
- package/dist/components/Link.js +0 -42
- package/dist/components/List.js +0 -34
- package/dist/components/ListItem.js +0 -43
- package/dist/components/Loader.js +0 -45
- package/dist/components/Modal.js +0 -75
- package/dist/components/ModalActions.js +0 -31
- package/dist/components/ModalContent.js +0 -31
- package/dist/components/ModalHeader.js +0 -29
- package/dist/components/Nav.js +0 -39
- package/dist/components/NavBar.js +0 -53
- package/dist/components/NavGroup.js +0 -30
- package/dist/components/NavItem.js +0 -73
- package/dist/components/Page.js +0 -30
- package/dist/components/PageHeader.js +0 -57
- package/dist/components/Paragraph.js +0 -54
- package/dist/components/Radio.js +0 -57
- package/dist/components/RadioButtons.js +0 -62
- package/dist/components/Section.js +0 -57
- package/dist/components/SectionContent.js +0 -37
- package/dist/components/SectionHeader.js +0 -53
- package/dist/components/Select.js +0 -78
- package/dist/components/Snippet.js +0 -49
- package/dist/components/Status.js +0 -42
- package/dist/components/Step.js +0 -63
- package/dist/components/Stepper.js +0 -81
- package/dist/components/Switch.js +0 -56
- package/dist/components/Table.js +0 -55
- package/dist/components/TableBody.js +0 -30
- package/dist/components/TableCell.js +0 -46
- package/dist/components/TableFooter.js +0 -89
- package/dist/components/TableHead.js +0 -37
- package/dist/components/TableRow.js +0 -30
- package/dist/components/Tabs.js +0 -30
- package/dist/components/TabsContent.js +0 -28
- package/dist/components/TabsControl.js +0 -46
- package/dist/components/Tag.js +0 -42
- package/dist/components/Textarea.js +0 -79
- package/dist/components/Tooltip.js +0 -52
- package/dist/index.scss +0 -8
- package/dist/utilities/Color.js +0 -51
- package/dist/utilities/Display.js +0 -54
- package/dist/utilities/Text.js +0 -64
package/dist/index.js
CHANGED
|
@@ -1,390 +1,1416 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { useState, useEffect, createContext, useContext, useRef } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import { X, CalendarBlank, Clock, CaretUpDown, ArrowSquareOut, CaretDoubleLeft, CaretLeft, CaretRight, CaretDoubleRight } from '@phosphor-icons/react';
|
|
6
|
+
import SyntaxHighlighter from 'react-syntax-highlighter';
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
Object.defineProperty(exports, "Status", {
|
|
247
|
-
enumerable: true,
|
|
248
|
-
get: function get() {
|
|
249
|
-
return _Status.Status;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
Object.defineProperty(exports, "Switch", {
|
|
253
|
-
enumerable: true,
|
|
254
|
-
get: function get() {
|
|
255
|
-
return _Switch.Switch;
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
Object.defineProperty(exports, "Table", {
|
|
259
|
-
enumerable: true,
|
|
260
|
-
get: function get() {
|
|
261
|
-
return _Table.Table;
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
Object.defineProperty(exports, "TableBody", {
|
|
265
|
-
enumerable: true,
|
|
266
|
-
get: function get() {
|
|
267
|
-
return _TableBody.TableBody;
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
Object.defineProperty(exports, "TableCell", {
|
|
271
|
-
enumerable: true,
|
|
272
|
-
get: function get() {
|
|
273
|
-
return _TableCell.TableCell;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
Object.defineProperty(exports, "TableFooter", {
|
|
277
|
-
enumerable: true,
|
|
278
|
-
get: function get() {
|
|
279
|
-
return _TableFooter.TableFooter;
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
Object.defineProperty(exports, "TableHead", {
|
|
283
|
-
enumerable: true,
|
|
284
|
-
get: function get() {
|
|
285
|
-
return _TableHead.TableHead;
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
Object.defineProperty(exports, "TableRow", {
|
|
289
|
-
enumerable: true,
|
|
290
|
-
get: function get() {
|
|
291
|
-
return _TableRow.TableRow;
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
Object.defineProperty(exports, "Tabs", {
|
|
295
|
-
enumerable: true,
|
|
296
|
-
get: function get() {
|
|
297
|
-
return _Tabs.Tabs;
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
Object.defineProperty(exports, "TabsContent", {
|
|
301
|
-
enumerable: true,
|
|
302
|
-
get: function get() {
|
|
303
|
-
return _TabsContent.TabsContent;
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
Object.defineProperty(exports, "TabsControl", {
|
|
307
|
-
enumerable: true,
|
|
308
|
-
get: function get() {
|
|
309
|
-
return _TabsControl.TabsControl;
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
Object.defineProperty(exports, "Tag", {
|
|
313
|
-
enumerable: true,
|
|
314
|
-
get: function get() {
|
|
315
|
-
return _Tag.Tag;
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
Object.defineProperty(exports, "Text", {
|
|
319
|
-
enumerable: true,
|
|
320
|
-
get: function get() {
|
|
321
|
-
return _Text.Text;
|
|
8
|
+
const Color = ({
|
|
9
|
+
fill,
|
|
10
|
+
stroke,
|
|
11
|
+
customFill,
|
|
12
|
+
customStroke,
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const style = {
|
|
18
|
+
...(customFill ? {
|
|
19
|
+
backgroundColor: customFill
|
|
20
|
+
} : {}),
|
|
21
|
+
...(customStroke ? {
|
|
22
|
+
border: `1px solid ${customStroke}`
|
|
23
|
+
} : {})
|
|
24
|
+
};
|
|
25
|
+
const childClassName = classnames(children.props.className, className, {
|
|
26
|
+
[`fill-${fill}`]: fill,
|
|
27
|
+
[`stroke-${stroke}`]: stroke
|
|
28
|
+
});
|
|
29
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
30
|
+
className: childClassName,
|
|
31
|
+
style: {
|
|
32
|
+
...children.props.style,
|
|
33
|
+
...style
|
|
34
|
+
},
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
Color.propTypes = {
|
|
39
|
+
fill: PropTypes.oneOf(['main', 'contrast', 'grey90', 'grey80', 'grey70', 'grey60', 'grey50', 'grey40', 'grey30', 'grey20', 'grey10', 'grey5', 'default', 'paper', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
|
|
40
|
+
stroke: PropTypes.oneOf(['main', 'contrast', 'grey90', 'grey80', 'grey70', 'grey60', 'grey50', 'grey40', 'grey30', 'grey20', 'grey10', 'grey5', 'default', 'paper', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
|
|
41
|
+
customFill: PropTypes.string,
|
|
42
|
+
customStroke: PropTypes.string,
|
|
43
|
+
className: PropTypes.node,
|
|
44
|
+
children: PropTypes.node
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const viewportSizes = {
|
|
48
|
+
'mobile-sm': 375,
|
|
49
|
+
'mobile': 576,
|
|
50
|
+
'tablet': 768,
|
|
51
|
+
'laptop': 1024,
|
|
52
|
+
'desktop': 1280
|
|
53
|
+
};
|
|
54
|
+
const Display = ({
|
|
55
|
+
show,
|
|
56
|
+
hide,
|
|
57
|
+
children
|
|
58
|
+
}) => {
|
|
59
|
+
const [isDisplayed, setDisplayed] = useState(false);
|
|
60
|
+
const updateMedia = () => {
|
|
61
|
+
if (show === 'touch') {
|
|
62
|
+
setDisplayed(navigator.maxTouchPoints > 0);
|
|
63
|
+
} else if (hide === 'touch') {
|
|
64
|
+
setDisplayed(navigator.maxTouchPoints === 0);
|
|
65
|
+
} else {
|
|
66
|
+
const viewportValue = viewportSizes[show || hide];
|
|
67
|
+
if (show) {
|
|
68
|
+
setDisplayed(window.innerWidth <= viewportValue);
|
|
69
|
+
} else if (hide) {
|
|
70
|
+
setDisplayed(window.innerWidth > viewportValue);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
updateMedia();
|
|
76
|
+
window.addEventListener('resize', updateMedia);
|
|
77
|
+
return () => window.removeEventListener('resize', updateMedia);
|
|
78
|
+
}, [show, hide]);
|
|
79
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isDisplayed ? children : null);
|
|
80
|
+
};
|
|
81
|
+
Display.propTypes = {
|
|
82
|
+
show: PropTypes.oneOf(['mobile-sm', 'mobile', 'tablet', 'laptop', 'desktop', 'touch']),
|
|
83
|
+
hide: PropTypes.oneOf(['mobile-sm', 'mobile', 'tablet', 'laptop', 'desktop', 'touch']),
|
|
84
|
+
children: PropTypes.node
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function _extends() {
|
|
88
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
89
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
90
|
+
var t = arguments[e];
|
|
91
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
92
|
+
}
|
|
93
|
+
return n;
|
|
94
|
+
}, _extends.apply(null, arguments);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const Grid = ({
|
|
98
|
+
item,
|
|
99
|
+
wrap,
|
|
100
|
+
direction,
|
|
101
|
+
justify,
|
|
102
|
+
items,
|
|
103
|
+
self,
|
|
104
|
+
gap,
|
|
105
|
+
col,
|
|
106
|
+
colxs,
|
|
107
|
+
colsm,
|
|
108
|
+
colmd,
|
|
109
|
+
collg,
|
|
110
|
+
colxl,
|
|
111
|
+
className,
|
|
112
|
+
children,
|
|
113
|
+
...props
|
|
114
|
+
}) => {
|
|
115
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
116
|
+
className: classnames('flex', {
|
|
117
|
+
'flex-wrap': wrap,
|
|
118
|
+
[`direction-${direction}`]: direction,
|
|
119
|
+
[`justify-${justify}`]: justify,
|
|
120
|
+
[`items-${items}`]: items,
|
|
121
|
+
[`slef-${self}`]: self,
|
|
122
|
+
[`col-${col}`]: col,
|
|
123
|
+
[`col-xs-${colxs}`]: colxs,
|
|
124
|
+
[`col-sm-${colsm}`]: colsm,
|
|
125
|
+
[`col-md-${colmd}`]: colmd,
|
|
126
|
+
[`col-lg-${collg}`]: collg,
|
|
127
|
+
[`col-xl-${colxl}`]: colxl,
|
|
128
|
+
[`gap-${gap}`]: gap
|
|
129
|
+
}, className)
|
|
130
|
+
}, props), children);
|
|
131
|
+
};
|
|
132
|
+
Grid.propTypes = {
|
|
133
|
+
item: PropTypes.bool,
|
|
134
|
+
wrap: PropTypes.bool,
|
|
135
|
+
direction: PropTypes.oneOf(['column', 'columnReverse', 'row', 'rowReverse']),
|
|
136
|
+
justify: PropTypes.oneOf(['center', 'end', 'start', 'spaceAround', 'spaceBetween', 'spaceEvenly']),
|
|
137
|
+
items: PropTypes.oneOf(['stretch', 'center', 'end', 'start', 'baseline']),
|
|
138
|
+
self: PropTypes.oneOf(['stretch', 'center', 'end', 'start', 'baseline']),
|
|
139
|
+
col: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
140
|
+
colxs: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
141
|
+
colsm: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
142
|
+
colmd: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
143
|
+
collg: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
144
|
+
colxl: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
145
|
+
gap: PropTypes.oneOf([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
|
146
|
+
className: PropTypes.node,
|
|
147
|
+
children: PropTypes.node
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const Text = ({
|
|
151
|
+
variant,
|
|
152
|
+
align,
|
|
153
|
+
weight,
|
|
154
|
+
transform,
|
|
155
|
+
italic,
|
|
156
|
+
underline,
|
|
157
|
+
strikeThrough,
|
|
158
|
+
code,
|
|
159
|
+
color,
|
|
160
|
+
component,
|
|
161
|
+
className,
|
|
162
|
+
children,
|
|
163
|
+
...props
|
|
164
|
+
}) => {
|
|
165
|
+
const Component = component || 'p';
|
|
166
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
167
|
+
className: classnames([{
|
|
168
|
+
[`${variant}`]: variant,
|
|
169
|
+
[`text-${align}`]: align,
|
|
170
|
+
[`text-${weight}`]: weight,
|
|
171
|
+
[`text-${transform}`]: transform,
|
|
172
|
+
[`text-${color}`]: color,
|
|
173
|
+
'text-italic': italic,
|
|
174
|
+
'text-underline': underline,
|
|
175
|
+
'text-strikeThrough': strikeThrough,
|
|
176
|
+
'text-code': code
|
|
177
|
+
}, className])
|
|
178
|
+
}, props), children);
|
|
179
|
+
};
|
|
180
|
+
Text.propTypes = {
|
|
181
|
+
variant: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle', 'body', 'caption', 'overline']),
|
|
182
|
+
align: PropTypes.oneOf(['left', 'center', 'right', 'justify']),
|
|
183
|
+
weight: PropTypes.oneOf(['regular', 'bold']),
|
|
184
|
+
transform: PropTypes.oneOf(['none', 'capitalize', 'uppercase', 'lowercase', 'initial', 'inherit']),
|
|
185
|
+
italic: PropTypes.bool,
|
|
186
|
+
underline: PropTypes.bool,
|
|
187
|
+
strikeThrough: PropTypes.bool,
|
|
188
|
+
code: PropTypes.bool,
|
|
189
|
+
color: PropTypes.oneOf(['default', 'alt', 'disabled', 'contrast', 'contrastAlt', 'contrastDisabled', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
|
|
190
|
+
component: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'label', 'legend']),
|
|
191
|
+
className: PropTypes.node,
|
|
192
|
+
children: PropTypes.node
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const Alert = ({
|
|
196
|
+
color = 'success',
|
|
197
|
+
variant = 'toast',
|
|
198
|
+
title,
|
|
199
|
+
subtitle,
|
|
200
|
+
dense,
|
|
201
|
+
noIcon,
|
|
202
|
+
show,
|
|
203
|
+
onClose,
|
|
204
|
+
className,
|
|
205
|
+
...props
|
|
206
|
+
}) => {
|
|
207
|
+
const [shouldRender, setRender] = useState(show);
|
|
208
|
+
const [container] = useState(() => {
|
|
209
|
+
let el = document.getElementById('alerts');
|
|
210
|
+
if (!el) {
|
|
211
|
+
el = document.createElement('div');
|
|
212
|
+
el.id = 'alerts';
|
|
213
|
+
document.body.appendChild(el);
|
|
214
|
+
}
|
|
215
|
+
return el;
|
|
216
|
+
});
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
if (show) setRender(true);
|
|
219
|
+
}, [show]);
|
|
220
|
+
const onAnimationEnd = () => {
|
|
221
|
+
if (!show) setRender(false);
|
|
222
|
+
};
|
|
223
|
+
let alert = /*#__PURE__*/React.createElement("div", _extends({
|
|
224
|
+
className: classnames(['alert', {
|
|
225
|
+
[`alert-${color}`]: color,
|
|
226
|
+
[`alert-${variant}`]: variant,
|
|
227
|
+
'alert-slideIn': show,
|
|
228
|
+
'alert-slideOut': !show,
|
|
229
|
+
'alert-dense': dense,
|
|
230
|
+
'alert-noIcon': noIcon
|
|
231
|
+
}, className]),
|
|
232
|
+
onAnimationEnd: onAnimationEnd
|
|
233
|
+
}, props), /*#__PURE__*/React.createElement("div", {
|
|
234
|
+
className: classnames('alert_content')
|
|
235
|
+
}, title ? /*#__PURE__*/React.createElement(Text, {
|
|
236
|
+
className: classnames('alert_title'),
|
|
237
|
+
variant: dense ? 'caption' : 'body',
|
|
238
|
+
weight: "bold"
|
|
239
|
+
}, title) : null, subtitle ? /*#__PURE__*/React.createElement(Text, {
|
|
240
|
+
variant: dense ? 'overline' : 'caption',
|
|
241
|
+
className: classnames('alert_subtitle')
|
|
242
|
+
}, subtitle) : null), onClose ? /*#__PURE__*/React.createElement(X, {
|
|
243
|
+
className: classnames('alert_close'),
|
|
244
|
+
onClick: onClose,
|
|
245
|
+
size: dense ? 14 : 16
|
|
246
|
+
}) : null);
|
|
247
|
+
if (variant === 'notice') {
|
|
248
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, alert);
|
|
249
|
+
} else {
|
|
250
|
+
return /*#__PURE__*/createPortal(shouldRender && alert, container);
|
|
322
251
|
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
252
|
+
};
|
|
253
|
+
Alert.propTypes = {
|
|
254
|
+
color: PropTypes.oneOf(['success', 'info', 'warning', 'error']),
|
|
255
|
+
variant: PropTypes.oneOf(['bar', 'toast', 'notice']),
|
|
256
|
+
title: PropTypes.string,
|
|
257
|
+
subtitle: PropTypes.string,
|
|
258
|
+
dense: PropTypes.bool,
|
|
259
|
+
noIcon: PropTypes.bool,
|
|
260
|
+
show: PropTypes.bool,
|
|
261
|
+
onClose: PropTypes.func,
|
|
262
|
+
className: PropTypes.node
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const Breadcrumbs = ({
|
|
266
|
+
items,
|
|
267
|
+
separator = "slash",
|
|
268
|
+
className
|
|
269
|
+
}) => /*#__PURE__*/React.createElement("nav", {
|
|
270
|
+
"aria-label": "breadcrumbs",
|
|
271
|
+
className: classnames(['breadcrumbs', {
|
|
272
|
+
[`breadcrumbs-${separator}`]: separator
|
|
273
|
+
}, className])
|
|
274
|
+
}, /*#__PURE__*/React.createElement("ol", null, items.map((item, index) => /*#__PURE__*/React.createElement("li", {
|
|
275
|
+
key: index,
|
|
276
|
+
className: "breadcrumbs_item"
|
|
277
|
+
}, index === items.length - 1 ? /*#__PURE__*/React.createElement("p", {
|
|
278
|
+
"aria-current": "page"
|
|
279
|
+
}, item.label) : /*#__PURE__*/React.createElement("a", {
|
|
280
|
+
href: item.href
|
|
281
|
+
}, item.label)))));
|
|
282
|
+
Breadcrumbs.propTypes = {
|
|
283
|
+
items: PropTypes.array,
|
|
284
|
+
separator: PropTypes.oneOf(['slash', 'arrow']),
|
|
285
|
+
className: PropTypes.node
|
|
286
|
+
};
|
|
287
|
+
Breadcrumbs.defaultProps = {};
|
|
288
|
+
|
|
289
|
+
const Button = /*#__PURE__*/React.forwardRef(({
|
|
290
|
+
component = 'button',
|
|
291
|
+
kind,
|
|
292
|
+
variant = 'fill',
|
|
293
|
+
size = 'md',
|
|
294
|
+
color = 'primary',
|
|
295
|
+
fullWidth,
|
|
296
|
+
disabled,
|
|
297
|
+
iconLeft,
|
|
298
|
+
iconRight,
|
|
299
|
+
className,
|
|
300
|
+
children = 'button',
|
|
301
|
+
...props
|
|
302
|
+
}, ref) => {
|
|
303
|
+
const Component = component || 'button';
|
|
304
|
+
let content;
|
|
305
|
+
if (kind === 'icon') {
|
|
306
|
+
content = children;
|
|
307
|
+
} else {
|
|
308
|
+
content = /*#__PURE__*/React.createElement(React.Fragment, null, iconLeft && iconLeft, children, iconRight && iconRight);
|
|
328
309
|
}
|
|
310
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
311
|
+
className: classnames(['button', {
|
|
312
|
+
[`button-${size}`]: size,
|
|
313
|
+
[`button-${color}`]: color,
|
|
314
|
+
[`button-${kind}`]: kind,
|
|
315
|
+
[`button-${variant}`]: variant,
|
|
316
|
+
'button-fullWidth': fullWidth,
|
|
317
|
+
'button-disabled': disabled
|
|
318
|
+
}, className]),
|
|
319
|
+
ref: ref,
|
|
320
|
+
disabled: Component === 'button' ? disabled : undefined
|
|
321
|
+
}, props), content);
|
|
329
322
|
});
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
323
|
+
Button.displayName = 'Button';
|
|
324
|
+
Button.propTypes = {
|
|
325
|
+
component: PropTypes.oneOfType([PropTypes.oneOf(['button', 'a']), PropTypes.elementType]),
|
|
326
|
+
kind: PropTypes.oneOf(['text', 'icon']),
|
|
327
|
+
variant: PropTypes.oneOf(['fill', 'stroke', 'transparent']),
|
|
328
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
|
|
329
|
+
color: PropTypes.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error', 'main', 'contrast']),
|
|
330
|
+
fullWidth: PropTypes.bool,
|
|
331
|
+
disabled: PropTypes.bool,
|
|
332
|
+
iconLeft: PropTypes.node,
|
|
333
|
+
iconRight: PropTypes.node,
|
|
334
|
+
className: PropTypes.node,
|
|
335
|
+
children: PropTypes.node
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
const Buttons = ({
|
|
339
|
+
direction = 'landscape',
|
|
340
|
+
fullWidth,
|
|
341
|
+
wide,
|
|
342
|
+
className,
|
|
343
|
+
children,
|
|
344
|
+
...props
|
|
345
|
+
}) => {
|
|
346
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
347
|
+
className: classnames(['buttons', {
|
|
348
|
+
[`buttons-${direction}`]: direction,
|
|
349
|
+
'buttons-fullWidth': fullWidth,
|
|
350
|
+
'buttons-wide': wide
|
|
351
|
+
}, className])
|
|
352
|
+
}, props), children);
|
|
353
|
+
};
|
|
354
|
+
Buttons.propTypes = {
|
|
355
|
+
direction: PropTypes.oneOf(['landscape', 'portrait']),
|
|
356
|
+
fullWidth: PropTypes.bool,
|
|
357
|
+
wide: PropTypes.bool,
|
|
358
|
+
className: PropTypes.node,
|
|
359
|
+
children: PropTypes.node
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
const SizeContext = /*#__PURE__*/createContext('md');
|
|
363
|
+
const Card = ({
|
|
364
|
+
size = 'md',
|
|
365
|
+
fill = 'paper',
|
|
366
|
+
direction = 'portrait',
|
|
367
|
+
align = 'left',
|
|
368
|
+
hasShadow = false,
|
|
369
|
+
transparent = false,
|
|
370
|
+
className,
|
|
371
|
+
children,
|
|
372
|
+
...props
|
|
373
|
+
}) => {
|
|
374
|
+
return /*#__PURE__*/React.createElement(SizeContext.Provider, {
|
|
375
|
+
value: size
|
|
376
|
+
}, /*#__PURE__*/React.createElement(Color, {
|
|
377
|
+
fill: transparent ? null : fill
|
|
378
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
379
|
+
className: classnames(['card', {
|
|
380
|
+
[`card-${size}`]: size,
|
|
381
|
+
[`card-${direction}`]: direction,
|
|
382
|
+
[`card-${align}`]: align,
|
|
383
|
+
'card-hasShadow': hasShadow,
|
|
384
|
+
'card-transparent': transparent
|
|
385
|
+
}, className])
|
|
386
|
+
}, props), children)));
|
|
387
|
+
};
|
|
388
|
+
Card.propTypes = {
|
|
389
|
+
size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
|
390
|
+
fill: PropTypes.oneOf(['default', 'paper', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
|
|
391
|
+
direction: PropTypes.oneOf(['portrait', 'landscape']),
|
|
392
|
+
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
393
|
+
hasShadow: PropTypes.bool,
|
|
394
|
+
transparent: PropTypes.bool,
|
|
395
|
+
className: PropTypes.node,
|
|
396
|
+
children: PropTypes.node
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
const CardActions = ({
|
|
400
|
+
direction,
|
|
401
|
+
className,
|
|
402
|
+
children,
|
|
403
|
+
...props
|
|
404
|
+
}) => {
|
|
405
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
406
|
+
className: classnames(['card_actions', {
|
|
407
|
+
[`card_actions-${direction}`]: direction
|
|
408
|
+
}, className])
|
|
409
|
+
}, props), children);
|
|
410
|
+
};
|
|
411
|
+
CardActions.propTypes = {
|
|
412
|
+
direction: PropTypes.oneOf(['portrait', 'landscape']),
|
|
413
|
+
className: PropTypes.node,
|
|
414
|
+
children: PropTypes.node
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
const CardContent = ({
|
|
418
|
+
fullWidth,
|
|
419
|
+
className,
|
|
420
|
+
children,
|
|
421
|
+
...props
|
|
422
|
+
}) => {
|
|
423
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
424
|
+
className: classnames(['card_content', {
|
|
425
|
+
'card_content-fullWidth': fullWidth
|
|
426
|
+
}, className])
|
|
427
|
+
}, props), children);
|
|
428
|
+
};
|
|
429
|
+
CardContent.propTypes = {
|
|
430
|
+
fullWidth: PropTypes.bool,
|
|
431
|
+
className: PropTypes.node,
|
|
432
|
+
children: PropTypes.node
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
const CardHeader = ({
|
|
436
|
+
label,
|
|
437
|
+
title,
|
|
438
|
+
subtitle,
|
|
439
|
+
actions,
|
|
440
|
+
className,
|
|
441
|
+
...props
|
|
442
|
+
}) => {
|
|
443
|
+
const useSize = () => useContext(SizeContext);
|
|
444
|
+
useSize();
|
|
445
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
446
|
+
className: classnames(['card_header', className])
|
|
447
|
+
}, props), actions && /*#__PURE__*/React.createElement("div", {
|
|
448
|
+
className: "card_headerActions"
|
|
449
|
+
}, actions), label ? /*#__PURE__*/React.createElement(Text, {
|
|
450
|
+
className: classnames('card_label')
|
|
451
|
+
}, label) : null, /*#__PURE__*/React.createElement(Text, {
|
|
452
|
+
className: classnames('card_title')
|
|
453
|
+
}, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
|
|
454
|
+
className: classnames('card_subtitle')
|
|
455
|
+
}, subtitle) : null);
|
|
456
|
+
};
|
|
457
|
+
CardHeader.propTypes = {
|
|
458
|
+
label: PropTypes.string,
|
|
459
|
+
title: PropTypes.string,
|
|
460
|
+
subtitle: PropTypes.string,
|
|
461
|
+
actions: PropTypes.node,
|
|
462
|
+
className: PropTypes.node,
|
|
463
|
+
children: PropTypes.node
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const CardMedia = ({
|
|
467
|
+
width,
|
|
468
|
+
height,
|
|
469
|
+
image,
|
|
470
|
+
fullWidth,
|
|
471
|
+
className,
|
|
472
|
+
...props
|
|
473
|
+
}) => {
|
|
474
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
475
|
+
className: classnames(['card_media', {
|
|
476
|
+
'card_media-fullWidth': fullWidth
|
|
477
|
+
}, className])
|
|
478
|
+
}, props), /*#__PURE__*/React.createElement("div", {
|
|
479
|
+
className: 'card_mediaInner',
|
|
480
|
+
style: {
|
|
481
|
+
width: width + 'px',
|
|
482
|
+
paddingBottom: height,
|
|
483
|
+
backgroundImage: `url(${image})`
|
|
484
|
+
}
|
|
485
|
+
}));
|
|
486
|
+
};
|
|
487
|
+
CardMedia.propTypes = {
|
|
488
|
+
width: PropTypes.number,
|
|
489
|
+
height: PropTypes.number,
|
|
490
|
+
image: PropTypes.string,
|
|
491
|
+
fullWidth: PropTypes.bool,
|
|
492
|
+
className: PropTypes.node
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
const Checkbox = ({
|
|
496
|
+
id,
|
|
497
|
+
value,
|
|
498
|
+
label,
|
|
499
|
+
checked,
|
|
500
|
+
disabled,
|
|
501
|
+
optional,
|
|
502
|
+
className,
|
|
503
|
+
...props
|
|
504
|
+
}) => {
|
|
505
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
506
|
+
className: classnames(['checkbox', {
|
|
507
|
+
'checkbox-disabled': disabled
|
|
508
|
+
}, className])
|
|
509
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
510
|
+
className: classnames('checkbox_control'),
|
|
511
|
+
type: "checkbox",
|
|
512
|
+
name: id,
|
|
513
|
+
id: id,
|
|
514
|
+
value: value,
|
|
515
|
+
checked: checked,
|
|
516
|
+
"aria-checked": checked,
|
|
517
|
+
disabled: disabled,
|
|
518
|
+
required: !(disabled || optional)
|
|
519
|
+
}, props)), /*#__PURE__*/React.createElement("label", {
|
|
520
|
+
className: classnames('checkbox_label'),
|
|
521
|
+
htmlFor: id
|
|
522
|
+
}, label));
|
|
523
|
+
};
|
|
524
|
+
Checkbox.propTypes = {
|
|
525
|
+
id: PropTypes.string,
|
|
526
|
+
value: PropTypes.string,
|
|
527
|
+
label: PropTypes.string,
|
|
528
|
+
checked: PropTypes.bool,
|
|
529
|
+
disabled: PropTypes.bool,
|
|
530
|
+
optional: PropTypes.bool,
|
|
531
|
+
className: PropTypes.node
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
const Checkboxes = ({
|
|
535
|
+
onChange,
|
|
536
|
+
id,
|
|
537
|
+
label = 'Label',
|
|
538
|
+
direction = 'portrait',
|
|
539
|
+
error,
|
|
540
|
+
disabled,
|
|
541
|
+
optional,
|
|
542
|
+
hint,
|
|
543
|
+
children,
|
|
544
|
+
className
|
|
545
|
+
}) => {
|
|
546
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
547
|
+
className: classnames(['input', {
|
|
548
|
+
'js-error': error,
|
|
549
|
+
'input-disabled': disabled,
|
|
550
|
+
'input-optional': optional
|
|
551
|
+
}, className]),
|
|
552
|
+
onChange: onChange,
|
|
553
|
+
"aria-description": hint
|
|
554
|
+
}, label && /*#__PURE__*/React.createElement("legend", {
|
|
555
|
+
className: 'input_label',
|
|
556
|
+
htmlFor: id
|
|
557
|
+
}, label), hint && /*#__PURE__*/React.createElement("p", {
|
|
558
|
+
className: 'input_hint'
|
|
559
|
+
}, hint), /*#__PURE__*/React.createElement("div", {
|
|
560
|
+
className: classnames(['input_control', 'radios', {
|
|
561
|
+
[`radios-${direction}`]: direction
|
|
562
|
+
}])
|
|
563
|
+
}, React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
|
|
564
|
+
optional,
|
|
565
|
+
disabled
|
|
566
|
+
}) : child)));
|
|
567
|
+
};
|
|
568
|
+
Checkboxes.propTypes = {
|
|
569
|
+
onChange: PropTypes.func,
|
|
570
|
+
id: PropTypes.string,
|
|
571
|
+
label: PropTypes.string,
|
|
572
|
+
direction: PropTypes.oneOf(['portrait', 'landscape']),
|
|
573
|
+
error: PropTypes.bool,
|
|
574
|
+
disabled: PropTypes.bool,
|
|
575
|
+
optional: PropTypes.bool,
|
|
576
|
+
hint: PropTypes.string,
|
|
577
|
+
children: PropTypes.node,
|
|
578
|
+
className: PropTypes.node
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
const Divider = ({
|
|
582
|
+
direction = 'landscape',
|
|
583
|
+
padding = 'md',
|
|
584
|
+
className,
|
|
585
|
+
...props
|
|
586
|
+
}) => {
|
|
587
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
588
|
+
className: classnames(['divider', {
|
|
589
|
+
[`divider-${direction}`]: direction,
|
|
590
|
+
[`divider-${padding}`]: padding
|
|
591
|
+
}, className])
|
|
592
|
+
}, props));
|
|
593
|
+
};
|
|
594
|
+
Divider.propTypes = {
|
|
595
|
+
direction: PropTypes.oneOf(['landscape', 'portrait']),
|
|
596
|
+
padding: PropTypes.oneOf(['none', 'sm', 'md', 'lg']),
|
|
597
|
+
className: PropTypes.node
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
const Input = ({
|
|
601
|
+
onChange,
|
|
602
|
+
type = 'text',
|
|
603
|
+
id,
|
|
604
|
+
placeholder,
|
|
605
|
+
label = 'Input',
|
|
606
|
+
icon,
|
|
607
|
+
isFocused,
|
|
608
|
+
error,
|
|
609
|
+
disabled,
|
|
610
|
+
optional,
|
|
611
|
+
hint,
|
|
612
|
+
className,
|
|
613
|
+
...props
|
|
614
|
+
}) => {
|
|
615
|
+
const inputRef = useRef(null);
|
|
616
|
+
useEffect(() => {
|
|
617
|
+
if (isFocused && inputRef.current) {
|
|
618
|
+
inputRef.current.focus();
|
|
619
|
+
}
|
|
620
|
+
}, [isFocused]);
|
|
621
|
+
const customIcon = icon || type === 'date' && /*#__PURE__*/React.createElement(CalendarBlank, null) || type === 'time' && /*#__PURE__*/React.createElement(Clock, null) || type === 'number' && /*#__PURE__*/React.createElement(CaretUpDown, null);
|
|
622
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
623
|
+
className: classnames(['input', {
|
|
624
|
+
'js-error': error,
|
|
625
|
+
'input-disabled': disabled,
|
|
626
|
+
'input-optional': optional,
|
|
627
|
+
'input-withIcon': icon
|
|
628
|
+
}, className]),
|
|
629
|
+
onChange: onChange
|
|
630
|
+
}, label && /*#__PURE__*/React.createElement("label", {
|
|
631
|
+
className: 'input_label',
|
|
632
|
+
htmlFor: id
|
|
633
|
+
}, label), hint && /*#__PURE__*/React.createElement("p", {
|
|
634
|
+
className: 'input_hint'
|
|
635
|
+
}, hint), customIcon && /*#__PURE__*/React.createElement("div", {
|
|
636
|
+
className: 'input_icon'
|
|
637
|
+
}, customIcon), /*#__PURE__*/React.createElement("input", _extends({
|
|
638
|
+
ref: inputRef,
|
|
639
|
+
type: type,
|
|
640
|
+
className: 'input_control',
|
|
641
|
+
name: id,
|
|
642
|
+
id: id,
|
|
643
|
+
placeholder: placeholder,
|
|
644
|
+
disabled: disabled,
|
|
645
|
+
required: !(disabled || optional),
|
|
646
|
+
"aria-description": hint
|
|
647
|
+
}, props)));
|
|
648
|
+
};
|
|
649
|
+
Input.propTypes = {
|
|
650
|
+
onChange: PropTypes.func,
|
|
651
|
+
type: PropTypes.oneOf(['date', 'email', 'number', 'tel', 'text', 'time']),
|
|
652
|
+
id: PropTypes.string,
|
|
653
|
+
placeholder: PropTypes.string,
|
|
654
|
+
label: PropTypes.string,
|
|
655
|
+
icon: PropTypes.node,
|
|
656
|
+
isFocused: PropTypes.bool,
|
|
657
|
+
error: PropTypes.bool,
|
|
658
|
+
disabled: PropTypes.bool,
|
|
659
|
+
optional: PropTypes.bool,
|
|
660
|
+
hint: PropTypes.string,
|
|
661
|
+
className: PropTypes.node
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
const Link = ({
|
|
665
|
+
component = 'a',
|
|
666
|
+
icon,
|
|
667
|
+
color,
|
|
668
|
+
isExternal,
|
|
669
|
+
href,
|
|
670
|
+
className,
|
|
671
|
+
children,
|
|
672
|
+
...props
|
|
673
|
+
}) => {
|
|
674
|
+
const Component = component || 'a';
|
|
675
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
676
|
+
className: classnames(['link', {
|
|
677
|
+
[`text-${color}`]: color
|
|
678
|
+
}, className]),
|
|
679
|
+
href: isExternal ? href : undefined,
|
|
680
|
+
target: isExternal ? '_blank' : undefined,
|
|
681
|
+
rel: isExternal ? 'noopener noreferrer' : undefined
|
|
682
|
+
}, props), children, icon && !isExternal && /*#__PURE__*/React.createElement("span", {
|
|
683
|
+
className: 'link_icon'
|
|
684
|
+
}, icon), isExternal && /*#__PURE__*/React.createElement("span", {
|
|
685
|
+
className: 'link_icon'
|
|
686
|
+
}, /*#__PURE__*/React.createElement(ArrowSquareOut, null)));
|
|
687
|
+
};
|
|
688
|
+
Link.propTypes = {
|
|
689
|
+
component: PropTypes.oneOfType(['a', PropTypes.elementType]),
|
|
690
|
+
icon: PropTypes.node,
|
|
691
|
+
color: PropTypes.oneOf(['default', 'alt', 'disabled', 'contrast', 'contrastAlt', 'contrastDisabled', 'primary', 'secondary', 'inherit']),
|
|
692
|
+
href: PropTypes.string,
|
|
693
|
+
className: PropTypes.node,
|
|
694
|
+
children: PropTypes.node
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
const List = ({
|
|
698
|
+
dense,
|
|
699
|
+
className,
|
|
700
|
+
children,
|
|
701
|
+
...props
|
|
702
|
+
}) => {
|
|
703
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
704
|
+
className: classnames(['list', {
|
|
705
|
+
'list-dense': dense
|
|
706
|
+
}, className])
|
|
707
|
+
}, props), children);
|
|
708
|
+
};
|
|
709
|
+
List.propTypes = {
|
|
710
|
+
dense: PropTypes.bool,
|
|
711
|
+
className: PropTypes.node,
|
|
712
|
+
children: PropTypes.node
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
const ListItem = ({
|
|
716
|
+
icon,
|
|
717
|
+
bold,
|
|
718
|
+
className,
|
|
719
|
+
children = 'List item',
|
|
720
|
+
...props
|
|
721
|
+
}) => {
|
|
722
|
+
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
723
|
+
className: classnames(['list_item', {
|
|
724
|
+
'list_item-bold': bold
|
|
725
|
+
}, className])
|
|
726
|
+
}, props), icon ? /*#__PURE__*/React.cloneElement(icon, {
|
|
727
|
+
className: `${icon.props.className ?? ''} list_itemIcon`
|
|
728
|
+
}) : null, children);
|
|
729
|
+
};
|
|
730
|
+
ListItem.propTypes = {
|
|
731
|
+
icon: PropTypes.node,
|
|
732
|
+
bold: PropTypes.bool,
|
|
733
|
+
className: PropTypes.node,
|
|
734
|
+
children: PropTypes.node
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
const Radio = ({
|
|
738
|
+
id,
|
|
739
|
+
name,
|
|
740
|
+
value,
|
|
741
|
+
label,
|
|
742
|
+
checked,
|
|
743
|
+
disabled,
|
|
744
|
+
optional,
|
|
745
|
+
className,
|
|
746
|
+
...props
|
|
747
|
+
}) => {
|
|
748
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
749
|
+
className: classnames(['radio', {
|
|
750
|
+
'radio-disabled': disabled
|
|
751
|
+
}, className])
|
|
752
|
+
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
753
|
+
className: classnames('radio_control'),
|
|
754
|
+
type: "radio",
|
|
755
|
+
id: id,
|
|
756
|
+
name: name,
|
|
757
|
+
value: value,
|
|
758
|
+
checked: checked,
|
|
759
|
+
"aria-checked": checked,
|
|
760
|
+
disabled: disabled,
|
|
761
|
+
required: !(disabled || optional)
|
|
762
|
+
}, props)), /*#__PURE__*/React.createElement("label", {
|
|
763
|
+
className: classnames('radio_label'),
|
|
764
|
+
htmlFor: id
|
|
765
|
+
}, label));
|
|
766
|
+
};
|
|
767
|
+
Radio.propTypes = {
|
|
768
|
+
id: PropTypes.string,
|
|
769
|
+
name: PropTypes.string,
|
|
770
|
+
value: PropTypes.string,
|
|
771
|
+
label: PropTypes.string,
|
|
772
|
+
checked: PropTypes.bool,
|
|
773
|
+
disabled: PropTypes.bool,
|
|
774
|
+
optional: PropTypes.bool,
|
|
775
|
+
className: PropTypes.node
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
const RadioButtons = ({
|
|
779
|
+
onChange,
|
|
780
|
+
id,
|
|
781
|
+
label = 'Label',
|
|
782
|
+
direction = 'portrait',
|
|
783
|
+
error,
|
|
784
|
+
disabled,
|
|
785
|
+
optional,
|
|
786
|
+
hint,
|
|
787
|
+
children,
|
|
788
|
+
className
|
|
789
|
+
}) => {
|
|
790
|
+
return /*#__PURE__*/React.createElement("fieldset", {
|
|
791
|
+
className: classnames(['input', {
|
|
792
|
+
'js-error': error,
|
|
793
|
+
'input-disabled': disabled,
|
|
794
|
+
'input-optional': optional
|
|
795
|
+
}, className]),
|
|
796
|
+
onChange: onChange,
|
|
797
|
+
"aria-description": hint
|
|
798
|
+
}, label && /*#__PURE__*/React.createElement("legend", {
|
|
799
|
+
className: 'input_label',
|
|
800
|
+
htmlFor: id
|
|
801
|
+
}, label), hint && /*#__PURE__*/React.createElement("p", {
|
|
802
|
+
className: 'input_hint'
|
|
803
|
+
}, hint), /*#__PURE__*/React.createElement("div", {
|
|
804
|
+
className: classnames(['input_control', 'radios', {
|
|
805
|
+
[`radios-${direction}`]: direction
|
|
806
|
+
}])
|
|
807
|
+
}, React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
|
|
808
|
+
optional,
|
|
809
|
+
disabled
|
|
810
|
+
}) : child)));
|
|
811
|
+
};
|
|
812
|
+
RadioButtons.propTypes = {
|
|
813
|
+
onChange: PropTypes.func,
|
|
814
|
+
id: PropTypes.string,
|
|
815
|
+
label: PropTypes.string,
|
|
816
|
+
direction: PropTypes.oneOf(['portrait', 'landscape']),
|
|
817
|
+
error: PropTypes.bool,
|
|
818
|
+
disabled: PropTypes.bool,
|
|
819
|
+
optional: PropTypes.bool,
|
|
820
|
+
hint: PropTypes.string,
|
|
821
|
+
children: PropTypes.node,
|
|
822
|
+
className: PropTypes.node
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
const SectionHeader = ({
|
|
826
|
+
label,
|
|
827
|
+
title,
|
|
828
|
+
promoteTitle = false,
|
|
829
|
+
titleComponent,
|
|
830
|
+
subtitle,
|
|
831
|
+
actions,
|
|
832
|
+
className,
|
|
833
|
+
...props
|
|
834
|
+
}) => {
|
|
835
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
836
|
+
className: classnames(['section_header', className])
|
|
837
|
+
}, props), label ? /*#__PURE__*/React.createElement(Text, {
|
|
838
|
+
className: classnames('section_label')
|
|
839
|
+
}, label) : null, /*#__PURE__*/React.createElement(Text, {
|
|
840
|
+
className: "section_title",
|
|
841
|
+
component: titleComponent || (promoteTitle ? 'h1' : 'h2')
|
|
842
|
+
}, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
|
|
843
|
+
className: classnames('section_subtitle')
|
|
844
|
+
}, subtitle) : null, actions ? /*#__PURE__*/React.createElement("div", {
|
|
845
|
+
className: "section_actions"
|
|
846
|
+
}, actions) : null);
|
|
847
|
+
};
|
|
848
|
+
SectionHeader.propTypes = {
|
|
849
|
+
label: PropTypes.string,
|
|
850
|
+
title: PropTypes.string.isRequired,
|
|
851
|
+
promoteTitle: PropTypes.bool,
|
|
852
|
+
titleComponent: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p']),
|
|
853
|
+
subtitle: PropTypes.string,
|
|
854
|
+
actions: PropTypes.node,
|
|
855
|
+
className: PropTypes.node
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
const Section = ({
|
|
859
|
+
align = 'left',
|
|
860
|
+
color = 'default',
|
|
861
|
+
landing,
|
|
862
|
+
header,
|
|
863
|
+
className,
|
|
864
|
+
children,
|
|
865
|
+
...props
|
|
866
|
+
}) => {
|
|
867
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
868
|
+
className: classnames(['section', {
|
|
869
|
+
[`section-${align}`]: align,
|
|
870
|
+
[`section-${color}`]: color,
|
|
871
|
+
'section-landing': landing,
|
|
872
|
+
'section-header': header
|
|
873
|
+
}, className])
|
|
874
|
+
}, props), /*#__PURE__*/React.createElement("div", {
|
|
875
|
+
className: 'section_container'
|
|
876
|
+
}, React.Children.map(children, child => {
|
|
877
|
+
if (/*#__PURE__*/React.isValidElement(child) && child.type === SectionHeader) {
|
|
878
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
879
|
+
promoteTitle: landing || header
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
return child;
|
|
883
|
+
})));
|
|
884
|
+
};
|
|
885
|
+
Section.propTypes = {
|
|
886
|
+
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
887
|
+
color: PropTypes.oneOf(['default', 'paper', 'primary', 'primaryLight']),
|
|
888
|
+
landing: PropTypes.bool,
|
|
889
|
+
header: PropTypes.bool,
|
|
890
|
+
className: PropTypes.node,
|
|
891
|
+
children: PropTypes.node
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
const SectionContent = ({
|
|
895
|
+
align = 'left',
|
|
896
|
+
className,
|
|
897
|
+
children,
|
|
898
|
+
...props
|
|
899
|
+
}) => {
|
|
900
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
901
|
+
className: classnames(['section_content', {
|
|
902
|
+
[`section_content-${align}`]: align
|
|
903
|
+
}, className])
|
|
904
|
+
}, props), children);
|
|
905
|
+
};
|
|
906
|
+
SectionContent.propTypes = {
|
|
907
|
+
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
908
|
+
className: PropTypes.node,
|
|
909
|
+
children: PropTypes.node
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
const Select = ({
|
|
913
|
+
onChange,
|
|
914
|
+
id,
|
|
915
|
+
label,
|
|
916
|
+
isFocused,
|
|
917
|
+
error,
|
|
918
|
+
disabled,
|
|
919
|
+
optional,
|
|
920
|
+
dense,
|
|
921
|
+
hint,
|
|
922
|
+
children,
|
|
923
|
+
className,
|
|
924
|
+
...props
|
|
925
|
+
}) => {
|
|
926
|
+
const inputRef = useRef(null);
|
|
927
|
+
useEffect(() => {
|
|
928
|
+
if (isFocused && inputRef.current) {
|
|
929
|
+
inputRef.current.focus();
|
|
930
|
+
}
|
|
931
|
+
}, [isFocused]);
|
|
932
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
933
|
+
className: classnames(['input', 'select', {
|
|
934
|
+
'input-focused': isFocused,
|
|
935
|
+
'js-error': error,
|
|
936
|
+
'input-disabled': disabled,
|
|
937
|
+
'input-optional': optional,
|
|
938
|
+
'input-dense': dense
|
|
939
|
+
}, className]),
|
|
940
|
+
onChange: onChange
|
|
941
|
+
}, label && /*#__PURE__*/React.createElement("label", {
|
|
942
|
+
className: 'input_label',
|
|
943
|
+
htmlFor: id
|
|
944
|
+
}, label), hint && /*#__PURE__*/React.createElement("p", {
|
|
945
|
+
className: 'input_hint'
|
|
946
|
+
}, hint), /*#__PURE__*/React.createElement("select", _extends({
|
|
947
|
+
ref: inputRef,
|
|
948
|
+
className: 'input_control',
|
|
949
|
+
name: id,
|
|
950
|
+
id: id,
|
|
951
|
+
disabled: disabled,
|
|
952
|
+
required: !(disabled || optional),
|
|
953
|
+
"aria-description": hint
|
|
954
|
+
}, props), children));
|
|
955
|
+
};
|
|
956
|
+
Select.propTypes = {
|
|
957
|
+
onChange: PropTypes.func,
|
|
958
|
+
id: PropTypes.string,
|
|
959
|
+
label: PropTypes.string,
|
|
960
|
+
isFocused: PropTypes.bool,
|
|
961
|
+
error: PropTypes.bool,
|
|
962
|
+
disabled: PropTypes.bool,
|
|
963
|
+
optional: PropTypes.bool,
|
|
964
|
+
dense: PropTypes.bool,
|
|
965
|
+
hint: PropTypes.string,
|
|
966
|
+
children: PropTypes.any,
|
|
967
|
+
className: PropTypes.node
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
var nnfxDark = {
|
|
971
|
+
"hljs": {
|
|
972
|
+
"display": "block",
|
|
973
|
+
"overflowX": "auto",
|
|
974
|
+
"padding": "0.5em",
|
|
975
|
+
"background": "#333",
|
|
976
|
+
"color": "#fff"
|
|
977
|
+
},
|
|
978
|
+
"xml .hljs-meta": {
|
|
979
|
+
"fontWeight": "bold",
|
|
980
|
+
"fontStyle": "italic",
|
|
981
|
+
"color": "#69f"
|
|
982
|
+
},
|
|
983
|
+
"hljs-comment": {
|
|
984
|
+
"fontStyle": "italic",
|
|
985
|
+
"color": "#9c6"
|
|
986
|
+
},
|
|
987
|
+
"hljs-quote": {
|
|
988
|
+
"fontStyle": "italic",
|
|
989
|
+
"color": "#9c6"
|
|
990
|
+
},
|
|
991
|
+
"hljs-name": {
|
|
992
|
+
"color": "#a7a",
|
|
993
|
+
"fontWeight": "bold"
|
|
994
|
+
},
|
|
995
|
+
"hljs-keyword": {
|
|
996
|
+
"color": "#a7a"
|
|
997
|
+
},
|
|
998
|
+
"hljs-attr": {
|
|
999
|
+
"fontWeight": "bold",
|
|
1000
|
+
"color": "#fff"
|
|
1001
|
+
},
|
|
1002
|
+
"hljs-string": {
|
|
1003
|
+
"fontWeight": "normal",
|
|
1004
|
+
"color": "#bce"
|
|
1005
|
+
},
|
|
1006
|
+
"hljs-variable": {
|
|
1007
|
+
"color": "#588"
|
|
1008
|
+
},
|
|
1009
|
+
"hljs-template-variable": {
|
|
1010
|
+
"color": "#588"
|
|
1011
|
+
},
|
|
1012
|
+
"hljs-code": {
|
|
1013
|
+
"color": "#bce"
|
|
1014
|
+
},
|
|
1015
|
+
"hljs-meta-string": {
|
|
1016
|
+
"color": "#bce"
|
|
1017
|
+
},
|
|
1018
|
+
"hljs-number": {
|
|
1019
|
+
"color": "#bce"
|
|
1020
|
+
},
|
|
1021
|
+
"hljs-regexp": {
|
|
1022
|
+
"color": "#bce"
|
|
1023
|
+
},
|
|
1024
|
+
"hljs-link": {
|
|
1025
|
+
"color": "#bce"
|
|
1026
|
+
},
|
|
1027
|
+
"hljs-title": {
|
|
1028
|
+
"color": "#d40"
|
|
1029
|
+
},
|
|
1030
|
+
"hljs-symbol": {
|
|
1031
|
+
"color": "#d40"
|
|
1032
|
+
},
|
|
1033
|
+
"hljs-bullet": {
|
|
1034
|
+
"color": "#d40"
|
|
1035
|
+
},
|
|
1036
|
+
"hljs-built_in": {
|
|
1037
|
+
"color": "#d40"
|
|
1038
|
+
},
|
|
1039
|
+
"hljs-builtin-name": {
|
|
1040
|
+
"color": "#d40"
|
|
1041
|
+
},
|
|
1042
|
+
"hljs-section": {
|
|
1043
|
+
"color": "#a85"
|
|
1044
|
+
},
|
|
1045
|
+
"hljs-meta": {
|
|
1046
|
+
"color": "#a85"
|
|
1047
|
+
},
|
|
1048
|
+
"hljs-class .hljs-title": {
|
|
1049
|
+
"color": "#96c"
|
|
1050
|
+
},
|
|
1051
|
+
"hljs-type": {
|
|
1052
|
+
"color": "#96c"
|
|
1053
|
+
},
|
|
1054
|
+
"hljs-function .hljs-title": {
|
|
1055
|
+
"color": "#fff"
|
|
1056
|
+
},
|
|
1057
|
+
"hljs-subst": {
|
|
1058
|
+
"color": "#fff"
|
|
1059
|
+
},
|
|
1060
|
+
"hljs-formula": {
|
|
1061
|
+
"backgroundColor": "#eee",
|
|
1062
|
+
"fontStyle": "italic"
|
|
1063
|
+
},
|
|
1064
|
+
"hljs-addition": {
|
|
1065
|
+
"backgroundColor": "#797"
|
|
1066
|
+
},
|
|
1067
|
+
"hljs-deletion": {
|
|
1068
|
+
"backgroundColor": "#c99"
|
|
1069
|
+
},
|
|
1070
|
+
"hljs-selector-id": {
|
|
1071
|
+
"color": "#964"
|
|
1072
|
+
},
|
|
1073
|
+
"hljs-selector-class": {
|
|
1074
|
+
"color": "#964"
|
|
1075
|
+
},
|
|
1076
|
+
"hljs-doctag": {
|
|
1077
|
+
"fontWeight": "bold"
|
|
1078
|
+
},
|
|
1079
|
+
"hljs-strong": {
|
|
1080
|
+
"fontWeight": "bold"
|
|
1081
|
+
},
|
|
1082
|
+
"hljs-emphasis": {
|
|
1083
|
+
"fontStyle": "italic"
|
|
334
1084
|
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
const Snippet = ({
|
|
1088
|
+
content = 'Snippet',
|
|
1089
|
+
isDefault = false,
|
|
1090
|
+
dense = false,
|
|
1091
|
+
className,
|
|
1092
|
+
...props
|
|
1093
|
+
}) => {
|
|
1094
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1095
|
+
className: classnames('snippet__wrapper')
|
|
1096
|
+
}, /*#__PURE__*/React.createElement(SyntaxHighlighter, _extends({
|
|
1097
|
+
language: "javascript",
|
|
1098
|
+
style: nnfxDark,
|
|
1099
|
+
className: classnames(['snippet', {
|
|
1100
|
+
' snippet--dense': dense
|
|
1101
|
+
}, {
|
|
1102
|
+
' snippet--default': isDefault
|
|
1103
|
+
}, className])
|
|
1104
|
+
}, props), content));
|
|
1105
|
+
};
|
|
1106
|
+
Snippet.propTypes = {
|
|
1107
|
+
content: PropTypes.string,
|
|
1108
|
+
isDefault: PropTypes.bool,
|
|
1109
|
+
dense: PropTypes.bool,
|
|
1110
|
+
className: PropTypes.node
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
const Status = ({
|
|
1114
|
+
color = 'inactive',
|
|
1115
|
+
dense,
|
|
1116
|
+
className,
|
|
1117
|
+
children = 'Status',
|
|
1118
|
+
...props
|
|
1119
|
+
}) => {
|
|
1120
|
+
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
1121
|
+
className: classnames(['status', {
|
|
1122
|
+
[`status-${color}`]: color,
|
|
1123
|
+
'status-dense': dense
|
|
1124
|
+
}, className])
|
|
1125
|
+
}, props), children);
|
|
1126
|
+
};
|
|
1127
|
+
Status.propTypes = {
|
|
1128
|
+
color: PropTypes.oneOf(['inactive', 'success', 'info', 'warning', 'error']),
|
|
1129
|
+
dense: PropTypes.bool,
|
|
1130
|
+
className: PropTypes.node,
|
|
1131
|
+
children: PropTypes.node
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
const Switch = ({
|
|
1135
|
+
id,
|
|
1136
|
+
startLabel,
|
|
1137
|
+
endLabel,
|
|
1138
|
+
disabled,
|
|
1139
|
+
className,
|
|
1140
|
+
...props
|
|
1141
|
+
}) => {
|
|
1142
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1143
|
+
className: classnames(['switch', {
|
|
1144
|
+
'switch-disabled': disabled
|
|
1145
|
+
}, className])
|
|
1146
|
+
}, startLabel ? /*#__PURE__*/React.createElement(Text, {
|
|
1147
|
+
className: classnames('switch_label'),
|
|
1148
|
+
variant: "body"
|
|
1149
|
+
}, startLabel) : null, /*#__PURE__*/React.createElement("input", _extends({
|
|
1150
|
+
className: classnames('switch_input'),
|
|
1151
|
+
type: "checkbox",
|
|
1152
|
+
name: id,
|
|
1153
|
+
id: id,
|
|
1154
|
+
disabled: disabled
|
|
1155
|
+
}, props)), /*#__PURE__*/React.createElement("label", {
|
|
1156
|
+
className: classnames('switch_switch'),
|
|
1157
|
+
htmlFor: id
|
|
1158
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1159
|
+
className: classnames('switch_toggle')
|
|
1160
|
+
})), endLabel ? /*#__PURE__*/React.createElement(Text, {
|
|
1161
|
+
className: classnames('switch_label'),
|
|
1162
|
+
variant: "body"
|
|
1163
|
+
}, endLabel) : null);
|
|
1164
|
+
};
|
|
1165
|
+
Switch.propTypes = {
|
|
1166
|
+
id: PropTypes.string,
|
|
1167
|
+
startLabel: PropTypes.string,
|
|
1168
|
+
endLabel: PropTypes.string,
|
|
1169
|
+
disabled: PropTypes.bool,
|
|
1170
|
+
className: PropTypes.node
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
const TableFooter = ({
|
|
1174
|
+
className,
|
|
1175
|
+
...props
|
|
1176
|
+
}) => {
|
|
1177
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
1178
|
+
className: classnames(['table_footer', className])
|
|
1179
|
+
}, props), /*#__PURE__*/React.createElement(Select, {
|
|
1180
|
+
dense: true,
|
|
1181
|
+
id: "rows",
|
|
1182
|
+
className: "table_rowSelect"
|
|
1183
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
1184
|
+
value: "1"
|
|
1185
|
+
}, "10"), /*#__PURE__*/React.createElement("option", {
|
|
1186
|
+
value: "2"
|
|
1187
|
+
}, "25"), /*#__PURE__*/React.createElement("option", {
|
|
1188
|
+
value: "2"
|
|
1189
|
+
}, "50"), /*#__PURE__*/React.createElement("option", {
|
|
1190
|
+
value: "2"
|
|
1191
|
+
}, "100"), /*#__PURE__*/React.createElement("option", {
|
|
1192
|
+
value: "2"
|
|
1193
|
+
}, "All")), /*#__PURE__*/React.createElement(Buttons, {
|
|
1194
|
+
className: "table_pagination"
|
|
1195
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1196
|
+
kind: "icon",
|
|
1197
|
+
variant: "transparent",
|
|
1198
|
+
size: "sm"
|
|
1199
|
+
}, /*#__PURE__*/React.createElement(CaretDoubleLeft, null)), /*#__PURE__*/React.createElement(Button, {
|
|
1200
|
+
kind: "icon",
|
|
1201
|
+
variant: "transparent",
|
|
1202
|
+
size: "sm"
|
|
1203
|
+
}, /*#__PURE__*/React.createElement(CaretLeft, null)), /*#__PURE__*/React.createElement(Button, {
|
|
1204
|
+
kind: "icon",
|
|
1205
|
+
size: "sm"
|
|
1206
|
+
}, "1"), /*#__PURE__*/React.createElement(Button, {
|
|
1207
|
+
kind: "icon",
|
|
1208
|
+
variant: "transparent",
|
|
1209
|
+
size: "sm"
|
|
1210
|
+
}, "2"), /*#__PURE__*/React.createElement(Button, {
|
|
1211
|
+
kind: "icon",
|
|
1212
|
+
variant: "transparent",
|
|
1213
|
+
size: "sm"
|
|
1214
|
+
}, "3"), /*#__PURE__*/React.createElement(Button, {
|
|
1215
|
+
kind: "icon",
|
|
1216
|
+
variant: "transparent",
|
|
1217
|
+
size: "sm"
|
|
1218
|
+
}, "\u2026"), /*#__PURE__*/React.createElement(Button, {
|
|
1219
|
+
kind: "icon",
|
|
1220
|
+
variant: "transparent",
|
|
1221
|
+
size: "sm"
|
|
1222
|
+
}, "8"), /*#__PURE__*/React.createElement(Button, {
|
|
1223
|
+
kind: "icon",
|
|
1224
|
+
variant: "transparent",
|
|
1225
|
+
size: "sm"
|
|
1226
|
+
}, /*#__PURE__*/React.createElement(CaretRight, null)), /*#__PURE__*/React.createElement(Button, {
|
|
1227
|
+
kind: "icon",
|
|
1228
|
+
variant: "transparent",
|
|
1229
|
+
size: "sm"
|
|
1230
|
+
}, /*#__PURE__*/React.createElement(CaretDoubleRight, null))));
|
|
1231
|
+
};
|
|
1232
|
+
TableFooter.propTypes = {
|
|
1233
|
+
className: PropTypes.node
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
const DenseContext = /*#__PURE__*/createContext(false);
|
|
1237
|
+
const Table = ({
|
|
1238
|
+
striped,
|
|
1239
|
+
hasHover,
|
|
1240
|
+
dense,
|
|
1241
|
+
border,
|
|
1242
|
+
withFooter,
|
|
1243
|
+
className,
|
|
1244
|
+
children,
|
|
1245
|
+
...props
|
|
1246
|
+
}) => {
|
|
1247
|
+
return /*#__PURE__*/React.createElement(DenseContext.Provider, {
|
|
1248
|
+
value: dense
|
|
1249
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1250
|
+
className: classnames(['table', {
|
|
1251
|
+
'table-striped': striped,
|
|
1252
|
+
'table-hasHover': hasHover,
|
|
1253
|
+
'table-dense': dense,
|
|
1254
|
+
'table-border': border
|
|
1255
|
+
}, className])
|
|
1256
|
+
}, /*#__PURE__*/React.createElement("table", _extends({
|
|
1257
|
+
cellPadding: 0,
|
|
1258
|
+
cellSpacing: 0,
|
|
1259
|
+
className: classnames('table_content')
|
|
1260
|
+
}, props), children), withFooter ? /*#__PURE__*/React.createElement(TableFooter, {
|
|
1261
|
+
dense: dense ? dense : null
|
|
1262
|
+
}) : null));
|
|
1263
|
+
};
|
|
1264
|
+
Table.propTypes = {
|
|
1265
|
+
striped: PropTypes.bool,
|
|
1266
|
+
hasHover: PropTypes.bool,
|
|
1267
|
+
dense: PropTypes.bool,
|
|
1268
|
+
border: PropTypes.bool,
|
|
1269
|
+
withFooter: PropTypes.bool,
|
|
1270
|
+
className: PropTypes.node,
|
|
1271
|
+
children: PropTypes.node
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
const TableBody = ({
|
|
1275
|
+
className,
|
|
1276
|
+
children,
|
|
1277
|
+
...props
|
|
1278
|
+
}) => {
|
|
1279
|
+
return /*#__PURE__*/React.createElement("tbody", _extends({
|
|
1280
|
+
className: classnames(['table_body', className])
|
|
1281
|
+
}, props), children);
|
|
1282
|
+
};
|
|
1283
|
+
TableBody.propTypes = {
|
|
1284
|
+
className: PropTypes.node,
|
|
1285
|
+
children: PropTypes.node
|
|
1286
|
+
};
|
|
1287
|
+
|
|
1288
|
+
const TableCellComponentContext = /*#__PURE__*/createContext('td');
|
|
1289
|
+
const TableHead = ({
|
|
1290
|
+
className,
|
|
1291
|
+
children,
|
|
1292
|
+
...props
|
|
1293
|
+
}) => {
|
|
1294
|
+
return /*#__PURE__*/React.createElement(TableCellComponentContext.Provider, {
|
|
1295
|
+
value: "th"
|
|
1296
|
+
}, /*#__PURE__*/React.createElement("thead", _extends({
|
|
1297
|
+
className: classnames(['table_head', className])
|
|
1298
|
+
}, props), children));
|
|
1299
|
+
};
|
|
1300
|
+
TableHead.propTypes = {
|
|
1301
|
+
className: PropTypes.node,
|
|
1302
|
+
children: PropTypes.node
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
const TableCell = ({
|
|
1306
|
+
kind,
|
|
1307
|
+
className,
|
|
1308
|
+
children,
|
|
1309
|
+
...props
|
|
1310
|
+
}) => {
|
|
1311
|
+
const useTableCellComponent = () => useContext(TableCellComponentContext);
|
|
1312
|
+
const Component = useTableCellComponent();
|
|
1313
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
1314
|
+
className: classnames(['table_cell', {
|
|
1315
|
+
[`table_cell-${kind}`]: kind
|
|
1316
|
+
}, className])
|
|
1317
|
+
}, props), children);
|
|
1318
|
+
};
|
|
1319
|
+
TableCell.propTypes = {
|
|
1320
|
+
kind: PropTypes.oneOf(['default', 'number', 'action']),
|
|
1321
|
+
className: PropTypes.node,
|
|
1322
|
+
children: PropTypes.node
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
const TableRow = ({
|
|
1326
|
+
className,
|
|
1327
|
+
children,
|
|
1328
|
+
...props
|
|
1329
|
+
}) => {
|
|
1330
|
+
return /*#__PURE__*/React.createElement("tr", _extends({
|
|
1331
|
+
className: classnames(['table_row', className])
|
|
1332
|
+
}, props), children);
|
|
1333
|
+
};
|
|
1334
|
+
TableRow.propTypes = {
|
|
1335
|
+
className: PropTypes.node,
|
|
1336
|
+
children: PropTypes.node
|
|
1337
|
+
};
|
|
1338
|
+
|
|
1339
|
+
const Tag = ({
|
|
1340
|
+
color = 'primary',
|
|
1341
|
+
dense,
|
|
1342
|
+
className,
|
|
1343
|
+
children = 'Tag',
|
|
1344
|
+
...props
|
|
1345
|
+
}) => {
|
|
1346
|
+
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
1347
|
+
className: classnames(['tag', {
|
|
1348
|
+
[`tag-${color}`]: color,
|
|
1349
|
+
'tag-dense': dense
|
|
1350
|
+
}, className])
|
|
1351
|
+
}, props), children);
|
|
1352
|
+
};
|
|
1353
|
+
Tag.propTypes = {
|
|
1354
|
+
color: PropTypes.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error']),
|
|
1355
|
+
dense: PropTypes.bool,
|
|
1356
|
+
className: PropTypes.node,
|
|
1357
|
+
children: PropTypes.node
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
const Textarea = ({
|
|
1361
|
+
onChange,
|
|
1362
|
+
id,
|
|
1363
|
+
placeholder,
|
|
1364
|
+
label = 'Textarea',
|
|
1365
|
+
isFocused,
|
|
1366
|
+
error,
|
|
1367
|
+
disabled,
|
|
1368
|
+
optional,
|
|
1369
|
+
hint,
|
|
1370
|
+
className,
|
|
1371
|
+
...props
|
|
1372
|
+
}) => {
|
|
1373
|
+
const inputRef = useRef(null);
|
|
1374
|
+
useEffect(() => {
|
|
1375
|
+
if (isFocused && inputRef.current) {
|
|
1376
|
+
inputRef.current.focus();
|
|
1377
|
+
}
|
|
1378
|
+
}, [isFocused]);
|
|
1379
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1380
|
+
className: classnames(['input', {
|
|
1381
|
+
'js-error': error,
|
|
1382
|
+
'input-disabled': disabled,
|
|
1383
|
+
'input-optional': optional
|
|
1384
|
+
}, className]),
|
|
1385
|
+
onChange: onChange
|
|
1386
|
+
}, label && /*#__PURE__*/React.createElement("label", {
|
|
1387
|
+
className: 'input_label',
|
|
1388
|
+
htmlFor: id
|
|
1389
|
+
}, label), hint && /*#__PURE__*/React.createElement("p", {
|
|
1390
|
+
className: 'input_hint'
|
|
1391
|
+
}, hint), /*#__PURE__*/React.createElement("textarea", _extends({
|
|
1392
|
+
ref: inputRef,
|
|
1393
|
+
className: 'input_control',
|
|
1394
|
+
name: id,
|
|
1395
|
+
id: id,
|
|
1396
|
+
placeholder: placeholder,
|
|
1397
|
+
disabled: disabled,
|
|
1398
|
+
required: !(disabled || optional),
|
|
1399
|
+
rows: 4,
|
|
1400
|
+
"aria-description": hint
|
|
1401
|
+
}, props)));
|
|
1402
|
+
};
|
|
1403
|
+
Textarea.propTypes = {
|
|
1404
|
+
onChange: PropTypes.func,
|
|
1405
|
+
id: PropTypes.string,
|
|
1406
|
+
placeholder: PropTypes.string,
|
|
1407
|
+
label: PropTypes.string,
|
|
1408
|
+
isFocused: PropTypes.bool,
|
|
1409
|
+
error: PropTypes.bool,
|
|
1410
|
+
disabled: PropTypes.bool,
|
|
1411
|
+
optional: PropTypes.bool,
|
|
1412
|
+
hint: PropTypes.string,
|
|
1413
|
+
className: PropTypes.node
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
export { Alert, Breadcrumbs, Button, Buttons, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Checkboxes, Color, Display, Divider, Grid, Input, Link, List, ListItem, Radio, RadioButtons, Section, SectionContent, SectionHeader, Select, Snippet, Status, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableRow, Tag, Text, Textarea };
|