@7shifts/sous-chef 3.34.0-beta.2 → 3.34.0-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 (49) hide show
  1. package/README.md +0 -1
  2. package/dist/NoneFound~NeRgtMTh.svg +14 -0
  3. package/dist/actions/Button/Button.d.ts +3 -3
  4. package/dist/core/ComponentIdentifier/ComponentIdentifier.d.ts +11 -0
  5. package/dist/core/ComponentIdentifier/ComponentIdentifierContext.d.ts +6 -0
  6. package/dist/core/ComponentIdentifier/constants.d.ts +3 -0
  7. package/dist/core/ComponentIdentifier/useIsInsideComponent.d.ts +2 -0
  8. package/dist/empty_states/EmptyState/EmptyState.d.ts +3 -3
  9. package/dist/empty_states/EmptyStateContainer/types.d.ts +7 -0
  10. package/dist/empty_states/Paywall/Paywall.d.ts +3 -2
  11. package/dist/forms/CheckboxField/CheckboxField.d.ts +2 -1
  12. package/dist/forms/CurrencyField/CurrencyField.d.ts +21 -1
  13. package/dist/forms/CurrencyField/constants.d.ts +2 -0
  14. package/dist/forms/DateRangeField/ToDate/ToDate.d.ts +2 -2
  15. package/dist/forms/Field/Field.d.ts +2 -1
  16. package/dist/forms/TextField/TextField.d.ts +26 -2
  17. package/dist/forms/TextField/useTextField.d.ts +5 -2
  18. package/dist/forms/TimeField/TimeField.d.ts +21 -1
  19. package/dist/i18n/locales/en.json +7 -0
  20. package/dist/i18n/locales/es.json +7 -0
  21. package/dist/i18n/locales/fr.json +7 -0
  22. package/dist/i18n/types.d.ts +2 -0
  23. package/dist/i18n/useTranslation.d.ts +2 -2
  24. package/dist/icons/components/IconHatChef.d.ts +9 -0
  25. package/dist/icons/components/IconPlateUtensils.d.ts +9 -0
  26. package/dist/icons/components/index.d.ts +2 -0
  27. package/dist/icons/iconUtils.d.ts +2 -2
  28. package/dist/index.css +117 -80
  29. package/dist/index.js +2410 -860
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.modern.js +2405 -857
  32. package/dist/index.modern.js.map +1 -1
  33. package/dist/layout/CalloutCard/CalloutCard.d.ts +3 -0
  34. package/dist/layout/Card/Card.d.ts +4 -3
  35. package/dist/layout/Flex/Flex.d.ts +2 -2
  36. package/dist/layout/Inline/Inline.d.ts +2 -2
  37. package/dist/layout/Stack/Stack.d.ts +2 -2
  38. package/dist/lists/DataTable/DataTable.d.ts +5 -3
  39. package/dist/lists/DataTable/DataTableEmptyState/DataTableEmptyState.d.ts +8 -0
  40. package/dist/lists/DataTable/DataTableEmptyState/index.d.ts +1 -0
  41. package/dist/lists/DataTable/constants.d.ts +1 -0
  42. package/dist/lists/DataTable/types.d.ts +6 -1
  43. package/dist/media/Badge/Badge.d.ts +2 -2
  44. package/dist/overlay/DropdownList/domain.d.ts +0 -1
  45. package/dist/overlay/Modal/Modal.d.ts +3 -2
  46. package/dist/overlay/Tooltip/Tooltip.d.ts +2 -2
  47. package/dist/utils/elements.d.ts +7 -0
  48. package/dist/utils/props.d.ts +4 -1
  49. package/package.json +2 -1
@@ -11,5 +11,8 @@ type Props = {
11
11
  };
12
12
  testId?: string;
13
13
  };
14
+ /**
15
+ * @deprecated Use `<EmptyState as='card' />` instead
16
+ */
14
17
  declare const CalloutCard: ({ header, title, children, mediaUrl, onClose, actions, testId }: Props) => React.JSX.Element;
15
18
  export default CalloutCard;
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
- import { PositionStyles } from '../../foundation/types';
2
+ import type { DataProps, PositionStyles } from '../../foundation/types';
3
3
  import { MenuAction } from '../../overlay/KebabMenu/types';
4
4
  type Props = {
5
5
  children: React.ReactNode;
6
6
  onClick?: () => void;
7
+ onClose?: () => void;
7
8
  isSelected?: boolean;
8
9
  disabled?: boolean;
9
10
  actions?: MenuAction[];
10
11
  testId?: string;
11
- } & PositionStyles;
12
- declare const Card: ({ children, onClick, isSelected, disabled, actions, testId, ...positionProps }: Props) => React.JSX.Element;
12
+ } & PositionStyles & DataProps;
13
+ declare const Card: ({ children, onClick, onClose, isSelected, disabled, actions, testId, ...rest }: Props) => React.JSX.Element;
13
14
  export default Card;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { AlignItems, FlexWrap, JustifyContent, Space, SpaceConfig } from './types';
3
- import { PositionStyles } from '../../foundation/types';
3
+ import { DataProps, PositionStyles } from '../../foundation/types';
4
4
  type Props = {
5
5
  children: React.ReactNode;
6
6
  space?: Space | SpaceConfig;
@@ -15,7 +15,7 @@ type Props = {
15
15
  flexGrow?: number;
16
16
  testId?: string;
17
17
  extraClass?: string;
18
- } & PositionStyles;
18
+ } & PositionStyles & DataProps;
19
19
  /**
20
20
  * Flex is a internal component used by Stack and Inline. DON'T use this component outside of Sous Chef
21
21
  */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { PositionStyles } from '../../foundation/types';
2
+ import { DataProps, PositionStyles } from '../../foundation/types';
3
3
  import type { AlignItems, FlexWrap, JustifyContent, Space, SpaceConfig } from '../Flex/types';
4
4
  type Props = {
5
5
  children: React.ReactNode;
@@ -15,7 +15,7 @@ type Props = {
15
15
  flexWrap?: FlexWrap;
16
16
  testId?: string;
17
17
  flexGrow?: number;
18
- } & PositionStyles;
18
+ } & PositionStyles & DataProps;
19
19
  /**
20
20
  * Layout component to easily line elements up in a row.
21
21
  */
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { PositionStyles } from '../../foundation/types';
2
+ import { DataProps, PositionStyles } from '../../foundation/types';
3
3
  import type { JustifyContent, Space, AlignItems, SpaceConfig } from '../Flex/types';
4
4
  type Props = {
5
5
  children: React.ReactNode;
@@ -14,7 +14,7 @@ type Props = {
14
14
  flexItems?: boolean;
15
15
  testId?: string;
16
16
  flexGrow?: number;
17
- } & PositionStyles;
17
+ } & PositionStyles & DataProps;
18
18
  /**
19
19
  * Layout component to easily stack elements up in a column.
20
20
  */
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import type { DataTableColumn, DataTableCustomComponent, DataTableItem, DataTableSort, StickyColumns } from './types';
2
+ import type { DataTableColumn, DataTableCustomComponent, DataTableEmptyState as DataTableEmptyStateType, DataTableItem, DataTableSort, StickyColumns } from './types';
3
+ import type { DataProps } from '../../foundation/types';
3
4
  type Props<T> = {
4
5
  /** Each element represents a row and each key of the object represents a column */
5
6
  items: DataTableItem<T>[];
@@ -30,6 +31,7 @@ type Props<T> = {
30
31
  testId?: string;
31
32
  /** Used to make the left, rigth or both edge columns sticky */
32
33
  stickyColumns?: StickyColumns;
33
- };
34
- declare const DataTable: <T extends unknown>({ items, columns, itemComponent, maxHeight, hasPrevious, hasNext, onPreviousClick, onNextClick, onSort, isLoading, showActionMenu, footerComponent, hasVerticalBorders, testId, skeletonRowLayout, stickyColumns }: Props<T>) => React.JSX.Element;
34
+ emptyState?: DataTableEmptyStateType;
35
+ } & DataProps;
36
+ declare const DataTable: <T extends unknown>({ items, columns, itemComponent, maxHeight, hasPrevious, hasNext, onPreviousClick, onNextClick, onSort, isLoading, showActionMenu, footerComponent, hasVerticalBorders, testId, skeletonRowLayout, stickyColumns, emptyState, ...otherProps }: Props<T>) => React.JSX.Element;
35
37
  export default DataTable;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { DataTableColumn, DataTableEmptyState as DataTableEmptyStateType } from '../types';
3
+ type Props = {
4
+ columns?: DataTableColumn[];
5
+ customEmptyState?: DataTableEmptyStateType;
6
+ };
7
+ declare const DataTableEmptyState: ({ columns, customEmptyState }: Props) => React.JSX.Element;
8
+ export default DataTableEmptyState;
@@ -0,0 +1 @@
1
+ export { default } from './DataTableEmptyState';
@@ -2,6 +2,7 @@ export declare const DATA_TABLE_STATES: {
2
2
  readonly CONTENT: "CONTENT";
3
3
  readonly SKELETON_LOADING: "SKELETON_LOADING";
4
4
  readonly BACKGROUND_LOADING: "BACKGROUND_LOADING";
5
+ readonly EMPTY: "EMPTY";
5
6
  };
6
7
  export declare const DATA_TABLE_SCROLL_STATES: {
7
8
  readonly NO_SCROLL: "NO_SCROLL";
@@ -34,7 +34,12 @@ type ButtonAction = {
34
34
  showInKebab: false;
35
35
  } & MenuAction;
36
36
  export type DataTableAction = KebabAction | ButtonAction;
37
- export type DataTableState = 'CONTENT' | 'SKELETON_LOADING' | 'BACKGROUND_LOADING';
37
+ export type DataTableState = 'CONTENT' | 'SKELETON_LOADING' | 'BACKGROUND_LOADING' | 'EMPTY';
38
38
  export type StickyColumns = 'left' | 'right' | 'both';
39
39
  export type ScrollState = 'NO_SCROLL' | 'SCROLLABLE_CONTENT_ON_BOTH_SIDES' | 'SCROLLABLE_CONTENT_ON_LEFT' | 'SCROLLABLE_CONTENT_ON_RIGHT';
40
+ export type DataTableEmptyState = {
41
+ title: string;
42
+ caption: string;
43
+ image?: string;
44
+ };
40
45
  export {};
@@ -6,5 +6,5 @@ type Props = {
6
6
  title?: string;
7
7
  testId?: string;
8
8
  };
9
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
10
- export default _default;
9
+ declare const Badge: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
10
+ export default Badge;
@@ -1,2 +1 @@
1
1
  export declare const canInteractWithItem: (child: React.ReactElement) => boolean;
2
- export declare const calculateScrollYPosition: (newFocusItem: number, lastFocusItem: number, paneScrollTop: number, maxPaneHeight: number, elementYPosition: number) => number | null;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ZIndex } from '../../foundation/tokens/zindex/z-index-types';
3
+ import type { DataProps } from '../../foundation/types';
3
4
  type Props = {
4
5
  children: React.ReactNode;
5
6
  header?: React.ReactNode;
@@ -16,9 +17,9 @@ type Props = {
16
17
  maxWidth?: number;
17
18
  shouldReturnFocusAfterClose?: boolean;
18
19
  testId?: string;
19
- };
20
+ } & DataProps;
20
21
  declare const Modal: {
21
- ({ children, header, subHeader, onClose, loading, zIndex, rootElementId, width, height, maxWidth, shouldReturnFocusAfterClose, testId }: Props): React.JSX.Element;
22
+ ({ children, header, subHeader, onClose, loading, zIndex, rootElementId, width, height, maxWidth, shouldReturnFocusAfterClose, testId, ...otherProps }: Props): React.JSX.Element;
22
23
  setAppElement(rootElement: string | HTMLElement): void;
23
24
  };
24
25
  export default Modal;
@@ -18,5 +18,5 @@ type Props = {
18
18
  children: React.ReactElement;
19
19
  testId?: string;
20
20
  };
21
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
22
- export default _default;
21
+ declare const Tooltip: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
22
+ export default Tooltip;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ type Config = {
3
+ component: React.ReactElement['type'];
4
+ displayName: string;
5
+ };
6
+ export declare const checkIsComponent: (element: React.ReactElement, config: Config) => boolean;
7
+ export {};
@@ -23,5 +23,8 @@ type GetDataPropsResponse = {
23
23
  dataProps: ObjectMap<string>;
24
24
  otherProps: ObjectMap;
25
25
  };
26
- export declare const getDataProps: (props: ObjectMap) => GetDataPropsResponse;
26
+ type GetDataPropsConfig = {
27
+ removeDataPrefix: boolean;
28
+ };
29
+ export declare const getDataProps: (props: ObjectMap, config?: GetDataPropsConfig) => GetDataPropsResponse;
27
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7shifts/sous-chef",
3
- "version": "3.34.0-beta.2",
3
+ "version": "3.34.0-beta0",
4
4
  "description": "7shifts component library",
5
5
  "author": "7shifts",
6
6
  "license": "MIT",
@@ -27,6 +27,7 @@
27
27
  "test:unit:coverage": "run-s \"test:unit --coverage --coveragePathIgnorePatterns .stories.tsx index.ts icon-typescript-template.js types.ts\"",
28
28
  "test:watch": "react-scripts test --colors --transformIgnorePatterns \"node_modules/(?!time-autocomplete)/\" --env=jest-environment-jsdom-sixteen --setupTestFrameworkScriptFile=./jestSetup.js",
29
29
  "test:visual": "chromatic --project-token=9226d55e4d56 --exit-zero-on-changes --build-script-name=storybook:chromatic:build",
30
+ "start": "yarn storybook",
30
31
  "storybook": "storybook dev -p 6006 --loglevel info",
31
32
  "storybook:chromatic": "storybook dev -p 6006",
32
33
  "storybook:chromatic:build": "storybook build -o ./.storybook/dist",