@7shifts/sous-chef 3.35.0 → 3.36.1-beta0

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 (65) hide show
  1. package/dist/core/DataTable/DataTable.d.ts +29 -0
  2. package/dist/core/DataTable/DataTableCell/DataTableCell.d.ts +7 -0
  3. package/dist/core/DataTable/DataTableCell/index.d.ts +1 -0
  4. package/dist/core/DataTable/DataTableContext.d.ts +11 -0
  5. package/dist/core/DataTable/DataTableHeader.d.ts +9 -0
  6. package/dist/core/DataTable/index.d.ts +1 -0
  7. package/dist/core/DataTable/types.d.ts +38 -0
  8. package/dist/core/DataTableEditableCell/DataTableEditableCell.d.ts +21 -0
  9. package/dist/core/DataTableEditableCell/index.d.ts +1 -0
  10. package/dist/core/DataTableRow/DataTableRow.d.ts +11 -0
  11. package/dist/core/DataTableRow/DataTableRowActions/DataTableRowActions.d.ts +6 -0
  12. package/dist/core/DataTableRow/DataTableRowActions/index.d.ts +1 -0
  13. package/dist/core/DataTableRow/index.d.ts +1 -0
  14. package/dist/core/Flex/Flex.d.ts +19 -0
  15. package/dist/core/Flex/index.d.ts +1 -0
  16. package/dist/core/Flex/types.d.ts +4 -0
  17. package/dist/core/Inline/Inline.d.ts +20 -0
  18. package/dist/core/Inline/index.d.ts +1 -0
  19. package/dist/core/ResourceTable/ResourceTable.d.ts +28 -0
  20. package/dist/core/ResourceTable/ResourceTableContext.d.ts +8 -0
  21. package/dist/core/ResourceTable/ResourceTableHeader.d.ts +12 -0
  22. package/dist/core/ResourceTable/index.d.ts +1 -0
  23. package/dist/core/ResourceTable/types.d.ts +26 -0
  24. package/dist/core/ResourceTableRow/ResourceTableRow.d.ts +13 -0
  25. package/dist/core/ResourceTableRow/index.d.ts +1 -0
  26. package/dist/core/SousChefProvider/SousChefProvider.d.ts +3 -1
  27. package/dist/core/Stack/Stack.d.ts +19 -0
  28. package/dist/core/Stack/index.d.ts +1 -0
  29. package/dist/forms/DatePickerCalendar/DatePickerCalendar.d.ts +15 -0
  30. package/dist/forms/DatePickerCalendar/index.d.ts +1 -0
  31. package/dist/forms/MultiSelectField/CustomOption/CustomOption.d.ts +7 -0
  32. package/dist/forms/MultiSelectField/CustomOption/index.d.ts +1 -0
  33. package/dist/forms/TimeField/TimeFieldDropdown/TimeFieldDropdown.d.ts +2 -1
  34. package/dist/foundation/colors.d.ts +53 -0
  35. package/dist/i18n/TranslationsContext.d.ts +7 -0
  36. package/dist/i18n/locales/en.json +37 -0
  37. package/dist/i18n/locales/es.json +37 -0
  38. package/dist/i18n/locales/fr.json +37 -0
  39. package/dist/i18n/types.d.ts +3 -0
  40. package/dist/i18n/useTranslation.d.ts +2 -0
  41. package/dist/icons/components/IconCoffeeCup.d.ts +12 -0
  42. package/dist/index.js +124 -77
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.modern.js +120 -73
  45. package/dist/index.modern.js.map +1 -1
  46. package/dist/lists/DataTable/DataTableCell/DataTableCell.d.ts +7 -0
  47. package/dist/lists/DataTable/DataTableCell/index.d.ts +1 -0
  48. package/dist/lists/DataTable/DataTableHeader.d.ts +9 -0
  49. package/dist/lists/ResourceTable/ResourceTable.d.ts +28 -0
  50. package/dist/lists/ResourceTable/ResourceTableContext.d.ts +8 -0
  51. package/dist/lists/ResourceTable/ResourceTableHeader.d.ts +12 -0
  52. package/dist/lists/ResourceTable/index.d.ts +1 -0
  53. package/dist/lists/ResourceTable/types.d.ts +26 -0
  54. package/dist/lists/ResourceTableRow/ResourceTableRow.d.ts +13 -0
  55. package/dist/lists/ResourceTableRow/index.d.ts +1 -0
  56. package/dist/overlay/Menu/Menu.d.ts +9 -0
  57. package/dist/overlay/Menu/MenuButton.d.ts +8 -0
  58. package/dist/overlay/Menu/MenuContext.d.ts +9 -0
  59. package/dist/overlay/Menu/MenuItem.d.ts +7 -0
  60. package/dist/overlay/Menu/MenuList.d.ts +6 -0
  61. package/dist/overlay/Menu/index.d.ts +1 -0
  62. package/dist/overlay/Menu/types.d.ts +6 -0
  63. package/dist/utils/date.d.ts +9 -2
  64. package/dist/utils/i18n.d.ts +1 -1
  65. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ children: React.ReactNode;
4
+ columnIndex: number;
5
+ };
6
+ declare const DataTableCell: ({ children, columnIndex }: Props) => JSX.Element;
7
+ export default DataTableCell;
@@ -0,0 +1 @@
1
+ export * from './DataTableCell';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { DataTableColumn, DataTableSort } from './types';
3
+ declare type Props = {
4
+ columns: DataTableColumn[];
5
+ onSort?: (sort: DataTableSort) => void;
6
+ showActionMenu?: boolean;
7
+ };
8
+ declare const DataTableHeader: React.FC<Props>;
9
+ export default DataTableHeader;
@@ -0,0 +1,28 @@
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
+ };
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
+ */
27
+ declare const ResourceTable: <T extends unknown>({ items, columns, itemComponent, maxHeight, hasPrevious, hasNext, onPreviousClick, onNextClick, onSort, isLoading, showActionMenu }: Props<T>) => JSX.Element;
28
+ export default ResourceTable;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare type ResourceTableContextType = {
3
+ columnSizes?: number[];
4
+ showActionMenu?: boolean;
5
+ };
6
+ declare const Context: import("react").Context<ResourceTableContextType>;
7
+ export declare const useResourceTableContext: () => ResourceTableContextType;
8
+ export default Context;
@@ -0,0 +1,12 @@
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
+ /**
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
+ */
11
+ declare const ResourceTableHeader: React.FC<Props>;
12
+ export default ResourceTableHeader;
@@ -0,0 +1 @@
1
+ export { default } from './ResourceTable';
@@ -0,0 +1,26 @@
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
+ };
9
+ export declare type SortDirection = 'asc' | 'desc' | null;
10
+ export declare type Sort = {
11
+ columnName: string;
12
+ direction: SortDirection;
13
+ };
14
+ export declare type Item<T> = T | (T & {
15
+ actions?: Action[];
16
+ });
17
+ export declare type CustomComponent<T> = {
18
+ item: Item<T>;
19
+ index: number;
20
+ columnSizes?: number[];
21
+ columns?: Column[];
22
+ };
23
+ export declare type Action = {
24
+ label: React.ReactNode;
25
+ onAction: () => void;
26
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { Action } from '../ResourceTable/types';
3
+ declare type Props = {
4
+ children: React.ReactNode;
5
+ onClick?: () => void;
6
+ isSelected?: boolean;
7
+ actions?: Action[];
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
+ */
12
+ declare const ResourceTableRow: React.FC<Props>;
13
+ export default ResourceTableRow;
@@ -0,0 +1 @@
1
+ export { default } from './ResourceTableRow';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ children: React.ReactNode;
4
+ };
5
+ /**
6
+ * STATUS: IN DRAFT (Don't use this component yet)
7
+ */
8
+ declare const Menu: React.FC<Props>;
9
+ export default Menu;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ declare type ButtonTheme = 'default' | 'primary' | 'danger' | 'upsell' | 'marketing' | 'hollow' | 'link-primary' | 'link-danger' | 'link-upsell' | 'link-toolbar' | 'link-contrast' | 'link-icon';
3
+ declare type Props = {
4
+ children: React.ReactNode;
5
+ theme?: ButtonTheme;
6
+ };
7
+ declare const MenuButton: React.FC<Props>;
8
+ export default MenuButton;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export declare type MenuContextType = {
3
+ onToggleMenu: () => void;
4
+ isOpen: boolean;
5
+ triggerRef: any;
6
+ };
7
+ declare const MenuContext: React.Context<MenuContextType>;
8
+ export declare const useMenuContext: () => MenuContextType;
9
+ export default MenuContext;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ onClick: (e: React.MouseEvent | React.KeyboardEvent) => void;
4
+ children: React.ReactNode;
5
+ };
6
+ declare const MenuItem: React.FC<Props>;
7
+ export default MenuItem;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare type Props = {
3
+ children: React.ReactNode;
4
+ };
5
+ declare const MenuList: React.FC<Props>;
6
+ export default MenuList;
@@ -0,0 +1 @@
1
+ export { default } from './Menu';
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare type MenuAction = {
3
+ action: string;
4
+ label: React.ReactNode;
5
+ onAction: (e: React.MouseEvent | React.KeyboardEvent) => void;
6
+ };
@@ -1,4 +1,5 @@
1
1
  import { Matcher } from 'react-day-picker';
2
+ import { TranslateFunction } from '../i18n/types';
2
3
  type Locale = any;
3
4
  export declare function parseDate(str: string, format: string, locale?: Locale): Date | undefined;
4
5
  export declare function formatDate(date: Date, format: string, locale?: Locale): string;
@@ -8,8 +9,14 @@ export declare function setToMidnight(date: Date): Date;
8
9
  export declare function getStartOfWeek(date: Date, weekIndex: number): Date;
9
10
  export declare function getEndOfWeek(date: Date, weekIndex: number): Date;
10
11
  export declare function createWeekRange(date: Date, weekStart: WeekStart): FullDateRange;
11
- export declare const getDays: () => string[];
12
- export declare const getMonths: () => string[];
12
+ /**
13
+ * @param translate pass the translation function returned from the `useTranslate` hook
14
+ */
15
+ export declare const getDays: (translate: TranslateFunction) => string[];
16
+ /**
17
+ * @param translate pass the translation function returned from the `useTranslate` hook
18
+ */
19
+ export declare const getMonths: (translate: TranslateFunction) => string[];
13
20
  export type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
14
21
  export type TimeInterval = 15 | 30;
15
22
  export type FullDateRange = {
@@ -1 +1 @@
1
- export declare const getLocalizedString: (key: string) => string;
1
+ export declare const getLocalizedString: (key: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7shifts/sous-chef",
3
- "version": "3.35.0",
3
+ "version": "3.36.1-beta0",
4
4
  "description": "7shifts component library",
5
5
  "author": "7shifts",
6
6
  "license": "MIT",