grommet 2.46.0 → 2.47.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/components/Accordion/index.d.ts +7 -1
- package/components/AccordionPanel/index.d.ts +4 -1
- package/components/Anchor/index.d.ts +7 -1
- package/components/Avatar/Avatar.js +4 -3
- package/components/Avatar/index.d.ts +9 -1
- package/components/Avatar/propTypes.js +2 -1
- package/components/Box/Box.js +41 -6
- package/components/Box/{ResponsiveContainer.js → ResponsiveContainerProvider.js} +29 -28
- package/components/Box/StyledBox.js +13 -2
- package/components/Box/index.d.ts +9 -2
- package/components/Button/index.d.ts +14 -2
- package/components/Calendar/Calendar.js +43 -32
- package/components/Calendar/StyledCalendar.js +86 -32
- package/components/Calendar/index.d.ts +15 -2
- package/components/Calendar/propTypes.js +1 -0
- package/components/Cards/index.d.ts +7 -1
- package/components/Carousel/index.d.ts +4 -1
- package/components/Chart/index.d.ts +7 -1
- package/components/CheckBox/index.d.ts +7 -1
- package/components/CheckBoxGroup/index.d.ts +15 -2
- package/components/Clock/index.d.ts +14 -2
- package/components/Collapsible/index.d.ts +4 -1
- package/components/Data/index.d.ts +4 -1
- package/components/DataFilter/index.d.ts +4 -1
- package/components/DataFilters/index.d.ts +4 -1
- package/components/DataTable/Body.js +13 -7
- package/components/DataTable/DataTable.js +6 -1
- package/components/DataTable/index.d.ts +11 -2
- package/components/DataTable/propTypes.js +5 -1
- package/components/DataTable/stories/rowDetails.stories.js +174 -66
- package/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
- package/components/DataTableGroupBy/index.d.ts +4 -1
- package/components/DataView/index.d.ts +4 -1
- package/components/DateInput/index.d.ts +4 -1
- package/components/Diagram/index.d.ts +4 -1
- package/components/Distribution/index.d.ts +4 -1
- package/components/Drop/StyledDrop.js +3 -1
- package/components/Drop/index.d.ts +6 -2
- package/components/DropButton/index.d.ts +8 -1
- package/components/FileInput/index.d.ts +8 -2
- package/components/Form/index.d.ts +7 -1
- package/components/FormField/index.d.ts +4 -1
- package/components/Grid/index.d.ts +4 -1
- package/components/Grommet/index.d.ts +18 -1
- package/components/Grommet/propTypes.js +11 -0
- package/components/Header/stories/typescript/Ref.stories.tsx +1 -1
- package/components/Heading/index.d.ts +7 -7
- package/components/Image/index.d.ts +4 -1
- package/components/InfiniteScroll/index.d.ts +2 -2
- package/components/Layer/index.d.ts +4 -1
- package/components/List/index.d.ts +9 -3
- package/components/Markdown/index.d.ts +5 -1
- package/components/MaskedInput/MaskedInput.js +49 -4
- package/components/MaskedInput/index.d.ts +7 -1
- package/components/MaskedInput/stories/CustomBox.stories.js +1 -0
- package/components/MaskedInput/stories/Date.stories.js +1 -0
- package/components/MaskedInput/stories/DateRange.stories.js +1 -0
- package/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
- package/components/MaskedInput/stories/Filtered.stories.js +1 -0
- package/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
- package/components/MaskedInput/stories/Time.stories.js +1 -0
- package/components/NameValueList/index.d.ts +8 -1
- package/components/Notification/index.d.ts +1 -0
- package/components/PageHeader/index.d.ts +5 -1
- package/components/Pagination/PaginationStep.js +4 -0
- package/components/Pagination/index.d.ts +5 -0
- package/components/Pagination/propTypes.js +6 -1
- package/components/Paragraph/index.d.ts +7 -1
- package/components/RadioButton/index.d.ts +7 -1
- package/components/RadioButtonGroup/index.d.ts +7 -1
- package/components/RangeInput/index.d.ts +7 -1
- package/components/RangeSelector/index.d.ts +15 -2
- package/components/RoutedAnchor/index.d.ts +3 -2
- package/components/RoutedButton/index.d.ts +3 -2
- package/components/Select/Select.js +2 -4
- package/components/Select/index.d.ts +7 -1
- package/components/Select/utils.js +12 -3
- package/components/SelectMultiple/SelectMultiple.js +5 -10
- package/components/SelectMultiple/SelectMultipleContainer.js +2 -4
- package/components/SelectMultiple/SelectMultipleValue.js +1 -2
- package/components/SelectMultiple/index.d.ts +7 -1
- package/components/Sidebar/index.d.ts +4 -1
- package/components/Stack/index.d.ts +4 -1
- package/components/Tab/index.d.ts +7 -1
- package/components/Table/index.d.ts +4 -1
- package/components/TableBody/index.d.ts +4 -1
- package/components/TableCell/index.d.ts +10 -3
- package/components/TableFooter/index.d.ts +4 -1
- package/components/TableHeader/index.d.ts +4 -1
- package/components/TableRow/index.d.ts +4 -1
- package/components/Tabs/index.d.ts +4 -1
- package/components/Tag/Tag.js +15 -1
- package/components/Tag/index.d.ts +6 -0
- package/components/Tag/propTypes.js +6 -0
- package/components/Text/Text.js +3 -2
- package/components/Text/index.d.ts +7 -1
- package/components/TextArea/index.d.ts +7 -1
- package/components/TextInput/TextInput.js +6 -2
- package/components/TextInput/index.d.ts +6 -3
- package/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
- package/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
- package/components/TextInput/stories/OnSelect.stories.js +1 -0
- package/components/TextInput/stories/WithTags.stories.js +1 -0
- package/components/Tip/Tip.js +25 -3
- package/components/ToggleGroup/index.d.ts +7 -1
- package/components/Toolbar/index.d.ts +5 -2
- package/components/Video/index.d.ts +7 -1
- package/components/WorldMap/index.d.ts +7 -1
- package/es6/components/Accordion/index.d.ts +7 -1
- package/es6/components/AccordionPanel/index.d.ts +4 -1
- package/es6/components/Anchor/index.d.ts +7 -1
- package/es6/components/Avatar/Avatar.js +4 -3
- package/es6/components/Avatar/index.d.ts +9 -1
- package/es6/components/Avatar/propTypes.js +2 -1
- package/es6/components/Box/Box.js +42 -7
- package/es6/components/Box/ResponsiveContainerProvider.js +54 -0
- package/es6/components/Box/StyledBox.js +12 -2
- package/es6/components/Box/index.d.ts +9 -2
- package/es6/components/Button/index.d.ts +14 -2
- package/es6/components/Calendar/Calendar.js +44 -32
- package/es6/components/Calendar/StyledCalendar.js +86 -32
- package/es6/components/Calendar/index.d.ts +15 -2
- package/es6/components/Calendar/propTypes.js +1 -0
- package/es6/components/Cards/index.d.ts +7 -1
- package/es6/components/Carousel/index.d.ts +4 -1
- package/es6/components/Chart/index.d.ts +7 -1
- package/es6/components/CheckBox/index.d.ts +7 -1
- package/es6/components/CheckBoxGroup/index.d.ts +15 -2
- package/es6/components/Clock/index.d.ts +14 -2
- package/es6/components/Collapsible/index.d.ts +4 -1
- package/es6/components/Data/index.d.ts +4 -1
- package/es6/components/DataFilter/index.d.ts +4 -1
- package/es6/components/DataFilters/index.d.ts +4 -1
- package/es6/components/DataTable/Body.js +13 -7
- package/es6/components/DataTable/DataTable.js +6 -1
- package/es6/components/DataTable/index.d.ts +11 -2
- package/es6/components/DataTable/propTypes.js +5 -1
- package/es6/components/DataTable/stories/rowDetails.stories.js +172 -66
- package/es6/components/DataTable/stories/typescript/OnSelect.stories.tsx +3 -3
- package/es6/components/DataTableGroupBy/index.d.ts +4 -1
- package/es6/components/DataView/index.d.ts +4 -1
- package/es6/components/DateInput/index.d.ts +4 -1
- package/es6/components/Diagram/index.d.ts +4 -1
- package/es6/components/Distribution/index.d.ts +4 -1
- package/es6/components/Drop/StyledDrop.js +3 -1
- package/es6/components/Drop/index.d.ts +6 -2
- package/es6/components/DropButton/index.d.ts +8 -1
- package/es6/components/FileInput/index.d.ts +8 -2
- package/es6/components/Form/index.d.ts +7 -1
- package/es6/components/FormField/index.d.ts +4 -1
- package/es6/components/Grid/index.d.ts +4 -1
- package/es6/components/Grommet/index.d.ts +18 -1
- package/es6/components/Grommet/propTypes.js +11 -0
- package/es6/components/Header/stories/typescript/Ref.stories.tsx +1 -1
- package/es6/components/Heading/index.d.ts +7 -7
- package/es6/components/Image/index.d.ts +4 -1
- package/es6/components/InfiniteScroll/index.d.ts +2 -2
- package/es6/components/Layer/index.d.ts +4 -1
- package/es6/components/List/index.d.ts +9 -3
- package/es6/components/Markdown/index.d.ts +5 -1
- package/es6/components/MaskedInput/MaskedInput.js +49 -4
- package/es6/components/MaskedInput/index.d.ts +7 -1
- package/es6/components/MaskedInput/stories/CustomBox.stories.js +1 -0
- package/es6/components/MaskedInput/stories/Date.stories.js +1 -0
- package/es6/components/MaskedInput/stories/DateRange.stories.js +1 -0
- package/es6/components/MaskedInput/stories/DateTimeDrop.stories.js +1 -0
- package/es6/components/MaskedInput/stories/Filtered.stories.js +1 -0
- package/es6/components/MaskedInput/stories/SizeUnits.stories.js +1 -0
- package/es6/components/MaskedInput/stories/Time.stories.js +1 -0
- package/es6/components/NameValueList/index.d.ts +8 -1
- package/es6/components/Notification/index.d.ts +1 -0
- package/es6/components/PageHeader/index.d.ts +5 -1
- package/es6/components/Pagination/PaginationStep.js +4 -0
- package/es6/components/Pagination/index.d.ts +5 -0
- package/es6/components/Pagination/propTypes.js +6 -1
- package/es6/components/Paragraph/index.d.ts +7 -1
- package/es6/components/RadioButton/index.d.ts +7 -1
- package/es6/components/RadioButtonGroup/index.d.ts +7 -1
- package/es6/components/RangeInput/index.d.ts +7 -1
- package/es6/components/RangeSelector/index.d.ts +15 -2
- package/es6/components/RoutedAnchor/index.d.ts +3 -2
- package/es6/components/RoutedButton/index.d.ts +3 -2
- package/es6/components/Select/Select.js +3 -5
- package/es6/components/Select/index.d.ts +7 -1
- package/es6/components/Select/utils.js +9 -2
- package/es6/components/SelectMultiple/SelectMultiple.js +6 -11
- package/es6/components/SelectMultiple/SelectMultipleContainer.js +3 -5
- package/es6/components/SelectMultiple/SelectMultipleValue.js +2 -3
- package/es6/components/SelectMultiple/index.d.ts +7 -1
- package/es6/components/Sidebar/index.d.ts +4 -1
- package/es6/components/Stack/index.d.ts +4 -1
- package/es6/components/Tab/index.d.ts +7 -1
- package/es6/components/Table/index.d.ts +4 -1
- package/es6/components/TableBody/index.d.ts +4 -1
- package/es6/components/TableCell/index.d.ts +10 -3
- package/es6/components/TableFooter/index.d.ts +4 -1
- package/es6/components/TableHeader/index.d.ts +4 -1
- package/es6/components/TableRow/index.d.ts +4 -1
- package/es6/components/Tabs/index.d.ts +4 -1
- package/es6/components/Tag/Tag.js +16 -2
- package/es6/components/Tag/index.d.ts +6 -0
- package/es6/components/Tag/propTypes.js +6 -0
- package/es6/components/Text/Text.js +3 -2
- package/es6/components/Text/index.d.ts +7 -1
- package/es6/components/TextArea/index.d.ts +7 -1
- package/es6/components/TextInput/TextInput.js +6 -2
- package/es6/components/TextInput/index.d.ts +6 -3
- package/es6/components/TextInput/stories/CustomThemed/CustomSuggestions.stories.tsx +2 -1
- package/es6/components/TextInput/stories/CustomThemed/Themed.stories.js +1 -0
- package/es6/components/TextInput/stories/OnSelect.stories.js +1 -0
- package/es6/components/TextInput/stories/WithTags.stories.js +1 -0
- package/es6/components/Tip/Tip.js +26 -3
- package/es6/components/ToggleGroup/index.d.ts +7 -1
- package/es6/components/Toolbar/index.d.ts +5 -2
- package/es6/components/Video/index.d.ts +7 -1
- package/es6/components/WorldMap/index.d.ts +7 -1
- package/es6/languages/default.json +6 -0
- package/es6/utils/mixins.js +2 -1
- package/es6/utils/responsive.js +8 -7
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +6 -0
- package/package.json +43 -43
- package/utils/mixins.js +2 -1
- package/utils/responsive.js +8 -7
- package/components/Box/StyledResponsiveContainer.js +0 -11
- package/components/Drop/stories/TrapFocus.stories.js +0 -86
- package/es6/components/Box/ResponsiveContainer.js +0 -52
- package/es6/components/Box/StyledResponsiveContainer.js +0 -6
- package/es6/components/Drop/stories/TrapFocus.stories.js +0 -82
|
@@ -16,7 +16,13 @@ export interface CheckBoxProps {
|
|
|
16
16
|
indeterminate?: boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
type inputType = Omit<
|
|
19
|
+
type inputType = Omit<
|
|
20
|
+
React.DetailedHTMLProps<
|
|
21
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
22
|
+
HTMLInputElement
|
|
23
|
+
>,
|
|
24
|
+
'children'
|
|
25
|
+
>;
|
|
20
26
|
|
|
21
27
|
export interface CheckBoxExtendedProps extends CheckBoxProps, inputType {}
|
|
22
28
|
|
|
@@ -9,7 +9,14 @@ interface OnChangeEvent {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface CheckBoxType
|
|
12
|
-
extends Omit<
|
|
12
|
+
extends Omit<
|
|
13
|
+
CheckBoxProps &
|
|
14
|
+
React.DetailedHTMLProps<
|
|
15
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
16
|
+
HTMLInputElement
|
|
17
|
+
>,
|
|
18
|
+
'checked'
|
|
19
|
+
> {
|
|
13
20
|
[key: string]: any;
|
|
14
21
|
}
|
|
15
22
|
|
|
@@ -27,7 +34,13 @@ export interface CheckBoxGroupProps {
|
|
|
27
34
|
export interface CheckBoxGroupExtendedProps
|
|
28
35
|
extends CheckBoxGroupProps,
|
|
29
36
|
BoxProps,
|
|
30
|
-
Omit<
|
|
37
|
+
Omit<
|
|
38
|
+
React.DetailedHTMLProps<
|
|
39
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
40
|
+
HTMLDivElement
|
|
41
|
+
>,
|
|
42
|
+
keyof CheckBoxGroupProps
|
|
43
|
+
> {}
|
|
31
44
|
|
|
32
45
|
declare const CheckBoxGroup: React.FC<CheckBoxGroupExtendedProps>;
|
|
33
46
|
|
|
@@ -35,8 +35,20 @@ export interface ClockProps {
|
|
|
35
35
|
*/
|
|
36
36
|
export type ClockExtendedProps = ClockProps &
|
|
37
37
|
(
|
|
38
|
-
| Omit<
|
|
39
|
-
|
|
38
|
+
| Omit<
|
|
39
|
+
React.DetailedHTMLProps<
|
|
40
|
+
React.SVGAttributes<SVGSVGElement>,
|
|
41
|
+
SVGSVGElement
|
|
42
|
+
>,
|
|
43
|
+
'onChange' | 'type'
|
|
44
|
+
>
|
|
45
|
+
| Omit<
|
|
46
|
+
React.DetailedHTMLProps<
|
|
47
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
48
|
+
HTMLDivElement
|
|
49
|
+
>,
|
|
50
|
+
'onChange'
|
|
51
|
+
>
|
|
40
52
|
);
|
|
41
53
|
|
|
42
54
|
declare const Clock: React.FC<ClockExtendedProps>;
|
|
@@ -5,7 +5,10 @@ export interface CollapsibleProps {
|
|
|
5
5
|
direction?: 'horizontal' | 'vertical';
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
type divProps =
|
|
8
|
+
type divProps = React.DetailedHTMLProps<
|
|
9
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
10
|
+
HTMLDivElement
|
|
11
|
+
>;
|
|
9
12
|
|
|
10
13
|
export interface CollapsibleExtendedProps extends CollapsibleProps, divProps {}
|
|
11
14
|
|
|
@@ -125,7 +125,10 @@ export interface DataProps {
|
|
|
125
125
|
// onDeleteView?: (string) => void;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
type divProps = Omit<
|
|
128
|
+
type divProps = Omit<
|
|
129
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
130
|
+
'onClick'
|
|
131
|
+
>;
|
|
129
132
|
|
|
130
133
|
export interface DataExtendedProps extends BoxProps, DataProps, divProps {}
|
|
131
134
|
|
|
@@ -18,7 +18,10 @@ export interface DataFilterProps {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
type divProps = Omit<
|
|
21
|
+
type divProps = Omit<
|
|
22
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
23
|
+
'onClick' | 'property'
|
|
24
|
+
>;
|
|
22
25
|
|
|
23
26
|
export interface DataFilterExtendedProps
|
|
24
27
|
extends BoxProps,
|
|
@@ -10,7 +10,10 @@ export interface DataFiltersProps {
|
|
|
10
10
|
updateOn?: 'change' | 'submit';
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
type divProps = Omit<
|
|
13
|
+
type divProps = Omit<
|
|
14
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
15
|
+
'onClick'
|
|
16
|
+
>;
|
|
14
17
|
|
|
15
18
|
export interface DataFiltersExtendedProps
|
|
16
19
|
extends BoxProps,
|
|
@@ -35,7 +35,6 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
35
35
|
columns = _ref.columns,
|
|
36
36
|
pinnedOffset = _ref.pinnedOffset,
|
|
37
37
|
primaryProperty = _ref.primaryProperty,
|
|
38
|
-
data = _ref.data,
|
|
39
38
|
verticalAlign = _ref.verticalAlign;
|
|
40
39
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledDataTableRow, {
|
|
41
40
|
ref: rowRef,
|
|
@@ -98,12 +97,19 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
98
97
|
context: isRowExpanded ? 'groupHeader' : 'body',
|
|
99
98
|
expanded: isRowExpanded,
|
|
100
99
|
onToggle: function onToggle() {
|
|
100
|
+
var nextRowExpand;
|
|
101
|
+
var rowKey = primaryValue || index;
|
|
101
102
|
if (isRowExpanded) {
|
|
102
|
-
|
|
103
|
-
return s !==
|
|
104
|
-
})
|
|
103
|
+
nextRowExpand = rowExpand.filter(function (s) {
|
|
104
|
+
return s !== rowKey;
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
nextRowExpand = [].concat(rowExpand, [rowKey]);
|
|
108
|
+
}
|
|
109
|
+
if (rowDetails.onExpand) {
|
|
110
|
+
rowDetails.onExpand(nextRowExpand, datum);
|
|
105
111
|
} else {
|
|
106
|
-
setRowExpand(
|
|
112
|
+
setRowExpand(nextRowExpand);
|
|
107
113
|
}
|
|
108
114
|
},
|
|
109
115
|
pad: cellProps.pad,
|
|
@@ -127,7 +133,7 @@ var Row = /*#__PURE__*/memo(function (_ref) {
|
|
|
127
133
|
key: index.toString() + "_expand"
|
|
128
134
|
}, (selected || onSelect) && /*#__PURE__*/React.createElement(TableCell, null), /*#__PURE__*/React.createElement(TableCell, {
|
|
129
135
|
colSpan: columns.length + 1
|
|
130
|
-
}, rowDetails(
|
|
136
|
+
}, rowDetails.render ? rowDetails.render(datum) : rowDetails(datum))));
|
|
131
137
|
});
|
|
132
138
|
var Body = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
133
139
|
var _ref3;
|
|
@@ -245,7 +251,7 @@ var Body = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
245
251
|
var primaryValue = primaryProperty ? datumValue(datum, primaryProperty) : undefined;
|
|
246
252
|
var isSelected = selected && selected.includes(primaryValue);
|
|
247
253
|
var isDisabled = disabled && disabled.includes(primaryValue);
|
|
248
|
-
var isRowExpanded = rowExpand && rowExpand.includes(index);
|
|
254
|
+
var isRowExpanded = rowExpand && rowExpand.includes(primaryValue || index);
|
|
249
255
|
var cellProps = normalizeRowCellProps(rowProps, cellPropsProp, primaryValue, index);
|
|
250
256
|
return /*#__PURE__*/React.createElement(Row, {
|
|
251
257
|
key: primaryValue != null ? primaryValue : index,
|
|
@@ -184,9 +184,14 @@ var DataTable = function DataTable(_ref) {
|
|
|
184
184
|
setSelectedDataContext(select.length);
|
|
185
185
|
}
|
|
186
186
|
}, [select, setSelectedDataContext]);
|
|
187
|
-
var _useState8 = useState([]),
|
|
187
|
+
var _useState8 = useState((rowDetails == null ? void 0 : rowDetails.expand) || []),
|
|
188
188
|
rowExpand = _useState8[0],
|
|
189
189
|
setRowExpand = _useState8[1];
|
|
190
|
+
useEffect(function () {
|
|
191
|
+
if (rowDetails != null && rowDetails.expand) {
|
|
192
|
+
setRowExpand(rowDetails.expand);
|
|
193
|
+
}
|
|
194
|
+
}, [rowDetails == null ? void 0 : rowDetails.expand]);
|
|
190
195
|
|
|
191
196
|
// any customized column widths
|
|
192
197
|
var _useState9 = useState({}),
|
|
@@ -99,7 +99,13 @@ export interface DataTableProps<TRowType = any> {
|
|
|
99
99
|
pad?: PadType;
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
|
-
rowDetails?:
|
|
102
|
+
rowDetails?:
|
|
103
|
+
| ((row: TRowType) => React.ReactNode)
|
|
104
|
+
| {
|
|
105
|
+
render: (row: TRowType) => React.ReactNode;
|
|
106
|
+
expand?: (string | number)[];
|
|
107
|
+
onExpand?: (expandedKeys: (string | number)[], datum: TRowType) => void;
|
|
108
|
+
};
|
|
103
109
|
show?: number | { page?: number };
|
|
104
110
|
size?: 'small' | 'medium' | 'large' | 'xlarge' | string;
|
|
105
111
|
|
|
@@ -152,7 +158,10 @@ export interface DataTableProps<TRowType = any> {
|
|
|
152
158
|
export interface DataTableExtendedProps<TRowType = any>
|
|
153
159
|
extends DataTableProps<TRowType>,
|
|
154
160
|
Omit<
|
|
155
|
-
|
|
161
|
+
React.DetailedHTMLProps<
|
|
162
|
+
React.HTMLAttributes<HTMLTableElement>,
|
|
163
|
+
HTMLTableElement
|
|
164
|
+
>,
|
|
156
165
|
'onSelect' | 'placeholder' | 'border'
|
|
157
166
|
> {}
|
|
158
167
|
|
|
@@ -73,7 +73,11 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
73
73
|
onSelect: PropTypes.func
|
|
74
74
|
})]),
|
|
75
75
|
onClickRow: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOf(['select'])]),
|
|
76
|
-
rowDetails: PropTypes.func,
|
|
76
|
+
rowDetails: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
77
|
+
render: PropTypes.func.isRequired,
|
|
78
|
+
expand: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
79
|
+
onExpand: PropTypes.func
|
|
80
|
+
})]),
|
|
77
81
|
onMore: PropTypes.func,
|
|
78
82
|
onSearch: PropTypes.func,
|
|
79
83
|
onSelect: PropTypes.func,
|
|
@@ -1,80 +1,186 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
2
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
3
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
4
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { Box, Data, DataTable, NameValueList, NameValuePair, Pagination, Text } from 'grommet';
|
|
4
6
|
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
7
|
+
// Uses the StarWars API for starships, see https://swapi.dev
|
|
8
|
+
|
|
9
|
+
var step = 10; // default for https://swapi.dev
|
|
10
|
+
|
|
11
|
+
var fetchData = /*#__PURE__*/function () {
|
|
12
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(view, signal) {
|
|
13
|
+
var params, url;
|
|
14
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
|
+
while (1) switch (_context.prev = _context.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
params = {};
|
|
18
|
+
if (view.search) params.search = view.search;
|
|
19
|
+
if (view.page) params.page = view.page;
|
|
20
|
+
url = "https://swapi.dev/api/starships?" + Object.keys(params).map(function (k) {
|
|
21
|
+
return k + "=" + params[k];
|
|
22
|
+
}).join('&');
|
|
23
|
+
return _context.abrupt("return", fetch(url, {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
headers: {
|
|
26
|
+
'Content-Type': 'application/json'
|
|
27
|
+
},
|
|
28
|
+
signal: signal
|
|
29
|
+
}).then(function (response) {
|
|
30
|
+
return response.json();
|
|
31
|
+
})["catch"](function (err) {
|
|
32
|
+
if (err.name !== 'AbortError') throw err;
|
|
33
|
+
return {};
|
|
34
|
+
}));
|
|
35
|
+
case 5:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context.stop();
|
|
38
|
+
}
|
|
39
|
+
}, _callee);
|
|
40
|
+
}));
|
|
41
|
+
return function fetchData(_x, _x2) {
|
|
42
|
+
return _ref.apply(this, arguments);
|
|
32
43
|
};
|
|
44
|
+
}();
|
|
45
|
+
var ShipProperties = function ShipProperties(_ref2) {
|
|
46
|
+
var ship = _ref2.ship;
|
|
47
|
+
return /*#__PURE__*/React.createElement(NameValueList, {
|
|
48
|
+
pairProps: {
|
|
49
|
+
direction: 'column'
|
|
50
|
+
},
|
|
51
|
+
valueProps: {
|
|
52
|
+
width: 'xsmall'
|
|
53
|
+
},
|
|
54
|
+
layout: "grid",
|
|
55
|
+
pad: {
|
|
56
|
+
left: 'large',
|
|
57
|
+
bottom: 'small'
|
|
58
|
+
},
|
|
59
|
+
gap: {
|
|
60
|
+
row: 'xsmall',
|
|
61
|
+
column: 'large'
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/React.createElement(NameValuePair, {
|
|
64
|
+
name: /*#__PURE__*/React.createElement(Text, {
|
|
65
|
+
size: "small",
|
|
66
|
+
weight: "bold"
|
|
67
|
+
}, "Name")
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
69
|
+
size: "xsmall"
|
|
70
|
+
}, ship.name)), /*#__PURE__*/React.createElement(NameValuePair, {
|
|
71
|
+
name: /*#__PURE__*/React.createElement(Text, {
|
|
72
|
+
size: "small",
|
|
73
|
+
weight: "bold"
|
|
74
|
+
}, "Model")
|
|
75
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
76
|
+
size: "xsmall"
|
|
77
|
+
}, ship.model)), /*#__PURE__*/React.createElement(NameValuePair, {
|
|
78
|
+
name: /*#__PURE__*/React.createElement(Text, {
|
|
79
|
+
size: "small",
|
|
80
|
+
weight: "bold"
|
|
81
|
+
}, "Manufacturer")
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
83
|
+
size: "xsmall"
|
|
84
|
+
}, ship.manufacturer)), /*#__PURE__*/React.createElement(NameValuePair, {
|
|
85
|
+
name: /*#__PURE__*/React.createElement(Text, {
|
|
86
|
+
size: "small",
|
|
87
|
+
weight: "bold"
|
|
88
|
+
}, "Passengers")
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
90
|
+
size: "xsmall"
|
|
91
|
+
}, ship.passengers)));
|
|
92
|
+
};
|
|
93
|
+
export var RowDetails = function RowDetails() {
|
|
94
|
+
var _useState = useState({}),
|
|
95
|
+
result = _useState[0],
|
|
96
|
+
setResult = _useState[1];
|
|
97
|
+
var _useState2 = useState(0),
|
|
98
|
+
total = _useState2[0],
|
|
99
|
+
setTotal = _useState2[1];
|
|
100
|
+
var _useState3 = useState({
|
|
101
|
+
search: '',
|
|
102
|
+
step: step
|
|
103
|
+
}),
|
|
104
|
+
view = _useState3[0],
|
|
105
|
+
setView = _useState3[1];
|
|
106
|
+
var abortRef = useRef();
|
|
107
|
+
var _useState4 = useState(['Y-wing']),
|
|
108
|
+
expand = _useState4[0],
|
|
109
|
+
setExpand = _useState4[1];
|
|
110
|
+
useEffect(function () {
|
|
111
|
+
var _abortRef$current;
|
|
112
|
+
// This API is a bit slow, abort any uncompleted requests.
|
|
113
|
+
abortRef == null || (_abortRef$current = abortRef.current) == null || _abortRef$current.abort();
|
|
114
|
+
abortRef.current = new AbortController();
|
|
115
|
+
fetchData(view, abortRef.current.signal).then(function (_ref3) {
|
|
116
|
+
var count = _ref3.count,
|
|
117
|
+
results = _ref3.results;
|
|
118
|
+
if (results) {
|
|
119
|
+
// The API doesn't provide a non-filtered total, so we rely on the
|
|
120
|
+
// first call having no filtering telling us the total.
|
|
121
|
+
setTotal(function (prevTotal) {
|
|
122
|
+
return Math.max(prevTotal, count);
|
|
123
|
+
});
|
|
124
|
+
setResult({
|
|
125
|
+
data: results,
|
|
126
|
+
filteredTotal: count
|
|
127
|
+
});
|
|
128
|
+
abortRef.current = undefined;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}, [view]);
|
|
132
|
+
var rowDetails = useMemo(function () {
|
|
133
|
+
return {
|
|
134
|
+
render: function render(row) {
|
|
135
|
+
return /*#__PURE__*/React.createElement(ShipProperties, {
|
|
136
|
+
ship: row
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
expand: expand,
|
|
140
|
+
onExpand: function onExpand(nextExpand /* , datum */) {
|
|
141
|
+
return setExpand(nextExpand);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}, [expand]);
|
|
33
145
|
return (
|
|
34
146
|
/*#__PURE__*/
|
|
35
147
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
36
|
-
// <Grommet theme={
|
|
148
|
+
// <Grommet theme={...}>
|
|
37
149
|
React.createElement(Box, {
|
|
38
|
-
|
|
39
|
-
|
|
150
|
+
skeleton: !result.data,
|
|
151
|
+
width: "large",
|
|
152
|
+
pad: "large"
|
|
153
|
+
}, /*#__PURE__*/React.createElement(Data, {
|
|
154
|
+
data: result.data,
|
|
155
|
+
total: total,
|
|
156
|
+
filteredTotal: result.filteredTotal,
|
|
157
|
+
view: view,
|
|
158
|
+
onView: setView,
|
|
159
|
+
toolbar: "search"
|
|
40
160
|
}, /*#__PURE__*/React.createElement(DataTable, {
|
|
41
161
|
columns: [{
|
|
42
|
-
property: '
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
header: /*#__PURE__*/React.createElement(CheckBox, {
|
|
55
|
-
checked: checked.length === DATA.length,
|
|
56
|
-
indeterminate: checked.length > 0 && checked.length < DATA.length,
|
|
57
|
-
onChange: onCheckAll,
|
|
58
|
-
"aria-label": "header checkbox"
|
|
59
|
-
}),
|
|
60
|
-
sortable: false
|
|
61
|
-
}].concat(controlledColumns).map(function (col) {
|
|
62
|
-
return _extends({}, col);
|
|
63
|
-
}),
|
|
64
|
-
data: DATA,
|
|
65
|
-
sortable: true,
|
|
66
|
-
rowDetails: function rowDetails(row) {
|
|
67
|
-
if (row.name === 'Alan') {
|
|
68
|
-
return /*#__PURE__*/React.createElement(Box, null, " ", row.name, " ");
|
|
69
|
-
}
|
|
70
|
-
return /*#__PURE__*/React.createElement(Box, null, "Blah ", row.name, " ");
|
|
71
|
-
},
|
|
72
|
-
size: "medium"
|
|
73
|
-
}))
|
|
162
|
+
property: 'name',
|
|
163
|
+
header: 'Name',
|
|
164
|
+
primary: true
|
|
165
|
+
}, {
|
|
166
|
+
property: 'starship_class',
|
|
167
|
+
header: 'Class'
|
|
168
|
+
}],
|
|
169
|
+
rowDetails: rowDetails
|
|
170
|
+
}), /*#__PURE__*/React.createElement(Pagination, null)))
|
|
171
|
+
|
|
74
172
|
// </Grommet>
|
|
75
173
|
);
|
|
76
174
|
};
|
|
77
|
-
|
|
175
|
+
RowDetails.storyName = 'rowDetails';
|
|
176
|
+
RowDetails.parameters = {
|
|
177
|
+
chromatic: {
|
|
178
|
+
disable: true
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
RowDetails.args = {
|
|
182
|
+
full: true
|
|
183
|
+
};
|
|
78
184
|
export default {
|
|
79
185
|
title: 'Visualizations/DataTable/rowDetails'
|
|
80
186
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { Box, DataTable, Meter, Text } from 'grommet';
|
|
4
4
|
|
|
@@ -148,8 +148,8 @@ const DATA: RowType[] = [
|
|
|
148
148
|
|
|
149
149
|
export const OnSelectDataTable = () => {
|
|
150
150
|
// Type arguments can only be used in TypeScript files.
|
|
151
|
-
// Remove <
|
|
152
|
-
const [select, setSelect] = useState<
|
|
151
|
+
// Remove <(number | string)[]> if you are not using Typescript.
|
|
152
|
+
const [select, setSelect] = useState<(number | string)[]>([]);
|
|
153
153
|
|
|
154
154
|
return (
|
|
155
155
|
// Uncomment <Grommet> lines when using outside of storybook
|
|
@@ -3,7 +3,10 @@ import { BoxProps } from '../Box/index';
|
|
|
3
3
|
|
|
4
4
|
export interface DataViewProps {}
|
|
5
5
|
|
|
6
|
-
type divProps = Omit<
|
|
6
|
+
type divProps = Omit<
|
|
7
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
8
|
+
'onClick' | 'property'
|
|
9
|
+
>;
|
|
7
10
|
|
|
8
11
|
export interface DataViewExtendedProps
|
|
9
12
|
extends BoxProps,
|
|
@@ -41,7 +41,10 @@ export interface DateInputProps {
|
|
|
41
41
|
export interface DateInputExtendedProps
|
|
42
42
|
extends DateInputProps,
|
|
43
43
|
Omit<
|
|
44
|
-
|
|
44
|
+
React.DetailedHTMLProps<
|
|
45
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
46
|
+
HTMLInputElement
|
|
47
|
+
>,
|
|
45
48
|
'defaultValue' | 'onChange' | 'value' | 'size'
|
|
46
49
|
> {}
|
|
47
50
|
|
|
@@ -37,7 +37,10 @@ export interface DiagramProps {
|
|
|
37
37
|
}[];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
type divProps =
|
|
40
|
+
type divProps = React.DetailedHTMLProps<
|
|
41
|
+
React.SVGAttributes<SVGSVGElement>,
|
|
42
|
+
SVGSVGElement
|
|
43
|
+
>;
|
|
41
44
|
|
|
42
45
|
export interface DiagramExtendedProps extends DiagramProps, divProps {}
|
|
43
46
|
|
|
@@ -23,7 +23,10 @@ export interface DistributionProps {
|
|
|
23
23
|
}[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
type divProps = Omit<
|
|
26
|
+
type divProps = Omit<
|
|
27
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
28
|
+
'children'
|
|
29
|
+
>;
|
|
27
30
|
|
|
28
31
|
export interface DistributionExtendedProps
|
|
29
32
|
extends DistributionProps,
|
|
@@ -17,6 +17,8 @@ var dropKeyFrames = keyframes(["0%{opacity:0.5;transform:scale(0.8);}100%{opacit
|
|
|
17
17
|
|
|
18
18
|
// The desired margin may be adjusted depending on drops alignment
|
|
19
19
|
var marginStyle = function marginStyle(theme, align, data, responsive, marginProp) {
|
|
20
|
+
// NOTE: If marginProp is passed, it overrides the alignment-aware
|
|
21
|
+
// margin logic and uses the provided value instead.
|
|
20
22
|
var margin = theme.global.edgeSize[data] || data;
|
|
21
23
|
var adjustedMargin = {};
|
|
22
24
|
// if user provides CSS string such as '50px 12px', apply that always
|
|
@@ -28,7 +30,7 @@ var marginStyle = function marginStyle(theme, align, data, responsive, marginPro
|
|
|
28
30
|
} else {
|
|
29
31
|
return edgeStyle('margin', marginProp || theme.global.drop.margin, responsive, theme.global.edgeSize.responsiveBreakpoint, theme);
|
|
30
32
|
}
|
|
31
|
-
return edgeStyle('margin', adjustedMargin, responsive, theme.global.edgeSize.responsiveBreakpoint, theme);
|
|
33
|
+
return edgeStyle('margin', marginProp || adjustedMargin, responsive, theme.global.edgeSize.responsiveBreakpoint, theme);
|
|
32
34
|
};
|
|
33
35
|
var StyledDrop = styled(Box).withConfig({
|
|
34
36
|
displayName: "StyledDrop",
|
|
@@ -19,12 +19,16 @@ export interface DropProps extends Omit<BoxProps, 'align'> {
|
|
|
19
19
|
plain?: boolean;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
type divProps = Omit<
|
|
22
|
+
type divProps = Omit<
|
|
23
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
24
|
+
keyof DropProps
|
|
25
|
+
>;
|
|
23
26
|
|
|
24
27
|
export interface DropExtendedProps extends DropProps, divProps {}
|
|
25
28
|
|
|
26
29
|
// Keep type alias for backwards compatibility.
|
|
27
|
-
export type DropType = DropProps &
|
|
30
|
+
export type DropType = DropProps &
|
|
31
|
+
React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
|
|
28
32
|
|
|
29
33
|
declare const Drop: React.FC<DropExtendedProps>;
|
|
30
34
|
|
|
@@ -18,7 +18,14 @@ export interface DropButtonProps {
|
|
|
18
18
|
open?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
type buttonProps = ButtonProps &
|
|
21
|
+
type buttonProps = ButtonProps &
|
|
22
|
+
Omit<
|
|
23
|
+
React.DetailedHTMLProps<
|
|
24
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
25
|
+
HTMLButtonElement
|
|
26
|
+
>,
|
|
27
|
+
'color'
|
|
28
|
+
>;
|
|
22
29
|
|
|
23
30
|
export interface DropButtonExtendedProps extends DropButtonProps, buttonProps {}
|
|
24
31
|
|