@7shifts/sous-chef 4.6.1 → 4.7.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.
@@ -13,6 +13,7 @@ export declare function createWeekRange(date: Date, weekStart: WeekStart): FullD
13
13
  * @param translate pass the translation function returned from the `useTranslate` hook
14
14
  */
15
15
  export declare const getDays: (translate: TranslateFunction) => string[];
16
+ export declare const getDaysShort: (translate: TranslateFunction) => string[];
16
17
  /**
17
18
  * @param translate pass the translation function returned from the `useTranslate` hook
18
19
  */
@@ -26,10 +26,27 @@ Calendar positions itself relative to the trigger element. It opens below the an
26
26
 
27
27
  Use `disabledDays` to prevent selection of dates that aren't valid choices — past dates, dates outside a booking window, or dates already taken.
28
28
 
29
+ ### Highlighting days
30
+
31
+ You can highlight a specific day on the calendar with a special visual treatment. This can be useful for showing a user that a day has special significance that might affect their decision making. For example:
32
+
33
+ - highlighting the pay days in a pay cycle.
34
+ - highlighting a day someone is unavailable to work.
35
+ - highlighting someone's birthday.
36
+
37
+ You can highlight a specific date, or an array of multiple specified dates. You can also use simple logic to highlight a series of days such as `Last of the Month`, `Every other day`, `Every other Friday`, `14th of every month`, etc.
38
+
39
+ Highlights offer 6 different shapes (circle, circle-dashed, square, square-dashed, octagon, star) and can use one of our 6 colour themes. Shapes and colors are independent of each other, and you are free to use any combination you need. You must also return a label for each of the highlights that will show up in the legend under the calendar.
40
+
41
+ Do not use the same shape more than once with different colours. This is an accessibility issue. Instead try to use a variety of shapes with different colours.
42
+
43
+ [See examples of all 6 shapes](https://souschef.7shifts.com/?path=/story/components-forms-daterangefield--with-multiple-highlight-groups)
44
+
29
45
  ## Tips & Tricks
30
46
 
31
47
  - Use `initialMonth` to open the calendar at a relevant month when the context implies one — for example, opening at the month of the currently selected date rather than always defaulting to today.
32
48
  - Disabled days should feel visually obvious. Don't rely solely on click prevention — ensure the styling makes it clear which dates are selectable at a glance.
49
+ - When highlighting more than one type of day on the calendar, make sure to use a variety of shapes as well as colours to keep the design accessibile.
33
50
 
34
51
  ## Additional Rules
35
52
 
@@ -16,15 +16,15 @@
16
16
 
17
17
  ## Usage
18
18
 
19
- ### Small Small should be used either when only a portion of the content on a page
19
+ ### Small
20
20
 
21
- isn't shown or when a sub-feature on a page isn't shown.{' '}
21
+ Small should be used either when only a portion of the content on a page isn't shown or when a sub-feature on a page isn't shown.
22
22
 
23
23
  ### Medium
24
24
 
25
25
  Also known as horizontal empty states. Used inline either when only a portion of the content on a page isn't shown or when a sub-feature on a page isn't shown. They differ from Small in that they provide the user more context to the empty state and they have some kind of call-to-action.
26
26
 
27
- ### large
27
+ ### Large
28
28
 
29
29
  Also known as the Full Page empty states. Used when an entire page isn't available.
30
30
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## When Not to Use
10
10
 
11
- - If there is a large data set and the user needs to be able quickly pick out a single item. If you are using this pattern consider including a search.
11
+ - If there is a large data set and the user needs to be able to quickly pick out a single item. If you are using this pattern consider including a search.
12
12
  - When records load continuously as the user scrolls — use infinite scroll instead
13
13
  - When there is only ever one page of results — hide or omit the controls entirely rather than rendering them in a permanently disabled state
14
14
 
@@ -26,7 +26,6 @@
26
26
  ## Additional Rules
27
27
 
28
28
  - Use `onDismiss` to let the user close the banner. When provided, a close button appears automatically. Managing whether the banner re-appears is the responsibility of the caller.
29
- `theme` defaults to "info". Always pass it explicitly.
30
29
  - `theme` defaults to `"info"`. Always pass it explicitly.
31
30
  - `primaryButton` and `secondaryButton` accept `Button` elements. The component forcefully applies `hollow-contrast` to the primary button and `link-contrast` to the secondary button — any `theme` passed on the button itself will be overridden.
32
31
  - `onLoad` fires once on mount — use it to trigger analytics or logging when the banner becomes visible.
@@ -13,9 +13,11 @@
13
13
  - When there are too many options to comfortably fit in the frame.
14
14
  - When the user is submitting a value as part of a form — use a radio group instead.
15
15
  - When the options trigger an action rather than change a view — use a `Button` group instead
16
+ - To swap between 2 binary settings or options - use `toggle` instead
16
17
 
17
18
  ## Usage
18
19
 
20
+ - Typically `SegmentedControls` is used in association with another component or section of a page. Its typically used in a toolbar, above the item its affecting.
19
21
  - You may include as many items as necessary and will fit in your frame, however the SegmentedControl should never be longer than the component it is controlling.
20
22
  - Keep option labels short — one or two words. The control is sized to its content, so long labels create an unbalanced layout.
21
23
  - Use nouns or short noun phrases that describe the view, not verbs — "Day", "Week", "Month", not "Show Day", "Show Week".
@@ -17,12 +17,10 @@
17
17
  - The default `size` of 28px suits most contexts. Increase it only when the spinner needs to fill a large empty area.
18
18
  - Spinners have their own unique set of themes. These differ from the semantic themes that apply to other components like banners.
19
19
 
20
- | Theme | When to use |
21
- | ---------- | ------------------------------------------------------------------------ |
22
- | `mint` | Standard backgrounds (default) |
23
- | `contrast` | Inverse-coloured surfaces that require more visual contrast |
24
- | `disabled` | Inside a disabled element such as a disabled `Button` in a loading state |
25
- | `pride` | Seasonal spinner that is active during pride month (June 1-30) |
20
+ | Theme | When to use | |---|---| | `mint` | Standard backgrounds (default)
21
+ | | `contrast` | Inverse-coloured surfaces that require more visual contrast | |
22
+ `disabled` | Inside a disabled element such as a disabled `Button` in a loading state|
23
+ | `pride` | Seasonal spinner that is active during pride month (June 1-30)|
26
24
 
27
25
  ## Additional Rules
28
26
 
@@ -0,0 +1,65 @@
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
+ - When a page or modal contains distinct sections of content that don't need to be visible at the same time
6
+ - When users are likely to switch between sections — not just read one
7
+ - When the sections are parallel in nature and at the same level of hierarchy
8
+
9
+ ## When Not to Use
10
+
11
+ - As a replacement for primary navigation — use `PrimaryNav` for top-level sections of the product
12
+ - When users need to compare content across sections — tabs hide all but one panel, making comparison difficult
13
+ - When changing content views on a single component or table — consider a `SegmentedControl` instead
14
+ - When the sections have a meaningful sequence or dependency — consider a stepper or a single scrollable page
15
+
16
+ ## Usage
17
+
18
+ ### Tab labels
19
+
20
+ Keep tab labels short — one or two words at most. Labels should name the content category, not describe an action. Use sentence case.
21
+
22
+ ### Suffix slot
23
+
24
+ Each `Tab` accepts a `suffix` prop for a `Badge`, `Chip` or `icon` rendered after the label. Use a `Badge` to show a count of items in that panel. Use a `Chip` to flag something new or upgraded.
25
+
26
+ ### Disabled tabs
27
+
28
+ Pass `disabled` on a `Tab` to prevent selection. Use this sparingly — a disabled tab with no explanation is confusing. To provide clarity to the user you can try:
29
+
30
+ - Adding a lock or upsell icon in the suffix to help explain why the tab is disabled.
31
+ - Keep the tab active, and show an empty state inside the panel explaining why content might not be accessible to them.
32
+ - Hide the tab entirely.
33
+
34
+ ### Uncontrolled vs. controlled
35
+
36
+ Tabs support two modes. In **uncontrolled** mode, pass `defaultValue` to set the initially active tab and let the component manage its own state. In **controlled** mode, pass `value` and `onValueChange` to sync the active tab with external state — useful when the active tab reflects a URL parameter or needs to respond to events outside the component.
37
+
38
+ ```tsx
39
+ {
40
+ /* Uncontrolled */
41
+ }
42
+ <Tabs defaultValue="schedule">...</Tabs>;
43
+
44
+ {
45
+ /* Controlled */
46
+ }
47
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
48
+ ...
49
+ </Tabs>;
50
+ ```
51
+
52
+ ## Additional Rules
53
+
54
+ - Every `Tab` must have a `value` prop, and its matching `TabPanel` must use the same `value`.
55
+ - Either `defaultValue` or `value` must be provided on `<Tabs>` — omitting both leaves no tab selected.
56
+ - `TabPanel` content is unmounted when inactive by default. Pass `forceMount` to keep it in the DOM — useful when the panel contains state that should not be lost on tab switch.
57
+ - `TabList` accepts an `aria-label` prop. Set it when more than one `Tabs` instance exists on the same page so screen readers can distinguish between them.
58
+ - `TabList` and `TabPanel` can be placed in different parts of the tree — only the root `<Tabs>` wrapper needs to enclose both. This is useful when the tab bar and content area are rendered in separate layout regions.
59
+
60
+ ## Accessibility
61
+
62
+ - Keyboard navigation follows the ARIA tabs pattern: `ArrowLeft` / `ArrowRight` move between tabs, `Home` jumps to the first, `End` jumps to the last.
63
+ - Each `Tab` is linked to its `TabPanel` via `aria-controls` and `aria-labelledby` automatically.
64
+ - `aria-selected` reflects the active tab state.
65
+ - Only the active tab is in the tab order (`tabIndex={0}`); inactive tabs use `tabIndex={-1}` and are reached with arrow keys, not Tab.
@@ -0,0 +1,52 @@
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
+ - When a user needs to pick days from specific range - such as choosing which days of the schedule to publish.
6
+ - When the user already selected a week or has the context of which week is being displayed.
7
+
8
+ ## When Not to Use
9
+
10
+ - When no specific calendar week is involved and only weekday names matter — use `PillSelectField` with day-of-week options instead
11
+ - When users need to pick dates across multiple weeks or a date range — use `DateRangeField`
12
+ - When the user needs to see the full calendar for additional context.
13
+
14
+ ## Usage
15
+
16
+ ### Label and Caption
17
+
18
+ Always provide a `label` so users understand what the day selection controls. The `caption` is an ideal place to display the formatted date range of the week — for example "June 14 – June 20" — which anchors the pills in real time and reduces ambiguity about which week is shown.
19
+
20
+ ### The Week
21
+
22
+ Pass the days of the week as an array of `Date` objects via the `days` prop. The row doesn't have to be exactly 7 days — a partial week or a Mon–Sun arrangement both work. Days are displayed in the order they appear in the array, so pass them in chronological order.
23
+
24
+ ### Pre-selecting Days
25
+
26
+ Pass a `value` array to control which days start selected. For a standard working-week scenario, pre-selecting Monday through Friday is a sensible default. Days not included in `value` render as unselected.
27
+
28
+ ### Error State
29
+
30
+ Use the `error` prop to surface a validation message — for example, "At least one day must be selected." The message appears below the pills and the field is marked as invalid for screen readers.
31
+
32
+ ### Display Format
33
+
34
+ By default each pill shows the weekday abbreviation above the date number — "Mon 16", "Tue 17". Setting `displayFormat="month"` swaps the top label to show the month abbreviation instead — "Jan 16", "Feb 17". Use the month format when the days being shown span more than one month, or when the month is more meaningful context than the day of the week — for example, when selecting days across a multi-week planning window.
35
+
36
+ ### Disabled State
37
+
38
+ Set `disabled` to prevent interaction with all pills. Use this when a week's schedule has been locked, submitted, or when the user doesn't have permission to edit the selection.
39
+
40
+ ## Tips & Tricks
41
+
42
+ - The `caption` or `label` is the best place to show the week's date range if the user needs that context. It sits close to the pills and gives users the calendar context they need without taking up extra space.
43
+ - Pre-selecting Mon–Fri is a natural default for most scheduling use cases — it matches the most common working-week expectation and saves users an extra step.
44
+ - The `days` array doesn't need to be exactly 7 entries. If the context involves a partial week — for example, the remaining days of an in-progress week — just pass those dates.
45
+
46
+ ## Additional Rules
47
+
48
+ - `days` and `name` are both required. `days` must be an array of valid `Date` objects in chronological order.
49
+ - For **uncontrolled** use (inside a Formik form), omit `value` and `onChange` — the field reads and writes through Formik context automatically via `name`.
50
+ - For **controlled** use, pass both `value` and `onChange`. The `onChange` callback receives the full updated `Date[]`, not a diff — replace the previous value entirely.
51
+ - `displayFormat` defaults to `'weekday'`. Set to `'month'` to show the month abbreviation instead of the weekday abbreviation on each pill.
52
+ - Day pill labels are derived from the date's weekday index, month index, and calendar day number. The component does not localize or format dates — pass dates in the correct local timezone.
@@ -4,7 +4,7 @@
4
4
 
5
5
  All component APIs and use cases are defined in the Storybook MCP. You can get detailed information about any specific component.
6
6
 
7
- In this document, you will find a list of the available components grouped by category, with a short description of what each one does.
7
+ In this document, you will find a list of documented components grouped by category, with a short description of what each one does.
8
8
 
9
9
  If you want information (props, guidelines) about an specific component, you can use the tool sous-chef_get_component_details, providing the name of the component as an argument.
10
10
 
@@ -98,7 +98,7 @@ Form components are used to collect user input and data.
98
98
 
99
99
  ### ColorField
100
100
 
101
- Color fields allow users to select a color from a predefined set of options. They are ideal for settings or configurations where color selection is necessary.
101
+ Color fields allow users to select a color from a predefined set of options, or pick a custom color via the native color picker. They are ideal for settings or configurations where color selection is necessary.
102
102
 
103
103
  ### FormFeedback
104
104
 
@@ -116,6 +116,10 @@ FormFeedback is used to indicate an error within a form, for example when there
116
116
 
117
117
  A field for entering phone numbers. It includes a selection field for country code and can validate phone numbers.
118
118
 
119
+ ### WeekSelectField
120
+
121
+ A week-scoped day selector. Pass an array of 7 dates representing a week and let users pick which days apply. Each pill displays the 3-letter weekday abbreviation and the calendar date.
122
+
119
123
  ## Media
120
124
 
121
125
  Media components display compact visual or status information, such as avatars and labels.
@@ -188,6 +192,10 @@ Used on top of pages to let the user navigate back to parent routes. IMPORTANT:
188
192
 
189
193
  PrimaryNav is the main navigation component for Sous Chef. It provides a vertical navigation menu with support for nested sub-items, badges, and a footer section. The navigation can be expanded or collapsed, and it highlights the active item based on the current selection. The component is designed to be flexible and customizable, allowing for various use cases within the application.
190
194
 
195
+ ### Tabs
196
+
197
+ Compound component for horizontal tab navigation. Supports uncontrolled (`defaultValue`) and controlled (`value` + `onValueChange`) modes. `TabList` and `TabPanel` can live in different parts of the tree — only the root `` needs to wrap both.
198
+
191
199
  ## Overlay
192
200
 
193
201
  Overlays are components that render on top of the main page.
@@ -211,6 +211,7 @@ Available icon components:
211
211
  - IconPlateUtensils
212
212
  - IconPlug
213
213
  - IconRocket
214
+ - IconSchool
214
215
  - IconSparkle
215
216
  - IconStickyNoteLines
216
217
  - IconStore
@@ -399,14 +399,10 @@ Ideally, you won't need to use the typography tokens, as you will be using the S
399
399
 
400
400
  | Token | Value |
401
401
  | ------------------------ | ----- |
402
- | --p-font-weight-thin | 100 |
403
- | --p-font-weight-light | 200 |
404
- | --p-font-weight-normal | 300 |
405
- | --p-font-weight-medium | 400 |
402
+ | --p-font-weight-light | 300 |
403
+ | --p-font-weight-normal | 400 |
406
404
  | --p-font-weight-semibold | 500 |
407
405
  | --p-font-weight-bold | 600 |
408
- | --p-font-weight-heavy | 700 |
409
- | --p-font-weight-black | 800 |
410
406
 
411
407
  ## Border radius
412
408
 
@@ -446,7 +442,7 @@ In Sous Chef, we have the `Stack` and `Inline` components that are responsible f
446
442
  <Stack space={12}>
447
443
  <Card>Card 1</Card>
448
444
  <Card>Card 2</Card>
449
- <Stack>
445
+ </Stack>
450
446
  ```
451
447
 
452
448
  In the application level, it might be available a SCSS variable for spacing:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@7shifts/sous-chef",
3
- "version": "4.6.1",
3
+ "version": "4.7.0",
4
4
  "description": "7shifts component library",
5
5
  "author": "7shifts",
6
6
  "license": "MIT",