@pingux/astro 1.1.0-alpha.1 → 1.1.0-alpha.13

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 (104) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.test.js +24 -0
  3. package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +1 -1
  4. package/lib/cjs/components/AccordionGridItem/AccordionGridItemHeader.js +1 -1
  5. package/lib/cjs/components/AccordionGroup/AccordionGroup.test.js +33 -1
  6. package/lib/cjs/components/AccordionItem/AccordionItem.js +5 -4
  7. package/lib/cjs/components/Button/Button.js +1 -2
  8. package/lib/cjs/components/Button/Button.stories.js +2 -1
  9. package/lib/cjs/components/Button/Button.test.js +2 -1
  10. package/lib/cjs/components/CodeView/CodeView.js +165 -0
  11. package/lib/cjs/components/CodeView/CodeView.stories.js +93 -0
  12. package/lib/cjs/components/CodeView/CodeView.test.js +211 -0
  13. package/lib/cjs/components/CodeView/index.js +18 -0
  14. package/lib/cjs/components/ColorField/ColorField.js +1 -0
  15. package/lib/cjs/components/ComboBoxField/ComboBoxField.js +7 -0
  16. package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +25 -1
  17. package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +44 -0
  18. package/lib/cjs/components/CopyText/CopyText.js +34 -11
  19. package/lib/cjs/components/FileInputField/FileItem.js +2 -1
  20. package/lib/cjs/components/IconButton/IconButton.js +1 -1
  21. package/lib/cjs/components/IconButton/IconButton.stories.js +8 -17
  22. package/lib/cjs/components/IconButton/IconButton.test.js +4 -5
  23. package/lib/cjs/components/ImageUploadField/ImagePreviewButton.js +2 -1
  24. package/lib/cjs/components/List/List.js +3 -0
  25. package/lib/cjs/components/List/List.stories.js +7 -2
  26. package/lib/cjs/components/ListBox/ListBox.js +3 -6
  27. package/lib/cjs/components/ListBox/ListBox.test.js +2 -0
  28. package/lib/cjs/components/ListBox/Option.js +6 -0
  29. package/lib/cjs/components/Messages/Message.js +2 -2
  30. package/lib/cjs/components/MultivaluesField/MultivaluesField.js +2 -1
  31. package/lib/cjs/components/NavBar/NavBar.js +38 -0
  32. package/lib/cjs/components/NavBar/NavBar.stories.js +679 -0
  33. package/lib/cjs/components/NavBar/NavBar.test.js +116 -0
  34. package/lib/cjs/components/NavBar/index.js +18 -0
  35. package/lib/cjs/components/NavBarSection/NavBarItemBody.js +56 -0
  36. package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +47 -0
  37. package/lib/cjs/components/NavBarSection/NavBarSection.js +82 -0
  38. package/lib/cjs/components/NavBarSection/index.js +18 -0
  39. package/lib/cjs/components/OverlayPanel/OverlayPanel.stories.js +15 -14
  40. package/lib/cjs/components/PopoverContainer/PopoverContainer.test.js +15 -0
  41. package/lib/cjs/components/Separator/Separator.js +1 -1
  42. package/lib/cjs/components/TextArea/TextArea.js +5 -1
  43. package/lib/cjs/components/TooltipTrigger/TooltipTrigger.js +10 -5
  44. package/lib/cjs/index.js +84 -30
  45. package/lib/cjs/styles/variants/accordion.js +34 -3
  46. package/lib/cjs/styles/variants/boxes.js +24 -1
  47. package/lib/cjs/styles/variants/buttons.js +39 -1
  48. package/lib/cjs/styles/variants/codeView.js +80 -0
  49. package/lib/cjs/styles/variants/link.js +1 -1
  50. package/lib/cjs/styles/variants/separator.js +46 -3
  51. package/lib/cjs/styles/variants/text.js +15 -0
  52. package/lib/cjs/styles/variants/variants.js +3 -0
  53. package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +23 -1
  54. package/lib/components/AccordionGridItem/AccordionGridItemBody.js +1 -1
  55. package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +1 -1
  56. package/lib/components/AccordionGroup/AccordionGroup.test.js +30 -1
  57. package/lib/components/AccordionItem/AccordionItem.js +6 -5
  58. package/lib/components/Button/Button.js +2 -3
  59. package/lib/components/Button/Button.stories.js +2 -1
  60. package/lib/components/Button/Button.test.js +2 -1
  61. package/lib/components/CodeView/CodeView.js +130 -0
  62. package/lib/components/CodeView/CodeView.stories.js +67 -0
  63. package/lib/components/CodeView/CodeView.test.js +171 -0
  64. package/lib/components/CodeView/index.js +1 -0
  65. package/lib/components/ColorField/ColorField.js +1 -0
  66. package/lib/components/ComboBoxField/ComboBoxField.js +7 -0
  67. package/lib/components/ComboBoxField/ComboBoxField.stories.js +21 -0
  68. package/lib/components/ComboBoxField/ComboBoxField.test.js +35 -0
  69. package/lib/components/CopyText/CopyText.js +35 -11
  70. package/lib/components/FileInputField/FileItem.js +2 -1
  71. package/lib/components/IconButton/IconButton.js +1 -1
  72. package/lib/components/IconButton/IconButton.stories.js +7 -13
  73. package/lib/components/IconButton/IconButton.test.js +4 -5
  74. package/lib/components/ImageUploadField/ImagePreviewButton.js +2 -1
  75. package/lib/components/List/List.js +2 -0
  76. package/lib/components/List/List.stories.js +6 -2
  77. package/lib/components/ListBox/ListBox.js +3 -5
  78. package/lib/components/ListBox/ListBox.test.js +2 -0
  79. package/lib/components/ListBox/Option.js +6 -0
  80. package/lib/components/Messages/Message.js +2 -2
  81. package/lib/components/MultivaluesField/MultivaluesField.js +2 -1
  82. package/lib/components/NavBar/NavBar.js +24 -0
  83. package/lib/components/NavBar/NavBar.stories.js +650 -0
  84. package/lib/components/NavBar/NavBar.test.js +92 -0
  85. package/lib/components/NavBar/index.js +1 -0
  86. package/lib/components/NavBarSection/NavBarItemBody.js +37 -0
  87. package/lib/components/NavBarSection/NavBarItemHeader.js +31 -0
  88. package/lib/components/NavBarSection/NavBarSection.js +65 -0
  89. package/lib/components/NavBarSection/index.js +1 -0
  90. package/lib/components/OverlayPanel/OverlayPanel.stories.js +7 -5
  91. package/lib/components/PopoverContainer/PopoverContainer.test.js +16 -1
  92. package/lib/components/Separator/Separator.js +1 -1
  93. package/lib/components/TextArea/TextArea.js +5 -1
  94. package/lib/components/TooltipTrigger/TooltipTrigger.js +10 -5
  95. package/lib/index.js +5 -0
  96. package/lib/styles/variants/accordion.js +34 -3
  97. package/lib/styles/variants/boxes.js +24 -1
  98. package/lib/styles/variants/buttons.js +39 -1
  99. package/lib/styles/variants/codeView.js +68 -0
  100. package/lib/styles/variants/link.js +1 -1
  101. package/lib/styles/variants/separator.js +33 -1
  102. package/lib/styles/variants/text.js +15 -0
  103. package/lib/styles/variants/variants.js +2 -0
  104. package/package.json +3 -1
@@ -0,0 +1,171 @@
1
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
2
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
3
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
4
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
7
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
8
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
9
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
10
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
11
+ import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/trim";
12
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
13
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
14
+
15
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
16
+
17
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context5; _forEachInstanceProperty(_context5 = ownKeys(Object(source), true)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context6; _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
18
+
19
+ import React from 'react';
20
+ import userEvent from '@testing-library/user-event';
21
+ import axeTest from '../../utils/testUtils/testAxe';
22
+ import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
23
+ import { CodeView } from '../..';
24
+ import { jsx as ___EmotionJSX } from "@emotion/react";
25
+ var testId = 'test-code-sample';
26
+
27
+ var originalClipboard = _objectSpread({}, global.navigator.clipboard);
28
+
29
+ var originalExecCommand = global.document.execCommand;
30
+ var defaultProps = {
31
+ 'data-testid': testId
32
+ };
33
+ var textValue = "\nexport const Default = args => (\n <>\n <Text sx={{ fontWeight: 2 }}>JSON</Text>\n <CodeView {...args} />\n </>\n);\n";
34
+
35
+ var getComponent = function getComponent() {
36
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
37
+ return render(___EmotionJSX(CodeView, _extends({}, defaultProps, props), textValue));
38
+ }; // Need to be added to each test file to test accessibility using axe.
39
+
40
+
41
+ axeTest(getComponent);
42
+ test('renders component in the default state', function () {
43
+ getComponent();
44
+ var container = screen.getByTestId(testId);
45
+ expect(container).toBeInstanceOf(HTMLDivElement);
46
+ expect(container).toBeInTheDocument();
47
+ });
48
+ test('tooltip renders on hover', function () {
49
+ getComponent();
50
+ var container = screen.getByTestId(testId);
51
+ fireEvent.mouseMove(container);
52
+ fireEvent.mouseEnter(container);
53
+ expect(screen.queryByRole('tooltip')).toBeInTheDocument();
54
+ expect(screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
55
+ });
56
+ test('content and copy button are focused via keyboard', function () {
57
+ getComponent();
58
+ var container = screen.getByTestId(testId);
59
+ expect(container).not.toHaveFocus();
60
+ userEvent.tab();
61
+ expect(container).toHaveFocus();
62
+ var copyBtn = screen.getByLabelText('copy');
63
+ expect(copyBtn).not.toHaveFocus();
64
+ userEvent.tab();
65
+ expect(copyBtn).toHaveFocus();
66
+ expect(copyBtn).toHaveClass('is-focused');
67
+ });
68
+ test('doesn\'t render copy button and tooltip with prop hasNoCopyButton', function () {
69
+ getComponent({
70
+ hasNoCopyButton: true
71
+ });
72
+ var container = screen.getByTestId(testId);
73
+ fireEvent.mouseMove(container);
74
+ fireEvent.mouseEnter(container);
75
+ expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
76
+ expect(screen.queryByLabelText('copy')).not.toBeInTheDocument();
77
+ });
78
+ test('renders line numbers with prop hasLineNumbers', function () {
79
+ var linesLength = (_trimInstanceProperty(textValue).call(textValue).split('\n').length - 1).toString();
80
+ getComponent();
81
+ expect(screen.queryByText('1')).not.toBeInTheDocument();
82
+ expect(screen.queryByText(linesLength)).not.toBeInTheDocument();
83
+ getComponent({
84
+ hasLineNumbers: true
85
+ });
86
+ expect(screen.queryByText('1')).toBeInTheDocument();
87
+ expect(screen.queryByText(linesLength)).toBeInTheDocument();
88
+ });
89
+ beforeEach(function () {
90
+ var mockClipboard = {
91
+ writeText: jest.fn()
92
+ };
93
+ global.navigator.clipboard = mockClipboard;
94
+ global.document.execCommand = jest.fn();
95
+ global.document.execCommand.mockReturnValue(true);
96
+ });
97
+ afterEach(function () {
98
+ jest.resetAllMocks();
99
+ global.navigator.clipboard = originalClipboard;
100
+ global.document.execCommand = originalExecCommand;
101
+ });
102
+ test('click on copy button copies data to the clipboard', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
103
+ var button;
104
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
105
+ while (1) {
106
+ switch (_context2.prev = _context2.next) {
107
+ case 0:
108
+ getComponent();
109
+ button = screen.getByLabelText('copy');
110
+ _context2.next = 4;
111
+ return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
112
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
113
+ while (1) {
114
+ switch (_context.prev = _context.next) {
115
+ case 0:
116
+ return _context.abrupt("return", userEvent.click(button));
117
+
118
+ case 1:
119
+ case "end":
120
+ return _context.stop();
121
+ }
122
+ }
123
+ }, _callee);
124
+ })));
125
+
126
+ case 4:
127
+ expect(navigator.clipboard.writeText).toBeCalledTimes(1);
128
+ expect(navigator.clipboard.writeText).toHaveBeenCalledWith(textValue);
129
+
130
+ case 6:
131
+ case "end":
132
+ return _context2.stop();
133
+ }
134
+ }
135
+ }, _callee2);
136
+ })));
137
+ test('after button click, the tooltip renders with the text "Copied!"', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
138
+ var button;
139
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
140
+ while (1) {
141
+ switch (_context4.prev = _context4.next) {
142
+ case 0:
143
+ getComponent();
144
+ button = screen.getByLabelText('copy');
145
+ _context4.next = 4;
146
+ return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
147
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
148
+ while (1) {
149
+ switch (_context3.prev = _context3.next) {
150
+ case 0:
151
+ return _context3.abrupt("return", userEvent.click(button));
152
+
153
+ case 1:
154
+ case "end":
155
+ return _context3.stop();
156
+ }
157
+ }
158
+ }, _callee3);
159
+ })));
160
+
161
+ case 4:
162
+ expect(screen.queryByRole('tooltip')).toBeInTheDocument();
163
+ expect(screen.queryByRole('tooltip')).toHaveTextContent('Copied!');
164
+
165
+ case 6:
166
+ case "end":
167
+ return _context4.stop();
168
+ }
169
+ }
170
+ }, _callee4);
171
+ })));
@@ -0,0 +1 @@
1
+ export { default } from './CodeView';
@@ -108,6 +108,7 @@ var ColorField = /*#__PURE__*/forwardRef(function (props, ref) {
108
108
  return _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "rgba(".concat(colorValue === null || colorValue === void 0 ? void 0 : colorValue.red, ", ")).call(_context4, colorValue === null || colorValue === void 0 ? void 0 : colorValue.green, ", ")).call(_context3, colorValue === null || colorValue === void 0 ? void 0 : colorValue.blue, ", ")).call(_context2, colorValue === null || colorValue === void 0 ? void 0 : colorValue.alpha, ")");
109
109
  }, []);
110
110
  return ___EmotionJSX(Box, fieldContainerProps, label && ___EmotionJSX(Label, fieldLabelProps), ___EmotionJSX(Button, _extends({
111
+ "aria-label": "Select color",
111
112
  bg: getRgbaFromState(state),
112
113
  onPress: handleButtonPress,
113
114
  ref: triggerRef,
@@ -116,6 +116,12 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
116
116
  useImperativeHandle(ref, function () {
117
117
  return inputRef.current;
118
118
  });
119
+ /* istanbul ignore next */
120
+
121
+ var onSelectionChangeHandler = function onSelectionChangeHandler(key) {
122
+ var newVal = key || selectedKey || '';
123
+ if (onSelectionChange) onSelectionChange(newVal);
124
+ };
119
125
 
120
126
  var _useFilter = useFilter({
121
127
  sensitivity: 'base'
@@ -123,6 +129,7 @@ var ComboBoxField = /*#__PURE__*/forwardRef(function (props, ref) {
123
129
  contains = _useFilter.contains;
124
130
 
125
131
  var state = useComboBoxState(_objectSpread(_objectSpread({}, comboBoxOptions), {}, {
132
+ onSelectionChange: hasCustomValue ? onSelectionChangeHandler : onSelectionChange,
126
133
  defaultFilter: contains
127
134
  }));
128
135
 
@@ -330,6 +330,27 @@ export var ControlledFiltering = function ControlledFiltering() {
330
330
  }, item.name);
331
331
  }));
332
332
  };
333
+ export var ControlledWithCustomValue = function ControlledWithCustomValue() {
334
+ var _useState9 = useState(''),
335
+ _useState10 = _slicedToArray(_useState9, 2),
336
+ inputValue = _useState10[0],
337
+ setInputValue = _useState10[1];
338
+
339
+ return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
340
+ label: "Example label",
341
+ defaultItems: items
342
+ }, actions, {
343
+ inputValue: inputValue,
344
+ selectedKey: inputValue,
345
+ onInputChange: setInputValue,
346
+ onSelectionChange: setInputValue,
347
+ hasCustomValue: true
348
+ }), function (item) {
349
+ return ___EmotionJSX(Item, {
350
+ key: item.name
351
+ }, item.name);
352
+ }));
353
+ };
333
354
  export var AllowCustomValue = function AllowCustomValue() {
334
355
  return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({
335
356
  label: "Example label",
@@ -639,6 +639,41 @@ test('two listbox can not be open at the same time', function () {
639
639
  name: 'Tango'
640
640
  })).toBeInTheDocument();
641
641
  });
642
+ test('should handle selecting custom option', function () {
643
+ getComponent({
644
+ hasCustomValue: true
645
+ });
646
+ var input = screen.queryByRole('combobox');
647
+ expect(input).toHaveValue(''); // type something
648
+
649
+ userEvent.type(input, 'custom'); // set input value as selected
650
+
651
+ userEvent.type(input, '{enter}', {
652
+ skipClick: true
653
+ });
654
+ expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
655
+ expect(screen.queryByRole('combobox')).toHaveValue('custom'); // blur input
656
+
657
+ userEvent.tab();
658
+ expect(input).toHaveValue('custom');
659
+ });
660
+ test('onSelectionChange works properly with custom value', function () {
661
+ var onSelectionChange = jest.fn();
662
+ getComponent({
663
+ hasCustomValue: true,
664
+ onSelectionChange: onSelectionChange,
665
+ onInputChange: onSelectionChange
666
+ });
667
+ var input = screen.queryByRole('combobox');
668
+ expect(input).toHaveValue('');
669
+ expect(onSelectionChange).not.toHaveBeenCalled(); // Should fire when input value was typed, and enter was pressed
670
+
671
+ userEvent.type(input, 'custom{enter}');
672
+ expect(onSelectionChange).toHaveBeenCalledWith('custom'); // Should fire when input is cleared
673
+
674
+ userEvent.type(input, '{selectall}{backspace}{enter}');
675
+ expect(onSelectionChange).toHaveBeenCalledWith('');
676
+ });
642
677
  test('should have no accessibility violations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
643
678
  var _getComponent6, container, results;
644
679
 
@@ -1,8 +1,8 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
1
  import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
3
2
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
4
4
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
5
- import React, { forwardRef, useEffect, useState } from 'react';
5
+ import React, { forwardRef, useEffect, useRef, useState } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { useFocusRing } from '@react-aria/focus';
8
8
  import { Pressable, useHover } from '@react-aria/interactions';
@@ -14,19 +14,20 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
14
14
 
15
15
  var TooltipWrapper = function TooltipWrapper(_ref) {
16
16
  var children = _ref.children,
17
- isOpen = _ref.isOpen,
18
- tooltip = _ref.tooltip;
19
- return ___EmotionJSX(TooltipTrigger, {
17
+ tooltip = _ref.tooltip,
18
+ others = _objectWithoutProperties(_ref, ["children", "tooltip"]);
19
+
20
+ return ___EmotionJSX(TooltipTrigger, _extends({
20
21
  key: tooltip,
21
22
  direction: "top",
22
23
  isNotFlippable: true,
23
- isOpen: isOpen,
24
24
  offset: 5
25
- }, children, ___EmotionJSX(Tooltip, null, tooltip));
25
+ }, others), children, ___EmotionJSX(Tooltip, null, tooltip));
26
26
  };
27
27
 
28
28
  TooltipWrapper.propTypes = {
29
29
  isOpen: PropTypes.bool,
30
+ targetRef: PropTypes.shape({}),
30
31
  tooltip: PropTypes.string
31
32
  };
32
33
  /**
@@ -38,7 +39,9 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
38
39
  textToCopy = props.textToCopy,
39
40
  tooltipText = props.tooltipText,
40
41
  mode = props.mode,
41
- others = _objectWithoutProperties(props, ["children", "textToCopy", "tooltipText", "mode"]);
42
+ tooltipProps = props.tooltipProps,
43
+ wrapperProps = props.wrapperProps,
44
+ others = _objectWithoutProperties(props, ["children", "textToCopy", "tooltipText", "mode", "tooltipProps", "wrapperProps"]);
42
45
 
43
46
  var value = textToCopy || (mode === 'link' ? children.props.href : children.props.children);
44
47
 
@@ -75,13 +78,28 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
75
78
  return undefined;
76
79
  }, [isCopied]);
77
80
  var copyToClipboard = useCopyToClipboard(value, setIsCopied);
78
- var content = mode === 'link' ? children : ___EmotionJSX(Button, _extends({
81
+ var content = mode === 'link' || mode === 'nonClickableContent' ? children : ___EmotionJSX(Button, _extends({
79
82
  variant: "quiet",
80
83
  onPress: copyToClipboard,
81
84
  "aria-label": "copy-content"
82
85
  }, focusProps), children);
83
86
  var tooltip = isCopied ? 'Copied!' : tooltipText;
84
87
  var isTooltipOpen = isFocusVisible || isHovered || isCopied;
88
+ var wrapperRef = useRef();
89
+
90
+ if (mode === 'nonClickableContent') {
91
+ return ___EmotionJSX(TooltipWrapper, _extends({
92
+ isOpen: isTooltipOpen,
93
+ tooltip: tooltip,
94
+ targetRef: wrapperRef
95
+ }, tooltipProps), ___EmotionJSX(Box, _extends({
96
+ ref: wrapperRef,
97
+ isRow: true,
98
+ tabIndex: 0
99
+ }, mergeProps(hoverProps, others), wrapperProps), content, ___EmotionJSX(CopyButton, _extends({
100
+ onPress: copyToClipboard
101
+ }, focusProps))));
102
+ }
85
103
 
86
104
  if (mode === 'link') {
87
105
  return ___EmotionJSX(Box, _extends({
@@ -109,13 +127,19 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
109
127
  });
110
128
  CopyText.propTypes = {
111
129
  /** The behavioral pattern to apply to the component. */
112
- mode: PropTypes.oneOf(['text', 'link']),
130
+ mode: PropTypes.oneOf(['text', 'link', 'nonClickableContent']),
113
131
 
114
132
  /** The text to be copied instead of the text inside the child component. */
115
133
  textToCopy: PropTypes.string,
116
134
 
117
135
  /** The text to be displayed in the tooltip. */
118
- tooltipText: PropTypes.string
136
+ tooltipText: PropTypes.string,
137
+
138
+ /** Props to apply to the tooltip in nonClickableContent mode. */
139
+ tooltipProps: PropTypes.shape({}),
140
+
141
+ /** Props to apply to the wrapper in nonClickableContent mode. */
142
+ wrapperProps: PropTypes.shape({})
119
143
  };
120
144
  CopyText.defaultProps = {
121
145
  mode: 'text',
@@ -37,7 +37,8 @@ var FileItem = function FileItem(props) {
37
37
 
38
38
  default:
39
39
  return {
40
- icon: InsertDriveFileIcon
40
+ icon: InsertDriveFileIcon,
41
+ color: 'neutral.10'
41
42
  };
42
43
  }
43
44
  }, [status]);
@@ -83,7 +83,7 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
83
83
  tabIndex: 0,
84
84
  ref: buttonRef,
85
85
  className: classNames,
86
- "aria-label": ariaLabel || 'Icon Button',
86
+ "aria-label": ariaLabel,
87
87
  sx: chipBg && isHovered && {
88
88
  'path': {
89
89
  fill: chipBg
@@ -35,29 +35,23 @@ export default {
35
35
  isDisabled: {},
36
36
  variant: {
37
37
  control: {
38
- type: 'none'
39
- }
38
+ type: 'select',
39
+ options: ['iconButton', 'inverted', 'square', 'invertedSquare']
40
+ },
41
+ defaultValue: 'iconButton'
40
42
  }
41
43
  }
42
44
  };
43
45
  export var Default = function Default(args) {
44
46
  return ___EmotionJSX(IconButton, _extends({
45
- "aria-label": "my-label"
47
+ "aria-label": "default icon button"
46
48
  }, args), ___EmotionJSX(Icon, {
47
49
  icon: CreateIcon
48
50
  }));
49
51
  };
50
- export var Inverted = function Inverted() {
51
- return ___EmotionJSX(IconButton, {
52
- "aria-label": "my-label",
53
- variant: "inverted"
54
- }, ___EmotionJSX(Icon, {
55
- icon: CreateIcon
56
- }));
57
- };
58
52
  export var WithTooltip = function WithTooltip() {
59
53
  return ___EmotionJSX(IconButton, {
60
- "aria-label": "my-label",
54
+ "aria-label": "icon button with tooltip",
61
55
  title: "Edit"
62
56
  }, ___EmotionJSX(Icon, {
63
57
  icon: CreateIcon
@@ -65,7 +59,7 @@ export var WithTooltip = function WithTooltip() {
65
59
  };
66
60
  export var Disabled = function Disabled() {
67
61
  return ___EmotionJSX(IconButton, {
68
- "aria-label": "my-label",
62
+ "aria-label": "disabled icon button",
69
63
  isDisabled: true
70
64
  }, ___EmotionJSX(Icon, {
71
65
  icon: CreateIcon
@@ -17,7 +17,8 @@ var Icon = function Icon(props) {
17
17
  var testId = 'test-button';
18
18
  var defaultProps = {
19
19
  'data-testid': testId,
20
- icon: Icon
20
+ icon: Icon,
21
+ 'aria-label': 'Create'
21
22
  };
22
23
 
23
24
  var getComponent = function getComponent() {
@@ -115,10 +116,8 @@ test('tooltip is not shown on hover or focus when prop is not passed', function
115
116
  expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
116
117
  });
117
118
  test('the button should be getting aria label attribute', function () {
118
- var testLabel = 'test label';
119
- getComponent({
120
- 'aria-label': testLabel
121
- });
119
+ var testLabel = defaultProps['aria-label'];
120
+ getComponent();
122
121
  expect(screen.getByLabelText(testLabel)).toBeInTheDocument();
123
122
  });
124
123
  test('show button isDisabled status', function () {
@@ -92,7 +92,8 @@ var ImagePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
92
92
  ref: buttonRef,
93
93
  variant: "imageUpload",
94
94
  sx: widthHeightSx,
95
- "data-testid": "image-preview-button"
95
+ "data-testid": "image-preview-button",
96
+ "aria-label": "Image preview"
96
97
  }, mergeProps(focusProps, others)), previewImage && isImageType ? imagePreview : noImagePreview, isLoading && loadingPreview, (isHovered || isFocusVisible) && !isLoading && hoveredPreview));
97
98
  });
98
99
  ImagePreviewButton.propTypes = {
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
3
  import React, { forwardRef } from 'react';
4
4
  import Box from '../Box/Box';
5
+ import { useDeprecationWarning } from '../../hooks';
5
6
  /**
6
7
  * The intended use of List is to hold a collection of <ListItem/> components.
7
8
  * Accepts most of the styling props from [styled-system](https://styled-system.com/table).
@@ -12,6 +13,7 @@ var List = /*#__PURE__*/forwardRef(function (props, ref) {
12
13
  var children = props.children,
13
14
  others = _objectWithoutProperties(props, ["children"]);
14
15
 
16
+ useDeprecationWarning('The List component will be deprecated in Astro-UI 2.0.0, use ListView instead.');
15
17
  return ___EmotionJSX(Box, _extends({
16
18
  ref: ref,
17
19
  role: "list",
@@ -3,10 +3,14 @@ import List from '.';
3
3
  import ListItem from '../ListItem';
4
4
  import Text from '../Text';
5
5
  import Separator from '../Separator';
6
+ import withDeprecationWarning from '../../utils/devUtils/decorators/withDeprecationWarning';
6
7
  import { jsx as ___EmotionJSX } from "@emotion/react";
7
8
  export default {
8
- title: 'List',
9
- component: [List, ListItem]
9
+ title: 'Deprecated/List',
10
+ component: [List, ListItem],
11
+ decorators: [function (Story, context) {
12
+ return withDeprecationWarning(Story, context, 'The `List` component will be deprecated in Astro-UI 2.0.0, use `ListView` instead.');
13
+ }]
10
14
  };
11
15
  export var Default = function Default() {
12
16
  return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Text, {
@@ -24,7 +24,6 @@ import { useCollator } from '@react-aria/i18n';
24
24
  import { ListLayout } from '@react-stately/layout';
25
25
  import { ListBoxContext } from './ListBoxContext';
26
26
  import { Option } from './index.js';
27
- import { useAriaLabelWarning } from '../../hooks';
28
27
  import { isIterableProp } from '../../utils/devUtils/props/isIterable';
29
28
  import Loader from '../Loader';
30
29
  import ListBoxSection from './ListBoxSection';
@@ -77,13 +76,12 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
77
76
  selectedKeys = props.selectedKeys,
78
77
  selectionMode = props.selectionMode,
79
78
  state = props.state,
79
+ ariaLabel = props['aria-label'],
80
80
  ariaLabelledby = props['aria-labelledby'],
81
81
  ariaDescribedby = props['aria-describedby'],
82
82
  ariaDetails = props['aria-details'],
83
- others = _objectWithoutProperties(props, ["defaultSelectedKeys", "disabledKeys", "hasAutoFocus", "hasFocusWrap", "hasNoEmptySelection", "hasVirtualFocus", "id", "isLoading", "isFocusedOnHover", "isSelectedOnPressUp", "isVirtualized", "items", "keyboardDelegate", "label", "onLoadMore", "onScroll", "onSelectionChange", "renderEmptyState", "selectedKeys", "selectionMode", "state", "aria-labelledby", "aria-describedby", "aria-details"]);
83
+ others = _objectWithoutProperties(props, ["defaultSelectedKeys", "disabledKeys", "hasAutoFocus", "hasFocusWrap", "hasNoEmptySelection", "hasVirtualFocus", "id", "isLoading", "isFocusedOnHover", "isSelectedOnPressUp", "isVirtualized", "items", "keyboardDelegate", "label", "onLoadMore", "onScroll", "onSelectionChange", "renderEmptyState", "selectedKeys", "selectionMode", "state", "aria-label", "aria-labelledby", "aria-describedby", "aria-details"]);
84
84
 
85
- var ariaLabel = props['aria-label'];
86
- useAriaLabelWarning('ListBox', ariaLabel);
87
85
  var focusStrategy = state.focusStrategy; // Object matching React Aria API with all options
88
86
 
89
87
  var listBoxOptions = {
@@ -107,7 +105,7 @@ var ListBox = /*#__PURE__*/forwardRef(function (props, ref) {
107
105
  shouldFocusWrap: hasFocusWrap,
108
106
  shouldSelectOnPressUp: isSelectedOnPressUp,
109
107
  shouldUseVirtualFocus: hasVirtualFocus,
110
- 'aria-label': ariaLabel || 'ListBox',
108
+ 'aria-label': ariaLabel,
111
109
  'aria-labelledby': ariaLabelledby,
112
110
  'aria-describedby': ariaDescribedby,
113
111
  'aria-details': ariaDetails
@@ -29,11 +29,13 @@ var itemsWithSections = [{
29
29
  }];
30
30
  var defaultProps = {
31
31
  'data-testid': testId,
32
+ 'aria-label': 'listbox',
32
33
  'aria-labelledby': 'label',
33
34
  items: items
34
35
  };
35
36
  var defaultWithSectionsProps = {
36
37
  'data-testid': testId,
38
+ 'aria-label': 'listbox',
37
39
  'aria-labelledby': 'label',
38
40
  items: itemsWithSections
39
41
  };
@@ -63,7 +63,13 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
63
63
  isSelected: isSelected
64
64
  }),
65
65
  classNames = _useStatusClasses.classNames;
66
+ /* Related to UIP-4992
67
+ * Need to remove these properties to avoid errors in the console on the external app.
68
+ * By the way, these properties return "undefined", so it shouldn't create issues */
66
69
 
70
+
71
+ delete optionProps.onPressStart;
72
+ delete optionProps.onPressUp;
67
73
  return ___EmotionJSX(Box, _extends({
68
74
  as: "li",
69
75
  isRow: true,
@@ -20,8 +20,8 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
20
20
  export var icons = {
21
21
  "default": AlertCircleOutlineIcon,
22
22
  success: CheckCircleIcon,
23
- error: AlertCircleOutlineIcon,
24
- warning: AlertCircleIcon
23
+ error: AlertCircleIcon,
24
+ warning: AlertCircleOutlineIcon
25
25
  };
26
26
 
27
27
  var CloseButton = function CloseButton(_ref) {
@@ -311,7 +311,8 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
311
311
  hasAutoFocus: hasAutoFocus,
312
312
  hasVirtualFocus: true,
313
313
  hasNoEmptySelection: true,
314
- state: state
314
+ state: state,
315
+ "aria-label": "List of options"
315
316
  })), ___EmotionJSX(DismissButton, {
316
317
  onDismiss: close
317
318
  }));
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import Box from '../Box/Box';
3
+ /**
4
+ * Composed component that spreads children.
5
+ *
6
+ * This component is built to have the NavBarSection component passed into it.
7
+ *
8
+ * NavBarSection is an iterative component that
9
+ * will build an AccordionGridGroup using
10
+ * the array of objects that is passed into it.
11
+ *
12
+ */
13
+
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var NavBar = function NavBar(props) {
17
+ return ___EmotionJSX(Box, {
18
+ variant: "boxes.navBar",
19
+ role: "navigation",
20
+ as: "nav"
21
+ }, props.children);
22
+ };
23
+
24
+ export default NavBar;