@pingux/astro 1.23.0-alpha.2 → 1.23.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 +20 -0
- package/NOTICE.html +5016 -0
- package/lib/cjs/components/ArrayField/ArrayField.js +2 -2
- package/lib/cjs/components/ArrayField/ArrayField.test.js +4 -0
- package/lib/cjs/components/CollapsiblePanelItem/CollapsiblePanelItem.js +2 -1
- package/lib/cjs/components/ListView/ListView.js +6 -0
- package/lib/cjs/components/SwitchField/SwitchField.js +10 -2
- package/lib/cjs/recipes/CollapsiblePanel.stories.js +7 -1
- package/lib/cjs/styles/forms/switch.js +3 -3
- package/lib/components/ArrayField/ArrayField.js +2 -2
- package/lib/components/ArrayField/ArrayField.test.js +4 -0
- package/lib/components/CollapsiblePanelItem/CollapsiblePanelItem.js +2 -1
- package/lib/components/ListView/ListView.js +6 -0
- package/lib/components/SwitchField/SwitchField.js +9 -2
- package/lib/recipes/CollapsiblePanel.stories.js +8 -2
- package/lib/styles/forms/switch.js +3 -3
- package/package.json +1 -1
@@ -172,7 +172,7 @@ var ArrayField = function ArrayField(props) {
|
|
172
172
|
}
|
173
173
|
}, [isControlled]);
|
174
174
|
var onFieldAdd = (0, _react.useCallback)(function () {
|
175
|
-
if (
|
175
|
+
if (isControlled) {
|
176
176
|
return onAddRef.current();
|
177
177
|
}
|
178
178
|
|
@@ -181,7 +181,7 @@ var ArrayField = function ArrayField(props) {
|
|
181
181
|
|
182
182
|
return (0, _concat["default"])(_context = []).call(_context, oldValues, [createEmptyField()]);
|
183
183
|
});
|
184
|
-
}, [createEmptyField]);
|
184
|
+
}, [createEmptyField, isControlled]);
|
185
185
|
|
186
186
|
var _useLabel = (0, _label.useLabel)(_objectSpread({}, props)),
|
187
187
|
raLabelProps = _useLabel.labelProps;
|
@@ -79,7 +79,11 @@ test('adds one text field and new empty field is added', function () {
|
|
79
79
|
});
|
80
80
|
test('onAdd callback is fired when adding field', function () {
|
81
81
|
var onAdd = jest.fn();
|
82
|
+
var value = defaultData;
|
83
|
+
var defaultValue = null;
|
82
84
|
getComponent({
|
85
|
+
value: value,
|
86
|
+
defaultValue: defaultValue,
|
83
87
|
onAdd: onAdd,
|
84
88
|
renderField: renderField
|
85
89
|
});
|
@@ -105,6 +105,12 @@ function useListLayout(state) {
|
|
105
105
|
* ListViews are used to display a list of items. Users can select,
|
106
106
|
* view, or edit items in this list. This virtualized component supports
|
107
107
|
* asynchronous data in infinitely scrollable lists.
|
108
|
+
*
|
109
|
+
* NOTE: be careful with putting focusable elements inside ListView.
|
110
|
+
* It is using a grid (useList hook) with its own event listeners under the hood.
|
111
|
+
* [react-specttrum-github-issue](https://github.com/adobe/react-spectrum/issues/2801)
|
112
|
+
* If you decided to add a focusable element inside ListView,
|
113
|
+
* you should stop bubbling of a pointerDown event and put a focus on the element.
|
108
114
|
*/
|
109
115
|
|
110
116
|
|
@@ -48,6 +48,8 @@ var _toggle = require("@react-stately/toggle");
|
|
48
48
|
|
49
49
|
var _switch = require("@react-aria/switch");
|
50
50
|
|
51
|
+
var _interactions = require("@react-aria/interactions");
|
52
|
+
|
51
53
|
var _hooks = require("../../hooks");
|
52
54
|
|
53
55
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
@@ -113,6 +115,12 @@ var SwitchField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
113
115
|
var state = (0, _toggle.useToggleState)(_objectSpread({
|
114
116
|
defaultSelected: isDefaultSelected
|
115
117
|
}, props));
|
118
|
+
|
119
|
+
var _usePress = (0, _interactions.usePress)({
|
120
|
+
isDisabled: isDisabled
|
121
|
+
}),
|
122
|
+
containerPressProps = _usePress.pressProps;
|
123
|
+
|
116
124
|
var whitelistedProps = (0, _omit["default"])(props, (0, _keys["default"])(others));
|
117
125
|
|
118
126
|
var _useSwitch = (0, _switch.useSwitch)(_objectSpread({
|
@@ -124,9 +132,9 @@ var SwitchField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
124
132
|
isSelected: inputProps.checked
|
125
133
|
};
|
126
134
|
|
127
|
-
var _useField = (0, _hooks.useField)(_objectSpread(_objectSpread({
|
135
|
+
var _useField = (0, _hooks.useField)(_objectSpread(_objectSpread(_objectSpread({
|
128
136
|
statusClasses: statusClasses
|
129
|
-
}, props), {}, {
|
137
|
+
}, containerPressProps), props), {}, {
|
130
138
|
controlProps: _objectSpread(_objectSpread({}, controlProps), inputProps)
|
131
139
|
})),
|
132
140
|
fieldContainerProps = _useField.fieldContainerProps,
|
@@ -150,6 +150,8 @@ var Default = function Default() {
|
|
150
150
|
searchValue = _useState4[0],
|
151
151
|
setSearchValue = _useState4[1];
|
152
152
|
|
153
|
+
var checkBoxRef = (0, _react.useRef)(null);
|
154
|
+
|
153
155
|
var _useFilter = (0, _i18n.useFilter)({
|
154
156
|
sensitivity: 'base'
|
155
157
|
}),
|
@@ -325,7 +327,11 @@ var Default = function Default() {
|
|
325
327
|
},
|
326
328
|
isSelected: (0, _some["default"])(selectedItems).call(selectedItems, function (el) {
|
327
329
|
return el.key === item.key;
|
328
|
-
})
|
330
|
+
}),
|
331
|
+
ref: checkBoxRef,
|
332
|
+
onClick: function onClick() {
|
333
|
+
return checkBoxRef.current.focus();
|
334
|
+
}
|
329
335
|
}));
|
330
336
|
})), (0, _react2.jsx)(_.CollapsiblePanel, {
|
331
337
|
items: selectedItems,
|
@@ -54,11 +54,11 @@ var thumbContainer = {
|
|
54
54
|
border: '1px solid',
|
55
55
|
borderColor: 'neutral.80',
|
56
56
|
borderRadius: 9999,
|
57
|
-
'.is-selected &': {
|
57
|
+
'label.is-selected &': {
|
58
58
|
bg: 'active',
|
59
59
|
borderColor: 'active'
|
60
60
|
},
|
61
|
-
'.is-focused &, &:focus': _objectSpread({}, _buttons.defaultFocus)
|
61
|
+
'label.is-focused &, &:focus': _objectSpread({}, _buttons.defaultFocus)
|
62
62
|
};
|
63
63
|
exports.thumbContainer = thumbContainer;
|
64
64
|
var thumb = {
|
@@ -73,7 +73,7 @@ var thumb = {
|
|
73
73
|
transitionTimingFunction: 'ease-out',
|
74
74
|
transitionDuration: '0.1s',
|
75
75
|
transform: 'translateX(0)',
|
76
|
-
'.is-selected &': {
|
76
|
+
'label.is-selected &': {
|
77
77
|
transform: 'translateX(20px)',
|
78
78
|
borderColor: 'active'
|
79
79
|
}
|
@@ -118,7 +118,7 @@ var ArrayField = function ArrayField(props) {
|
|
118
118
|
}
|
119
119
|
}, [isControlled]);
|
120
120
|
var onFieldAdd = useCallback(function () {
|
121
|
-
if (
|
121
|
+
if (isControlled) {
|
122
122
|
return onAddRef.current();
|
123
123
|
}
|
124
124
|
|
@@ -127,7 +127,7 @@ var ArrayField = function ArrayField(props) {
|
|
127
127
|
|
128
128
|
return _concatInstanceProperty(_context = []).call(_context, oldValues, [createEmptyField()]);
|
129
129
|
});
|
130
|
-
}, [createEmptyField]);
|
130
|
+
}, [createEmptyField, isControlled]);
|
131
131
|
|
132
132
|
var _useLabel = useLabel(_objectSpread({}, props)),
|
133
133
|
raLabelProps = _useLabel.labelProps;
|
@@ -66,7 +66,11 @@ test('adds one text field and new empty field is added', function () {
|
|
66
66
|
});
|
67
67
|
test('onAdd callback is fired when adding field', function () {
|
68
68
|
var onAdd = jest.fn();
|
69
|
+
var value = defaultData;
|
70
|
+
var defaultValue = null;
|
69
71
|
getComponent({
|
72
|
+
value: value,
|
73
|
+
defaultValue: defaultValue,
|
70
74
|
onAdd: onAdd,
|
71
75
|
renderField: renderField
|
72
76
|
});
|
@@ -59,6 +59,12 @@ export function useListLayout(state) {
|
|
59
59
|
* ListViews are used to display a list of items. Users can select,
|
60
60
|
* view, or edit items in this list. This virtualized component supports
|
61
61
|
* asynchronous data in infinitely scrollable lists.
|
62
|
+
*
|
63
|
+
* NOTE: be careful with putting focusable elements inside ListView.
|
64
|
+
* It is using a grid (useList hook) with its own event listeners under the hood.
|
65
|
+
* [react-specttrum-github-issue](https://github.com/adobe/react-spectrum/issues/2801)
|
66
|
+
* If you decided to add a focusable element inside ListView,
|
67
|
+
* you should stop bubbling of a pointerDown event and put a focus on the element.
|
62
68
|
*/
|
63
69
|
|
64
70
|
var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -21,6 +21,7 @@ import PropTypes from 'prop-types';
|
|
21
21
|
import omit from 'lodash/omit';
|
22
22
|
import { useToggleState } from '@react-stately/toggle';
|
23
23
|
import { useSwitch } from '@react-aria/switch';
|
24
|
+
import { usePress } from '@react-aria/interactions';
|
24
25
|
import { useField, usePropWarning } from '../../hooks';
|
25
26
|
import statuses from '../../utils/devUtils/constants/statuses';
|
26
27
|
import Box from '../Box';
|
@@ -71,6 +72,12 @@ var SwitchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
71
72
|
var state = useToggleState(_objectSpread({
|
72
73
|
defaultSelected: isDefaultSelected
|
73
74
|
}, props));
|
75
|
+
|
76
|
+
var _usePress = usePress({
|
77
|
+
isDisabled: isDisabled
|
78
|
+
}),
|
79
|
+
containerPressProps = _usePress.pressProps;
|
80
|
+
|
74
81
|
var whitelistedProps = omit(props, _Object$keys(others));
|
75
82
|
|
76
83
|
var _useSwitch = useSwitch(_objectSpread({
|
@@ -82,9 +89,9 @@ var SwitchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
82
89
|
isSelected: inputProps.checked
|
83
90
|
};
|
84
91
|
|
85
|
-
var _useField = useField(_objectSpread(_objectSpread({
|
92
|
+
var _useField = useField(_objectSpread(_objectSpread(_objectSpread({
|
86
93
|
statusClasses: statusClasses
|
87
|
-
}, props), {}, {
|
94
|
+
}, containerPressProps), props), {}, {
|
88
95
|
controlProps: _objectSpread(_objectSpread({}, controlProps), inputProps)
|
89
96
|
})),
|
90
97
|
fieldContainerProps = _useField.fieldContainerProps,
|
@@ -16,7 +16,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
16
16
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
18
18
|
|
19
|
-
import React, { useMemo, useState } from 'react';
|
19
|
+
import React, { useMemo, useState, useRef } from 'react';
|
20
20
|
import { useFilter } from '@react-aria/i18n';
|
21
21
|
import AccountIcon from 'mdi-react/AccountIcon';
|
22
22
|
import AccountGroupIcon from 'mdi-react/AccountGroupIcon';
|
@@ -106,6 +106,8 @@ export var Default = function Default() {
|
|
106
106
|
searchValue = _useState4[0],
|
107
107
|
setSearchValue = _useState4[1];
|
108
108
|
|
109
|
+
var checkBoxRef = useRef(null);
|
110
|
+
|
109
111
|
var _useFilter = useFilter({
|
110
112
|
sensitivity: 'base'
|
111
113
|
}),
|
@@ -281,7 +283,11 @@ export var Default = function Default() {
|
|
281
283
|
},
|
282
284
|
isSelected: _someInstanceProperty(selectedItems).call(selectedItems, function (el) {
|
283
285
|
return el.key === item.key;
|
284
|
-
})
|
286
|
+
}),
|
287
|
+
ref: checkBoxRef,
|
288
|
+
onClick: function onClick() {
|
289
|
+
return checkBoxRef.current.focus();
|
290
|
+
}
|
285
291
|
}));
|
286
292
|
})), ___EmotionJSX(CollapsiblePanel, {
|
287
293
|
items: selectedItems,
|
@@ -33,11 +33,11 @@ export var thumbContainer = {
|
|
33
33
|
border: '1px solid',
|
34
34
|
borderColor: 'neutral.80',
|
35
35
|
borderRadius: 9999,
|
36
|
-
'.is-selected &': {
|
36
|
+
'label.is-selected &': {
|
37
37
|
bg: 'active',
|
38
38
|
borderColor: 'active'
|
39
39
|
},
|
40
|
-
'.is-focused &, &:focus': _objectSpread({}, defaultFocus)
|
40
|
+
'label.is-focused &, &:focus': _objectSpread({}, defaultFocus)
|
41
41
|
};
|
42
42
|
export var thumb = {
|
43
43
|
width: 20,
|
@@ -51,7 +51,7 @@ export var thumb = {
|
|
51
51
|
transitionTimingFunction: 'ease-out',
|
52
52
|
transitionDuration: '0.1s',
|
53
53
|
transform: 'translateX(0)',
|
54
|
-
'.is-selected &': {
|
54
|
+
'label.is-selected &': {
|
55
55
|
transform: 'translateX(20px)',
|
56
56
|
borderColor: 'active'
|
57
57
|
}
|