pallote-react 0.15.0 → 0.15.2

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/dist/index.js ADDED
@@ -0,0 +1,1655 @@
1
+ import React, { useState, useEffect, useRef, createContext, useContext } 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';
7
+
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);
251
+ }
252
+ };
253
+ Alert.propTypes = {
254
+ color: PropTypes.oneOf(['success', 'info', 'warning', 'error']),
255
+ variant: PropTypes.oneOf(['bar', 'toast', 'notice']),
256
+ title: PropTypes.string.isRequired,
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.isRequired,
284
+ separator: PropTypes.oneOf(['slash', 'arrow']),
285
+ className: PropTypes.node
286
+ };
287
+
288
+ const Button = /*#__PURE__*/React.forwardRef(({
289
+ component = 'button',
290
+ kind,
291
+ variant = 'fill',
292
+ size = 'md',
293
+ color = 'primary',
294
+ fullWidth,
295
+ disabled,
296
+ iconLeft,
297
+ iconRight,
298
+ className,
299
+ children = 'button',
300
+ ...props
301
+ }, ref) => {
302
+ const Component = component || 'button';
303
+ let content;
304
+ if (kind === 'icon') {
305
+ content = children;
306
+ } else {
307
+ content = /*#__PURE__*/React.createElement(React.Fragment, null, iconLeft && iconLeft, children, iconRight && iconRight);
308
+ }
309
+ return /*#__PURE__*/React.createElement(Component, _extends({
310
+ className: classnames(['button', {
311
+ [`button-${size}`]: size,
312
+ [`button-${color}`]: color,
313
+ [`button-${kind}`]: kind,
314
+ [`button-${variant}`]: variant,
315
+ 'button-fullWidth': fullWidth,
316
+ 'button-disabled': disabled
317
+ }, className]),
318
+ ref: ref,
319
+ disabled: Component === 'button' ? disabled : undefined
320
+ }, props), content);
321
+ });
322
+ Button.displayName = 'Button';
323
+ Button.propTypes = {
324
+ component: PropTypes.oneOfType([PropTypes.oneOf(['button', 'a']), PropTypes.elementType]),
325
+ kind: PropTypes.oneOf(['text', 'icon']),
326
+ variant: PropTypes.oneOf(['fill', 'stroke', 'transparent']),
327
+ size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg']),
328
+ color: PropTypes.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error', 'main', 'contrast']),
329
+ fullWidth: PropTypes.bool,
330
+ disabled: PropTypes.bool,
331
+ iconLeft: PropTypes.node,
332
+ iconRight: PropTypes.node,
333
+ className: PropTypes.node,
334
+ children: PropTypes.node.isRequired
335
+ };
336
+
337
+ const Buttons = ({
338
+ direction = 'landscape',
339
+ fullWidth,
340
+ wide,
341
+ className,
342
+ children,
343
+ ...props
344
+ }) => {
345
+ return /*#__PURE__*/React.createElement("div", _extends({
346
+ className: classnames(['buttons', {
347
+ [`buttons-${direction}`]: direction,
348
+ 'buttons-fullWidth': fullWidth,
349
+ 'buttons-wide': wide
350
+ }, className])
351
+ }, props), children);
352
+ };
353
+ Buttons.propTypes = {
354
+ direction: PropTypes.oneOf(['landscape', 'portrait']),
355
+ fullWidth: PropTypes.bool,
356
+ wide: PropTypes.bool,
357
+ className: PropTypes.node,
358
+ children: PropTypes.node.isRequired
359
+ };
360
+
361
+ const Card = ({
362
+ size = 'md',
363
+ fill = 'paper',
364
+ direction = 'portrait',
365
+ align = 'left',
366
+ hasShadow = false,
367
+ transparent = false,
368
+ className,
369
+ children,
370
+ ...props
371
+ }) => {
372
+ return /*#__PURE__*/React.createElement(Color, {
373
+ fill: transparent ? null : fill
374
+ }, /*#__PURE__*/React.createElement("div", _extends({
375
+ className: classnames(['card', {
376
+ [`card-${size}`]: size,
377
+ [`card-${direction}`]: direction,
378
+ [`card-${align}`]: align,
379
+ 'card-hasShadow': hasShadow,
380
+ 'card-transparent': transparent
381
+ }, className])
382
+ }, props), children));
383
+ };
384
+ Card.propTypes = {
385
+ size: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
386
+ fill: PropTypes.oneOf(['default', 'paper', 'primary', 'secondary', 'success', 'info', 'warning', 'error']),
387
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
388
+ align: PropTypes.oneOf(['left', 'center', 'right']),
389
+ hasShadow: PropTypes.bool,
390
+ transparent: PropTypes.bool,
391
+ className: PropTypes.node,
392
+ children: PropTypes.node.isRequired
393
+ };
394
+
395
+ const CardActions = ({
396
+ direction,
397
+ className,
398
+ children,
399
+ ...props
400
+ }) => {
401
+ return /*#__PURE__*/React.createElement("div", _extends({
402
+ className: classnames(['card_actions', {
403
+ [`card_actions-${direction}`]: direction
404
+ }, className])
405
+ }, props), children);
406
+ };
407
+ CardActions.propTypes = {
408
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
409
+ className: PropTypes.node,
410
+ children: PropTypes.node.isRequired
411
+ };
412
+
413
+ const CardContent = ({
414
+ fullWidth,
415
+ className,
416
+ children,
417
+ ...props
418
+ }) => {
419
+ return /*#__PURE__*/React.createElement("div", _extends({
420
+ className: classnames(['card_content', {
421
+ 'card_content-fullWidth': fullWidth
422
+ }, className])
423
+ }, props), children);
424
+ };
425
+ CardContent.propTypes = {
426
+ fullWidth: PropTypes.bool,
427
+ className: PropTypes.node,
428
+ children: PropTypes.node.isRequired
429
+ };
430
+
431
+ const CardHeader = ({
432
+ label,
433
+ title,
434
+ subtitle,
435
+ actions,
436
+ className,
437
+ ...props
438
+ }) => {
439
+ return /*#__PURE__*/React.createElement("div", _extends({
440
+ className: classnames(['card_header', className])
441
+ }, props), actions && /*#__PURE__*/React.createElement("div", {
442
+ className: "card_headerActions"
443
+ }, actions), label ? /*#__PURE__*/React.createElement(Text, {
444
+ className: classnames('card_label')
445
+ }, label) : null, /*#__PURE__*/React.createElement(Text, {
446
+ className: classnames('card_title')
447
+ }, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
448
+ className: classnames('card_subtitle')
449
+ }, subtitle) : null);
450
+ };
451
+ CardHeader.propTypes = {
452
+ label: PropTypes.string,
453
+ title: PropTypes.string.isRequired,
454
+ subtitle: PropTypes.string,
455
+ actions: PropTypes.node,
456
+ className: PropTypes.node,
457
+ children: PropTypes.node
458
+ };
459
+
460
+ const CardMedia = ({
461
+ width,
462
+ height,
463
+ image,
464
+ fullWidth,
465
+ className,
466
+ ...props
467
+ }) => {
468
+ return /*#__PURE__*/React.createElement("div", _extends({
469
+ className: classnames(['card_media', {
470
+ 'card_media-fullWidth': fullWidth
471
+ }, className])
472
+ }, props), /*#__PURE__*/React.createElement("div", {
473
+ className: 'card_mediaInner',
474
+ style: {
475
+ width: width + 'px',
476
+ paddingBottom: height,
477
+ backgroundImage: `url(${image})`
478
+ }
479
+ }));
480
+ };
481
+ CardMedia.propTypes = {
482
+ width: PropTypes.number,
483
+ height: PropTypes.number,
484
+ image: PropTypes.string.isRequired,
485
+ fullWidth: PropTypes.bool,
486
+ className: PropTypes.node
487
+ };
488
+
489
+ const Checkbox = ({
490
+ id,
491
+ value,
492
+ label,
493
+ checked,
494
+ disabled,
495
+ optional,
496
+ className,
497
+ ...props
498
+ }) => {
499
+ return /*#__PURE__*/React.createElement("div", {
500
+ className: classnames(['checkbox', {
501
+ 'checkbox-disabled': disabled
502
+ }, className])
503
+ }, /*#__PURE__*/React.createElement("input", _extends({
504
+ className: classnames('checkbox_control'),
505
+ type: "checkbox",
506
+ name: id,
507
+ id: id,
508
+ value: value,
509
+ checked: checked,
510
+ "aria-checked": checked,
511
+ disabled: disabled,
512
+ required: !(disabled || optional)
513
+ }, props)), /*#__PURE__*/React.createElement("label", {
514
+ className: classnames('checkbox_label'),
515
+ htmlFor: id
516
+ }, label));
517
+ };
518
+ Checkbox.propTypes = {
519
+ id: PropTypes.string.isRequired,
520
+ value: PropTypes.string.isRequired,
521
+ label: PropTypes.string.isRequired,
522
+ checked: PropTypes.bool,
523
+ disabled: PropTypes.bool,
524
+ optional: PropTypes.bool,
525
+ className: PropTypes.node
526
+ };
527
+
528
+ const InputLabel = ({
529
+ isLegend = false,
530
+ htmlFor,
531
+ label = 'Input label',
532
+ hint,
533
+ error
534
+ }) => {
535
+ const LabelTag = isLegend ? 'legend' : 'label';
536
+ return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(LabelTag, _extends({
537
+ className: 'input_label'
538
+ }, !isLegend && {
539
+ htmlFor
540
+ }), label), hint && /*#__PURE__*/React.createElement("p", {
541
+ id: htmlFor + '-hint',
542
+ className: 'input_hint'
543
+ }, hint), error && /*#__PURE__*/React.createElement("p", {
544
+ id: htmlFor + '-error',
545
+ className: 'input_error'
546
+ }, error));
547
+ };
548
+ InputLabel.propTypes = {
549
+ isLegend: PropTypes.bool,
550
+ htmlFor: (props, propName, componentName) => {
551
+ if (!props.isLegend && !props[propName]) {
552
+ return new Error(`The prop \`${propName}\` is required in \`${componentName}\` when \`isLegend\` is false.`);
553
+ }
554
+ },
555
+ label: PropTypes.string.isRequired,
556
+ hint: PropTypes.string,
557
+ error: PropTypes.string
558
+ };
559
+
560
+ const Checkboxes = ({
561
+ onChange,
562
+ id,
563
+ label = 'Label',
564
+ direction = 'portrait',
565
+ error,
566
+ disabled,
567
+ optional,
568
+ hint,
569
+ children,
570
+ className
571
+ }) => {
572
+ return /*#__PURE__*/React.createElement("fieldset", _extends({
573
+ className: classnames(['input', {
574
+ 'js-error': error,
575
+ 'input-disabled': disabled,
576
+ 'input-optional': optional
577
+ }, className]),
578
+ onChange: onChange
579
+ }, hint || error ? {
580
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
581
+ } : null), /*#__PURE__*/React.createElement(InputLabel, {
582
+ isLegend: true,
583
+ label: label,
584
+ hint: hint,
585
+ error: error
586
+ }), /*#__PURE__*/React.createElement("div", {
587
+ className: classnames(['input_control', 'radios', {
588
+ [`radios-${direction}`]: direction
589
+ }])
590
+ }, React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
591
+ optional,
592
+ disabled
593
+ }) : child)));
594
+ };
595
+ Checkboxes.propTypes = {
596
+ onChange: PropTypes.func,
597
+ id: PropTypes.string.isRequired,
598
+ label: PropTypes.string.isRequired,
599
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
600
+ error: PropTypes.bool,
601
+ disabled: PropTypes.bool,
602
+ optional: PropTypes.bool,
603
+ hint: PropTypes.string,
604
+ children: PropTypes.node.isRequired,
605
+ className: PropTypes.node
606
+ };
607
+
608
+ const Divider = ({
609
+ direction = 'landscape',
610
+ padding = 'md',
611
+ className,
612
+ ...props
613
+ }) => {
614
+ return /*#__PURE__*/React.createElement("div", _extends({
615
+ className: classnames(['divider', {
616
+ [`divider-${direction}`]: direction,
617
+ [`divider-${padding}`]: padding
618
+ }, className])
619
+ }, props));
620
+ };
621
+ Divider.propTypes = {
622
+ direction: PropTypes.oneOf(['landscape', 'portrait']),
623
+ padding: PropTypes.oneOf(['none', 'sm', 'md', 'lg']),
624
+ className: PropTypes.node
625
+ };
626
+
627
+ const Input = ({
628
+ onChange,
629
+ type = 'text',
630
+ id,
631
+ placeholder,
632
+ label = 'Input',
633
+ icon,
634
+ isFocused,
635
+ error,
636
+ disabled,
637
+ optional,
638
+ hint,
639
+ className,
640
+ ...props
641
+ }) => {
642
+ const inputRef = useRef(null);
643
+ useEffect(() => {
644
+ if (isFocused && inputRef.current) {
645
+ inputRef.current.focus();
646
+ }
647
+ }, [isFocused]);
648
+ const customIcon = icon || type === 'date' && /*#__PURE__*/React.createElement(CalendarBlank, null) || type === 'time' && /*#__PURE__*/React.createElement(Clock, null) || type === 'number' && /*#__PURE__*/React.createElement(CaretUpDown, null);
649
+ return /*#__PURE__*/React.createElement("div", {
650
+ className: classnames(['input', {
651
+ 'js-error': error,
652
+ 'input-disabled': disabled,
653
+ 'input-optional': optional,
654
+ 'input-withIcon': icon
655
+ }, className]),
656
+ onChange: onChange
657
+ }, /*#__PURE__*/React.createElement(InputLabel, {
658
+ htmlFor: id,
659
+ label: label,
660
+ hint: hint,
661
+ error: error
662
+ }), customIcon && /*#__PURE__*/React.createElement("div", {
663
+ className: 'input_icon'
664
+ }, customIcon), /*#__PURE__*/React.createElement("input", _extends({
665
+ ref: inputRef,
666
+ type: type,
667
+ className: 'input_control',
668
+ name: id,
669
+ id: id,
670
+ placeholder: placeholder,
671
+ disabled: disabled,
672
+ required: !(disabled || optional)
673
+ }, hint || error ? {
674
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
675
+ } : null, props)));
676
+ };
677
+ Input.propTypes = {
678
+ onChange: PropTypes.func,
679
+ type: PropTypes.oneOf(['date', 'email', 'number', 'tel', 'text', 'time']),
680
+ id: PropTypes.string.isRequired,
681
+ placeholder: PropTypes.string,
682
+ label: PropTypes.string.isRequired,
683
+ icon: PropTypes.node,
684
+ isFocused: PropTypes.bool,
685
+ error: PropTypes.bool,
686
+ disabled: PropTypes.bool,
687
+ optional: PropTypes.bool,
688
+ hint: PropTypes.string,
689
+ className: PropTypes.node
690
+ };
691
+
692
+ const Link = ({
693
+ component = 'a',
694
+ icon,
695
+ color,
696
+ isExternal,
697
+ href,
698
+ className,
699
+ children,
700
+ ...props
701
+ }) => {
702
+ const Component = component || 'a';
703
+ return /*#__PURE__*/React.createElement(Component, _extends({
704
+ className: classnames(['link', {
705
+ [`text-${color}`]: color
706
+ }, className]),
707
+ href: isExternal ? href : undefined,
708
+ target: isExternal ? '_blank' : undefined,
709
+ rel: isExternal ? 'noopener noreferrer' : undefined
710
+ }, props), children, icon && !isExternal && /*#__PURE__*/React.createElement("span", {
711
+ className: 'link_icon'
712
+ }, icon), isExternal && /*#__PURE__*/React.createElement("span", {
713
+ className: 'link_icon'
714
+ }, /*#__PURE__*/React.createElement(ArrowSquareOut, null)));
715
+ };
716
+ Link.propTypes = {
717
+ component: PropTypes.oneOfType(['a', PropTypes.elementType]),
718
+ icon: PropTypes.node,
719
+ color: PropTypes.oneOf(['default', 'alt', 'disabled', 'contrast', 'contrastAlt', 'contrastDisabled', 'primary', 'secondary', 'inherit']),
720
+ href: PropTypes.string,
721
+ className: PropTypes.node,
722
+ children: PropTypes.node.isRequired
723
+ };
724
+
725
+ const List = ({
726
+ dense,
727
+ className,
728
+ children,
729
+ ...props
730
+ }) => {
731
+ return /*#__PURE__*/React.createElement("div", _extends({
732
+ className: classnames(['list', {
733
+ 'list-dense': dense
734
+ }, className])
735
+ }, props), children);
736
+ };
737
+ List.propTypes = {
738
+ dense: PropTypes.bool,
739
+ className: PropTypes.node,
740
+ children: PropTypes.node.isRequired
741
+ };
742
+
743
+ const ListItem = ({
744
+ icon,
745
+ bold,
746
+ className,
747
+ children = 'List item',
748
+ ...props
749
+ }) => {
750
+ return /*#__PURE__*/React.createElement(Text, _extends({
751
+ className: classnames(['list_item', {
752
+ 'list_item-bold': bold
753
+ }, className])
754
+ }, props), icon ? /*#__PURE__*/React.cloneElement(icon, {
755
+ className: `${icon.props.className ?? ''} list_itemIcon`
756
+ }) : null, children);
757
+ };
758
+ ListItem.propTypes = {
759
+ icon: PropTypes.node,
760
+ bold: PropTypes.bool,
761
+ className: PropTypes.node,
762
+ children: PropTypes.node.isRequired
763
+ };
764
+
765
+ const Nav = ({
766
+ direction,
767
+ dense,
768
+ className,
769
+ children,
770
+ ...props
771
+ }) => {
772
+ return /*#__PURE__*/React.createElement("nav", _extends({
773
+ className: classnames(['nav', {
774
+ [`nav-${direction}`]: direction,
775
+ 'nav-dense': dense
776
+ }, className])
777
+ }, props), /*#__PURE__*/React.createElement("div", {
778
+ className: "nav_container"
779
+ }, children));
780
+ };
781
+ Nav.propTypes = {
782
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
783
+ dense: PropTypes.bool,
784
+ className: PropTypes.node,
785
+ children: PropTypes.node.isRequired
786
+ };
787
+
788
+ const SectionHeader = ({
789
+ label,
790
+ title,
791
+ promoteTitle = false,
792
+ titleComponent,
793
+ subtitle,
794
+ actions,
795
+ className,
796
+ ...props
797
+ }) => {
798
+ return /*#__PURE__*/React.createElement("div", _extends({
799
+ className: classnames(['section_header', className])
800
+ }, props), label ? /*#__PURE__*/React.createElement(Text, {
801
+ className: classnames('section_label')
802
+ }, label) : null, /*#__PURE__*/React.createElement(Text, {
803
+ className: "section_title",
804
+ component: titleComponent || (promoteTitle ? 'h1' : 'h2')
805
+ }, title), subtitle ? /*#__PURE__*/React.createElement(Text, {
806
+ className: classnames('section_subtitle')
807
+ }, subtitle) : null, actions ? /*#__PURE__*/React.createElement("div", {
808
+ className: "section_actions"
809
+ }, actions) : null);
810
+ };
811
+ SectionHeader.propTypes = {
812
+ label: PropTypes.string,
813
+ title: PropTypes.string.isRequired,
814
+ promoteTitle: PropTypes.bool,
815
+ titleComponent: PropTypes.oneOf(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p']).isRequired,
816
+ subtitle: PropTypes.string,
817
+ actions: PropTypes.node,
818
+ className: PropTypes.node
819
+ };
820
+
821
+ const Section = ({
822
+ align = 'left',
823
+ color = 'default',
824
+ landing,
825
+ header,
826
+ className,
827
+ children,
828
+ ...props
829
+ }) => {
830
+ return /*#__PURE__*/React.createElement("div", _extends({
831
+ className: classnames(['section', {
832
+ [`section-${align}`]: align,
833
+ [`section-${color}`]: color,
834
+ 'section-landing': landing,
835
+ 'section-header': header
836
+ }, className])
837
+ }, props), /*#__PURE__*/React.createElement("div", {
838
+ className: 'section_container'
839
+ }, React.Children.map(children, child => {
840
+ if (/*#__PURE__*/React.isValidElement(child) && child.type === SectionHeader) {
841
+ return /*#__PURE__*/React.cloneElement(child, {
842
+ promoteTitle: landing || header
843
+ });
844
+ }
845
+ return child;
846
+ })));
847
+ };
848
+ Section.propTypes = {
849
+ align: PropTypes.oneOf(['left', 'center', 'right']),
850
+ color: PropTypes.oneOf(['default', 'paper', 'primary', 'primaryLight']),
851
+ landing: PropTypes.bool,
852
+ header: PropTypes.bool,
853
+ className: PropTypes.node,
854
+ children: PropTypes.node.isRequired
855
+ };
856
+
857
+ const NavBar = ({
858
+ logo,
859
+ align,
860
+ className,
861
+ children,
862
+ ...props
863
+ }) => {
864
+ const [isOpen, setIsOpen] = useState(false);
865
+ const toggleNav = () => {
866
+ setIsOpen(!isOpen);
867
+ document.body.classList.toggle('js-navbar', !isOpen);
868
+ };
869
+ return /*#__PURE__*/React.createElement("header", null, /*#__PURE__*/React.createElement(Section, _extends({
870
+ className: classnames(['navbar', {
871
+ [`navbar-${align}`]: align,
872
+ 'js-opened': isOpen
873
+ }, className])
874
+ }, props), /*#__PURE__*/React.createElement("div", {
875
+ className: "navbar_main"
876
+ }, /*#__PURE__*/React.createElement("div", {
877
+ className: "navbar_logo"
878
+ }, logo), /*#__PURE__*/React.createElement("button", {
879
+ "aria-label": "Open mobile menu",
880
+ className: classnames('navbar_button', {
881
+ 'js-opened': isOpen
882
+ }),
883
+ onClick: toggleNav
884
+ }, /*#__PURE__*/React.createElement("span", null))), /*#__PURE__*/React.createElement("nav", {
885
+ "aria-label": "main-nav",
886
+ className: classnames('navbar_nav nav', {
887
+ 'js-opened': isOpen
888
+ })
889
+ }, /*#__PURE__*/React.createElement("div", {
890
+ className: "nav_container"
891
+ }, children))));
892
+ };
893
+ NavBar.propTypes = {
894
+ logo: PropTypes.node,
895
+ align: PropTypes.oneOf(['left', 'right']),
896
+ className: PropTypes.node,
897
+ children: PropTypes.node.isRequired
898
+ };
899
+
900
+ const NavItem = ({
901
+ component,
902
+ label,
903
+ active,
904
+ dropdown,
905
+ icon,
906
+ end,
907
+ to,
908
+ className,
909
+ ...props
910
+ }) => {
911
+ const dropdownRef = useRef(null);
912
+ const [isExpanded, setIsExpanded] = useState(false);
913
+ const onClick = () => setIsExpanded(!isExpanded);
914
+ let Component;
915
+ if (dropdown) {
916
+ Component = 'button';
917
+ } else {
918
+ Component = component || "a";
919
+ }
920
+ return /*#__PURE__*/React.createElement("div", {
921
+ className: classnames(['nav_item', {
922
+ 'nav_item-dropdown': dropdown,
923
+ 'js-show': isExpanded
924
+ }, className])
925
+ }, /*#__PURE__*/React.createElement(Component, _extends({
926
+ end: end,
927
+ to: to,
928
+ className: classnames(['nav_trigger', {
929
+ 'nav_trigger-active': active
930
+ }]),
931
+ onClick: onClick
932
+ }, props), icon ? /*#__PURE__*/React.createElement("span", {
933
+ className: classnames('nav_icon')
934
+ }, icon) : null, label), dropdown ? /*#__PURE__*/React.createElement("div", {
935
+ ref: dropdownRef,
936
+ className: "nav_target"
937
+ }, dropdown) : null);
938
+ };
939
+ NavItem.propTypes = {
940
+ label: PropTypes.string.isRequired,
941
+ active: PropTypes.bool,
942
+ dropdown: PropTypes.object,
943
+ icon: PropTypes.node,
944
+ end: PropTypes.node,
945
+ to: PropTypes.node,
946
+ className: PropTypes.node
947
+ };
948
+
949
+ const Radio = ({
950
+ id,
951
+ name,
952
+ value,
953
+ label,
954
+ checked,
955
+ disabled,
956
+ optional,
957
+ className,
958
+ ...props
959
+ }) => {
960
+ return /*#__PURE__*/React.createElement("div", {
961
+ className: classnames(['radio', {
962
+ 'radio-disabled': disabled
963
+ }, className])
964
+ }, /*#__PURE__*/React.createElement("input", _extends({
965
+ className: classnames('radio_control'),
966
+ type: "radio",
967
+ id: id,
968
+ name: name,
969
+ value: value,
970
+ checked: checked,
971
+ "aria-checked": checked,
972
+ disabled: disabled,
973
+ required: !(disabled || optional)
974
+ }, props)), /*#__PURE__*/React.createElement("label", {
975
+ className: classnames('radio_label'),
976
+ htmlFor: id
977
+ }, label));
978
+ };
979
+ Radio.propTypes = {
980
+ id: PropTypes.string.isRequired,
981
+ name: PropTypes.string.isRequired,
982
+ value: PropTypes.string.isRequired,
983
+ label: PropTypes.string.isRequired,
984
+ checked: PropTypes.bool,
985
+ disabled: PropTypes.bool,
986
+ optional: PropTypes.bool,
987
+ className: PropTypes.node
988
+ };
989
+
990
+ const RadioButtons = ({
991
+ onChange,
992
+ id,
993
+ label = 'Label',
994
+ direction = 'portrait',
995
+ error,
996
+ disabled,
997
+ optional,
998
+ hint,
999
+ children,
1000
+ className
1001
+ }) => {
1002
+ return /*#__PURE__*/React.createElement("fieldset", _extends({
1003
+ className: classnames(['input', {
1004
+ 'js-error': error,
1005
+ 'input-disabled': disabled,
1006
+ 'input-optional': optional
1007
+ }, className]),
1008
+ onChange: onChange
1009
+ }, hint || error ? {
1010
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
1011
+ } : null), /*#__PURE__*/React.createElement(InputLabel, {
1012
+ isLegend: true,
1013
+ label: label,
1014
+ hint: hint,
1015
+ error: error
1016
+ }), /*#__PURE__*/React.createElement("div", {
1017
+ className: classnames(['input_control', 'radios', {
1018
+ [`radios-${direction}`]: direction
1019
+ }])
1020
+ }, React.Children.map(children, child => /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
1021
+ optional,
1022
+ disabled
1023
+ }) : child)));
1024
+ };
1025
+ RadioButtons.propTypes = {
1026
+ onChange: PropTypes.func,
1027
+ id: PropTypes.string.isRequired,
1028
+ label: PropTypes.string.isRequired,
1029
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
1030
+ error: PropTypes.bool,
1031
+ disabled: PropTypes.bool,
1032
+ optional: PropTypes.bool,
1033
+ hint: PropTypes.string,
1034
+ children: PropTypes.node.isRequired,
1035
+ className: PropTypes.node
1036
+ };
1037
+
1038
+ const SectionContent = ({
1039
+ align = 'left',
1040
+ className,
1041
+ children,
1042
+ ...props
1043
+ }) => {
1044
+ return /*#__PURE__*/React.createElement("div", _extends({
1045
+ className: classnames(['section_content', {
1046
+ [`section_content-${align}`]: align
1047
+ }, className])
1048
+ }, props), children);
1049
+ };
1050
+ SectionContent.propTypes = {
1051
+ align: PropTypes.oneOf(['left', 'center', 'right']),
1052
+ className: PropTypes.node,
1053
+ children: PropTypes.node.isRequired
1054
+ };
1055
+
1056
+ const Select = ({
1057
+ onChange,
1058
+ id,
1059
+ label = 'Select',
1060
+ isFocused,
1061
+ error,
1062
+ disabled,
1063
+ optional,
1064
+ dense,
1065
+ hint,
1066
+ children,
1067
+ className,
1068
+ ...props
1069
+ }) => {
1070
+ const inputRef = useRef(null);
1071
+ useEffect(() => {
1072
+ if (isFocused && inputRef.current) {
1073
+ inputRef.current.focus();
1074
+ }
1075
+ }, [isFocused]);
1076
+ return /*#__PURE__*/React.createElement("div", {
1077
+ className: classnames(['input', 'select', {
1078
+ 'input-focused': isFocused,
1079
+ 'js-error': error,
1080
+ 'input-disabled': disabled,
1081
+ 'input-optional': optional,
1082
+ 'input-dense': dense
1083
+ }, className]),
1084
+ onChange: onChange
1085
+ }, /*#__PURE__*/React.createElement(InputLabel, {
1086
+ htmlFor: id,
1087
+ label: label,
1088
+ hint: hint,
1089
+ error: error
1090
+ }), /*#__PURE__*/React.createElement("select", _extends({
1091
+ ref: inputRef,
1092
+ className: 'input_control',
1093
+ name: id,
1094
+ id: id,
1095
+ disabled: disabled,
1096
+ required: !(disabled || optional)
1097
+ }, hint || error ? {
1098
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
1099
+ } : null, props), children));
1100
+ };
1101
+ Select.propTypes = {
1102
+ onChange: PropTypes.func,
1103
+ id: PropTypes.string.isRequired,
1104
+ label: PropTypes.string.isRequired,
1105
+ isFocused: PropTypes.bool,
1106
+ error: PropTypes.bool,
1107
+ disabled: PropTypes.bool,
1108
+ optional: PropTypes.bool,
1109
+ dense: PropTypes.bool,
1110
+ hint: PropTypes.string,
1111
+ children: PropTypes.any.isRequired,
1112
+ className: PropTypes.node
1113
+ };
1114
+
1115
+ var nnfxDark = {
1116
+ "hljs": {
1117
+ "display": "block",
1118
+ "overflowX": "auto",
1119
+ "padding": "0.5em",
1120
+ "background": "#333",
1121
+ "color": "#fff"
1122
+ },
1123
+ "xml .hljs-meta": {
1124
+ "fontWeight": "bold",
1125
+ "fontStyle": "italic",
1126
+ "color": "#69f"
1127
+ },
1128
+ "hljs-comment": {
1129
+ "fontStyle": "italic",
1130
+ "color": "#9c6"
1131
+ },
1132
+ "hljs-quote": {
1133
+ "fontStyle": "italic",
1134
+ "color": "#9c6"
1135
+ },
1136
+ "hljs-name": {
1137
+ "color": "#a7a",
1138
+ "fontWeight": "bold"
1139
+ },
1140
+ "hljs-keyword": {
1141
+ "color": "#a7a"
1142
+ },
1143
+ "hljs-attr": {
1144
+ "fontWeight": "bold",
1145
+ "color": "#fff"
1146
+ },
1147
+ "hljs-string": {
1148
+ "fontWeight": "normal",
1149
+ "color": "#bce"
1150
+ },
1151
+ "hljs-variable": {
1152
+ "color": "#588"
1153
+ },
1154
+ "hljs-template-variable": {
1155
+ "color": "#588"
1156
+ },
1157
+ "hljs-code": {
1158
+ "color": "#bce"
1159
+ },
1160
+ "hljs-meta-string": {
1161
+ "color": "#bce"
1162
+ },
1163
+ "hljs-number": {
1164
+ "color": "#bce"
1165
+ },
1166
+ "hljs-regexp": {
1167
+ "color": "#bce"
1168
+ },
1169
+ "hljs-link": {
1170
+ "color": "#bce"
1171
+ },
1172
+ "hljs-title": {
1173
+ "color": "#d40"
1174
+ },
1175
+ "hljs-symbol": {
1176
+ "color": "#d40"
1177
+ },
1178
+ "hljs-bullet": {
1179
+ "color": "#d40"
1180
+ },
1181
+ "hljs-built_in": {
1182
+ "color": "#d40"
1183
+ },
1184
+ "hljs-builtin-name": {
1185
+ "color": "#d40"
1186
+ },
1187
+ "hljs-section": {
1188
+ "color": "#a85"
1189
+ },
1190
+ "hljs-meta": {
1191
+ "color": "#a85"
1192
+ },
1193
+ "hljs-class .hljs-title": {
1194
+ "color": "#96c"
1195
+ },
1196
+ "hljs-type": {
1197
+ "color": "#96c"
1198
+ },
1199
+ "hljs-function .hljs-title": {
1200
+ "color": "#fff"
1201
+ },
1202
+ "hljs-subst": {
1203
+ "color": "#fff"
1204
+ },
1205
+ "hljs-formula": {
1206
+ "backgroundColor": "#eee",
1207
+ "fontStyle": "italic"
1208
+ },
1209
+ "hljs-addition": {
1210
+ "backgroundColor": "#797"
1211
+ },
1212
+ "hljs-deletion": {
1213
+ "backgroundColor": "#c99"
1214
+ },
1215
+ "hljs-selector-id": {
1216
+ "color": "#964"
1217
+ },
1218
+ "hljs-selector-class": {
1219
+ "color": "#964"
1220
+ },
1221
+ "hljs-doctag": {
1222
+ "fontWeight": "bold"
1223
+ },
1224
+ "hljs-strong": {
1225
+ "fontWeight": "bold"
1226
+ },
1227
+ "hljs-emphasis": {
1228
+ "fontStyle": "italic"
1229
+ }
1230
+ };
1231
+
1232
+ const Snippet = ({
1233
+ content = 'Snippet',
1234
+ isDefault = false,
1235
+ dense = false,
1236
+ className,
1237
+ ...props
1238
+ }) => {
1239
+ return /*#__PURE__*/React.createElement("div", {
1240
+ className: classnames('snippet_wrapper')
1241
+ }, /*#__PURE__*/React.createElement(SyntaxHighlighter, _extends({
1242
+ language: "javascript",
1243
+ style: nnfxDark,
1244
+ className: classnames(['snippet', {
1245
+ ' snippet-dense': dense
1246
+ }, {
1247
+ ' snippet-default': isDefault
1248
+ }, className])
1249
+ }, props), content));
1250
+ };
1251
+ Snippet.propTypes = {
1252
+ content: PropTypes.string.isRequired,
1253
+ isDefault: PropTypes.bool,
1254
+ dense: PropTypes.bool,
1255
+ className: PropTypes.node
1256
+ };
1257
+
1258
+ const Status = ({
1259
+ color = 'inactive',
1260
+ dense,
1261
+ className,
1262
+ children = 'Status',
1263
+ ...props
1264
+ }) => {
1265
+ return /*#__PURE__*/React.createElement(Text, _extends({
1266
+ className: classnames(['status', {
1267
+ [`status-${color}`]: color,
1268
+ 'status-dense': dense
1269
+ }, className])
1270
+ }, props), children);
1271
+ };
1272
+ Status.propTypes = {
1273
+ color: PropTypes.oneOf(['inactive', 'success', 'info', 'warning', 'error']),
1274
+ dense: PropTypes.bool,
1275
+ className: PropTypes.node,
1276
+ children: PropTypes.node.isRequired
1277
+ };
1278
+
1279
+ const Switch = ({
1280
+ id,
1281
+ startLabel,
1282
+ endLabel,
1283
+ disabled,
1284
+ className,
1285
+ ...props
1286
+ }) => {
1287
+ return /*#__PURE__*/React.createElement("div", {
1288
+ className: classnames(['switch', {
1289
+ 'switch-disabled': disabled
1290
+ }, className])
1291
+ }, startLabel ? /*#__PURE__*/React.createElement(Text, {
1292
+ className: classnames('switch_label'),
1293
+ variant: "body"
1294
+ }, startLabel) : null, /*#__PURE__*/React.createElement("input", _extends({
1295
+ className: classnames('switch_input'),
1296
+ type: "checkbox",
1297
+ name: id,
1298
+ id: id,
1299
+ disabled: disabled
1300
+ }, props)), /*#__PURE__*/React.createElement("label", {
1301
+ className: classnames('switch_switch'),
1302
+ htmlFor: id
1303
+ }, /*#__PURE__*/React.createElement("div", {
1304
+ className: classnames('switch_toggle')
1305
+ })), endLabel ? /*#__PURE__*/React.createElement(Text, {
1306
+ className: classnames('switch_label'),
1307
+ variant: "body"
1308
+ }, endLabel) : null);
1309
+ };
1310
+ Switch.propTypes = {
1311
+ id: PropTypes.string,
1312
+ startLabel: PropTypes.string,
1313
+ endLabel: PropTypes.string,
1314
+ disabled: PropTypes.bool,
1315
+ className: PropTypes.node
1316
+ };
1317
+
1318
+ const TabsContext = /*#__PURE__*/createContext();
1319
+ const Tabs = ({
1320
+ direction,
1321
+ dense,
1322
+ hasBorder,
1323
+ className,
1324
+ children
1325
+ }) => {
1326
+ const [activeIndex, setActiveIndex] = useState(0);
1327
+ return /*#__PURE__*/React.createElement(TabsContext.Provider, {
1328
+ value: {
1329
+ activeIndex,
1330
+ setActiveIndex
1331
+ }
1332
+ }, /*#__PURE__*/React.createElement("div", {
1333
+ className: classnames(['tabs', {
1334
+ [`tabs-${direction}`]: direction,
1335
+ 'tabs-dense': dense,
1336
+ 'tabs-hasBorder': hasBorder
1337
+ }, className])
1338
+ }, children));
1339
+ };
1340
+ Tabs.propTypes = {
1341
+ direction: PropTypes.oneOf(['portrait', 'landscape']),
1342
+ dense: PropTypes.bool,
1343
+ hasBorder: PropTypes.bool,
1344
+ className: PropTypes.node,
1345
+ children: PropTypes.node.isRequired
1346
+ };
1347
+
1348
+ const Tab = ({
1349
+ index,
1350
+ label,
1351
+ className
1352
+ }) => {
1353
+ const {
1354
+ activeIndex,
1355
+ setActiveIndex
1356
+ } = useContext(TabsContext);
1357
+ const isSelected = activeIndex === index;
1358
+ return /*#__PURE__*/React.createElement("button", {
1359
+ className: classnames(['tab', {
1360
+ 'tab-active': isSelected
1361
+ }, className]),
1362
+ role: "tab",
1363
+ "aria-selected": isSelected,
1364
+ "aria-controls": `tabpanel-${index}`,
1365
+ id: `tab-${index}`,
1366
+ tabIndex: isSelected ? 0 : -1,
1367
+ onClick: () => setActiveIndex(index)
1368
+ }, label);
1369
+ };
1370
+ Tab.propTypes = {
1371
+ label: PropTypes.string,
1372
+ className: PropTypes.node.isRequired
1373
+ };
1374
+
1375
+ const TableFooter = ({
1376
+ className,
1377
+ ...props
1378
+ }) => {
1379
+ return /*#__PURE__*/React.createElement("div", _extends({
1380
+ className: classnames(['table_footer', className])
1381
+ }, props), /*#__PURE__*/React.createElement(Select, {
1382
+ dense: true,
1383
+ id: "rows",
1384
+ className: "table_rowSelect"
1385
+ }, /*#__PURE__*/React.createElement("option", {
1386
+ value: "1"
1387
+ }, "10"), /*#__PURE__*/React.createElement("option", {
1388
+ value: "2"
1389
+ }, "25"), /*#__PURE__*/React.createElement("option", {
1390
+ value: "2"
1391
+ }, "50"), /*#__PURE__*/React.createElement("option", {
1392
+ value: "2"
1393
+ }, "100"), /*#__PURE__*/React.createElement("option", {
1394
+ value: "2"
1395
+ }, "All")), /*#__PURE__*/React.createElement(Buttons, {
1396
+ className: "table_pagination"
1397
+ }, /*#__PURE__*/React.createElement(Button, {
1398
+ kind: "icon",
1399
+ variant: "transparent",
1400
+ size: "sm"
1401
+ }, /*#__PURE__*/React.createElement(CaretDoubleLeft, null)), /*#__PURE__*/React.createElement(Button, {
1402
+ kind: "icon",
1403
+ variant: "transparent",
1404
+ size: "sm"
1405
+ }, /*#__PURE__*/React.createElement(CaretLeft, null)), /*#__PURE__*/React.createElement(Button, {
1406
+ kind: "icon",
1407
+ size: "sm"
1408
+ }, "1"), /*#__PURE__*/React.createElement(Button, {
1409
+ kind: "icon",
1410
+ variant: "transparent",
1411
+ size: "sm"
1412
+ }, "2"), /*#__PURE__*/React.createElement(Button, {
1413
+ kind: "icon",
1414
+ variant: "transparent",
1415
+ size: "sm"
1416
+ }, "3"), /*#__PURE__*/React.createElement(Button, {
1417
+ kind: "icon",
1418
+ variant: "transparent",
1419
+ size: "sm"
1420
+ }, "\u2026"), /*#__PURE__*/React.createElement(Button, {
1421
+ kind: "icon",
1422
+ variant: "transparent",
1423
+ size: "sm"
1424
+ }, "8"), /*#__PURE__*/React.createElement(Button, {
1425
+ kind: "icon",
1426
+ variant: "transparent",
1427
+ size: "sm"
1428
+ }, /*#__PURE__*/React.createElement(CaretRight, null)), /*#__PURE__*/React.createElement(Button, {
1429
+ kind: "icon",
1430
+ variant: "transparent",
1431
+ size: "sm"
1432
+ }, /*#__PURE__*/React.createElement(CaretDoubleRight, null))));
1433
+ };
1434
+ TableFooter.propTypes = {
1435
+ className: PropTypes.node
1436
+ };
1437
+
1438
+ const DenseContext = /*#__PURE__*/createContext(false);
1439
+ const Table = ({
1440
+ striped,
1441
+ hasHover,
1442
+ dense,
1443
+ border,
1444
+ withFooter,
1445
+ className,
1446
+ children,
1447
+ ...props
1448
+ }) => {
1449
+ return /*#__PURE__*/React.createElement(DenseContext.Provider, {
1450
+ value: dense
1451
+ }, /*#__PURE__*/React.createElement("div", {
1452
+ className: classnames(['table', {
1453
+ 'table-striped': striped,
1454
+ 'table-hasHover': hasHover,
1455
+ 'table-dense': dense,
1456
+ 'table-border': border
1457
+ }, className])
1458
+ }, /*#__PURE__*/React.createElement("table", _extends({
1459
+ cellPadding: 0,
1460
+ cellSpacing: 0,
1461
+ className: classnames('table_content')
1462
+ }, props), children), withFooter ? /*#__PURE__*/React.createElement(TableFooter, {
1463
+ dense: dense ? dense : null
1464
+ }) : null));
1465
+ };
1466
+ Table.propTypes = {
1467
+ striped: PropTypes.bool,
1468
+ hasHover: PropTypes.bool,
1469
+ dense: PropTypes.bool,
1470
+ border: PropTypes.bool,
1471
+ withFooter: PropTypes.bool,
1472
+ className: PropTypes.node,
1473
+ children: PropTypes.node.isRequired
1474
+ };
1475
+
1476
+ const TableBody = ({
1477
+ className,
1478
+ children,
1479
+ ...props
1480
+ }) => {
1481
+ return /*#__PURE__*/React.createElement("tbody", _extends({
1482
+ className: classnames(['table_body', className])
1483
+ }, props), children);
1484
+ };
1485
+ TableBody.propTypes = {
1486
+ className: PropTypes.node,
1487
+ children: PropTypes.node.isRequired
1488
+ };
1489
+
1490
+ const TableCellComponentContext = /*#__PURE__*/createContext('td');
1491
+ const TableHead = ({
1492
+ className,
1493
+ children,
1494
+ ...props
1495
+ }) => {
1496
+ return /*#__PURE__*/React.createElement(TableCellComponentContext.Provider, {
1497
+ value: "th"
1498
+ }, /*#__PURE__*/React.createElement("thead", _extends({
1499
+ className: classnames(['table_head', className])
1500
+ }, props), children));
1501
+ };
1502
+ TableHead.propTypes = {
1503
+ className: PropTypes.node,
1504
+ children: PropTypes.node.isRequired
1505
+ };
1506
+
1507
+ const TableCell = ({
1508
+ kind = 'default',
1509
+ className,
1510
+ children,
1511
+ ...props
1512
+ }) => {
1513
+ const useTableCellComponent = () => useContext(TableCellComponentContext);
1514
+ const Component = useTableCellComponent();
1515
+ return /*#__PURE__*/React.createElement(Component, _extends({
1516
+ className: classnames(['table_cell', {
1517
+ [`table_cell-${kind}`]: kind
1518
+ }, className])
1519
+ }, props), children);
1520
+ };
1521
+ TableCell.propTypes = {
1522
+ kind: PropTypes.oneOf(['default', 'number', 'action']),
1523
+ className: PropTypes.node,
1524
+ children: PropTypes.node.isRequired
1525
+ };
1526
+
1527
+ const TableRow = ({
1528
+ className,
1529
+ children,
1530
+ ...props
1531
+ }) => {
1532
+ return /*#__PURE__*/React.createElement("tr", _extends({
1533
+ className: classnames(['table_row', className])
1534
+ }, props), children);
1535
+ };
1536
+ TableRow.propTypes = {
1537
+ className: PropTypes.node,
1538
+ children: PropTypes.node.isRequired
1539
+ };
1540
+
1541
+ const TabsControl = ({
1542
+ className,
1543
+ children
1544
+ }) => {
1545
+ return /*#__PURE__*/React.createElement("div", {
1546
+ role: "tablist",
1547
+ className: classnames(['tabs_controls', className])
1548
+ }, children);
1549
+ };
1550
+ TabsControl.propTypes = {
1551
+ className: PropTypes.node,
1552
+ children: PropTypes.node.isRequired
1553
+ };
1554
+
1555
+ const TabsPanel = ({
1556
+ index,
1557
+ className,
1558
+ children
1559
+ }) => {
1560
+ const {
1561
+ activeIndex
1562
+ } = useContext(TabsContext);
1563
+ const isActive = activeIndex === index;
1564
+ return isActive ? /*#__PURE__*/React.createElement("div", {
1565
+ className: classnames(['tabs_panel', className]),
1566
+ role: "tabpanel",
1567
+ id: `tabpanel-${index}`,
1568
+ "aria-labelledby": `tab-${index}`,
1569
+ hidden: !isActive
1570
+ }, children) : null;
1571
+ };
1572
+ TabsPanel.propTypes = {
1573
+ className: PropTypes.node,
1574
+ children: PropTypes.node.isRequired
1575
+ };
1576
+
1577
+ const Tag = ({
1578
+ color = 'primary',
1579
+ dense,
1580
+ className,
1581
+ children = 'Tag',
1582
+ ...props
1583
+ }) => {
1584
+ return /*#__PURE__*/React.createElement(Text, _extends({
1585
+ className: classnames(['tag', {
1586
+ [`tag-${color}`]: color,
1587
+ 'tag-dense': dense
1588
+ }, className])
1589
+ }, props), children);
1590
+ };
1591
+ Tag.propTypes = {
1592
+ color: PropTypes.oneOf(['primary', 'secondary', 'grey', 'success', 'info', 'warning', 'error']),
1593
+ dense: PropTypes.bool,
1594
+ className: PropTypes.node,
1595
+ children: PropTypes.node.isRequired
1596
+ };
1597
+
1598
+ const Textarea = ({
1599
+ onChange,
1600
+ id,
1601
+ placeholder,
1602
+ label = 'Textarea',
1603
+ isFocused,
1604
+ error,
1605
+ disabled,
1606
+ optional,
1607
+ hint,
1608
+ className,
1609
+ ...props
1610
+ }) => {
1611
+ const inputRef = useRef(null);
1612
+ useEffect(() => {
1613
+ if (isFocused && inputRef.current) {
1614
+ inputRef.current.focus();
1615
+ }
1616
+ }, [isFocused]);
1617
+ return /*#__PURE__*/React.createElement("div", {
1618
+ className: classnames(['input', {
1619
+ 'js-error': error,
1620
+ 'input-disabled': disabled,
1621
+ 'input-optional': optional
1622
+ }, className]),
1623
+ onChange: onChange
1624
+ }, /*#__PURE__*/React.createElement(InputLabel, {
1625
+ htmlFor: id,
1626
+ label: label,
1627
+ hint: hint,
1628
+ error: error
1629
+ }), /*#__PURE__*/React.createElement("textarea", _extends({
1630
+ ref: inputRef,
1631
+ className: 'input_control',
1632
+ name: id,
1633
+ id: id,
1634
+ placeholder: placeholder,
1635
+ disabled: disabled,
1636
+ required: !(disabled || optional),
1637
+ rows: 4
1638
+ }, hint || error ? {
1639
+ 'aria-describedby': [hint ? `${id}-hint` : null, error ? `${id}-error` : null].filter(Boolean).join(' ')
1640
+ } : null, props)));
1641
+ };
1642
+ Textarea.propTypes = {
1643
+ onChange: PropTypes.func,
1644
+ id: PropTypes.string.isRequired,
1645
+ placeholder: PropTypes.string,
1646
+ label: PropTypes.string.isRequired,
1647
+ isFocused: PropTypes.bool,
1648
+ error: PropTypes.bool,
1649
+ disabled: PropTypes.bool,
1650
+ optional: PropTypes.bool,
1651
+ hint: PropTypes.string,
1652
+ className: PropTypes.node
1653
+ };
1654
+
1655
+ export { Alert, Breadcrumbs, Button, Buttons, Card, CardActions, CardContent, CardHeader, CardMedia, Checkbox, Checkboxes, Color, Display, Divider, Grid, Input, InputLabel, Link, List, ListItem, Nav, NavBar, NavItem, Radio, RadioButtons, Section, SectionContent, SectionHeader, Select, Snippet, Status, Switch, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableRow, Tabs, TabsControl, TabsPanel, Tag, Text, Textarea };