@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.
Files changed (223) hide show
  1. package/dist/actions/Button/Button.d.ts +5 -1
  2. package/dist/actions/Link/Link.d.ts +7 -0
  3. package/dist/actions/PaginationControls/PaginationControls.d.ts +7 -5
  4. package/dist/actions/Toggle/Toggle.d.ts +2 -0
  5. package/dist/controls/DateFilter/DateFilter.d.ts +16 -1
  6. package/dist/controls/SegmentedControl/SegmentedControl.d.ts +6 -0
  7. package/dist/controls/ToolbarSelect/ToolbarSelect.d.ts +9 -1
  8. package/dist/core/SousChefProvider/SousChefProvider.d.ts +7 -0
  9. package/dist/empty_states/EmptyStateContainer/types.d.ts +16 -2
  10. package/dist/feedback/CircularProgress/CircularProgress.d.ts +1 -0
  11. package/dist/feedback/InlineBanner/InlineBanner.d.ts +1 -0
  12. package/dist/feedback/MicroBanner/MicroBanner.d.ts +1 -0
  13. package/dist/feedback/PersistentBanner/PersistentBanner.d.ts +6 -0
  14. package/dist/feedback/ProgressBar/ProgressBar.d.ts +7 -1
  15. package/dist/feedback/Spinner/Spinner.d.ts +6 -0
  16. package/dist/feedback/Toast/Toast.d.ts +13 -0
  17. package/dist/forms/CheckboxField/CheckboxField.d.ts +4 -0
  18. package/dist/forms/CurrencyField/CurrencyField.d.ts +5 -21
  19. package/dist/forms/DateField/DateField.d.ts +13 -1
  20. package/dist/forms/DateRangeField/DateRangeCalendar/DateRangeCalendar.d.ts +6 -3
  21. package/dist/forms/DateRangeField/DateRangeField.d.ts +17 -3
  22. package/dist/forms/Form/Form.d.ts +13 -2
  23. package/dist/forms/FormFeedback/FormFeedback.d.ts +1 -0
  24. package/dist/forms/FormFooter/FormFooter.d.ts +11 -5
  25. package/dist/forms/FormFooter/FormFooterActions/FormFooterActions.d.ts +2 -5
  26. package/dist/forms/FormFooter/types.d.ts +10 -0
  27. package/dist/forms/FormRow/FormRow.d.ts +6 -0
  28. package/dist/forms/FormSection/FormSection.d.ts +4 -0
  29. package/dist/forms/MultiSelectField/MultiSelectField.d.ts +6 -2
  30. package/dist/forms/NumberField/NumberField.d.ts +4 -0
  31. package/dist/forms/PasswordField/PasswordField.d.ts +3 -0
  32. package/dist/forms/PercentageField/PercentageField.d.ts +13 -0
  33. package/dist/forms/PhoneField/PhoneField.d.ts +10 -0
  34. package/dist/forms/PillSelectField/PillSelectField.d.ts +9 -0
  35. package/dist/forms/PillSelectField/types.d.ts +2 -0
  36. package/dist/forms/RadioGroupBoxOption/RadioGroupBoxOption.d.ts +7 -0
  37. package/dist/forms/RadioGroupField/RadioGroupField.d.ts +8 -1
  38. package/dist/forms/RadioGroupField/RadioGroupFieldContext.d.ts +2 -1
  39. package/dist/forms/RadioGroupOption/RadioGroupOption.d.ts +6 -1
  40. package/dist/forms/SelectField/SelectField.d.ts +20 -3
  41. package/dist/forms/SelectField/types.d.ts +27 -0
  42. package/dist/forms/TextAreaField/TextAreaField.d.ts +7 -1
  43. package/dist/forms/TextField/TextField.d.ts +8 -0
  44. package/dist/forms/TimeField/TimeField.d.ts +23 -1
  45. package/dist/forms/TimeRangeField/TimeRangeField.d.ts +15 -2
  46. package/dist/forms/WeekField/WeekField.d.ts +4 -0
  47. package/dist/forms/WeekSelectField/WeekSelectField.d.ts +4 -0
  48. package/dist/forms/hooks/useRadioGroupFieldControllers.d.ts +1 -2
  49. package/dist/forms/hooks/useSelectFieldControllers.d.ts +2 -2
  50. package/dist/forms/index.d.ts +2 -0
  51. package/dist/foundation/tokens/color/color-constants.d.ts +34 -0
  52. package/dist/foundation/tokens/color/color-types.d.ts +1 -1
  53. package/dist/foundation/tokens/dimension/dimension-tokens.d.ts +1 -0
  54. package/dist/foundation/tokens/layout/TokenTable.d.ts +14 -0
  55. package/dist/foundation/tokens/layout/layout-tokens.d.ts +12 -0
  56. package/dist/hooks/useIsOverflowing.d.ts +2 -0
  57. package/dist/index.css +755 -479
  58. package/dist/index.css.map +1 -1
  59. package/dist/index.d.ts +2 -1
  60. package/dist/index.js +1295 -941
  61. package/dist/index.js.map +1 -1
  62. package/dist/index.modern.js +1431 -1098
  63. package/dist/index.modern.js.map +1 -1
  64. package/dist/ink_illustrations/components/design/Ink3DModeling.d.ts +7 -0
  65. package/dist/ink_illustrations/components/design/index.d.ts +1 -1
  66. package/dist/ink_illustrations/components/index.d.ts +2 -2
  67. package/dist/ink_illustrations/components/other/InkSculptureBust.d.ts +7 -0
  68. package/dist/ink_illustrations/components/other/index.d.ts +1 -1
  69. package/dist/ink_illustrations/components/{design/Ink3DModeling02.d.ts → travel/InkBoardingPass.d.ts} +2 -2
  70. package/dist/ink_illustrations/components/travel/InkVolcano.d.ts +7 -0
  71. package/dist/ink_illustrations/components/travel/index.d.ts +2 -2
  72. package/dist/ink_illustrations/components/weather/InkSun.d.ts +7 -0
  73. package/dist/ink_illustrations/components/weather/index.d.ts +1 -1
  74. package/dist/ink_illustrations/deprecatedAliases.d.ts +27 -0
  75. package/dist/ink_illustrations/index.d.ts +1 -0
  76. package/dist/layout/CalloutCard/CalloutCard.d.ts +1 -0
  77. package/dist/layout/Card/Card.d.ts +14 -0
  78. package/dist/layout/Inline/Inline.d.ts +20 -4
  79. package/dist/layout/Page/Page.d.ts +11 -3
  80. package/dist/layout/Page/PageBreadcrumbs/PageBreadcrumbs.d.ts +2 -2
  81. package/dist/layout/Page/types.d.ts +11 -2
  82. package/dist/layout/PageLayout/PageLayout.d.ts +18 -0
  83. package/dist/layout/PageLayout/types.d.ts +10 -0
  84. package/dist/layout/Stack/Stack.d.ts +16 -4
  85. package/dist/layout/index.d.ts +1 -0
  86. package/dist/lists/Accordion/Accordion.d.ts +10 -0
  87. package/dist/lists/Accordion/types.d.ts +4 -0
  88. package/dist/lists/ActionList/ActionList.d.ts +12 -0
  89. package/dist/lists/ActionList/type.d.ts +5 -0
  90. package/dist/lists/ActionListItem/ActionListItem.d.ts +17 -0
  91. package/dist/lists/BasicTable/BasicTable.d.ts +22 -0
  92. package/dist/lists/BasicTable/BasicTableSectionContext.d.ts +4 -0
  93. package/dist/lists/BasicTable/constants.d.ts +13 -0
  94. package/dist/lists/BasicTable/index.d.ts +1 -0
  95. package/dist/lists/BasicTable/types.d.ts +4 -0
  96. package/dist/lists/BasicTableBody/BasicTableBody.d.ts +9 -0
  97. package/dist/lists/BasicTableBody/index.d.ts +1 -0
  98. package/dist/lists/BasicTableCell/BasicTableCell.d.ts +14 -0
  99. package/dist/lists/BasicTableCell/index.d.ts +1 -0
  100. package/dist/lists/BasicTableHeader/BasicTableHeader.d.ts +9 -0
  101. package/dist/lists/BasicTableHeader/index.d.ts +1 -0
  102. package/dist/lists/BasicTableRow/BasicTableRow.d.ts +9 -0
  103. package/dist/lists/BasicTableRow/index.d.ts +1 -0
  104. package/dist/lists/DataTable/DataTable.d.ts +31 -8
  105. package/dist/lists/DataTable/types.d.ts +35 -0
  106. package/dist/lists/DataTableCell/DataTableCell.d.ts +1 -0
  107. package/dist/lists/DataTableEditableCell/DataTableEditableCell.d.ts +1 -0
  108. package/dist/lists/DataTableRow/DataTableRow.d.ts +12 -0
  109. package/dist/lists/index.d.ts +7 -1
  110. package/dist/media/Avatar/Avatar.d.ts +1 -0
  111. package/dist/media/Badge/Badge.d.ts +7 -2
  112. package/dist/media/Pill/Pill.d.ts +8 -0
  113. package/dist/media/Pill/constants.d.ts +2 -0
  114. package/dist/media/Pill/types.d.ts +3 -1
  115. package/dist/navigation/BreadcrumbItem/BreadcrumbItem.d.ts +1 -0
  116. package/dist/navigation/Breadcrumbs/Breadcrumbs.d.ts +1 -0
  117. package/dist/navigation/PrimaryNav/PrimaryNav.d.ts +1 -0
  118. package/dist/navigation/PrimaryNavFooter/PrimaryNavFooter.d.ts +1 -0
  119. package/dist/navigation/PrimaryNavItem/PrimaryNavItem.d.ts +1 -0
  120. package/dist/navigation/PrimaryNavSubItem/PrimaryNavSubItem.d.ts +1 -0
  121. package/dist/navigation/Tab/Tab.d.ts +1 -0
  122. package/dist/navigation/TabList/TabList.d.ts +1 -0
  123. package/dist/navigation/TabPanel/TabPanel.d.ts +1 -0
  124. package/dist/navigation/Tabs/Tabs.d.ts +1 -0
  125. package/dist/overlay/Calendar/Calendar.d.ts +15 -4
  126. package/dist/overlay/Dropdown/Dropdown.d.ts +1 -0
  127. package/dist/overlay/DropdownListDivider/DropdownListDivider.d.ts +1 -0
  128. package/dist/overlay/DropdownListItem/DropdownListItem.d.ts +1 -0
  129. package/dist/overlay/DropdownListItemSelectable/DropdownListItemSelectable.d.ts +1 -0
  130. package/dist/overlay/DropdownSubmenu/DropdownSubmenu.d.ts +1 -0
  131. package/dist/overlay/HintModal/HintModal.d.ts +1 -0
  132. package/dist/overlay/KebabMenu/types.d.ts +5 -0
  133. package/dist/overlay/Modal/Modal.d.ts +3 -0
  134. package/dist/overlay/Modal/ModalBody/ModalBody.d.ts +1 -0
  135. package/dist/overlay/Modal/ModalFooter/ModalFooter.d.ts +11 -6
  136. package/dist/overlay/Modal/ModalFooter/types.d.ts +10 -0
  137. package/dist/overlay/Popover/Popover.d.ts +8 -1
  138. package/dist/overlay/Tooltip/Tooltip.d.ts +2 -1
  139. package/dist/overlay/index.d.ts +1 -0
  140. package/dist/typography/KeyboardKey/KeyboardKey.d.ts +1 -0
  141. package/dist/typography/Text/Bold/Bold.d.ts +1 -0
  142. package/dist/typography/Text/Italic/Italic.d.ts +1 -0
  143. package/dist/typography/Text/Text.d.ts +23 -0
  144. package/dist/typography/Text/Underline/Underline.d.ts +1 -0
  145. package/dist/utils/formik.d.ts +5 -0
  146. package/llms-instructions/guidelines/ActionList.guidelines.md +1 -3
  147. package/llms-instructions/guidelines/Avatar.guidelines.md +6 -5
  148. package/llms-instructions/guidelines/Badge.guidelines.md +24 -8
  149. package/llms-instructions/guidelines/BasicTable.guidelines.md +80 -0
  150. package/llms-instructions/guidelines/Breadcrumbs.guidelines.md +2 -2
  151. package/llms-instructions/guidelines/Button.guidelines.md +3 -3
  152. package/llms-instructions/guidelines/Calendar.guidelines.md +12 -0
  153. package/llms-instructions/guidelines/Card.guidelines.md +2 -2
  154. package/llms-instructions/guidelines/CircularProgress.guidelines.md +1 -1
  155. package/llms-instructions/guidelines/DateFilter.guidelines.md +2 -2
  156. package/llms-instructions/guidelines/Dropdown.guidelines.md +3 -2
  157. package/llms-instructions/guidelines/EmptyState.guidelines.md +3 -1
  158. package/llms-instructions/guidelines/{Forms.guidelines.md → Form.guidelines.md} +41 -6
  159. package/llms-instructions/guidelines/Icons.guidelines.md +11 -10
  160. package/llms-instructions/guidelines/InkIllustrations.guidelines.md +5 -4
  161. package/llms-instructions/guidelines/Inline.guidelines.md +55 -0
  162. package/llms-instructions/guidelines/InlineBanner.guidelines.md +5 -3
  163. package/llms-instructions/guidelines/MultiSelectField.guidelines.md +2 -2
  164. package/llms-instructions/guidelines/Page.guidelines.md +65 -0
  165. package/llms-instructions/guidelines/PageLayout.guidelines.md +85 -0
  166. package/llms-instructions/guidelines/Paywall.guidelines.md +3 -2
  167. package/llms-instructions/guidelines/PersistentBanner.guidelines.md +2 -2
  168. package/llms-instructions/guidelines/Pill.guidelines.md +31 -3
  169. package/llms-instructions/guidelines/PillSelectField.guidelines.md +1 -1
  170. package/llms-instructions/guidelines/PrimaryNav.guidelines.md +144 -0
  171. package/llms-instructions/guidelines/SegmentedControl.guidelines.md +2 -2
  172. package/llms-instructions/guidelines/Skeleton.guidelines.md +3 -3
  173. package/llms-instructions/guidelines/Spinner.guidelines.md +6 -4
  174. package/llms-instructions/guidelines/Stack.guidelines.md +53 -0
  175. package/llms-instructions/guidelines/Text.guidelines.md +70 -0
  176. package/llms-instructions/guidelines/Toast.guidelines.md +2 -1
  177. package/llms-instructions/guidelines/Toggle.guidelines.md +2 -2
  178. package/llms-instructions/guidelines/ToolbarSelect.guidelines.md +2 -2
  179. package/llms-instructions/guidelines/Tooltip.guidelines.md +1 -1
  180. package/llms-instructions/llms-components.md +91 -19
  181. package/llms-instructions/llms-composing-components.md +583 -219
  182. package/llms-instructions/llms-icons-and-illustrations.md +305 -1011
  183. package/llms-instructions/llms-tokens.md +227 -164
  184. package/llms-instructions/llms.md +12 -28
  185. package/package.json +2 -2
  186. package/dist/ink_illustrations/components/other/InkS/321/201ulptureBust.d.ts +0 -7
  187. package/dist/ink_illustrations/components/travel/InkDrawing.d.ts +0 -7
  188. package/dist/ink_illustrations/components/travel/InkDrawing1.d.ts +0 -7
  189. package/dist/ink_illustrations/components/weather/InkGroup7975.d.ts +0 -7
  190. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/Ink3DGlasses.d.ts +0 -0
  191. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkAmusementPark.d.ts +0 -0
  192. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkBallet.d.ts +0 -0
  193. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkBowling.d.ts +0 -0
  194. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkCardGames.d.ts +0 -0
  195. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkCarouselWithHorses.d.ts +0 -0
  196. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkDiscoBall.d.ts +0 -0
  197. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkDj.d.ts +0 -0
  198. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkFirecracker.d.ts +0 -0
  199. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkJoystick.d.ts +0 -0
  200. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkMagicTricks.d.ts +0 -0
  201. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkMascarade.d.ts +0 -0
  202. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkNotesChart.d.ts +0 -0
  203. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkRollerSkating.d.ts +0 -0
  204. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkSlotMachine.d.ts +0 -0
  205. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/InkTheatre.d.ts +0 -0
  206. /package/dist/ink_illustrations/components/{enterteniment → entertainment}/index.d.ts +0 -0
  207. /package/dist/ink_illustrations/components/{sciency → science}/InkAnatomy.d.ts +0 -0
  208. /package/dist/ink_illustrations/components/{sciency → science}/InkAsteroid.d.ts +0 -0
  209. /package/dist/ink_illustrations/components/{sciency → science}/InkAstronaut.d.ts +0 -0
  210. /package/dist/ink_illustrations/components/{sciency → science}/InkBacteria.d.ts +0 -0
  211. /package/dist/ink_illustrations/components/{sciency → science}/InkChemistry.d.ts +0 -0
  212. /package/dist/ink_illustrations/components/{sciency → science}/InkDna.d.ts +0 -0
  213. /package/dist/ink_illustrations/components/{sciency → science}/InkLabTube.d.ts +0 -0
  214. /package/dist/ink_illustrations/components/{sciency → science}/InkMicroChips.d.ts +0 -0
  215. /package/dist/ink_illustrations/components/{sciency → science}/InkMicroscope.d.ts +0 -0
  216. /package/dist/ink_illustrations/components/{sciency → science}/InkNewtonsCradle.d.ts +0 -0
  217. /package/dist/ink_illustrations/components/{sciency → science}/InkNuclearEnergy.d.ts +0 -0
  218. /package/dist/ink_illustrations/components/{sciency → science}/InkPlanet.d.ts +0 -0
  219. /package/dist/ink_illustrations/components/{sciency → science}/InkPlantInTube.d.ts +0 -0
  220. /package/dist/ink_illustrations/components/{sciency → science}/InkRobotics.d.ts +0 -0
  221. /package/dist/ink_illustrations/components/{sciency → science}/InkSpaceTravel.d.ts +0 -0
  222. /package/dist/ink_illustrations/components/{sciency → science}/InkTelescope.d.ts +0 -0
  223. /package/dist/ink_illustrations/components/{sciency → science}/index.d.ts +0 -0
@@ -1,7 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { ButtonTheme, ButtonSize, ButtonType, ButtonTarget } from './types';
3
3
  import type { PositionStyles, DataProps } from '../../foundation/types';
4
+ /**
5
+ * Buttons trigger actions or navigation. Default buttons are used for secondary, understated, or redundant actions. If you don't know what a button should be, it's probably this. Use the `theme` prop for primary, danger, upsell and link styles, and `href` to make it act as a link.
6
+ */
4
7
  declare const Button: React.ForwardRefExoticComponent<{
8
+ /** Content of the button. Usually a text label; it can also be an icon, or an icon followed by a label. A single child that is not a string (e.g. an icon, a number or any element, even one that renders text) gets icon-only styling. */
5
9
  children: React.ReactNode;
6
10
  /** Native HTML button type. If `submit` it will trigger the form `onSubmit`. */
7
11
  type?: ButtonType | undefined;
@@ -21,7 +25,7 @@ declare const Button: React.ForwardRefExoticComponent<{
21
25
  /** This will show a black tooltip when the user hover the button */
22
26
  title?: string | React.ReactNode;
23
27
  /**
24
- * @description It will show a black tooltip when the user hover the button.
28
+ * @description URL to navigate to. When provided, the button renders as an `<a>` element styled as a button instead of a `<button>`.
25
29
  * @category Acting as Link
26
30
  */
27
31
  href?: string | undefined;
@@ -2,11 +2,18 @@ import React from 'react';
2
2
  import { Target, Theme } from './types';
3
3
  import { DataProps } from '../../foundation/types';
4
4
  type Props = {
5
+ /** URL the link navigates to. */
5
6
  href: string;
7
+ /** Where to open the linked URL. Links open in a new tab (`_blank`) by default; use `_self` for internal navigation. */
6
8
  target?: Target;
9
+ /** Link color theme. Use `contrast` on dark backgrounds. */
7
10
  theme?: Theme;
8
11
  onClick?: React.MouseEventHandler;
12
+ /** Content of the link, usually text. */
9
13
  children: React.ReactNode;
10
14
  } & DataProps;
15
+ /**
16
+ * Links are used to redirect to other pages. Usually external sources are opened on a separate browser tab. Use a `Button` instead when the element triggers an action rather than navigation.
17
+ */
11
18
  declare const Link: ({ href, target, theme, onClick, children, ...otherProps }: Props) => React.JSX.Element;
12
19
  export default Link;
@@ -1,20 +1,22 @@
1
1
  import React from 'react';
2
2
  import { DataProps } from '../../foundation/types';
3
3
  type Props = {
4
- /** It will enable or disable the `Previous` button. */
4
+ /** Enables or disables the `Previous` button (and the J shortcut). */
5
5
  hasPrevious?: boolean;
6
- /** It will enable or disable the `Next` button. */
6
+ /** Enables or disables the `Next` button (and the K shortcut). */
7
7
  hasNext?: boolean;
8
- /** It will be fired when the `Previous` button is clicked */
8
+ /** Called when the `Previous` button is clicked or the J key is pressed, unless `hasPrevious` is `false`. */
9
9
  onPreviousClick: () => void;
10
- /** It will be fired when the `Next` button is clicked */
10
+ /** Called when the `Next` button is clicked or the K key is pressed, unless `hasNext` is `false`. */
11
11
  onNextClick: () => void;
12
12
  testId?: string;
13
13
  /** It is a target element that will be scrolled to the top when the buttons are clicked */
14
14
  scrollTarget?: React.RefObject<HTMLElement>;
15
15
  } & DataProps;
16
16
  /**
17
- * `PaginationControls` are two buttons side by side.
17
+ * `PaginationControls` are two buttons side by side, `Previous` and `Next`.
18
+ *
19
+ * They come with keyboard shortcuts: J is previous and K is next. The key listener is attached to `document`, so the shortcuts work wherever focus is (except while typing in a textarea or a text, email, number, search, tel, url or password input; `contenteditable` elements are not excluded), and every mounted `PaginationControls` responds to them. Render only one at a time on a page, or the shortcuts will page several lists at once.
18
20
  */
19
21
  declare const PaginationControls: React.FC<Props>;
20
22
  export default PaginationControls;
@@ -4,7 +4,9 @@ type Props = {
4
4
  /** It turns the toggle ON if `true` and OFF if `false` */
5
5
  checked: boolean;
6
6
  onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
+ /** Text shown next to the toggle. Clicking it also switches the toggle. */
7
8
  label?: React.ReactNode;
9
+ /** Helper text shown below the label. */
8
10
  caption?: React.ReactNode;
9
11
  disabled?: boolean;
10
12
  id?: string;
@@ -3,15 +3,30 @@ import { WeekStart } from '../../utils/date';
3
3
  import { HighlightGroup } from '../../utils/highlight';
4
4
  import { DateFilterMode } from './types';
5
5
  type Props = {
6
+ /** Granularity of the filter: `day`, `week` or `month`. The arrows step by this unit and the calendar picks a day, a week or a month accordingly. */
6
7
  mode?: DateFilterMode;
8
+ /** First day of the week used in `week` mode and in the calendar: `0` (Sunday) to `6` (Saturday). */
7
9
  weekStart?: WeekStart;
10
+ /** Currently selected date. In `week` and `month` mode, any date inside the period selects that period. */
8
11
  value: Date;
12
+ /** Called with the new date when the user steps with the arrows or picks a date in the calendar. */
9
13
  onChange: (selected: Date) => void;
10
14
  /** Highlight one or more groups of dates below the calendar, each with its
11
15
  * own shape, colour theme, and legend label. Applies to the day and week
12
- * calendars (not the month picker). */
16
+ * calendars (not the month picker).
17
+ *
18
+ * Each `HighlightGroup` is an object with:
19
+ * - `dates` (required): `Matcher | Matcher[]` from react-day-picker: a `Date`, an array of dates, a `{ from, to }` range, `{ dayOfWeek: number[] }` or a `(date: Date) => boolean` function. Helpers such as `nthWeekdayOfMonth`, `everyOtherWeekday`, `firstOfMonth` and `lastOfMonth` build common patterns.
20
+ * - `label` (required): `string` shown in the legend, e.g. "Pay Days".
21
+ * - `theme`: `'success' | 'danger' | 'warning' | 'info' | 'upsell' | 'neutral'`. Defaults to `'success'`.
22
+ * - `shape`: `'circle' | 'circle-dashed' | 'square' | 'square-dashed' | 'octagon' | 'star'`. Defaults to `'circle'`.
23
+ *
24
+ * When a day matches more than one group, the first group wins. */
13
25
  highlightedDays?: HighlightGroup[] | HighlightGroup;
14
26
  testId?: string;
15
27
  };
28
+ /**
29
+ * DateFilter filters content on the page by date, either by day, week or month. Users can step backward and forward with the arrows or click the date to pick one from a calendar.
30
+ */
16
31
  declare const DateFilter: React.FC<Props>;
17
32
  export default DateFilter;
@@ -1,9 +1,15 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
+ /** Labels of the segments, in display order. Each string is both the visible label and the value passed to `onChange`, so they must be unique. */
3
4
  options: string[];
5
+ /** Called with the clicked option string. */
4
6
  onChange: (action: string) => void;
7
+ /** The currently selected option. Must match one of the strings in `options`. */
5
8
  value: string;
6
9
  testId?: string;
7
10
  };
11
+ /**
12
+ * Segmented Control is typically used in a toolbar to switch between different views. It can have as many options as needed. It is controlled: keep the selected option in state and pass it back through `value`.
13
+ */
8
14
  declare const SegmentedControl: ({ options, onChange, value, testId }: Props) => React.JSX.Element;
9
15
  export default SegmentedControl;
@@ -1,7 +1,15 @@
1
1
  import React from 'react';
2
2
  import { Props } from '../../forms/SelectField/SelectField';
3
+ import type { SelectOption } from '../../forms/SelectField/types';
3
4
  import { DataProps } from '../../foundation/types';
4
- type ToolbarSelectProps<T> = Omit<Props<T>, 'asToolbarFilter' | 'caption' | 'error' | 'id' | 'isClearable' | 'label' | 'noOptionMessage' | 'CustomOption' | 'SelectedOptionPrefix' | 'isSearchable'> & DataProps;
5
+ type ToolbarSelectProps<T> = {
6
+ /** Name of the filter, used to generate the input `id`. Toolbar filters usually live outside a form and are controlled with `value` and `onChange`; inside a Sous Chef `Form` the filter is also bound to the Formik value with this name. */
7
+ name: string;
8
+ /** The selected option, as a full `SelectOption` object (`{ value, label }`), not only its `value`. Pass `null` to clear the selection. */
9
+ value?: SelectOption<T> | null;
10
+ /** When `true`, opening the menu scrolls the page so the whole menu is visible. Leave it off when the toolbar is inside a modal or another scrolling container. */
11
+ menuShouldScrollIntoView?: boolean;
12
+ } & Omit<Props<T>, 'name' | 'value' | 'menuShouldScrollIntoView' | 'asToolbarFilter' | 'caption' | 'error' | 'id' | 'isClearable' | 'label' | 'noOptionMessage' | 'CustomOption' | 'SelectedOptionPrefix' | 'isSearchable'> & DataProps;
5
13
  /** ToolbarSelect is a compact dropdown filter for use in toolbars. It lets a user narrow page content or a paired component content by selecting from a predefined list of options. */
6
14
  declare const ToolbarSelect: <T extends unknown>({ name, value, options, onChange, onBlur, placeholder, defaultValue, menuShouldScrollIntoView, disabled, prefix, testId, creatableButton, onCreate, ...rest }: ToolbarSelectProps<T>) => React.JSX.Element;
7
15
  export default ToolbarSelect;
@@ -3,10 +3,17 @@ import en from '../../i18n/locales/en.json';
3
3
  import { CountryCode } from 'libphonenumber-js';
4
4
  import { TimeFormat } from '../../forms/TimeField/types';
5
5
  type Props = {
6
+ /** Translations for the text the components render themselves, such as "Previous" and "Next" in `PaginationControls`. Pass an object with the same keys as the bundled English strings. */
6
7
  i18n?: typeof en;
8
+ /** ISO 3166-1 alpha-2 country code. Sets the default country of `PhoneField`. Unsupported codes fall back to `US`. */
7
9
  country?: CountryCode;
10
+ /** Your app. Sous Chef components must be rendered inside the provider. */
8
11
  children: React.ReactNode;
12
+ /** Default time format of `TimeField`: `ampm` (e.g. 9:00 AM) or `24h` (e.g. 09:00). */
9
13
  timeFormat?: TimeFormat;
10
14
  };
15
+ /**
16
+ * Sets up Sous Chef for your app. Render it once, at the root of your app: every Sous Chef component must be rendered inside it. It mounts the `ToastContainer` used by `toast()`, follows the light or dark theme (the `theme-dark` class on `<body>`) for illustrations, and provides the translations and the `PhoneField` and `TimeField` defaults.
17
+ */
11
18
  declare const SousChefProvider: ({ children, i18n, country, timeFormat }: Props) => React.JSX.Element;
12
19
  export default SousChefProvider;
@@ -9,12 +9,17 @@ export type EmptyStateProps = {
9
9
  children?: ReactNode;
10
10
  /** Path to the image/gif to display */
11
11
  mediaUrl?: string;
12
- /** Caption that appears below the CTAs */
12
+ /**
13
+ * Call-to-action buttons shown below the body text. An object with optional `primary` and `secondary` keys, each a `Button` element, e.g. `{ primary: <Button>Upgrade</Button>, secondary: <Button>Learn more</Button> }`. Unless you set a `theme` yourself, the primary button uses the `primary` theme (`upsell` on a Paywall) and the secondary uses `default`.
14
+ */
13
15
  actions?: {
14
16
  primary?: React.ReactElement;
15
17
  secondary?: React.ReactElement;
16
18
  };
17
- /** Controls the size and appearance of the component */
19
+ /**
20
+ * Controls the size and appearance of the component: `small` stacks the image above the text, `medium` and `large` place them side by side when there is room.
21
+ * @default large
22
+ */
18
23
  size?: EmptyStateSize;
19
24
  /** Caption that appears below the cta options */
20
25
  caption?: ReactNode;
@@ -23,9 +28,18 @@ export type EmptyStateProps = {
23
28
  testId?: string;
24
29
  };
25
30
  export type EmptyStateAsCard = {
31
+ /**
32
+ * Renders the empty state as a `banner` (inline in the page) or as a `card`.
33
+ * @default banner
34
+ */
26
35
  as?: 'card';
36
+ /** Only available with `as="card"`. Shows a close button on the card and is called when the user clicks it. */
27
37
  onClose?: () => void;
28
38
  } & EmptyStateProps;
29
39
  export type EmptyStateAsBanner = {
40
+ /**
41
+ * Renders the empty state as a `banner` (inline in the page) or as a `card`.
42
+ * @default banner
43
+ */
30
44
  as?: 'banner';
31
45
  } & EmptyStateProps;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  type Props = {
3
3
  progress: number;
4
4
  maxValue?: number;
5
+ /** Content shown in the center of the circle. When empty or falsy (including `0`), it shows `progress/maxValue` instead, e.g. `3/5`. */
5
6
  children?: React.ReactNode;
6
7
  testId?: string;
7
8
  };
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { InlineBannerTheme } from './types';
3
3
  import { PositionStyles } from '../../foundation/types';
4
4
  type Props = {
5
+ /** The banner message, shown below the `title` when provided. */
5
6
  children: React.ReactNode;
6
7
  /** Banner design theme */
7
8
  theme?: InlineBannerTheme;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { MicroBannerTheme } from './types';
3
3
  import { DataProps, PositionStyles } from '../../foundation/types';
4
4
  type Props = {
5
+ /** The banner message. */
5
6
  children?: React.ReactNode;
6
7
  /** Banner design theme */
7
8
  theme?: MicroBannerTheme;
@@ -1,12 +1,18 @@
1
1
  import React from 'react';
2
2
  import { Theme } from './types';
3
3
  type Props = {
4
+ /** Color theme of the banner, based on the kind of message. */
4
5
  theme?: Theme;
6
+ /** A `Button` shown after the message. It is styled as `hollow-contrast` unless you pass a `theme` yourself. */
5
7
  primaryButton?: React.ReactElement;
8
+ /** A `Button` shown after the primary button. It is styled as `link-contrast` unless you pass a `theme` yourself. */
6
9
  secondaryButton?: React.ReactElement;
10
+ /** When provided, a close button is shown on the right and this is called when the user clicks it. Hiding the banner is up to you. */
7
11
  onDismiss?: () => void;
12
+ /** Called once when the banner mounts. Useful for tracking impressions. */
8
13
  onLoad?: () => void;
9
14
  testId?: string;
15
+ /** The banner message. */
10
16
  children: React.ReactNode;
11
17
  };
12
18
  /**
@@ -1,12 +1,18 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
+ /** Current progress. With `steps` and no `maxValue`, it is the number of the current step (e.g. `2` for the second step): the bar fills to the middle of that step, and only values above the number of steps fill it completely. Otherwise it goes from `0` to `maxValue` (or `100`), and values outside that range are clamped. */
3
4
  progress: number;
5
+ /**
6
+ * The value that represents a full bar. Defaults to the number of `steps` when `steps` is non-empty, otherwise to `100`.
7
+ * @default steps.length (100 without steps)
8
+ */
4
9
  maxValue?: number;
5
10
  testId?: string;
11
+ /** Labels shown evenly below the bar, one per step. When provided without `maxValue`, `progress` counts steps and the bar fills to the middle of the current step. */
6
12
  steps?: string[];
7
13
  };
8
14
  /**
9
- * ProgressBar shows a horizontal bar that fills as a task advances.
15
+ * ProgressBar shows a horizontal bar that fills as a task advances. It is used to indicate the overall progress for a task with a varying amount of steps to complete.
10
16
  */
11
17
  declare const ProgressBar: ({ progress, maxValue, testId, steps }: Props) => React.JSX.Element;
12
18
  export default ProgressBar;
@@ -1,9 +1,15 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
+ /** Width and height of the spinner in pixels. */
3
4
  size?: number;
5
+ /** Color of the spinner. Use `contrast` on dark or colored backgrounds and `disabled` on disabled surfaces. */
4
6
  theme?: 'mint' | 'disabled' | 'contrast' | 'pride';
7
+ /** When `true` the spinner is centered in a full-width block. Used in pages when the spinner needs to be centered. */
5
8
  block?: boolean;
6
9
  testId?: string;
7
10
  };
11
+ /**
12
+ * Spinner is an animated indicator that shows content or an action is loading. Use it while waiting for data or for an action to finish.
13
+ */
8
14
  declare const Spinner: React.FC<Props>;
9
15
  export default Spinner;
@@ -3,9 +3,22 @@ import { ToastOptions } from 'react-toastify';
3
3
  import type { Theme } from './types';
4
4
  import 'react-toastify/dist/ReactToastify.css';
5
5
  import type { ToastAction } from './types';
6
+ /**
7
+ * Shows a toast message.
8
+ *
9
+ * @param text Message to show. Only strings are accepted; any other value is ignored.
10
+ * @param theme `'default'` or `'danger'`. Defaults to `'default'`.
11
+ * @param options Any react-toastify `ToastOptions` (e.g. `autoClose`, `toastId`), plus `actionText` and `onActionClick` to render an action button inside the toast. Both are needed for the action to show.
12
+ */
6
13
  export declare const toast: (text: string, theme?: Theme, options?: ToastOptions & ToastAction) => void;
7
14
  type Props = {
15
+ /** Id of the toast container. You rarely need this: `SousChefProvider` already renders a `ToastContainer` with the default id, and `toast()` targets that id. */
8
16
  containerId?: string;
9
17
  };
18
+ /**
19
+ * Toasts are used to inform the user about an action that happened. Show one by calling the `toast(text, theme?, options?)` function, e.g. `toast('Shift saved')` or `toast('Could not save', 'danger', { actionText: 'Retry', onActionClick: retry })`.
20
+ *
21
+ * `SousChefProvider` already renders the `ToastContainer`, so you don't need to render it yourself. **Important:** make sure to call `toast` at least one component level below the `<SousChefProvider>`.
22
+ */
10
23
  export declare const ToastContainer: ({ containerId }: Props) => React.JSX.Element;
11
24
  export {};
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { DataProps } from '../../foundation/types';
3
3
  type Props = {
4
+ /** Field name. Inside a Sous Chef `Form` it binds the field to Formik: the field reads its value and error from the Formik key with this name and writes changes back to it. A `checked` value you pass overrides the Formik value; an `onChange` you pass is called in addition to the Formik update. Nested paths such as `address.city` or `shifts[0].start` work. Also used to generate the `id` when none is given. */
4
5
  name: string;
5
6
  /** If not provided it will generate a random id so the label links properly with the text input */
6
7
  id?: string;
@@ -8,8 +9,11 @@ type Props = {
8
9
  indeterminate?: boolean;
9
10
  onChange?: (e: boolean) => void;
10
11
  onBlur?: (e: boolean) => void;
12
+ /** Text shown next to the checkbox. Clicking it also checks or unchecks the box. */
11
13
  label?: React.ReactNode;
14
+ /** Helper text shown below the label. */
12
15
  caption?: React.ReactNode;
16
+ /** Error message shown below the field. Inside a Sous Chef `Form`, the Formik error for this field's `name` is shown automatically once the field has been touched; passing `error` overrides it. */
13
17
  error?: React.ReactNode;
14
18
  disabled?: boolean;
15
19
  /** This is used for setting the data-testid */
@@ -6,27 +6,11 @@ import type { Props as TextFieldProps } from '../TextField/TextField';
6
6
  * **You are in charge of validating the value and parsing it back to a value that you can use on your application**.
7
7
  */
8
8
  declare const CurrencyField: React.ForwardRefExoticComponent<{
9
- autoComplete?: ("off" | "on") | undefined;
10
- autoFocus?: boolean | undefined;
11
- caption?: React.ReactNode;
12
- defaultValue?: string | undefined;
13
- disabled?: boolean | undefined;
14
- error?: React.ReactNode;
15
- id?: string | undefined;
16
- label?: React.ReactNode;
17
- maxLength?: number | undefined;
18
- name: string;
19
- onBlur?: ((value: string) => void) | undefined;
20
- onChange?: ((value: string) => void) | undefined;
21
- onFocus?: ((value: string) => void) | undefined;
22
- onKeyDown?: ((key: string) => void) | undefined;
23
- placeholder?: string | undefined;
24
- prefix?: React.ReactNode;
25
- suffix?: React.ReactNode;
26
- value?: string | undefined;
27
- testId?: string | undefined;
28
- } & import("../../foundation/types").DataProps & {
29
- currencySymbol: string;
9
+ /** Currency symbol shown at the start of the field, e.g. `$`, `€` or `£`. */
10
+ currencySymbol?: string | undefined;
11
+ /** Increment used by the native number input. Use a whole number (e.g. `1`) to only accept whole amounts without decimals. */
30
12
  step?: number | undefined;
13
+ /** @deprecated Ignored: the field always shows `currencySymbol`. It will be removed in the next major version. */
14
+ prefix?: React.ReactNode;
31
15
  } & Omit<TextFieldProps, "prefix"> & React.RefAttributes<HTMLInputElement>>;
32
16
  export default CurrencyField;
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { WeekStart } from '../../utils/date';
3
3
  import { HighlightGroup } from '../../utils/highlight';
4
4
  type Props = {
5
+ /** Field name. Inside a Sous Chef `Form` it binds the field to Formik: the field reads its value and error from the Formik key with this name and writes changes back to it. A `value` you pass overrides the Formik value; an `onChange` you pass replaces the Formik update, so call `formik.setFieldValue` yourself if you still need it. Nested paths such as `address.city` or `shifts[0].start` work. Also used to generate the `id` when none is given. */
5
6
  name: string;
6
7
  /** If not provided it will generate a random id so the label links properly with the text input */
7
8
  id?: string;
@@ -9,15 +10,26 @@ type Props = {
9
10
  disabledDays?: (day: Date) => boolean;
10
11
  /** Highlight one or more groups of dates below the calendar, each with its
11
12
  * own shape, colour theme, and legend label. Example use cases: pay days,
12
- * holidays, blackout periods. */
13
+ * holidays, blackout periods.
14
+ *
15
+ * Each `HighlightGroup` is an object with:
16
+ * - `dates` (required): `Matcher | Matcher[]` from react-day-picker: a `Date`, an array of dates, a `{ from, to }` range, `{ dayOfWeek: number[] }` or a `(date: Date) => boolean` function. Helpers such as `nthWeekdayOfMonth`, `everyOtherWeekday`, `firstOfMonth` and `lastOfMonth` build common patterns.
17
+ * - `label` (required): `string` shown in the legend, e.g. "Pay Days".
18
+ * - `theme`: `'success' | 'danger' | 'warning' | 'info' | 'upsell' | 'neutral'`. Defaults to `'success'`.
19
+ * - `shape`: `'circle' | 'circle-dashed' | 'square' | 'square-dashed' | 'octagon' | 'star'`. Defaults to `'circle'`.
20
+ *
21
+ * When a day matches more than one group, the first group wins. */
13
22
  highlightedDays?: HighlightGroup[] | HighlightGroup;
14
23
  /** Reference this for valid formats: https://date-fns.org/v2.18.0/docs/format */
15
24
  format?: string;
16
25
  initialMonth?: Date;
17
26
  onChange?: (e: Date) => void;
18
27
  onBlur?: () => void;
28
+ /** Label shown above the field. It is linked to the input, so clicking it focuses the field. */
19
29
  label?: React.ReactNode;
30
+ /** Helper text shown below the field. */
20
31
  caption?: React.ReactNode;
32
+ /** Error message shown below the field. Inside a Sous Chef `Form`, the Formik error for this field's `name` is shown automatically once the field has been touched; passing `error` overrides it. */
21
33
  error?: React.ReactNode;
22
34
  placeholder?: string;
23
35
  disabled?: boolean;
@@ -9,9 +9,12 @@ type Props = {
9
9
  maxDays?: number;
10
10
  onSelect: (selected: Date) => void;
11
11
  onClickOutside: () => void;
12
- /** It disable some dates so the user can't click on them. Refer to this
13
- * [doc](https://react-day-picker-v7.netlify.app/api/DayPicker#disabledDays) to see what
14
- * values you can use. */
12
+ /** Dates the user can't select. Takes a react-day-picker v8
13
+ * [`Matcher`](https://daypicker.dev/v8/api/type-aliases/Matcher) or an array of them:
14
+ * a `Date`, an array of dates, `{ from, to }`, `{ before }`, `{ after }`,
15
+ * `{ dayOfWeek: number[] }` (0 is Sunday) or a `(date: Date) => boolean` function.
16
+ * v7 shapes such as `{ daysOfWeek }` don't match anything.
17
+ * Example: `[{ before: new Date() }, { dayOfWeek: [0, 6] }]` disables past dates and weekends. */
15
18
  disabledDays?: BlockedDays;
16
19
  /** Highlight one or more groups of dates, each with its own shape, colour
17
20
  * theme, and legend label, e.g. pay days or holidays. */
@@ -2,23 +2,37 @@ import React from 'react';
2
2
  import { WeekStart, DateRange, BlockedDays, DisabledDays } from '../../utils/date';
3
3
  import { HighlightGroup } from '../../utils/highlight';
4
4
  type Props = {
5
+ /** Field name. Inside a Sous Chef `Form` it binds the field to Formik: the field reads its value and error from the Formik key with this name and writes changes back to it. A `value` you pass overrides the Formik value; an `onChange` you pass replaces the Formik update, so call `formik.setFieldValue` yourself if you still need it. Nested paths such as `address.city` or `shifts[0].start` work. Also used to generate the `id` when none is given. */
5
6
  name: string;
6
7
  /** If not provided it will generate a random id so the label links properly with the text input */
7
8
  id?: string;
9
+ /** The selected range: `{ start?: Date, end?: Date }`. Both dates are optional while the user is picking. */
8
10
  value?: DateRange;
9
- /** It disable some dates so the user can't click on them. Refer to this [doc](https://react-day-picker.js.org/api/types/matcher) to see what values you can use. */
11
+ /** It disable some dates so the user can't click on them. Takes a react-day-picker v8 [`Matcher`](https://daypicker.dev/v8/api/type-aliases/Matcher) or an array of them (e.g. `{ before: new Date() }` or `{ dayOfWeek: [0, 6] }`), or `{ start, end }` to disable different dates for each end of the range. */
10
12
  disabledDays?: DisabledDays | BlockedDays;
11
13
  /** Highlight one or more groups of dates below the calendar, each with its
12
14
  * own shape, colour theme, and legend label. Each group's `dates` accepts
13
15
  * the same Matcher types as `disabledDays` (plus the pattern helpers).
14
- * Example use cases: pay days, holidays, blackout periods. */
16
+ * Example use cases: pay days, holidays, blackout periods.
17
+ *
18
+ * Each `HighlightGroup` is an object with:
19
+ * - `dates` (required): `Matcher | Matcher[]` from react-day-picker: a `Date`, an array of dates, a `{ from, to }` range, `{ dayOfWeek: number[] }` or a `(date: Date) => boolean` function. Helpers such as `nthWeekdayOfMonth`, `everyOtherWeekday`, `firstOfMonth` and `lastOfMonth` build common patterns.
20
+ * - `label` (required): `string` shown in the legend, e.g. "Pay Days".
21
+ * - `theme`: `'success' | 'danger' | 'warning' | 'info' | 'upsell' | 'neutral'`. Defaults to `'success'`.
22
+ * - `shape`: `'circle' | 'circle-dashed' | 'square' | 'square-dashed' | 'octagon' | 'star'`. Defaults to `'circle'`.
23
+ *
24
+ * When a day matches more than one group, the first group wins. */
15
25
  highlightedDays?: HighlightGroup[] | HighlightGroup;
16
26
  /** Reference this for valid formats: https://date-fns.org/v2.18.0/docs/format */
17
27
  format?: string;
28
+ /** Called with the new `DateRange` (`{ start?: Date, end?: Date }`) whenever either date changes. */
18
29
  onChange?: (e: DateRange) => void;
19
30
  onBlur?: () => void;
31
+ /** Label shown above the start and end date inputs. */
20
32
  label?: React.ReactNode;
33
+ /** Helper text shown below the field. */
21
34
  caption?: React.ReactNode;
35
+ /** Error message shown below the field. Inside a Sous Chef `Form`, the Formik error for this field's `name` is shown automatically once the field has been touched; passing `error` overrides it. */
22
36
  error?: React.ReactNode;
23
37
  placeholder?: string;
24
38
  disabled?: boolean;
@@ -27,6 +41,6 @@ type Props = {
27
41
  maxDays?: number;
28
42
  testId?: string;
29
43
  };
30
- /** A dropdown style field with 2 inputs. It allows the user to select a specific start date and end date separately to create a range of dates. . */
44
+ /** A dropdown style field with 2 inputs. It allows the user to select a specific start date and end date separately to create a range of dates. */
31
45
  declare const DateRangeField: React.FC<Props>;
32
46
  export default DateRangeField;
@@ -1,14 +1,25 @@
1
1
  import React from 'react';
2
2
  import { FormikType } from './types';
3
3
  type Props = {
4
+ /** Form content: form fields, `FormRow`, `FormSection` and `FormFooter`. */
4
5
  children: React.ReactNode;
5
- onSubmit?: (e: Object) => void;
6
+ /**
7
+ * Called on every submit with the form's controls (`event.currentTarget.elements`), not the form values.
8
+ * When `formik` is also set, `formik.handleSubmit` always runs too, so Formik validation, `touched` marking and Formik's own `onSubmit` still happen.
9
+ * Note that this callback runs even when Formik validation fails, so prefer Formik's `onSubmit` to handle the values.
10
+ * When neither `onSubmit` nor `formik` is set, the browser's native form submission applies.
11
+ */
12
+ onSubmit?: (elements: HTMLFormControlsCollection) => void;
6
13
  /** By default forms are `500px`. If you want the form to use all the space you can turn this ON. */
7
14
  wide?: boolean;
8
- /** If set it will controll the state of the form using `Formik` */
15
+ /** The object returned by Formik's `useFormik`. If set, it controls the state of the form: fields read their value and error from it by `name`, and submitting calls `formik.handleSubmit`. */
9
16
  formik?: FormikType;
17
+ /** When `true` (default) the children are stacked with a `Stack` using its default spacing. Turn it off to lay out the children yourself. */
10
18
  stackContent?: boolean;
11
19
  testId?: string;
12
20
  };
21
+ /**
22
+ * Form wraps form fields and handles submission. Pass a `formik` instance (from `useFormik`) and the Sous Chef fields inside it connect by their `name`: they read their value and error from Formik and update its value on change, without passing `value`, `onChange` or `error` by hand. Fields with blur handling also mark themselves as touched on blur; the others (e.g. `WeekSelectField`) are marked touched when the form is submitted.
23
+ */
13
24
  declare const Form: React.FC<Props>;
14
25
  export default Form;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
+ /** The feedback message. */
3
4
  children: React.ReactNode;
4
5
  fieldId?: string;
5
6
  testId?: string;
@@ -1,11 +1,17 @@
1
1
  import React from 'react';
2
+ import type { FormFooterActions as FormFooterActionsType } from './types';
2
3
  type Props = {
4
+ /** Custom footer content. Prefer the `actions` prop for the standard button layout. */
3
5
  children?: React.ReactNode;
4
- actions?: {
5
- primary?: React.ReactElement;
6
- secondary?: React.ReactElement;
7
- tertiary?: React.ReactElement;
8
- };
6
+ /**
7
+ * The footer buttons, laid out and styled for you. A `FormFooterActions` object with optional `primary`, `secondary` and `tertiary` keys, each a `Button` element, e.g. `{ primary: <Button>Save</Button>, secondary: <Button>Cancel</Button> }`.
8
+ * - `primary`: shown first, with the `primary` theme and `type="submit"`, so clicking it submits the surrounding `Form`.
9
+ * - `secondary`: shown next to the primary button with the `default` theme.
10
+ * - `tertiary`: shown on the far right with the `link-primary` theme.
11
+ *
12
+ * Any prop you set on the button wins over these, e.g. `<Button theme="danger">Delete</Button>` for a destructive confirm, or `type="button"` to stop the primary button from submitting. Buttons get a minimum width of 100px unless you set a `size`.
13
+ */
14
+ actions?: FormFooterActionsType;
9
15
  testId?: string;
10
16
  };
11
17
  /**
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
+ import type { FormFooterActions as FormFooterActionsType } from '../types';
2
3
  type Props = {
3
- actions: {
4
- primary?: React.ReactElement;
5
- secondary?: React.ReactElement;
6
- tertiary?: React.ReactElement;
7
- };
4
+ actions: FormFooterActionsType;
8
5
  };
9
6
  declare const FormFooterActions: ({ actions }: Props) => React.JSX.Element;
10
7
  export default FormFooterActions;
@@ -0,0 +1,10 @@
1
+ import type { ReactElement } from 'react';
2
+ /** The buttons of a `FormFooter`, passed through its `actions` prop. */
3
+ export type FormFooterActions = {
4
+ /** Main action. Rendered first, with the `primary` theme and `type="submit"`. */
5
+ primary?: ReactElement;
6
+ /** Rendered next to the primary button with the `default` theme, e.g. "Cancel". */
7
+ secondary?: ReactElement;
8
+ /** Rendered on the far right of the footer with the `link-primary` theme. */
9
+ tertiary?: ReactElement;
10
+ };
@@ -12,10 +12,16 @@ type Size75Percent = '75%';
12
12
  export declare const SIZE_75_PERCENT: Size75Percent;
13
13
  type Size = Size25Percent | Size33Percent | Size50Percent | Size66Percent | Size75Percent;
14
14
  type Props = {
15
+ /** Form fields to place side by side, one per column. */
15
16
  children: React.ReactNode;
17
+ /** Total number of columns. When there are fewer children than columns, empty cells fill the rest, so a single field can take e.g. half of the row with `columns={2}`. */
16
18
  columns?: number;
19
+ /**
20
+ * Width of each child, by position: `'25%'`, `'33.333%'`, `'50%'`, `'66.666%'` or `'75%'`. Import the matching constants `SIZE_25_PERCENT`, `SIZE_33_PERCENT`, `SIZE_50_PERCENT`, `SIZE_66_PERCENT` and `SIZE_75_PERCENT` from `@7shifts/sous-chef`, e.g. `sizes={[SIZE_25_PERCENT, SIZE_75_PERCENT]}`. Children without a size share the remaining space equally.
21
+ */
17
22
  sizes?: Size[];
18
23
  testId?: string;
24
+ /** Gap between fields in pixels, from `0` to `60` in multiples of `4`. */
19
25
  space?: Space;
20
26
  };
21
27
  /** Easily add form fields side by side with equal size. */
@@ -1,8 +1,12 @@
1
1
  import React from 'react';
2
2
  type Props = {
3
+ /** Fields and `FormRow`s of the section. */
3
4
  children?: React.ReactNode;
5
+ /** Heading of the section, rendered as an `h2` above the fields. */
4
6
  title?: React.ReactNode;
7
+ /** Text shown below the `title`, rendered as an `h3`. */
5
8
  subtitle?: React.ReactNode;
9
+ /** Removes the bottom margin that separates the section from the next one. Use it on the last section, or when you handle the spacing yourself. Always applied with `as="card"`. */
6
10
  noMargin?: boolean;
7
11
  testId?: string;
8
12
  /** When set `as="card"` it will render the form section in a card */