@7shifts/sous-chef 4.17.0 → 5.0.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/dist/index.css +187 -45
- package/dist/index.css.map +1 -1
- package/dist/index.js +507 -441
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +693 -626
- package/dist/index.modern.js.map +1 -1
- package/dist/media/Avatar/Avatar.d.ts +22 -7
- package/dist/media/Avatar/constants.d.ts +17 -4
- package/dist/media/Avatar/index.d.ts +1 -0
- package/dist/media/Avatar/types.d.ts +3 -0
- package/dist/media/index.d.ts +1 -0
- package/llms-instructions/llms-composing-components.md +2 -2
- package/package.json +1 -1
- package/dist/media/Avatar/AvatarImage/AvatarImage.d.ts +0 -9
- package/dist/media/Avatar/AvatarImage/index.d.ts +0 -1
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AvatarSize, AvatarType } from './types';
|
|
3
|
+
import Badge from '../Badge';
|
|
2
4
|
type Props = {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** The entity the avatar represents. It decides the shape, colour, icon and whether an image can be shown. */
|
|
6
|
+
type: AvatarType;
|
|
7
|
+
/** How big the avatar is: `small` (20px), `medium` (30px), `large` (40px) or `extra-large` (80px). Use `medium` in table cells and list rows. */
|
|
8
|
+
size?: AvatarSize;
|
|
9
|
+
/** Name of the user or entity. Used as the accessible name, and `type="role"` shows its first letter. Without it the avatar is decorative. */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Image URL, lazy-loaded when the avatar enters the viewport. Only used by `user`, `company` and `enterprise`: for `role`, `department` and `location` it is ignored. A role shows its colour and initial, and a department or location its colour and icon. If the image fails to load, the avatar falls back to its default: the silhouette for `user`, the colour and icon for `company` and `enterprise`. */
|
|
7
12
|
url?: string;
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Only used by `type="role"`: the role's assigned colour. Accepts a colour token name like `seq-1`, or any CSS colour.
|
|
15
|
+
* @default surface-on-color-subtle
|
|
16
|
+
*/
|
|
17
|
+
color?: string;
|
|
18
|
+
/**
|
|
19
|
+
* A `Badge` shown at the bottom-right of the avatar, e.g. `<Badge theme="danger">9</Badge>`. Avatar always sets `hasBorder` on it.
|
|
20
|
+
* - `large` and `extra-large`: rendered as passed (text, a number or an icon).
|
|
21
|
+
* - `small` and `medium`: Avatar sets `size="small"`, so it becomes a dot that keeps the badge's `theme` and hides its content.
|
|
22
|
+
*/
|
|
23
|
+
badge?: React.ReactElement<React.ComponentProps<typeof Badge>>;
|
|
10
24
|
testId?: string;
|
|
11
25
|
};
|
|
26
|
+
export declare const getRoleInitial: (name?: string) => string;
|
|
12
27
|
/**
|
|
13
|
-
* Avatar
|
|
28
|
+
* Avatar shows a photo, initials or an icon for a person or entity, such as a company, location, department or role.
|
|
14
29
|
*/
|
|
15
30
|
declare const Avatar: React.FC<Props>;
|
|
16
31
|
export default Avatar;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { AvatarSize, AvatarType, UserPlaceholderColor } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* User placeholder colours: a background and a silhouette colour per pair.
|
|
4
|
+
*
|
|
5
|
+
* These are intentionally hardcoded hex values, not design tokens. They pre-date
|
|
6
|
+
* the Sous Chef design system and are kept unchanged on purpose, so a user's
|
|
7
|
+
* placeholder looks the same as it always has. Don't map them to tokens.
|
|
8
|
+
*/
|
|
9
|
+
export declare const USER_PLACEHOLDER_COLORS: Record<UserPlaceholderColor, {
|
|
10
|
+
background: string;
|
|
11
|
+
silhouette: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const USER_PLACEHOLDER_COLOR_NAMES: UserPlaceholderColor[];
|
|
14
|
+
/** Types that can show an image. For every other type `url` is ignored. */
|
|
15
|
+
export declare const IMAGE_AVATAR_TYPES: AvatarType[];
|
|
16
|
+
/** Sizes that always render the badge as a dot, whatever was passed. */
|
|
17
|
+
export declare const DOT_BADGE_SIZES: AvatarSize[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type AvatarType = 'user' | 'role' | 'department' | 'location' | 'company' | 'enterprise';
|
|
2
|
+
export type AvatarSize = 'small' | 'medium' | 'large' | 'extra-large';
|
|
3
|
+
export type UserPlaceholderColor = 'basil-dark' | 'basil-light' | 'plum-dark' | 'plum-light' | 'strawberry-dark' | 'strawberry-light' | 'blackberry-dark' | 'blackberry-light' | 'oregano-dark' | 'oregano-light' | 'mustard-dark' | 'mustard-light';
|
package/dist/media/index.d.ts
CHANGED
|
@@ -774,7 +774,7 @@ const ITEMS: Item[] = [
|
|
|
774
774
|
employeeName: 'Steve Lawrence',
|
|
775
775
|
date: 'Jun 22, 2019',
|
|
776
776
|
hours: 15
|
|
777
|
-
// No image: the Avatar shows
|
|
777
|
+
// No image: the Avatar shows the user silhouette
|
|
778
778
|
},
|
|
779
779
|
{
|
|
780
780
|
employeeName: 'Alex Andrade',
|
|
@@ -790,7 +790,7 @@ const CustomItemComponent = (props: DataTableCustomComponent<Item>) => {
|
|
|
790
790
|
<DataTableRow>
|
|
791
791
|
<DataTableCell columnIndex={0}>
|
|
792
792
|
<Inline alignItems="center">
|
|
793
|
-
<Avatar url={image} />
|
|
793
|
+
<Avatar type="user" url={image} />
|
|
794
794
|
{employeeName}
|
|
795
795
|
</Inline>
|
|
796
796
|
</DataTableCell>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './AvatarImage';
|