@pingux/astro 1.2.0-alpha.0 → 1.2.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Breadcrumbs/BreadcrumbItem.js +3 -0
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.js +24 -14
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.test.js +9 -0
- package/lib/cjs/components/Button/Button.js +5 -2
- package/lib/cjs/components/Button/Button.stories.js +71 -17
- package/lib/cjs/components/Button/Button.test.js +26 -0
- package/lib/cjs/components/CopyText/CopyButton.js +9 -2
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +338 -0
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +295 -0
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +287 -0
- package/lib/cjs/components/EnvironmentBreadcrumb/index.js +18 -0
- package/lib/cjs/components/HelpHint/HelpHint.js +24 -6
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +57 -0
- package/lib/cjs/components/HelpHint/HelpHint.test.js +80 -0
- package/lib/cjs/components/Messages/Messages.reducer.js +2 -1
- package/lib/cjs/components/Messages/Messages.stories.js +10 -10
- package/lib/cjs/components/Messages/Messages.test.js +15 -1
- package/lib/cjs/components/Messages/index.js +21 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/cjs/components/NumberField/NumberField.js +3 -1
- package/lib/cjs/components/NumberField/NumberField.test.js +7 -0
- package/lib/cjs/components/OverlayPanel/OverlayPanel.js +2 -16
- package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +44 -0
- package/lib/cjs/components/SearchField/SearchField.stories.js +1 -15
- package/lib/cjs/components/TextAreaField/TextAreaField.js +1 -1
- package/lib/cjs/components/TextAreaField/TextAreaField.stories.js +1 -54
- package/lib/cjs/components/TextField/TextField.stories.js +79 -2
- package/lib/cjs/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
- package/lib/cjs/index.js +10 -0
- package/lib/cjs/styles/variants/boxes.js +13 -0
- package/lib/cjs/styles/variants/buttons.js +101 -2
- package/lib/cjs/styles/variants/text.js +23 -0
- package/lib/components/Breadcrumbs/BreadcrumbItem.js +4 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.js +24 -15
- package/lib/components/Breadcrumbs/Breadcrumbs.test.js +9 -0
- package/lib/components/Button/Button.js +6 -3
- package/lib/components/Button/Button.stories.js +53 -5
- package/lib/components/Button/Button.test.js +20 -0
- package/lib/components/CopyText/CopyButton.js +7 -2
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +296 -0
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +256 -0
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +246 -0
- package/lib/components/EnvironmentBreadcrumb/index.js +1 -0
- package/lib/components/HelpHint/HelpHint.js +25 -5
- package/lib/components/HelpHint/HelpHint.stories.js +34 -0
- package/lib/components/HelpHint/HelpHint.test.js +58 -0
- package/lib/components/Messages/Messages.reducer.js +1 -1
- package/lib/components/Messages/Messages.stories.js +1 -1
- package/lib/components/Messages/Messages.test.js +11 -1
- package/lib/components/Messages/index.js +2 -1
- package/lib/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/components/NumberField/NumberField.js +2 -1
- package/lib/components/NumberField/NumberField.test.js +7 -0
- package/lib/components/OverlayPanel/OverlayPanel.js +3 -16
- package/lib/components/OverlayPanel/OverlayPanel.test.js +38 -0
- package/lib/components/SearchField/SearchField.stories.js +0 -11
- package/lib/components/TextAreaField/TextAreaField.js +1 -1
- package/lib/components/TextAreaField/TextAreaField.stories.js +0 -43
- package/lib/components/TextField/TextField.stories.js +72 -0
- package/lib/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
- package/lib/index.js +1 -0
- package/lib/styles/variants/boxes.js +13 -0
- package/lib/styles/variants/buttons.js +101 -2
- package/lib/styles/variants/text.js +23 -0
- package/package.json +2 -2
package/lib/cjs/index.js
CHANGED
@@ -34,6 +34,7 @@ var _exportNames = {
|
|
34
34
|
ComboBoxField: true,
|
35
35
|
CopyText: true,
|
36
36
|
ColorField: true,
|
37
|
+
EnvironmentBreadcrumb: true,
|
37
38
|
FieldHelperText: true,
|
38
39
|
FileInputField: true,
|
39
40
|
HelpHint: true,
|
@@ -214,6 +215,13 @@ _Object$defineProperty(exports, "ColorField", {
|
|
214
215
|
}
|
215
216
|
});
|
216
217
|
|
218
|
+
_Object$defineProperty(exports, "EnvironmentBreadcrumb", {
|
219
|
+
enumerable: true,
|
220
|
+
get: function get() {
|
221
|
+
return _EnvironmentBreadcrumb["default"];
|
222
|
+
}
|
223
|
+
});
|
224
|
+
|
217
225
|
_Object$defineProperty(exports, "FieldHelperText", {
|
218
226
|
enumerable: true,
|
219
227
|
get: function get() {
|
@@ -817,6 +825,8 @@ var _CopyText = _interopRequireDefault(require("./components/CopyText"));
|
|
817
825
|
|
818
826
|
var _ColorField = _interopRequireDefault(require("./components/ColorField"));
|
819
827
|
|
828
|
+
var _EnvironmentBreadcrumb = _interopRequireDefault(require("./components/EnvironmentBreadcrumb"));
|
829
|
+
|
820
830
|
var _FieldHelperText = _interopRequireWildcard(require("./components/FieldHelperText"));
|
821
831
|
|
822
832
|
_forEachInstanceProperty(_context14 = _Object$keys(_FieldHelperText)).call(_context14, function (key) {
|
@@ -274,6 +274,18 @@ var datePicker = {
|
|
274
274
|
}
|
275
275
|
}
|
276
276
|
};
|
277
|
+
|
278
|
+
var environmentChip = _objectSpread(_objectSpread({}, chip), {}, {
|
279
|
+
alignSelf: 'center',
|
280
|
+
height: '17px',
|
281
|
+
minWidth: 'fit-content',
|
282
|
+
ml: 8,
|
283
|
+
'& span': {
|
284
|
+
fontSize: 'xs',
|
285
|
+
lineHeight: 1
|
286
|
+
}
|
287
|
+
});
|
288
|
+
|
277
289
|
var fileInputFieldWrapper = {
|
278
290
|
display: 'flex',
|
279
291
|
border: '1px dashed',
|
@@ -302,6 +314,7 @@ var _default = {
|
|
302
314
|
chip: chip,
|
303
315
|
copy: copy,
|
304
316
|
datePicker: datePicker,
|
317
|
+
environmentChip: environmentChip,
|
305
318
|
expandableRow: expandableRow,
|
306
319
|
inputInContainerSlot: inputInContainerSlot,
|
307
320
|
fileInputFieldWrapper: fileInputFieldWrapper,
|
@@ -317,6 +317,11 @@ var helpHint = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
317
317
|
ml: '5px',
|
318
318
|
maxWidth: '13px',
|
319
319
|
maxHeight: '14px',
|
320
|
+
borderRadius: '5.5px',
|
321
|
+
'svg': {
|
322
|
+
'height': '100%',
|
323
|
+
mb: 0.75
|
324
|
+
},
|
320
325
|
'path': {
|
321
326
|
fill: 'neutral.20'
|
322
327
|
},
|
@@ -376,7 +381,7 @@ var chipDeleteButton = {
|
|
376
381
|
borderRadius: '50%',
|
377
382
|
cursor: 'pointer',
|
378
383
|
height: 14,
|
379
|
-
|
384
|
+
mx: '3px !important',
|
380
385
|
p: 0,
|
381
386
|
width: 14,
|
382
387
|
'&.is-focused, &.is-hovered': {
|
@@ -485,6 +490,28 @@ var expandableRow = {
|
|
485
490
|
}
|
486
491
|
}
|
487
492
|
};
|
493
|
+
var environmentBreadcrumb = {
|
494
|
+
current: _objectSpread(_objectSpread({}, text), {}, {
|
495
|
+
color: 'neutral.30',
|
496
|
+
fontSize: 'md',
|
497
|
+
fontWeight: 1,
|
498
|
+
'&.is-hovered, &.is-focused': {
|
499
|
+
color: 'active',
|
500
|
+
textDecoration: 'none',
|
501
|
+
boxShadow: 'none'
|
502
|
+
},
|
503
|
+
'&.is-pressed': {
|
504
|
+
color: 'accent.20',
|
505
|
+
textDecoration: 'none'
|
506
|
+
}
|
507
|
+
}),
|
508
|
+
selectItem: _objectSpread(_objectSpread({}, text), {}, {
|
509
|
+
color: 'neutral.10',
|
510
|
+
fontSize: 'md',
|
511
|
+
fontWeight: 0,
|
512
|
+
justifyContent: 'start'
|
513
|
+
})
|
514
|
+
};
|
488
515
|
var fileInputField = {
|
489
516
|
background: 'none',
|
490
517
|
cursor: 'pointer',
|
@@ -534,6 +561,75 @@ var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
|
|
534
561
|
}
|
535
562
|
});
|
536
563
|
|
564
|
+
var defaultVariant = _objectSpread(_objectSpread({}, base), {}, {
|
565
|
+
bg: 'white',
|
566
|
+
border: '1px solid',
|
567
|
+
borderColor: 'active',
|
568
|
+
'&.is-hovered': _objectSpread({}, defaultHover),
|
569
|
+
'&.is-pressed': _objectSpread({}, defaultActive),
|
570
|
+
'&.is-focused': _objectSpread({}, defaultFocus)
|
571
|
+
});
|
572
|
+
|
573
|
+
var filter = _objectSpread(_objectSpread({}, defaultVariant), {}, {
|
574
|
+
px: 'sm',
|
575
|
+
borderColor: 'neutral.80',
|
576
|
+
height: 40,
|
577
|
+
color: 'active',
|
578
|
+
display: 'flex'
|
579
|
+
});
|
580
|
+
|
581
|
+
var colorBlock = {
|
582
|
+
bg: 'neutral.95',
|
583
|
+
border: '1px solid',
|
584
|
+
borderColor: 'neutral.90',
|
585
|
+
borderRadius: 10,
|
586
|
+
outline: 'none',
|
587
|
+
cursor: 'pointer',
|
588
|
+
width: 150,
|
589
|
+
minHeight: 40,
|
590
|
+
p: '5px 15px',
|
591
|
+
display: 'flex',
|
592
|
+
justifyContent: 'space-between',
|
593
|
+
alignItems: 'center',
|
594
|
+
'&.is-hovered': {
|
595
|
+
bg: 'neutral.80'
|
596
|
+
},
|
597
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
598
|
+
'&.is-pressed': {
|
599
|
+
bg: 'neutral.60',
|
600
|
+
borderColor: 'neutral.60'
|
601
|
+
},
|
602
|
+
'& span': {
|
603
|
+
color: 'text.primary',
|
604
|
+
textAlign: 'left'
|
605
|
+
},
|
606
|
+
'&>div': {
|
607
|
+
alignItems: 'baseline'
|
608
|
+
},
|
609
|
+
'&>svg': {
|
610
|
+
color: 'text.secondary',
|
611
|
+
fill: 'text.secondary'
|
612
|
+
},
|
613
|
+
'&.is-configured': {
|
614
|
+
bg: 'active',
|
615
|
+
borderColor: 'active',
|
616
|
+
'& span': {
|
617
|
+
color: 'white'
|
618
|
+
},
|
619
|
+
'&>svg': {
|
620
|
+
color: 'white',
|
621
|
+
fill: 'white'
|
622
|
+
}
|
623
|
+
},
|
624
|
+
'&.is-configured.is-hovered': {
|
625
|
+
bg: 'accent.40',
|
626
|
+
borderColor: 'accent.40'
|
627
|
+
},
|
628
|
+
'&.is-configured.is-pressed': {
|
629
|
+
bg: 'accent.20',
|
630
|
+
borderColor: 'accent.20'
|
631
|
+
}
|
632
|
+
};
|
537
633
|
var _default = {
|
538
634
|
accordionHeader: accordionHeader,
|
539
635
|
chipDeleteButton: chipDeleteButton,
|
@@ -551,8 +647,10 @@ var _default = {
|
|
551
647
|
'&.is-pressed': _objectSpread({}, defaultActive),
|
552
648
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
553
649
|
}),
|
650
|
+
environmentBreadcrumb: environmentBreadcrumb,
|
554
651
|
expandableRow: expandableRow,
|
555
652
|
fileInputField: fileInputField,
|
653
|
+
filter: filter,
|
556
654
|
iconButton: iconButton,
|
557
655
|
imageUpload: imageUpload,
|
558
656
|
inline: inline,
|
@@ -572,6 +670,7 @@ var _default = {
|
|
572
670
|
invertedSquare: invertedSquare,
|
573
671
|
tooltipChip: tooltipChip,
|
574
672
|
tooltipIconButton: tooltipIconButton,
|
575
|
-
tooltipInline: tooltipInline
|
673
|
+
tooltipInline: tooltipInline,
|
674
|
+
colorBlock: colorBlock
|
576
675
|
};
|
577
676
|
exports["default"] = _default;
|
@@ -139,6 +139,14 @@ var expandableRow = {
|
|
139
139
|
}
|
140
140
|
}
|
141
141
|
};
|
142
|
+
|
143
|
+
var environmentBreadcrumb = _objectSpread(_objectSpread({}, base), {}, {
|
144
|
+
fontSize: 'sm',
|
145
|
+
fontWeight: 3,
|
146
|
+
color: 'secondary',
|
147
|
+
textTransform: 'capitalize'
|
148
|
+
});
|
149
|
+
|
142
150
|
var navBarSubtitle = {
|
143
151
|
fontWeight: 3,
|
144
152
|
fontSize: '11px',
|
@@ -170,11 +178,26 @@ var text = {
|
|
170
178
|
color: 'accent.30',
|
171
179
|
fontFamily: 'standard'
|
172
180
|
}),
|
181
|
+
buttonTitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
182
|
+
fontSize: 'xs',
|
183
|
+
fontWeight: 0,
|
184
|
+
color: 'text.primary',
|
185
|
+
fontFamily: 'standard',
|
186
|
+
lineHeight: '13px'
|
187
|
+
}),
|
188
|
+
buttonSubtitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
189
|
+
fontSize: 'sm',
|
190
|
+
fontWeight: 3,
|
191
|
+
color: 'text.primary',
|
192
|
+
fontFamily: 'standard',
|
193
|
+
lineHeight: '16px'
|
194
|
+
}),
|
173
195
|
capsLabel: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
174
196
|
color: 'text.secondary',
|
175
197
|
textTransform: 'uppercase',
|
176
198
|
fontFamily: 'standard'
|
177
199
|
}),
|
200
|
+
environmentBreadcrumb: environmentBreadcrumb,
|
178
201
|
fieldHelperText: fieldHelperText,
|
179
202
|
inputValue: {
|
180
203
|
fontWeight: 1,
|
@@ -14,7 +14,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
14
14
|
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source), true)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context3; _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
16
|
|
17
|
-
import React, { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
|
17
|
+
import React, { forwardRef, Fragment, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
|
18
18
|
import { useBreadcrumbItem } from '@react-aria/breadcrumbs';
|
19
19
|
import PropTypes from 'prop-types';
|
20
20
|
import { mergeProps } from '@react-aria/utils';
|
@@ -54,6 +54,9 @@ var BreadcrumbItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
54
54
|
case 'Text':
|
55
55
|
return Text;
|
56
56
|
|
57
|
+
case 'Fragment':
|
58
|
+
return Fragment;
|
59
|
+
|
57
60
|
default:
|
58
61
|
return elementType;
|
59
62
|
}
|
@@ -1,7 +1,9 @@
|
|
1
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
3
5
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
import React, { forwardRef, useRef, useImperativeHandle, Fragment } from 'react';
|
6
|
+
import React, { forwardRef, useRef, useImperativeHandle, Fragment, useCallback } from 'react';
|
5
7
|
import { useBreadcrumbs } from '@react-aria/breadcrumbs';
|
6
8
|
import PropTypes from 'prop-types';
|
7
9
|
import { mergeProps } from '@react-aria/utils';
|
@@ -21,7 +23,12 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
21
23
|
icon = props.icon,
|
22
24
|
iconProps = props.iconProps,
|
23
25
|
onAction = props.onAction,
|
24
|
-
others = _objectWithoutProperties(props, ["children", "icon", "iconProps", "onAction"]);
|
26
|
+
others = _objectWithoutProperties(props, ["children", "icon", "iconProps", "onAction"]); // the following filters undefined values passed as a child
|
27
|
+
|
28
|
+
|
29
|
+
var filteredChildren = _Array$isArray(children) ? _filterInstanceProperty(children).call(children, function (child) {
|
30
|
+
return child;
|
31
|
+
}) : children;
|
25
32
|
|
26
33
|
var _useBreadcrumbs = useBreadcrumbs(props),
|
27
34
|
wrapperProps = _useBreadcrumbs.navProps;
|
@@ -33,26 +40,28 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
40
|
useImperativeHandle(ref, function () {
|
34
41
|
return breadcrumbsRef.current;
|
35
42
|
});
|
36
|
-
|
37
|
-
|
38
|
-
display: "flex",
|
39
|
-
flexDirection: "row",
|
40
|
-
alignItems: "center",
|
41
|
-
sx: {
|
42
|
-
overflow: 'auto'
|
43
|
-
}
|
44
|
-
}, mergeProps(wrapperProps, others)), _mapInstanceProperty(children).call(children, function (child, idx) {
|
43
|
+
var createBreadcrumb = useCallback(function (child, idx) {
|
44
|
+
var isCurrentItem = _Array$isArray(filteredChildren) && filteredChildren.length > 1 ? idx === children.length - 1 : true;
|
45
45
|
return ___EmotionJSX(Fragment, {
|
46
46
|
key: "fragment-".concat(child.key)
|
47
47
|
}, ___EmotionJSX(BreadcrumbItem, _extends({
|
48
48
|
"data-id": child['data-id'],
|
49
|
-
isCurrent:
|
49
|
+
isCurrent: isCurrentItem,
|
50
50
|
onAction: onAction,
|
51
51
|
actionKey: child.key
|
52
|
-
}, child.props), child.props.children), icon &&
|
52
|
+
}, child.props), child.props.children), icon && !isCurrentItem && ___EmotionJSX(Icon, _extends({
|
53
53
|
icon: icon
|
54
54
|
}, iconProps)));
|
55
|
-
})
|
55
|
+
}, [children.length, filteredChildren, icon, iconProps, onAction]);
|
56
|
+
return ___EmotionJSX(Box, _extends({
|
57
|
+
ref: breadcrumbsRef,
|
58
|
+
display: "flex",
|
59
|
+
flexDirection: "row",
|
60
|
+
alignItems: "center",
|
61
|
+
sx: {
|
62
|
+
overflow: 'auto'
|
63
|
+
}
|
64
|
+
}, mergeProps(wrapperProps, others)), _Array$isArray(filteredChildren) ? _mapInstanceProperty(filteredChildren).call(filteredChildren, createBreadcrumb) : createBreadcrumb(children));
|
56
65
|
});
|
57
66
|
Breadcrumbs.propTypes = {
|
58
67
|
/** The icon to render in between each node. */
|
@@ -89,4 +89,13 @@ test('Item accepts a data-id and the data-id can be found in the DOM', function
|
|
89
89
|
var item = screen.getByText(testItemsArr[0]);
|
90
90
|
expect(item).toBeInTheDocument();
|
91
91
|
expect(item).toHaveAttribute('data-id', testItemsArr[0]);
|
92
|
+
});
|
93
|
+
test('will render correctly with single child item', function () {
|
94
|
+
render(___EmotionJSX(Breadcrumbs, mergeProps(defaultProps), ___EmotionJSX(Item, {
|
95
|
+
key: testItemsArr[0],
|
96
|
+
"data-id": testItemsArr[0],
|
97
|
+
isCurrent: true
|
98
|
+
}, testItemsArr[0])));
|
99
|
+
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
100
|
+
expect(screen.getByText(testItemsArr[0])).toBeInTheDocument();
|
92
101
|
});
|
@@ -21,7 +21,7 @@ import { useButton } from '@react-aria/button';
|
|
21
21
|
import { useHover } from '@react-aria/interactions';
|
22
22
|
import { useFocusRing } from '@react-aria/focus';
|
23
23
|
import { mergeProps } from '@react-aria/utils';
|
24
|
-
import { useStatusClasses, usePropWarning } from '../../hooks';
|
24
|
+
import { useStatusClasses, usePropWarning, useAriaLabelWarning } from '../../hooks';
|
25
25
|
import Loader from '../Loader';
|
26
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
27
|
var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -37,7 +37,8 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
37
|
onPressChange = props.onPressChange,
|
38
38
|
onPressUp = props.onPressUp,
|
39
39
|
children = props.children,
|
40
|
-
|
40
|
+
variant = props.variant,
|
41
|
+
others = _objectWithoutProperties(props, ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "variant"]);
|
41
42
|
|
42
43
|
var buttonRef = useRef();
|
43
44
|
usePropWarning(props, 'disabled', 'isDisabled');
|
@@ -70,6 +71,7 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
71
|
classNames = _useStatusClasses.classNames;
|
71
72
|
|
72
73
|
var ariaLabel = props['aria-label'];
|
74
|
+
useAriaLabelWarning('Button', ariaLabel, variant === 'filter');
|
73
75
|
return ___EmotionJSX(ThemeUIButton, _extends({
|
74
76
|
"aria-label": ariaLabel,
|
75
77
|
ref: buttonRef,
|
@@ -80,7 +82,8 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
80
82
|
display: 'flex',
|
81
83
|
justifyContent: 'center',
|
82
84
|
alignItems: 'center'
|
83
|
-
}
|
85
|
+
},
|
86
|
+
variant: variant
|
84
87
|
}, others, mergeProps(hoverProps, focusProps, buttonProps)), isLoading ? ___EmotionJSX("span", {
|
85
88
|
style: {
|
86
89
|
visibility: 'hidden'
|
@@ -1,10 +1,11 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
1
3
|
import React from 'react';
|
2
4
|
import AddCircleIcon from 'mdi-react/AddCircleIcon';
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import Text from '
|
7
|
-
import { buttonVariants } from '../../utils/devUtils/constants/variants'; // removing the iconButton variants from this story.
|
5
|
+
import CreateIcon from 'mdi-react/CreateIcon';
|
6
|
+
import FilterIcon from 'mdi-react/FilterIcon';
|
7
|
+
import { buttonVariants } from '../../utils/devUtils/constants/variants';
|
8
|
+
import { Box, Button, Icon, SearchField, Text } from '../../index'; // removing the iconButton variants from this story.
|
8
9
|
|
9
10
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
11
|
var variants = buttonVariants;
|
@@ -36,6 +37,13 @@ export default {
|
|
36
37
|
type: 'text'
|
37
38
|
}
|
38
39
|
}
|
40
|
+
},
|
41
|
+
parameters: {
|
42
|
+
docs: {
|
43
|
+
source: {
|
44
|
+
type: 'code'
|
45
|
+
}
|
46
|
+
}
|
39
47
|
}
|
40
48
|
};
|
41
49
|
export var Default = function Default(args) {
|
@@ -74,4 +82,44 @@ export var InlineButton = function InlineButton() {
|
|
74
82
|
mb: "sm",
|
75
83
|
variant: "inline"
|
76
84
|
}, "Inline");
|
85
|
+
};
|
86
|
+
export var ColorBlockButton = function ColorBlockButton(args) {
|
87
|
+
// Change `isConfigured` property in storybook controls
|
88
|
+
var isConfigured = args.isConfigured,
|
89
|
+
props = _objectWithoutProperties(args, ["isConfigured"]);
|
90
|
+
|
91
|
+
return ___EmotionJSX(Button, _extends({}, props, {
|
92
|
+
variant: "colorBlock",
|
93
|
+
className: isConfigured ? 'is-configured' : ''
|
94
|
+
}), ___EmotionJSX(Box, null, ___EmotionJSX(Text, {
|
95
|
+
variant: "buttonTitle"
|
96
|
+
}, "Title"), ___EmotionJSX(Text, {
|
97
|
+
variant: "buttonSubtitle"
|
98
|
+
}, "Info")), ___EmotionJSX(Icon, {
|
99
|
+
icon: CreateIcon
|
100
|
+
}));
|
101
|
+
};
|
102
|
+
ColorBlockButton.story = {
|
103
|
+
argTypes: {
|
104
|
+
isConfigured: {
|
105
|
+
control: {
|
106
|
+
type: 'boolean'
|
107
|
+
},
|
108
|
+
defaultValue: false
|
109
|
+
}
|
110
|
+
}
|
111
|
+
};
|
112
|
+
export var FilterButton = function FilterButton() {
|
113
|
+
return ___EmotionJSX(Box, {
|
114
|
+
p: "xx",
|
115
|
+
isRow: true,
|
116
|
+
gap: "md"
|
117
|
+
}, ___EmotionJSX(SearchField, {
|
118
|
+
"aria-label": "search items"
|
119
|
+
}), ___EmotionJSX(Button, {
|
120
|
+
variant: "filter",
|
121
|
+
"aria-label": "filter button"
|
122
|
+
}, ___EmotionJSX(Icon, {
|
123
|
+
icon: FilterIcon
|
124
|
+
})));
|
77
125
|
};
|
@@ -89,4 +89,24 @@ test('button renders children when not loading', function () {
|
|
89
89
|
expect(childWrapper).toBeInTheDocument();
|
90
90
|
expect(childWrapper).toBeVisible();
|
91
91
|
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
92
|
+
});
|
93
|
+
test('color block button renders in default state', function () {
|
94
|
+
getComponent({
|
95
|
+
variant: 'colorBlock'
|
96
|
+
});
|
97
|
+
var button = screen.getByRole('button');
|
98
|
+
expect(button).toBeInTheDocument();
|
99
|
+
expect(button).not.toHaveClass('is-configured');
|
100
|
+
userEvent.tab();
|
101
|
+
expect(button).toHaveClass('is-focused');
|
102
|
+
expect(button).toHaveFocus();
|
103
|
+
});
|
104
|
+
test('color block button renders in configured state', function () {
|
105
|
+
getComponent({
|
106
|
+
variant: 'colorBlock',
|
107
|
+
className: 'is-configured'
|
108
|
+
});
|
109
|
+
var button = screen.getByRole('button');
|
110
|
+
expect(button).toBeInTheDocument();
|
111
|
+
expect(button).toHaveClass('is-configured');
|
92
112
|
});
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React, { forwardRef } from 'react';
|
3
3
|
import ContentCopy from 'mdi-react/ContentCopyIcon';
|
4
|
+
import { omit } from 'lodash';
|
5
|
+
import PropTypes from 'prop-types';
|
4
6
|
import Icon from '../Icon';
|
5
7
|
import IconButton from '../IconButton';
|
6
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -9,9 +11,12 @@ var CopyButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
9
11
|
ref: ref,
|
10
12
|
"aria-label": "copy",
|
11
13
|
variant: "buttons.copy"
|
12
|
-
}, props), ___EmotionJSX(Icon, {
|
14
|
+
}, omit(props, 'iconProps')), ___EmotionJSX(Icon, _extends({
|
13
15
|
icon: ContentCopy,
|
14
16
|
size: 15
|
15
|
-
}));
|
17
|
+
}, props === null || props === void 0 ? void 0 : props.iconProps)));
|
16
18
|
});
|
19
|
+
CopyButton.propTypes = {
|
20
|
+
iconProps: PropTypes.shape({})
|
21
|
+
};
|
17
22
|
export default CopyButton;
|