@7shifts/sous-chef 5.0.0 → 5.0.1
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 +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/overlay/Modal/useDraggableModal.d.ts +1 -1
- package/llms-instructions/guidelines/Avatar.guidelines.md +45 -25
- package/llms-instructions/guidelines/Bullet.guidelines.md +62 -0
- package/llms-instructions/llms-components.md +2 -2
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@ export type DraggableModalState = {
|
|
|
30
30
|
* (react-draggable v4.7+ no longer accepts "window" as a string shorthand).
|
|
31
31
|
*
|
|
32
32
|
* Initial bounds are estimated from the numeric width/height props (falling
|
|
33
|
-
* back to
|
|
33
|
+
* back to default size estimates). After mount, the element is
|
|
34
34
|
* measured and bounds are corrected to the actual rendered dimensions so the
|
|
35
35
|
* modal cannot be dragged outside the viewport even when width/height are CSS
|
|
36
36
|
* strings or the content exceeds the fallback height.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## When to Use
|
|
4
4
|
|
|
5
5
|
- To represent a person in a list, table row, or header — such as an employee name, a shift assignee, or a message sender
|
|
6
|
-
- To represent an entity such as a role, department, location, or
|
|
6
|
+
- To represent an entity such as a role, department, location, company, or enterprise alongside its name
|
|
7
7
|
- When a profile photo or brand image is available and adds recognition value
|
|
8
8
|
- As an indicator of the current logged in user or account being viewed
|
|
9
9
|
|
|
@@ -11,67 +11,87 @@
|
|
|
11
11
|
|
|
12
12
|
- As a decorative element with no connection to a real person or entity
|
|
13
13
|
- In place of an icon when the context has nothing to do with identity
|
|
14
|
+
- As a bullet in a list or numbered steps in a flow — use `Bullet` instead
|
|
15
|
+
- To indicate a status or state that isn't associated with an entity — use `Pill` or `Badge` instead
|
|
14
16
|
|
|
15
17
|
## Usage
|
|
16
18
|
|
|
17
19
|
### Content
|
|
18
20
|
|
|
19
|
-
Avatars can display different kinds of content. Within 7shifts, the entity being displayed defines the content displayed:
|
|
21
|
+
Avatars can display different kinds of content. Within 7shifts, the entity being displayed defines the content displayed. Set it with the `type` prop:
|
|
20
22
|
|
|
21
|
-
- **For
|
|
22
|
-
- **For Roles** - Uses
|
|
23
|
-
- **For Departments** -
|
|
24
|
-
- **For Locations** -
|
|
23
|
+
- **For People** - Uses a photo if available. If not, falls back to the placeholder icon version
|
|
24
|
+
- **For Roles** - Uses the first character of the role as an initial
|
|
25
|
+
- **For Departments** - Static. Always uses the `IconSitemap` icon, which cannot be overridden
|
|
26
|
+
- **For Locations** - Static. Always uses the `IconMapMarker` icon, which cannot be overridden
|
|
27
|
+
- **For Companies** - Uses a photo if available. If not, falls back to the placeholder version that uses `IconKnifeFork`
|
|
28
|
+
- **For Enterprises** - Uses a photo if available. If not, falls back to the placeholder version that uses `IconBarsV`
|
|
29
|
+
|
|
30
|
+
The type also sets the shape: people are circles, roles use a scalloped shape, and departments, locations, companies and enterprises are rounded squares.
|
|
25
31
|
|
|
26
32
|
### Sizes
|
|
27
33
|
|
|
28
|
-
Avatars come in four sizes: `small
|
|
34
|
+
Avatars come in four sizes: `small` (20px), `medium` (30px), `large` (40px), and `extra-large` (80px). Choose the size based on how prominent the identity needs to be and what works in your layout.
|
|
29
35
|
On table cells and list rows, `medium` is the most common size as `small` is quite small.
|
|
30
36
|
|
|
31
37
|
### Colour
|
|
32
38
|
|
|
33
|
-
Colour
|
|
39
|
+
Colour helps people tell entity types apart at a glance. Only roles take a colour from you, and they always need one — every other type's colour is built into the component.
|
|
34
40
|
|
|
35
41
|
#### Users
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
Users no longer use their role colour.
|
|
38
44
|
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
- **No assigned role** — leave `color` unset and the avatar appears grey
|
|
42
|
-
- **Multiple roles** — the Primary Role's colour is always used. If the user has multiple roles but none is set as primary, the colour of their oldest assigned role is shown instead
|
|
45
|
+
- **Photo uploaded** — the photo fills the avatar. There is no background colour or border.
|
|
46
|
+
- **No photo** — the avatar shows the placeholder silhouette in one of 12 colour pairs, picked at random: basil, plum, strawberry, blackberry, oregano or mustard, each as a light silhouette on a dark background or the reverse. The colour can't be set or overridden.
|
|
43
47
|
|
|
44
48
|
#### Roles
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
A role avatar must always use the role's assigned colour. Pass it with the `color` prop, as a colour token name like `seq-1`. This isn't optional and there is no fallback: never show a role avatar without its assigned colour, and don't substitute another colour. The initial is shown in `surface-on-inverse-bold`.
|
|
47
51
|
|
|
48
52
|
#### Departments
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
Static. Always a `tertiary-container` background with a `tertiary-on-container` icon.
|
|
51
55
|
|
|
52
56
|
#### Locations
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
Static. Always a `primary-container` background with a `primary-on-container` icon.
|
|
59
|
+
|
|
60
|
+
#### Companies
|
|
61
|
+
|
|
62
|
+
Uses the photo if one is available. Otherwise the placeholder uses a `secondary-container` background with a `secondary-on-container` icon.
|
|
63
|
+
|
|
64
|
+
#### Enterprises
|
|
65
|
+
|
|
66
|
+
Uses the photo if one is available. Otherwise the placeholder uses a `surface-inverse` background with a `surface-on-inverse` icon.
|
|
55
67
|
|
|
56
68
|
### Badge
|
|
57
69
|
|
|
58
|
-
A badge can be overlaid on the avatar to surface supplementary information — an action, a status indicator, or a count. The badge sits in the bottom-right corner of the avatar.
|
|
70
|
+
A badge can be overlaid on the avatar to surface supplementary information — an action, a status indicator, or a count. The badge sits in the bottom-right corner of the avatar and always has a border to separate it from the avatar.
|
|
71
|
+
|
|
72
|
+
Pass the badge with the `badge` prop, typically a `Badge` component. Badges render on all avatar sizes:
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
- **`large` and `extra-large`** — the badge renders as passed: text, a number or an icon
|
|
75
|
+
- **`small` and `medium`** — the badge automatically renders as a `dot` badge so it doesn't cover the avatar. It keeps the badge's `theme`, but its content is hidden
|
|
61
76
|
|
|
62
77
|
## Tips & Tricks
|
|
63
78
|
|
|
64
|
-
-
|
|
79
|
+
- Always pass `name` with the person's or entity's name. It's what screen readers announce, and for roles it's where the initial comes from.
|
|
65
80
|
- Avoid using avatars on their own without a label if possible. In most cases an avatar on its own is not enough detail to identify a person or entity.
|
|
81
|
+
- A role avatar always uses the role's assigned colour, so it matches how that role appears elsewhere in the product, like on the schedule.
|
|
82
|
+
- On `small` and `medium` avatars a badge's count or icon is hidden, so let the badge's `theme` carry the meaning, and repeat anything important in the label or a tooltip.
|
|
83
|
+
- Don't rely on a user's placeholder colour to mean anything — it's random and is not tied to their role or department.
|
|
66
84
|
- The `extra-large` size is best reserved for dedicated profile or detail contexts — a settings page, an employee profile, a company detail view. Using it in a list or table will overpower the surrounding content.
|
|
67
85
|
- When pairing an avatar with a name in a row or list, the avatar should always sit to the left of the text. Use `Inline` with `alignItems="center"` to keep them vertically centred.
|
|
68
|
-
- Always pass an `alt` prop when using a photo or image URL — use the person's name or entity name so screen readers can identify what is shown.
|
|
69
86
|
|
|
70
87
|
## Additional Rules
|
|
71
88
|
|
|
89
|
+
- `type` is required and decides the shape, colour, icon, and whether a photo can be shown.
|
|
72
90
|
- `size` defaults to `medium` if not specified.
|
|
73
|
-
- `
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
91
|
+
- `url` is only used by `user`, `company` and `enterprise`. For `role`, `department` and `location` it is ignored.
|
|
92
|
+
- `color` is required for `role` and must be the role's assigned colour. Every other type ignores it.
|
|
93
|
+
- `name` is the avatar's accessible name. Without it, the avatar is treated as decorative and hidden from screen readers.
|
|
94
|
+
- The role initial is the first character of `name`, trimmed and uppercased.
|
|
95
|
+
- `badge` always renders with a border. On `small` and `medium` it is forced to a dot.
|
|
96
|
+
- Images are lazy-loaded and only fetched when the avatar enters the viewport. While an image loads, the avatar shows a `surface-container-highest` background.
|
|
97
|
+
- If the image fails to load, the avatar falls back to its placeholder — the silhouette for users, and the colour and icon for companies and enterprises — never a broken image.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!-- AUTO-GENERATED by scripts/build-llms-guidelines.js. Do not edit manually. Run `yarn build-llms-guidelines` to regenerate. -->
|
|
2
|
+
|
|
3
|
+
## When to Use
|
|
4
|
+
|
|
5
|
+
- As the marker for each item in a list, such as a list of features, benefits or requirements
|
|
6
|
+
- To number the steps in a flow, such as an onboarding checklist or a setup guide
|
|
7
|
+
- To give each item in a list a visual cue about what kind of item it is, using an icon
|
|
8
|
+
- On its own as a static visual decal, where it decorates the layout and doesn't carry any information
|
|
9
|
+
|
|
10
|
+
## When Not to Use
|
|
11
|
+
|
|
12
|
+
- To represent a person or entity, such as an employee, role or location — use `Avatar` instead
|
|
13
|
+
- To show a count or status on top of another element — use `Badge` instead
|
|
14
|
+
- To label the status or category of something — use `Pill` instead
|
|
15
|
+
- On its own to communicate information — a bullet used as a decal is decorative only, so anything the reader needs to know must be in text
|
|
16
|
+
- For anything dynamic, such as a status, count or state that changes — use `Badge` or `Pill` instead
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Content
|
|
21
|
+
|
|
22
|
+
Pass the content as `children`. A bullet holds one of two things:
|
|
23
|
+
|
|
24
|
+
- **An icon** — any Sous Chef icon, such as `IconCheck` or `IconClipboardList`. Bullet sizes the icon to fit the circle and colours it to match the theme, so you don't need to set the icon's `size` or `color`. In `small` bullets, use the solid icon (`variant="solid"`) rather than the outline one. At 12px, outline icons lose detail and become hard to read.
|
|
25
|
+
- **Text** — one or two characters, such as a step number (`1`, `2`) or a letter (`A`). Bullet shows the text exactly as you pass it. It doesn't uppercase or shorten it, so anything longer than two characters spills out of the circle.
|
|
26
|
+
|
|
27
|
+
### Sizes
|
|
28
|
+
|
|
29
|
+
Bullet comes in four sizes: `small` (20px), `medium` (30px), `large` (40px) and `extra-large` (80px). These match the `Avatar` sizes, so a bullet lines up with an avatar of the same size.
|
|
30
|
+
|
|
31
|
+
`small` is the default and suits most lists. Use the larger sizes when the bullet introduces a bigger heading or block of content, such as the steps of a setup guide.
|
|
32
|
+
|
|
33
|
+
### Theme and emphasis
|
|
34
|
+
|
|
35
|
+
Set the colour with `theme` and choose how strong it is with `emphasis`.
|
|
36
|
+
|
|
37
|
+
- **`theme`** — `default`, `primary`, `secondary`, `neutral`, `success`, `info`, `warning`, `danger` or `upsell`. Pick the theme that matches the meaning of the list, such as `success` for completed steps or `danger` for things to avoid.
|
|
38
|
+
- **`emphasis`** — `bold` fills the circle with the theme colour. `subtle` uses the theme's lighter container colour with darker content, for a bullet that draws less attention.
|
|
39
|
+
|
|
40
|
+
Use the same theme and emphasis for every bullet in a list, unless the colour is there to show a difference between items, such as completed and upcoming steps.
|
|
41
|
+
|
|
42
|
+
### Dark mode
|
|
43
|
+
|
|
44
|
+
Bullet switches to the dark theme colours automatically when the page uses the dark theme. There's nothing to set on the bullet itself.
|
|
45
|
+
|
|
46
|
+
## Tips & Tricks
|
|
47
|
+
|
|
48
|
+
- When a bullet sits next to text, put the meaning in the text. Icons inside a bullet are hidden from screen readers, so the icon alone tells them nothing.
|
|
49
|
+
- When a bullet is used on its own as a decal, keep it static. If removing it would leave the reader missing information, it isn't a decal — add text or use another component.
|
|
50
|
+
- Don't rely on colour alone to tell items apart. Pair a change of theme with a different icon or with wording that says what changed.
|
|
51
|
+
- For numbered steps, use the step number as the text so the order is clear without the surrounding layout.
|
|
52
|
+
- When pairing a bullet with text in a list, the bullet should sit to the left of the text. Use `Inline` with `alignItems="center"` for a single line of text, or align it to the top when the text wraps onto several lines.
|
|
53
|
+
- Keep bullets in a list the same size. Mixing sizes in one list makes it look uneven.
|
|
54
|
+
|
|
55
|
+
## Additional Rules
|
|
56
|
+
|
|
57
|
+
- `children` is required. Pass either one icon or one or two characters of text.
|
|
58
|
+
- `theme` defaults to `default`, `emphasis` defaults to `bold`, and `size` defaults to `small`.
|
|
59
|
+
- When `children` is an icon, Bullet always sets the icon's size to fit (12px for `small`, 16px for `medium`, 20px for `large`, 40px for `extra-large`). A `size` set on the icon is ignored.
|
|
60
|
+
- Icons get `aria-hidden` and are hidden from screen readers. Text is read out as it is.
|
|
61
|
+
- The bullet is decorative and has no role or label of its own.
|
|
62
|
+
- Bullet accepts only `children`, `theme`, `emphasis`, `size` and `testId`.
|
|
@@ -250,7 +250,7 @@ Media components display compact visual or status information, such as avatars a
|
|
|
250
250
|
|
|
251
251
|
### Avatar
|
|
252
252
|
|
|
253
|
-
Avatar represents a person or entity — such as
|
|
253
|
+
Avatar represents a person or entity — such as an enterprise, company, location, department, or role — with a visual identifier. It appears wherever a person or entity's identity needs to be communicated at a glance.
|
|
254
254
|
|
|
255
255
|
### Badge
|
|
256
256
|
|
|
@@ -258,7 +258,7 @@ Badge is a small circular indicator used to draw attention to something associat
|
|
|
258
258
|
|
|
259
259
|
### Bullet
|
|
260
260
|
|
|
261
|
-
Bullet
|
|
261
|
+
Bullet is a small coloured circle that holds a single icon, or one or two characters of text. It marks the start of an item in a list or a step in a flow, and can also be used on its own as a static visual decal.
|
|
262
262
|
|
|
263
263
|
### Chip
|
|
264
264
|
|