@7shifts/sous-chef 1.2.0 → 1.3.1
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 +23 -1
- package/dist/actions/PaginationControls/PaginationControls.d.ts +1 -1
- package/dist/core/DataTable/DataTable.d.ts +29 -0
- package/dist/core/DataTable/DataTable.js.flow +59 -0
- package/dist/core/DataTable/DataTableCell/DataTableCell.d.ts +7 -0
- package/dist/core/DataTable/DataTableCell/index.d.ts +1 -0
- package/dist/core/DataTable/DataTableContext.d.ts +11 -0
- package/dist/core/DataTable/DataTableContext.js.flow +15 -0
- package/dist/core/DataTable/DataTableHeader.d.ts +9 -0
- package/dist/core/DataTable/index.d.ts +1 -0
- package/dist/core/DataTable/index.js.flow +8 -0
- package/dist/core/DataTable/types.d.ts +27 -0
- package/dist/core/DataTable/types.js.flow +31 -0
- package/dist/core/DataTableCell/DataTableCell.js.flow +16 -0
- package/dist/core/DataTableCell/index.js.flow +8 -0
- package/dist/core/DataTableEditableCell/DataTableEditableCell.d.ts +21 -0
- package/dist/core/DataTableEditableCell/DataTableEditableCell.js.flow +26 -0
- package/dist/core/DataTableEditableCell/index.d.ts +1 -0
- package/dist/core/DataTableEditableCell/index.js.flow +8 -0
- package/dist/core/DataTableRow/DataTableRow.d.ts +11 -0
- package/dist/core/DataTableRow/DataTableRow.js.flow +17 -0
- package/dist/core/DataTableRow/index.d.ts +1 -0
- package/dist/core/DataTableRow/index.js.flow +8 -0
- package/dist/core/ResourceTable/ResourceTable.d.ts +3 -0
- package/dist/core/ResourceTable/ResourceTableHeader.d.ts +3 -0
- package/dist/core/ResourceTableRow/ResourceTableRow.d.ts +3 -0
- package/dist/core/index.d.ts +6 -1
- package/dist/forms/hooks/useFieldControllers.d.ts +2 -1
- package/dist/index.css +223 -51
- package/dist/index.js +652 -239
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +649 -240
- package/dist/index.modern.js.map +1 -1
- package/dist/media/Avatar/AvatarImage/AvatarImage.d.ts +1 -0
- package/dist/overlay/Modal/Modal.d.ts +1 -1
- package/dist/overlay/Modal/Modal.js.flow +3 -1
- package/dist/overlay/Modal/ModalFooter/ModalFooter.js.flow +1 -1
- package/dist/utils/formik.d.ts +5 -0
- package/dist/utils/string.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
##
|
|
1
|
+
## 1.3.0 (September 27th, 2021)
|
|
2
|
+
|
|
3
|
+
### New components
|
|
4
|
+
|
|
5
|
+
- DataTable ([#50](https://github.com/7shifts/sous-chef/pull/50)) - And added editable functionality ([#54](https://github.com/7shifts/sous-chef/pull/54))
|
|
6
|
+
|
|
7
|
+
## 1.2.2 (September 24rd, 2021)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
- TextField: Removed the support for Formik `Field` as it was a breaking change in the `TextField` component ([#56](https://github.com/7shifts/sous-chef/pull/56))
|
|
12
|
+
|
|
13
|
+
## 1.2.1 (September 23rd, 2021)
|
|
14
|
+
|
|
15
|
+
### Bug fixes
|
|
16
|
+
|
|
17
|
+
- Modal: When a scroll was showing, the top content was getting cut off on the top. Also updated the flow type ([#55](https://github.com/7shifts/sous-chef/pull/55))
|
|
18
|
+
|
|
19
|
+
### Enhancements
|
|
20
|
+
|
|
21
|
+
- Form: Updated the field components to work with formik components such as `Field` and `FieldArray`. It also suports now dynamic fields ([#53](https://github.com/7shifts/sous-chef/pull/53))
|
|
22
|
+
|
|
23
|
+
## 1.2.0 (September 15th, 2021)
|
|
2
24
|
|
|
3
25
|
### New components
|
|
4
26
|
|
|
@@ -6,7 +6,7 @@ declare type Props = {
|
|
|
6
6
|
onNextClick: () => void;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* `PaginationControls` are two buttons side by side
|
|
9
|
+
* `PaginationControls` are two buttons side by side.
|
|
10
10
|
*/
|
|
11
11
|
declare const PaginationControls: React.FC<Props>;
|
|
12
12
|
export default PaginationControls;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, CustomComponent, Item, Sort } from './types';
|
|
3
|
+
declare type Props<T> = {
|
|
4
|
+
/** Each element represents a row and each key of the object represents a column */
|
|
5
|
+
items: Item<T>[];
|
|
6
|
+
/** For each column element, the `name` property should match the key on `items` */
|
|
7
|
+
columns: Column[];
|
|
8
|
+
/** A custom component for customizing how the each item is rendered. It pass as props: `item`, `index`, `columnSizes` and `columns` */
|
|
9
|
+
itemComponent?: React.ComponentType<CustomComponent<T>>;
|
|
10
|
+
maxHeight?: number;
|
|
11
|
+
/** Used for pagination */
|
|
12
|
+
hasPrevious?: boolean;
|
|
13
|
+
/** Used for pagination */
|
|
14
|
+
hasNext?: boolean;
|
|
15
|
+
/** Used for pagination */
|
|
16
|
+
onPreviousClick?: () => void;
|
|
17
|
+
/** Used for pagination */
|
|
18
|
+
onNextClick?: () => void;
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
/** It is fired when a sorted column is clicked to be sorted */
|
|
21
|
+
onSort?: (sort: Sort) => void;
|
|
22
|
+
showActionMenu?: boolean;
|
|
23
|
+
/** Will render footer component if not null - expects a custom RowItem component */
|
|
24
|
+
footerComponent?: React.ReactNode;
|
|
25
|
+
/** Will render vertical borders between columns if true */
|
|
26
|
+
hasVerticalBorders?: boolean;
|
|
27
|
+
};
|
|
28
|
+
declare const DataTable: <T extends unknown>({ items, columns, itemComponent, maxHeight, hasPrevious, hasNext, onPreviousClick, onNextClick, onSort, isLoading, showActionMenu, footerComponent, hasVerticalBorders }: Props<T>) => JSX.Element;
|
|
29
|
+
export default DataTable;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for DataTable
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.14.1
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import type { Column, CustomComponent, Item, Sort } from './types';
|
|
10
|
+
declare type Props<T> = {
|
|
11
|
+
/**
|
|
12
|
+
* Each element represents a row and each key of the object represents a column
|
|
13
|
+
*/
|
|
14
|
+
items: Item<T>[],
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* For each column element, the `name` property should match the key on `items`
|
|
18
|
+
*/
|
|
19
|
+
columns: Column[],
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A custom component for customizing how the each item is rendered. It pass as props: `item`, `index`, `columnSizes` and `columns`
|
|
23
|
+
*/
|
|
24
|
+
itemComponent?: React$ComponentType<CustomComponent<T>>,
|
|
25
|
+
maxHeight?: number,
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Used for pagination
|
|
29
|
+
*/
|
|
30
|
+
hasPrevious?: boolean,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Used for pagination
|
|
34
|
+
*/
|
|
35
|
+
hasNext?: boolean,
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Used for pagination
|
|
39
|
+
*/
|
|
40
|
+
onPreviousClick?: () => void,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Used for pagination
|
|
44
|
+
*/
|
|
45
|
+
onNextClick?: () => void,
|
|
46
|
+
isLoading?: boolean,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* It is fired when a sorted column is clicked to be sorted
|
|
50
|
+
*/
|
|
51
|
+
onSort?: (sort: Sort) => void,
|
|
52
|
+
showActionMenu?: boolean,
|
|
53
|
+
/** Will render footer component if not null - expects a custom RowItem component */
|
|
54
|
+
footerComponent?: React.ReactNode;
|
|
55
|
+
/** Will render vertical borders between columns if true */
|
|
56
|
+
hasVerticalBorders?: boolean
|
|
57
|
+
};
|
|
58
|
+
declare var DataTable: <T>(props: Props<T>) => React$Node;
|
|
59
|
+
declare export default typeof DataTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DataTableCell';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Column } from './types';
|
|
3
|
+
export declare type DataTableContextType = {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
showActionMenu?: boolean;
|
|
6
|
+
numberOfRows: number;
|
|
7
|
+
hasVerticalBorders?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const Context: import("react").Context<DataTableContextType>;
|
|
10
|
+
export declare const useDataTableContext: () => DataTableContextType;
|
|
11
|
+
export default Context;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for DataTableContext
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.14.1
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
export type DataTableContextType = {
|
|
10
|
+
columnSizes?: number[],
|
|
11
|
+
showActionMenu?: boolean,
|
|
12
|
+
};
|
|
13
|
+
declare var Context: React$Context<DataTableContextType>;
|
|
14
|
+
declare export var useDataTableContext: () => DataTableContextType;
|
|
15
|
+
declare export default typeof Context;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Column, Sort } from './types';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
columns: Column[];
|
|
5
|
+
onSort?: (sort: Sort) => void;
|
|
6
|
+
showActionMenu?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const DataTableHeader: React.FC<Props>;
|
|
9
|
+
export default DataTableHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DataTable';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type Column = {
|
|
3
|
+
name: string;
|
|
4
|
+
label?: React.ReactNode;
|
|
5
|
+
size?: number;
|
|
6
|
+
isSortable?: boolean;
|
|
7
|
+
currentSort?: SortDirection;
|
|
8
|
+
isRightAligned?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare type SortDirection = 'asc' | 'desc' | null;
|
|
11
|
+
export declare type Sort = {
|
|
12
|
+
columnName: string;
|
|
13
|
+
direction: SortDirection;
|
|
14
|
+
};
|
|
15
|
+
export declare type Item<T> = T | (T & {
|
|
16
|
+
actions?: Action[];
|
|
17
|
+
});
|
|
18
|
+
export declare type CustomComponent<T> = {
|
|
19
|
+
item: Item<T>;
|
|
20
|
+
index: number;
|
|
21
|
+
columnSizes?: number[];
|
|
22
|
+
columns?: Column[];
|
|
23
|
+
};
|
|
24
|
+
export declare type Action = {
|
|
25
|
+
label: React.ReactNode;
|
|
26
|
+
onAction: () => void;
|
|
27
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for types
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.14.1
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
export type Column = {
|
|
10
|
+
name: string,
|
|
11
|
+
label?: React$Node,
|
|
12
|
+
size?: number,
|
|
13
|
+
isSortable?: boolean,
|
|
14
|
+
currentSort?: SortDirection,
|
|
15
|
+
};
|
|
16
|
+
export type SortDirection = 'asc' | 'desc' | null;
|
|
17
|
+
export type Sort = {
|
|
18
|
+
columnName: string,
|
|
19
|
+
direction: SortDirection,
|
|
20
|
+
};
|
|
21
|
+
export type Item<T> = T | (T & { actions?: Action[] });
|
|
22
|
+
export type CustomComponent<T> = {
|
|
23
|
+
item: Item<T>,
|
|
24
|
+
index: number,
|
|
25
|
+
columnSizes?: number[],
|
|
26
|
+
columns?: Column[],
|
|
27
|
+
};
|
|
28
|
+
export type Action = {
|
|
29
|
+
label: React$Node,
|
|
30
|
+
onAction: () => void,
|
|
31
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for DataTableRow
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.14.1
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
declare type Props = {
|
|
9
|
+
value?: string,
|
|
10
|
+
/** Use a prefix for things like currency symbols (“$”, “¥”, “£”) or icons. */
|
|
11
|
+
prefix?: React.ReactNode,
|
|
12
|
+
/** Use suffix for things like units of measure (“in”, “cm”, ”hours”) or icons. */
|
|
13
|
+
suffix?: React.ReactNode
|
|
14
|
+
};
|
|
15
|
+
declare var DataTableCell: (props: Props) => React$Node;
|
|
16
|
+
declare export default typeof DataTableCell;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
name: string;
|
|
4
|
+
columnIndex: number;
|
|
5
|
+
rowIndex: number;
|
|
6
|
+
id?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
onChange?: (e: string) => void;
|
|
9
|
+
onBlur?: (e: string) => void;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
error?: string;
|
|
13
|
+
/** Use a prefix for things like currency symbols (“$”, “¥”, “£”) or icons. */
|
|
14
|
+
prefix?: React.ReactNode;
|
|
15
|
+
/** Use suffix for things like units of measure (“in”, “cm”, ”hours”) or icons. */
|
|
16
|
+
suffix?: React.ReactNode;
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
type?: 'text' | 'currency';
|
|
19
|
+
};
|
|
20
|
+
declare const DataTableEditableCell: ({ name, columnIndex, rowIndex, id: inputId, value, onChange, onBlur, placeholder, disabled, error, prefix, suffix, defaultValue, type }: Props) => JSX.Element;
|
|
21
|
+
export default DataTableEditableCell;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for DataTableRow
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.14.1
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
declare type Props = {
|
|
9
|
+
name: string,
|
|
10
|
+
columnIndex: number,
|
|
11
|
+
rowIndex: number,
|
|
12
|
+
id?: string,
|
|
13
|
+
value?: string,
|
|
14
|
+
onChange?: (e: string) => void,
|
|
15
|
+
onBlur?: (e: string) => void,
|
|
16
|
+
placeholder?: string,
|
|
17
|
+
disabled?: boolean,
|
|
18
|
+
error?: string,
|
|
19
|
+
/** Use a prefix for things like currency symbols (“$”, “¥”, “£”) or icons. */
|
|
20
|
+
prefix?: React.ReactNode,
|
|
21
|
+
/** Use suffix for things like units of measure (“in”, “cm”, ”hours”) or icons. */
|
|
22
|
+
suffix?: React.ReactNode,
|
|
23
|
+
defaultValue?: string
|
|
24
|
+
};
|
|
25
|
+
declare var DataTableEditableCell: (props: Props) => React$Node;
|
|
26
|
+
declare export default typeof DataTableEditableCell;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DataTableEditableCell';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Action } from '../DataTable/types';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
onClick?: () => void;
|
|
6
|
+
isSelected?: boolean;
|
|
7
|
+
actions?: Action[];
|
|
8
|
+
hasDefaultPadding?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const DataTableRow: React.FC<Props>;
|
|
11
|
+
export default DataTableRow;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flowtype definitions for DataTableRow
|
|
3
|
+
* Generated by Flowgen from a Typescript Definition
|
|
4
|
+
* Flowgen v1.14.1
|
|
5
|
+
* @flow
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import type { Action } from '../DataTable/types';
|
|
10
|
+
declare type Props = {
|
|
11
|
+
children: React$Node,
|
|
12
|
+
onClick?: () => void,
|
|
13
|
+
isSelected?: boolean,
|
|
14
|
+
actions?: Action[],
|
|
15
|
+
};
|
|
16
|
+
declare var DataTableRow: (props: Props) => React$Node;
|
|
17
|
+
declare export default typeof DataTableRow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './DataTableRow';
|
|
@@ -21,5 +21,8 @@ declare type Props<T> = {
|
|
|
21
21
|
onSort?: (sort: Sort) => void;
|
|
22
22
|
showActionMenu?: boolean;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated On v2.0 we introduced the `DataTable` that should be used for tabular data. This component will be removed on v3.0.
|
|
26
|
+
*/
|
|
24
27
|
declare const ResourceTable: <T extends unknown>({ items, columns, itemComponent, maxHeight, hasPrevious, hasNext, onPreviousClick, onNextClick, onSort, isLoading, showActionMenu }: Props<T>) => JSX.Element;
|
|
25
28
|
export default ResourceTable;
|
|
@@ -5,5 +5,8 @@ declare type Props = {
|
|
|
5
5
|
onSort?: (sort: Sort) => void;
|
|
6
6
|
showActionMenu?: boolean;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated On v2.0 we introduced the `DataTable` that should be used for tabular data. This component will be removed on v3.0.
|
|
10
|
+
*/
|
|
8
11
|
declare const ResourceTableHeader: React.FC<Props>;
|
|
9
12
|
export default ResourceTableHeader;
|
|
@@ -6,5 +6,8 @@ declare type Props = {
|
|
|
6
6
|
isSelected?: boolean;
|
|
7
7
|
actions?: Action[];
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated On v2.0 we introduced the `DataTable` that should be used for tabular data. This component will be removed on v3.0.
|
|
11
|
+
*/
|
|
9
12
|
declare const ResourceTableRow: React.FC<Props>;
|
|
10
13
|
export default ResourceTableRow;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import ResourceTable from './ResourceTable';
|
|
|
2
2
|
import ResourceTableRow from './ResourceTableRow';
|
|
3
3
|
import Inline from './Inline';
|
|
4
4
|
import Stack from './Stack';
|
|
5
|
-
|
|
5
|
+
import DataTable from './DataTable';
|
|
6
|
+
import DataTableRow from './DataTableRow';
|
|
7
|
+
import DataTableCell from './DataTable/DataTableCell/DataTableCell';
|
|
8
|
+
import DataTableEditableCell from './DataTableEditableCell';
|
|
9
|
+
export { ResourceTable, ResourceTableRow, Inline, Stack, DataTable, DataTableRow, DataTableCell, DataTableEditableCell };
|
|
6
10
|
export type { AlignItems, FlexWrap, JustifyContent } from './Flex/types';
|
|
7
11
|
export type { CustomComponent, Column, SortDirection, Sort, Action } from './ResourceTable/types';
|
|
12
|
+
export type { Column as DataTableColumn } from './DataTable/types';
|
|
@@ -14,6 +14,7 @@ declare type Props = {
|
|
|
14
14
|
onChange?: (e: string) => void;
|
|
15
15
|
onBlur?: (e: string) => void;
|
|
16
16
|
error?: string;
|
|
17
|
+
type?: 'text' | 'currency';
|
|
17
18
|
};
|
|
18
|
-
export declare const useFieldControllers: ({ name, id: inputId, value, onChange, onBlur, error }: Props) => FieldControls;
|
|
19
|
+
export declare const useFieldControllers: ({ name, id: inputId, value, onChange, onBlur, error, type }: Props) => FieldControls;
|
|
19
20
|
export {};
|