@7shifts/sous-chef 4.16.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/icons/components/image/IconKnifeFork.d.ts +10 -0
- package/dist/icons/components/image/index.d.ts +1 -0
- package/dist/index.css +304 -45
- package/dist/index.css.map +1 -1
- package/dist/index.js +525 -377
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +517 -376
- 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/Bullet/Bullet.d.ts +22 -0
- package/dist/media/Bullet/index.d.ts +1 -0
- package/dist/media/index.d.ts +3 -1
- package/llms-instructions/llms-components.md +4 -0
- package/llms-instructions/llms-composing-components.md +2 -2
- package/llms-instructions/llms-icons-and-illustrations.md +1 -1
- 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';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type BulletSize = 'small' | 'medium' | 'large' | 'extra-large';
|
|
3
|
+
type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* What the bullet shows: a Sous Chef icon, e.g. `<IconCheck />`, or one or two characters of text, e.g. `"A"` or `"DK"`.
|
|
6
|
+
* - Icon: Bullet sets the icon's `size` to fit the bullet (12, 16, 20 or 40px) and adds `aria-hidden`, so put the meaning in the text next to the bullet. The icon takes the content colour of `theme` and `emphasis`.
|
|
7
|
+
* - Text: shown as you pass it and read by screen readers. Bullet doesn't uppercase or shorten it, so keep it to two characters or it spills out of the circle.
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/** Colour of the bullet. Pair it with `emphasis` to choose between the solid colour and its lighter container colour. */
|
|
11
|
+
theme?: 'default' | 'primary' | 'secondary' | 'neutral' | 'success' | 'info' | 'warning' | 'danger' | 'upsell';
|
|
12
|
+
/** `bold` fills the circle with the theme colour. `subtle` uses the theme's container colour with a darker content colour, for a bullet that draws less attention. */
|
|
13
|
+
emphasis?: 'bold' | 'subtle';
|
|
14
|
+
/** How big the bullet is: `small` (20px), `medium` (30px), `large` (40px) or `extra-large` (80px). The same scale as `Avatar`, so a bullet lines up with an avatar of the same size. */
|
|
15
|
+
size?: BulletSize;
|
|
16
|
+
testId?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Bullet shows a single icon, or one or two characters of text, inside a small coloured circle.
|
|
20
|
+
*/
|
|
21
|
+
declare const Bullet: ({ children, theme, emphasis, size, testId }: Props) => React.JSX.Element;
|
|
22
|
+
export default Bullet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Bullet';
|
package/dist/media/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Badge from './Badge';
|
|
2
2
|
import Avatar from './Avatar';
|
|
3
|
+
import Bullet from './Bullet';
|
|
3
4
|
import Chip from './Chip';
|
|
4
5
|
import Pill from './Pill';
|
|
5
6
|
import ShortcutKey from './ShortcutKey';
|
|
6
|
-
export { Badge, Avatar, Chip, Pill, ShortcutKey };
|
|
7
|
+
export { Badge, Avatar, Bullet, Chip, Pill, ShortcutKey };
|
|
8
|
+
export type { AvatarType } from './Avatar';
|
|
@@ -256,6 +256,10 @@ Avatar represents a person or entity — such as a company, location, department
|
|
|
256
256
|
|
|
257
257
|
Badge is a small circular indicator used to draw attention to something associated with another element — a count, a status, or a quick action. It always appears in relation to something else, never on its own.
|
|
258
258
|
|
|
259
|
+
### Bullet
|
|
260
|
+
|
|
261
|
+
Bullet shows a single icon, or one or two characters of text, inside a small coloured circle.
|
|
262
|
+
|
|
259
263
|
### Chip
|
|
260
264
|
|
|
261
265
|
A chip is similar looking to pill, but is instead used to convey system status such as "New", "Beta", or "Add-on"
|
|
@@ -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>
|
|
@@ -92,7 +92,7 @@ IconAddressBook IconFaceSmileRelaxed IconFileUser IconGrinBeam IconHand IconHand
|
|
|
92
92
|
|
|
93
93
|
#### Image
|
|
94
94
|
|
|
95
|
-
IconBirthdayCake IconBolt IconBriefcase IconBullseyeArrow IconClipboardList IconColorPalette IconDownload IconFilePdf IconFlag IconFourDotsCircle IconFourSquares IconGavel IconGif IconGift IconGlobe IconHatChef IconIslandTropical IconLaptopSearch IconMagic IconMapMarker IconMedal IconMugSaucer IconNotesMedical IconPlateUtensils IconPlug IconRocket IconSchool IconSparkle IconStickyNoteLines IconStore IconTachometer IconTemperature IconThreeSquares IconUniversity
|
|
95
|
+
IconBirthdayCake IconBolt IconBriefcase IconBullseyeArrow IconClipboardList IconColorPalette IconDownload IconFilePdf IconFlag IconFourDotsCircle IconFourSquares IconGavel IconGif IconGift IconGlobe IconHatChef IconIslandTropical IconKnifeFork IconLaptopSearch IconMagic IconMapMarker IconMedal IconMugSaucer IconNotesMedical IconPlateUtensils IconPlug IconRocket IconSchool IconSparkle IconStickyNoteLines IconStore IconTachometer IconTemperature IconThreeSquares IconUniversity
|
|
96
96
|
|
|
97
97
|
#### Status
|
|
98
98
|
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './AvatarImage';
|