@pingux/astro 1.27.0-alpha.9 → 1.28.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.
- package/CHANGELOG.md +34 -0
- package/NOTICE.html +5016 -0
- package/lib/cjs/components/DataTable/DataTable.js +477 -0
- package/lib/cjs/components/DataTable/DataTable.stories.js +310 -0
- package/lib/cjs/components/DataTable/DataTable.styles.js +156 -0
- package/lib/cjs/components/DataTable/DataTable.test.js +1307 -0
- package/lib/cjs/components/DataTable/DataTableChip.js +63 -0
- package/lib/cjs/components/DataTable/DataTableChip.test.js +38 -0
- package/lib/cjs/components/DataTable/DataTableMenu.js +51 -0
- package/lib/cjs/components/DataTable/DataTableMenu.test.js +20 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.js +75 -0
- package/lib/cjs/components/DataTable/DataTableMultiLine.test.js +30 -0
- package/lib/cjs/components/DataTable/DataTableVirtualizer.js +188 -0
- package/lib/cjs/components/DataTable/index.js +54 -0
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +10 -10
- package/lib/cjs/context/DataTableContext/index.js +31 -0
- package/lib/cjs/index.js +67 -2
- package/lib/cjs/recipes/FlippableCaretMenuButton.stories.js +38 -30
- package/lib/cjs/recipes/MaskedValue.stories.js +8 -5
- package/lib/cjs/recipes/OneWayToBidirectionalArrow.stories.js +38 -33
- package/lib/cjs/recipes/RowLineChart.stories.js +58 -70
- package/lib/cjs/styles/variants/variants.js +4 -1
- package/lib/components/DataTable/DataTable.js +431 -0
- package/lib/components/DataTable/DataTable.stories.js +273 -0
- package/lib/components/DataTable/DataTable.styles.js +137 -0
- package/lib/components/DataTable/DataTable.test.js +1256 -0
- package/lib/components/DataTable/DataTableChip.js +33 -0
- package/lib/components/DataTable/DataTableChip.test.js +31 -0
- package/lib/components/DataTable/DataTableMenu.js +24 -0
- package/lib/components/DataTable/DataTableMenu.test.js +13 -0
- package/lib/components/DataTable/DataTableMultiLine.js +46 -0
- package/lib/components/DataTable/DataTableMultiLine.test.js +22 -0
- package/lib/components/DataTable/DataTableVirtualizer.js +157 -0
- package/lib/components/DataTable/index.js +5 -0
- package/lib/components/MultivaluesField/MultivaluesField.js +10 -10
- package/lib/context/DataTableContext/index.js +5 -0
- package/lib/index.js +4 -1
- package/lib/recipes/FlippableCaretMenuButton.stories.js +38 -30
- package/lib/recipes/MaskedValue.stories.js +8 -5
- package/lib/recipes/OneWayToBidirectionalArrow.stories.js +38 -33
- package/lib/recipes/RowLineChart.stories.js +58 -70
- package/lib/styles/variants/variants.js +3 -1
- package/package.json +55 -50
@@ -0,0 +1,33 @@
|
|
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;
|
@@ -0,0 +1,31 @@
|
|
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
|
+
});
|
@@ -0,0 +1,24 @@
|
|
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;
|
@@ -0,0 +1,13 @@
|
|
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
|
+
});
|
@@ -0,0 +1,46 @@
|
|
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;
|
@@ -0,0 +1,22 @@
|
|
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
|
+
});
|
@@ -0,0 +1,157 @@
|
|
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;
|
@@ -0,0 +1,5 @@
|
|
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';
|
@@ -18,7 +18,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
18
18
|
|
19
19
|
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; }
|
20
20
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context10, _context11; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context10 = ownKeys(Object(source), !0)).call(_context10, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context11 = ownKeys(Object(source))).call(_context11, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
22
22
|
|
23
23
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
24
24
|
import PropTypes from 'prop-types';
|
@@ -46,7 +46,7 @@ import FieldHelperText from '../FieldHelperText';
|
|
46
46
|
|
47
47
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
48
48
|
var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
49
|
-
var
|
49
|
+
var _context7;
|
50
50
|
|
51
51
|
var defaultSelectedKeys = props.defaultSelectedKeys,
|
52
52
|
direction = props.direction,
|
@@ -228,7 +228,7 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
228
228
|
setFilterString('');
|
229
229
|
}
|
230
230
|
} else if (hasCustomValue) {
|
231
|
-
var _context3;
|
231
|
+
var _context3, _context4;
|
232
232
|
|
233
233
|
var _key2 = e.target.value;
|
234
234
|
|
@@ -236,8 +236,8 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
236
236
|
return;
|
237
237
|
}
|
238
238
|
|
239
|
-
selectionManager.
|
240
|
-
setCustomItems(_concatInstanceProperty(
|
239
|
+
selectionManager.setSelectedKeys(_concatInstanceProperty(_context3 = []).call(_context3, _Array$from(selectionManager.state.selectedKeys), [_key2]));
|
240
|
+
setCustomItems(_concatInstanceProperty(_context4 = []).call(_context4, customItems, [{
|
241
241
|
id: _key2,
|
242
242
|
key: _key2,
|
243
243
|
name: _key2
|
@@ -291,9 +291,9 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
291
291
|
};
|
292
292
|
|
293
293
|
var readOnlyInputEntry = ___EmotionJSX(React.Fragment, null, isReadOnly && (readOnlyKeys.length ? _mapInstanceProperty(readOnlyKeys).call(readOnlyKeys, function (key) {
|
294
|
-
var
|
294
|
+
var _context5, _context6;
|
295
295
|
|
296
|
-
var item = _findInstanceProperty(
|
296
|
+
var item = _findInstanceProperty(_context5 = _concatInstanceProperty(_context6 = []).call(_context6, initialItems, customItems)).call(_context5, function (el) {
|
297
297
|
return el.key === key;
|
298
298
|
});
|
299
299
|
|
@@ -329,10 +329,10 @@ var MultivaluesField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
329
329
|
return null;
|
330
330
|
}));
|
331
331
|
|
332
|
-
var selectedItems = ___EmotionJSX(React.Fragment, null, _mapInstanceProperty(
|
333
|
-
var
|
332
|
+
var selectedItems = ___EmotionJSX(React.Fragment, null, _mapInstanceProperty(_context7 = _Array$from(selectionManager.selectedKeys)).call(_context7, function (key) {
|
333
|
+
var _context8, _context9;
|
334
334
|
|
335
|
-
var item = _findInstanceProperty(
|
335
|
+
var item = _findInstanceProperty(_context8 = _concatInstanceProperty(_context9 = []).call(_context9, initialItems, customItems)).call(_context8, function (el) {
|
336
336
|
return el.key === key;
|
337
337
|
});
|
338
338
|
|
package/lib/index.js
CHANGED
@@ -151,4 +151,7 @@ export * from './components/TooltipTrigger';
|
|
151
151
|
|
152
152
|
export { Item, Section } from '@react-stately/collections';
|
153
153
|
export { OverlayProvider, useOverlayPosition, useOverlayTrigger } from '@react-aria/overlays';
|
154
|
-
export { useOverlayTriggerState } from '@react-stately/overlays';
|
154
|
+
export { useOverlayTriggerState } from '@react-stately/overlays';
|
155
|
+
export { default as DataTable } from './components/DataTable';
|
156
|
+
export * from './components/DataTable';
|
157
|
+
export { Cell as DataTableCell, Column as DataTableColumn, Row as DataTableRow, TableBody as DataTableBody, TableHeader as DataTableHeader } from '@react-spectrum/table';
|
@@ -31,6 +31,40 @@ export default {
|
|
31
31
|
title: 'Recipes/FlippableCaretMenuButton'
|
32
32
|
};
|
33
33
|
var buttonArray = ['Web App', 'Native App', 'Single Page App', 'Non-Interactive', 'Worker', 'Advanced Configuration', 'Built-in admin console for this environment', 'Built-in Application portal'];
|
34
|
+
var sx = {
|
35
|
+
openButton: {
|
36
|
+
height: '30px',
|
37
|
+
borderRadius: 'md',
|
38
|
+
fontSize: '13px',
|
39
|
+
mb: 'sm'
|
40
|
+
},
|
41
|
+
closeIconButton: {
|
42
|
+
position: 'absolute',
|
43
|
+
top: '14px',
|
44
|
+
right: 'sm'
|
45
|
+
},
|
46
|
+
buttonsContainer: {
|
47
|
+
p: 'lg',
|
48
|
+
flexDirection: 'initial !important',
|
49
|
+
alignContent: 'space-between',
|
50
|
+
flexWrap: 'wrap'
|
51
|
+
},
|
52
|
+
selectedButton: {
|
53
|
+
mb: 'sm',
|
54
|
+
mr: '4px',
|
55
|
+
height: '30px',
|
56
|
+
borderRadius: '15px',
|
57
|
+
fontSize: '13px'
|
58
|
+
},
|
59
|
+
unSelectedButton: {
|
60
|
+
mb: 'sm',
|
61
|
+
mr: '4px',
|
62
|
+
borderColor: 'neutral.80',
|
63
|
+
height: '30px',
|
64
|
+
borderRadius: '15px',
|
65
|
+
fontSize: '13px'
|
66
|
+
}
|
67
|
+
};
|
34
68
|
export var Default = function Default() {
|
35
69
|
var buttonRef = useRef();
|
36
70
|
var popoverRef = useRef();
|
@@ -89,14 +123,9 @@ export var Default = function Default() {
|
|
89
123
|
|
90
124
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Button, {
|
91
125
|
ref: buttonRef,
|
92
|
-
mb: "sm",
|
93
126
|
variant: "inline",
|
94
127
|
onPress: onChange,
|
95
|
-
sx:
|
96
|
-
height: '30px',
|
97
|
-
borderRadius: '15px',
|
98
|
-
fontSize: '13px'
|
99
|
-
}
|
128
|
+
sx: sx.openButton
|
100
129
|
}, ___EmotionJSX(Box, {
|
101
130
|
isRow: true,
|
102
131
|
alignItems: "center"
|
@@ -119,36 +148,15 @@ export var Default = function Default() {
|
|
119
148
|
onPress: function onPress() {
|
120
149
|
return setIsOpen(false);
|
121
150
|
},
|
122
|
-
sx:
|
123
|
-
position: 'absolute',
|
124
|
-
top: 14,
|
125
|
-
right: 10
|
126
|
-
}
|
151
|
+
sx: sx.closeIconButton
|
127
152
|
}, ___EmotionJSX(Icon, {
|
128
153
|
icon: CloseIcon
|
129
154
|
})), ___EmotionJSX(Box, {
|
130
|
-
sx:
|
131
|
-
p: 'lg',
|
132
|
-
flexDirection: 'initial !important',
|
133
|
-
alignContent: 'space-between',
|
134
|
-
flexWrap: 'wrap'
|
135
|
-
}
|
155
|
+
sx: sx.buttonsContainer
|
136
156
|
}, _mapInstanceProperty(buttonArray).call(buttonArray, function (item) {
|
137
157
|
return ___EmotionJSX(Button, {
|
138
|
-
mb: "sm",
|
139
158
|
variant: "inline",
|
140
|
-
sx: _includesInstanceProperty(selectedButtons).call(selectedButtons, item) ?
|
141
|
-
mr: '4px',
|
142
|
-
height: '30px',
|
143
|
-
borderRadius: '15px',
|
144
|
-
fontSize: '13px'
|
145
|
-
} : {
|
146
|
-
mr: '4px',
|
147
|
-
borderColor: 'neutral.80',
|
148
|
-
height: '30px',
|
149
|
-
borderRadius: '15px',
|
150
|
-
fontSize: '13px'
|
151
|
-
},
|
159
|
+
sx: _includesInstanceProperty(selectedButtons).call(selectedButtons, item) ? sx.selectedButton : sx.unSelectedButton,
|
152
160
|
key: item,
|
153
161
|
onPress: function onPress() {
|
154
162
|
return toggleButton(item);
|
@@ -23,6 +23,13 @@ export default {
|
|
23
23
|
}
|
24
24
|
}
|
25
25
|
};
|
26
|
+
var sx = {
|
27
|
+
showHideButton: {
|
28
|
+
width: 'fit-content',
|
29
|
+
marginLeft: 'sm',
|
30
|
+
alignSelf: 'auto'
|
31
|
+
}
|
32
|
+
};
|
26
33
|
export var Default = function Default(_ref) {
|
27
34
|
var _context;
|
28
35
|
|
@@ -52,11 +59,7 @@ export var Default = function Default(_ref) {
|
|
52
59
|
onPress: function onPress() {
|
53
60
|
return setIsMasked(!isMasked);
|
54
61
|
},
|
55
|
-
sx:
|
56
|
-
width: 'fit-content',
|
57
|
-
marginLeft: 10,
|
58
|
-
alignSelf: 'auto'
|
59
|
-
}
|
62
|
+
sx: sx.showHideButton
|
60
63
|
}, ___EmotionJSX(Icon, {
|
61
64
|
icon: isMasked ? EyeOffIcon : EyeIcon
|
62
65
|
}))));
|