@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.
Files changed (94) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/README.md +5 -0
  3. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
  4. package/lib/cjs/components/Button/Button.js +5 -24
  5. package/lib/cjs/components/Button/Button.stories.js +5 -11
  6. package/lib/cjs/components/Button/Button.test.js +0 -24
  7. package/lib/cjs/components/Chip/Chip.js +26 -10
  8. package/lib/cjs/components/Chip/Chip.stories.js +44 -5
  9. package/lib/cjs/components/Chip/Chip.test.js +9 -0
  10. package/lib/cjs/components/{DropdownField/index.js → Chip/ChipContext.js} +8 -7
  11. package/lib/cjs/components/IconButton/IconButton.js +17 -7
  12. package/lib/cjs/components/IconButton/IconButton.test.js +0 -1
  13. package/lib/cjs/components/ListItem/ListItem.stories.js +0 -2
  14. package/lib/cjs/components/ListView/ListView.js +4 -3
  15. package/lib/cjs/components/ListViewItem/ListViewItem.js +3 -6
  16. package/lib/cjs/components/Stepper/Stepper.js +1 -0
  17. package/lib/cjs/components/Tab/Tab.js +5 -3
  18. package/lib/cjs/components/Tabs/Tabs.js +3 -0
  19. package/lib/cjs/components/Tabs/Tabs.stories.js +3 -4
  20. package/lib/cjs/components/Tabs/Tabs.test.js +44 -15
  21. package/lib/cjs/components/TextAreaField/TextAreaField.test.js +10 -0
  22. package/lib/cjs/index.js +48 -136
  23. package/lib/cjs/layouts/ListLayout.stories.js +2 -1
  24. package/lib/cjs/layouts/SchemaFormLayout.stories.js +2 -21
  25. package/lib/cjs/recipes/ArrayField.stories.js +3 -3
  26. package/lib/cjs/styles/forms/input.js +4 -0
  27. package/lib/cjs/styles/theme.js +0 -3
  28. package/lib/cjs/styles/variants/accordion.js +5 -7
  29. package/lib/cjs/styles/variants/boxes.js +20 -18
  30. package/lib/cjs/styles/variants/buttons.js +2 -28
  31. package/lib/cjs/styles/variants/variants.js +0 -3
  32. package/lib/components/AccordionGridGroup/AccordionGridGroup.stories.js +4 -11
  33. package/lib/components/Button/Button.js +7 -24
  34. package/lib/components/Button/Button.stories.js +5 -10
  35. package/lib/components/Button/Button.test.js +0 -20
  36. package/lib/components/Chip/Chip.js +25 -10
  37. package/lib/components/Chip/Chip.stories.js +41 -5
  38. package/lib/components/Chip/Chip.test.js +9 -0
  39. package/lib/components/Chip/ChipContext.js +3 -0
  40. package/lib/components/IconButton/IconButton.js +17 -9
  41. package/lib/components/IconButton/IconButton.test.js +0 -1
  42. package/lib/components/ListItem/ListItem.stories.js +0 -2
  43. package/lib/components/ListView/ListView.js +4 -3
  44. package/lib/components/ListViewItem/ListViewItem.js +3 -5
  45. package/lib/components/Stepper/Stepper.js +1 -0
  46. package/lib/components/Tab/Tab.js +5 -3
  47. package/lib/components/Tabs/Tabs.js +3 -0
  48. package/lib/components/Tabs/Tabs.stories.js +3 -4
  49. package/lib/components/Tabs/Tabs.test.js +40 -15
  50. package/lib/components/TextAreaField/TextAreaField.test.js +8 -0
  51. package/lib/index.js +0 -8
  52. package/lib/layouts/ListLayout.stories.js +2 -1
  53. package/lib/layouts/SchemaFormLayout.stories.js +2 -19
  54. package/lib/recipes/ArrayField.stories.js +3 -3
  55. package/lib/styles/forms/input.js +4 -0
  56. package/lib/styles/theme.js +0 -3
  57. package/lib/styles/variants/accordion.js +5 -7
  58. package/lib/styles/variants/boxes.js +20 -18
  59. package/lib/styles/variants/buttons.js +2 -28
  60. package/lib/styles/variants/variants.js +0 -2
  61. package/package.json +1 -1
  62. package/lib/cjs/components/Dropdown/Dropdown.js +0 -112
  63. package/lib/cjs/components/Dropdown/Dropdown.test.js +0 -80
  64. package/lib/cjs/components/Dropdown/index.js +0 -18
  65. package/lib/cjs/components/DropdownField/DropdownField.js +0 -187
  66. package/lib/cjs/components/DropdownField/DropdownField.stories.js +0 -278
  67. package/lib/cjs/components/DropdownField/DropdownField.test.js +0 -80
  68. package/lib/cjs/components/Panel/Panel.js +0 -101
  69. package/lib/cjs/components/Panel/Panel.stories.js +0 -57
  70. package/lib/cjs/components/Panel/Panel.test.js +0 -72
  71. package/lib/cjs/components/Panel/index.js +0 -18
  72. package/lib/cjs/components/Popover/Popover.js +0 -87
  73. package/lib/cjs/components/Popover/Popover.stories.js +0 -80
  74. package/lib/cjs/components/Popover/Popover.test.js +0 -91
  75. package/lib/cjs/components/Popover/index.js +0 -18
  76. package/lib/cjs/recipes/InputBoxWithLinkedChip.stories.js +0 -67
  77. package/lib/cjs/styles/variants/popover.js +0 -86
  78. package/lib/components/Dropdown/Dropdown.js +0 -90
  79. package/lib/components/Dropdown/Dropdown.test.js +0 -62
  80. package/lib/components/Dropdown/index.js +0 -1
  81. package/lib/components/DropdownField/DropdownField.js +0 -155
  82. package/lib/components/DropdownField/DropdownField.stories.js +0 -222
  83. package/lib/components/DropdownField/DropdownField.test.js +0 -60
  84. package/lib/components/DropdownField/index.js +0 -1
  85. package/lib/components/Panel/Panel.js +0 -71
  86. package/lib/components/Panel/Panel.stories.js +0 -35
  87. package/lib/components/Panel/Panel.test.js +0 -52
  88. package/lib/components/Panel/index.js +0 -1
  89. package/lib/components/Popover/Popover.js +0 -65
  90. package/lib/components/Popover/Popover.stories.js +0 -52
  91. package/lib/components/Popover/Popover.test.js +0 -75
  92. package/lib/components/Popover/index.js +0 -2
  93. package/lib/recipes/InputBoxWithLinkedChip.stories.js +0 -43
  94. package/lib/styles/variants/popover.js +0 -76
@@ -119,6 +119,7 @@ var Stepper = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
119
119
  },
120
120
  textValue: textValue,
121
121
  title: step,
122
+ "aria-label": textValue,
122
123
  content: item.rendered,
123
124
  separator: !isFirst && line
124
125
  });
@@ -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
- otherItemProps = (0, _objectWithoutProperties2["default"])(itemProps, ["icon", "isDisabled", "separator", "tabLabelProps", "tabLineProps", "content"]);
67
- var isDisabled = tabsDisabled || tabDisabled;
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
- defaultSelectedKey: "Tab 2",
174
- items: tabs
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 _getTabs5 = getTabs(),
271
- tabs = _getTabs5.tabs,
272
- tab0 = _getTabs5.tab0,
273
- tab1 = _getTabs5.tab1,
274
- tab2 = _getTabs5.tab2; // Expect the second tab to be selected
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 _getTabs6 = getTabs(),
313
- tabs = _getTabs6.tabs,
314
- tab0 = _getTabs6.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 _getTabs7 = getTabs(),
344
- tabs = _getTabs7.tabs,
345
- tab0 = _getTabs7.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 _getTabs8, tab0;
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
- _getTabs8 = getTabs(), tab0 = _getTabs8.tab0;
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 _getTabs9 = getTabs(),
390
- tab0 = _getTabs9.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 = {