@pingux/astro 2.7.0-alpha.2 → 2.7.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 +16 -0
- package/NOTICE.html +12804 -0
- package/lib/cjs/components/IconButton/IconButton.js +38 -2
- package/lib/cjs/components/IconButton/IconButton.stories.js +34 -2
- package/lib/cjs/components/ListView/ListView.js +9 -0
- package/lib/cjs/components/ListView/ListView.stories.js +80 -34
- package/lib/cjs/components/ListViewItem/ListViewItem.styles.js +1 -6
- package/lib/cjs/components/Menu/Menu.js +60 -7
- package/lib/cjs/components/Menu/Menu.stories.js +56 -2
- package/lib/cjs/components/SwitchField/SwitchField.js +54 -12
- package/lib/cjs/components/SwitchField/SwitchField.stories.js +34 -2
- package/lib/cjs/components/SwitchField/SwitchField.test.js +5 -4
- package/lib/cjs/index.js +1 -33
- package/lib/cjs/utils/docUtils/ariaAttributes.js +1 -2
- package/lib/cjs/utils/docUtils/hoverProps.js +2 -7
- package/lib/components/IconButton/IconButton.js +38 -2
- package/lib/components/IconButton/IconButton.stories.js +34 -2
- package/lib/components/ListView/ListView.js +9 -0
- package/lib/components/ListView/ListView.stories.js +82 -35
- package/lib/components/ListViewItem/ListViewItem.styles.js +1 -6
- package/lib/components/Menu/Menu.js +60 -7
- package/lib/components/Menu/Menu.stories.js +57 -2
- package/lib/components/SwitchField/SwitchField.js +55 -14
- package/lib/components/SwitchField/SwitchField.stories.js +34 -2
- package/lib/components/SwitchField/SwitchField.test.js +5 -4
- package/lib/index.js +1 -7
- package/lib/utils/docUtils/ariaAttributes.js +1 -1
- package/lib/utils/docUtils/hoverProps.js +2 -7
- package/package.json +1 -1
- package/lib/cjs/components/IconButton/iconButtonAttributes.js +0 -100
- package/lib/cjs/components/Menu/menuAttributes.js +0 -104
- package/lib/cjs/components/SwitchField/switchFieldAttributes.js +0 -191
- package/lib/cjs/experimental/StyledListItem/StyledListItem.js +0 -159
- package/lib/cjs/experimental/StyledListItem/StyledListItem.stories.js +0 -155
- package/lib/cjs/experimental/StyledListItem/StyledListItem.test.js +0 -83
- package/lib/cjs/experimental/StyledListItem/controls/ListItemEditButton.js +0 -34
- package/lib/cjs/experimental/StyledListItem/controls/ListItemEditButton.stories.js +0 -31
- package/lib/cjs/experimental/StyledListItem/controls/ListItemEditButton.test.js +0 -25
- package/lib/cjs/experimental/StyledListItem/controls/ListItemMenu.js +0 -37
- package/lib/cjs/experimental/StyledListItem/controls/ListItemMenu.stories.js +0 -36
- package/lib/cjs/experimental/StyledListItem/controls/ListItemMenu.test.js +0 -59
- package/lib/cjs/experimental/StyledListItem/controls/ListItemSwitchField.js +0 -32
- package/lib/cjs/experimental/StyledListItem/controls/ListItemSwitchField.stories.js +0 -41
- package/lib/cjs/experimental/StyledListItem/controls/ListItemSwitchField.test.js +0 -25
- package/lib/cjs/experimental/StyledListItem/styledListItemAttributes.js +0 -81
- package/lib/cjs/experimental/recipes/ListAndPanel.stories.js +0 -370
- package/lib/cjs/experimental/recipes/ScrollableListView.stories.js +0 -108
- package/lib/cjs/experimental/recipes/items.js +0 -126
- package/lib/cjs/utils/docUtils/docArgTypes.js +0 -41
- package/lib/components/IconButton/iconButtonAttributes.js +0 -91
- package/lib/components/Menu/menuAttributes.js +0 -95
- package/lib/components/SwitchField/switchFieldAttributes.js +0 -182
- package/lib/experimental/StyledListItem/StyledListItem.js +0 -146
- package/lib/experimental/StyledListItem/StyledListItem.stories.js +0 -140
- package/lib/experimental/StyledListItem/StyledListItem.test.js +0 -74
- package/lib/experimental/StyledListItem/controls/ListItemEditButton.js +0 -25
- package/lib/experimental/StyledListItem/controls/ListItemEditButton.stories.js +0 -21
- package/lib/experimental/StyledListItem/controls/ListItemEditButton.test.js +0 -22
- package/lib/experimental/StyledListItem/controls/ListItemMenu.js +0 -28
- package/lib/experimental/StyledListItem/controls/ListItemMenu.stories.js +0 -26
- package/lib/experimental/StyledListItem/controls/ListItemMenu.test.js +0 -56
- package/lib/experimental/StyledListItem/controls/ListItemSwitchField.js +0 -23
- package/lib/experimental/StyledListItem/controls/ListItemSwitchField.stories.js +0 -32
- package/lib/experimental/StyledListItem/controls/ListItemSwitchField.test.js +0 -22
- package/lib/experimental/StyledListItem/styledListItemAttributes.js +0 -72
- package/lib/experimental/recipes/ListAndPanel.stories.js +0 -353
- package/lib/experimental/recipes/ScrollableListView.stories.js +0 -93
- package/lib/experimental/recipes/items.js +0 -117
- package/lib/utils/docUtils/docArgTypes.js +0 -29
@@ -25,7 +25,6 @@ var _ariaAttributes = require("../../utils/docUtils/ariaAttributes");
|
|
25
25
|
var _fieldAttributes = require("../../utils/docUtils/fieldAttributes");
|
26
26
|
var _statusProp = require("../../utils/docUtils/statusProp");
|
27
27
|
var _SwitchField = _interopRequireDefault(require("./SwitchField.mdx"));
|
28
|
-
var _switchFieldAttributes = require("./switchFieldAttributes");
|
29
28
|
var _react2 = require("@emotion/react");
|
30
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
31
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -44,7 +43,40 @@ var _default = {
|
|
44
43
|
}
|
45
44
|
}
|
46
45
|
},
|
47
|
-
argTypes: _objectSpread(_objectSpread(_objectSpread(
|
46
|
+
argTypes: _objectSpread(_objectSpread(_objectSpread({
|
47
|
+
label: {
|
48
|
+
control: {
|
49
|
+
type: 'text'
|
50
|
+
},
|
51
|
+
defaultValue: 'Example Label'
|
52
|
+
},
|
53
|
+
helperText: {
|
54
|
+
control: {
|
55
|
+
type: 'text'
|
56
|
+
}
|
57
|
+
},
|
58
|
+
hintText: {
|
59
|
+
control: {
|
60
|
+
type: 'text'
|
61
|
+
}
|
62
|
+
},
|
63
|
+
value: {
|
64
|
+
defaultValue: 'my-switch'
|
65
|
+
},
|
66
|
+
name: {},
|
67
|
+
className: {},
|
68
|
+
isDisabled: {},
|
69
|
+
isRequired: {},
|
70
|
+
isReadOnly: {},
|
71
|
+
isDefaultSelected: {},
|
72
|
+
hasAutoFocus: {},
|
73
|
+
id: {},
|
74
|
+
isSelected: {
|
75
|
+
control: {
|
76
|
+
type: 'none'
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}, _statusProp.statusArgTypes), _ariaAttributes.ariaAttributeBaseArgTypes), _fieldAttributes.inputFieldAttributeBaseArgTypes)
|
48
80
|
};
|
49
81
|
exports["default"] = _default;
|
50
82
|
var Default = function Default(args) {
|
@@ -8,9 +8,10 @@ var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
|
8
8
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
9
9
|
var _SwitchField = _interopRequireDefault(require("./SwitchField"));
|
10
10
|
var _react2 = require("@emotion/react");
|
11
|
-
var
|
11
|
+
var testId = 'test-switch';
|
12
12
|
var defaultProps = {
|
13
|
-
label:
|
13
|
+
label: 'Example label',
|
14
|
+
'data-testid': testId
|
14
15
|
};
|
15
16
|
var getComponent = function getComponent() {
|
16
17
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -23,9 +24,9 @@ test('renders Switch component', function () {
|
|
23
24
|
getComponent({
|
24
25
|
'aria-label': 'test'
|
25
26
|
});
|
26
|
-
var switchComponent = _testWrapper.screen.
|
27
|
+
var switchComponent = _testWrapper.screen.getByTestId(testId);
|
27
28
|
_testWrapper.screen.getByRole('switch');
|
28
|
-
expect(switchComponent).toBeInstanceOf(
|
29
|
+
expect(switchComponent).toBeInstanceOf(HTMLDivElement);
|
29
30
|
expect(switchComponent).toBeInTheDocument();
|
30
31
|
});
|
31
32
|
test('renders label', function () {
|
package/lib/cjs/index.js
CHANGED
@@ -109,11 +109,7 @@ var _exportNames = {
|
|
109
109
|
DataTableCell: true,
|
110
110
|
DataTableColumn: true,
|
111
111
|
DataTableHeader: true,
|
112
|
-
DataTableRow: true
|
113
|
-
ListItemEditButton: true,
|
114
|
-
ListItemMenu: true,
|
115
|
-
ListItemSwitchField: true,
|
116
|
-
StyledListItem: true
|
112
|
+
DataTableRow: true
|
117
113
|
};
|
118
114
|
_Object$defineProperty(exports, "AccordionGridGroup", {
|
119
115
|
enumerable: true,
|
@@ -421,24 +417,6 @@ _Object$defineProperty(exports, "ListItem", {
|
|
421
417
|
return _ListItem["default"];
|
422
418
|
}
|
423
419
|
});
|
424
|
-
_Object$defineProperty(exports, "ListItemEditButton", {
|
425
|
-
enumerable: true,
|
426
|
-
get: function get() {
|
427
|
-
return _ListItemEditButton["default"];
|
428
|
-
}
|
429
|
-
});
|
430
|
-
_Object$defineProperty(exports, "ListItemMenu", {
|
431
|
-
enumerable: true,
|
432
|
-
get: function get() {
|
433
|
-
return _ListItemMenu["default"];
|
434
|
-
}
|
435
|
-
});
|
436
|
-
_Object$defineProperty(exports, "ListItemSwitchField", {
|
437
|
-
enumerable: true,
|
438
|
-
get: function get() {
|
439
|
-
return _ListItemSwitchField["default"];
|
440
|
-
}
|
441
|
-
});
|
442
420
|
_Object$defineProperty(exports, "ListView", {
|
443
421
|
enumerable: true,
|
444
422
|
get: function get() {
|
@@ -607,12 +585,6 @@ _Object$defineProperty(exports, "Stepper", {
|
|
607
585
|
return _Stepper["default"];
|
608
586
|
}
|
609
587
|
});
|
610
|
-
_Object$defineProperty(exports, "StyledListItem", {
|
611
|
-
enumerable: true,
|
612
|
-
get: function get() {
|
613
|
-
return _StyledListItem["default"];
|
614
|
-
}
|
615
|
-
});
|
616
588
|
_Object$defineProperty(exports, "Switch", {
|
617
589
|
enumerable: true,
|
618
590
|
get: function get() {
|
@@ -1617,9 +1589,5 @@ _forEachInstanceProperty(_context73 = _Object$keys(_DataTable)).call(_context73,
|
|
1617
1589
|
});
|
1618
1590
|
var _reactAria = require("react-aria");
|
1619
1591
|
var _reactStately = require("react-stately");
|
1620
|
-
var _ListItemEditButton = _interopRequireDefault(require("./experimental/StyledListItem/controls/ListItemEditButton"));
|
1621
|
-
var _ListItemMenu = _interopRequireDefault(require("./experimental/StyledListItem/controls/ListItemMenu"));
|
1622
|
-
var _ListItemSwitchField = _interopRequireDefault(require("./experimental/StyledListItem/controls/ListItemSwitchField"));
|
1623
|
-
var _StyledListItem = _interopRequireDefault(require("./experimental/StyledListItem/StyledListItem"));
|
1624
1592
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
1625
1593
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
@@ -12,7 +12,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
12
12
|
_Object$defineProperty(exports, "__esModule", {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
exports.getAriaAttributeProps = exports.
|
15
|
+
exports.getAriaAttributeProps = exports.ariaAttributesBasePropTypes = exports.ariaAttributeBaseDocSettings = exports.ariaAttributeBaseArgTypes = void 0;
|
16
16
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
17
17
|
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
18
18
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
@@ -30,7 +30,6 @@ var descriptions = {
|
|
30
30
|
ariaLabel: 'Defines a string value that labels the current element.',
|
31
31
|
ariaLabelledby: 'Identifies the element (or elements) that labels the current element.'
|
32
32
|
};
|
33
|
-
exports.descriptions = descriptions;
|
34
33
|
var ariaAttributeBaseDocSettings = {
|
35
34
|
type: {
|
36
35
|
summary: 'string'
|
@@ -18,7 +18,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
18
18
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
19
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
20
20
|
var descriptions = {
|
21
|
-
isHovered: 'If the item is hovered',
|
22
21
|
onHoverStart: 'Handler that is called when a hover interaction starts.',
|
23
22
|
onHoverEnd: 'Handler that is called when a hover interaction ends.',
|
24
23
|
onHoverChange: 'Handler that is called when the hover state changes.'
|
@@ -36,9 +35,6 @@ var baseDocSettings = {
|
|
36
35
|
};
|
37
36
|
exports.baseDocSettings = baseDocSettings;
|
38
37
|
var onHoverArgTypes = {
|
39
|
-
isHovered: _objectSpread({
|
40
|
-
description: descriptions.isHovered
|
41
|
-
}, baseDocSettings),
|
42
38
|
'onHoverStart': _objectSpread({
|
43
39
|
description: descriptions.onHoverStart
|
44
40
|
}, baseDocSettings),
|
@@ -51,9 +47,8 @@ var onHoverArgTypes = {
|
|
51
47
|
};
|
52
48
|
exports.onHoverArgTypes = onHoverArgTypes;
|
53
49
|
var onHoverPropTypes = {
|
54
|
-
|
55
|
-
onHoverChange: _propTypes["default"].func,
|
50
|
+
onHoverStart: _propTypes["default"].func,
|
56
51
|
onHoverEnd: _propTypes["default"].func,
|
57
|
-
|
52
|
+
onHoverChange: _propTypes["default"].func
|
58
53
|
};
|
59
54
|
exports.onHoverPropTypes = onHoverPropTypes;
|
@@ -15,11 +15,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
15
15
|
import React, { forwardRef, useContext, useImperativeHandle, useRef } from 'react';
|
16
16
|
import { mergeProps, useButton, useFocusRing } from 'react-aria';
|
17
17
|
import { Pressable, useHover, usePress } from '@react-aria/interactions';
|
18
|
+
import PropTypes from 'prop-types';
|
18
19
|
import { IconButton as ThemeUIIconButton } from 'theme-ui';
|
19
20
|
import { BadgeContext } from '../../context/BadgeContext';
|
20
21
|
import { useAriaLabelWarning, useStatusClasses } from '../../hooks';
|
21
22
|
import TooltipTrigger, { Tooltip } from '../TooltipTrigger';
|
22
|
-
import { iconButtonPropTypes } from './iconButtonAttributes';
|
23
23
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
24
24
|
var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
25
25
|
var children = props.children,
|
@@ -81,7 +81,43 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
81
81
|
}
|
82
82
|
return button;
|
83
83
|
});
|
84
|
-
IconButton.propTypes =
|
84
|
+
IconButton.propTypes = {
|
85
|
+
/** Styling to apply to the IconButton. */
|
86
|
+
variant: PropTypes.string,
|
87
|
+
/** Defines a string value that labels the current element. */
|
88
|
+
'aria-label': PropTypes.string,
|
89
|
+
/** Content will be displayed in a tooltip on hover or focus. */
|
90
|
+
title: PropTypes.string,
|
91
|
+
/**
|
92
|
+
* Handler that is called when the press is released over the target.
|
93
|
+
* (e: PressEvent) => void
|
94
|
+
*/
|
95
|
+
onPress: PropTypes.func,
|
96
|
+
/**
|
97
|
+
* Handler that is called when a press interaction starts.
|
98
|
+
* (e: PressEvent) => void
|
99
|
+
*/
|
100
|
+
onPressStart: PropTypes.func,
|
101
|
+
/**
|
102
|
+
* Handler that is called when a press interaction ends, either over the target or when the
|
103
|
+
* pointer leaves the target.
|
104
|
+
* (e: PressEvent) => void
|
105
|
+
*/
|
106
|
+
onPressEnd: PropTypes.func,
|
107
|
+
/**
|
108
|
+
* Handler that is called when the press state changes.
|
109
|
+
* (isPressed: boolean) => void
|
110
|
+
*/
|
111
|
+
onPressChange: PropTypes.func,
|
112
|
+
/**
|
113
|
+
* Handler that is called when a press is released over the target, regardless of whether it
|
114
|
+
* started on the target or not.
|
115
|
+
* (e: PressEvent) => void
|
116
|
+
*/
|
117
|
+
onPressUp: PropTypes.func,
|
118
|
+
/** Whether the icon is disabled. */
|
119
|
+
isDisabled: PropTypes.bool
|
120
|
+
};
|
85
121
|
IconButton.defaultProps = {
|
86
122
|
variant: 'base',
|
87
123
|
isDisabled: false
|
@@ -10,7 +10,6 @@ import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
|
10
10
|
import { Box, Icon, IconButton, Table, TableBody, TableCell, TableHead, TableRow, Text } from '../../index';
|
11
11
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.js';
|
12
12
|
import IconButtonReadme from './IconButton.mdx';
|
13
|
-
import { iconButtonArgTypes } from './iconButtonAttributes';
|
14
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
14
|
export default {
|
16
15
|
title: 'Components/IconButton',
|
@@ -26,7 +25,40 @@ export default {
|
|
26
25
|
}
|
27
26
|
}
|
28
27
|
},
|
29
|
-
argTypes:
|
28
|
+
argTypes: {
|
29
|
+
icon: {
|
30
|
+
control: {
|
31
|
+
type: 'none'
|
32
|
+
},
|
33
|
+
defaultValue: CreateIcon,
|
34
|
+
description: 'The icon to render. List of icons at https://materialdesignicons.com/'
|
35
|
+
},
|
36
|
+
title: {
|
37
|
+
control: {
|
38
|
+
type: 'text'
|
39
|
+
}
|
40
|
+
},
|
41
|
+
'aria-label': {
|
42
|
+
control: {
|
43
|
+
type: 'text'
|
44
|
+
}
|
45
|
+
},
|
46
|
+
isDisabled: {},
|
47
|
+
variant: {
|
48
|
+
control: {
|
49
|
+
type: 'select',
|
50
|
+
options: ['base', 'inverted', 'invertedSquare', 'square']
|
51
|
+
},
|
52
|
+
defaultValue: 'base'
|
53
|
+
},
|
54
|
+
size: {
|
55
|
+
control: {
|
56
|
+
type: 'select',
|
57
|
+
options: ['xs', 'sm', 'md']
|
58
|
+
},
|
59
|
+
defaultValue: 'sm'
|
60
|
+
}
|
61
|
+
}
|
30
62
|
};
|
31
63
|
export var Default = function Default(args) {
|
32
64
|
return ___EmotionJSX(IconButton, _extends({
|
@@ -53,6 +53,15 @@ export function useListLayout(state) {
|
|
53
53
|
layout.disabledKeys = state.disabledKeys;
|
54
54
|
return layout;
|
55
55
|
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* NOTE: be careful with putting focusable elements inside ListView.
|
59
|
+
* It is using a grid (useList hook) with its own event listeners under the hood.
|
60
|
+
* [react-specttrum-github-issue](https://github.com/adobe/react-spectrum/issues/2801)
|
61
|
+
* If you decided to add a focusable element inside ListView,
|
62
|
+
* you should stop bubbling of a pointerDown event and put a focus on the element.
|
63
|
+
*/
|
64
|
+
|
56
65
|
var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
|
57
66
|
var disabledKeys = props.disabledKeys,
|
58
67
|
_props$isHoverable = props.isHoverable,
|
@@ -15,18 +15,21 @@ import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
15
15
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
16
16
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
17
17
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
18
|
+
/* eslint-disable react/prop-types */
|
18
19
|
import React from 'react';
|
19
20
|
import { Item, useAsyncList } from 'react-stately';
|
21
|
+
import CreateIcon from '@pingux/mdi-react/CreateIcon';
|
20
22
|
import FormSelectIcon from '@pingux/mdi-react/FormSelectIcon';
|
23
|
+
import MoreVertIcon from '@pingux/mdi-react/MoreVertIcon';
|
21
24
|
import { action } from '@storybook/addon-actions';
|
22
25
|
import isChromatic from 'chromatic/isChromatic';
|
23
26
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
24
|
-
import { Box,
|
27
|
+
import { Box, Icon, IconButton, ListView, Text } from '../../index';
|
25
28
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
26
29
|
import ListViewReadme from './ListView.mdx';
|
27
30
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
28
31
|
export default {
|
29
|
-
title: '
|
32
|
+
title: 'Components/ListView',
|
30
33
|
component: ListView,
|
31
34
|
parameters: {
|
32
35
|
docs: {
|
@@ -533,18 +536,44 @@ var actions = {
|
|
533
536
|
};
|
534
537
|
var ListElement = function ListElement(_ref) {
|
535
538
|
var item = _ref.item;
|
536
|
-
return ___EmotionJSX(
|
537
|
-
|
538
|
-
|
539
|
-
|
539
|
+
return ___EmotionJSX(Box, {
|
540
|
+
isRow: true
|
541
|
+
}, ___EmotionJSX(Box, {
|
542
|
+
isRow: true,
|
543
|
+
mr: "auto",
|
544
|
+
alignSelf: "center"
|
545
|
+
}, ___EmotionJSX(Icon, {
|
546
|
+
icon: FormSelectIcon,
|
547
|
+
mr: "sm",
|
548
|
+
color: "accent.40",
|
549
|
+
size: "md",
|
550
|
+
title: {
|
551
|
+
name: 'Form Select Icon'
|
552
|
+
}
|
553
|
+
}), ___EmotionJSX(Text, {
|
554
|
+
variant: "itemTitle",
|
555
|
+
alignSelf: "center"
|
556
|
+
}, item.name)), ___EmotionJSX(Box, {
|
557
|
+
isRow: true,
|
558
|
+
alignSelf: "center",
|
559
|
+
gap: "sm"
|
560
|
+
}, ___EmotionJSX(IconButton, {
|
561
|
+
"aria-label": "create-icon"
|
562
|
+
}, ___EmotionJSX(Icon, {
|
563
|
+
icon: CreateIcon,
|
564
|
+
size: "sm",
|
565
|
+
title: {
|
566
|
+
name: 'Create Icon'
|
567
|
+
}
|
568
|
+
})), ___EmotionJSX(IconButton, {
|
569
|
+
"aria-label": "actions-icon"
|
570
|
+
}, ___EmotionJSX(Icon, {
|
571
|
+
icon: MoreVertIcon,
|
572
|
+
size: "sm",
|
573
|
+
title: {
|
574
|
+
name: 'More Vertical Icon'
|
540
575
|
}
|
541
|
-
}
|
542
|
-
key: "enable"
|
543
|
-
}, "Enable user"), ___EmotionJSX(Item, {
|
544
|
-
key: "disable"
|
545
|
-
}, "Disable user"), ___EmotionJSX(Item, {
|
546
|
-
key: "delete"
|
547
|
-
}, "Delete user")));
|
576
|
+
}))));
|
548
577
|
};
|
549
578
|
export var Default = function Default(_ref2) {
|
550
579
|
var args = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
@@ -552,24 +581,48 @@ export var Default = function Default(_ref2) {
|
|
552
581
|
items: items
|
553
582
|
}), function (item) {
|
554
583
|
return ___EmotionJSX(Item, {
|
555
|
-
"data-id": item.key,
|
556
584
|
key: item.name,
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
}, ___EmotionJSX(
|
562
|
-
|
563
|
-
|
564
|
-
|
585
|
+
textValue: item.name,
|
586
|
+
"data-id": item.key
|
587
|
+
}, ___EmotionJSX(Box, {
|
588
|
+
isRow: true
|
589
|
+
}, ___EmotionJSX(Box, {
|
590
|
+
isRow: true,
|
591
|
+
mr: "auto",
|
592
|
+
alignSelf: "center"
|
593
|
+
}, ___EmotionJSX(Icon, {
|
594
|
+
icon: FormSelectIcon,
|
595
|
+
mr: "sm",
|
596
|
+
color: "accent.40",
|
597
|
+
size: "md",
|
598
|
+
title: {
|
599
|
+
name: 'Form Select Icon'
|
565
600
|
}
|
566
|
-
}
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
601
|
+
}), ___EmotionJSX(Text, {
|
602
|
+
variant: "itemTitle",
|
603
|
+
alignSelf: "center"
|
604
|
+
}, item.name)), ___EmotionJSX(Box, {
|
605
|
+
isRow: true,
|
606
|
+
alignSelf: "center",
|
607
|
+
gap: "sm"
|
608
|
+
}, ___EmotionJSX(IconButton, {
|
609
|
+
"aria-label": "create-icon"
|
610
|
+
}, ___EmotionJSX(Icon, {
|
611
|
+
icon: CreateIcon,
|
612
|
+
size: "sm",
|
613
|
+
title: {
|
614
|
+
name: 'Create Icon'
|
615
|
+
}
|
616
|
+
})), ___EmotionJSX(IconButton, {
|
617
|
+
"aria-label": "actions-icon",
|
618
|
+
size: "sm"
|
619
|
+
}, ___EmotionJSX(Icon, {
|
620
|
+
icon: MoreVertIcon,
|
621
|
+
size: "sm",
|
622
|
+
title: {
|
623
|
+
name: 'More Vertical Icon'
|
624
|
+
}
|
625
|
+
})))));
|
573
626
|
});
|
574
627
|
};
|
575
628
|
export var InfiniteLoadingList = function InfiniteLoadingList(args) {
|
@@ -709,9 +762,6 @@ export var InfiniteLoadingList = function InfiniteLoadingList(args) {
|
|
709
762
|
}), function (item) {
|
710
763
|
return ___EmotionJSX(Item, {
|
711
764
|
key: item.name,
|
712
|
-
listItemProps: {
|
713
|
-
variant: 'listViewItem.styledListItem'
|
714
|
-
},
|
715
765
|
textValue: item.name
|
716
766
|
}, ___EmotionJSX(ListElement, {
|
717
767
|
item: item
|
@@ -736,9 +786,6 @@ export var MultipleSelection = function MultipleSelection(_ref6) {
|
|
736
786
|
}), function (item) {
|
737
787
|
return ___EmotionJSX(Item, {
|
738
788
|
key: item.name,
|
739
|
-
listItemProps: {
|
740
|
-
variant: 'listViewItem.styledListItem'
|
741
|
-
},
|
742
789
|
textValue: item.name
|
743
790
|
}, ___EmotionJSX(ListElement, {
|
744
791
|
item: item
|
@@ -35,10 +35,6 @@ var container = {
|
|
35
35
|
borderBottomColor: 'line.light'
|
36
36
|
}
|
37
37
|
};
|
38
|
-
var styledListItem = _objectSpread(_objectSpread({}, container), {}, {
|
39
|
-
padding: 0,
|
40
|
-
minHeight: 0
|
41
|
-
});
|
42
38
|
var linkedViewContainer = _objectSpread(_objectSpread({}, container), {}, {
|
43
39
|
minHeight: '75px',
|
44
40
|
height: '76px',
|
@@ -70,6 +66,5 @@ var linkedViewContainer = _objectSpread(_objectSpread({}, container), {}, {
|
|
70
66
|
});
|
71
67
|
export default {
|
72
68
|
container: container,
|
73
|
-
linkedViewContainer: linkedViewContainer
|
74
|
-
styledListItem: styledListItem
|
69
|
+
linkedViewContainer: linkedViewContainer
|
75
70
|
};
|
@@ -9,7 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
9
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["isDisabled", "isNotFocusedOnHover", "onAction", "onHoverChange", "onHoverEnd", "onHoverStart", "onSelectionChange"
|
12
|
+
var _excluded = ["isDisabled", "isNotFocusedOnHover", "onAction", "onHoverChange", "onHoverEnd", "onHoverStart", "onSelectionChange"];
|
13
13
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
14
14
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
15
15
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -19,25 +19,23 @@ import { mergeProps, useFocusRing, useMenu } from 'react-aria';
|
|
19
19
|
import { useTreeState } from 'react-stately';
|
20
20
|
import { useHover } from '@react-aria/interactions';
|
21
21
|
import { useSyncRef } from '@react-aria/utils';
|
22
|
+
import PropTypes from 'prop-types';
|
22
23
|
import { MenuContext } from '../../context/MenuContext';
|
23
24
|
import { usePropWarning } from '../../hooks';
|
24
25
|
import ORIENTATION from '../../utils/devUtils/constants/orientation';
|
26
|
+
import { onHoverPropTypes } from '../../utils/docUtils/hoverProps';
|
25
27
|
import Box from '../Box';
|
26
28
|
import MenuItem from '../MenuItem';
|
27
|
-
import { menuPropTypes } from './menuAttributes';
|
28
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
29
30
|
var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
30
31
|
var _context;
|
31
|
-
var
|
32
|
-
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
32
|
+
var isDisabled = props.isDisabled,
|
33
33
|
isNotFocusedOnHover = props.isNotFocusedOnHover,
|
34
34
|
onAction = props.onAction,
|
35
35
|
onHoverChange = props.onHoverChange,
|
36
36
|
onHoverEnd = props.onHoverEnd,
|
37
37
|
onHoverStart = props.onHoverStart,
|
38
38
|
onSelectionChange = props.onSelectionChange,
|
39
|
-
_props$selectionMode = props.selectionMode,
|
40
|
-
selectionMode = _props$selectionMode === void 0 ? 'none' : _props$selectionMode,
|
41
39
|
others = _objectWithoutProperties(props, _excluded);
|
42
40
|
var contextProps = useContext(MenuContext);
|
43
41
|
var completeProps = _objectSpread({}, mergeProps(contextProps, props));
|
@@ -81,6 +79,61 @@ var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
81
79
|
});
|
82
80
|
}));
|
83
81
|
});
|
84
|
-
Menu.propTypes =
|
82
|
+
Menu.propTypes = _objectSpread({
|
83
|
+
/** The type of selection that is allowed. */
|
84
|
+
selectionMode: PropTypes.oneOf(['none', 'single', 'multiple']),
|
85
|
+
/**
|
86
|
+
* The item keys that are disabled. These items cannot be selected, focused, or otherwise
|
87
|
+
* interacted with.
|
88
|
+
*/
|
89
|
+
disabledKeys: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),
|
90
|
+
/**
|
91
|
+
* The initial selected keys in the collection (uncontrolled).
|
92
|
+
*
|
93
|
+
* `defaultSelectedKeys="all"` can be used to select every key.
|
94
|
+
*/
|
95
|
+
defaultSelectedKeys: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
96
|
+
/**
|
97
|
+
* The currently selected keys in the collection (controlled).
|
98
|
+
*
|
99
|
+
* `selectedKeys="all"` can be used to select every key.
|
100
|
+
*/
|
101
|
+
selectedKeys: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
102
|
+
/** Whether the item is disabled. */
|
103
|
+
isDisabled: PropTypes.bool,
|
104
|
+
/** Whether the menu item is selected. */
|
105
|
+
isSelected: PropTypes.bool,
|
106
|
+
/**
|
107
|
+
* Whether menu item should receive focus state on hover.
|
108
|
+
*/
|
109
|
+
isNotFocusedOnHover: PropTypes.bool,
|
110
|
+
/**
|
111
|
+
* Handler that is called when an item is selected.
|
112
|
+
*
|
113
|
+
* `(key: Key) => void`
|
114
|
+
*/
|
115
|
+
onAction: PropTypes.func,
|
116
|
+
/**
|
117
|
+
* Handler that is called when the selection changes. Does not fire when `selectionMode="none"`.
|
118
|
+
*
|
119
|
+
* `(keys: Selection) => any`
|
120
|
+
*/
|
121
|
+
onSelectionChange: PropTypes.func,
|
122
|
+
/** A screen reader only label for the menu item. */
|
123
|
+
'aria-label': PropTypes.string,
|
124
|
+
/** Identifies the element (or elements) that labels the current element. */
|
125
|
+
'aria-labelledby': PropTypes.string,
|
126
|
+
/** Identifies the element (or elements) that describes the object. */
|
127
|
+
'aria-describedby': PropTypes.string,
|
128
|
+
/**
|
129
|
+
* Identifies the element (or elements) that provide a detailed,
|
130
|
+
* extended description for the object.
|
131
|
+
*/
|
132
|
+
'aria-details': PropTypes.string
|
133
|
+
}, onHoverPropTypes);
|
134
|
+
Menu.defaultProps = {
|
135
|
+
selectionMode: 'none',
|
136
|
+
isDisabled: false
|
137
|
+
};
|
85
138
|
Menu.displayName = 'Menu';
|
86
139
|
export default Menu;
|