@pingux/astro 1.2.1 → 1.3.2-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 +38 -0
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.js +8 -2
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +5 -2
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemHeader.js +8 -3
- package/lib/cjs/components/ArrayField/ArrayField.js +213 -0
- package/lib/cjs/components/ArrayField/ArrayField.stories.js +223 -0
- package/lib/cjs/components/ArrayField/ArrayField.test.js +208 -0
- package/lib/cjs/components/ArrayField/ArrayFieldDeleteButton.js +61 -0
- package/lib/cjs/components/ArrayField/index.js +27 -0
- package/lib/cjs/components/CheckboxField/CheckboxField.js +4 -1
- package/lib/cjs/components/CodeView/CodeView.js +3 -3
- package/lib/cjs/components/Input/Input.js +3 -11
- package/lib/cjs/components/Input/Input.test.js +14 -2
- package/lib/cjs/components/ListView/ListView.stories.js +3 -0
- package/lib/cjs/components/Loader/Loader.stories.js +3 -3
- package/lib/cjs/components/Modal/Modal.js +3 -0
- package/lib/cjs/components/Modal/Modal.stories.js +11 -66
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +20 -10
- package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +74 -0
- package/lib/cjs/components/NavBar/NavBar.js +30 -4
- package/lib/cjs/components/NavBar/NavBar.stories.js +70 -463
- package/lib/cjs/components/NavBar/NavBar.test.js +51 -1
- package/lib/cjs/components/NavBarSection/NavBarItem.js +137 -0
- package/lib/cjs/components/NavBarSection/NavBarItemButton.js +96 -0
- package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +1 -1
- package/lib/cjs/components/NavBarSection/NavBarItemLink.js +98 -0
- package/lib/cjs/components/NavBarSection/NavBarSection.js +10 -8
- package/lib/cjs/components/NavBarSection/index.js +28 -1
- package/lib/cjs/components/NumberField/NumberField.js +30 -10
- package/lib/cjs/components/NumberField/NumberField.test.js +7 -0
- package/lib/cjs/components/PageHeader/PageHeader.js +3 -0
- package/lib/cjs/components/PageHeader/PageHeader.stories.js +6 -1
- package/lib/cjs/components/RadioGroupField/RadioGroupField.js +9 -5
- package/lib/cjs/components/SelectField/SelectField.stories.js +3 -55
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +8 -1
- package/lib/cjs/components/Tabs/Tabs.stories.js +1 -15
- package/lib/cjs/context/NavBarContext/index.js +20 -0
- package/lib/cjs/hooks/index.js +9 -0
- package/lib/cjs/hooks/useField/useField.js +2 -2
- package/lib/cjs/hooks/useNavBarPress/index.js +18 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +38 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.js +42 -0
- package/lib/cjs/index.js +80 -58
- package/lib/cjs/styles/forms/checkbox.js +0 -1
- package/lib/cjs/styles/forms/input.js +1 -1
- package/lib/cjs/styles/forms/label.js +3 -0
- package/lib/cjs/styles/forms/radio.js +1 -1
- package/lib/cjs/styles/forms/switch.js +3 -1
- package/lib/cjs/styles/variants/accordion.js +39 -7
- package/lib/cjs/styles/variants/boxes.js +5 -25
- package/lib/cjs/styles/variants/buttons.js +7 -1
- package/lib/cjs/styles/variants/codeView.js +91 -0
- package/lib/cjs/styles/variants/navBar.js +68 -0
- package/lib/cjs/styles/variants/separator.js +2 -1
- package/lib/cjs/styles/variants/text.js +3 -1
- package/lib/cjs/styles/variants/variants.js +3 -0
- package/lib/components/AccordionGridGroup/AccordionGridGroup.js +7 -2
- package/lib/components/AccordionGridItem/AccordionGridItemBody.js +4 -2
- package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +9 -4
- package/lib/components/ArrayField/ArrayField.js +179 -0
- package/lib/components/ArrayField/ArrayField.stories.js +196 -0
- package/lib/components/ArrayField/ArrayField.test.js +185 -0
- package/lib/components/ArrayField/ArrayFieldDeleteButton.js +43 -0
- package/lib/components/ArrayField/index.js +2 -0
- package/lib/components/CheckboxField/CheckboxField.js +4 -1
- package/lib/components/CodeView/CodeView.js +2 -2
- package/lib/components/Input/Input.js +2 -10
- package/lib/components/Input/Input.test.js +11 -2
- package/lib/components/ListView/ListView.stories.js +3 -0
- package/lib/components/Loader/Loader.stories.js +1 -1
- package/lib/components/Modal/Modal.js +4 -1
- package/lib/components/Modal/Modal.stories.js +10 -59
- package/lib/components/MultivaluesField/MultivaluesField.js +19 -9
- package/lib/components/MultivaluesField/MultivaluesField.test.js +52 -0
- package/lib/components/NavBar/NavBar.js +25 -4
- package/lib/components/NavBar/NavBar.stories.js +71 -462
- package/lib/components/NavBar/NavBar.test.js +39 -2
- package/lib/components/NavBarSection/NavBarItem.js +111 -0
- package/lib/components/NavBarSection/NavBarItemButton.js +69 -0
- package/lib/components/NavBarSection/NavBarItemHeader.js +1 -1
- package/lib/components/NavBarSection/NavBarItemLink.js +71 -0
- package/lib/components/NavBarSection/NavBarSection.js +9 -8
- package/lib/components/NavBarSection/index.js +4 -1
- package/lib/components/NumberField/NumberField.js +32 -12
- package/lib/components/NumberField/NumberField.test.js +5 -0
- package/lib/components/PageHeader/PageHeader.js +2 -0
- package/lib/components/PageHeader/PageHeader.stories.js +5 -1
- package/lib/components/RadioGroupField/RadioGroupField.js +9 -5
- package/lib/components/SelectField/SelectField.stories.js +2 -50
- package/lib/components/SelectFieldBase/SelectFieldBase.js +8 -1
- package/lib/components/Tabs/Tabs.stories.js +0 -11
- package/lib/context/NavBarContext/index.js +5 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useField/useField.js +2 -2
- package/lib/hooks/useNavBarPress/index.js +1 -0
- package/lib/hooks/useNavBarPress/useNavBarPress.js +27 -0
- package/lib/hooks/useNavBarPress/useNavBarPress.test.js +36 -0
- package/lib/index.js +2 -0
- package/lib/styles/forms/checkbox.js +0 -1
- package/lib/styles/forms/input.js +1 -1
- package/lib/styles/forms/label.js +3 -0
- package/lib/styles/forms/radio.js +1 -1
- package/lib/styles/forms/switch.js +3 -1
- package/lib/styles/variants/accordion.js +26 -5
- package/lib/styles/variants/boxes.js +5 -25
- package/lib/styles/variants/buttons.js +7 -1
- package/lib/styles/variants/codeView.js +91 -0
- package/lib/styles/variants/navBar.js +46 -0
- package/lib/styles/variants/separator.js +2 -1
- package/lib/styles/variants/text.js +3 -1
- package/lib/styles/variants/variants.js +2 -0
- package/package.json +3 -1
- package/lib/cjs/layouts/ListLayout.stories.js +0 -895
- package/lib/cjs/layouts/SchemaFormLayout.stories.js +0 -139
- package/lib/cjs/recipes/ArrayField.stories.js +0 -169
- package/lib/layouts/ListLayout.stories.js +0 -866
- package/lib/layouts/SchemaFormLayout.stories.js +0 -107
- package/lib/recipes/ArrayField.stories.js +0 -134
@@ -27,7 +27,6 @@ import { FocusScope } from '@react-aria/focus';
|
|
27
27
|
import { useListState } from '@react-stately/list';
|
28
28
|
import { DismissButton, useOverlayPosition } from '@react-aria/overlays';
|
29
29
|
import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
|
30
|
-
import { v4 as uuid } from 'uuid';
|
31
30
|
import { Chip, Icon, IconButton, PopoverContainer, ScrollBox, TextField } from '../..';
|
32
31
|
import ListBox from '../ListBox';
|
33
32
|
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
@@ -52,6 +51,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
52
51
|
disabledKeys = _props$disabledKeys === void 0 ? [] : _props$disabledKeys,
|
53
52
|
hasAutoFocus = props.hasAutoFocus,
|
54
53
|
hasNoStatusIndicator = props.hasNoStatusIndicator,
|
54
|
+
customInputProps = props.inputProps,
|
55
55
|
isDisabled = props.isDisabled,
|
56
56
|
isNotFlippable = props.isNotFlippable,
|
57
57
|
isReadOnly = props.isReadOnly,
|
@@ -219,13 +219,17 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
219
219
|
} else if (hasCustomValue) {
|
220
220
|
var _context3;
|
221
221
|
|
222
|
-
var
|
223
|
-
|
224
|
-
selectionManager.
|
222
|
+
var _key2 = e.target.value;
|
223
|
+
|
224
|
+
if (state.selectionManager.isSelected(_key2)) {
|
225
|
+
return;
|
226
|
+
}
|
227
|
+
|
228
|
+
selectionManager.toggleSelection(_key2);
|
225
229
|
setCustomItems(_concatInstanceProperty(_context3 = []).call(_context3, customItems, [{
|
226
|
-
id:
|
227
|
-
key:
|
228
|
-
name:
|
230
|
+
id: _key2,
|
231
|
+
key: _key2,
|
232
|
+
name: _key2
|
229
233
|
}]));
|
230
234
|
setFilterString('');
|
231
235
|
}
|
@@ -319,7 +323,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
319
323
|
onDismiss: close
|
320
324
|
}));
|
321
325
|
|
322
|
-
var inputProps = {
|
326
|
+
var inputProps = _objectSpread(_objectSpread({}, customInputProps), {}, {
|
323
327
|
controlProps: {
|
324
328
|
'aria-expanded': isOpen,
|
325
329
|
role: 'combobox'
|
@@ -335,7 +339,8 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
335
339
|
ref: inputRef,
|
336
340
|
variant: 'forms.input.multivaluesWrapper'
|
337
341
|
}
|
338
|
-
};
|
342
|
+
});
|
343
|
+
|
339
344
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(TextField, _extends({
|
340
345
|
onBlur: function onBlur(e) {
|
341
346
|
setIsOpen(false);
|
@@ -385,6 +390,11 @@ MultivaluesField.propTypes = {
|
|
385
390
|
/** Whether the field has a status indicator. */
|
386
391
|
hasNoStatusIndicator: PropTypes.bool,
|
387
392
|
|
393
|
+
/**
|
394
|
+
* Props that get passed as-is to the underlying TextField element
|
395
|
+
*/
|
396
|
+
inputProps: PropTypes.shape({}),
|
397
|
+
|
388
398
|
/** Whether the input is disabled. */
|
389
399
|
isDisabled: PropTypes.bool,
|
390
400
|
|
@@ -212,6 +212,58 @@ test('changing the input value and hitting enter creates new value in non-restri
|
|
212
212
|
var chipContainer = chip.parentElement;
|
213
213
|
expect(chipContainer).toHaveAttribute('role', 'presentation');
|
214
214
|
});
|
215
|
+
test('in non-restrictive mode "onSelectionChange" returns entered keys', function () {
|
216
|
+
var onSelectionChange = jest.fn();
|
217
|
+
getComponent({
|
218
|
+
mode: 'non-restrictive',
|
219
|
+
onSelectionChange: onSelectionChange
|
220
|
+
});
|
221
|
+
var input = screen.getByRole('combobox');
|
222
|
+
var value = 'custom';
|
223
|
+
userEvent.type(input, value);
|
224
|
+
userEvent.type(input, '{enter}');
|
225
|
+
var chip = screen.queryByText(value);
|
226
|
+
expect(chip).toBeInTheDocument();
|
227
|
+
expect(onSelectionChange).toBeCalledTimes(1);
|
228
|
+
expect(onSelectionChange.mock.calls[0][0].has(value)).toBeTruthy();
|
229
|
+
});
|
230
|
+
test('in non-restrictive mode the same value cannot be applied twice', function () {
|
231
|
+
var onSelectionChange = jest.fn();
|
232
|
+
getComponent({
|
233
|
+
mode: 'non-restrictive',
|
234
|
+
onSelectionChange: onSelectionChange
|
235
|
+
});
|
236
|
+
var input = screen.getByRole('combobox');
|
237
|
+
var value = 'custom';
|
238
|
+
userEvent.type(input, value);
|
239
|
+
userEvent.type(input, '{enter}');
|
240
|
+
var chip = screen.queryByText(value);
|
241
|
+
expect(chip).toBeInTheDocument();
|
242
|
+
expect(input).toHaveValue('');
|
243
|
+
userEvent.type(input, value);
|
244
|
+
userEvent.type(input, '{enter}');
|
245
|
+
expect(input).toHaveValue(value);
|
246
|
+
expect(onSelectionChange).toBeCalledTimes(1);
|
247
|
+
});
|
248
|
+
test('in non-restrictive mode the value that was already selected using the list cannot be applied', function () {
|
249
|
+
var onSelectionChange = jest.fn();
|
250
|
+
getComponent({
|
251
|
+
mode: 'non-restrictive',
|
252
|
+
onSelectionChange: onSelectionChange
|
253
|
+
});
|
254
|
+
var input = screen.getByRole('combobox');
|
255
|
+
input.focus();
|
256
|
+
var listbox = screen.getByRole('listbox');
|
257
|
+
var options = within(listbox).getAllByRole('option');
|
258
|
+
var firstOption = options[0];
|
259
|
+
firstOption.click();
|
260
|
+
expect(onSelectionChange.mock.calls[0][0].has(items[0].name)).toBeTruthy();
|
261
|
+
onSelectionChange.mockClear();
|
262
|
+
userEvent.type(input, items[0].name);
|
263
|
+
userEvent.type(input, '{enter}');
|
264
|
+
expect(input).toHaveValue(items[0].name);
|
265
|
+
expect(onSelectionChange).not.toBeCalled();
|
266
|
+
});
|
215
267
|
test('options can be focused via keyboard', function () {
|
216
268
|
getComponent();
|
217
269
|
var input = screen.getByRole('combobox');
|
@@ -1,4 +1,7 @@
|
|
1
|
-
import
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
|
+
import React, { useState } from 'react';
|
3
|
+
import { NavBarContext } from '../../context/NavBarContext';
|
4
|
+
import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
2
5
|
import Box from '../Box/Box';
|
3
6
|
/**
|
4
7
|
* Composed component that spreads children.
|
@@ -14,11 +17,29 @@ import Box from '../Box/Box';
|
|
14
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
18
|
|
16
19
|
var NavBar = function NavBar(props) {
|
17
|
-
|
18
|
-
|
20
|
+
var defaultSelectedKeys = props.defaultSelectedKeys;
|
21
|
+
|
22
|
+
var _useState = useState(defaultSelectedKeys),
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
24
|
+
selectedKeys = _useState2[0],
|
25
|
+
setSelectedKeys = _useState2[1];
|
26
|
+
|
27
|
+
return ___EmotionJSX(NavBarContext.Provider, {
|
28
|
+
value: {
|
29
|
+
selectedKeys: selectedKeys,
|
30
|
+
setSelectedKeys: setSelectedKeys
|
31
|
+
}
|
32
|
+
}, ___EmotionJSX(Box, {
|
33
|
+
variant: "navBar.container",
|
19
34
|
role: "navigation",
|
20
35
|
as: "nav"
|
21
|
-
}, props.children);
|
36
|
+
}, props.children));
|
22
37
|
};
|
23
38
|
|
39
|
+
NavBar.propTypes = {
|
40
|
+
defaultSelectedKeys: isIterableProp
|
41
|
+
};
|
42
|
+
NavBar.defaultProps = {
|
43
|
+
defaultSelectedKeys: []
|
44
|
+
};
|
24
45
|
export default NavBar;
|