@7shifts/sous-chef 4.12.0 → 4.13.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.
@@ -0,0 +1,6 @@
1
+ type AvatarContextType = {
2
+ size: 'small' | 'medium' | 'large' | 'extra-large' | null;
3
+ };
4
+ declare const AvatarContext: import("react").Context<AvatarContextType>;
5
+ export declare const useAvatarContext: () => AvatarContextType;
6
+ export default AvatarContext;
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
- url?: string;
4
- color?: string;
3
+ url: string;
5
4
  alt?: string;
6
5
  onImageFallbackError: () => void;
6
+ onImageLoad: () => void;
7
7
  };
8
8
  declare const AvatarImage: React.FC<Props>;
9
9
  export default AvatarImage;
@@ -4,6 +4,11 @@ type Props = {
4
4
  theme?: 'success' | 'danger' | 'warning' | 'info';
5
5
  /** This will show a black tooltip when the user hover the badge */
6
6
  title?: string;
7
+ /**
8
+ * `default` renders the badge with its content. `dot` renders a
9
+ * small solid circle with no content — used by small/medium Avatars.
10
+ */
11
+ size?: 'dot' | 'default';
7
12
  testId?: string;
8
13
  };
9
14
  /**
@@ -16,6 +16,8 @@ type Props = {
16
16
  height?: number | string;
17
17
  maxWidth?: number | string;
18
18
  shouldReturnFocusAfterClose?: boolean;
19
+ /** It is the bar that contains additional icons, displayed next to the close button. */
20
+ iconBar?: React.ReactNode;
19
21
  testId?: string;
20
22
  /** The source URL for the image to be displayed in the modal header. */
21
23
  imageSrc?: string;
@@ -26,12 +28,14 @@ type Props = {
26
28
  top: number;
27
29
  left: number;
28
30
  };
31
+ /** A TabList to render pinned between the header and body. Wrap the entire Modal in a Tabs component and place TabPanel children inside ModalBody. */
32
+ tabList?: React.ReactNode;
29
33
  } & DataProps;
30
34
  /**
31
35
  * Modal is a focused overlay that interrupts the current experience and demands the user's attention. It blocks all interaction with the rest of the page until the user responds — making it best suited for decisions, confirmations, and self-contained flows where that level of focus is warranted.
32
36
  */
33
37
  declare const Modal: {
34
- ({ children, header, subHeader, onClose, loading, zIndex, rootElementId, width, height, maxWidth, shouldReturnFocusAfterClose, testId, imageSrc, draggable, initialPosition, ...otherProps }: Props): React.JSX.Element;
38
+ ({ children, header, subHeader, onClose, loading, zIndex, rootElementId, width, height, maxWidth, shouldReturnFocusAfterClose, testId, imageSrc, draggable, initialPosition, tabList, iconBar, ...otherProps }: Props): React.JSX.Element;
35
39
  setAppElement(rootElement: string | HTMLElement): void;
36
40
  };
37
41
  export default Modal;
@@ -3,6 +3,7 @@ export type ModalContextType = {
3
3
  isModalMounted: boolean;
4
4
  modalBodyRef: React.RefObject<HTMLDivElement>;
5
5
  draggable: boolean;
6
+ hasTabList: boolean;
6
7
  };
7
8
  declare const ModalContext: React.Context<ModalContextType>;
8
9
  export declare const useModalContext: () => ModalContextType;
@@ -5,6 +5,7 @@ type Props = {
5
5
  onClose?: () => void;
6
6
  loading?: boolean;
7
7
  imageSrc?: string;
8
+ iconBar?: React.ReactNode;
8
9
  };
9
- declare const ModalHeader: ({ header, subHeader, onClose, loading, imageSrc }: Props) => React.JSX.Element;
10
+ declare const ModalHeader: ({ header, subHeader, onClose, loading, imageSrc, iconBar }: Props) => React.JSX.Element;
10
11
  export default ModalHeader;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ children: React.ReactNode;
4
+ };
5
+ declare const ModalTabZone: ({ children }: Props) => React.JSX.Element;
6
+ export default ModalTabZone;
@@ -0,0 +1 @@
1
+ export { default } from './ModalTabZone';
@@ -25,18 +25,32 @@
25
25
 
26
26
  ### Structure
27
27
 
28
- A Modal is composed of four parts: the `Modal` wrapper (which handles the overlay and focus trapping), a `header` which contains the title (and an optional `subHeader`), a `ModalBody` for content, and a `ModalFooter` for actions. The `header` and optional `subHeader` appear at the top of the modal.
28
+ A Modal is composed of five parts: the `Modal` wrapper (which handles the overlay and focus trapping), a `topbar` which acts as the top padding of the modal and holds the close button, a `header` which contains the title (and an optional `subHeader`), a `ModalBody` which is a slot for all the bespoke modal content, and a `ModalFooter` for actions.
29
29
 
30
30
  ### Sizing
31
31
 
32
- - Modals by default are `500px` wide. We recommend sticking to this size whenever possible.
32
+ - Modals by default are `545px` wide. We recommend sticking to this size whenever possible.
33
33
  - A modal's height is variable based on the content. We recommend never making a modal more than `750px` in height.
34
34
  - Avoid making a modal so large it feels like a full page; if content is that complex, consider whether a dedicated page is more appropriate.
35
35
 
36
- ### Non-closable modals
36
+ ### Variants
37
+
38
+ #### Non-closable modals
37
39
 
38
40
  When `onClose` is omitted, the modal renders without a close button. Use this sparingly — during loading, for flows where closing partway through would leave data in an inconsistent state or for a critical action the user cannot ignore.
39
41
 
42
+ #### Image modals
43
+
44
+ When `imageSrc` is passed, the modal renders with a large banner image at the top. Use this when you want to add visual impact to a modal. For example, in a promotional message or kicking off a new workflow.
45
+
46
+ This image has a fixed height of `200px` and the width matches the width of the modal. Make sure to crop and export your image to the exact size to avoid clipping or warping.
47
+
48
+ Note that the close `button` and icons in the icon bar have a distinct transparent fill in order to ensure they are still visible over the chosen image.
49
+
50
+ #### Draggable modals
51
+
52
+ `draggable` modals allow the user to move the modal around the canvas and do not apply an overlay to the rest of the canvas allowing users to keep interacting with it while the modal is open. Use these when the function of the modal is critically connected to the content of the page. For example, creating or editing a shift on the schedule, where the user may need to reference information on the schedule while creating their new shift.
53
+
40
54
  ## Tips & Tricks
41
55
 
42
56
  - Modals are high interruption and high interaction. Use them deliberately — every unnecessary modal trains users to dismiss them without reading.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7shifts/sous-chef",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "description": "7shifts component library",
5
5
  "author": "7shifts",
6
6
  "license": "MIT",
@@ -21,6 +21,7 @@
21
21
  "build-tokens": "./scripts/build-tokens.sh",
22
22
  "build-colors": "./scripts/tokens/build-colors.sh",
23
23
  "build-zindexes": "./scripts/tokens/build-z-indexes.sh",
24
+ "build:analytics": "node ./scripts/build-analytics.js",
24
25
  "build-llms": "run-s build-llms-components build-llms-icons-and-illustrations build-llms-tokens build-llms-guidelines",
25
26
  "build-llms-components": "node ./scripts/build-llms-components.js",
26
27
  "build-llms-icons-and-illustrations": "node ./scripts/build-llms-icons-and-illustrations.js",
@@ -42,7 +43,7 @@
42
43
  "storybook:build": "storybook build -o ./.storybook/dist --loglevel info",
43
44
  "new:component": "node ./scripts/new-component.js",
44
45
  "changeset": "changeset",
45
- "version": "changeset version",
46
+ "version": "changeset version && yarn build-tokens && yarn build-llms",
46
47
  "release": "changeset publish"
47
48
  },
48
49
  "peerDependencies": {