@pingux/astro 2.7.1 → 2.8.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/Button/Button.js +2 -55
- package/lib/cjs/components/Button/Button.stories.js +12 -30
- package/lib/cjs/components/Button/buttonAttributes.js +109 -0
- package/lib/cjs/components/Calendar/Calendar.test.js +6 -6
- package/lib/cjs/components/Calendar/CalendarCell.js +6 -5
- package/lib/cjs/components/IconButton/IconButton.js +2 -38
- package/lib/cjs/components/IconButton/IconButton.stories.js +2 -34
- package/lib/cjs/components/IconButton/iconButtonAttributes.js +100 -0
- package/lib/cjs/components/ListItem/ListItem.js +1 -0
- package/lib/cjs/components/ListView/ListView.js +0 -9
- package/lib/cjs/components/ListView/ListView.stories.js +39 -104
- package/lib/cjs/components/ListViewItem/ListViewItem.js +14 -5
- package/lib/cjs/components/ListViewItem/ListViewItem.styles.js +6 -1
- package/lib/cjs/components/Menu/Menu.js +7 -60
- package/lib/cjs/components/Menu/Menu.stories.js +2 -56
- package/lib/cjs/components/Menu/menuAttributes.js +104 -0
- package/lib/cjs/components/SwitchField/SwitchField.js +12 -54
- package/lib/cjs/components/SwitchField/SwitchField.stories.js +2 -34
- package/lib/cjs/components/SwitchField/SwitchField.test.js +4 -5
- package/lib/cjs/components/SwitchField/switchFieldAttributes.js +191 -0
- package/lib/cjs/experimental/ListViewItem/ListViewItem.js +157 -0
- package/lib/cjs/experimental/ListViewItem/ListViewItem.stories.js +136 -0
- package/lib/cjs/experimental/ListViewItem/ListViewItem.test.js +77 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemEditButton.js +34 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemEditButton.stories.js +31 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemEditButton.test.js +25 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemMenu.js +37 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemMenu.stories.js +36 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemMenu.test.js +59 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemSwitchField.js +32 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemSwitchField.stories.js +41 -0
- package/lib/cjs/experimental/ListViewItem/controls/ListViewItemSwitchField.test.js +25 -0
- package/lib/cjs/experimental/ListViewItem/listViewItemAttributes.js +81 -0
- package/lib/cjs/experimental/SaveBar/SaveBar.js +85 -0
- package/lib/cjs/experimental/SaveBar/SaveBar.stories.js +101 -0
- package/lib/cjs/experimental/SaveBar/SaveBar.test.js +94 -0
- package/lib/cjs/experimental/SaveBar/index.js +14 -0
- package/lib/cjs/experimental/recipes/ListAndPanel.stories.js +359 -0
- package/lib/cjs/experimental/recipes/ScrollableListView.stories.js +104 -0
- package/lib/cjs/experimental/recipes/items.js +77 -0
- package/lib/cjs/index.js +64 -51
- package/lib/cjs/utils/docUtils/ariaAttributes.js +2 -1
- package/lib/cjs/utils/docUtils/docArgTypes.js +41 -0
- package/lib/cjs/utils/docUtils/hoverProps.js +7 -2
- package/lib/components/Button/Button.js +2 -55
- package/lib/components/Button/Button.stories.js +13 -31
- package/lib/components/Button/buttonAttributes.js +101 -0
- package/lib/components/Calendar/Calendar.test.js +6 -6
- package/lib/components/Calendar/CalendarCell.js +6 -5
- package/lib/components/IconButton/IconButton.js +2 -38
- package/lib/components/IconButton/IconButton.stories.js +2 -34
- package/lib/components/IconButton/iconButtonAttributes.js +91 -0
- package/lib/components/ListItem/ListItem.js +2 -1
- package/lib/components/ListView/ListView.js +0 -9
- package/lib/components/ListView/ListView.stories.js +40 -106
- package/lib/components/ListViewItem/ListViewItem.js +12 -4
- package/lib/components/ListViewItem/ListViewItem.styles.js +6 -1
- package/lib/components/Menu/Menu.js +7 -60
- package/lib/components/Menu/Menu.stories.js +2 -57
- package/lib/components/Menu/menuAttributes.js +95 -0
- package/lib/components/SwitchField/SwitchField.js +14 -55
- package/lib/components/SwitchField/SwitchField.stories.js +2 -34
- package/lib/components/SwitchField/SwitchField.test.js +4 -5
- package/lib/components/SwitchField/switchFieldAttributes.js +182 -0
- package/lib/experimental/ListViewItem/ListViewItem.js +144 -0
- package/lib/experimental/ListViewItem/ListViewItem.stories.js +122 -0
- package/lib/experimental/ListViewItem/ListViewItem.test.js +74 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemEditButton.js +25 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemEditButton.stories.js +21 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemEditButton.test.js +22 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemMenu.js +28 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemMenu.stories.js +26 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemMenu.test.js +56 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemSwitchField.js +23 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemSwitchField.stories.js +32 -0
- package/lib/experimental/ListViewItem/controls/ListViewItemSwitchField.test.js +22 -0
- package/lib/experimental/ListViewItem/listViewItemAttributes.js +72 -0
- package/lib/experimental/SaveBar/SaveBar.js +76 -0
- package/lib/experimental/SaveBar/SaveBar.stories.js +88 -0
- package/lib/experimental/SaveBar/SaveBar.test.js +91 -0
- package/lib/experimental/SaveBar/index.js +1 -0
- package/lib/experimental/recipes/ListAndPanel.stories.js +342 -0
- package/lib/experimental/recipes/ScrollableListView.stories.js +89 -0
- package/lib/experimental/recipes/items.js +68 -0
- package/lib/index.js +7 -3
- package/lib/utils/docUtils/ariaAttributes.js +1 -1
- package/lib/utils/docUtils/docArgTypes.js +29 -0
- package/lib/utils/docUtils/hoverProps.js +7 -2
- package/package.json +1 -1
- package/NOTICE.html +0 -12804
@@ -1,6 +1,17 @@
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
1
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
10
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
11
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
3
12
|
var _excluded = ["isConfigured"];
|
13
|
+
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; }
|
14
|
+
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) { _defineProperty(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; }
|
4
15
|
import React from 'react';
|
5
16
|
import AddCircleIcon from '@pingux/mdi-react/AddCircleIcon';
|
6
17
|
import CreateIcon from '@pingux/mdi-react/CreateIcon';
|
@@ -9,43 +20,14 @@ import { withDesign } from 'storybook-addon-designs';
|
|
9
20
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
10
21
|
import { Box, Button, Icon, SearchField, Text } from '../../index';
|
11
22
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.js';
|
12
|
-
import { buttonVariants } from '../../utils/devUtils/constants/variants';
|
13
23
|
import ButtonReadme from './Button.mdx';
|
14
|
-
|
15
|
-
// removing the iconButton variants from this story.
|
24
|
+
import { buttonArgTypes } from './buttonAttributes';
|
16
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
17
|
-
var variants = buttonVariants;
|
18
|
-
delete variants.ICON;
|
19
|
-
delete variants.ICON_BUTTON;
|
20
|
-
delete variants.INVERTED;
|
21
|
-
|
22
|
-
// add designer approved variants for devs to use here
|
23
|
-
var variantOptions = ['critical', 'default', 'inline', 'inlinePrimary', 'link', 'primary'];
|
24
26
|
export default {
|
25
27
|
title: 'Components/Button',
|
26
28
|
component: Button,
|
27
29
|
decorators: [withDesign],
|
28
|
-
argTypes: {
|
29
|
-
variant: {
|
30
|
-
control: {
|
31
|
-
type: 'select',
|
32
|
-
options: variantOptions
|
33
|
-
},
|
34
|
-
defaultValue: 'default'
|
35
|
-
},
|
36
|
-
children: {
|
37
|
-
description: 'Button text.',
|
38
|
-
defaultValue: 'Button Text',
|
39
|
-
table: {
|
40
|
-
type: {
|
41
|
-
summary: 'string'
|
42
|
-
}
|
43
|
-
},
|
44
|
-
control: {
|
45
|
-
type: 'text'
|
46
|
-
}
|
47
|
-
}
|
48
|
-
},
|
30
|
+
argTypes: _objectSpread({}, buttonArgTypes),
|
49
31
|
parameters: {
|
50
32
|
docs: {
|
51
33
|
source: {
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
|
+
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; }
|
11
|
+
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) { _defineProperty(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; }
|
12
|
+
import PropTypes from 'prop-types';
|
13
|
+
import { descriptions as ariaDescriptions } from '../../utils/docUtils/ariaAttributes';
|
14
|
+
import { booleanArg, funcArg } from '../../utils/docUtils/docArgTypes';
|
15
|
+
import { onHoverArgTypes } from '../../utils/docUtils/hoverProps';
|
16
|
+
|
17
|
+
// add designer approved variants for devs to use here
|
18
|
+
var variantOptions = ['critical', 'default', 'inline', 'inlinePrimary', 'link', 'primary'];
|
19
|
+
var descriptions = {
|
20
|
+
isDisabled: 'Whether the button is disabled.',
|
21
|
+
isLoading: 'Shows loader instead of children',
|
22
|
+
onHoverStart: 'Handler that is called when a hover interaction starts. (e: HoverEvent) => void',
|
23
|
+
onHoverEnd: 'Handler that is called when the hover state changes. (isHovering: boolean) => void',
|
24
|
+
onHoverChange: 'Handler that is called when the press is released over the target. (e: PressEvent) => void',
|
25
|
+
onPress: 'Handler that is called when the press is released over the target. (e: PressEvent) => void',
|
26
|
+
onPressChange: 'Handler that is called when the press state changes. (isPressed: boolean) => void',
|
27
|
+
onPressEnd: 'Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. (e: PressEvent) => void',
|
28
|
+
onPressStart: 'Handler that is called when a press interaction starts. (e: PressEvent) => void',
|
29
|
+
onPressUp: 'Handler that is called when a press is released over the target, regardless of whether it started on the target or not. (e: PressEvent) => void',
|
30
|
+
variant: 'The styling variation of the button.',
|
31
|
+
tabIndex: 'The focus variation of button',
|
32
|
+
children: 'Button text.'
|
33
|
+
};
|
34
|
+
export var buttonArgTypes = _objectSpread(_objectSpread({
|
35
|
+
variant: {
|
36
|
+
control: {
|
37
|
+
type: 'select',
|
38
|
+
options: variantOptions
|
39
|
+
},
|
40
|
+
defaultValue: 'default',
|
41
|
+
description: descriptions.variant
|
42
|
+
},
|
43
|
+
children: {
|
44
|
+
defaultValue: 'Button Text',
|
45
|
+
table: {
|
46
|
+
type: {
|
47
|
+
summary: 'string'
|
48
|
+
}
|
49
|
+
},
|
50
|
+
control: {
|
51
|
+
type: 'text'
|
52
|
+
},
|
53
|
+
description: descriptions.children
|
54
|
+
},
|
55
|
+
onPress: _objectSpread({
|
56
|
+
description: descriptions.onPress
|
57
|
+
}, funcArg),
|
58
|
+
onPressStart: _objectSpread({
|
59
|
+
description: descriptions.onPressStart
|
60
|
+
}, funcArg),
|
61
|
+
onPressEnd: _objectSpread({
|
62
|
+
description: descriptions.onPressEnd
|
63
|
+
}, funcArg),
|
64
|
+
onPressChange: _objectSpread({
|
65
|
+
description: descriptions.onPressChange
|
66
|
+
}, funcArg),
|
67
|
+
onPressUp: _objectSpread({
|
68
|
+
description: descriptions.onPressUp
|
69
|
+
}, funcArg)
|
70
|
+
}, onHoverArgTypes), {}, {
|
71
|
+
isLoading: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
72
|
+
description: descriptions.isLoading
|
73
|
+
}),
|
74
|
+
isDisabled: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
75
|
+
description: descriptions.isDisabled
|
76
|
+
}),
|
77
|
+
tabIndex: {
|
78
|
+
description: descriptions.tabIndex
|
79
|
+
},
|
80
|
+
'aria-label': {
|
81
|
+
control: {
|
82
|
+
type: 'text'
|
83
|
+
},
|
84
|
+
description: ariaDescriptions.ariaLabel
|
85
|
+
}
|
86
|
+
});
|
87
|
+
export var buttonPropTypes = {
|
88
|
+
'aria-label': PropTypes.string,
|
89
|
+
isDisabled: PropTypes.bool,
|
90
|
+
isLoading: PropTypes.bool,
|
91
|
+
onHoverStart: PropTypes.func,
|
92
|
+
onHoverEnd: PropTypes.func,
|
93
|
+
onHoverChange: PropTypes.func,
|
94
|
+
onPress: PropTypes.func,
|
95
|
+
onPressStart: PropTypes.func,
|
96
|
+
onPressEnd: PropTypes.func,
|
97
|
+
onPressChange: PropTypes.func,
|
98
|
+
onPressUp: PropTypes.func,
|
99
|
+
variant: PropTypes.string,
|
100
|
+
tabIndex: PropTypes.number
|
101
|
+
};
|
@@ -124,7 +124,7 @@ test('should be able to select dates', function () {
|
|
124
124
|
userEvent.click(dateButtons[4]);
|
125
125
|
expect(dateButtons[4]).toHaveClass('is-selected');
|
126
126
|
});
|
127
|
-
test('should be able to navigate
|
127
|
+
test('should be able to navigate to previous month dates without selection', function () {
|
128
128
|
var _context3;
|
129
129
|
getComponent({
|
130
130
|
defaultValue: '2022-08-10'
|
@@ -135,10 +135,10 @@ test('should be able to navigate and select shown previous month dates', functio
|
|
135
135
|
var previousDate = disabledGridCells[0];
|
136
136
|
expect(within(previousDate).getByText(31)).toHaveAttribute('aria-label', 'Sunday, July 31, 2022');
|
137
137
|
userEvent.click(previousDate);
|
138
|
-
var
|
139
|
-
expect(
|
138
|
+
var selectedMonth = screen.queryByRole('grid');
|
139
|
+
expect(selectedMonth).toHaveAttribute('aria-label', 'July 2022');
|
140
140
|
});
|
141
|
-
test('should be able to navigate
|
141
|
+
test('should be able to navigate to next month dates without selection', function () {
|
142
142
|
var _context4;
|
143
143
|
getComponent({
|
144
144
|
defaultValue: '2022-08-10'
|
@@ -149,8 +149,8 @@ test('should be able to navigate and select shown next month dates', function ()
|
|
149
149
|
var NextDate = disabledGridCells[34];
|
150
150
|
expect(within(NextDate).getByText(3)).toHaveAttribute('aria-label', 'Saturday, September 3, 2022');
|
151
151
|
userEvent.click(NextDate);
|
152
|
-
var
|
153
|
-
expect(
|
152
|
+
var selectedMonth = screen.queryByRole('grid');
|
153
|
+
expect(selectedMonth).toHaveAttribute('aria-label', 'September 2022');
|
154
154
|
});
|
155
155
|
test('allows users to open calendar item with enter / space key', function () {
|
156
156
|
getComponent({
|
@@ -37,8 +37,8 @@ var CalendarCell = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
37
|
formattedDate = _useCalendarCell.formattedDate,
|
38
38
|
isDisabled = _useCalendarCell.isDisabled;
|
39
39
|
var focusPreviousPage = state.focusPreviousPage,
|
40
|
-
|
41
|
-
|
40
|
+
focusNextPage = state.focusNextPage,
|
41
|
+
setFocused = state.setFocused;
|
42
42
|
|
43
43
|
/**
|
44
44
|
* Function handles the navigation and adds focus to previous or next month dates
|
@@ -48,13 +48,13 @@ var CalendarCell = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
48
48
|
var handleDisableClick = useCallback(function () {
|
49
49
|
var _cellRef$current, _cellRef$current2;
|
50
50
|
if ((_cellRef$current = cellRef.current) !== null && _cellRef$current !== void 0 && _cellRef$current.hidden && !state.isDisabled && formattedDate > 20) {
|
51
|
+
setFocused(undefined);
|
51
52
|
focusPreviousPage();
|
52
|
-
setValue(date);
|
53
53
|
} else if ((_cellRef$current2 = cellRef.current) !== null && _cellRef$current2 !== void 0 && _cellRef$current2.hidden && !state.isDisabled && formattedDate < 15) {
|
54
|
+
setFocused(undefined);
|
54
55
|
focusNextPage();
|
55
|
-
setValue(date);
|
56
56
|
}
|
57
|
-
}, [date, focusNextPage, focusPreviousPage, formattedDate,
|
57
|
+
}, [date, focusNextPage, focusPreviousPage, formattedDate, state, setFocused]);
|
58
58
|
var _useHover = useHover({}),
|
59
59
|
hoverProps = _useHover.hoverProps,
|
60
60
|
isHovered = _useHover.isHovered;
|
@@ -103,6 +103,7 @@ CalendarCell.propTypes = {
|
|
103
103
|
focusPreviousPage: PropTypes.func,
|
104
104
|
setValue: PropTypes.func,
|
105
105
|
focusNextPage: PropTypes.func,
|
106
|
+
setFocused: PropTypes.func,
|
106
107
|
setFocusedDate: PropTypes.func,
|
107
108
|
isDisabled: PropTypes.bool
|
108
109
|
}),
|
@@ -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';
|
19
18
|
import { IconButton as ThemeUIIconButton } from 'theme-ui';
|
20
19
|
import { BadgeContext } from '../../context/BadgeContext';
|
21
20
|
import { useAriaLabelWarning, useStatusClasses } from '../../hooks';
|
22
21
|
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,43 +81,7 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
81
81
|
}
|
82
82
|
return button;
|
83
83
|
});
|
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
|
-
};
|
84
|
+
IconButton.propTypes = iconButtonPropTypes;
|
121
85
|
IconButton.defaultProps = {
|
122
86
|
variant: 'base',
|
123
87
|
isDisabled: false
|
@@ -10,6 +10,7 @@ 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';
|
13
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
14
15
|
export default {
|
15
16
|
title: 'Components/IconButton',
|
@@ -25,40 +26,7 @@ export default {
|
|
25
26
|
}
|
26
27
|
}
|
27
28
|
},
|
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
|
-
}
|
29
|
+
argTypes: iconButtonArgTypes
|
62
30
|
};
|
63
31
|
export var Default = function Default(args) {
|
64
32
|
return ___EmotionJSX(IconButton, _extends({
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
6
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
|
+
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; }
|
11
|
+
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) { _defineProperty(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; }
|
12
|
+
import CreateIcon from '@pingux/mdi-react/CreateIcon';
|
13
|
+
import PropTypes from 'prop-types';
|
14
|
+
import { descriptions as ariaDescriptions } from '../../utils/docUtils/ariaAttributes';
|
15
|
+
import { booleanArg, funcArg } from '../../utils/docUtils/docArgTypes';
|
16
|
+
var descriptions = {
|
17
|
+
icon: 'The icon to render. List of icons at https://materialdesignicons.com/',
|
18
|
+
isDisabled: 'Whether the icon is disabled.',
|
19
|
+
onPress: 'Handler that is called when the press is released over the target. (e: PressEvent) => void',
|
20
|
+
onPressChange: 'Handler that is called when the press state changes. (isPressed: boolean) => void',
|
21
|
+
onPressEnd: 'Handler that is called when a press interaction ends, either over the target or when the pointer leaves the target. (e: PressEvent) => void',
|
22
|
+
onPressStart: 'Handler that is called when a press interaction starts. (e: PressEvent) => void',
|
23
|
+
onPressUp: 'Handler that is called when a press is released over the target, regardless of whether it started on the target or not. (e: PressEvent) => void',
|
24
|
+
title: 'Content will be displayed in a tooltip on hover or focus.',
|
25
|
+
variant: 'Styling to apply to the IconButton.'
|
26
|
+
};
|
27
|
+
export var iconButtonArgTypes = {
|
28
|
+
icon: {
|
29
|
+
control: {
|
30
|
+
type: 'none'
|
31
|
+
},
|
32
|
+
defaultValue: CreateIcon,
|
33
|
+
description: descriptions.icon
|
34
|
+
},
|
35
|
+
title: {
|
36
|
+
control: {
|
37
|
+
type: 'text'
|
38
|
+
},
|
39
|
+
description: descriptions.title
|
40
|
+
},
|
41
|
+
'aria-label': {
|
42
|
+
control: {
|
43
|
+
type: 'text'
|
44
|
+
},
|
45
|
+
description: ariaDescriptions.ariaLabel
|
46
|
+
},
|
47
|
+
isDisabled: _objectSpread({
|
48
|
+
description: descriptions.isDisabled
|
49
|
+
}, booleanArg),
|
50
|
+
variant: {
|
51
|
+
control: {
|
52
|
+
type: 'select',
|
53
|
+
options: ['base', 'inverted', 'invertedSquare', 'square']
|
54
|
+
},
|
55
|
+
defaultValue: 'base',
|
56
|
+
description: descriptions.variant
|
57
|
+
},
|
58
|
+
size: {
|
59
|
+
control: {
|
60
|
+
type: 'select',
|
61
|
+
options: ['xs', 'sm', 'md']
|
62
|
+
},
|
63
|
+
defaultValue: 'sm'
|
64
|
+
},
|
65
|
+
onPress: _objectSpread({
|
66
|
+
description: descriptions.onPress
|
67
|
+
}, funcArg),
|
68
|
+
onPressStart: _objectSpread({
|
69
|
+
description: descriptions.onPressStart
|
70
|
+
}, funcArg),
|
71
|
+
onPressEnd: _objectSpread({
|
72
|
+
description: descriptions.onPressEnd
|
73
|
+
}, funcArg),
|
74
|
+
onPressChange: _objectSpread({
|
75
|
+
description: descriptions.onPressChange
|
76
|
+
}, funcArg),
|
77
|
+
onPressUp: _objectSpread({
|
78
|
+
description: descriptions.onPressUp
|
79
|
+
}, funcArg)
|
80
|
+
};
|
81
|
+
export var iconButtonPropTypes = {
|
82
|
+
variant: PropTypes.string,
|
83
|
+
'aria-label': PropTypes.string,
|
84
|
+
title: PropTypes.string,
|
85
|
+
onPress: PropTypes.func,
|
86
|
+
onPressStart: PropTypes.func,
|
87
|
+
onPressEnd: PropTypes.func,
|
88
|
+
onPressChange: PropTypes.func,
|
89
|
+
onPressUp: PropTypes.func,
|
90
|
+
isDisabled: PropTypes.bool
|
91
|
+
};
|
@@ -15,7 +15,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
15
15
|
import React, { forwardRef } from 'react';
|
16
16
|
import { useHover } from '@react-aria/interactions';
|
17
17
|
import PropTypes from 'prop-types';
|
18
|
-
import { useStatusClasses } from '../../hooks';
|
18
|
+
import { useDeprecationWarning, useStatusClasses } from '../../hooks';
|
19
19
|
import { onHoverPropTypes } from '../../utils/docUtils/hoverProps';
|
20
20
|
import Box from '../Box/Box';
|
21
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -34,6 +34,7 @@ var ListItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
34
34
|
onHoverStart: onHoverStart
|
35
35
|
}),
|
36
36
|
hoverProps = _useHover.hoverProps;
|
37
|
+
useDeprecationWarning('The ListItem will be depreciated in the near future, please use ListViewItem');
|
37
38
|
var _useStatusClasses = useStatusClasses(className, {
|
38
39
|
isHovered: isHovered,
|
39
40
|
isSelected: isSelected
|
@@ -53,15 +53,6 @@ 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
|
-
|
65
56
|
var ListView = /*#__PURE__*/forwardRef(function (props, ref) {
|
66
57
|
var disabledKeys = props.disabledKeys,
|
67
58
|
_props$isHoverable = props.isHoverable,
|