@7shifts/sous-chef 4.15.0 → 4.16.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/actions/Button/Button.d.ts +5 -1
- package/dist/actions/Link/Link.d.ts +7 -0
- package/dist/actions/PaginationControls/PaginationControls.d.ts +7 -5
- package/dist/actions/Toggle/Toggle.d.ts +2 -0
- package/dist/controls/DateFilter/DateFilter.d.ts +16 -1
- package/dist/controls/SegmentedControl/SegmentedControl.d.ts +6 -0
- package/dist/controls/ToolbarSelect/ToolbarSelect.d.ts +9 -1
- package/dist/core/SousChefProvider/SousChefProvider.d.ts +7 -0
- package/dist/empty_states/EmptyStateContainer/types.d.ts +16 -2
- package/dist/feedback/CircularProgress/CircularProgress.d.ts +1 -0
- package/dist/feedback/InlineBanner/InlineBanner.d.ts +1 -0
- package/dist/feedback/MicroBanner/MicroBanner.d.ts +1 -0
- package/dist/feedback/PersistentBanner/PersistentBanner.d.ts +6 -0
- package/dist/feedback/ProgressBar/ProgressBar.d.ts +7 -1
- package/dist/feedback/Spinner/Spinner.d.ts +6 -0
- package/dist/feedback/Toast/Toast.d.ts +13 -0
- package/dist/forms/CheckboxField/CheckboxField.d.ts +4 -0
- package/dist/forms/CurrencyField/CurrencyField.d.ts +5 -21
- package/dist/forms/DateField/DateField.d.ts +13 -1
- package/dist/forms/DateRangeField/DateRangeCalendar/DateRangeCalendar.d.ts +6 -3
- package/dist/forms/DateRangeField/DateRangeField.d.ts +17 -3
- package/dist/forms/Form/Form.d.ts +13 -2
- package/dist/forms/FormFeedback/FormFeedback.d.ts +1 -0
- package/dist/forms/FormFooter/FormFooter.d.ts +11 -5
- package/dist/forms/FormFooter/FormFooterActions/FormFooterActions.d.ts +2 -5
- package/dist/forms/FormFooter/types.d.ts +10 -0
- package/dist/forms/FormRow/FormRow.d.ts +6 -0
- package/dist/forms/FormSection/FormSection.d.ts +4 -0
- package/dist/forms/MultiSelectField/MultiSelectField.d.ts +6 -2
- package/dist/forms/NumberField/NumberField.d.ts +4 -0
- package/dist/forms/PasswordField/PasswordField.d.ts +3 -0
- package/dist/forms/PercentageField/PercentageField.d.ts +13 -0
- package/dist/forms/PhoneField/PhoneField.d.ts +10 -0
- package/dist/forms/PillSelectField/PillSelectField.d.ts +9 -0
- package/dist/forms/PillSelectField/types.d.ts +2 -0
- package/dist/forms/RadioGroupBoxOption/RadioGroupBoxOption.d.ts +7 -0
- package/dist/forms/RadioGroupField/RadioGroupField.d.ts +8 -1
- package/dist/forms/RadioGroupField/RadioGroupFieldContext.d.ts +2 -1
- package/dist/forms/RadioGroupOption/RadioGroupOption.d.ts +6 -1
- package/dist/forms/SelectField/SelectField.d.ts +20 -3
- package/dist/forms/SelectField/types.d.ts +27 -0
- package/dist/forms/TextAreaField/TextAreaField.d.ts +7 -1
- package/dist/forms/TextField/TextField.d.ts +8 -0
- package/dist/forms/TimeField/TimeField.d.ts +23 -1
- package/dist/forms/TimeRangeField/TimeRangeField.d.ts +15 -2
- package/dist/forms/WeekField/WeekField.d.ts +4 -0
- package/dist/forms/WeekSelectField/WeekSelectField.d.ts +4 -0
- package/dist/forms/hooks/useRadioGroupFieldControllers.d.ts +1 -2
- package/dist/forms/hooks/useSelectFieldControllers.d.ts +2 -2
- package/dist/forms/index.d.ts +2 -0
- package/dist/foundation/tokens/color/color-constants.d.ts +34 -0
- package/dist/foundation/tokens/color/color-types.d.ts +1 -1
- package/dist/foundation/tokens/dimension/dimension-tokens.d.ts +1 -0
- package/dist/foundation/tokens/layout/TokenTable.d.ts +14 -0
- package/dist/foundation/tokens/layout/layout-tokens.d.ts +12 -0
- package/dist/hooks/useIsOverflowing.d.ts +2 -0
- package/dist/index.css +755 -479
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1295 -941
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1431 -1098
- package/dist/index.modern.js.map +1 -1
- package/dist/ink_illustrations/components/design/Ink3DModeling.d.ts +7 -0
- package/dist/ink_illustrations/components/design/index.d.ts +1 -1
- package/dist/ink_illustrations/components/index.d.ts +2 -2
- package/dist/ink_illustrations/components/other/InkSculptureBust.d.ts +7 -0
- package/dist/ink_illustrations/components/other/index.d.ts +1 -1
- package/dist/ink_illustrations/components/{design/Ink3DModeling02.d.ts → travel/InkBoardingPass.d.ts} +2 -2
- package/dist/ink_illustrations/components/travel/InkVolcano.d.ts +7 -0
- package/dist/ink_illustrations/components/travel/index.d.ts +2 -2
- package/dist/ink_illustrations/components/weather/InkSun.d.ts +7 -0
- package/dist/ink_illustrations/components/weather/index.d.ts +1 -1
- package/dist/ink_illustrations/deprecatedAliases.d.ts +27 -0
- package/dist/ink_illustrations/index.d.ts +1 -0
- package/dist/layout/CalloutCard/CalloutCard.d.ts +1 -0
- package/dist/layout/Card/Card.d.ts +14 -0
- package/dist/layout/Inline/Inline.d.ts +20 -4
- package/dist/layout/Page/Page.d.ts +11 -3
- package/dist/layout/Page/PageBreadcrumbs/PageBreadcrumbs.d.ts +2 -2
- package/dist/layout/Page/types.d.ts +11 -2
- package/dist/layout/PageLayout/PageLayout.d.ts +18 -0
- package/dist/layout/PageLayout/types.d.ts +10 -0
- package/dist/layout/Stack/Stack.d.ts +16 -4
- package/dist/layout/index.d.ts +1 -0
- package/dist/lists/Accordion/Accordion.d.ts +10 -0
- package/dist/lists/Accordion/types.d.ts +4 -0
- package/dist/lists/ActionList/ActionList.d.ts +12 -0
- package/dist/lists/ActionList/type.d.ts +5 -0
- package/dist/lists/ActionListItem/ActionListItem.d.ts +17 -0
- package/dist/lists/BasicTable/BasicTable.d.ts +22 -0
- package/dist/lists/BasicTable/BasicTableSectionContext.d.ts +4 -0
- package/dist/lists/BasicTable/constants.d.ts +13 -0
- package/dist/lists/BasicTable/index.d.ts +1 -0
- package/dist/lists/BasicTable/types.d.ts +4 -0
- package/dist/lists/BasicTableBody/BasicTableBody.d.ts +9 -0
- package/dist/lists/BasicTableBody/index.d.ts +1 -0
- package/dist/lists/BasicTableCell/BasicTableCell.d.ts +14 -0
- package/dist/lists/BasicTableCell/index.d.ts +1 -0
- package/dist/lists/BasicTableHeader/BasicTableHeader.d.ts +9 -0
- package/dist/lists/BasicTableHeader/index.d.ts +1 -0
- package/dist/lists/BasicTableRow/BasicTableRow.d.ts +9 -0
- package/dist/lists/BasicTableRow/index.d.ts +1 -0
- package/dist/lists/DataTable/DataTable.d.ts +31 -8
- package/dist/lists/DataTable/types.d.ts +35 -0
- package/dist/lists/DataTableCell/DataTableCell.d.ts +1 -0
- package/dist/lists/DataTableEditableCell/DataTableEditableCell.d.ts +1 -0
- package/dist/lists/DataTableRow/DataTableRow.d.ts +12 -0
- package/dist/lists/index.d.ts +7 -1
- package/dist/media/Avatar/Avatar.d.ts +1 -0
- package/dist/media/Badge/Badge.d.ts +7 -2
- package/dist/media/Pill/Pill.d.ts +8 -0
- package/dist/media/Pill/constants.d.ts +2 -0
- package/dist/media/Pill/types.d.ts +3 -1
- package/dist/navigation/BreadcrumbItem/BreadcrumbItem.d.ts +1 -0
- package/dist/navigation/Breadcrumbs/Breadcrumbs.d.ts +1 -0
- package/dist/navigation/PrimaryNav/PrimaryNav.d.ts +1 -0
- package/dist/navigation/PrimaryNavFooter/PrimaryNavFooter.d.ts +1 -0
- package/dist/navigation/PrimaryNavItem/PrimaryNavItem.d.ts +1 -0
- package/dist/navigation/PrimaryNavSubItem/PrimaryNavSubItem.d.ts +1 -0
- package/dist/navigation/Tab/Tab.d.ts +1 -0
- package/dist/navigation/TabList/TabList.d.ts +1 -0
- package/dist/navigation/TabPanel/TabPanel.d.ts +1 -0
- package/dist/navigation/Tabs/Tabs.d.ts +1 -0
- package/dist/overlay/Calendar/Calendar.d.ts +15 -4
- package/dist/overlay/Dropdown/Dropdown.d.ts +1 -0
- package/dist/overlay/DropdownListDivider/DropdownListDivider.d.ts +1 -0
- package/dist/overlay/DropdownListItem/DropdownListItem.d.ts +1 -0
- package/dist/overlay/DropdownListItemSelectable/DropdownListItemSelectable.d.ts +1 -0
- package/dist/overlay/DropdownSubmenu/DropdownSubmenu.d.ts +1 -0
- package/dist/overlay/HintModal/HintModal.d.ts +1 -0
- package/dist/overlay/KebabMenu/types.d.ts +5 -0
- package/dist/overlay/Modal/Modal.d.ts +3 -0
- package/dist/overlay/Modal/ModalBody/ModalBody.d.ts +1 -0
- package/dist/overlay/Modal/ModalFooter/ModalFooter.d.ts +11 -6
- package/dist/overlay/Modal/ModalFooter/types.d.ts +10 -0
- package/dist/overlay/Popover/Popover.d.ts +8 -1
- package/dist/overlay/Tooltip/Tooltip.d.ts +2 -1
- package/dist/overlay/index.d.ts +1 -0
- package/dist/typography/KeyboardKey/KeyboardKey.d.ts +1 -0
- package/dist/typography/Text/Bold/Bold.d.ts +1 -0
- package/dist/typography/Text/Italic/Italic.d.ts +1 -0
- package/dist/typography/Text/Text.d.ts +23 -0
- package/dist/typography/Text/Underline/Underline.d.ts +1 -0
- package/dist/utils/formik.d.ts +5 -0
- package/llms-instructions/guidelines/ActionList.guidelines.md +1 -3
- package/llms-instructions/guidelines/Avatar.guidelines.md +6 -5
- package/llms-instructions/guidelines/Badge.guidelines.md +24 -8
- package/llms-instructions/guidelines/BasicTable.guidelines.md +80 -0
- package/llms-instructions/guidelines/Breadcrumbs.guidelines.md +2 -2
- package/llms-instructions/guidelines/Button.guidelines.md +3 -3
- package/llms-instructions/guidelines/Calendar.guidelines.md +12 -0
- package/llms-instructions/guidelines/Card.guidelines.md +2 -2
- package/llms-instructions/guidelines/CircularProgress.guidelines.md +1 -1
- package/llms-instructions/guidelines/DateFilter.guidelines.md +2 -2
- package/llms-instructions/guidelines/Dropdown.guidelines.md +3 -2
- package/llms-instructions/guidelines/EmptyState.guidelines.md +3 -1
- package/llms-instructions/guidelines/{Forms.guidelines.md → Form.guidelines.md} +41 -6
- package/llms-instructions/guidelines/Icons.guidelines.md +11 -10
- package/llms-instructions/guidelines/InkIllustrations.guidelines.md +5 -4
- package/llms-instructions/guidelines/Inline.guidelines.md +55 -0
- package/llms-instructions/guidelines/InlineBanner.guidelines.md +5 -3
- package/llms-instructions/guidelines/MultiSelectField.guidelines.md +2 -2
- package/llms-instructions/guidelines/Page.guidelines.md +65 -0
- package/llms-instructions/guidelines/PageLayout.guidelines.md +85 -0
- package/llms-instructions/guidelines/Paywall.guidelines.md +3 -2
- package/llms-instructions/guidelines/PersistentBanner.guidelines.md +2 -2
- package/llms-instructions/guidelines/Pill.guidelines.md +31 -3
- package/llms-instructions/guidelines/PillSelectField.guidelines.md +1 -1
- package/llms-instructions/guidelines/PrimaryNav.guidelines.md +144 -0
- package/llms-instructions/guidelines/SegmentedControl.guidelines.md +2 -2
- package/llms-instructions/guidelines/Skeleton.guidelines.md +3 -3
- package/llms-instructions/guidelines/Spinner.guidelines.md +6 -4
- package/llms-instructions/guidelines/Stack.guidelines.md +53 -0
- package/llms-instructions/guidelines/Text.guidelines.md +70 -0
- package/llms-instructions/guidelines/Toast.guidelines.md +2 -1
- package/llms-instructions/guidelines/Toggle.guidelines.md +2 -2
- package/llms-instructions/guidelines/ToolbarSelect.guidelines.md +2 -2
- package/llms-instructions/guidelines/Tooltip.guidelines.md +1 -1
- package/llms-instructions/llms-components.md +91 -19
- package/llms-instructions/llms-composing-components.md +583 -219
- package/llms-instructions/llms-icons-and-illustrations.md +305 -1011
- package/llms-instructions/llms-tokens.md +227 -164
- package/llms-instructions/llms.md +12 -28
- package/package.json +2 -2
- package/dist/ink_illustrations/components/other/InkS/321/201ulptureBust.d.ts +0 -7
- package/dist/ink_illustrations/components/travel/InkDrawing.d.ts +0 -7
- package/dist/ink_illustrations/components/travel/InkDrawing1.d.ts +0 -7
- package/dist/ink_illustrations/components/weather/InkGroup7975.d.ts +0 -7
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/Ink3DGlasses.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkAmusementPark.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkBallet.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkBowling.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkCardGames.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkCarouselWithHorses.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkDiscoBall.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkDj.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkFirecracker.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkJoystick.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkMagicTricks.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkMascarade.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkNotesChart.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkRollerSkating.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkSlotMachine.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkTheatre.d.ts +0 -0
- /package/dist/ink_illustrations/components/{enterteniment → entertainment}/index.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkAnatomy.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkAsteroid.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkAstronaut.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkBacteria.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkChemistry.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkDna.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkLabTube.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkMicroChips.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkMicroscope.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkNewtonsCradle.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkNuclearEnergy.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkPlanet.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkPlantInTube.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkRobotics.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkSpaceTravel.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/InkTelescope.d.ts +0 -0
- /package/dist/ink_illustrations/components/{sciency → science}/index.d.ts +0 -0
|
@@ -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
|
+
- As the root of every screen in the app, so titles, actions and spacing are consistent across pages
|
|
6
|
+
- Inside each route of a `PageLayout`, to render the page that belongs to the selected menu item
|
|
7
|
+
- When a screen needs a title with page-level actions, a page banner, or a row of filters above its content
|
|
8
|
+
|
|
9
|
+
## When Not to Use
|
|
10
|
+
|
|
11
|
+
- Inside a `Modal`, `Card`, `Popover` or any other container. Use `Text` for a title and `Stack` for spacing there
|
|
12
|
+
- More than once on the same screen. Use `Text as="h2"` and `Stack` to split a page into sections instead of nesting pages
|
|
13
|
+
- To build the app shell (top bar or the app's side nav). `Page` only covers the content area
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Header
|
|
18
|
+
|
|
19
|
+
- Pass the page name to `title`. It is rendered as the page `h1`, so don't add another `<Text as="h1">` inside the page.
|
|
20
|
+
- Use `subtitle` for a short sentence that explains the page. Keep it to one or two lines.
|
|
21
|
+
- Pass text to these props rather than building your own header in `children`, so the spacing and heading level stay consistent.
|
|
22
|
+
|
|
23
|
+
### Actions
|
|
24
|
+
|
|
25
|
+
- `actions` is shown on the same row as the title, aligned to the right. Use it for actions that apply to the whole page, such as "Add employee" or "Export".
|
|
26
|
+
- Pass a single `Button`, or several buttons wrapped in an `Inline` (e.g. `<Inline space={12}>`). The primary action goes right-most.
|
|
27
|
+
- Keep it to one primary action and a few secondary ones. Move the rest into a `Dropdown` menu.
|
|
28
|
+
- Actions that only apply to part of the page (a table row, a card) belong next to that content, not in `actions`.
|
|
29
|
+
|
|
30
|
+
### Breadcrumbs
|
|
31
|
+
|
|
32
|
+
`breadcrumbs` shows a trail above the title to navigate back up. It is not JSX and not the `Breadcrumbs` component; it takes one of:
|
|
33
|
+
|
|
34
|
+
| Value | Result |
|
|
35
|
+
| ------------------------------------------- | ----------------------------------------------------------------- |
|
|
36
|
+
| `"Employees"` (a string) | A single breadcrumb with that label that goes up one level (`..`) |
|
|
37
|
+
| `{ label: 'Employees', url: '/employees' }` | A single breadcrumb linking to `url` |
|
|
38
|
+
| `[{ label, url }, { label, url }]` | One breadcrumb per item, in order |
|
|
39
|
+
|
|
40
|
+
- Use a string when the parent page is one level up the route, e.g. `/employees/new` going back to `/employees`.
|
|
41
|
+
- Use `{ label, url }` when the parent is not the previous path level.
|
|
42
|
+
- Add breadcrumbs to pages below a top-level page (detail, create and edit pages). Top-level pages don't need them.
|
|
43
|
+
|
|
44
|
+
### Banner and filter bar
|
|
45
|
+
|
|
46
|
+
- `banner` sits below the header. Use an `InlineBanner` for a message about the whole page.
|
|
47
|
+
- `filterBar` sits below the banner. Pass a row of fields (`TextField`, `SelectField`, `DateFilter` and others) wrapped in an `Inline`.
|
|
48
|
+
|
|
49
|
+
### Size
|
|
50
|
+
|
|
51
|
+
| `size` | When to use |
|
|
52
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
53
|
+
| `restricted` (default) | Most pages: forms, settings and lists. The content is centred with a max width of 1000px, which keeps lines and forms easy to read |
|
|
54
|
+
| `fullwidth` | Pages that need all the horizontal room, such as wide data tables, reports, schedules and dashboards |
|
|
55
|
+
|
|
56
|
+
- There is no `wide` size. Use `fullwidth` when the content needs more than 1000px.
|
|
57
|
+
- Don't use `fullwidth` only to fill the screen. Wide forms and long lines of text are harder to read.
|
|
58
|
+
|
|
59
|
+
## Additional Rules
|
|
60
|
+
|
|
61
|
+
- `breadcrumbs` renders react-router links, so a react-router `Router` must be above the `Page` when it is used. A `Page` without breadcrumbs doesn't need a router.
|
|
62
|
+
- The header row (title, subtitle and actions) only renders when `title` or `actions` is passed.
|
|
63
|
+
- Page adds the horizontal page padding (`--padding-page-tight`) and the spacing between its blocks (20px). Don't add your own padding or margin around it.
|
|
64
|
+
- `children` are rendered below the header blocks with a 20px gap. Use `Stack` inside `children` to space the page sections.
|
|
65
|
+
- Page has a minimum width of 720px.
|
|
@@ -0,0 +1,85 @@
|
|
|
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 group of related pages share a side menu to move between them, such as a settings area or an employee section with "Active" and "Inactive" pages
|
|
6
|
+
- When each menu item maps to its own route
|
|
7
|
+
|
|
8
|
+
## When Not to Use
|
|
9
|
+
|
|
10
|
+
- For a single page. Use `Page` on its own
|
|
11
|
+
- As the app's main side navigation or app shell. `PageLayout` is a secondary menu inside the content area
|
|
12
|
+
- To switch between views of the same content without changing route. Use `Tabs` or `SegmentedControl` instead
|
|
13
|
+
- Inside a `Modal`, `Card` or other container
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Nesting with `Page`
|
|
18
|
+
|
|
19
|
+
`PageLayout` is the outer container: it renders the side menu and a content area. The content area holds the routes, and each route renders a `Page` with its own title, actions and content.
|
|
20
|
+
|
|
21
|
+
With react-router v6:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
<PageLayout title="Employees" menu={MENU}>
|
|
25
|
+
<Routes>
|
|
26
|
+
<Route
|
|
27
|
+
path="/active-employees"
|
|
28
|
+
element={<Page title="Active employees">…</Page>}
|
|
29
|
+
/>
|
|
30
|
+
<Route
|
|
31
|
+
path="/inactive-employees"
|
|
32
|
+
element={<Page title="Inactive employees">…</Page>}
|
|
33
|
+
/>
|
|
34
|
+
</Routes>
|
|
35
|
+
</PageLayout>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
With react-router v5 (Sous Chef supports `react-router-dom` 5.1.2 and up), use `Switch` and pass the `Page` as the `Route` child:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<PageLayout title="Employees" menu={MENU}>
|
|
42
|
+
<Switch>
|
|
43
|
+
<Route path="/active-employees">
|
|
44
|
+
<Page title="Active employees">…</Page>
|
|
45
|
+
</Route>
|
|
46
|
+
<Route path="/inactive-employees">
|
|
47
|
+
<Page title="Inactive employees">…</Page>
|
|
48
|
+
</Route>
|
|
49
|
+
</Switch>
|
|
50
|
+
</PageLayout>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- Put the `Page` inside the `PageLayout`, never the other way around.
|
|
54
|
+
- The `PageLayout` `title` names the whole group (e.g. "Settings"). Each `Page` `title` names the selected page (e.g. "Notifications").
|
|
55
|
+
|
|
56
|
+
### Menu
|
|
57
|
+
|
|
58
|
+
`menu` is an array of `PageLayoutMenu` objects, one per item:
|
|
59
|
+
|
|
60
|
+
| Key | Description |
|
|
61
|
+
| ------------------ | ------------------------------------------------------------------------- |
|
|
62
|
+
| `to` (required) | Route the item links to. The item is highlighted when its route is active |
|
|
63
|
+
| `label` (required) | Text shown for the item |
|
|
64
|
+
| `name` | Unique key for the item. Falls back to the item index |
|
|
65
|
+
| `suffix` | Content shown in a `Badge` after the label, usually a count |
|
|
66
|
+
| `isVisible` | Set to `false` to hide the item, e.g. when the user lacks permission |
|
|
67
|
+
| `reloadDocument` | When `true`, renders a plain `<a href>` that skips client-side routing |
|
|
68
|
+
| `isActive` | Highlights the item. Only used with `reloadDocument` |
|
|
69
|
+
|
|
70
|
+
- Keep labels short (one to three words) and match each label to the `title` of the page it opens.
|
|
71
|
+
- For client-side items (without `reloadDocument`), every `to` must match a `Route` path in the children. Items with `reloadDocument` can link anywhere, including outside the `PageLayout`.
|
|
72
|
+
- Hide items with `isVisible: false` instead of filtering the array yourself, so the menu definition stays in one place.
|
|
73
|
+
- Use `sideNavContent` for extra content below the menu items, such as a short help link. Keep it light.
|
|
74
|
+
|
|
75
|
+
### Suffix
|
|
76
|
+
|
|
77
|
+
- `suffix` is a badge count. `PageLayout` already wraps it in a `Badge`, so pass the value itself, e.g. `suffix: 3` or `suffix: '12'`. Don't pass a `<Badge>`, or it renders a badge inside a badge.
|
|
78
|
+
- Use it for counts that need attention, such as pending requests. Leave it unset when there is nothing to show. A falsy `suffix` (`undefined`, `null` or the number `0`) renders no badge, but the string `'0'` does.
|
|
79
|
+
|
|
80
|
+
## Additional Rules
|
|
81
|
+
|
|
82
|
+
- Menu items without `reloadDocument` are react-router `NavLink`s, so a react-router `Router` must be above the `PageLayout` when any menu item doesn't set `reloadDocument`. Without one, rendering throws. Items with `reloadDocument` are plain links and don't need a `Router`.
|
|
83
|
+
- The active item is detected from the current route. `isActive` is ignored unless `reloadDocument` is `true`.
|
|
84
|
+
- `PageLayout` adds its own top and horizontal padding. Don't add padding around it.
|
|
85
|
+
- The side menu is 250px wide (190px below 1200px). Leave enough room for the `Page` content next to it.
|
|
@@ -51,7 +51,8 @@ Use `as="card"` with `size="medium"` when the Paywall needs to sit within a card
|
|
|
51
51
|
|
|
52
52
|
## Additional Rules
|
|
53
53
|
|
|
54
|
-
-
|
|
54
|
+
- Always use the `Paywall` component for subscription gates — it applies the paywall visual treatment for you. `EmptyState` has no prop to switch to that treatment.
|
|
55
55
|
- `title` is required. All other props are optional but `actions.primary` should always be provided.
|
|
56
|
-
- `as`, `size`, `onClose`, `header`, `caption`, `mediaUrl`,
|
|
56
|
+
- `Paywall` accepts the same props as `EmptyState`: `as`, `size`, `onClose`, `header`, `title`, `children`, `caption`, `mediaUrl`, `actions` and `testId`. Refer to the EmptyState guidelines for usage details on those props, with one difference: `EmptyState` hides `header` at `size="small"`, while `Paywall` shows `header` at every size — use it for the name of the locked feature or add-on.
|
|
57
|
+
- `size` defaults to `"large"` and `as` defaults to `"banner"`.
|
|
57
58
|
- `onClose` is only valid when `as="card"`. Passing it in banner mode has no effect.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
- Choose a theme that is appropriate to the urgency and context of your message. See the `Themes` page for more information on using themes.
|
|
19
19
|
- Keep the message brief — PersistentBanner has no title, so the body text must stand alone and be scannable in one line
|
|
20
|
-
- For buttons use `hollow-contrast` for primary, `link-contrast` for secondary
|
|
20
|
+
- For buttons use `hollow-contrast` for primary, `link-contrast` for secondary. These are applied by default, so don't pass a `theme` on the buttons
|
|
21
21
|
- You can make a banner dismissable. Use when the information is non-critical and users can reasonably acknowledge it later.
|
|
22
22
|
- One at a time — only one Persistent Banner should appear at a time. If multiple messages compete, show the most critical one.
|
|
23
23
|
- Reserve for app-wide scope — if the message applies only to a specific page or workflow, use Inline Banner instead.
|
|
@@ -27,6 +27,6 @@
|
|
|
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
29
|
- `theme` defaults to `"info"`. Always pass it explicitly.
|
|
30
|
-
- `primaryButton` and `secondaryButton` accept `Button` elements. The component
|
|
30
|
+
- `primaryButton` and `secondaryButton` accept `Button` elements. The component applies `hollow-contrast` to the primary button and `link-contrast` to the secondary button by default. A `theme` passed on the button itself takes precedence over the default, so leave it unset unless you have a specific reason to change it.
|
|
31
31
|
- `onLoad` fires once on mount — use it to trigger analytics or logging when the banner becomes visible.
|
|
32
32
|
- `onDismiss` does not hide the banner automatically. The caller is responsible for conditionally rendering the component based on dismissed state.
|
|
@@ -33,22 +33,50 @@ Pill's theme controls its colour and signals the nature of the status at a glanc
|
|
|
33
33
|
|
|
34
34
|
| Theme | Use | Examples |
|
|
35
35
|
| --------- | ------------------------------------- | ----------------------------------------------- |
|
|
36
|
-
| `
|
|
36
|
+
| `neutral` | Neutral or unclear state | Pending, Unavailable, Inactive |
|
|
37
37
|
| `success` | Positive or active state | Active, Approved, Available, Connected, Enabled |
|
|
38
38
|
| `danger` | Critical or negative state | Declined, Deleted, Closed, Errors |
|
|
39
39
|
| `warning` | Cautionary or at-risk state | Expiring, Overdue, Needs Attention |
|
|
40
40
|
| `info` | Something has changed or been updated | Modified, Updated |
|
|
41
41
|
| `upsell` | Premium or gated content | Pro, Premium |
|
|
42
42
|
|
|
43
|
+
### Styles
|
|
44
|
+
|
|
45
|
+
Pills come in 3 styles. Pick one and use it consistently within a list or table:
|
|
46
|
+
|
|
47
|
+
| Style | How | Use |
|
|
48
|
+
| ------- | ---------------------------- | --------------------------------------------------- |
|
|
49
|
+
| Default | Text only | Most statuses |
|
|
50
|
+
| Icon | Pass an icon before the text | When an icon makes the status easier to recognise |
|
|
51
|
+
| Status | Set `hasStatus` | A `Badge` dot in the pill's theme replaces the icon |
|
|
52
|
+
|
|
53
|
+
The status dot uses the theme's `-color` token in the default and hover states, and its `-on-color` token when the pill is active.
|
|
54
|
+
|
|
55
|
+
### Static or interactive?
|
|
56
|
+
|
|
57
|
+
Pills are static by default — they only display a status. Set `isInteractive` when clicking the pill does something, such as opening a menu to change the status or filtering a list by it, and pass an `onClick` handler.
|
|
58
|
+
|
|
59
|
+
Interactive pills have 3 states, with a short fade between them:
|
|
60
|
+
|
|
61
|
+
| State | Appearance |
|
|
62
|
+
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| Default | Same as a static pill |
|
|
64
|
+
| Hover | Same background with `--color-hover-lighten` laid over it, and the outline changes to the theme's `-on-container` token |
|
|
65
|
+
| Active | Toggled on by clicking the pill, and off by clicking it again or clicking outside it. The fill and outline use the theme's `-color` token and the text and icon use its `-on-color` token |
|
|
66
|
+
|
|
67
|
+
Don't make a pill interactive just for a tooltip. A static pill can already be the anchor for a `Tooltip`.
|
|
68
|
+
|
|
43
69
|
## Tips & Tricks
|
|
44
70
|
|
|
45
71
|
- Pill content is almost always a short status label — one to three words.
|
|
46
72
|
- Use themes consistently. If "Approved" is always `success` green in one part of the product, it should be everywhere. Inconsistent theme use erodes the visual language users learn to rely on.
|
|
47
73
|
- Pill and Chip look alike but mean different things. Ask: is this the state of a record in the system, or the state of a product feature? Record → Pill. Feature → Chip.
|
|
48
74
|
- Avoid using more than one Pill per row in a dense list unless each one describes a genuinely different dimension of that record. Multiple pills per row adds visual noise and competes for attention.
|
|
49
|
-
-
|
|
75
|
+
- Neutral (grey) is for genuinely neutral states — not a fallback when you're unsure which theme to use. If the state has a clear positive or negative valence, pick the right colour.
|
|
50
76
|
|
|
51
77
|
## Additional Rules
|
|
52
78
|
|
|
53
|
-
- `theme` defaults to `
|
|
79
|
+
- `theme` defaults to `neutral` if not specified. `default` still works as a deprecated alias of `neutral`.
|
|
80
|
+
- Pills are 24px (`--dim-6x`) tall, have `--dim-2-5x` horizontal padding, and have a 1px outline in the theme's `-color` token by default (for example `--color-info-color`).
|
|
81
|
+
- `isInteractive` defaults to `false`. Interactive pills get `role="button"` and `aria-pressed`, are focusable, and toggle their active state and call `onClick` on click, Enter or Space. `onClick` is ignored on static pills.
|
|
54
82
|
- Pill accepts a forwarded ref, making it usable as an anchor for tooltips or popovers when additional context is needed.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
## When Not to Use
|
|
9
9
|
|
|
10
|
-
- When the option list is long or dynamic — use `
|
|
10
|
+
- When the option list is long or dynamic — use `MultiSelectField` instead. If only one option can be selected, use `SelectField`, or `AsyncSelectField` for options loaded from a server (`AsyncSelectField` is single-select only)
|
|
11
11
|
- When only a single selection is allowed and all options must be visible — use `RadioGroupField` instead
|
|
12
12
|
- When multiple selections are needed from a longer, searchable list — use `MultiSelectField` instead
|
|
13
13
|
- When options carry enough detail that a pill label alone is insufficient context
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<!-- AUTO-GENERATED by scripts/build-llms-guidelines.js. Do not edit manually. Run `yarn build-llms-guidelines` to regenerate. -->
|
|
2
|
+
|
|
3
|
+
## Structure
|
|
4
|
+
|
|
5
|
+
The nav is composed of five building blocks:
|
|
6
|
+
|
|
7
|
+
| Component | Role |
|
|
8
|
+
| ------------------- | -------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `PrimaryNav` | The root container. Manages expand/collapse state and renders the header, scroll body, and footer. |
|
|
10
|
+
| `PrimaryNavItem` | A top-level navigation destination. Has an icon, a label, and optional children. |
|
|
11
|
+
| `PrimaryNavSubItem` | A secondary destination nested inside a `PrimaryNavItem`. Label only — no icon. |
|
|
12
|
+
| `PrimaryNavDivider` | A horizontal rule used to group related items visually. |
|
|
13
|
+
| `PrimaryNavFooter` | A pinned container at the bottom of the nav, used for utility items like Help and Quick Start. |
|
|
14
|
+
|
|
15
|
+
## Expanding and Collapsing
|
|
16
|
+
|
|
17
|
+
The nav has two width states: **collapsed** (64px) and **expanded** (248px). The transition between them is animated.
|
|
18
|
+
|
|
19
|
+
**Collapsed state**
|
|
20
|
+
|
|
21
|
+
- Only icons are visible. Labels are hidden from view but remain in the accessibility tree.
|
|
22
|
+
- Sub-item labels are hidden. If the parent has an active sub-item, a small dot is shown for each sub-item instead.
|
|
23
|
+
- Numeric badges on a parent item (or a positive total of numeric sub-item badges) collapse to a small coloured dot. String badges and sub-item badges are hidden.
|
|
24
|
+
|
|
25
|
+
**Expanded state**
|
|
26
|
+
|
|
27
|
+
- Icons and labels are both visible.
|
|
28
|
+
- Sub-items appear indented beneath their parent, as long as one of them is active.
|
|
29
|
+
- Badges and chips display in full.
|
|
30
|
+
|
|
31
|
+
The toggle button sits in the nav header and fires an `onToggleExpand` callback with either `'expanded'` or `'collapsed'`. The expansion state is persisted to `localStorage` automatically, so it survives page reloads. Pass `isExpanded` to control the state externally.
|
|
32
|
+
|
|
33
|
+
**Hover and focus peek**
|
|
34
|
+
|
|
35
|
+
When the nav is collapsed, hovering over it or moving keyboard focus into it temporarily expands it — without changing the persisted state. When the pointer leaves or focus moves out, it returns to collapsed. This allows users to quickly scan the full nav without committing to an expanded layout.
|
|
36
|
+
|
|
37
|
+
> Hover peek is mouse-only. Keyboard focus uses `:focus-visible` to avoid triggering on mouse-driven focus events.
|
|
38
|
+
|
|
39
|
+
## Nav Items
|
|
40
|
+
|
|
41
|
+
### Primary items (`PrimaryNavItem`)
|
|
42
|
+
|
|
43
|
+
Each top-level item requires an `icon` and a `label`. Use the icon library — icons are automatically sized to medium (16×16).
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
<PrimaryNavItem icon={<IconCalendarAlt />} label="Schedule" href="/schedule" />
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Mark the current page with `isActive`. This highlights the item with a left border and shifts the icon and label from their soft colour to their full colour.
|
|
50
|
+
|
|
51
|
+
Pass `onClick` for client-side navigation or `href` to render the item as a link. If both are needed, use `onClick`.
|
|
52
|
+
|
|
53
|
+
### Sub-items (`PrimaryNavSubItem`)
|
|
54
|
+
|
|
55
|
+
Sub-items nest inside a `PrimaryNavItem` as children. They have no icon — only a label, a small dot indicator in collapsed mode, and an optional badge slot.
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<PrimaryNavItem icon={<IconCalendarAlt />} label="Schedule">
|
|
59
|
+
<PrimaryNavSubItem href="/schedule/daily" isActive>
|
|
60
|
+
Daily
|
|
61
|
+
</PrimaryNavSubItem>
|
|
62
|
+
<PrimaryNavSubItem href="/schedule/weekly">Weekly</PrimaryNavSubItem>
|
|
63
|
+
</PrimaryNavItem>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Sub-items render only when at least one child has `isActive`. Their labels show when the nav is expanded (or temporarily open via hover/focus), and collapsed mode shows a dot for each sub-item.
|
|
67
|
+
|
|
68
|
+
**Paywalled sub-items**
|
|
69
|
+
|
|
70
|
+
Pass `isPaywalled` on a sub-item to show the upsell award icon next to the label. Use this when a feature is available to upgrade to but not currently accessible to the account.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<PrimaryNavSubItem href="/payroll" isPaywalled>
|
|
74
|
+
Payroll
|
|
75
|
+
</PrimaryNavSubItem>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Badges and Chips
|
|
79
|
+
|
|
80
|
+
Both `PrimaryNavItem` and `PrimaryNavSubItem` accept a `badge` prop. The value can be a **number** or a **string**, and the display adapts accordingly.
|
|
81
|
+
|
|
82
|
+
| Value type | Component used | Example |
|
|
83
|
+
| ---------- | -------------- | -------------------------------------- |
|
|
84
|
+
| Number | `Badge` | `badge={4}` → shows `4`, caps at `99+` |
|
|
85
|
+
| String | `Chip` | `badge="New"` → shows a chip label |
|
|
86
|
+
|
|
87
|
+
**Badge behaviour on parent items with sub-items**
|
|
88
|
+
|
|
89
|
+
When a `PrimaryNavItem` has children, it does not use its own `badge` value directly. Instead it sums the numeric badges of all its sub-items and displays that total. This keeps the parent count accurate without requiring manual calculation.
|
|
90
|
+
|
|
91
|
+
If the parent has an active sub-item, the parent's badge is hidden — the sub-item badge is already visible inline.
|
|
92
|
+
|
|
93
|
+
**Collapsed state**
|
|
94
|
+
|
|
95
|
+
In collapsed mode, a numeric badge on a parent item (or a positive total of its numeric sub-item badges) reduces to a small 8px coloured dot positioned on the icon. The count is not shown — only the presence of a notification. String badges (chips) and sub-item badges are hidden entirely.
|
|
96
|
+
|
|
97
|
+
## Divider
|
|
98
|
+
|
|
99
|
+
`PrimaryNavDivider` is a presentational separator with no props. Drop it between items to create visual groupings.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<PrimaryNavItem icon={<IconBarsV />} label="Reports" href="/reports" />
|
|
103
|
+
<PrimaryNavDivider />
|
|
104
|
+
<PrimaryNavItem icon={<IconCog />} label="Settings" href="/settings" />
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Footer
|
|
108
|
+
|
|
109
|
+
`PrimaryNavFooter` pins content to the bottom of the nav, independent of the scrollable item list above. Use it for utility items that should always be reachable — Quick Start, Help, user account actions.
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<PrimaryNav
|
|
113
|
+
footer={
|
|
114
|
+
<PrimaryNavFooter>
|
|
115
|
+
<PrimaryNavItem
|
|
116
|
+
icon={<IconQuestionCircle />}
|
|
117
|
+
label="Help"
|
|
118
|
+
href="/help"
|
|
119
|
+
/>
|
|
120
|
+
</PrimaryNavFooter>
|
|
121
|
+
}
|
|
122
|
+
>
|
|
123
|
+
{/* main nav items */}
|
|
124
|
+
</PrimaryNav>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
A shadow appears on the top edge of the footer when the scrollable content above has been scrolled, to indicate that more items are hidden above.
|
|
128
|
+
|
|
129
|
+
## Logo
|
|
130
|
+
|
|
131
|
+
The nav header shows a logo. Two variants are supported:
|
|
132
|
+
|
|
133
|
+
- `shortLogo` — displayed when collapsed. Defaults to the 7shifts mark.
|
|
134
|
+
- `longLogo` — displayed when expanded. Defaults to the full 7shifts wordmark.
|
|
135
|
+
|
|
136
|
+
Both accept any React node, so custom logos or environment badges can be composed in.
|
|
137
|
+
|
|
138
|
+
## Accessibility
|
|
139
|
+
|
|
140
|
+
- The `<nav>` element receives an `aria-label` (defaults to `"Main"`). Override with `ariaLabel` if more than one nav landmark exists on the page.
|
|
141
|
+
- Active items receive `aria-current="page"`.
|
|
142
|
+
- The toggle button uses `aria-expanded` to reflect the current expansion state.
|
|
143
|
+
- Labels remain in the accessibility tree when the nav is collapsed — only their visual display is hidden.
|
|
144
|
+
- The divider uses `role="separator"` with `aria-orientation="horizontal"`.
|
|
@@ -13,11 +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 `
|
|
16
|
+
- To swap between 2 binary settings or options - use `Toggle` instead
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
19
19
|
|
|
20
|
-
- Typically `
|
|
20
|
+
- Typically `SegmentedControl` is used in association with another component or section of a page. Its typically used in a toolbar, above the item its affecting.
|
|
21
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.
|
|
22
22
|
- Keep option labels short — one or two words. The control is sized to its content, so long labels create an unbalanced layout.
|
|
23
23
|
- Use nouns or short noun phrases that describe the view, not verbs — "Day", "Week", "Month", not "Show Day", "Show Week".
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
- Use `as` to match a specific Sous Chef component shape. When no preset fits, use `height` and `width` to size it manually.
|
|
18
|
-
- `avatar` - Circular avatar
|
|
18
|
+
- `avatar` - Circular avatar (medium size). Use `avatar--small`, `avatar--medium`, `avatar--large` or `avatar--xlarge` to match other Avatar sizes
|
|
19
19
|
- `button` - Button-shaped rectangle
|
|
20
20
|
- `pill` - Pill/badge shape
|
|
21
|
-
- _(none)_ - Plain rectangle —
|
|
21
|
+
- _(none)_ - Plain rectangle, 13px tall and 100% wide by default — adjust with `height` and `width`
|
|
22
22
|
|
|
23
23
|
* Build skeleton layouts that closely match the structure of the real content — a row of skeletons for a list, a wide block for a heading, narrower blocks for body text
|
|
24
24
|
* The loading animation is intentionally delayed by 3.5 seconds to avoid a flash on fast loads
|
|
25
25
|
|
|
26
26
|
## Additional Rules
|
|
27
27
|
|
|
28
|
-
- When `as` is not provided,
|
|
28
|
+
- When `as` is not provided, the skeleton renders as a 13px tall, full-width (100%) bar — roughly one line of text. Set `height` and `width` to match other content.
|
|
29
29
|
- `height` and `width` accept a number (pixels) or a string with units (e.g. `"75%"`, `"2rem"`).
|
|
30
30
|
- `as` and manual sizing can be combined — `as` sets the shape, and `height`/`width` override the default dimensions of that shape if needed.
|
|
@@ -17,10 +17,12 @@
|
|
|
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
|
|
21
|
-
|
|
|
22
|
-
|
|
23
|
-
| `
|
|
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 rainbow spinner for pride month (June). It is opt-in: pass `theme="pride"` yourself, it never switches on automatically |
|
|
24
26
|
|
|
25
27
|
## Additional Rules
|
|
26
28
|
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
- To space elements vertically: page sections, a title above its content, a list of cards, a group of fields
|
|
6
|
+
- Instead of writing custom CSS with `display: flex; flex-direction: column` and `gap`, or adding margins between elements
|
|
7
|
+
- Combined with `Inline` to build more complex layouts, e.g. a `Stack` of `Inline` rows
|
|
8
|
+
|
|
9
|
+
## When Not to Use
|
|
10
|
+
|
|
11
|
+
- To lay elements out in a row. Use `Inline`
|
|
12
|
+
- For fields inside a `Form`. `Form` already wraps its children in a `Stack` (unless `stackContent={false}`), so don't add another one
|
|
13
|
+
- For a two-dimensional grid where rows and columns must line up. There is no grid component; use custom CSS grid with the Sous Chef tokens
|
|
14
|
+
- To add space inside a container (padding). `space` only sets the gap between items
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Space
|
|
19
|
+
|
|
20
|
+
- `space` is the gap between items, in pixels. It defaults to `20`, which matches `--space-section-default` and is the right gap for most sections and form fields.
|
|
21
|
+
- It only accepts multiples of `4` from `0` to `60` (`0`, `4`, `8`, `12` … `60`), the same 4px scale as the `--dim-*` tokens. Values off the scale, like `10`, are not allowed.
|
|
22
|
+
- Pick the value that matches the space token for the relationship between the items:
|
|
23
|
+
|
|
24
|
+
| `space` | Token | When to use |
|
|
25
|
+
| -------------- | ------------------------- | --------------------------------------------------- |
|
|
26
|
+
| `4` | `--space-content-xs` | Tightly related parts, e.g. a label and its value |
|
|
27
|
+
| `8` | `--space-content-sm` | A title and its description |
|
|
28
|
+
| `12` | `--space-content-md` | Items of a compact list, a group of buttons |
|
|
29
|
+
| `16` | `--space-content-lg` | Parts inside a card or modal |
|
|
30
|
+
| `20` (default) | `--space-section-default` | Elements of a section, such as cards or form fields |
|
|
31
|
+
| `40` | `--space-page-default` | Sections of a page |
|
|
32
|
+
|
|
33
|
+
- Pass `{ row, column }` (e.g. `space={{ row: 8, column: 16 }}`) to set the row and column gaps separately. This matters for `Inline` rows that wrap; in a `Stack`, `row` is the gap between items.
|
|
34
|
+
|
|
35
|
+
### Alignment
|
|
36
|
+
|
|
37
|
+
In a `Stack` the items run top to bottom, so:
|
|
38
|
+
|
|
39
|
+
- `alignItems` sets the **horizontal** alignment: `stretch` (default, every item takes the full width), `flex-start`, `center` or `flex-end`.
|
|
40
|
+
- `justifyContent` sets the **vertical** distribution: `start` (default), `center`, `end` or `space-between`. It only has a visible effect when the `Stack` is taller than its content.
|
|
41
|
+
- Use `alignItems="flex-start"` when items such as a `Button` should keep their own width instead of stretching.
|
|
42
|
+
|
|
43
|
+
### Sizing items
|
|
44
|
+
|
|
45
|
+
- `flex` sets the CSS `flex` value of each child by position. For example, `flex={['0 1 auto', 1]}` makes the second child fill the remaining height when the `Stack` has free space, such as a fixed height. Children without an entry, or with a falsy entry such as the number `0`, use `0 1 auto`. Pass the string `'0 0 auto'` to make a child neither grow nor shrink.
|
|
46
|
+
- `flexItems` makes each item wrapper a flex container, so its child can fill the item width.
|
|
47
|
+
- `flexGrow` lets the `Stack` itself grow when it is a child of another `Stack` or `Inline`.
|
|
48
|
+
|
|
49
|
+
## Additional Rules
|
|
50
|
+
|
|
51
|
+
- Each child is wrapped in its own item `div`. Direct children that are `null`, `undefined` or `false` are dropped and don't create a gap, so conditional rendering (`{isVisible && <Card />}`) is safe. A component that renders `null` still gets a wrapper, so its neighbours keep the gap around it; render it conditionally from the parent instead.
|
|
52
|
+
- Don't add margins to the children to tweak the space. Change `space`, or nest another `Stack` with a different `space` for a sub-group.
|
|
53
|
+
- Prefer `Stack` over `Flex`. `Flex` is internal to Sous Chef and is not exported.
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
- For any heading, paragraph or label that is not already rendered by another component's props
|
|
6
|
+
- For headings inside the page content, such as a section title above a `DataTable` or the title of a custom `Card`
|
|
7
|
+
- To highlight a key number or metric (`insight`), or a short headline (`tagline`)
|
|
8
|
+
- To colour or emphasise part of a sentence, by nesting `Bold`, `Italic`, `Underline` or a `Text as="span"` inside a `Text`
|
|
9
|
+
|
|
10
|
+
## When Not to Use
|
|
11
|
+
|
|
12
|
+
- Instead of a component's own text props. Pass text to the prop the component provides: `Page` `title` and `subtitle`, `TextField` `label`, `Modal` `header`, `EmptyState` `title` and so on. Those props already apply the right style
|
|
13
|
+
- Don't use raw `h1`–`h5`, `p` or `span` elements for text. Use `<Text as="h1">` (or the matching `as` value) instead
|
|
14
|
+
- Don't wrap a `Text` around another component to restyle its text. Use the component's props or theme instead
|
|
15
|
+
- For links, use `Link`. For a keyboard shortcut, use `ShortcutKey`
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Choosing `as`
|
|
20
|
+
|
|
21
|
+
The `as` prop sets both the HTML element and the text style. Pick it by the role of the text, not by the size you want. `as` defaults to `body`.
|
|
22
|
+
|
|
23
|
+
| `as` | Renders | When to use |
|
|
24
|
+
| ----------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `h1` | `<h1>` | Page title. Only one per page. `Page` already renders its `title` as `h1`, so you rarely need it inside a `Page` |
|
|
26
|
+
| `h2` | `<h2>` | Section titles inside a page |
|
|
27
|
+
| `h3` | `<h3>` | Titles inside a piece of content, such as a card or a group of fields |
|
|
28
|
+
| `h4` | `<h4>` | Sub-titles below an `h3` |
|
|
29
|
+
| `h5` | `<h5>` | The smallest heading, e.g. a label above a short list |
|
|
30
|
+
| `body` | `<p>` | Default UI text (13px): descriptions, helper copy, table cells |
|
|
31
|
+
| `paragraph` | `<p>` | Long-form reading text (14px), such as several sentences of explanation |
|
|
32
|
+
| `caption` | `<p>` | Small secondary text (11px), such as timestamps, footnotes or metadata |
|
|
33
|
+
| `insight` | `<p>` | Large text (28px) for a key number or metric, e.g. a total on a dashboard card |
|
|
34
|
+
| `tagline` | `<p>` | Large text (24px) for a short headline, e.g. the title of a custom empty or welcome state |
|
|
35
|
+
| `span` | `<span>` | Body-styled inline text, used inside another `Text` to change the colour or style of a few words |
|
|
36
|
+
|
|
37
|
+
- Keep the heading levels in order (`h1` → `h2` → `h3`). Don't skip a level to get a smaller size; screen readers use heading levels to navigate the page.
|
|
38
|
+
- Use `span` only inside another text element. A `body` text already renders as a `<p>`, so don't nest a `body` inside a `body`.
|
|
39
|
+
|
|
40
|
+
### Emphasis
|
|
41
|
+
|
|
42
|
+
- `emphasis` takes a single value or an array to combine several, e.g. `emphasis={['bold', 'italic']}`.
|
|
43
|
+
- `bold`, `italic`, `underline` and `strikethrough` apply to the whole text. To emphasise only part of a sentence, nest `Bold`, `Italic` or `Underline` inside the `Text`.
|
|
44
|
+
- `dotted-underline` signals that hovering the text shows more information. Pair it with a `Tooltip`.
|
|
45
|
+
- `monospace` makes digits fixed-width so numbers line up in columns (e.g. hours or amounts in a table). It does not change the font of letters.
|
|
46
|
+
- Use emphasis sparingly. Don't bold a whole paragraph or use `underline` on text that is not a link, as it looks clickable.
|
|
47
|
+
|
|
48
|
+
### Colour
|
|
49
|
+
|
|
50
|
+
- Text inherits its colour by default, which is the right choice in most cases.
|
|
51
|
+
- To change it, pass a colour token name without the `--color-` prefix to `color`, e.g. `color="surface-on-color-subtle"`. Don't pass a hex value or any other raw CSS colour.
|
|
52
|
+
- Use the `on-` tokens, which are meant for text and icons:
|
|
53
|
+
|
|
54
|
+
| Token | When to use |
|
|
55
|
+
| ------------------------------------------------------------------------------------------ | ---------------------------------------------------------- |
|
|
56
|
+
| `surface-on-color` | Default text on a surface |
|
|
57
|
+
| `surface-on-color-bold` | Higher-emphasis text |
|
|
58
|
+
| `surface-on-color-subtle` | Secondary text, such as descriptions, metadata or captions |
|
|
59
|
+
| `surface-on-color-disabled` | Text of a disabled element |
|
|
60
|
+
| `surface-on-inverse` | Text on an inverse (dark in light mode) surface |
|
|
61
|
+
| `danger-on-container`, `success-on-container`, `warning-on-container`, `info-on-container` | Text on the matching status container colour |
|
|
62
|
+
|
|
63
|
+
- Don't rely on colour alone to communicate meaning, such as an error. Pair it with text or an icon.
|
|
64
|
+
|
|
65
|
+
## Additional Rules
|
|
66
|
+
|
|
67
|
+
- `as` defaults to `body`. `body`, `paragraph`, `caption`, `insight` and `tagline` all render a `<p>`, so they can't be placed inside another `<p>`; use `span` for inline text.
|
|
68
|
+
- `alignment` accepts `left`, `right`, `center` or `justify`. Leave it unset to inherit the alignment.
|
|
69
|
+
- `textWrap="nowrap"` keeps the text on a single line. Make sure the container has room for it, or it will overflow.
|
|
70
|
+
- `Text` has no margin of its own. Space text from other elements with `Stack` or `Inline` rather than adding margins.
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
### Best Practices
|
|
26
26
|
|
|
27
|
-
-
|
|
27
|
+
- `toast` is a function, not a component. Call it with the message and an optional theme as the second argument: `toast('Changes saved')` for confirmations and neutral notifications, and `toast('Something went wrong', 'danger')` for errors. The theme defaults to `'default'`.
|
|
28
|
+
- To offer a follow-up action like "Undo", pass `actionText` and `onActionClick` in the third (options) argument: `toast('Shift deleted', 'default', { actionText: 'Undo', onActionClick: handleUndo })`.
|
|
28
29
|
- Toasts should be fired after an action has occurred, such as clicking a submit button in a form.
|
|
29
30
|
- Make sure to call toast at least one component level below the `<SousChefProvider>`.
|
|
30
31
|
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
## When Not to Use
|
|
10
10
|
|
|
11
|
-
- Inside a form that requires a submit action to save — use a `
|
|
11
|
+
- Inside a form that requires a submit action to save — use a `CheckboxField` instead
|
|
12
12
|
- When the user is selecting one option from a group of mutually exclusive choices — use a radio group instead
|
|
13
|
-
- When more than two states are needed — use a `
|
|
13
|
+
- When more than two states are needed — use a `SelectField` or `SegmentedControl` instead
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
## When Not to Use
|
|
10
10
|
|
|
11
11
|
- Inside a form — use `SelectField` instead
|
|
12
|
-
- When the selection should trigger an action rather than filter content — use a `Button
|
|
12
|
+
- When the selection should trigger an action rather than filter content — use a `Button`, or a `Dropdown` with a `Button` as its `trigger`, instead
|
|
13
13
|
- When the user needs to select multiple values — use a multi-select form field instead
|
|
14
14
|
- When there are only 2 or 3 static ungrouped actions - use a `SegmentedControl` instead
|
|
15
15
|
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
- Always place ToolbarSelect in a toolbar alongside other filters and controls, not inline within page content
|
|
19
19
|
- Use `prefix` to add an icon before the selected value, which helps identify what the filter controls at a glance — especially useful when multiple ToolbarSelects appear in the same toolbar
|
|
20
20
|
- Use `placeholder` to indicate what the filter represents when no selection has been made — e.g. "All locations", "All roles"
|
|
21
|
-
- Use grouped options (`
|
|
21
|
+
- Use grouped options (pass `options` as an array of `{ label, options }` groups) when the option list has a natural category structure that helps the user scan and find the right choice faster
|
|
22
22
|
- Use `creatableButton` sparingly — only when the user legitimately needs to add new options on the fly as part of their workflow
|
|
@@ -30,7 +30,7 @@ The tooltip appears above or below the trigger by default, and will reposition i
|
|
|
30
30
|
|
|
31
31
|
### Delays
|
|
32
32
|
|
|
33
|
-
`delayOnOpen` adds a small pause before the tooltip appears — useful when a trigger is near other interactive elements and you want to avoid tooltips flashing as the user moves between them. `delayOnClose` keeps the tooltip open briefly after the user moves away, which is helpful when the overlay itself contains selectable text or a link
|
|
33
|
+
`delayOnOpen` adds a small pause before the tooltip appears — useful when a trigger is near other interactive elements and you want to avoid tooltips flashing as the user moves between them. `delayOnClose` keeps the tooltip open briefly after the user moves away, which is helpful when the overlay itself contains selectable text or a link. Both work with any theme.
|
|
34
34
|
|
|
35
35
|
## Tips & Tricks
|
|
36
36
|
|