@7shifts/sous-chef 4.2.0 → 4.3.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/assets/SevenShiftsLogo/SevenShiftsLogo.d.ts +3 -0
- package/dist/assets/SevenShiftsLogo/index.d.ts +1 -0
- package/dist/assets/SevenShiftsShortLogo/SevenShiftsShortLogo.d.ts +3 -0
- package/dist/assets/SevenShiftsShortLogo/index.d.ts +1 -0
- package/dist/foundation/tokens/color/color-constants.d.ts +1 -0
- package/dist/foundation/tokens/color/color-types.d.ts +1 -1
- package/dist/hooks/useScrollDetector.d.ts +5 -0
- package/dist/index.css +253 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +2553 -2160
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +2748 -2348
- package/dist/index.modern.js.map +1 -1
- package/dist/navigation/PrimaryNav/PrimaryNav.d.ts +13 -0
- package/dist/navigation/PrimaryNav/PrimaryNavContext.d.ts +16 -0
- package/dist/navigation/PrimaryNav/PrimaryNavHeader/PrimaryNavHeader.d.ts +8 -0
- package/dist/navigation/PrimaryNav/PrimaryNavHeader/index.d.ts +1 -0
- package/dist/navigation/PrimaryNav/index.d.ts +1 -0
- package/dist/navigation/PrimaryNavDivider/PrimaryNavDivider.d.ts +3 -0
- package/dist/navigation/PrimaryNavDivider/index.d.ts +1 -0
- package/dist/navigation/PrimaryNavFooter/PrimaryNavFooter.d.ts +6 -0
- package/dist/navigation/PrimaryNavFooter/index.d.ts +1 -0
- package/dist/navigation/PrimaryNavItem/PrimaryNavItem.d.ts +12 -0
- package/dist/navigation/PrimaryNavItem/PrimaryNavItemBadge/PrimaryNavItemBadge.d.ts +9 -0
- package/dist/navigation/PrimaryNavItem/PrimaryNavItemBadge/index.d.ts +1 -0
- package/dist/navigation/PrimaryNavItem/index.d.ts +1 -0
- package/dist/navigation/PrimaryNavSubItem/PrimaryNavSubItem.d.ts +11 -0
- package/dist/navigation/PrimaryNavSubItem/index.d.ts +1 -0
- package/dist/navigation/index.d.ts +6 -1
- package/dist/utils/actions.d.ts +1 -1
- package/llms-instructions/llms-components.md +425 -0
- package/llms-instructions/llms-composing-components.md +502 -0
- package/llms-instructions/llms-icons-and-illustrations.md +1039 -0
- package/llms-instructions/llms-tokens.md +397 -0
- package/llms-instructions/llms.md +78 -0
- package/package.json +3 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
isExpanded?: boolean;
|
|
5
|
+
onToggleExpand?: (state: 'expanded' | 'collapsed') => void;
|
|
6
|
+
footer?: React.ReactNode;
|
|
7
|
+
/** This is the logo displayed when the navigation is collapsed. By default it uses the 7shifts short logo */
|
|
8
|
+
shortLogo?: React.ReactNode;
|
|
9
|
+
/** This is the logo displayed when the navigation is expanded. By default it uses the 7shifts logo */
|
|
10
|
+
longLogo?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
declare const PrimaryNav: ({ children, isExpanded, onToggleExpand, footer, shortLogo, longLogo }: Props) => React.JSX.Element;
|
|
13
|
+
export default PrimaryNav;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type PrimaryNavContextType = {
|
|
3
|
+
isNavExpanded: boolean;
|
|
4
|
+
setIsNavExpanded: (isExpanded: boolean) => void;
|
|
5
|
+
isHoveringNav: boolean;
|
|
6
|
+
setIsHoveringNav: (isHovering: boolean) => void;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
contentRef: React.RefObject<HTMLDivElement>;
|
|
9
|
+
};
|
|
10
|
+
export declare const usePrimaryNavContext: () => PrimaryNavContextType;
|
|
11
|
+
type Props = {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
isExpanded?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function PrimaryNavContextProvider({ children, isExpanded: externalIsExpanded }: Props): React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
onToggleExpand?: (state: 'expanded' | 'collapsed') => void;
|
|
4
|
+
shortLogo?: React.ReactNode;
|
|
5
|
+
longLogo?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare const PrimaryNavHeader: ({ onToggleExpand, shortLogo, longLogo }: Props) => React.JSX.Element;
|
|
8
|
+
export default PrimaryNavHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PrimaryNavHeader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PrimaryNav';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PrimaryNavDivider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PrimaryNavFooter';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataProps } from '../../foundation/types';
|
|
3
|
+
type Props = {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
icon: React.ReactNode;
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
label: string;
|
|
8
|
+
badge?: string | number;
|
|
9
|
+
onClick: (e: React.MouseEvent<HTMLElement>) => void;
|
|
10
|
+
} & DataProps;
|
|
11
|
+
declare const PrimaryNavItem: ({ children, icon, isActive, label, badge, onClick, ...rest }: Props) => React.JSX.Element;
|
|
12
|
+
export default PrimaryNavItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
badge?: string | number;
|
|
4
|
+
hasSubItems: boolean;
|
|
5
|
+
hasActiveSubItem: boolean;
|
|
6
|
+
sumOfSubItemsBadges: number;
|
|
7
|
+
};
|
|
8
|
+
declare const PrimaryNavItemBadge: ({ badge, hasSubItems, hasActiveSubItem, sumOfSubItemsBadges }: Props) => React.JSX.Element | null;
|
|
9
|
+
export default PrimaryNavItemBadge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PrimaryNavItemBadge';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PrimaryNavItem';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataProps } from '../../foundation/types';
|
|
3
|
+
type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
isActive?: boolean;
|
|
6
|
+
badge?: string | number;
|
|
7
|
+
onClick: (e: React.MouseEvent<HTMLElement>) => void;
|
|
8
|
+
isPaywalled?: boolean;
|
|
9
|
+
} & DataProps;
|
|
10
|
+
declare const PrimaryNavSubItem: ({ children, isActive, badge, onClick, isPaywalled, ...rest }: Props) => React.JSX.Element;
|
|
11
|
+
export default PrimaryNavSubItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './PrimaryNavSubItem';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import Breadcrumbs from './Breadcrumbs';
|
|
2
2
|
import BreadcrumbItem from './BreadcrumbItem';
|
|
3
|
-
|
|
3
|
+
import PrimaryNav from './PrimaryNav';
|
|
4
|
+
import PrimaryNavItem from './PrimaryNavItem';
|
|
5
|
+
import PrimaryNavSubItem from './PrimaryNavSubItem';
|
|
6
|
+
import PrimaryNavDivider from './PrimaryNavDivider';
|
|
7
|
+
import PrimaryNavFooter from './PrimaryNavFooter';
|
|
8
|
+
export { Breadcrumbs, BreadcrumbItem, PrimaryNav, PrimaryNavItem, PrimaryNavSubItem, PrimaryNavDivider, PrimaryNavFooter };
|
package/dist/utils/actions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const updateButtonProps: (button: React.ReactElement | undefined, newProps:
|
|
2
|
+
export declare const updateButtonProps: (button: React.ReactElement | undefined, newProps: Record<string, unknown>) => React.ReactElement | null;
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
# @7shifts/sous-chef — Component Reference
|
|
2
|
+
|
|
3
|
+
All component APIs and use cases are defined in the Storybook MCP. You can get detailed information about any specific component.
|
|
4
|
+
|
|
5
|
+
In this document, you will find additional information on how to use components in specific situations.
|
|
6
|
+
|
|
7
|
+
## Actions
|
|
8
|
+
|
|
9
|
+
Components available:
|
|
10
|
+
|
|
11
|
+
### Button
|
|
12
|
+
|
|
13
|
+
When using a button with an icon and text, you don't need to use the `Inline` component to align the elements:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Button>
|
|
17
|
+
<IconPencil />
|
|
18
|
+
Edit
|
|
19
|
+
</Button>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Also, the icon size is inferred by the `Button` component.
|
|
23
|
+
|
|
24
|
+
### Link
|
|
25
|
+
|
|
26
|
+
### PaginationControls
|
|
27
|
+
|
|
28
|
+
Only use this component if you need to control pagination outside of the `DataTable` component. If you are using `DataTable`, it already provides props for controlling pagination.
|
|
29
|
+
|
|
30
|
+
### Toggle
|
|
31
|
+
|
|
32
|
+
It should be used outside of a form. If it is inside a form, then you should use a `CheckboxField` instead.
|
|
33
|
+
The `Toggle` component is used when there is no `Save` button to persist the data, so when the user changes its value, it is automatically persisted, usually in settings.
|
|
34
|
+
|
|
35
|
+
## Controls
|
|
36
|
+
|
|
37
|
+
Controls contains the components that are usually used in toolbars, for example in a list filter.
|
|
38
|
+
|
|
39
|
+
Components available:
|
|
40
|
+
|
|
41
|
+
### DateFilter
|
|
42
|
+
|
|
43
|
+
Use this component to filter content on the page by date, whether by day, week, or month.
|
|
44
|
+
DON'T use it in a form with a submit button. Inside a form, you should use the `DateField`, `DateRangeField`, or `WeekField` components for picking a date.
|
|
45
|
+
|
|
46
|
+
### SegmentedControl
|
|
47
|
+
|
|
48
|
+
Segmented control is typically used in a toolbar to switch between different views. It can have two or three options.
|
|
49
|
+
DON'T use it as tabs. Sous Chef does not have a `Tab` component yet, so if you need one, check whether there is an application-specific `Tab` component to use. If not, then you need to create one.
|
|
50
|
+
|
|
51
|
+
### ToolbarSelect
|
|
52
|
+
|
|
53
|
+
This component is used to select options (similar to `SelectField`). However, this is meant to be used outside of a Form, more specifically in toolbars where there is no need for a label.
|
|
54
|
+
|
|
55
|
+
## Empty States
|
|
56
|
+
|
|
57
|
+
Components available:
|
|
58
|
+
|
|
59
|
+
### EmptyState
|
|
60
|
+
|
|
61
|
+
This component should be used outside the context of a list because list components already handle the empty state. For example, `DataTable` handles the empty state when `items` is an empty array.
|
|
62
|
+
Use this component when you want to show an empty state inside a modal or for a first-time user experience.
|
|
63
|
+
|
|
64
|
+
### Paywall
|
|
65
|
+
|
|
66
|
+
It is similar to the `EmptyState` component, but it is designed for conversion flows with proper upsell theming on headers and other features.
|
|
67
|
+
|
|
68
|
+
## Feedback
|
|
69
|
+
|
|
70
|
+
Feedback components bring information to the user's attention.
|
|
71
|
+
|
|
72
|
+
Components available:
|
|
73
|
+
|
|
74
|
+
### CircularProgress
|
|
75
|
+
|
|
76
|
+
It is a circular bar that shows the progress. Use this component when you want a small indicator of progress. If you want something bigger, use the `ProgressBar`.
|
|
77
|
+
|
|
78
|
+
### InlineBanner
|
|
79
|
+
|
|
80
|
+
It is the most commonly used banner for displaying information. It fills all the space available in the container where it is placed.
|
|
81
|
+
If you want a smaller banner, then use the `MicroBanner` component.
|
|
82
|
+
|
|
83
|
+
When rendering it in a page using the `Page` component, you can place it in the `banner` prop.
|
|
84
|
+
|
|
85
|
+
### MicroBanner
|
|
86
|
+
|
|
87
|
+
It is a small banner that does not take all the space available in the container. It can be used where space is limited, for example, in top bars.
|
|
88
|
+
|
|
89
|
+
### PersistentBanner
|
|
90
|
+
|
|
91
|
+
It should be used for something that needs a lot of attention, for example, a failed subscription payment. Usually, it is placed above the top bar.
|
|
92
|
+
|
|
93
|
+
### ProgressBar
|
|
94
|
+
|
|
95
|
+
It is a bar that takes all the space available on the container it is placed. It is usually used inside a modal as the progress tracker of a wizard, for example.
|
|
96
|
+
|
|
97
|
+
### Skeleton
|
|
98
|
+
|
|
99
|
+
Used for building skeleton loading states. The `DataTable` already handles the loading state.
|
|
100
|
+
Use this component when you want to create a loading state for some view, for example a card, or something else.
|
|
101
|
+
|
|
102
|
+
### Spinner
|
|
103
|
+
|
|
104
|
+
This is the classic loading state. Skeleton brings a more modern loading state.
|
|
105
|
+
|
|
106
|
+
### Toast
|
|
107
|
+
|
|
108
|
+
It is a simple function that shows a small pop-up at the bottom of the page. It should be used to show the user that an action has completed or that something failed.
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
toast('User updated')
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Forms
|
|
115
|
+
|
|
116
|
+
For common form composition examples, refer to the [Composing components](llms-composing-components.md) document.
|
|
117
|
+
|
|
118
|
+
Components available:
|
|
119
|
+
|
|
120
|
+
### AsyncSelectField
|
|
121
|
+
|
|
122
|
+
It is similar to the `SelectField`; however, it has a `loadOptions` prop that returns a `Promise` to load the data. With `SelectField`, you need to pass the `options` prop directly.
|
|
123
|
+
Use this component when you DON'T have all the options upfront and you need to fetch data from an API, or when your endpoint is paginated.
|
|
124
|
+
|
|
125
|
+
### CheckboxField
|
|
126
|
+
|
|
127
|
+
Simple checkbox field.
|
|
128
|
+
|
|
129
|
+
### ColorField
|
|
130
|
+
|
|
131
|
+
Used when you need to pick a color. It gives all the sequention color tokens as options.
|
|
132
|
+
|
|
133
|
+
### CurrencyField
|
|
134
|
+
|
|
135
|
+
Used when the user needs to type a currency value.
|
|
136
|
+
|
|
137
|
+
### DateField
|
|
138
|
+
|
|
139
|
+
Used when the user needs to pick up a SINGLE date. If the user needs a range then use the `DateRangeField`. If the user needs a week, then use the `WeekField`.
|
|
140
|
+
|
|
141
|
+
### DateRangeField
|
|
142
|
+
|
|
143
|
+
Used when the user wants to pick a range of dates (start and end).
|
|
144
|
+
|
|
145
|
+
### Form
|
|
146
|
+
|
|
147
|
+
This is the component that holds the form state, usually through the `formik` prop, and is responsible for submitting the data.
|
|
148
|
+
|
|
149
|
+
### FormFeedback
|
|
150
|
+
|
|
151
|
+
Used to show a form validation error at the form-wide level. Individual form fields already handle their own error state.
|
|
152
|
+
|
|
153
|
+
### FormFooter
|
|
154
|
+
|
|
155
|
+
It is responsible for holding the submit button and other form actions. It takes the `actions` prop and automatically positions the buttons properly.
|
|
156
|
+
|
|
157
|
+
### FormRow
|
|
158
|
+
|
|
159
|
+
Used when you need to place form fields on the same row. It distributes the space evenly between the form fields.
|
|
160
|
+
For forms, give preference to `FormRow` instead of the `Inline` component.
|
|
161
|
+
|
|
162
|
+
### FormSection
|
|
163
|
+
|
|
164
|
+
Used when you need to group some form fields together. It handles the title and subtitle of the section.
|
|
165
|
+
You can also use it as a card with the `as="card"` prop. In forms, if you see form fields inside a card, it is usually a `FormSection` component with the `as="card"` prop.
|
|
166
|
+
|
|
167
|
+
### MultiSelectField
|
|
168
|
+
|
|
169
|
+
Similar to the `SelectField` but for selecting multiple options.
|
|
170
|
+
|
|
171
|
+
### NumberField
|
|
172
|
+
|
|
173
|
+
Form field for informing numbers.
|
|
174
|
+
|
|
175
|
+
### PasswordField
|
|
176
|
+
|
|
177
|
+
Used for entering passwords. Unlike the other form fields, this component does not have a `caption` prop. Instead, it handles the configured password criteria in the caption, for example when the password is too weak.
|
|
178
|
+
|
|
179
|
+
### PercentageField
|
|
180
|
+
|
|
181
|
+
Used for informing a percentage number.
|
|
182
|
+
|
|
183
|
+
### PhoneField
|
|
184
|
+
|
|
185
|
+
Used for entering a phone number. By default, it uses the `country` passed to the `SousChefProvider`, but it can be overridden by passing the `defaultCountry` prop.
|
|
186
|
+
|
|
187
|
+
### PillSelectField
|
|
188
|
+
|
|
189
|
+
It is similar to the `SelectField` but all the options are shown side-by-side in the screen. Use this component when you have just a few options to display.
|
|
190
|
+
|
|
191
|
+
### RadioGroupField
|
|
192
|
+
|
|
193
|
+
Used when the user needs to select only one option. Options can also be displayed as cards when using the `RadioGroupBoxOption` as children.
|
|
194
|
+
|
|
195
|
+
Subcomponents:
|
|
196
|
+
|
|
197
|
+
- RadioGroupOption
|
|
198
|
+
- RadioGroupBoxOption
|
|
199
|
+
|
|
200
|
+
### SelectField
|
|
201
|
+
|
|
202
|
+
Used when you need to select only one option from the dropdown.
|
|
203
|
+
|
|
204
|
+
### TextAreaField
|
|
205
|
+
|
|
206
|
+
Similar to the `TextField` but it can have multiple lines and can also have toolbar at the bottom where you can place some buttons.
|
|
207
|
+
|
|
208
|
+
### TextField
|
|
209
|
+
|
|
210
|
+
This is the main component for typing a text in a form.
|
|
211
|
+
|
|
212
|
+
### TimeField
|
|
213
|
+
|
|
214
|
+
Used for pick a specific time. If you need a range of times then use the `TimeRangeField`.
|
|
215
|
+
|
|
216
|
+
### TimeRangeField
|
|
217
|
+
|
|
218
|
+
Used when you need to select a start time and an end time.
|
|
219
|
+
|
|
220
|
+
### WeekField
|
|
221
|
+
|
|
222
|
+
Used when you need to select a week. This component will give you the start of the week to be saved in the form state.
|
|
223
|
+
|
|
224
|
+
## Media
|
|
225
|
+
|
|
226
|
+
Available components
|
|
227
|
+
|
|
228
|
+
### Avatar
|
|
229
|
+
|
|
230
|
+
By default, the `Avatar` component already handles a user illustration with an appropriate background color, so you don't need to pass the `color` prop for this use case.
|
|
231
|
+
You can also pass letters as children, usually initials. In that case, you can set the `color` prop if you want a specific color.
|
|
232
|
+
You can also show a user image passing the `url` prop.
|
|
233
|
+
|
|
234
|
+
### Badge
|
|
235
|
+
|
|
236
|
+
It is a circle that is usually used to show a counter, for example, the number of unseen notifications. It can also be used with an icon.
|
|
237
|
+
|
|
238
|
+
### Chip
|
|
239
|
+
|
|
240
|
+
A chip is similar looking to pill, but is instead used to convey system status such as "New", "Beta", or "Add-on".
|
|
241
|
+
|
|
242
|
+
### Pill
|
|
243
|
+
|
|
244
|
+
A Pill is used to inform users on the status of a nearby object or of an action that’s been taken. It is bigger than a Chip.
|
|
245
|
+
|
|
246
|
+
## Layout
|
|
247
|
+
|
|
248
|
+
Available components:
|
|
249
|
+
|
|
250
|
+
### Card
|
|
251
|
+
|
|
252
|
+
It is a simple container with a border (and border radius) and some content in it. It is a flexible component meant to render everything the user passes as children.
|
|
253
|
+
When using it inside a form, check whether it is more suitable to use a `FormSection` component instead.
|
|
254
|
+
|
|
255
|
+
### Inline
|
|
256
|
+
|
|
257
|
+
Used to align elements side by side. It uses CSS `flex` concepts for its props. For complex use cases where you need to control how each item grows, you can use the `flex` prop.
|
|
258
|
+
Pay special attention to the `flex` prop. It is an array of elements, each of which can be a string or number, where each element sets the `flex` prop for a child element. For example:
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
<Inline flex={['0 1 auto', 1]}>
|
|
262
|
+
<div>item 1</div>
|
|
263
|
+
<div>item 2</div>
|
|
264
|
+
</Inline>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
It is literally setting the CSS `flex: 0 1 auto;` to the first element and `flex: 1` to the second element.
|
|
268
|
+
|
|
269
|
+
### Page
|
|
270
|
+
|
|
271
|
+
It is used to create a single page with slots to place all page elements, such as title, subtitle, banner, filter bar, actions, and children.
|
|
272
|
+
IMPORTANT: It should not be used for high-level app layout, such as the nav bar and top bar. Also, if it has a small left menu, it is probably a `PageLayout` component.
|
|
273
|
+
|
|
274
|
+
For examples of how to set up a page layout, refer to the [Composing components](llms-composing-components.md) document.
|
|
275
|
+
|
|
276
|
+
### PageLayout
|
|
277
|
+
|
|
278
|
+
It should be used to hold a group of pages where there is a left side menu (using the `menu` prop). Usually, when the user clicks on a menu item it should navigate to some specific route.
|
|
279
|
+
In its children, it should contain a router where each route renders a component that uses a `Page` component.
|
|
280
|
+
|
|
281
|
+
For examples of how to set up a page layout, refer to the [Composing components](llms-composing-components.md) document.
|
|
282
|
+
|
|
283
|
+
### Stack
|
|
284
|
+
|
|
285
|
+
Used to align elements vertically. It is similar to the `Inline` component. It uses CSS `flex` concepts for its props. For complex use cases where you need to control how each item grows, you can use the `flex` prop.
|
|
286
|
+
Pay special attention to the `flex` prop. It is an array of elements, each of which can be a string or number, where each element sets the `flex` prop for a child element. For example:
|
|
287
|
+
|
|
288
|
+
```tsx
|
|
289
|
+
<Inline flex={['0 1 auto', 1]}>
|
|
290
|
+
<div>item 1</div>
|
|
291
|
+
<div>item 2</div>
|
|
292
|
+
</Inline>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
It is literally setting the CSS `flex: 0 1 auto;` to the first element and `flex: 1` to the second element.
|
|
296
|
+
|
|
297
|
+
## Lists
|
|
298
|
+
|
|
299
|
+
Components used to display a list of data.
|
|
300
|
+
|
|
301
|
+
Available components:
|
|
302
|
+
|
|
303
|
+
### Accordion
|
|
304
|
+
|
|
305
|
+
Accordions are lists used to group information into collapsible sections. Only one section can be open at a time.
|
|
306
|
+
Don't use this component if you have columns, in that case, use the `DataTable` component instead.
|
|
307
|
+
|
|
308
|
+
### ActionList
|
|
309
|
+
|
|
310
|
+
It is similar to the `Accordion` but it does not collapse items. It is a more rich data display that should be used for displaying a list of actions that the user needs to take.
|
|
311
|
+
It is usually used on dashboard pages.
|
|
312
|
+
|
|
313
|
+
Subcomponents:
|
|
314
|
+
|
|
315
|
+
- ActionListItem
|
|
316
|
+
|
|
317
|
+
### DataTable
|
|
318
|
+
|
|
319
|
+
This is the main component used to display a dynamic list of data (usually coming from an endpoint).
|
|
320
|
+
With this component, you can build simple tables by passing an array of `items`, but you can also build more complex use cases, such as sortable columns, pagination, and editable cells.
|
|
321
|
+
|
|
322
|
+
Subcomponents:
|
|
323
|
+
|
|
324
|
+
- DataTableRow
|
|
325
|
+
- DataTableCell
|
|
326
|
+
- DataTableEditableCell
|
|
327
|
+
|
|
328
|
+
For examples of how to compose tables, refer to the [Composing components](llms-composing-components.md) document.
|
|
329
|
+
|
|
330
|
+
## Navigation
|
|
331
|
+
|
|
332
|
+
Available components
|
|
333
|
+
|
|
334
|
+
### Breadcrumbs
|
|
335
|
+
|
|
336
|
+
The `Page` component already handles breadcrumbs. However, if you need to render breadcrumbs outside of the page component then you can use this component.
|
|
337
|
+
|
|
338
|
+
## Overlay
|
|
339
|
+
|
|
340
|
+
Overlays are components that render on top of the main page.
|
|
341
|
+
|
|
342
|
+
Available components:
|
|
343
|
+
|
|
344
|
+
### Calendar
|
|
345
|
+
|
|
346
|
+
It is a standalone calendar that needs an `anchorRef` from a trigger, for example, a button created with React `useRef`.
|
|
347
|
+
Use this component outside of a Form context. If you are in a form, then use the form fields for picking a date.
|
|
348
|
+
|
|
349
|
+
### Dropdown
|
|
350
|
+
|
|
351
|
+
A Dropdown is where you can have menu options that are hidden until the user clicks or hovers on a trigger element.
|
|
352
|
+
If you want to render a more complex interaction or content within a dropdown, consider using a Popover instead.
|
|
353
|
+
|
|
354
|
+
Subcomponents:
|
|
355
|
+
|
|
356
|
+
- DropdownList
|
|
357
|
+
- DropdownListItem
|
|
358
|
+
- DropdownListItemSelectable
|
|
359
|
+
- DropdownListItemDivider
|
|
360
|
+
|
|
361
|
+
### HintModal
|
|
362
|
+
|
|
363
|
+
HintModal can be used to provide tips or guidance to users on a page. It is not typically triggered by a button. Instead, it should be rendered when a user navigates to a page where they might require additional guidance.
|
|
364
|
+
It shows on the bottom-right side of the screen.
|
|
365
|
+
For larger information or forms, use the `Modal` component instead.
|
|
366
|
+
|
|
367
|
+
### Modal
|
|
368
|
+
|
|
369
|
+
Used to interrupt the page flow and show a container to display some information, such as a paywall, a set of steps in a wizard, or a form.
|
|
370
|
+
It already handles the `header` and `subHeader`.
|
|
371
|
+
|
|
372
|
+
Subcomponents:
|
|
373
|
+
|
|
374
|
+
- ModalBody
|
|
375
|
+
- ModalFooter
|
|
376
|
+
|
|
377
|
+
When using a form inside a modal, refer to the [Composing components](llms-composing-components.md) document, as it has some special configuration to work well in a modal.
|
|
378
|
+
|
|
379
|
+
### Popover
|
|
380
|
+
|
|
381
|
+
Similar to a `Dropdown` but, instead of options, you have the flexibility to render anything you want in the children. It will be placed in the overlay.
|
|
382
|
+
For small overlays, like a text with a title, use the `Tooltip` instead.
|
|
383
|
+
|
|
384
|
+
### Tooltip
|
|
385
|
+
|
|
386
|
+
Used to show small overlays, usually it is triggered on hover. If you need to render more complex things use the `Popover` component instead.
|
|
387
|
+
|
|
388
|
+
## Typography
|
|
389
|
+
|
|
390
|
+
### Text
|
|
391
|
+
|
|
392
|
+
This is the atomic component for rendering text and headings. You can use the `as` prop to set how it will be displayed:
|
|
393
|
+
|
|
394
|
+
Example:
|
|
395
|
+
|
|
396
|
+
```tsx
|
|
397
|
+
<Text as="h1">Title</Text>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
You can give emphasis to a text using the `emphasis` prop:
|
|
401
|
+
|
|
402
|
+
Example:
|
|
403
|
+
|
|
404
|
+
```tsx
|
|
405
|
+
<Text emphasis="bold">Title</Text>
|
|
406
|
+
<Text emphasis=["bold", "italic"]>Title</Text> // with multiple emphasis
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
If you want to give emphasis just to some parts of the text you can use the sub components:
|
|
410
|
+
|
|
411
|
+
Example:
|
|
412
|
+
|
|
413
|
+
```tsx
|
|
414
|
+
<Text>
|
|
415
|
+
Example of a <Bold>bold</Bold> text and <Italic>italic</Italic> text.
|
|
416
|
+
</Text>
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
The subcomponents use a `span` tag under the hood, so they do not break the DOM structure.
|
|
420
|
+
|
|
421
|
+
Subcomponents:
|
|
422
|
+
|
|
423
|
+
- Italic
|
|
424
|
+
- Bold
|
|
425
|
+
- Underline
|