@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
@@ -12,17 +12,16 @@ var _excluded = ["label", "helperText", "isDefaultSelected", "isSelected", "onCh
|
|
12
12
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
13
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
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; }
|
15
|
+
/* eslint-disable no-unused-vars */
|
15
16
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
16
17
|
import { useSwitch } from 'react-aria';
|
17
18
|
import { useToggleState } from 'react-stately';
|
18
19
|
import { usePress } from '@react-aria/interactions';
|
19
20
|
import omit from 'lodash/omit';
|
20
|
-
import PropTypes from 'prop-types';
|
21
21
|
import { Box, FieldHelperText, Label, Switch } from '../..';
|
22
22
|
import { useField, usePropWarning } from '../../hooks';
|
23
|
-
import {
|
24
|
-
import {
|
25
|
-
import { statusDefaultProp, statusPropTypes } from '../../utils/docUtils/statusProp';
|
23
|
+
import { statusDefaultProp } from '../../utils/docUtils/statusProp';
|
24
|
+
import { switchFieldPropTypes } from './switchFieldAttributes';
|
26
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
26
|
var SwitchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
28
27
|
var label = props.label,
|
@@ -33,10 +32,14 @@ var SwitchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
32
|
value = props.value,
|
34
33
|
name = props.name,
|
35
34
|
id = props.id,
|
36
|
-
isDisabled = props.isDisabled,
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
_props$isDisabled = props.isDisabled,
|
36
|
+
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
37
|
+
_props$isReadOnly = props.isReadOnly,
|
38
|
+
isReadOnly = _props$isReadOnly === void 0 ? false : _props$isReadOnly,
|
39
|
+
_props$isRequired = props.isRequired,
|
40
|
+
isRequired = _props$isRequired === void 0 ? false : _props$isRequired,
|
41
|
+
_props$hasAutoFocus = props.hasAutoFocus,
|
42
|
+
hasAutoFocus = _props$hasAutoFocus === void 0 ? false : _props$hasAutoFocus,
|
40
43
|
onFocus = props.onFocus,
|
41
44
|
onBlur = props.onBlur,
|
42
45
|
onFocusChange = props.onFocusChange,
|
@@ -86,55 +89,11 @@ var SwitchField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
86
89
|
}, fieldLabelProps), ___EmotionJSX(Box, fieldControlWrapperProps, ___EmotionJSX(Switch, _extends({
|
87
90
|
ref: switchRef,
|
88
91
|
inputProps: fieldControlInputProps
|
89
|
-
}, unhandledAriaProps))), label), helperText && ___EmotionJSX(FieldHelperText, {
|
92
|
+
}, unhandledAriaProps, others))), label), helperText && ___EmotionJSX(FieldHelperText, {
|
90
93
|
status: status
|
91
94
|
}, helperText));
|
92
95
|
});
|
93
|
-
SwitchField.propTypes =
|
94
|
-
|
95
|
-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
96
|
-
/** Whether the element should receive focus on render. */
|
97
|
-
hasAutoFocus: PropTypes.bool,
|
98
|
-
/** Text rendered below the input. */
|
99
|
-
helperText: PropTypes.node,
|
100
|
-
/** If present this prop will cause a help hint to render in the label of the field. */
|
101
|
-
hintText: PropTypes.string,
|
102
|
-
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
103
|
-
id: PropTypes.string,
|
104
|
-
/** Whether the element should be selected (uncontrolled). */
|
105
|
-
isDefaultSelected: PropTypes.bool,
|
106
|
-
/** Whether the field is disabled. */
|
107
|
-
isDisabled: PropTypes.bool,
|
108
|
-
/** Whether the input can be selected, but not changed by the user. */
|
109
|
-
isReadOnly: PropTypes.bool,
|
110
|
-
/** Whether user input is required on the input before form submission. */
|
111
|
-
isRequired: PropTypes.bool,
|
112
|
-
/** Whether the element should be selected (controlled). */
|
113
|
-
isSelected: PropTypes.bool,
|
114
|
-
/** The rendered label for the field. */
|
115
|
-
label: PropTypes.node,
|
116
|
-
/** The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). */
|
117
|
-
name: PropTypes.string,
|
118
|
-
/** Handler that is called when the element loses focus. */
|
119
|
-
onBlur: PropTypes.func,
|
120
|
-
/** Handler that is called when the element's selection state changes. */
|
121
|
-
onChange: PropTypes.func,
|
122
|
-
/** Handler that is called when the element receives focus. */
|
123
|
-
onFocus: PropTypes.func,
|
124
|
-
/** Handler that is called when the element's focus status changes. */
|
125
|
-
onFocusChange: PropTypes.func,
|
126
|
-
/** Handler that is called when a key is pressed. */
|
127
|
-
onKeyDown: PropTypes.func,
|
128
|
-
/** Handler that is called when a key is released. */
|
129
|
-
onKeyUp: PropTypes.func,
|
130
|
-
/** The value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue). */
|
131
|
-
value: PropTypes.string
|
132
|
-
}, statusPropTypes), ariaAttributesBasePropTypes), inputFieldAttributesBasePropTypes);
|
133
|
-
SwitchField.defaultProps = _objectSpread({
|
134
|
-
isDisabled: false,
|
135
|
-
isReadOnly: false,
|
136
|
-
isRequired: false,
|
137
|
-
hasAutoFocus: false
|
138
|
-
}, statusDefaultProp);
|
96
|
+
SwitchField.propTypes = switchFieldPropTypes;
|
97
|
+
SwitchField.defaultProps = _objectSpread({}, statusDefaultProp);
|
139
98
|
SwitchField.displayName = 'SwitchField';
|
140
99
|
export default SwitchField;
|
@@ -18,6 +18,7 @@ import { ariaAttributeBaseArgTypes } from '../../utils/docUtils/ariaAttributes';
|
|
18
18
|
import { inputFieldAttributeBaseArgTypes } from '../../utils/docUtils/fieldAttributes';
|
19
19
|
import { statusArgTypes } from '../../utils/docUtils/statusProp';
|
20
20
|
import SwitchFieldReadme from './SwitchField.mdx';
|
21
|
+
import { switchFieldArgTypes } from './switchFieldAttributes';
|
21
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
22
23
|
export default {
|
23
24
|
title: 'Form/SwitchField',
|
@@ -32,40 +33,7 @@ export default {
|
|
32
33
|
}
|
33
34
|
}
|
34
35
|
},
|
35
|
-
argTypes: _objectSpread(_objectSpread(_objectSpread({
|
36
|
-
label: {
|
37
|
-
control: {
|
38
|
-
type: 'text'
|
39
|
-
},
|
40
|
-
defaultValue: 'Example Label'
|
41
|
-
},
|
42
|
-
helperText: {
|
43
|
-
control: {
|
44
|
-
type: 'text'
|
45
|
-
}
|
46
|
-
},
|
47
|
-
hintText: {
|
48
|
-
control: {
|
49
|
-
type: 'text'
|
50
|
-
}
|
51
|
-
},
|
52
|
-
value: {
|
53
|
-
defaultValue: 'my-switch'
|
54
|
-
},
|
55
|
-
name: {},
|
56
|
-
className: {},
|
57
|
-
isDisabled: {},
|
58
|
-
isRequired: {},
|
59
|
-
isReadOnly: {},
|
60
|
-
isDefaultSelected: {},
|
61
|
-
hasAutoFocus: {},
|
62
|
-
id: {},
|
63
|
-
isSelected: {
|
64
|
-
control: {
|
65
|
-
type: 'none'
|
66
|
-
}
|
67
|
-
}
|
68
|
-
}, statusArgTypes), ariaAttributeBaseArgTypes), inputFieldAttributeBaseArgTypes)
|
36
|
+
argTypes: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, switchFieldArgTypes), statusArgTypes), ariaAttributeBaseArgTypes), inputFieldAttributeBaseArgTypes)
|
69
37
|
};
|
70
38
|
export var Default = function Default(args) {
|
71
39
|
return ___EmotionJSX(SwitchField, args);
|
@@ -5,10 +5,9 @@ import axeTest from '../../utils/testUtils/testAxe';
|
|
5
5
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
6
6
|
import SwitchField from './SwitchField';
|
7
7
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
|
-
var
|
8
|
+
var TEST_LABEL = 'test label';
|
9
9
|
var defaultProps = {
|
10
|
-
label:
|
11
|
-
'data-testid': testId
|
10
|
+
label: TEST_LABEL
|
12
11
|
};
|
13
12
|
var getComponent = function getComponent() {
|
14
13
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -21,9 +20,9 @@ test('renders Switch component', function () {
|
|
21
20
|
getComponent({
|
22
21
|
'aria-label': 'test'
|
23
22
|
});
|
24
|
-
var switchComponent = screen.
|
23
|
+
var switchComponent = screen.getByText(TEST_LABEL);
|
25
24
|
screen.getByRole('switch');
|
26
|
-
expect(switchComponent).toBeInstanceOf(
|
25
|
+
expect(switchComponent).toBeInstanceOf(HTMLLabelElement);
|
27
26
|
expect(switchComponent).toBeInTheDocument();
|
28
27
|
});
|
29
28
|
test('renders label', function () {
|
@@ -0,0 +1,182 @@
|
|
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
|
+
var _context;
|
11
|
+
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; }
|
12
|
+
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; }
|
13
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
14
|
+
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
15
|
+
import PropTypes from 'prop-types';
|
16
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
17
|
+
import { ariaAttributesBasePropTypes } from '../../utils/docUtils/ariaAttributes';
|
18
|
+
import { booleanArg, docArgTypes, funcArg } from '../../utils/docUtils/docArgTypes';
|
19
|
+
import { inputFieldAttributesBasePropTypes } from '../../utils/docUtils/fieldAttributes';
|
20
|
+
import { statusPropTypes } from '../../utils/docUtils/statusProp';
|
21
|
+
var descriptions = {
|
22
|
+
className: 'A list of class names to apply to the input element.',
|
23
|
+
hasAutoFocus: 'Whether the element should receive focus on render.',
|
24
|
+
helperText: 'Text rendered below the input.',
|
25
|
+
hintText: 'If present this prop will cause a help hint to render in the label of the field.',
|
26
|
+
id: "The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).",
|
27
|
+
isDefaultSelected: 'Whether the element should be selected (uncontrolled).',
|
28
|
+
isDisabled: 'Whether the field is disabled.',
|
29
|
+
isReadOnly: 'Whether the input can be selected, but not changed by the user.',
|
30
|
+
isRequired: 'Whether user input is required on the input before form submission.',
|
31
|
+
isSelected: 'Whether the element should be selected (controlled).',
|
32
|
+
label: 'The rendered label for the field.',
|
33
|
+
name: 'The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).',
|
34
|
+
onBlur: 'Handler that is called when the element loses focus.',
|
35
|
+
onChange: "Handler that is called when the element's selection state changes.",
|
36
|
+
onFocus: 'Handler that is called when the element receives focus.',
|
37
|
+
onFocusChange: "Handler that is called when the element's focus status changes.",
|
38
|
+
onKeyDown: 'Handler that is called when a key is pressed.',
|
39
|
+
onKeyUp: 'Handler that is called when a key is released.',
|
40
|
+
status: 'Determines the textarea status indicator and helper text styling.',
|
41
|
+
value: 'The value of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefvalue).'
|
42
|
+
};
|
43
|
+
var string = docArgTypes.string,
|
44
|
+
stringArray = docArgTypes.stringArray,
|
45
|
+
text = docArgTypes.text,
|
46
|
+
node = docArgTypes.node;
|
47
|
+
export var switchFieldArgTypes = {
|
48
|
+
className: {
|
49
|
+
type: {
|
50
|
+
summary: _concatInstanceProperty(_context = "".concat(string, " | ")).call(_context, stringArray)
|
51
|
+
},
|
52
|
+
description: descriptions.className
|
53
|
+
},
|
54
|
+
hasAutoFocus: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
55
|
+
description: descriptions.hasAutoFocus
|
56
|
+
}),
|
57
|
+
helperText: {
|
58
|
+
control: {
|
59
|
+
type: text
|
60
|
+
},
|
61
|
+
type: {
|
62
|
+
summary: node
|
63
|
+
},
|
64
|
+
description: descriptions.helperText
|
65
|
+
},
|
66
|
+
hintText: {
|
67
|
+
control: {
|
68
|
+
type: text
|
69
|
+
},
|
70
|
+
type: {
|
71
|
+
summary: string
|
72
|
+
},
|
73
|
+
description: descriptions.hintText
|
74
|
+
},
|
75
|
+
id: {
|
76
|
+
control: {
|
77
|
+
type: text
|
78
|
+
},
|
79
|
+
type: {
|
80
|
+
summary: string
|
81
|
+
},
|
82
|
+
description: descriptions.id
|
83
|
+
},
|
84
|
+
isDefaultSelected: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
85
|
+
description: descriptions.isDefaultSelected
|
86
|
+
}),
|
87
|
+
isDisabled: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
88
|
+
description: descriptions.isDisabled
|
89
|
+
}),
|
90
|
+
isReadOnly: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
91
|
+
description: descriptions.isReadOnly
|
92
|
+
}),
|
93
|
+
isRequired: _objectSpread(_objectSpread({}, booleanArg), {}, {
|
94
|
+
description: descriptions.isRequired
|
95
|
+
}),
|
96
|
+
isSelected: {
|
97
|
+
control: {
|
98
|
+
type: 'none'
|
99
|
+
},
|
100
|
+
type: {
|
101
|
+
summary: string
|
102
|
+
},
|
103
|
+
description: descriptions.isSelected
|
104
|
+
},
|
105
|
+
label: {
|
106
|
+
control: {
|
107
|
+
type: text
|
108
|
+
},
|
109
|
+
type: {
|
110
|
+
summary: string
|
111
|
+
},
|
112
|
+
defaultValue: 'Example Label',
|
113
|
+
description: descriptions.label
|
114
|
+
},
|
115
|
+
name: {
|
116
|
+
control: {
|
117
|
+
type: text
|
118
|
+
},
|
119
|
+
type: {
|
120
|
+
summary: string
|
121
|
+
},
|
122
|
+
description: descriptions.name
|
123
|
+
},
|
124
|
+
onBlur: _objectSpread(_objectSpread({}, funcArg), {}, {
|
125
|
+
description: descriptions.onBlur
|
126
|
+
}),
|
127
|
+
onChange: _objectSpread(_objectSpread({}, funcArg), {}, {
|
128
|
+
description: descriptions.onChange
|
129
|
+
}),
|
130
|
+
onFocus: _objectSpread(_objectSpread({}, funcArg), {}, {
|
131
|
+
description: descriptions.onFocus
|
132
|
+
}),
|
133
|
+
onFocusChange: _objectSpread(_objectSpread({}, funcArg), {}, {
|
134
|
+
description: descriptions.onFocusChange
|
135
|
+
}),
|
136
|
+
onKeyDown: _objectSpread(_objectSpread({}, funcArg), {}, {
|
137
|
+
description: descriptions.onKeyDown
|
138
|
+
}),
|
139
|
+
onKeyUp: _objectSpread(_objectSpread({}, funcArg), {}, {
|
140
|
+
description: descriptions.onKeyUp
|
141
|
+
}),
|
142
|
+
value: {
|
143
|
+
defaultValue: 'my-switch',
|
144
|
+
control: {
|
145
|
+
type: text
|
146
|
+
},
|
147
|
+
type: {
|
148
|
+
summary: string
|
149
|
+
},
|
150
|
+
description: descriptions.value
|
151
|
+
},
|
152
|
+
status: {
|
153
|
+
control: {
|
154
|
+
type: 'select',
|
155
|
+
options: statuses
|
156
|
+
},
|
157
|
+
defaultValue: statuses.DEFAULT,
|
158
|
+
description: descriptions.status
|
159
|
+
}
|
160
|
+
};
|
161
|
+
export var switchFieldPropTypes = _objectSpread(_objectSpread(_objectSpread({
|
162
|
+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
163
|
+
hasAutoFocus: PropTypes.bool,
|
164
|
+
helperText: PropTypes.node,
|
165
|
+
hintText: PropTypes.string,
|
166
|
+
id: PropTypes.string,
|
167
|
+
isDefaultSelected: PropTypes.bool,
|
168
|
+
isDisabled: PropTypes.bool,
|
169
|
+
isReadOnly: PropTypes.bool,
|
170
|
+
isRequired: PropTypes.bool,
|
171
|
+
isSelected: PropTypes.bool,
|
172
|
+
label: PropTypes.node,
|
173
|
+
name: PropTypes.string,
|
174
|
+
onBlur: PropTypes.func,
|
175
|
+
onChange: PropTypes.func,
|
176
|
+
onFocus: PropTypes.func,
|
177
|
+
onFocusChange: PropTypes.func,
|
178
|
+
onKeyDown: PropTypes.func,
|
179
|
+
onKeyUp: PropTypes.func,
|
180
|
+
status: PropTypes.oneOf(_Object$values(statuses)),
|
181
|
+
value: PropTypes.string
|
182
|
+
}, ariaAttributesBasePropTypes), inputFieldAttributesBasePropTypes), statusPropTypes);
|
@@ -0,0 +1,144 @@
|
|
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 _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
+
var _excluded = ["children", "className", "data", "isHovered", "isSelected", "linkProps", "onHoverChange", "onHoverEnd", "onHoverStart", "slots"];
|
13
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
14
|
+
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; }
|
15
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context3 = ownKeys(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
16
|
+
import React, { forwardRef } from 'react';
|
17
|
+
import { useHover } from '@react-aria/interactions';
|
18
|
+
import { useStatusClasses } from '../../hooks';
|
19
|
+
import { Box, Icon, Text } from '../../index';
|
20
|
+
import { listViewItemPropTypes } from './listViewItemAttributes';
|
21
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
22
|
+
var sx = {
|
23
|
+
container: {
|
24
|
+
m: 1,
|
25
|
+
minHeight: 72,
|
26
|
+
'&.is-hovered': {
|
27
|
+
bg: 'white',
|
28
|
+
cursor: 'pointer'
|
29
|
+
}
|
30
|
+
},
|
31
|
+
controls: {
|
32
|
+
alignSelf: 'center',
|
33
|
+
ml: 'auto',
|
34
|
+
pr: 'sm'
|
35
|
+
},
|
36
|
+
data: {
|
37
|
+
alignItems: 'center'
|
38
|
+
},
|
39
|
+
icon: {
|
40
|
+
width: 25,
|
41
|
+
color: 'accent.40'
|
42
|
+
},
|
43
|
+
rightOfData: {
|
44
|
+
alignSelf: 'center',
|
45
|
+
ml: 'sm'
|
46
|
+
},
|
47
|
+
subtitle: {
|
48
|
+
alignSelf: 'start',
|
49
|
+
fontSize: 'sm',
|
50
|
+
lineHeight: '16px',
|
51
|
+
my: '1px'
|
52
|
+
},
|
53
|
+
text: {
|
54
|
+
ml: 'md'
|
55
|
+
},
|
56
|
+
title: {
|
57
|
+
alignSelf: 'start',
|
58
|
+
fontSize: 'md'
|
59
|
+
},
|
60
|
+
wrapper: {
|
61
|
+
cursor: 'pointer',
|
62
|
+
display: 'flex',
|
63
|
+
flex: '1 1 0px',
|
64
|
+
ml: 'md'
|
65
|
+
}
|
66
|
+
};
|
67
|
+
export var LIST_ITEM_ICON = '-list-item-icon';
|
68
|
+
var ListViewItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
69
|
+
var _context, _context2;
|
70
|
+
var children = _ref.children,
|
71
|
+
className = _ref.className,
|
72
|
+
data = _ref.data,
|
73
|
+
isHovered = _ref.isHovered,
|
74
|
+
isSelected = _ref.isSelected,
|
75
|
+
linkProps = _ref.linkProps,
|
76
|
+
onHoverChange = _ref.onHoverChange,
|
77
|
+
onHoverEnd = _ref.onHoverEnd,
|
78
|
+
onHoverStart = _ref.onHoverStart,
|
79
|
+
slots = _ref.slots,
|
80
|
+
others = _objectWithoutProperties(_ref, _excluded);
|
81
|
+
var icon = data.icon,
|
82
|
+
subtext = data.subtext,
|
83
|
+
text = data.text;
|
84
|
+
var shouldUseDefaultHover = isHovered === undefined;
|
85
|
+
var _useHover = useHover({
|
86
|
+
onHoverChange: onHoverChange,
|
87
|
+
onHoverEnd: onHoverEnd,
|
88
|
+
onHoverStart: onHoverStart
|
89
|
+
}),
|
90
|
+
hoverProps = _useHover.hoverProps,
|
91
|
+
defaultIsHovered = _useHover.isHovered;
|
92
|
+
var _useStatusClasses = useStatusClasses(className, {
|
93
|
+
isHovered: shouldUseDefaultHover ? defaultIsHovered : isHovered,
|
94
|
+
isSelected: isSelected
|
95
|
+
}),
|
96
|
+
classNames = _useStatusClasses.classNames;
|
97
|
+
var wrapperStyles = slots !== null && slots !== void 0 && slots.leftOfData ? _objectSpread(_objectSpread({}, sx.wrapper), {}, {
|
98
|
+
ml: 0
|
99
|
+
}) : sx.wrapper;
|
100
|
+
var textStyles = slots !== null && slots !== void 0 && slots.leftOfData ? _objectSpread(_objectSpread({}, sx.text), {}, {
|
101
|
+
ml: 0
|
102
|
+
}) : sx.text;
|
103
|
+
var renderIcon = ___EmotionJSX(Box, {
|
104
|
+
sx: sx.icon
|
105
|
+
}, icon && ___EmotionJSX(Icon, {
|
106
|
+
icon: icon,
|
107
|
+
size: "md",
|
108
|
+
title: {
|
109
|
+
id: _concatInstanceProperty(_context = "".concat(text)).call(_context, LIST_ITEM_ICON),
|
110
|
+
name: _concatInstanceProperty(_context2 = "".concat(text)).call(_context2, LIST_ITEM_ICON)
|
111
|
+
}
|
112
|
+
}));
|
113
|
+
var renderData = ___EmotionJSX(Box, {
|
114
|
+
isRow: true,
|
115
|
+
sx: sx.data
|
116
|
+
}, (slots === null || slots === void 0 ? void 0 : slots.leftOfData) || renderIcon, ___EmotionJSX(Box, {
|
117
|
+
sx: textStyles
|
118
|
+
}, text && ___EmotionJSX(Text, {
|
119
|
+
variant: "bodyStrong",
|
120
|
+
sx: sx.title
|
121
|
+
}, text), subtext && ___EmotionJSX(Text, {
|
122
|
+
variant: "subtitle",
|
123
|
+
sx: sx.subtitle
|
124
|
+
}, subtext)));
|
125
|
+
return ___EmotionJSX(Box, _extends({
|
126
|
+
className: classNames,
|
127
|
+
ref: ref,
|
128
|
+
sx: sx.container
|
129
|
+
}, hoverProps, others), ___EmotionJSX(Box, {
|
130
|
+
isRow: true,
|
131
|
+
sx: wrapperStyles
|
132
|
+
}, renderData, (slots === null || slots === void 0 ? void 0 : slots.rightOfData) && ___EmotionJSX(Box, {
|
133
|
+
isRow: true,
|
134
|
+
alignSelf: "center"
|
135
|
+
}, slots.rightOfData), ___EmotionJSX(Box, {
|
136
|
+
isRow: true,
|
137
|
+
gap: "sm",
|
138
|
+
alignItems: "center",
|
139
|
+
sx: sx.controls
|
140
|
+
}, children)));
|
141
|
+
});
|
142
|
+
ListViewItem.propTypes = listViewItemPropTypes;
|
143
|
+
ListViewItem.displayName = 'ListViewItem';
|
144
|
+
export default ListViewItem;
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Item } from 'react-stately';
|
3
|
+
import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
4
|
+
import FormSelectIcon from '@pingux/mdi-react/FormSelectIcon';
|
5
|
+
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
6
|
+
import { Badge, Box, ListViewItem, ListViewItemEditButton, ListViewItemMenu, ListViewItemSwitchField, Separator, Text } from '../../index';
|
7
|
+
import ListViewItemReadMe from './ListViewItem.mdx';
|
8
|
+
import { listViewItemArgTypes } from './listViewItemAttributes';
|
9
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
|
+
export default {
|
11
|
+
title: 'Experimental/ListViewItem',
|
12
|
+
component: ListViewItem,
|
13
|
+
parameters: {
|
14
|
+
docs: {
|
15
|
+
page: function page() {
|
16
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(ListViewItemReadMe, null), ___EmotionJSX(DocsLayout, null));
|
17
|
+
},
|
18
|
+
source: {
|
19
|
+
type: 'code'
|
20
|
+
}
|
21
|
+
}
|
22
|
+
},
|
23
|
+
argTypes: listViewItemArgTypes
|
24
|
+
};
|
25
|
+
var Wrapper = function Wrapper(_ref) {
|
26
|
+
var children = _ref.children;
|
27
|
+
return ___EmotionJSX(Box, {
|
28
|
+
sx: {
|
29
|
+
bg: 'accent.99'
|
30
|
+
}
|
31
|
+
}, ___EmotionJSX(Separator, {
|
32
|
+
margin: 0
|
33
|
+
}), children, ___EmotionJSX(Separator, {
|
34
|
+
margin: 0
|
35
|
+
}));
|
36
|
+
};
|
37
|
+
export var Default = function Default() {
|
38
|
+
return ___EmotionJSX(Wrapper, null, ___EmotionJSX(ListViewItem, {
|
39
|
+
data: {
|
40
|
+
icon: AccountIcon,
|
41
|
+
text: 'Fons Vernall'
|
42
|
+
}
|
43
|
+
}));
|
44
|
+
};
|
45
|
+
export var WithSubtext = function WithSubtext() {
|
46
|
+
return ___EmotionJSX(Wrapper, null, ___EmotionJSX(ListViewItem, {
|
47
|
+
data: {
|
48
|
+
icon: AccountIcon,
|
49
|
+
subtext: 'rad_developer@pingidentity.com',
|
50
|
+
text: 'Fons Vernall'
|
51
|
+
}
|
52
|
+
}));
|
53
|
+
};
|
54
|
+
export var WithControls = function WithControls() {
|
55
|
+
return ___EmotionJSX(Wrapper, null, ___EmotionJSX(ListViewItem, {
|
56
|
+
data: {
|
57
|
+
icon: FormSelectIcon,
|
58
|
+
text: 'Fons Vernall'
|
59
|
+
}
|
60
|
+
}, ___EmotionJSX(ListViewItemEditButton, null), ___EmotionJSX(ListViewItemSwitchField, null), ___EmotionJSX(ListViewItemMenu, null, ___EmotionJSX(Item, {
|
61
|
+
key: "enable"
|
62
|
+
}, "Enable user"), ___EmotionJSX(Item, {
|
63
|
+
key: "disable"
|
64
|
+
}, "Disable user"), ___EmotionJSX(Item, {
|
65
|
+
key: "delete"
|
66
|
+
}, "Delete user"))));
|
67
|
+
};
|
68
|
+
export var WithRightOfDataSlot = function WithRightOfDataSlot() {
|
69
|
+
var renderRightOfData = ___EmotionJSX(Box, {
|
70
|
+
isRow: true,
|
71
|
+
gap: "sm",
|
72
|
+
ml: "sm"
|
73
|
+
}, ___EmotionJSX(Badge, {
|
74
|
+
label: "Label"
|
75
|
+
}), ___EmotionJSX(Badge, {
|
76
|
+
label: "Label",
|
77
|
+
bg: "active"
|
78
|
+
}));
|
79
|
+
return ___EmotionJSX(Wrapper, null, ___EmotionJSX(ListViewItem, {
|
80
|
+
data: {
|
81
|
+
icon: AccountIcon,
|
82
|
+
text: 'Fons Vernall',
|
83
|
+
subtext: 'verylongemailaddress@email.com'
|
84
|
+
},
|
85
|
+
slots: {
|
86
|
+
rightOfData: renderRightOfData
|
87
|
+
}
|
88
|
+
}, ___EmotionJSX(ListViewItemMenu, null, ___EmotionJSX(Item, {
|
89
|
+
key: "enable"
|
90
|
+
}, "Enable user"), ___EmotionJSX(Item, {
|
91
|
+
key: "disable"
|
92
|
+
}, "Disable user"), ___EmotionJSX(Item, {
|
93
|
+
key: "delete"
|
94
|
+
}, "Delete user"))));
|
95
|
+
};
|
96
|
+
export var WithLeftOfDataSlot = function WithLeftOfDataSlot() {
|
97
|
+
var renderLeftOfData = ___EmotionJSX(Box, {
|
98
|
+
mx: "sm"
|
99
|
+
}, ___EmotionJSX(Text, {
|
100
|
+
pr: 3,
|
101
|
+
variant: "H3"
|
102
|
+
}, "Ping"));
|
103
|
+
return ___EmotionJSX(Wrapper, null, ___EmotionJSX(ListViewItem, {
|
104
|
+
data: {
|
105
|
+
icon: AccountIcon,
|
106
|
+
text: 'Fons Vernall',
|
107
|
+
subtext: 'verylongemailaddress@email.com'
|
108
|
+
}
|
109
|
+
// Note that when the leftOfData slot is used, it overrides the provided icon and
|
110
|
+
// removes all margins and padding on the left of data
|
111
|
+
,
|
112
|
+
slots: {
|
113
|
+
leftOfData: renderLeftOfData
|
114
|
+
}
|
115
|
+
}, ___EmotionJSX(ListViewItemMenu, null, ___EmotionJSX(Item, {
|
116
|
+
key: "enable"
|
117
|
+
}, "Enable user"), ___EmotionJSX(Item, {
|
118
|
+
key: "disable"
|
119
|
+
}, "Disable user"), ___EmotionJSX(Item, {
|
120
|
+
key: "delete"
|
121
|
+
}, "Delete user"))));
|
122
|
+
};
|