@pingux/astro 1.0.0-alpha.9 → 1.0.1
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 +131 -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.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/ListViewItem/ListViewItem.js +3 -6
- 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/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 +20 -18
- package/lib/cjs/styles/variants/buttons.js +2 -28
- 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.test.js +0 -1
- package/lib/components/ListItem/ListItem.stories.js +0 -2
- package/lib/components/ListView/ListView.js +4 -3
- package/lib/components/ListViewItem/ListViewItem.js +3 -5
- 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/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 +20 -18
- package/lib/styles/variants/buttons.js +2 -28
- 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
@@ -33,10 +33,11 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
33
|
tabLabelProps = itemProps.tabLabelProps,
|
34
34
|
tabLineProps = itemProps.tabLineProps,
|
35
35
|
content = itemProps.content,
|
36
|
-
|
36
|
+
titleAttr = itemProps.titleAttr,
|
37
|
+
otherItemProps = _objectWithoutProperties(itemProps, ["icon", "isDisabled", "separator", "tabLabelProps", "tabLineProps", "content", "titleAttr"]);
|
37
38
|
|
38
|
-
var isDisabled = tabsDisabled || tabDisabled;
|
39
39
|
var state = useContext(TabsContext);
|
40
|
+
var isDisabled = tabsDisabled || tabDisabled || state.disabledKeys.has(key);
|
40
41
|
var isSelected = state.selectedKey === key;
|
41
42
|
|
42
43
|
var _useFocusRing = useFocusRing(),
|
@@ -77,7 +78,8 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
77
78
|
className: classNames,
|
78
79
|
variant: "tab"
|
79
80
|
}, mergeProps(focusProps, hoverProps, tabProps), otherItemProps, {
|
80
|
-
ref: tabRef
|
81
|
+
ref: tabRef,
|
82
|
+
title: titleAttr || undefined
|
81
83
|
}), icon, ___EmotionJSX(Text, _extends({
|
82
84
|
variant: "tabLabel"
|
83
85
|
}, tabLabelProps), rendered), isSelected && !isDisabled && ___EmotionJSX(TabLine, tabLineProps)), slots === null || slots === void 0 ? void 0 : slots.afterTab);
|
@@ -90,6 +90,9 @@ Tabs.propTypes = {
|
|
90
90
|
/** The default tab key to be selected. (uncontrolled) */
|
91
91
|
defaultSelectedKey: PropTypes.string,
|
92
92
|
|
93
|
+
/** Array of keys to disable within the tab list. */
|
94
|
+
disabledKeys: PropTypes.arrayOf(PropTypes.string),
|
95
|
+
|
93
96
|
/** The tab key that is currently selected. (controlled) */
|
94
97
|
selectedKey: PropTypes.string,
|
95
98
|
|
@@ -128,13 +128,12 @@ export var Centered = function Centered() {
|
|
128
128
|
};
|
129
129
|
export var DisabledSingleTab = function DisabledSingleTab() {
|
130
130
|
return ___EmotionJSX(Tabs, {
|
131
|
-
|
132
|
-
|
131
|
+
items: tabs,
|
132
|
+
disabledKeys: ['Tab 2']
|
133
133
|
}, function (item) {
|
134
134
|
return ___EmotionJSX(Tab, {
|
135
135
|
key: item.name,
|
136
|
-
title: item.name
|
137
|
-
isDisabled: item.name === 'Tab 1'
|
136
|
+
title: item.name
|
138
137
|
}, item.children);
|
139
138
|
});
|
140
139
|
};
|
@@ -220,6 +220,31 @@ test('disabled all tabs', function () {
|
|
220
220
|
expect(tab1).not.toContainElement(screen.queryByRole('presentation'));
|
221
221
|
testTabPanel(0);
|
222
222
|
});
|
223
|
+
test('disabled tab is not accessible on click or focus', function () {
|
224
|
+
getComponent({
|
225
|
+
disabledKeys: [defaultTabs[1].name]
|
226
|
+
});
|
227
|
+
testTabPanel(0);
|
228
|
+
|
229
|
+
var _getTabs5 = getTabs(),
|
230
|
+
tabs = _getTabs5.tabs,
|
231
|
+
tab0 = _getTabs5.tab0,
|
232
|
+
tab1 = _getTabs5.tab1,
|
233
|
+
tab2 = _getTabs5.tab2; // Ensure that clicking a disabled tab does nothing
|
234
|
+
|
235
|
+
|
236
|
+
userEvent.click(tab1);
|
237
|
+
testTabPanel(0); // Ensure that disabled tab is not accessible via focus
|
238
|
+
|
239
|
+
userEvent.tab();
|
240
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
241
|
+
fireEvent.keyDown(tab0, {
|
242
|
+
key: 'ArrowRight',
|
243
|
+
code: 'ArrowRight'
|
244
|
+
});
|
245
|
+
testSingleTab(tabs, tab2, 'toHaveFocus');
|
246
|
+
testTabPanel(2);
|
247
|
+
});
|
223
248
|
test('controlled tabs', function () {
|
224
249
|
var selectedKey = defaultTabs[1].name;
|
225
250
|
var onSelectionChange = jest.fn();
|
@@ -230,11 +255,11 @@ test('controlled tabs', function () {
|
|
230
255
|
}),
|
231
256
|
rerender = _getComponent.rerender;
|
232
257
|
|
233
|
-
var
|
234
|
-
tabs =
|
235
|
-
tab0 =
|
236
|
-
tab1 =
|
237
|
-
tab2 =
|
258
|
+
var _getTabs6 = getTabs(),
|
259
|
+
tabs = _getTabs6.tabs,
|
260
|
+
tab0 = _getTabs6.tab0,
|
261
|
+
tab1 = _getTabs6.tab1,
|
262
|
+
tab2 = _getTabs6.tab2; // Expect the second tab to be selected
|
238
263
|
|
239
264
|
|
240
265
|
expect(onSelectionChange).not.toHaveBeenCalled();
|
@@ -271,9 +296,9 @@ test('tab line props', function () {
|
|
271
296
|
}),
|
272
297
|
rerender = _getComponent2.rerender;
|
273
298
|
|
274
|
-
var
|
275
|
-
tabs =
|
276
|
-
tab0 =
|
299
|
+
var _getTabs7 = getTabs(),
|
300
|
+
tabs = _getTabs7.tabs,
|
301
|
+
tab0 = _getTabs7.tab0;
|
277
302
|
|
278
303
|
var tabLine = screen.getByRole('presentation'); // Expect the tab line to have a red background
|
279
304
|
|
@@ -302,16 +327,16 @@ test('tab with icon', function () {
|
|
302
327
|
tabs: newTabs
|
303
328
|
});
|
304
329
|
|
305
|
-
var
|
306
|
-
tabs =
|
307
|
-
tab0 =
|
330
|
+
var _getTabs8 = getTabs(),
|
331
|
+
tabs = _getTabs8.tabs,
|
332
|
+
tab0 = _getTabs8.tab0;
|
308
333
|
|
309
334
|
var icon = screen.getByTestId('icon'); // Expect the tab to have the given icon element
|
310
335
|
|
311
336
|
testSingleTab(tabs, tab0, 'toContainElement', [icon]);
|
312
337
|
});
|
313
338
|
test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
314
|
-
var
|
339
|
+
var _getTabs9, tab0;
|
315
340
|
|
316
341
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
317
342
|
while (1) {
|
@@ -321,7 +346,7 @@ test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/_asyncToG
|
|
321
346
|
mode: 'tooltip'
|
322
347
|
});
|
323
348
|
expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
324
|
-
|
349
|
+
_getTabs9 = getTabs(), tab0 = _getTabs9.tab0;
|
325
350
|
fireEvent.mouseMove(tab0);
|
326
351
|
fireEvent.mouseEnter(tab0);
|
327
352
|
|
@@ -345,8 +370,8 @@ test('tabs without selected keys show null tab panel content', function () {
|
|
345
370
|
test('hover tab style', function () {
|
346
371
|
getComponent();
|
347
372
|
|
348
|
-
var
|
349
|
-
tab0 =
|
373
|
+
var _getTabs10 = getTabs(),
|
374
|
+
tab0 = _getTabs10.tab0;
|
350
375
|
|
351
376
|
expect(tab0).not.toHaveClass('is-hovered');
|
352
377
|
userEvent.hover(tab0);
|
@@ -99,6 +99,14 @@ test('form wrapper will have default max label column width when no custom width
|
|
99
99
|
var textAreaContainer = screen.getByTestId(testId);
|
100
100
|
expect(textAreaContainer).toHaveStyle('grid-template-columns: 40% auto');
|
101
101
|
});
|
102
|
+
test('passing read only prop applys the is-read-only class to the textarea', function () {
|
103
|
+
var isReadOnly = true;
|
104
|
+
getComponent({
|
105
|
+
isReadOnly: isReadOnly
|
106
|
+
});
|
107
|
+
var textArea = screen.getByLabelText(defaultProps.label);
|
108
|
+
expect(textArea).toHaveClass('is-read-only');
|
109
|
+
});
|
102
110
|
test('form wrapper will have a max label column width when custom width set', function () {
|
103
111
|
var labelMode = 'left';
|
104
112
|
var containerProps = {
|
package/lib/index.js
CHANGED
@@ -30,10 +30,6 @@ export * from './components/Chip';
|
|
30
30
|
export { default as ComboBoxField } from './components/ComboBoxField';
|
31
31
|
export { default as CopyText } from './components/CopyText';
|
32
32
|
export { default as ColorField } from './components/ColorField';
|
33
|
-
export { default as Dropdown } from './components/Dropdown';
|
34
|
-
export * from './components/Dropdown';
|
35
|
-
export { default as DropdownField } from './components/DropdownField';
|
36
|
-
export * from './components/DropdownField';
|
37
33
|
export { default as FieldHelperText } from './components/FieldHelperText';
|
38
34
|
export * from './components/FieldHelperText';
|
39
35
|
export { default as FileInputField } from './components/FileInputField';
|
@@ -77,12 +73,8 @@ export { default as OverlayPanel } from './components/OverlayPanel';
|
|
77
73
|
export * from './components/OverlayPanel';
|
78
74
|
export { default as PageHeader } from './components/PageHeader';
|
79
75
|
export * from './components/PageHeader';
|
80
|
-
export { default as Panel } from './components/Panel';
|
81
|
-
export * from './components/Panel';
|
82
76
|
export { default as PasswordField } from './components/PasswordField';
|
83
77
|
export * from './components/PasswordField';
|
84
|
-
export { default as Popover } from './components/Popover';
|
85
|
-
export * from './components/Popover';
|
86
78
|
export { default as PopoverContainer } from './components/PopoverContainer';
|
87
79
|
export * from './components/PopoverContainer';
|
88
80
|
export { default as PopoverMenu } from './components/PopoverMenu';
|
@@ -274,7 +274,8 @@ export var Default = function Default() {
|
|
274
274
|
}, ___EmotionJSX(Chip, {
|
275
275
|
bg: "success.light",
|
276
276
|
textColor: "success.dark",
|
277
|
-
label: "New"
|
277
|
+
label: "New",
|
278
|
+
isUppercase: true
|
278
279
|
})) : null)), ___EmotionJSX(Box, {
|
279
280
|
isRow: true,
|
280
281
|
alignSelf: "center"
|
@@ -3,14 +3,12 @@ import React from 'react';
|
|
3
3
|
import Earth from 'mdi-react/EarthIcon';
|
4
4
|
import Cog from 'mdi-react/CogOutlineIcon';
|
5
5
|
import Button from '../components/Button/Button';
|
6
|
-
import Panel from '../components/Panel/Panel';
|
7
6
|
import Box from '../components/Box/Box';
|
8
7
|
import Icon from '../components/Icon/Icon';
|
9
8
|
import Text from '../components/Text/Text';
|
10
9
|
import Separator from '../components/Separator/Separator';
|
11
10
|
import TextField from '../components/TextField/TextField';
|
12
11
|
import TextAreaField from '../components/TextAreaField/TextAreaField';
|
13
|
-
import DropdownField from '../components/DropdownField/DropdownField';
|
14
12
|
import RadioGroupField from '../components/RadioGroupField/RadioGroupField';
|
15
13
|
import RadioField from '../components/RadioField/RadioField';
|
16
14
|
import Tabs from '../components/Tabs/Tabs';
|
@@ -96,10 +94,7 @@ export var Default = function Default() {
|
|
96
94
|
}), ___EmotionJSX(TextAreaField, {
|
97
95
|
mb: "lg",
|
98
96
|
label: "Description"
|
99
|
-
}), ___EmotionJSX(
|
100
|
-
label: "Category",
|
101
|
-
mb: "lg"
|
102
|
-
}, ___EmotionJSX("option", null, "Option 1"), ___EmotionJSX("option", null, "Option 2"), ___EmotionJSX("option", null, "Option 3")), ___EmotionJSX(RadioGroupField, {
|
97
|
+
}), ___EmotionJSX(RadioGroupField, {
|
103
98
|
label: "Required Fields",
|
104
99
|
variant: "radioGroupBasic"
|
105
100
|
}, ___EmotionJSX(RadioField, {
|
@@ -108,17 +103,5 @@ export var Default = function Default() {
|
|
108
103
|
}), ___EmotionJSX(RadioField, {
|
109
104
|
value: "B",
|
110
105
|
label: "Option B"
|
111
|
-
}))))
|
112
|
-
isVisible: visible,
|
113
|
-
width: "70%",
|
114
|
-
bg: "accent.99"
|
115
|
-
}, ___EmotionJSX(Box, {
|
116
|
-
p: "lg",
|
117
|
-
onClick: function onClick() {
|
118
|
-
return setVisible(!visible);
|
119
|
-
}
|
120
|
-
}, ___EmotionJSX(Box, {
|
121
|
-
p: "lg",
|
122
|
-
bg: "white"
|
123
|
-
}, ___EmotionJSX(Text, null, "Your content here."))))));
|
106
|
+
}))))));
|
124
107
|
};
|
@@ -82,11 +82,11 @@ export var Default = function Default() {
|
|
82
82
|
sx: {
|
83
83
|
position: 'absolute',
|
84
84
|
right: -30,
|
85
|
-
top: 5
|
85
|
+
top: 5,
|
86
|
+
width: 'auto'
|
86
87
|
},
|
87
88
|
type: "delete",
|
88
|
-
title: "Delete Field"
|
89
|
-
variant: "icon"
|
89
|
+
title: "Delete Field"
|
90
90
|
}, ___EmotionJSX(Icon, {
|
91
91
|
icon: TrashIcon,
|
92
92
|
size: 20,
|
package/lib/styles/theme.js
CHANGED
@@ -28,10 +28,10 @@ var accordionBody = {
|
|
28
28
|
var accordionGridHeader = {
|
29
29
|
cursor: 'pointer',
|
30
30
|
lineHeight: '30px',
|
31
|
-
|
31
|
+
pl: 'sm',
|
32
32
|
outline: 'none',
|
33
33
|
display: 'flex',
|
34
|
-
justifyContent: '
|
34
|
+
justifyContent: 'center',
|
35
35
|
flexShrink: 0,
|
36
36
|
wordBreak: 'inherit',
|
37
37
|
whiteSpace: 'nowrap',
|
@@ -45,12 +45,9 @@ var accordionGridHeader = {
|
|
45
45
|
WebkitBoxShadow: 'focus',
|
46
46
|
MozBoxShadow: 'focus'
|
47
47
|
},
|
48
|
-
|
48
|
+
minHeight: '64px',
|
49
49
|
'&.is-hovered': {
|
50
|
-
|
51
|
-
'& div > div > div > span': {
|
52
|
-
color: 'active'
|
53
|
-
}
|
50
|
+
backgroundColor: 'accent.99'
|
54
51
|
},
|
55
52
|
'&.is-pressed': {
|
56
53
|
color: 'accent.20',
|
@@ -61,6 +58,7 @@ var accordionGridHeader = {
|
|
61
58
|
};
|
62
59
|
var accordionGridBody = {
|
63
60
|
display: 'none !important',
|
61
|
+
pl: 'sm',
|
64
62
|
width: '100%',
|
65
63
|
'&.is-selected': {
|
66
64
|
display: 'flex !important'
|
@@ -16,20 +16,6 @@ import { text } from './text';
|
|
16
16
|
var base = {
|
17
17
|
display: 'flex'
|
18
18
|
};
|
19
|
-
var panel = {
|
20
|
-
outline: 'none',
|
21
|
-
position: 'relative',
|
22
|
-
bg: 'white',
|
23
|
-
borderLeft: 'separator',
|
24
|
-
transition: 'margin 0.25s ease-in',
|
25
|
-
visibility: 'hidden',
|
26
|
-
'&.is-focused': {
|
27
|
-
boxShadow: 'focus'
|
28
|
-
},
|
29
|
-
'&.is-visible': {
|
30
|
-
visibility: 'visible'
|
31
|
-
}
|
32
|
-
};
|
33
19
|
var card = {
|
34
20
|
boxShadow: 'standard',
|
35
21
|
p: 'lg',
|
@@ -85,6 +71,10 @@ var listViewItem = _objectSpread(_objectSpread({}, base), {}, {
|
|
85
71
|
},
|
86
72
|
'&.is-focused': {
|
87
73
|
boxShadow: 'inset 0 0 5px #5873bdbf'
|
74
|
+
},
|
75
|
+
'&.has-separator': {
|
76
|
+
borderBottom: '1px solid',
|
77
|
+
borderBottomColor: 'line.hairline'
|
88
78
|
}
|
89
79
|
});
|
90
80
|
|
@@ -98,14 +88,27 @@ var listBoxSectionTitle = {
|
|
98
88
|
};
|
99
89
|
var chip = {
|
100
90
|
cursor: 'pointer',
|
101
|
-
|
102
|
-
p: '10px',
|
91
|
+
p: '3px 5px 4px 5px',
|
103
92
|
alignItems: 'center',
|
104
93
|
justifyContent: 'center',
|
105
94
|
minWidth: '50px',
|
106
95
|
alignSelf: 'flex-start',
|
107
96
|
display: 'inline-flex !important',
|
108
|
-
borderRadius: '5px'
|
97
|
+
borderRadius: '5px',
|
98
|
+
fontWeight: 1,
|
99
|
+
'& button': {
|
100
|
+
backgroundColor: 'transparent',
|
101
|
+
marginLeft: 'xs',
|
102
|
+
marginTop: '1px',
|
103
|
+
padding: '0',
|
104
|
+
'&.is-hovered': {
|
105
|
+
backgroundColor: 'white'
|
106
|
+
},
|
107
|
+
'& .mdi-icon': {
|
108
|
+
marginLeft: '0',
|
109
|
+
padding: '2px'
|
110
|
+
}
|
111
|
+
}
|
109
112
|
};
|
110
113
|
var inputInContainerSlot = {
|
111
114
|
position: 'absolute',
|
@@ -263,7 +266,6 @@ export default {
|
|
263
266
|
listItem: listItem,
|
264
267
|
listBoxSectionTitle: listBoxSectionTitle,
|
265
268
|
listViewItem: listViewItem,
|
266
|
-
panel: panel,
|
267
269
|
radioCheckedContent: radioCheckedContent,
|
268
270
|
radioContainer: radioContainer,
|
269
271
|
scrollbox: scrollbox,
|
@@ -158,32 +158,7 @@ var accordionHeader = _objectSpread(_objectSpread({}, base), {}, {
|
|
158
158
|
color: 'accent.20'
|
159
159
|
},
|
160
160
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
161
|
-
});
|
162
|
-
|
163
|
-
|
164
|
-
var icon = {
|
165
|
-
p: '3px',
|
166
|
-
alignSelf: 'flex-start',
|
167
|
-
flexGrow: 0,
|
168
|
-
borderRadius: '100%',
|
169
|
-
cursor: 'pointer',
|
170
|
-
bg: 'transparent',
|
171
|
-
'path': {
|
172
|
-
fill: 'text.secondary'
|
173
|
-
},
|
174
|
-
outline: 'none',
|
175
|
-
color: 'white',
|
176
|
-
'&.is-hovered': {
|
177
|
-
bg: 'accent.90'
|
178
|
-
},
|
179
|
-
'&.is-pressed': {
|
180
|
-
'path': {
|
181
|
-
fill: 'white'
|
182
|
-
},
|
183
|
-
bg: 'active'
|
184
|
-
},
|
185
|
-
'&.is-focused': _objectSpread({}, defaultFocus)
|
186
|
-
};
|
161
|
+
});
|
187
162
|
|
188
163
|
var primary = _objectSpread(_objectSpread({}, base), {}, {
|
189
164
|
display: 'inline-flex',
|
@@ -309,7 +284,7 @@ var inline = _objectSpread(_objectSpread({}, base), {}, {
|
|
309
284
|
bg: 'white',
|
310
285
|
height: '22px',
|
311
286
|
lineHeight: 1,
|
312
|
-
fontSize: '
|
287
|
+
fontSize: 'sm',
|
313
288
|
borderRadius: '15px',
|
314
289
|
border: '1px solid',
|
315
290
|
borderColor: 'active',
|
@@ -491,7 +466,6 @@ export default {
|
|
491
466
|
expandableRow: expandableRow,
|
492
467
|
fileInputField: fileInputField,
|
493
468
|
iconButton: iconButton,
|
494
|
-
icon: icon,
|
495
469
|
imageUpload: imageUpload,
|
496
470
|
inline: inline,
|
497
471
|
inverted: inverted,
|
@@ -24,7 +24,6 @@ import menu from './menu';
|
|
24
24
|
import menuItem from './menuItem';
|
25
25
|
import messages from './messages';
|
26
26
|
import numberField from './numberField';
|
27
|
-
import popover from './popover';
|
28
27
|
import overlayPanel from './overlayPanel';
|
29
28
|
import popoverMenu from './popoverMenu';
|
30
29
|
import rockerbutton from './rockerbutton';
|
@@ -47,7 +46,6 @@ export default _objectSpread(_objectSpread({
|
|
47
46
|
modal: modal,
|
48
47
|
numberField: numberField,
|
49
48
|
overlayPanel: overlayPanel,
|
50
|
-
popover: popover,
|
51
49
|
popoverMenu: popoverMenu,
|
52
50
|
rockerbutton: rockerbutton,
|
53
51
|
separator: separator,
|
package/package.json
CHANGED
@@ -1,112 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
|
4
|
-
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
6
|
-
|
7
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
8
|
-
|
9
|
-
_Object$defineProperty(exports, "__esModule", {
|
10
|
-
value: true
|
11
|
-
});
|
12
|
-
|
13
|
-
exports["default"] = void 0;
|
14
|
-
|
15
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
16
|
-
|
17
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
18
|
-
|
19
|
-
var _react = _interopRequireWildcard(require("react"));
|
20
|
-
|
21
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
22
|
-
|
23
|
-
var _forms = require("@rebass/forms");
|
24
|
-
|
25
|
-
var _focus = require("@react-aria/focus");
|
26
|
-
|
27
|
-
var _hooks = require("../../hooks");
|
28
|
-
|
29
|
-
var _react2 = require("@emotion/react");
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Basic dropdown menu input.
|
33
|
-
* Accepts most styling props from [styled-system](https://styled-system.com/table).
|
34
|
-
* Built on top of the [Select component from Rebass Forms](https://rebassjs.org/forms/select).
|
35
|
-
*/
|
36
|
-
var Dropdown = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
37
|
-
var className = props.className,
|
38
|
-
children = props.children,
|
39
|
-
hasNoneOption = props.hasNoneOption,
|
40
|
-
hasDisabledFirstOption = props.hasDisabledFirstOption,
|
41
|
-
firstLabel = props.firstLabel,
|
42
|
-
noneLabel = props.noneLabel,
|
43
|
-
defaultValue = props.defaultValue,
|
44
|
-
value = props.value,
|
45
|
-
others = (0, _objectWithoutProperties2["default"])(props, ["className", "children", "hasNoneOption", "hasDisabledFirstOption", "firstLabel", "noneLabel", "defaultValue", "value"]);
|
46
|
-
var dropdownRef = (0, _react.useRef)();
|
47
|
-
/* istanbul ignore next */
|
48
|
-
|
49
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
50
|
-
return dropdownRef.current;
|
51
|
-
});
|
52
|
-
|
53
|
-
var _useFocusRing = (0, _focus.useFocusRing)(),
|
54
|
-
isFocusVisible = _useFocusRing.isFocusVisible,
|
55
|
-
focusProps = _useFocusRing.focusProps;
|
56
|
-
|
57
|
-
var _useStatusClasses = (0, _hooks.useStatusClasses)(className, {
|
58
|
-
isFocused: isFocusVisible
|
59
|
-
}),
|
60
|
-
classNames = _useStatusClasses.classNames;
|
61
|
-
|
62
|
-
return (0, _react2.jsx)(_forms.Select, (0, _extends2["default"])({
|
63
|
-
ref: dropdownRef,
|
64
|
-
className: classNames,
|
65
|
-
defaultValue: value ? undefined : defaultValue || '',
|
66
|
-
value: value
|
67
|
-
}, others, focusProps), !hasNoneOption && (0, _react2.jsx)("option", {
|
68
|
-
key: "__empty",
|
69
|
-
value: "",
|
70
|
-
disabled: hasDisabledFirstOption
|
71
|
-
}, firstLabel), hasNoneOption && (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)("option", {
|
72
|
-
key: "__empty",
|
73
|
-
value: "",
|
74
|
-
disabled: hasDisabledFirstOption
|
75
|
-
}, noneLabel || firstLabel), (0, _react2.jsx)("option", {
|
76
|
-
key: "__spacer",
|
77
|
-
disabled: true
|
78
|
-
}, "--------")), children);
|
79
|
-
});
|
80
|
-
|
81
|
-
Dropdown.propTypes = {
|
82
|
-
/** Displays a none option within the dropdown options */
|
83
|
-
hasNoneOption: _propTypes["default"].bool,
|
84
|
-
|
85
|
-
/** Whether the first option is disabled. Useful to prevent reselection of the first option. */
|
86
|
-
hasDisabledFirstOption: _propTypes["default"].bool,
|
87
|
-
|
88
|
-
/** Id of the selected element */
|
89
|
-
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
90
|
-
|
91
|
-
/** Label for first option. */
|
92
|
-
firstLabel: _propTypes["default"].string,
|
93
|
-
|
94
|
-
/** Label for none option. `firstLabel` prop can also be used. */
|
95
|
-
noneLabel: _propTypes["default"].string,
|
96
|
-
|
97
|
-
/** Value of the select (controlled). */
|
98
|
-
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
99
|
-
|
100
|
-
/** Default value of the select (uncontrolled). */
|
101
|
-
defaultValue: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
102
|
-
|
103
|
-
/** Handler that is called when the element's selection state changes. */
|
104
|
-
onChange: _propTypes["default"].func
|
105
|
-
};
|
106
|
-
Dropdown.defaultProps = {
|
107
|
-
hasNoneOption: false,
|
108
|
-
firstLabel: 'Select an option'
|
109
|
-
};
|
110
|
-
Dropdown.displayName = 'Dropdown';
|
111
|
-
var _default = Dropdown;
|
112
|
-
exports["default"] = _default;
|
@@ -1,80 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
-
|
5
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
6
|
-
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
8
|
-
|
9
|
-
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
10
|
-
|
11
|
-
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
12
|
-
|
13
|
-
var _ = _interopRequireDefault(require("."));
|
14
|
-
|
15
|
-
var _react2 = require("@emotion/react");
|
16
|
-
|
17
|
-
var testId = 'test-box';
|
18
|
-
var defaultProps = {
|
19
|
-
'data-testid': testId
|
20
|
-
};
|
21
|
-
|
22
|
-
var getComponent = function getComponent() {
|
23
|
-
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
24
|
-
var children = props.children;
|
25
|
-
return (0, _testWrapper.render)((0, _react2.jsx)(_["default"], (0, _extends2["default"])({}, defaultProps, props), children));
|
26
|
-
}; // Need to be added to each test file to test accessibility using axe.
|
27
|
-
|
28
|
-
|
29
|
-
(0, _testAxe["default"])(getComponent, {
|
30
|
-
// Dropdown with label provided by DropdownField
|
31
|
-
rules: {
|
32
|
-
'select-name': {
|
33
|
-
enabled: false
|
34
|
-
}
|
35
|
-
}
|
36
|
-
});
|
37
|
-
test('dropdown renders', function () {
|
38
|
-
getComponent();
|
39
|
-
|
40
|
-
var dropdown = _testWrapper.screen.getByTestId(testId);
|
41
|
-
|
42
|
-
expect(dropdown).toBeInstanceOf(HTMLSelectElement);
|
43
|
-
expect(dropdown).toBeInTheDocument();
|
44
|
-
});
|
45
|
-
test('hasNoneOption prop renders none option', function () {
|
46
|
-
getComponent({
|
47
|
-
hasNoneOption: true,
|
48
|
-
noneLabel: 'None'
|
49
|
-
});
|
50
|
-
expect((0, _testWrapper.within)(document).getByText('None')).toBeInTheDocument();
|
51
|
-
});
|
52
|
-
test('default option is first one', function () {
|
53
|
-
getComponent();
|
54
|
-
|
55
|
-
var firstOption = _testWrapper.screen.getByRole('option');
|
56
|
-
|
57
|
-
expect(firstOption.value).toEqual('');
|
58
|
-
expect(firstOption).toHaveAttribute('selected', '');
|
59
|
-
expect(firstOption).toBeEnabled();
|
60
|
-
});
|
61
|
-
test('default option is disabled when hasDisabledFirstOption is passed in', function () {
|
62
|
-
getComponent({
|
63
|
-
hasDisabledFirstOption: true
|
64
|
-
});
|
65
|
-
|
66
|
-
var firstOption = _testWrapper.screen.getByRole('option');
|
67
|
-
|
68
|
-
expect(firstOption.value).toEqual('');
|
69
|
-
expect(firstOption).toHaveAttribute('selected', '');
|
70
|
-
expect(firstOption).toBeDisabled();
|
71
|
-
});
|
72
|
-
test('default option is not first one when custom defaultValue is passed in', function () {
|
73
|
-
getComponent({
|
74
|
-
defaultValue: '1'
|
75
|
-
});
|
76
|
-
|
77
|
-
var firstOption = _testWrapper.screen.getByRole('option');
|
78
|
-
|
79
|
-
expect(firstOption).not.toHaveAttribute('selected', '');
|
80
|
-
});
|