@pingux/astro 1.41.0-alpha.1 → 1.41.0-alpha.3
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/Patterns/AttributeMappingDisplayViewPattern.stories.hidden.js +138 -0
- package/lib/Patterns/AttributeMappingEditViewPattern.stories.hidden.js +145 -0
- package/lib/Patterns/ListAndPanelPattern.stories.hidden.js +381 -0
- package/lib/Patterns/MessagesPattern.stories.hidden.js +69 -0
- package/lib/Patterns/SaveBarPattern.stories.hidden.js +80 -0
- package/lib/Patterns/UnsavedChangesPattern.stories.hidden.js +106 -0
- package/lib/cjs/Patterns/AttributeMappingDisplayViewPattern.stories.hidden.js +158 -0
- package/lib/cjs/Patterns/AttributeMappingEditViewPattern.stories.hidden.js +167 -0
- package/lib/cjs/Patterns/ListAndPanelPattern.stories.hidden.js +418 -0
- package/lib/cjs/Patterns/MessagesPattern.stories.hidden.js +99 -0
- package/lib/cjs/Patterns/SaveBarPattern.stories.hidden.js +109 -0
- package/lib/cjs/Patterns/UnsavedChangesPattern.stories.hidden.js +136 -0
- package/lib/cjs/components/Bracket/Bracket.stories.js +1 -3
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.stories.js +2 -18
- package/lib/cjs/components/Card/Card.js +117 -6
- package/lib/cjs/components/Card/Card.stories.js +55 -16
- package/lib/cjs/components/Card/Card.test.js +50 -0
- package/lib/cjs/components/Chip/Badge.js +0 -5
- package/lib/cjs/components/Chip/Badge.stories.js +11 -0
- package/lib/cjs/components/Chip/Chip.js +0 -5
- package/lib/cjs/components/CodeView/CodeView.js +0 -4
- package/lib/cjs/components/CodeView/CodeView.stories.js +9 -0
- package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.js +0 -4
- package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.stories.js +7 -0
- package/lib/cjs/components/ComboBoxField/ComboBoxField.stories.js +13 -1
- package/lib/cjs/components/ComboBoxField/ComboBoxField.test.js +75 -4
- package/lib/cjs/components/CopyText/CopyText.js +0 -4
- package/lib/cjs/components/CopyText/CopyText.stories.js +11 -0
- package/lib/cjs/components/DataTable/DataTable.js +33 -15
- package/lib/cjs/components/DataTable/DataTable.stories.js +91 -17
- package/lib/cjs/components/DataTable/DataTable.test.js +38 -6
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +1 -3
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +25 -3
- package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +19 -5
- package/lib/cjs/components/HelpHint/HelpHint.js +0 -7
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +11 -0
- package/lib/cjs/components/Icon/Icon.js +0 -12
- package/lib/cjs/components/Icon/Icon.stories.js +7 -0
- package/lib/cjs/components/Image/Image.stories.js +2 -2
- package/lib/cjs/components/ListBox/ListBoxSection.js +8 -1
- package/lib/cjs/components/ListView/ListView.stories.js +6 -4
- package/lib/cjs/components/OverlayPanel/OverlayPanel.stories.js +2 -1
- package/lib/cjs/components/SelectField/SelectField.stories.js +13 -1
- package/lib/cjs/components/SelectField/SelectField.test.js +75 -0
- package/lib/cjs/recipes/ConditionalFilter.stories.js +0 -1
- package/lib/cjs/recipes/ScrollableListView.stories.js +3 -2
- package/lib/cjs/recipes/TrialExperienceIndustryButtons.stories.js +4 -8
- package/lib/cjs/styles/variants/boxes.js +6 -6
- package/lib/cjs/utils/devUtils/constants/text.js +11 -0
- package/lib/components/Bracket/Bracket.stories.js +1 -3
- package/lib/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.js +0 -13
- package/lib/components/Card/Card.js +110 -7
- package/lib/components/Card/Card.stories.js +44 -10
- package/lib/components/Card/Card.test.js +36 -0
- package/lib/components/Chip/Badge.js +0 -6
- package/lib/components/Chip/Badge.stories.js +9 -0
- package/lib/components/Chip/Chip.js +0 -6
- package/lib/components/CodeView/CodeView.js +0 -5
- package/lib/components/CodeView/CodeView.stories.js +7 -0
- package/lib/components/CollapsiblePanel/CollapsiblePanel.js +0 -5
- package/lib/components/CollapsiblePanel/CollapsiblePanel.stories.js +5 -0
- package/lib/components/ComboBoxField/ComboBoxField.stories.js +13 -1
- package/lib/components/ComboBoxField/ComboBoxField.test.js +70 -5
- package/lib/components/CopyText/CopyText.js +0 -4
- package/lib/components/CopyText/CopyText.stories.js +9 -0
- package/lib/components/DataTable/DataTable.js +33 -15
- package/lib/components/DataTable/DataTable.stories.js +80 -17
- package/lib/components/DataTable/DataTable.test.js +36 -6
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.js +1 -3
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.stories.js +23 -3
- package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.test.js +16 -5
- package/lib/components/HelpHint/HelpHint.js +0 -7
- package/lib/components/HelpHint/HelpHint.stories.js +9 -0
- package/lib/components/Icon/Icon.js +0 -13
- package/lib/components/Icon/Icon.stories.js +5 -0
- package/lib/components/Image/Image.stories.js +2 -2
- package/lib/components/ListBox/ListBoxSection.js +7 -2
- package/lib/components/ListView/ListView.stories.js +6 -4
- package/lib/components/OverlayPanel/OverlayPanel.stories.js +2 -1
- package/lib/components/SelectField/SelectField.stories.js +13 -1
- package/lib/components/SelectField/SelectField.test.js +68 -1
- package/lib/recipes/ConditionalFilter.stories.js +0 -1
- package/lib/recipes/ScrollableListView.stories.js +3 -2
- package/lib/recipes/TrialExperienceIndustryButtons.stories.js +4 -8
- package/lib/styles/variants/boxes.js +6 -6
- package/lib/utils/devUtils/constants/text.js +1 -0
- package/package.json +1 -1
@@ -1,14 +1,23 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
1
2
|
import React from 'react';
|
2
|
-
import Card from '
|
3
|
-
import
|
3
|
+
import { Box, Button, Card } from '../../index';
|
4
|
+
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
5
|
+
import CardReadme from './Card.mdx';
|
4
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
5
7
|
export default {
|
6
8
|
title: 'Components/Card',
|
7
9
|
component: Card,
|
10
|
+
parameters: {
|
11
|
+
docs: {
|
12
|
+
page: function page() {
|
13
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CardReadme, null), ___EmotionJSX(DocsLayout, null));
|
14
|
+
}
|
15
|
+
}
|
16
|
+
},
|
8
17
|
argTypes: {
|
9
18
|
children: {
|
10
19
|
description: 'Card content.',
|
11
|
-
defaultValue: '
|
20
|
+
defaultValue: 'Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut at enim nunc. Cras congue consequat odio, ac sodales lacus imperdiet quis. In id ex eu lorem sollicitudin hendrerit feugiat ultrices elit. Curabitur imperdiet libero vitae luctus blandit. Ut ac dignissim tortor. Pellentesque convallis eu metus vitae mollis. Donec sapien felis, laoreet eu egestas eu, blandit quis tellus. Donec luctus suscipit nibh, et tincidunt nisl facilisis ut. Mauris molestie purus at lectus venenatis, ac ultrices felis ultrices.',
|
12
21
|
table: {
|
13
22
|
type: {}
|
14
23
|
},
|
@@ -21,7 +30,7 @@ export default {
|
|
21
30
|
export var Default = function Default(args) {
|
22
31
|
return ___EmotionJSX(Card, args);
|
23
32
|
};
|
24
|
-
export var CardRow = function CardRow() {
|
33
|
+
export var CardRow = function CardRow(args) {
|
25
34
|
var sx = {
|
26
35
|
li: {
|
27
36
|
display: 'inline',
|
@@ -40,17 +49,42 @@ export var CardRow = function CardRow() {
|
|
40
49
|
}, ___EmotionJSX(Box, {
|
41
50
|
as: "li",
|
42
51
|
sx: sx.li
|
43
|
-
}, ___EmotionJSX(Card, {
|
52
|
+
}, ___EmotionJSX(Card, _extends({
|
44
53
|
sx: sx.card
|
45
|
-
},
|
54
|
+
}, args))), ___EmotionJSX(Box, {
|
46
55
|
as: "li",
|
47
56
|
sx: sx.li
|
48
|
-
}, ___EmotionJSX(Card, {
|
57
|
+
}, ___EmotionJSX(Card, _extends({
|
49
58
|
sx: sx.card
|
50
|
-
},
|
59
|
+
}, args))), ___EmotionJSX(Box, {
|
51
60
|
as: "li",
|
52
61
|
sx: sx.li
|
53
|
-
}, ___EmotionJSX(Card, {
|
62
|
+
}, ___EmotionJSX(Card, _extends({
|
54
63
|
sx: sx.card
|
55
|
-
},
|
64
|
+
}, args))));
|
65
|
+
};
|
66
|
+
export var InteractiveCard = function InteractiveCard() {
|
67
|
+
var sx = {
|
68
|
+
alignContent: 'center',
|
69
|
+
height: '221px',
|
70
|
+
justifyContent: 'center',
|
71
|
+
textAlign: 'center',
|
72
|
+
width: '233px'
|
73
|
+
};
|
74
|
+
return ___EmotionJSX(Card, {
|
75
|
+
onPress: function onPress() {
|
76
|
+
return console.log('card pressed');
|
77
|
+
},
|
78
|
+
onHoverStart: function onHoverStart() {
|
79
|
+
return console.log('card hovered');
|
80
|
+
},
|
81
|
+
tabIndex: "0",
|
82
|
+
sx: sx
|
83
|
+
}, "Interactive Card", ___EmotionJSX(Button, {
|
84
|
+
variant: "inline",
|
85
|
+
mt: "md",
|
86
|
+
onPress: function onPress() {
|
87
|
+
return console.log('button pressed');
|
88
|
+
}
|
89
|
+
}, "Explore"));
|
56
90
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import React from 'react';
|
3
3
|
import { render, screen } from '@testing-library/react';
|
4
|
+
import userEvent from '@testing-library/user-event';
|
4
5
|
import Card from './Card';
|
5
6
|
import Button from '../Button';
|
6
7
|
import axeTest from '../../utils/testUtils/testAxe';
|
@@ -31,4 +32,39 @@ test('renders children within Card component', function () {
|
|
31
32
|
});
|
32
33
|
var mockedChildren = screen.getByRole('button');
|
33
34
|
expect(mockedChildren).toBeInTheDocument();
|
35
|
+
});
|
36
|
+
test('card allows hover, focus, and press events', function () {
|
37
|
+
var children = ___EmotionJSX(Button, null);
|
38
|
+
|
39
|
+
var onPress = jest.fn();
|
40
|
+
getComponent({
|
41
|
+
children: children,
|
42
|
+
onPress: onPress,
|
43
|
+
tabIndex: 0
|
44
|
+
});
|
45
|
+
var card = screen.getByTestId(testId);
|
46
|
+
expect(card).not.toHaveClass('is-hovered');
|
47
|
+
userEvent.hover(card);
|
48
|
+
expect(card).toHaveClass('is-hovered');
|
49
|
+
userEvent.click(card);
|
50
|
+
expect(onPress).toHaveBeenCalled();
|
51
|
+
expect(card).not.toHaveClass('is-focused');
|
52
|
+
userEvent.tab();
|
53
|
+
expect(card).toHaveClass('is-focused');
|
54
|
+
});
|
55
|
+
test('allows focus within card', function () {
|
56
|
+
var children = ___EmotionJSX(Button, null);
|
57
|
+
|
58
|
+
getComponent({
|
59
|
+
children: children,
|
60
|
+
tabIndex: 0
|
61
|
+
});
|
62
|
+
var button = screen.getByRole('button');
|
63
|
+
var card = screen.getByTestId(testId);
|
64
|
+
expect(button).not.toHaveClass('is-focused');
|
65
|
+
userEvent.tab();
|
66
|
+
expect(button).not.toHaveClass('is-focused');
|
67
|
+
expect(card).toHaveClass('is-focused');
|
68
|
+
userEvent.tab();
|
69
|
+
expect(button).toHaveClass('is-focused');
|
34
70
|
});
|
@@ -22,12 +22,6 @@ import { Badge as ThemeUIBadge } from 'theme-ui';
|
|
22
22
|
import { BadgeContext } from '../../context/BadgeContext';
|
23
23
|
import { Box, Text } from '../../';
|
24
24
|
import * as colors from '../../styles/colors';
|
25
|
-
/**
|
26
|
-
* Badge component.
|
27
|
-
* Built on top of the [Badge from Theme-UI](https://theme-ui.com/components/box/) and uses the
|
28
|
-
* available [props from Theme-UI](https://theme-ui.com/sx-prop).
|
29
|
-
*/
|
30
|
-
|
31
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
32
26
|
var Badge = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
33
27
|
var align = props.align,
|
@@ -10,10 +10,19 @@ import Icon from '../Icon';
|
|
10
10
|
import IconButton from '../IconButton';
|
11
11
|
import Box from '../Box';
|
12
12
|
import { flatColorList } from '../../styles/colors.js';
|
13
|
+
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
14
|
+
import ChipReadme from './Chip.mdx';
|
13
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
14
16
|
export default {
|
15
17
|
title: 'Components/Chip',
|
16
18
|
component: Chip,
|
19
|
+
parameters: {
|
20
|
+
docs: {
|
21
|
+
page: function page() {
|
22
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(ChipReadme, null), ___EmotionJSX(DocsLayout, null));
|
23
|
+
}
|
24
|
+
}
|
25
|
+
},
|
17
26
|
argTypes: {
|
18
27
|
bg: {
|
19
28
|
control: {
|
@@ -3,12 +3,6 @@ import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import Badge from './Badge';
|
5
5
|
import { useDeprecationWarning } from '../../hooks';
|
6
|
-
/**
|
7
|
-
* Chip component.
|
8
|
-
* Built on top of the [Box from Theme-UI](https://theme-ui.com/components/box/) and uses the
|
9
|
-
* available [props from Theme-UI](https://theme-ui.com/sx-prop).
|
10
|
-
*/
|
11
|
-
|
12
6
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
13
7
|
var Chip = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
14
8
|
useDeprecationWarning('The Chip component will be deprecated in Astro-UI 2.0.0 and replaced by the `Badge` component instead.');
|
@@ -26,11 +26,6 @@ import Highlight, { defaultProps, Prism } from 'prism-react-renderer';
|
|
26
26
|
import { useStatusClasses } from '../../hooks';
|
27
27
|
import { Box, CopyText } from '../..';
|
28
28
|
import codeView from '../../styles/variants/codeView';
|
29
|
-
/**
|
30
|
-
* Component for code syntax highlighting.
|
31
|
-
* Built on top of [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer).
|
32
|
-
*/
|
33
|
-
|
34
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
35
30
|
var CodeView = /*#__PURE__*/forwardRef(function (props, ref) {
|
36
31
|
var children = props.children,
|
@@ -4,6 +4,8 @@ import Prism from 'prismjs';
|
|
4
4
|
import 'prismjs/components/prism-powershell';
|
5
5
|
import CodeView from './CodeView';
|
6
6
|
import { Text } from '../..';
|
7
|
+
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
8
|
+
import CodeViewReadme from './CodeView.mdx';
|
7
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
10
|
var code = "{\n \"_links\": {\n \"self\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad\"\n },\n \"password\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad/password\"\n },\n \"password.set\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad/password\"\n },\n \"password.reset\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad/password\"\n },\n \"password.check\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad/password\"\n },\n \"password.recover\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad/password\"\n },\n \"account.sendVerificationCode\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad\"\n },\n \"linkedAccounts\": {\n \"href\": \"https://api.pingone.com/v1/environments/94e3268d-847d-47aa-a45e-1ef8dd8f4df0/users/5a5d4c0c-8383-4796-9cdc-16b5a22f45ad/linkedAccounts\"\n }\n },\n \"id\": \"5a5d4c0c-8383-4796-9cdc-16b5a22f45ad\",\n \"environment\": {\n \"id\": \"94e3268d-847d-47aa-a45e-1ef8dd8f4df0\"\n },\n \"account\": {\n \"canAuthenticate\": true,\n \"status\": \"OK\"\n },\n \"createdAt\": \"2021-09-03T15:01:43.555Z\",\n \"email\": \"allegraweldon@pingidentity.com\",\n \"enabled\": true,\n \"identityProvider\": {\n \"type\": \"PING_ONE\"\n },\n \"lifecycle\": {\n \"status\": \"ACCOUNT_OK\"\n },\n \"mfaEnabled\": false,\n \"population\": {\n \"id\": \"c1adbc29-f188-4ea6-a015-49bddd74bc84\"\n },\n \"updatedAt\": \"2021-09-03T15:01:43.555Z\",\n \"username\": \"allegraweldon@pingidentity.com\",\n \"verifyStatus\": \"NOT_INITIATED\"\n}";
|
9
11
|
export default {
|
@@ -24,6 +26,11 @@ export default {
|
|
24
26
|
}
|
25
27
|
},
|
26
28
|
parameters: {
|
29
|
+
docs: {
|
30
|
+
page: function page() {
|
31
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CodeViewReadme, null), ___EmotionJSX(DocsLayout, null));
|
32
|
+
}
|
33
|
+
},
|
27
34
|
a11y: {
|
28
35
|
config: {
|
29
36
|
rules: [
|
@@ -9,11 +9,6 @@ import { isIterableProp } from '../../utils/devUtils/props/isIterable';
|
|
9
9
|
import { useStatusClasses } from '../../hooks';
|
10
10
|
import CollapsiblePanelBadge from '../CollapsiblePanelContainer/CollapsiblePanelBadge';
|
11
11
|
import { Box, ListView, CollapsiblePanelContainer, Text } from '../../index';
|
12
|
-
/**
|
13
|
-
* The CollapsiblePanel serves as a filter menu with a menu title
|
14
|
-
* and selected count displayed in a badge.
|
15
|
-
*/
|
16
|
-
|
17
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
18
13
|
var CollapsiblePanel = /*#__PURE__*/forwardRef(function (props, ref) {
|
19
14
|
var selectedFilterCount = props.selectedFilterCount,
|
@@ -27,12 +27,17 @@ import AccountIcon from 'mdi-react/AccountIcon';
|
|
27
27
|
import CollapsiblePanel from './CollapsiblePanel';
|
28
28
|
import { useOverlayPanelState } from '../../hooks';
|
29
29
|
import { Breadcrumbs, Box, Button, CheckboxField, Chip, ListView, Item, Icon, IconButton, CollapsiblePanelItem, OverlayPanel, OverlayProvider, SearchField, Text } from '../../index';
|
30
|
+
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
31
|
+
import CollapsiblePanelReadme from './CollapsiblePanel.mdx';
|
30
32
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
31
33
|
export default {
|
32
34
|
title: 'Components/CollapsiblePanel',
|
33
35
|
component: CollapsiblePanel,
|
34
36
|
parameters: {
|
35
37
|
docs: {
|
38
|
+
page: function page() {
|
39
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CollapsiblePanelReadme, null), ___EmotionJSX(DocsLayout, null));
|
40
|
+
},
|
36
41
|
source: {
|
37
42
|
type: 'code'
|
38
43
|
}
|
@@ -88,6 +88,7 @@ var animals = [{
|
|
88
88
|
}];
|
89
89
|
var withSection = [{
|
90
90
|
name: 'Animals',
|
91
|
+
key: 'Animals',
|
91
92
|
children: [{
|
92
93
|
name: 'Raccoon'
|
93
94
|
}, {
|
@@ -97,6 +98,7 @@ var withSection = [{
|
|
97
98
|
}]
|
98
99
|
}, {
|
99
100
|
name: 'People',
|
101
|
+
key: 'People',
|
100
102
|
children: [{
|
101
103
|
name: 'Michael'
|
102
104
|
}, {
|
@@ -104,6 +106,16 @@ var withSection = [{
|
|
104
106
|
}, {
|
105
107
|
name: 'Creed'
|
106
108
|
}]
|
109
|
+
}, {
|
110
|
+
name: null,
|
111
|
+
key: 'fruit',
|
112
|
+
children: [{
|
113
|
+
name: 'Apple'
|
114
|
+
}, {
|
115
|
+
name: 'Orange'
|
116
|
+
}, {
|
117
|
+
name: 'Banana'
|
118
|
+
}]
|
107
119
|
}];
|
108
120
|
var actions = {
|
109
121
|
onOpenChange: action('onOpenChange'),
|
@@ -192,7 +204,7 @@ export var WithSections = function WithSections(args) {
|
|
192
204
|
items: withSection
|
193
205
|
}, args), function (section) {
|
194
206
|
return ___EmotionJSX(Section, {
|
195
|
-
key: section.
|
207
|
+
key: section.key,
|
196
208
|
items: section.children,
|
197
209
|
title: section.name
|
198
210
|
}, function (item) {
|
@@ -26,7 +26,7 @@ import { axe } from 'jest-axe';
|
|
26
26
|
import { useFilter } from '@react-aria/i18n';
|
27
27
|
import userEvent from '@testing-library/user-event';
|
28
28
|
import { render, screen, act, within } from '../../utils/testUtils/testWrapper';
|
29
|
-
import { ComboBoxField, Item, OverlayProvider } from '../../index';
|
29
|
+
import { ComboBoxField, Item, OverlayProvider, Section } from '../../index';
|
30
30
|
import loadingStates from '../../utils/devUtils/constants/loadingStates';
|
31
31
|
import statuses from '../../utils/devUtils/constants/statuses';
|
32
32
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -40,6 +40,37 @@ var items = [{
|
|
40
40
|
name: 'Snake',
|
41
41
|
id: '3'
|
42
42
|
}];
|
43
|
+
var withSection = [{
|
44
|
+
name: 'Animals',
|
45
|
+
key: 'Animals',
|
46
|
+
kids: [{
|
47
|
+
name: 'Raccoon'
|
48
|
+
}, {
|
49
|
+
name: 'Kangaroo'
|
50
|
+
}, {
|
51
|
+
name: 'Opossum'
|
52
|
+
}]
|
53
|
+
}, {
|
54
|
+
name: 'People',
|
55
|
+
key: 'People',
|
56
|
+
kids: [{
|
57
|
+
name: 'Michael'
|
58
|
+
}, {
|
59
|
+
name: 'Dwight'
|
60
|
+
}, {
|
61
|
+
name: 'Creed'
|
62
|
+
}]
|
63
|
+
}, {
|
64
|
+
name: null,
|
65
|
+
key: 'fruit',
|
66
|
+
kids: [{
|
67
|
+
name: 'Apple'
|
68
|
+
}, {
|
69
|
+
name: 'Orange'
|
70
|
+
}, {
|
71
|
+
name: 'Banana'
|
72
|
+
}]
|
73
|
+
}];
|
43
74
|
var defaultProps = {
|
44
75
|
defaultItems: items,
|
45
76
|
label: 'Test Label'
|
@@ -60,6 +91,28 @@ var getComponent = function getComponent() {
|
|
60
91
|
})));
|
61
92
|
};
|
62
93
|
|
94
|
+
var getComponentWithSections = function getComponentWithSections() {
|
95
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
96
|
+
|
97
|
+
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
98
|
+
_ref2$renderFn = _ref2.renderFn,
|
99
|
+
renderFn = _ref2$renderFn === void 0 ? render : _ref2$renderFn;
|
100
|
+
|
101
|
+
return renderFn(___EmotionJSX(OverlayProvider, null, ___EmotionJSX(ComboBoxField, _extends({}, defaultProps, props, {
|
102
|
+
items: withSection
|
103
|
+
}), function (section) {
|
104
|
+
return ___EmotionJSX(Section, {
|
105
|
+
key: section.key,
|
106
|
+
items: section.kids,
|
107
|
+
title: section.name
|
108
|
+
}, function (item) {
|
109
|
+
return ___EmotionJSX(Item, {
|
110
|
+
key: item.name
|
111
|
+
}, item.name);
|
112
|
+
});
|
113
|
+
})));
|
114
|
+
};
|
115
|
+
|
63
116
|
var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
|
64
117
|
var _useFilter = useFilter({
|
65
118
|
sensitivity: 'base'
|
@@ -76,8 +129,8 @@ var ComboBoxWithCustomFilter = function ComboBoxWithCustomFilter() {
|
|
76
129
|
setFieldState = _useState2[1];
|
77
130
|
|
78
131
|
var onSelectionChange = function onSelectionChange(key) {
|
79
|
-
var selectedItem = _filterInstanceProperty(items).call(items, function (
|
80
|
-
var id =
|
132
|
+
var selectedItem = _filterInstanceProperty(items).call(items, function (_ref3) {
|
133
|
+
var id = _ref3.id;
|
81
134
|
return id === key;
|
82
135
|
});
|
83
136
|
|
@@ -148,8 +201,8 @@ var ComboBoxWithAddOption = function ComboBoxWithAddOption() {
|
|
148
201
|
setSelectedKey = _useState8[1];
|
149
202
|
|
150
203
|
var onSelectionChange = function onSelectionChange(key) {
|
151
|
-
if (key && !_findInstanceProperty(options).call(options, function (
|
152
|
-
var name =
|
204
|
+
if (key && !_findInstanceProperty(options).call(options, function (_ref4) {
|
205
|
+
var name = _ref4.name;
|
153
206
|
return name === key;
|
154
207
|
})) {
|
155
208
|
var _context;
|
@@ -1009,6 +1062,18 @@ test('popover closes on input blur', function () {
|
|
1009
1062
|
expect(screen.queryByRole('listbox')).not.toBeInTheDocument();
|
1010
1063
|
expect(screen.queryByRole('option')).not.toBeInTheDocument();
|
1011
1064
|
});
|
1065
|
+
test('passing sections, renders separators', function () {
|
1066
|
+
getComponentWithSections();
|
1067
|
+
var button = screen.getByRole('button');
|
1068
|
+
userEvent.click(button);
|
1069
|
+
expect(screen.queryAllByRole('separator')).toHaveLength(4);
|
1070
|
+
});
|
1071
|
+
test('a blank title does not render', function () {
|
1072
|
+
getComponentWithSections();
|
1073
|
+
var button = screen.getByRole('button');
|
1074
|
+
userEvent.click(button);
|
1075
|
+
expect(screen.queryByText('Fruit')).not.toBeInTheDocument();
|
1076
|
+
});
|
1012
1077
|
describe('when isReadOnly is true', function () {
|
1013
1078
|
var testProp = {
|
1014
1079
|
isReadOnly: true
|
@@ -32,10 +32,6 @@ TooltipWrapper.propTypes = {
|
|
32
32
|
targetRef: PropTypes.shape({}),
|
33
33
|
tooltip: PropTypes.string
|
34
34
|
};
|
35
|
-
/**
|
36
|
-
* Allows copying some pieces of text by clicking on the text or by the button nearby.
|
37
|
-
*/
|
38
|
-
|
39
35
|
var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
40
36
|
var children = props.children,
|
41
37
|
textToCopy = props.textToCopy,
|
@@ -3,10 +3,19 @@ import React from 'react';
|
|
3
3
|
import Link from '../Link';
|
4
4
|
import Text from '../Text';
|
5
5
|
import CopyText from './CopyText';
|
6
|
+
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
7
|
+
import CopyTextReadme from './CopyText.mdx';
|
6
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
7
9
|
export default {
|
8
10
|
title: 'Components/CopyText',
|
9
11
|
component: CopyText,
|
12
|
+
parameters: {
|
13
|
+
docs: {
|
14
|
+
page: function page() {
|
15
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(CopyTextReadme, null), ___EmotionJSX(DocsLayout, null));
|
16
|
+
}
|
17
|
+
}
|
18
|
+
},
|
10
19
|
argTypes: {
|
11
20
|
mode: {
|
12
21
|
control: 'none'
|
@@ -51,13 +51,6 @@ var ROW_HEIGHTS = {
|
|
51
51
|
large: 75
|
52
52
|
}
|
53
53
|
};
|
54
|
-
/**
|
55
|
-
* DataTable component using react aria Spectrum TableView
|
56
|
-
* Primarily utilizes [TableView](https://react-spectrum.adobe.com/react-spectrum/TableView.html)
|
57
|
-
* Cross platform state management react hook for DataTable
|
58
|
-
* Primarily utilizes [useTableState](https://react-spectrum.adobe.com/react-stately/useTableState.html)
|
59
|
-
*/
|
60
|
-
|
61
54
|
var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
62
55
|
var width = props.width,
|
63
56
|
height = props.height,
|
@@ -211,12 +204,30 @@ var DataTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
211
204
|
});
|
212
205
|
DataTable.propTypes = {
|
213
206
|
/**
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
207
|
+
* Sets the amount of vertical padding within each cell.
|
208
|
+
* density: 'compact' | 'regular' | 'spacious'
|
209
|
+
* @default 'regular'
|
210
|
+
*/
|
218
211
|
density: PropTypes.string,
|
219
212
|
|
213
|
+
/** Sets the height of table. */
|
214
|
+
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
215
|
+
|
216
|
+
/** Determine if the header should be hidden. */
|
217
|
+
hasHiddenHeader: PropTypes.bool,
|
218
|
+
|
219
|
+
/** Bool that determines if the items are sortable. */
|
220
|
+
isSortable: PropTypes.bool,
|
221
|
+
|
222
|
+
/** The list of DataTable items. */
|
223
|
+
items: PropTypes.arrayOf(PropTypes.shape({})),
|
224
|
+
|
225
|
+
/** Reflects current loading state. */
|
226
|
+
loadingState: PropTypes.oneOf(['error', 'filtering', 'idle', 'loading', 'loadingMore', 'sorting']),
|
227
|
+
|
228
|
+
/** Handler that is called when a user performs an action on a row. */
|
229
|
+
onAction: PropTypes.func,
|
230
|
+
|
220
231
|
/**
|
221
232
|
* Sets the overflow behavior for the cell contents.
|
222
233
|
* overflowMode: 'wrap' | 'truncate'
|
@@ -224,10 +235,17 @@ DataTable.propTypes = {
|
|
224
235
|
*/
|
225
236
|
overflowMode: PropTypes.string,
|
226
237
|
|
227
|
-
/**
|
228
|
-
|
229
|
-
|
230
|
-
|
238
|
+
/** Callback function that fires when more data should be loaded on demand as user scrolls. */
|
239
|
+
onLoadMore: PropTypes.func,
|
240
|
+
|
241
|
+
/** Callback function that fires when sortable column header is pressed. */
|
242
|
+
onSortChange: PropTypes.func,
|
243
|
+
|
244
|
+
/** Defines the current column key to sort by and the sort direction. */
|
245
|
+
sortDescriptor: PropTypes.oneOf(['ascending', 'descending']),
|
246
|
+
|
247
|
+
/** Sets the width of table. */
|
248
|
+
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
231
249
|
};
|
232
250
|
DataTable.defaultProps = {
|
233
251
|
width: '100%',
|