@pingux/astro 2.214.0 → 2.216.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lib/cjs/components/OverlayPanel/OverlayPanel.js +6 -0
  2. package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +64 -0
  3. package/lib/cjs/components/Table/Table.mdx +2 -3
  4. package/lib/cjs/components/TableBase/Convenience/TableBaseEmptyState.stories.js +73 -0
  5. package/lib/cjs/components/TableBase/Customization/CustomEmptyState.stories.js +62 -0
  6. package/lib/cjs/components/TableBase/TableBase.js +179 -37
  7. package/lib/cjs/components/TableBase/TableBase.stories.js +217 -26
  8. package/lib/cjs/components/TableBase/TableBase.styles.d.ts +3 -0
  9. package/lib/cjs/components/TableBase/TableBase.styles.js +3 -0
  10. package/lib/cjs/components/TableBase/TableBase.test.js +557 -66
  11. package/lib/cjs/components/TableBase/TableBaseEmptyState.d.ts +4 -0
  12. package/lib/cjs/components/TableBase/TableBaseEmptyState.js +72 -0
  13. package/lib/cjs/components/TableBase/TableBaseEmptyState.test.js +54 -0
  14. package/lib/cjs/components/TableBase/index.d.ts +1 -0
  15. package/lib/cjs/components/TableBase/index.js +8 -1
  16. package/lib/cjs/components/TableBase/tableBaseAttributes.d.ts +21 -0
  17. package/lib/cjs/components/TableBase/tableBaseAttributes.js +24 -1
  18. package/lib/cjs/index.d.ts +1 -0
  19. package/lib/cjs/index.js +8 -0
  20. package/lib/cjs/types/tableBase.d.ts +16 -1
  21. package/lib/components/OverlayPanel/OverlayPanel.js +7 -1
  22. package/lib/components/OverlayPanel/OverlayPanel.test.js +64 -0
  23. package/lib/components/Table/Table.mdx +2 -3
  24. package/lib/components/TableBase/Convenience/TableBaseEmptyState.stories.js +65 -0
  25. package/lib/components/TableBase/Customization/CustomEmptyState.stories.js +54 -0
  26. package/lib/components/TableBase/TableBase.js +179 -35
  27. package/lib/components/TableBase/TableBase.stories.js +220 -28
  28. package/lib/components/TableBase/TableBase.styles.js +3 -0
  29. package/lib/components/TableBase/TableBase.test.js +557 -66
  30. package/lib/components/TableBase/TableBaseEmptyState.js +60 -0
  31. package/lib/components/TableBase/TableBaseEmptyState.test.js +51 -0
  32. package/lib/components/TableBase/index.js +2 -1
  33. package/lib/components/TableBase/tableBaseAttributes.js +23 -0
  34. package/lib/index.js +1 -0
  35. package/package.json +1 -1
@@ -0,0 +1,60 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["defaultIcon", "headerLabel", "descriptionLabel", "addButtonLabel", "onAddButtonPress"];
4
+ import React, { forwardRef } from 'react';
5
+ import ControlPointDuplicateIcon from '@pingux/mdi-react/ControlPointDuplicateIcon';
6
+ import { Box, Button, Icon, Text } from '../..';
7
+ import { jsx as ___EmotionJSX } from "@emotion/react";
8
+ var TableBaseEmptyState = /*#__PURE__*/forwardRef(function (props, ref) {
9
+ var _props$defaultIcon = props.defaultIcon,
10
+ defaultIcon = _props$defaultIcon === void 0 ? ControlPointDuplicateIcon : _props$defaultIcon,
11
+ _props$headerLabel = props.headerLabel,
12
+ headerLabel = _props$headerLabel === void 0 ? 'No items exist' : _props$headerLabel,
13
+ _props$descriptionLab = props.descriptionLabel,
14
+ descriptionLabel = _props$descriptionLab === void 0 ? 'Take action by doing x, y, z' : _props$descriptionLab,
15
+ addButtonLabel = props.addButtonLabel,
16
+ onAddButtonPress = props.onAddButtonPress,
17
+ others = _objectWithoutProperties(props, _excluded);
18
+ return ___EmotionJSX(Box, _extends({
19
+ ref: ref,
20
+ isRow: false,
21
+ alignItems: "center",
22
+ justifyContent: "center",
23
+ gap: "sm",
24
+ py: "lg"
25
+ }, others), ___EmotionJSX(Icon, {
26
+ icon: defaultIcon,
27
+ color: "text.secondary",
28
+ size: 60,
29
+ title: {
30
+ name: 'Empty state icon'
31
+ },
32
+ sx: {
33
+ opacity: 0.2
34
+ }
35
+ }), ___EmotionJSX(Text, {
36
+ variant: "H4",
37
+ as: "h4",
38
+ textAlign: "center"
39
+ }, headerLabel), ___EmotionJSX(Text, {
40
+ textAlign: "center",
41
+ color: "font.base"
42
+ }, descriptionLabel), addButtonLabel && onAddButtonPress && ___EmotionJSX(Button, {
43
+ variant: "primaryWithIcon",
44
+ mt: "sm",
45
+ sx: {
46
+ borderRadius: '50px'
47
+ },
48
+ onPress: onAddButtonPress
49
+ }, ___EmotionJSX(Icon, {
50
+ icon: "add",
51
+ color: "white",
52
+ size: "sm",
53
+ title: {
54
+ name: 'Plus Icon'
55
+ },
56
+ mr: "xs"
57
+ }), addButtonLabel));
58
+ });
59
+ TableBaseEmptyState.displayName = 'TableBaseEmptyState';
60
+ export default TableBaseEmptyState;
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
4
+ import TableBaseEmptyState from './TableBaseEmptyState';
5
+ import { jsx as ___EmotionJSX } from "@emotion/react";
6
+ universalComponentTests({
7
+ renderComponent: function renderComponent(props) {
8
+ return ___EmotionJSX(TableBaseEmptyState, props);
9
+ }
10
+ });
11
+ test('renders default headerLabel', function () {
12
+ render(___EmotionJSX(TableBaseEmptyState, null));
13
+ expect(screen.getByText('No items exist')).toBeInTheDocument();
14
+ });
15
+ test('renders default descriptionLabel', function () {
16
+ render(___EmotionJSX(TableBaseEmptyState, null));
17
+ expect(screen.getByText('Take action by doing x, y, z')).toBeInTheDocument();
18
+ });
19
+ test('renders custom headerLabel', function () {
20
+ render(___EmotionJSX(TableBaseEmptyState, {
21
+ headerLabel: "No results found"
22
+ }));
23
+ expect(screen.getByText('No results found')).toBeInTheDocument();
24
+ });
25
+ test('renders custom descriptionLabel', function () {
26
+ render(___EmotionJSX(TableBaseEmptyState, {
27
+ descriptionLabel: "Try adjusting your filters."
28
+ }));
29
+ expect(screen.getByText('Try adjusting your filters.')).toBeInTheDocument();
30
+ });
31
+ test('does not render add button when addButtonLabel is not provided', function () {
32
+ render(___EmotionJSX(TableBaseEmptyState, null));
33
+ expect(screen.queryByRole('button')).not.toBeInTheDocument();
34
+ });
35
+ test('does not render add button when action is not provided', function () {
36
+ render(___EmotionJSX(TableBaseEmptyState, {
37
+ addButtonLabel: "Add Item"
38
+ }));
39
+ expect(screen.queryByRole('button', {
40
+ name: /Add Item/i
41
+ })).not.toBeInTheDocument();
42
+ });
43
+ test('renders add button when addButtonLabel and action are provided', function () {
44
+ render(___EmotionJSX(TableBaseEmptyState, {
45
+ addButtonLabel: "Add Item",
46
+ onAddButtonPress: jest.fn()
47
+ }));
48
+ expect(screen.getByRole('button', {
49
+ name: /Add Item/i
50
+ })).toBeInTheDocument();
51
+ });
@@ -1 +1,2 @@
1
- export { default } from './TableBase';
1
+ export { default } from './TableBase';
2
+ export { default as TableBaseEmptyState } from './TableBaseEmptyState';
@@ -46,10 +46,33 @@ export var tableBaseArgTypes = {
46
46
  type: 'text'
47
47
  }
48
48
  },
49
+ loadingState: {
50
+ control: {
51
+ type: 'select'
52
+ },
53
+ options: ['error', 'filtering', 'idle', 'loading', 'loadingMore', 'sorting']
54
+ },
55
+ renderEmptyState: {
56
+ control: false
57
+ },
58
+ children: {
59
+ control: false
60
+ },
49
61
  onSortChange: _objectSpread(_objectSpread({}, funcArg), {}, {
50
62
  description: 'Callback invoked when the sort descriptor changes.'
51
63
  }),
52
64
  onSelectionChange: _objectSpread(_objectSpread({}, funcArg), {}, {
53
65
  description: 'Callback invoked when the selection state changes.'
66
+ }),
67
+ onRowAction: _objectSpread(_objectSpread({}, funcArg), {}, {
68
+ description: 'Callback fired when a row is pressed (pointer or Enter key), receiving the key of the pressed row.'
54
69
  })
70
+ };
71
+ export var tableBaseArgs = {
72
+ 'aria-label': 'table',
73
+ caption: 'Lorem ipsum',
74
+ selectionMode: 'none',
75
+ isStickyHeader: false,
76
+ isLastColumnSticky: false,
77
+ hasSelectionCheckboxes: false
55
78
  };
package/lib/index.js CHANGED
@@ -202,6 +202,7 @@ export { default as Table } from './components/Table';
202
202
  export * from './components/Table';
203
203
  export * from './components/TableBase';
204
204
  export { default as TableBase } from './components/TableBase';
205
+ export { default as TableBaseEmptyState } from './components/TableBase/TableBaseEmptyState';
205
206
  export { default as TableBody } from './components/TableBody';
206
207
  export * from './components/TableBody';
207
208
  export { default as TableCaption } from './components/TableCaption';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.214.0",
3
+ "version": "2.216.0-alpha.0",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",