@pingux/astro 1.0.0-alpha.9 → 1.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +147 -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/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 +38 -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.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/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 +37 -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
@@ -32,8 +32,6 @@ var _ListViewContext = require("../ListView/ListViewContext");
|
|
32
32
|
|
33
33
|
var _Box = _interopRequireDefault(require("../Box"));
|
34
34
|
|
35
|
-
var _Separator = _interopRequireDefault(require("../Separator"));
|
36
|
-
|
37
35
|
var _hooks = require("../../hooks");
|
38
36
|
|
39
37
|
var _react2 = require("@emotion/react");
|
@@ -90,7 +88,8 @@ var ListViewItem = function ListViewItem(props) {
|
|
90
88
|
var _useStatusClasses = (0, _hooks.useStatusClasses)(className, {
|
91
89
|
isHovered: isHovered,
|
92
90
|
isSelected: isSelected,
|
93
|
-
isFocused: isDisabled ? false : isFocusVisible
|
91
|
+
isFocused: isDisabled ? false : isFocusVisible,
|
92
|
+
hasSeparator: hasSeparator
|
94
93
|
}),
|
95
94
|
classNames = _useStatusClasses.classNames;
|
96
95
|
|
@@ -111,9 +110,7 @@ var ListViewItem = function ListViewItem(props) {
|
|
111
110
|
isSelected: isSelected,
|
112
111
|
className: classNames,
|
113
112
|
"data-id": dataId
|
114
|
-
}, listItemProps), item.rendered))
|
115
|
-
m: "0px"
|
116
|
-
}));
|
113
|
+
}, listItemProps), item.rendered)));
|
117
114
|
};
|
118
115
|
|
119
116
|
ListViewItem.propTypes = {
|
@@ -63,9 +63,10 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
63
63
|
tabLabelProps = itemProps.tabLabelProps,
|
64
64
|
tabLineProps = itemProps.tabLineProps,
|
65
65
|
content = itemProps.content,
|
66
|
-
|
67
|
-
|
66
|
+
titleAttr = itemProps.titleAttr,
|
67
|
+
otherItemProps = (0, _objectWithoutProperties2["default"])(itemProps, ["icon", "isDisabled", "separator", "tabLabelProps", "tabLineProps", "content", "titleAttr"]);
|
68
68
|
var state = (0, _react.useContext)(_Tabs.TabsContext);
|
69
|
+
var isDisabled = tabsDisabled || tabDisabled || state.disabledKeys.has(key);
|
69
70
|
var isSelected = state.selectedKey === key;
|
70
71
|
|
71
72
|
var _useFocusRing = (0, _focus.useFocusRing)(),
|
@@ -106,7 +107,8 @@ var CollectionTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
106
107
|
className: classNames,
|
107
108
|
variant: "tab"
|
108
109
|
}, (0, _utils.mergeProps)(focusProps, hoverProps, tabProps), otherItemProps, {
|
109
|
-
ref: tabRef
|
110
|
+
ref: tabRef,
|
111
|
+
title: titleAttr || undefined
|
110
112
|
}), icon, (0, _react2.jsx)(_Text["default"], (0, _extends2["default"])({
|
111
113
|
variant: "tabLabel"
|
112
114
|
}, tabLabelProps), rendered), isSelected && !isDisabled && (0, _react2.jsx)(TabLine, tabLineProps)), slots === null || slots === void 0 ? void 0 : slots.afterTab);
|
@@ -126,6 +126,9 @@ Tabs.propTypes = {
|
|
126
126
|
/** The default tab key to be selected. (uncontrolled) */
|
127
127
|
defaultSelectedKey: _propTypes["default"].string,
|
128
128
|
|
129
|
+
/** Array of keys to disable within the tab list. */
|
130
|
+
disabledKeys: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
131
|
+
|
129
132
|
/** The tab key that is currently selected. (controlled) */
|
130
133
|
selectedKey: _propTypes["default"].string,
|
131
134
|
|
@@ -170,13 +170,12 @@ exports.Centered = Centered;
|
|
170
170
|
|
171
171
|
var DisabledSingleTab = function DisabledSingleTab() {
|
172
172
|
return (0, _react2.jsx)(_Tabs["default"], {
|
173
|
-
|
174
|
-
|
173
|
+
items: tabs,
|
174
|
+
disabledKeys: ['Tab 2']
|
175
175
|
}, function (item) {
|
176
176
|
return (0, _react2.jsx)(_Tab["default"], {
|
177
177
|
key: item.name,
|
178
|
-
title: item.name
|
179
|
-
isDisabled: item.name === 'Tab 1'
|
178
|
+
title: item.name
|
180
179
|
}, item.children);
|
181
180
|
});
|
182
181
|
};
|
@@ -257,6 +257,35 @@ test('disabled all tabs', function () {
|
|
257
257
|
expect(tab1).not.toContainElement(_testWrapper.screen.queryByRole('presentation'));
|
258
258
|
testTabPanel(0);
|
259
259
|
});
|
260
|
+
test('disabled tab is not accessible on click or focus', function () {
|
261
|
+
getComponent({
|
262
|
+
disabledKeys: [defaultTabs[1].name]
|
263
|
+
});
|
264
|
+
testTabPanel(0);
|
265
|
+
|
266
|
+
var _getTabs5 = getTabs(),
|
267
|
+
tabs = _getTabs5.tabs,
|
268
|
+
tab0 = _getTabs5.tab0,
|
269
|
+
tab1 = _getTabs5.tab1,
|
270
|
+
tab2 = _getTabs5.tab2; // Ensure that clicking a disabled tab does nothing
|
271
|
+
|
272
|
+
|
273
|
+
_userEvent["default"].click(tab1);
|
274
|
+
|
275
|
+
testTabPanel(0); // Ensure that disabled tab is not accessible via focus
|
276
|
+
|
277
|
+
_userEvent["default"].tab();
|
278
|
+
|
279
|
+
testSingleTab(tabs, tab0, 'toHaveFocus');
|
280
|
+
|
281
|
+
_testWrapper.fireEvent.keyDown(tab0, {
|
282
|
+
key: 'ArrowRight',
|
283
|
+
code: 'ArrowRight'
|
284
|
+
});
|
285
|
+
|
286
|
+
testSingleTab(tabs, tab2, 'toHaveFocus');
|
287
|
+
testTabPanel(2);
|
288
|
+
});
|
260
289
|
test('controlled tabs', function () {
|
261
290
|
var selectedKey = defaultTabs[1].name;
|
262
291
|
var onSelectionChange = jest.fn();
|
@@ -267,11 +296,11 @@ test('controlled tabs', function () {
|
|
267
296
|
}),
|
268
297
|
rerender = _getComponent.rerender;
|
269
298
|
|
270
|
-
var
|
271
|
-
tabs =
|
272
|
-
tab0 =
|
273
|
-
tab1 =
|
274
|
-
tab2 =
|
299
|
+
var _getTabs6 = getTabs(),
|
300
|
+
tabs = _getTabs6.tabs,
|
301
|
+
tab0 = _getTabs6.tab0,
|
302
|
+
tab1 = _getTabs6.tab1,
|
303
|
+
tab2 = _getTabs6.tab2; // Expect the second tab to be selected
|
275
304
|
|
276
305
|
|
277
306
|
expect(onSelectionChange).not.toHaveBeenCalled();
|
@@ -309,9 +338,9 @@ test('tab line props', function () {
|
|
309
338
|
}),
|
310
339
|
rerender = _getComponent2.rerender;
|
311
340
|
|
312
|
-
var
|
313
|
-
tabs =
|
314
|
-
tab0 =
|
341
|
+
var _getTabs7 = getTabs(),
|
342
|
+
tabs = _getTabs7.tabs,
|
343
|
+
tab0 = _getTabs7.tab0;
|
315
344
|
|
316
345
|
var tabLine = _testWrapper.screen.getByRole('presentation'); // Expect the tab line to have a red background
|
317
346
|
|
@@ -340,9 +369,9 @@ test('tab with icon', function () {
|
|
340
369
|
tabs: newTabs
|
341
370
|
});
|
342
371
|
|
343
|
-
var
|
344
|
-
tabs =
|
345
|
-
tab0 =
|
372
|
+
var _getTabs8 = getTabs(),
|
373
|
+
tabs = _getTabs8.tabs,
|
374
|
+
tab0 = _getTabs8.tab0;
|
346
375
|
|
347
376
|
var icon = _testWrapper.screen.getByTestId('icon'); // Expect the tab to have the given icon element
|
348
377
|
|
@@ -350,7 +379,7 @@ test('tab with icon', function () {
|
|
350
379
|
testSingleTab(tabs, tab0, 'toContainElement', [icon]);
|
351
380
|
});
|
352
381
|
test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
353
|
-
var
|
382
|
+
var _getTabs9, tab0;
|
354
383
|
|
355
384
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
356
385
|
while (1) {
|
@@ -360,7 +389,7 @@ test('tooltip renders on tab\'s hover in `tooltip` mode', /*#__PURE__*/(0, _asyn
|
|
360
389
|
mode: 'tooltip'
|
361
390
|
});
|
362
391
|
expect(_testWrapper.screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
363
|
-
|
392
|
+
_getTabs9 = getTabs(), tab0 = _getTabs9.tab0;
|
364
393
|
|
365
394
|
_testWrapper.fireEvent.mouseMove(tab0);
|
366
395
|
|
@@ -386,8 +415,8 @@ test('tabs without selected keys show null tab panel content', function () {
|
|
386
415
|
test('hover tab style', function () {
|
387
416
|
getComponent();
|
388
417
|
|
389
|
-
var
|
390
|
-
tab0 =
|
418
|
+
var _getTabs10 = getTabs(),
|
419
|
+
tab0 = _getTabs10.tab0;
|
391
420
|
|
392
421
|
expect(tab0).not.toHaveClass('is-hovered');
|
393
422
|
|
@@ -128,6 +128,16 @@ test('form wrapper will have default max label column width when no custom width
|
|
128
128
|
|
129
129
|
expect(textAreaContainer).toHaveStyle('grid-template-columns: 40% auto');
|
130
130
|
});
|
131
|
+
test('passing read only prop applys the is-read-only class to the textarea', function () {
|
132
|
+
var isReadOnly = true;
|
133
|
+
getComponent({
|
134
|
+
isReadOnly: isReadOnly
|
135
|
+
});
|
136
|
+
|
137
|
+
var textArea = _testWrapper.screen.getByLabelText(defaultProps.label);
|
138
|
+
|
139
|
+
expect(textArea).toHaveClass('is-read-only');
|
140
|
+
});
|
131
141
|
test('form wrapper will have a max label column width when custom width set', function () {
|
132
142
|
var labelMode = 'left';
|
133
143
|
var containerProps = {
|
@@ -8,16 +8,20 @@ _Object$defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
9
9
|
});
|
10
10
|
|
11
|
-
exports.Disabled = exports.isOpen = exports.withDelayProp = exports.withDirectionProp = exports.withAlignProp = exports.Default = exports["default"] = void 0;
|
11
|
+
exports.TextWithTooltip = exports.ChipWithTooltip = exports.IconWithTooltip = exports.Disabled = exports.isOpen = exports.withDelayProp = exports.withDirectionProp = exports.withAlignProp = exports.Default = exports["default"] = void 0;
|
12
12
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
14
14
|
|
15
15
|
var _EarthIcon = _interopRequireDefault(require("mdi-react/EarthIcon"));
|
16
16
|
|
17
|
+
var _PersonIcon = _interopRequireDefault(require("mdi-react/PersonIcon"));
|
18
|
+
|
17
19
|
var _index = require("../../index");
|
18
20
|
|
19
21
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
20
22
|
|
23
|
+
var _Text = _interopRequireDefault(require("../Text"));
|
24
|
+
|
21
25
|
var _react2 = require("@emotion/react");
|
22
26
|
|
23
27
|
var _default = {
|
@@ -80,4 +84,43 @@ Disabled.parameters = {
|
|
80
84
|
story: 'The tooltip can be disabled without disabling the button press events.'
|
81
85
|
}
|
82
86
|
}
|
83
|
-
};
|
87
|
+
};
|
88
|
+
|
89
|
+
var IconWithTooltip = function IconWithTooltip() {
|
90
|
+
return (0, _react2.jsx)(_index.Box, {
|
91
|
+
pl: 50
|
92
|
+
}, (0, _react2.jsx)(_index.TooltipTrigger, null, (0, _react2.jsx)(_IconButton["default"], {
|
93
|
+
variant: "tooltipIconButton"
|
94
|
+
}, (0, _react2.jsx)(_index.Icon, {
|
95
|
+
icon: _PersonIcon["default"]
|
96
|
+
})), (0, _react2.jsx)(_index.Tooltip, null, "Useful tooltip")));
|
97
|
+
};
|
98
|
+
|
99
|
+
exports.IconWithTooltip = IconWithTooltip;
|
100
|
+
|
101
|
+
var ChipWithTooltip = function ChipWithTooltip() {
|
102
|
+
return (0, _react2.jsx)(_index.Box, {
|
103
|
+
pl: 50
|
104
|
+
}, (0, _react2.jsx)(_index.TooltipTrigger, null, (0, _react2.jsx)(_index.Button, {
|
105
|
+
variant: "tooltipChip",
|
106
|
+
bg: "neutral.10"
|
107
|
+
}, (0, _react2.jsx)(_Text["default"], {
|
108
|
+
variant: "label",
|
109
|
+
sx: {
|
110
|
+
textTransform: 'uppercase'
|
111
|
+
},
|
112
|
+
color: "white"
|
113
|
+
}, "Some text")), (0, _react2.jsx)(_index.Tooltip, null, "Useful tooltip")));
|
114
|
+
};
|
115
|
+
|
116
|
+
exports.ChipWithTooltip = ChipWithTooltip;
|
117
|
+
|
118
|
+
var TextWithTooltip = function TextWithTooltip() {
|
119
|
+
return (0, _react2.jsx)(_index.Box, {
|
120
|
+
pl: 50
|
121
|
+
}, (0, _react2.jsx)(_index.TooltipTrigger, null, (0, _react2.jsx)(_index.Button, {
|
122
|
+
variant: "tooltipInline"
|
123
|
+
}, "Some text"), (0, _react2.jsx)(_index.Tooltip, null, "Useful tooltip")));
|
124
|
+
};
|
125
|
+
|
126
|
+
exports.TextWithTooltip = TextWithTooltip;
|