@pingux/astro 1.27.0-alpha.17 → 1.27.0-alpha.18

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 (43) hide show
  1. package/lib/cjs/components/MultivaluesField/MultivaluesField.js +10 -10
  2. package/lib/cjs/index.js +2 -67
  3. package/lib/cjs/recipes/FlippableCaretMenuButton.stories.js +30 -38
  4. package/lib/cjs/recipes/MaskedValue.stories.js +5 -8
  5. package/lib/cjs/recipes/NeutralInput.stories.js +3 -6
  6. package/lib/cjs/recipes/OneWayToBidirectionalArrow.stories.js +33 -38
  7. package/lib/cjs/recipes/RowLineChart.stories.js +70 -58
  8. package/lib/cjs/styles/variants/variants.js +1 -4
  9. package/lib/components/MultivaluesField/MultivaluesField.js +10 -10
  10. package/lib/index.js +1 -4
  11. package/lib/recipes/FlippableCaretMenuButton.stories.js +30 -38
  12. package/lib/recipes/MaskedValue.stories.js +5 -8
  13. package/lib/recipes/NeutralInput.stories.js +3 -6
  14. package/lib/recipes/OneWayToBidirectionalArrow.stories.js +33 -38
  15. package/lib/recipes/RowLineChart.stories.js +70 -58
  16. package/lib/styles/variants/variants.js +1 -3
  17. package/package.json +1 -1
  18. package/lib/cjs/components/DataTable/DataTable.js +0 -477
  19. package/lib/cjs/components/DataTable/DataTable.stories.js +0 -310
  20. package/lib/cjs/components/DataTable/DataTable.styles.js +0 -156
  21. package/lib/cjs/components/DataTable/DataTable.test.js +0 -1307
  22. package/lib/cjs/components/DataTable/DataTableChip.js +0 -63
  23. package/lib/cjs/components/DataTable/DataTableChip.test.js +0 -38
  24. package/lib/cjs/components/DataTable/DataTableMenu.js +0 -51
  25. package/lib/cjs/components/DataTable/DataTableMenu.test.js +0 -20
  26. package/lib/cjs/components/DataTable/DataTableMultiLine.js +0 -75
  27. package/lib/cjs/components/DataTable/DataTableMultiLine.test.js +0 -30
  28. package/lib/cjs/components/DataTable/DataTableVirtualizer.js +0 -188
  29. package/lib/cjs/components/DataTable/index.js +0 -54
  30. package/lib/cjs/context/DataTableContext/index.js +0 -31
  31. package/lib/components/DataTable/DataTable.js +0 -431
  32. package/lib/components/DataTable/DataTable.stories.js +0 -273
  33. package/lib/components/DataTable/DataTable.styles.js +0 -137
  34. package/lib/components/DataTable/DataTable.test.js +0 -1256
  35. package/lib/components/DataTable/DataTableChip.js +0 -33
  36. package/lib/components/DataTable/DataTableChip.test.js +0 -31
  37. package/lib/components/DataTable/DataTableMenu.js +0 -24
  38. package/lib/components/DataTable/DataTableMenu.test.js +0 -13
  39. package/lib/components/DataTable/DataTableMultiLine.js +0 -46
  40. package/lib/components/DataTable/DataTableMultiLine.test.js +0 -22
  41. package/lib/components/DataTable/DataTableVirtualizer.js +0 -157
  42. package/lib/components/DataTable/index.js +0 -5
  43. package/lib/context/DataTableContext/index.js +0 -5
@@ -1,33 +0,0 @@
1
- /* eslint-disable no-nested-ternary */
2
- import React, { forwardRef } from 'react';
3
- import AlertIcon from 'mdi-react/AlertIcon';
4
- import AlertCircleIcon from 'mdi-react/AlertCircleIcon';
5
- import CheckIcon from 'mdi-react/CheckIcon';
6
- import PropTypes from 'prop-types';
7
- import { Chip, Icon } from '../../index';
8
- import { jsx as ___EmotionJSX } from "@emotion/react";
9
- var DataTableChip = /*#__PURE__*/forwardRef(function (_ref, ref) {
10
- var cell = _ref.cell;
11
- var color = cell === 'Pending' ? 'line.light' : cell === 'Failed' ? 'warning.bright' : cell === 'Rejected' ? 'critical.bright' : 'success.dark';
12
- return ___EmotionJSX(Chip, {
13
- label: cell,
14
- bg: "white",
15
- ref: ref,
16
- textColor: cell === 'Pending' || cell === 'Failed' ? 'text.primary' : color,
17
- sx: {
18
- border: '1px',
19
- borderStyle: 'solid',
20
- borderColor: color,
21
- flexDirection: 'row-reverse !important'
22
- }
23
- }, cell !== 'Pending' && ___EmotionJSX(Icon, {
24
- icon: cell === 'Approved' ? CheckIcon : cell === 'Rejected' ? AlertCircleIcon : cell === 'Failed' ? AlertIcon : null,
25
- mr: "xs",
26
- size: "14px",
27
- color: color
28
- }));
29
- });
30
- DataTableChip.propTypes = {
31
- cell: PropTypes.string
32
- };
33
- export default DataTableChip;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import { DataTableChip } from '../../index';
4
- import { jsx as ___EmotionJSX } from "@emotion/react";
5
-
6
- var getComponent = function getComponent() {
7
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8
- return render(___EmotionJSX(DataTableChip, props));
9
- };
10
-
11
- test('renders component with rejected label', function () {
12
- var cell = 'Rejected';
13
- getComponent({
14
- cell: cell
15
- });
16
- expect(screen.queryByText('Rejected')).toBeInTheDocument();
17
- });
18
- test('renders component with pending label', function () {
19
- var cell = 'Pending';
20
- getComponent({
21
- cell: cell
22
- });
23
- expect(screen.queryByText('Pending')).toBeInTheDocument();
24
- });
25
- test('renders component with failed label', function () {
26
- var cell = 'Failed';
27
- getComponent({
28
- cell: cell
29
- });
30
- expect(screen.queryByText('Failed')).toBeInTheDocument();
31
- });
@@ -1,24 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import DotsVerticalIcon from 'mdi-react/DotsVerticalIcon';
3
- import { Box, Icon, IconButton, Item, Menu, OverlayProvider, PopoverMenu, Text } from '../../index';
4
- import { jsx as ___EmotionJSX } from "@emotion/react";
5
- var DataTableMenu = /*#__PURE__*/forwardRef(function (props, ref) {
6
- return ___EmotionJSX(Box, {
7
- ref: ref,
8
- variant: "dataTable.tableMenu"
9
- }, ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(PopoverMenu, null, ___EmotionJSX(IconButton, {
10
- "aria-label": "row menu"
11
- }, ___EmotionJSX(Icon, {
12
- icon: DotsVerticalIcon
13
- })), ___EmotionJSX(Menu, null, ___EmotionJSX(Item, {
14
- key: "edit"
15
- }, "Edit"), ___EmotionJSX(Item, {
16
- key: "duplicate"
17
- }, "Duplicate"), ___EmotionJSX(Item, {
18
- key: "delete",
19
- textValue: "delete"
20
- }, ___EmotionJSX(Text, {
21
- color: "critical.bright"
22
- }, "Delete"))))));
23
- });
24
- export default DataTableMenu;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import { DataTableMenu } from '../../index';
4
- import { jsx as ___EmotionJSX } from "@emotion/react";
5
-
6
- var getComponent = function getComponent() {
7
- return render(___EmotionJSX(DataTableMenu, null));
8
- };
9
-
10
- test('renders component with menu', function () {
11
- getComponent();
12
- expect(screen.getByLabelText('row menu')).toBeInTheDocument();
13
- });
@@ -1,46 +0,0 @@
1
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
2
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
- import React, { forwardRef } from 'react';
4
- import PropTypes from 'prop-types';
5
- import { Box, Icon } from '../../index';
6
- import { jsx as ___EmotionJSX } from "@emotion/react";
7
- var DataTableMultiLine = /*#__PURE__*/forwardRef(function (_ref, ref) {
8
- var cell = _ref.cell;
9
- return ___EmotionJSX(React.Fragment, null, _mapInstanceProperty(cell).call(cell, function (item) {
10
- var _context;
11
-
12
- return ___EmotionJSX(Box, {
13
- key: _concatInstanceProperty(_context = "".concat(cell.key, "_")).call(_context, item.accountId),
14
- ref: ref
15
- }, ___EmotionJSX(Box, {
16
- sx: {
17
- flexDirection: 'row !important'
18
- }
19
- }, ___EmotionJSX(Box, {
20
- sx: {
21
- alignItems: 'center',
22
- justifyContent: 'center',
23
- mx: '18px'
24
- }
25
- }, ___EmotionJSX(Icon, {
26
- icon: item.icon,
27
- color: "accent.40",
28
- size: "18.75"
29
- })), ___EmotionJSX(Box, null, ___EmotionJSX(Box, {
30
- sx: {
31
- fontWeight: 500,
32
- fontSize: '15px'
33
- }
34
- }, item.name), ___EmotionJSX(Box, {
35
- sx: {
36
- color: 'neutral.40',
37
- fontWeight: 400,
38
- fontSize: '13px'
39
- }
40
- }, "Account ID: ", item.accountId))));
41
- }));
42
- });
43
- DataTableMultiLine.propTypes = {
44
- cell: PropTypes.arrayOf(PropTypes.shape({}))
45
- };
46
- export default DataTableMultiLine;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import { render, screen } from '@testing-library/react';
3
- import ApplicationIcon from 'mdi-react/ApplicationIcon';
4
- import { DataTableMultiLine } from '../../index';
5
- import { jsx as ___EmotionJSX } from "@emotion/react";
6
-
7
- var getComponent = function getComponent() {
8
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
- return render(___EmotionJSX(DataTableMultiLine, props));
10
- };
11
-
12
- test('renders component with account name', function () {
13
- var cell = [{
14
- name: 'Acme',
15
- icon: ApplicationIcon,
16
- accountId: 123
17
- }];
18
- getComponent({
19
- cell: cell
20
- });
21
- expect(screen.queryByText('Acme')).toBeInTheDocument();
22
- });
@@ -1,157 +0,0 @@
1
- import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["layout", "collection", "focusedKey", "renderView", "renderWrapper", "domRef", "bodyRef", "setTableWidth", "getColumnWidth", "onVisibleRectChange"];
4
- import PropTypes from 'prop-types';
5
- import React, { forwardRef, useCallback, useRef } from 'react';
6
- import { chain, mergeProps, useLayoutEffect } from '@react-aria/utils';
7
- import { ScrollView, setScrollLeft, useVirtualizer } from '@react-aria/virtualizer';
8
- import { useVirtualizerState } from '@react-stately/virtualizer';
9
- import { Box } from '../../index';
10
- /**
11
- * Custom Virtualizer using react aria Spectrum TableView/TableVirtualizer
12
- * Primarily utilizes [TableView](https://react-spectrum.adobe.com/react-spectrum/TableView.html)
13
- */
14
-
15
- import { jsx as ___EmotionJSX } from "@emotion/react";
16
- var DataTableVirtualizer = /*#__PURE__*/forwardRef(function (_ref, ref) {
17
- var _layout$getLayoutInfo;
18
-
19
- var layout = _ref.layout,
20
- collection = _ref.collection,
21
- focusedKey = _ref.focusedKey,
22
- renderView = _ref.renderView,
23
- renderWrapper = _ref.renderWrapper,
24
- domRef = _ref.domRef,
25
- bodyRef = _ref.bodyRef,
26
- setTableWidth = _ref.setTableWidth,
27
- getColumnWidth = _ref.getColumnWidth,
28
- onVisibleRectChangeProp = _ref.onVisibleRectChange,
29
- otherProps = _objectWithoutProperties(_ref, _excluded);
30
-
31
- var direction = 'ltr'; // useLocale override
32
-
33
- var headerRef = useRef(ref);
34
- var loadingState = collection.body.props.loadingState;
35
- var isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
36
- var onLoadMore = collection.body.props.onLoadMore;
37
- var state = useVirtualizerState({
38
- layout: layout,
39
- collection: collection,
40
- renderView: renderView,
41
- renderWrapper: renderWrapper,
42
- onVisibleRectChange: function onVisibleRectChange(rect) {
43
- // eslint-disable-next-line no-param-reassign
44
- bodyRef.current.scrollTop = rect.y;
45
- setScrollLeft(bodyRef.current, direction, rect.x);
46
- },
47
- transitionDuration: isLoading ? 160 : 220
48
- });
49
-
50
- var _useVirtualizer = useVirtualizer({
51
- focusedKey: focusedKey,
52
- scrollToItem: function scrollToItem(key) {
53
- var item = collection.getItem(key);
54
- state.virtualizer.scrollToItem(key, {
55
- duration: 0,
56
- // Prevent scrolling to the top when clicking on column headers.
57
- shouldScrollY: (item === null || item === void 0 ? void 0 : item.type) !== 'column',
58
- // Offset scroll position by width of selection cell
59
- // (which is sticky and will overlap the cell we're scrolling to).
60
- offsetX: 0
61
- });
62
- }
63
- }, state, domRef),
64
- virtualizerProps = _useVirtualizer.virtualizerProps; // If column widths change, need to relay out.
65
-
66
-
67
- useLayoutEffect(function () {
68
- state.virtualizer.relayoutNow({
69
- sizeChanged: true
70
- });
71
- }, [state.virtualizer]);
72
- var headerHeight = ((_layout$getLayoutInfo = layout.getLayoutInfo('header')) === null || _layout$getLayoutInfo === void 0 ? void 0 : _layout$getLayoutInfo.rect.height) || 0;
73
- var visibleRect = state.virtualizer.visibleRect; // Sync the scroll position from the table body to the header container.
74
-
75
- var onScroll = useCallback(function () {
76
- headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
77
- }, [bodyRef]);
78
- var onVisibleRectChange = useCallback(function (rect) {
79
- setTableWidth(rect.width);
80
- state.setVisibleRect(rect);
81
-
82
- if (!isLoading && onLoadMore) {
83
- var scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
84
-
85
- if (rect.y > scrollOffset) {
86
- onLoadMore();
87
- }
88
- }
89
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
90
- [onLoadMore, isLoading, state.setVisibleRect, state.virtualizer]);
91
- useLayoutEffect(function () {
92
- if (!isLoading && onLoadMore && !state.isAnimating) {
93
- if (state.contentSize.height <= state.virtualizer.visibleRect.height) {
94
- onLoadMore();
95
- }
96
- }
97
- }, [state.contentSize, state.virtualizer, state.isAnimating, onLoadMore, isLoading]);
98
- return ___EmotionJSX(Box, _extends({}, mergeProps(otherProps, virtualizerProps), {
99
- ref: domRef
100
- }), ___EmotionJSX(Box, {
101
- role: "presentation",
102
- variant: "dataTable.tableHeadWrapper",
103
- style: {
104
- width: visibleRect.width,
105
- height: headerHeight,
106
- overflow: 'hidden',
107
- position: 'relative',
108
- willChange: state.isScrolling ? 'scroll-position' : '',
109
- transition: state.isAnimating ? "none ".concat(state.virtualizer.transitionDuration, "ms") : undefined
110
- },
111
- ref: headerRef
112
- }, state.visibleViews[0]), ___EmotionJSX(ScrollView, {
113
- role: "presentation",
114
- variant: "dataTable.tableBody",
115
- style: {
116
- flex: 1
117
- },
118
- innerStyle: {
119
- overflow: 'visible',
120
- transition: state.isAnimating ? "none ".concat(state.virtualizer.transitionDuration, "ms") : undefined
121
- },
122
- ref: bodyRef,
123
- contentSize: state.contentSize,
124
- onVisibleRectChange: chain(onVisibleRectChange, onVisibleRectChangeProp),
125
- onScrollStart: state.startScrolling,
126
- onScrollEnd: state.endScrolling,
127
- onScroll: onScroll
128
- }, state.visibleViews[1]));
129
- });
130
- DataTableVirtualizer.propTypes = {
131
- bodyRef: PropTypes.shape({
132
- current: PropTypes.shape({
133
- scrollLeft: PropTypes.number,
134
- scrollTop: PropTypes.number
135
- })
136
- }),
137
- collection: PropTypes.shape({
138
- body: PropTypes.shape({
139
- props: PropTypes.shape({
140
- loadingState: PropTypes.string,
141
- onLoadMore: PropTypes.func
142
- })
143
- }),
144
- getItem: PropTypes.func
145
- }),
146
- domRef: PropTypes.shape({}),
147
- focusedKey: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
148
- getColumnWidth: PropTypes.func,
149
- layout: PropTypes.shape({
150
- getLayoutInfo: PropTypes.func
151
- }),
152
- onVisibleRectChange: PropTypes.func,
153
- renderView: PropTypes.func,
154
- renderWrapper: PropTypes.func,
155
- setTableWidth: PropTypes.func
156
- };
157
- export default DataTableVirtualizer;
@@ -1,5 +0,0 @@
1
- export { default } from './DataTable';
2
- export { default as DataTableChip } from './DataTableChip';
3
- export { default as DataTableMultiLine } from './DataTableMultiLine';
4
- export { default as DataTableVirtualize } from './DataTableVirtualizer';
5
- export { default as DataTableMenu } from './DataTableMenu';
@@ -1,5 +0,0 @@
1
- import React, { useContext } from 'react';
2
- export var DataTableContext = /*#__PURE__*/React.createContext(null);
3
- export var useDataTableContext = function useDataTableContext() {
4
- return useContext(DataTableContext);
5
- };