@pingux/astro 1.0.0-alpha.9 → 1.1.0-alpha.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/CHANGELOG.md +169 -0
- package/README.md +5 -0
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
- package/lib/cjs/components/Button/Button.js +5 -24
- package/lib/cjs/components/Button/Button.stories.js +5 -11
- package/lib/cjs/components/Button/Button.test.js +0 -24
- package/lib/cjs/components/Chip/Chip.js +26 -10
- package/lib/cjs/components/Chip/Chip.stories.js +44 -5
- package/lib/cjs/components/Chip/Chip.test.js +9 -0
- package/lib/cjs/components/{DropdownField/index.js → Chip/ChipContext.js} +8 -7
- package/lib/cjs/components/IconButton/IconButton.js +17 -7
- package/lib/cjs/components/IconButton/IconButton.stories.js +8 -17
- package/lib/cjs/components/IconButton/IconButton.test.js +0 -1
- package/lib/cjs/components/ListItem/ListItem.stories.js +0 -2
- package/lib/cjs/components/ListView/ListView.js +4 -3
- package/lib/cjs/components/ListView/ListView.stories.js +580 -39
- package/lib/cjs/components/ListViewItem/ListViewItem.js +3 -6
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +1 -1
- package/lib/cjs/components/Stepper/Stepper.js +1 -0
- package/lib/cjs/components/Tab/Tab.js +5 -3
- package/lib/cjs/components/Tabs/Tabs.js +3 -0
- package/lib/cjs/components/Tabs/Tabs.stories.js +3 -4
- package/lib/cjs/components/Tabs/Tabs.test.js +44 -15
- package/lib/cjs/components/TextAreaField/TextAreaField.test.js +10 -0
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.stories.js +45 -2
- package/lib/cjs/index.js +48 -136
- package/lib/cjs/layouts/ListLayout.stories.js +2 -1
- package/lib/cjs/layouts/SchemaFormLayout.stories.js +2 -21
- package/lib/cjs/recipes/ArrayField.stories.js +3 -3
- package/lib/cjs/styles/forms/input.js +4 -0
- package/lib/cjs/styles/theme.js +0 -3
- package/lib/cjs/styles/variants/accordion.js +5 -7
- package/lib/cjs/styles/variants/boxes.js +22 -19
- package/lib/cjs/styles/variants/buttons.js +48 -29
- package/lib/cjs/styles/variants/variants.js +0 -3
- package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
- package/lib/components/Button/Button.js +7 -24
- package/lib/components/Button/Button.stories.js +5 -10
- package/lib/components/Button/Button.test.js +0 -20
- package/lib/components/Chip/Chip.js +25 -10
- package/lib/components/Chip/Chip.stories.js +41 -5
- package/lib/components/Chip/Chip.test.js +9 -0
- package/lib/components/Chip/ChipContext.js +3 -0
- package/lib/components/IconButton/IconButton.js +17 -9
- package/lib/components/IconButton/IconButton.stories.js +7 -13
- package/lib/components/IconButton/IconButton.test.js +0 -1
- package/lib/components/ListItem/ListItem.stories.js +0 -2
- package/lib/components/ListView/ListView.js +4 -3
- package/lib/components/ListView/ListView.stories.js +577 -39
- package/lib/components/ListViewItem/ListViewItem.js +3 -5
- package/lib/components/MultivaluesField/MultivaluesField.js +1 -1
- package/lib/components/Stepper/Stepper.js +1 -0
- package/lib/components/Tab/Tab.js +5 -3
- package/lib/components/Tabs/Tabs.js +3 -0
- package/lib/components/Tabs/Tabs.stories.js +3 -4
- package/lib/components/Tabs/Tabs.test.js +40 -15
- package/lib/components/TextAreaField/TextAreaField.test.js +8 -0
- package/lib/components/TooltipTrigger/TooltipTrigger.stories.js +33 -1
- package/lib/index.js +0 -8
- package/lib/layouts/ListLayout.stories.js +2 -1
- package/lib/layouts/SchemaFormLayout.stories.js +2 -19
- package/lib/recipes/ArrayField.stories.js +3 -3
- package/lib/styles/forms/input.js +4 -0
- package/lib/styles/theme.js +0 -3
- package/lib/styles/variants/accordion.js +5 -7
- package/lib/styles/variants/boxes.js +21 -19
- package/lib/styles/variants/buttons.js +47 -29
- package/lib/styles/variants/variants.js +0 -2
- package/package.json +1 -1
- package/lib/cjs/components/Dropdown/Dropdown.js +0 -112
- package/lib/cjs/components/Dropdown/Dropdown.test.js +0 -80
- package/lib/cjs/components/Dropdown/index.js +0 -18
- package/lib/cjs/components/DropdownField/DropdownField.js +0 -187
- package/lib/cjs/components/DropdownField/DropdownField.stories.js +0 -278
- package/lib/cjs/components/DropdownField/DropdownField.test.js +0 -80
- package/lib/cjs/components/Panel/Panel.js +0 -101
- package/lib/cjs/components/Panel/Panel.stories.js +0 -57
- package/lib/cjs/components/Panel/Panel.test.js +0 -72
- package/lib/cjs/components/Panel/index.js +0 -18
- package/lib/cjs/components/Popover/Popover.js +0 -87
- package/lib/cjs/components/Popover/Popover.stories.js +0 -80
- package/lib/cjs/components/Popover/Popover.test.js +0 -91
- package/lib/cjs/components/Popover/index.js +0 -18
- package/lib/cjs/recipes/InputBoxWithLinkedChip.stories.js +0 -67
- package/lib/cjs/styles/variants/popover.js +0 -86
- package/lib/components/Dropdown/Dropdown.js +0 -90
- package/lib/components/Dropdown/Dropdown.test.js +0 -62
- package/lib/components/Dropdown/index.js +0 -1
- package/lib/components/DropdownField/DropdownField.js +0 -155
- package/lib/components/DropdownField/DropdownField.stories.js +0 -222
- package/lib/components/DropdownField/DropdownField.test.js +0 -60
- package/lib/components/DropdownField/index.js +0 -1
- package/lib/components/Panel/Panel.js +0 -71
- package/lib/components/Panel/Panel.stories.js +0 -35
- package/lib/components/Panel/Panel.test.js +0 -52
- package/lib/components/Panel/index.js +0 -1
- package/lib/components/Popover/Popover.js +0 -65
- package/lib/components/Popover/Popover.stories.js +0 -52
- package/lib/components/Popover/Popover.test.js +0 -75
- package/lib/components/Popover/index.js +0 -2
- package/lib/recipes/InputBoxWithLinkedChip.stories.js +0 -43
- package/lib/styles/variants/popover.js +0 -76
@@ -37,10 +37,10 @@ var accordionBody = {
|
|
37
37
|
var accordionGridHeader = {
|
38
38
|
cursor: 'pointer',
|
39
39
|
lineHeight: '30px',
|
40
|
-
|
40
|
+
pl: 'sm',
|
41
41
|
outline: 'none',
|
42
42
|
display: 'flex',
|
43
|
-
justifyContent: '
|
43
|
+
justifyContent: 'center',
|
44
44
|
flexShrink: 0,
|
45
45
|
wordBreak: 'inherit',
|
46
46
|
whiteSpace: 'nowrap',
|
@@ -54,12 +54,9 @@ var accordionGridHeader = {
|
|
54
54
|
WebkitBoxShadow: 'focus',
|
55
55
|
MozBoxShadow: 'focus'
|
56
56
|
},
|
57
|
-
|
57
|
+
minHeight: '64px',
|
58
58
|
'&.is-hovered': {
|
59
|
-
|
60
|
-
'& div > div > div > span': {
|
61
|
-
color: 'active'
|
62
|
-
}
|
59
|
+
backgroundColor: 'accent.99'
|
63
60
|
},
|
64
61
|
'&.is-pressed': {
|
65
62
|
color: 'accent.20',
|
@@ -70,6 +67,7 @@ var accordionGridHeader = {
|
|
70
67
|
};
|
71
68
|
var accordionGridBody = {
|
72
69
|
display: 'none !important',
|
70
|
+
pl: 'sm',
|
73
71
|
width: '100%',
|
74
72
|
'&.is-selected': {
|
75
73
|
display: 'flex !important'
|
@@ -8,7 +8,7 @@ _Object$defineProperty2(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports["default"] = void 0;
|
11
|
+
exports["default"] = exports.chip = void 0;
|
12
12
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
|
14
14
|
|
@@ -37,20 +37,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
37
37
|
var base = {
|
38
38
|
display: 'flex'
|
39
39
|
};
|
40
|
-
var panel = {
|
41
|
-
outline: 'none',
|
42
|
-
position: 'relative',
|
43
|
-
bg: 'white',
|
44
|
-
borderLeft: 'separator',
|
45
|
-
transition: 'margin 0.25s ease-in',
|
46
|
-
visibility: 'hidden',
|
47
|
-
'&.is-focused': {
|
48
|
-
boxShadow: 'focus'
|
49
|
-
},
|
50
|
-
'&.is-visible': {
|
51
|
-
visibility: 'visible'
|
52
|
-
}
|
53
|
-
};
|
54
40
|
var card = {
|
55
41
|
boxShadow: 'standard',
|
56
42
|
p: 'lg',
|
@@ -106,6 +92,10 @@ var listViewItem = _objectSpread(_objectSpread({}, base), {}, {
|
|
106
92
|
},
|
107
93
|
'&.is-focused': {
|
108
94
|
boxShadow: 'inset 0 0 5px #5873bdbf'
|
95
|
+
},
|
96
|
+
'&.has-separator': {
|
97
|
+
borderBottom: '1px solid',
|
98
|
+
borderBottomColor: 'line.hairline'
|
109
99
|
}
|
110
100
|
});
|
111
101
|
|
@@ -119,15 +109,29 @@ var listBoxSectionTitle = {
|
|
119
109
|
};
|
120
110
|
var chip = {
|
121
111
|
cursor: 'pointer',
|
122
|
-
|
123
|
-
p: '10px',
|
112
|
+
p: '3px 5px 4px 5px',
|
124
113
|
alignItems: 'center',
|
125
114
|
justifyContent: 'center',
|
126
115
|
minWidth: '50px',
|
127
116
|
alignSelf: 'flex-start',
|
128
117
|
display: 'inline-flex !important',
|
129
|
-
borderRadius: '5px'
|
118
|
+
borderRadius: '5px',
|
119
|
+
fontWeight: 1,
|
120
|
+
'& button': {
|
121
|
+
backgroundColor: 'transparent',
|
122
|
+
marginLeft: 'xs',
|
123
|
+
marginTop: '1px',
|
124
|
+
padding: '0',
|
125
|
+
'&.is-hovered': {
|
126
|
+
backgroundColor: 'white'
|
127
|
+
},
|
128
|
+
'& .mdi-icon': {
|
129
|
+
marginLeft: '0',
|
130
|
+
padding: '2px'
|
131
|
+
}
|
132
|
+
}
|
130
133
|
};
|
134
|
+
exports.chip = chip;
|
131
135
|
var inputInContainerSlot = {
|
132
136
|
position: 'absolute',
|
133
137
|
bg: 'transparent',
|
@@ -284,7 +288,6 @@ var _default = {
|
|
284
288
|
listItem: listItem,
|
285
289
|
listBoxSectionTitle: listBoxSectionTitle,
|
286
290
|
listViewItem: listViewItem,
|
287
|
-
panel: panel,
|
288
291
|
radioCheckedContent: radioCheckedContent,
|
289
292
|
radioContainer: radioContainer,
|
290
293
|
scrollbox: scrollbox,
|
@@ -32,6 +32,8 @@ var _text = require("./text");
|
|
32
32
|
|
33
33
|
var _colors = require("../colors");
|
34
34
|
|
35
|
+
var _boxes = require("./boxes");
|
36
|
+
|
35
37
|
function ownKeys(object, enumerableOnly) { var keys = (0, _keys["default"])(object); if (_getOwnPropertySymbols["default"]) { var symbols = (0, _getOwnPropertySymbols["default"])(object); if (enumerableOnly) symbols = (0, _filter["default"])(symbols).call(symbols, function (sym) { return (0, _getOwnPropertyDescriptor["default"])(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
36
38
|
|
37
39
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; (0, _forEach["default"])(_context = ownKeys(Object(source), true)).call(_context, function (key) { (0, _defineProperty3["default"])(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors["default"]) { (0, _defineProperties["default"])(target, (0, _getOwnPropertyDescriptors["default"])(source)); } else { var _context2; (0, _forEach["default"])(_context2 = ownKeys(Object(source))).call(_context2, function (key) { (0, _defineProperty2["default"])(target, key, (0, _getOwnPropertyDescriptor["default"])(source, key)); }); } } return target; }
|
@@ -102,6 +104,10 @@ var iconButton = {
|
|
102
104
|
}
|
103
105
|
};
|
104
106
|
|
107
|
+
var square = _objectSpread(_objectSpread({}, iconButton), {}, {
|
108
|
+
borderRadius: '2px'
|
109
|
+
});
|
110
|
+
|
105
111
|
var modalCloseButton = _objectSpread(_objectSpread({}, iconButton), {}, {
|
106
112
|
position: 'absolute',
|
107
113
|
top: 14,
|
@@ -179,32 +185,7 @@ var accordionHeader = _objectSpread(_objectSpread({}, base), {}, {
|
|
179
185
|
color: 'accent.20'
|
180
186
|
},
|
181
187
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
182
|
-
});
|
183
|
-
|
184
|
-
|
185
|
-
var icon = {
|
186
|
-
p: '3px',
|
187
|
-
alignSelf: 'flex-start',
|
188
|
-
flexGrow: 0,
|
189
|
-
borderRadius: '100%',
|
190
|
-
cursor: 'pointer',
|
191
|
-
bg: 'transparent',
|
192
|
-
'path': {
|
193
|
-
fill: 'text.secondary'
|
194
|
-
},
|
195
|
-
outline: 'none',
|
196
|
-
color: 'white',
|
197
|
-
'&.is-hovered': {
|
198
|
-
bg: 'accent.90'
|
199
|
-
},
|
200
|
-
'&.is-pressed': {
|
201
|
-
'path': {
|
202
|
-
fill: 'white'
|
203
|
-
},
|
204
|
-
bg: 'active'
|
205
|
-
},
|
206
|
-
'&.is-focused': _objectSpread({}, defaultFocus)
|
207
|
-
};
|
188
|
+
});
|
208
189
|
|
209
190
|
var primary = _objectSpread(_objectSpread({}, base), {}, {
|
210
191
|
display: 'inline-flex',
|
@@ -264,6 +245,10 @@ var inverted = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
264
245
|
}
|
265
246
|
});
|
266
247
|
|
248
|
+
var invertedSquare = _objectSpread(_objectSpread({}, inverted), {}, {
|
249
|
+
borderRadius: '2px'
|
250
|
+
});
|
251
|
+
|
267
252
|
var applicationPortal = _objectSpread(_objectSpread({}, iconButton), {}, {
|
268
253
|
background: 'transparent',
|
269
254
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
@@ -330,7 +315,7 @@ var inline = _objectSpread(_objectSpread({}, base), {}, {
|
|
330
315
|
bg: 'white',
|
331
316
|
height: '22px',
|
332
317
|
lineHeight: 1,
|
333
|
-
fontSize: '
|
318
|
+
fontSize: 'sm',
|
334
319
|
borderRadius: '15px',
|
335
320
|
border: '1px solid',
|
336
321
|
borderColor: 'active',
|
@@ -492,6 +477,36 @@ var fileInputField = {
|
|
492
477
|
boxShadow: 'focus'
|
493
478
|
}
|
494
479
|
};
|
480
|
+
|
481
|
+
var tooltipChip = _objectSpread(_objectSpread({}, _boxes.chip), {}, {
|
482
|
+
cursor: 'default',
|
483
|
+
'&.is-hovered, &.is-pressed': {
|
484
|
+
cursor: 'default',
|
485
|
+
outline: 'none'
|
486
|
+
}
|
487
|
+
});
|
488
|
+
|
489
|
+
var tooltipIconButton = _objectSpread(_objectSpread({}, iconButton), {}, {
|
490
|
+
cursor: 'default',
|
491
|
+
'&.is-hovered, &.is-pressed': {
|
492
|
+
backgroundColor: 'inherit',
|
493
|
+
cursor: 'default',
|
494
|
+
path: {
|
495
|
+
fill: 'neutral.20'
|
496
|
+
}
|
497
|
+
}
|
498
|
+
});
|
499
|
+
|
500
|
+
var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
|
501
|
+
cursor: 'default',
|
502
|
+
alignSelf: 'flex-start',
|
503
|
+
'&.is-hovered, &.is-pressed': {
|
504
|
+
backgroundColor: 'inherit',
|
505
|
+
cursor: 'default',
|
506
|
+
textDecoration: 'inherit'
|
507
|
+
}
|
508
|
+
});
|
509
|
+
|
495
510
|
var _default = {
|
496
511
|
accordionHeader: accordionHeader,
|
497
512
|
chipDeleteButton: chipDeleteButton,
|
@@ -512,7 +527,6 @@ var _default = {
|
|
512
527
|
expandableRow: expandableRow,
|
513
528
|
fileInputField: fileInputField,
|
514
529
|
iconButton: iconButton,
|
515
|
-
icon: icon,
|
516
530
|
imageUpload: imageUpload,
|
517
531
|
inline: inline,
|
518
532
|
inverted: inverted,
|
@@ -525,6 +539,11 @@ var _default = {
|
|
525
539
|
helpHint: helpHint,
|
526
540
|
modalCloseButton: modalCloseButton,
|
527
541
|
applicationPortalPinned: applicationPortalPinned,
|
528
|
-
applicationPortal: applicationPortal
|
542
|
+
applicationPortal: applicationPortal,
|
543
|
+
square: square,
|
544
|
+
invertedSquare: invertedSquare,
|
545
|
+
tooltipChip: tooltipChip,
|
546
|
+
tooltipIconButton: tooltipIconButton,
|
547
|
+
tooltipInline: tooltipInline
|
529
548
|
};
|
530
549
|
exports["default"] = _default;
|
@@ -54,8 +54,6 @@ var _messages = _interopRequireDefault(require("./messages"));
|
|
54
54
|
|
55
55
|
var _numberField = _interopRequireDefault(require("./numberField"));
|
56
56
|
|
57
|
-
var _popover = _interopRequireDefault(require("./popover"));
|
58
|
-
|
59
57
|
var _overlayPanel = _interopRequireDefault(require("./overlayPanel"));
|
60
58
|
|
61
59
|
var _popoverMenu = _interopRequireDefault(require("./popoverMenu"));
|
@@ -90,7 +88,6 @@ var _default = _objectSpread(_objectSpread({
|
|
90
88
|
modal: _modal["default"],
|
91
89
|
numberField: _numberField["default"],
|
92
90
|
overlayPanel: _overlayPanel["default"],
|
93
|
-
popover: _popover["default"],
|
94
91
|
popoverMenu: _popoverMenu["default"],
|
95
92
|
rockerbutton: _rockerbutton["default"],
|
96
93
|
separator: _separator["default"],
|
@@ -83,8 +83,6 @@ export var Default = function Default() {
|
|
83
83
|
return ___EmotionJSX(Box, {
|
84
84
|
isRow: true,
|
85
85
|
sx: {
|
86
|
-
pt: '12px',
|
87
|
-
pb: '12px',
|
88
86
|
flexGrow: 1
|
89
87
|
}
|
90
88
|
}, ___EmotionJSX(Box, {
|
@@ -129,20 +127,14 @@ export var Default = function Default() {
|
|
129
127
|
sx: {
|
130
128
|
mr: '4px',
|
131
129
|
height: '26px',
|
132
|
-
width: '26px'
|
133
|
-
'path': {
|
134
|
-
fill: 'active'
|
135
|
-
}
|
130
|
+
width: '26px'
|
136
131
|
}
|
137
132
|
}, ___EmotionJSX(CreateIcon, null)), ___EmotionJSX(IconButton, {
|
138
133
|
"aria-label": "vertical-lines-icon",
|
139
134
|
sx: {
|
140
135
|
mr: '4px',
|
141
136
|
height: '26px',
|
142
|
-
width: '26px'
|
143
|
-
'path': {
|
144
|
-
fill: 'active'
|
145
|
-
}
|
137
|
+
width: '26px'
|
146
138
|
}
|
147
139
|
}, ___EmotionJSX(MoreVertIcon, null)))));
|
148
140
|
};
|
@@ -285,7 +277,8 @@ export var Default = function Default() {
|
|
285
277
|
item: item
|
286
278
|
}), item.key !== 'Organization' ? ___EmotionJSX(Separator, {
|
287
279
|
sx: {
|
288
|
-
m: 0
|
280
|
+
m: 0,
|
281
|
+
bg: 'neutral.90'
|
289
282
|
}
|
290
283
|
}) : null);
|
291
284
|
}))
|
@@ -14,17 +14,15 @@ 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 _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
16
|
|
17
|
-
import React, { forwardRef, useRef, useImperativeHandle
|
17
|
+
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
18
18
|
import PropTypes from 'prop-types';
|
19
19
|
import { Button as ThemeUIButton } from 'theme-ui';
|
20
20
|
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 {
|
25
|
-
import { useAriaLabelWarning, useStatusClasses, useDeprecationWarning, usePropWarning } from '../../hooks';
|
24
|
+
import { useAriaLabelWarning, useStatusClasses, usePropWarning } from '../../hooks';
|
26
25
|
import Loader from '../Loader';
|
27
|
-
import Box from '../Box';
|
28
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
29
27
|
var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
30
28
|
var className = props.className,
|
@@ -39,8 +37,7 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
39
37
|
onPressChange = props.onPressChange,
|
40
38
|
onPressUp = props.onPressUp,
|
41
39
|
children = props.children,
|
42
|
-
|
43
|
-
others = _objectWithoutProperties(props, ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children", "mode"]);
|
40
|
+
others = _objectWithoutProperties(props, ["className", "isDisabled", "isLoading", "onHoverStart", "onHoverChange", "onHoverEnd", "onPress", "onPressStart", "onPressEnd", "onPressChange", "onPressUp", "children"]);
|
44
41
|
|
45
42
|
var buttonRef = useRef();
|
46
43
|
usePropWarning(props, 'disabled', 'isDisabled');
|
@@ -49,20 +46,13 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
49
46
|
useImperativeHandle(ref, function () {
|
50
47
|
return buttonRef.current;
|
51
48
|
});
|
52
|
-
var ButtonBase = useMemo(function () {
|
53
|
-
return mode === modes.ICON ? Box : ThemeUIButton;
|
54
|
-
}, [mode]);
|
55
|
-
var elementType = useMemo(function () {
|
56
|
-
if (mode === modes.ICON) return 'div';
|
57
|
-
return 'button';
|
58
|
-
}, [mode]);
|
59
49
|
|
60
50
|
var _useFocusRing = useFocusRing(),
|
61
51
|
isFocusVisible = _useFocusRing.isFocusVisible,
|
62
52
|
focusProps = _useFocusRing.focusProps;
|
63
53
|
|
64
54
|
var _useButton = useButton(_objectSpread({
|
65
|
-
elementType:
|
55
|
+
elementType: 'button'
|
66
56
|
}, props), buttonRef),
|
67
57
|
buttonProps = _useButton.buttonProps,
|
68
58
|
isPressed = _useButton.isPressed;
|
@@ -79,12 +69,9 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
79
69
|
}),
|
80
70
|
classNames = _useStatusClasses.classNames;
|
81
71
|
|
82
|
-
useDeprecationWarning('The "icon" variant for `Button` will be deprecated in Astro-UI 1.0.0, use the `IconButton` component instead.', {
|
83
|
-
isActive: props.variant === 'icon'
|
84
|
-
});
|
85
72
|
var ariaLabel = props['aria-label'];
|
86
73
|
useAriaLabelWarning('Button', ariaLabel);
|
87
|
-
return ___EmotionJSX(
|
74
|
+
return ___EmotionJSX(ThemeUIButton, _extends({
|
88
75
|
"aria-label": ariaLabel || 'Button',
|
89
76
|
ref: buttonRef,
|
90
77
|
className: classNames,
|
@@ -167,15 +154,11 @@ Button.propTypes = {
|
|
167
154
|
onPressUp: PropTypes.func,
|
168
155
|
|
169
156
|
/** The styling variation of the button. */
|
170
|
-
variant: PropTypes.string
|
171
|
-
|
172
|
-
/** The behavioral pattern to apply to the button. */
|
173
|
-
mode: PropTypes.oneOf(['default', 'icon'])
|
157
|
+
variant: PropTypes.string
|
174
158
|
};
|
175
159
|
Button.defaultProps = {
|
176
160
|
isDisabled: false,
|
177
|
-
variant: 'default'
|
178
|
-
mode: 'default'
|
161
|
+
variant: 'default'
|
179
162
|
};
|
180
163
|
Button.displayName = 'Button';
|
181
164
|
export default Button;
|
@@ -1,8 +1,3 @@
|
|
1
|
-
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
2
|
-
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
3
|
-
|
4
|
-
var _context;
|
5
|
-
|
6
1
|
import React from 'react';
|
7
2
|
import AddCircleIcon from 'mdi-react/AddCircleIcon';
|
8
3
|
import Box from '../Box';
|
@@ -15,7 +10,9 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
10
|
var variants = buttonVariants;
|
16
11
|
delete variants.ICON;
|
17
12
|
delete variants.ICON_BUTTON;
|
18
|
-
delete variants.INVERTED;
|
13
|
+
delete variants.INVERTED; // add designer approved variants for devs to use here
|
14
|
+
|
15
|
+
var variantOptions = ['critical', 'danger', 'default', 'inline', 'link', 'primary', 'success', 'text'];
|
19
16
|
export default {
|
20
17
|
title: 'Button',
|
21
18
|
component: Button,
|
@@ -23,11 +20,9 @@ export default {
|
|
23
20
|
variant: {
|
24
21
|
control: {
|
25
22
|
type: 'select',
|
26
|
-
options:
|
23
|
+
options: variantOptions
|
27
24
|
},
|
28
|
-
defaultValue:
|
29
|
-
return value === 'default';
|
30
|
-
})
|
25
|
+
defaultValue: 'default'
|
31
26
|
},
|
32
27
|
children: {
|
33
28
|
description: 'Button text.',
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React from 'react';
|
3
3
|
import userEvent from '@testing-library/user-event';
|
4
|
-
import AddCircleIcon from 'mdi-react/AddCircleIcon';
|
5
4
|
import axeTest from '../../utils/testUtils/testAxe';
|
6
5
|
import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
7
6
|
import Button from '.';
|
8
|
-
import Icon from '../Icon';
|
9
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
8
|
var testId = 'test-button';
|
11
9
|
var defaultProps = {
|
@@ -15,15 +13,6 @@ var defaultProps = {
|
|
15
13
|
var getComponent = function getComponent() {
|
16
14
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
17
15
|
return render(___EmotionJSX(Button, _extends({}, defaultProps, props)));
|
18
|
-
};
|
19
|
-
|
20
|
-
var getIconButton = function getIconButton() {
|
21
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
22
|
-
return render(___EmotionJSX(Button, _extends({}, defaultProps, props, {
|
23
|
-
variant: "icon"
|
24
|
-
}), ___EmotionJSX(Icon, {
|
25
|
-
icon: AddCircleIcon
|
26
|
-
})));
|
27
16
|
}; // Need to be added to each test file to test accessibility using axe.
|
28
17
|
|
29
18
|
|
@@ -99,13 +88,4 @@ test('button renders children when not loading', function () {
|
|
99
88
|
expect(childWrapper).toBeInTheDocument();
|
100
89
|
expect(childWrapper).toBeVisible();
|
101
90
|
expect(screen.queryByRole('progressbar')).not.toBeInTheDocument();
|
102
|
-
});
|
103
|
-
test('passing in an icon makes the button parent a div', function () {
|
104
|
-
getIconButton({
|
105
|
-
mode: 'icon'
|
106
|
-
});
|
107
|
-
var button = screen.getByRole('button');
|
108
|
-
expect(button).toBeInTheDocument();
|
109
|
-
expect(button).toBeVisible();
|
110
|
-
expect(button).toBeInstanceOf(HTMLDivElement);
|
111
91
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React from 'react';
|
3
3
|
import PropTypes from 'prop-types';
|
4
|
+
import { ChipContext } from './ChipContext';
|
4
5
|
import Box from '../Box/Box';
|
5
6
|
import Text from '../Text/Text';
|
6
7
|
import * as colors from '../../styles/colors';
|
@@ -12,21 +13,31 @@ import * as colors from '../../styles/colors';
|
|
12
13
|
|
13
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
14
15
|
var Chip = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
15
|
-
var
|
16
|
+
var bg = props.bg,
|
17
|
+
children = props.children,
|
16
18
|
textColor = props.textColor,
|
17
19
|
textProps = props.textProps,
|
18
|
-
label = props.label
|
19
|
-
|
20
|
+
label = props.label,
|
21
|
+
isUppercase = props.isUppercase;
|
22
|
+
return ___EmotionJSX(ChipContext.Provider, {
|
23
|
+
value: {
|
24
|
+
bg: bg
|
25
|
+
}
|
26
|
+
}, ___EmotionJSX(Box, _extends({
|
20
27
|
isRow: true,
|
21
28
|
variant: "boxes.chip",
|
29
|
+
sx: isUppercase && {
|
30
|
+
paddingBottom: '3px'
|
31
|
+
},
|
22
32
|
ref: ref
|
23
33
|
}, props), ___EmotionJSX(Text, _extends({
|
24
34
|
variant: "label",
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
35
|
+
color: textColor,
|
36
|
+
sx: isUppercase && {
|
37
|
+
textTransform: 'uppercase',
|
38
|
+
fontSize: '11px'
|
39
|
+
}
|
40
|
+
}, textProps), label), children));
|
30
41
|
});
|
31
42
|
Chip.propTypes = {
|
32
43
|
/** The text color of the chip. */
|
@@ -39,10 +50,14 @@ Chip.propTypes = {
|
|
39
50
|
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
40
51
|
|
41
52
|
/** Props object that is spread directly into the textfield. */
|
42
|
-
textProps: PropTypes.shape({})
|
53
|
+
textProps: PropTypes.shape({}),
|
54
|
+
|
55
|
+
/** When true, display chip label as uppercase. */
|
56
|
+
isUppercase: PropTypes.bool
|
43
57
|
};
|
44
58
|
Chip.defaultProps = {
|
45
59
|
textColor: 'white',
|
46
|
-
bg: colors.neutral[10]
|
60
|
+
bg: colors.neutral[10],
|
61
|
+
isUppercase: false
|
47
62
|
};
|
48
63
|
export default Chip;
|
@@ -3,8 +3,11 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
3
3
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
4
4
|
import React from 'react';
|
5
5
|
import Clear from 'mdi-react/CloseIcon';
|
6
|
-
import
|
7
|
-
import
|
6
|
+
import ContentCopy from 'mdi-react/ContentCopyIcon';
|
7
|
+
import Earth from 'mdi-react/EarthIcon';
|
8
|
+
import Chip from '../Chip';
|
9
|
+
import Icon from '../Icon';
|
10
|
+
import IconButton from '../IconButton';
|
8
11
|
import { flatColorList } from '../../styles/colors.js';
|
9
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
13
|
export default {
|
@@ -40,6 +43,12 @@ export default {
|
|
40
43
|
control: {
|
41
44
|
type: 'text'
|
42
45
|
}
|
46
|
+
},
|
47
|
+
isUppercase: {
|
48
|
+
defaultValue: false,
|
49
|
+
control: {
|
50
|
+
type: 'boolean'
|
51
|
+
}
|
43
52
|
}
|
44
53
|
}
|
45
54
|
};
|
@@ -59,13 +68,40 @@ export var ChipWithCustomColors = function ChipWithCustomColors() {
|
|
59
68
|
});
|
60
69
|
};
|
61
70
|
export var ChipWithIcon = function ChipWithIcon() {
|
62
|
-
return ___EmotionJSX(Chip, {
|
63
|
-
label: "Chip with Icon",
|
71
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Chip, {
|
72
|
+
label: "Chip with Icon Button",
|
64
73
|
bg: "navy"
|
74
|
+
}, ___EmotionJSX(IconButton, {
|
75
|
+
"aria-label": "Clear Chip with Icon Button",
|
76
|
+
variant: "inverted"
|
65
77
|
}, ___EmotionJSX(Icon, {
|
66
78
|
icon: Clear,
|
67
79
|
ml: "xs",
|
80
|
+
size: "14px"
|
81
|
+
}))), ___EmotionJSX("div", {
|
82
|
+
style: {
|
83
|
+
padding: '5px'
|
84
|
+
}
|
85
|
+
}), ___EmotionJSX(Chip, {
|
86
|
+
label: "Chip with Icon Button"
|
87
|
+
}, ___EmotionJSX(IconButton, {
|
88
|
+
"aria-label": "Clear Chip with Icon Button",
|
89
|
+
variant: "inverted"
|
90
|
+
}, ___EmotionJSX(Icon, {
|
91
|
+
icon: Earth,
|
92
|
+
ml: "xs",
|
93
|
+
size: "14px"
|
94
|
+
}))), ___EmotionJSX("div", {
|
95
|
+
style: {
|
96
|
+
padding: '5px'
|
97
|
+
}
|
98
|
+
}), ___EmotionJSX(Chip, {
|
99
|
+
label: "Chip with Icon",
|
100
|
+
bg: "green"
|
101
|
+
}, ___EmotionJSX(Icon, {
|
102
|
+
icon: ContentCopy,
|
103
|
+
ml: "xs",
|
68
104
|
size: "14px",
|
69
105
|
color: "white"
|
70
|
-
}));
|
106
|
+
})));
|
71
107
|
};
|
@@ -31,4 +31,13 @@ test('renders children within Chip component', function () {
|
|
31
31
|
});
|
32
32
|
var mockedChildren = screen.getByRole('button');
|
33
33
|
expect(mockedChildren).toBeInTheDocument();
|
34
|
+
});
|
35
|
+
test('renders Chip component with uppercase', function () {
|
36
|
+
var label = 'uppercase';
|
37
|
+
var isUppercase = true;
|
38
|
+
getComponent({
|
39
|
+
label: label,
|
40
|
+
isUppercase: isUppercase
|
41
|
+
});
|
42
|
+
expect(screen.queryByText('uppercase')).toHaveStyleRule('text-transform', 'uppercase');
|
34
43
|
});
|
@@ -14,13 +14,15 @@ 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 _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
16
16
|
|
17
|
-
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
17
|
+
import React, { forwardRef, useRef, useImperativeHandle, useContext } from 'react';
|
18
18
|
import PropTypes from 'prop-types';
|
19
19
|
import { IconButton as ThemeUIIconButton } from 'theme-ui';
|
20
|
+
import { useButton } from '@react-aria/button';
|
20
21
|
import { useFocusRing } from '@react-aria/focus';
|
21
|
-
import { Pressable, useHover
|
22
|
+
import { Pressable, useHover } from '@react-aria/interactions';
|
22
23
|
import { mergeProps } from '@react-aria/utils';
|
23
24
|
import { useAriaLabelWarning, useStatusClasses } from '../../hooks';
|
25
|
+
import { ChipContext } from '../Chip/ChipContext';
|
24
26
|
import TooltipTrigger, { Tooltip } from '../TooltipTrigger';
|
25
27
|
/**
|
26
28
|
* Convenience wrapper for a Button + Icon. This component applies specific styles necessary for
|
@@ -51,11 +53,12 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
51
53
|
return buttonRef.current;
|
52
54
|
});
|
53
55
|
|
54
|
-
var
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
var _useButton = useButton(_objectSpread({}, props), buttonRef),
|
57
|
+
buttonProps = _useButton.buttonProps,
|
58
|
+
isPressed = _useButton.isPressed;
|
59
|
+
|
60
|
+
var _useContext = useContext(ChipContext),
|
61
|
+
chipBg = _useContext.bg;
|
59
62
|
|
60
63
|
var _useHover = useHover(props),
|
61
64
|
hoverProps = _useHover.hoverProps,
|
@@ -80,8 +83,13 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
80
83
|
tabIndex: 0,
|
81
84
|
ref: buttonRef,
|
82
85
|
className: classNames,
|
83
|
-
"aria-label": ariaLabel || 'Icon Button'
|
84
|
-
|
86
|
+
"aria-label": ariaLabel || 'Icon Button',
|
87
|
+
sx: chipBg && isHovered && {
|
88
|
+
'path': {
|
89
|
+
fill: chipBg
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}, mergeProps(hoverProps, focusProps, buttonProps, others)), children);
|
85
93
|
|
86
94
|
if (title) {
|
87
95
|
return ___EmotionJSX(TooltipTrigger, {
|