@atom-learning/components 2.29.0-beta.2 → 2.29.0-beta.3
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/components/accordion/Accordion.d.ts +266 -1
- package/dist/components/accordion/AccordionContent.d.ts +266 -1
- package/dist/components/accordion/AccordionItem.d.ts +266 -1
- package/dist/components/accordion/AccordionTrigger.d.ts +268 -1
- package/dist/components/action-icon/ActionIcon.d.ts +281 -1
- package/dist/components/alert-dialog/AlertDialog.d.ts +266 -1
- package/dist/components/alert-dialog/AlertDialogContent.d.ts +268 -1
- package/dist/components/alert-dialog/alert-context/AlertDialog.d.ts +1 -1
- package/dist/components/avatar/Avatar.d.ts +536 -2
- package/dist/components/badge/Badge.d.ts +534 -1
- package/dist/components/box/Box.d.ts +266 -1
- package/dist/components/button/Button.d.ts +283 -2
- package/dist/components/calendar/Calendar.d.ts +1 -1
- package/dist/components/calendar/Day.d.ts +270 -1
- package/dist/components/carousel/Carousel.d.ts +1 -1
- package/dist/components/carousel/CarouselArrows.d.ts +1 -1
- package/dist/components/carousel/CarouselPagination.d.ts +267 -1
- package/dist/components/carousel/CarouselSlide.d.ts +266 -1
- package/dist/components/carousel/CarouselSlider.d.ts +269 -1
- package/dist/components/checkbox/Checkbox.d.ts +269 -1
- package/dist/components/checkbox-field/CheckboxField.d.ts +2 -2
- package/dist/components/chip/Chip.d.ts +1879 -5
- package/dist/components/chip/ChipGroup.d.ts +1 -1
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupItem.d.ts +547 -2
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupRoot.d.ts +5 -1
- package/dist/components/chip-toggle-group/ChipToggleGroupItem.d.ts +546 -1
- package/dist/components/chip-toggle-group/ChipToggleGroupRoot.d.ts +562 -1
- package/dist/components/combobox/Combobox.d.ts +266 -1
- package/dist/components/combobox/ComboboxInput.d.ts +268 -1
- package/dist/components/combobox/ComboboxList.d.ts +266 -1
- package/dist/components/combobox/ComboboxOption.d.ts +266 -1
- package/dist/components/combobox/ComboboxPopover.d.ts +266 -1
- package/dist/components/data-table/DataTableLoading.d.ts +270 -1
- package/dist/components/data-table/drag-and-drop/Handle.d.ts +559 -1
- package/dist/components/data-table/pagination/Pagination.d.ts +266 -1
- package/dist/components/data-table/pagination/PaginationButtons.d.ts +1 -1
- package/dist/components/date-field/DateField.d.ts +2 -2
- package/dist/components/dialog/Dialog.d.ts +266 -1
- package/dist/components/dialog/DialogBackground.d.ts +531 -1
- package/dist/components/dialog/DialogClose.d.ts +267 -1
- package/dist/components/dialog/DialogContent.d.ts +268 -1
- package/dist/components/dismissible-group/DismissibleGroupItem.d.ts +1 -1
- package/dist/components/dismissible-group/index.d.ts +1 -1
- package/dist/components/divider/Divider.d.ts +268 -1
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +266 -1
- package/dist/components/dropdown-menu/DropdownMenuContent.d.ts +267 -1
- package/dist/components/dropdown-menu/DropdownMenuItem.d.ts +267 -1
- package/dist/components/dropdown-menu/DropdownMenuSeparator.d.ts +267 -1
- package/dist/components/dropdown-menu/DropdownMenuTrigger.d.ts +267 -1
- package/dist/components/empty-state/EmptyState.d.ts +533 -1
- package/dist/components/empty-state/EmptyStateBody.d.ts +543 -1
- package/dist/components/empty-state/EmptyStateImage.d.ts +542 -2
- package/dist/components/empty-state/EmptyStateTitle.d.ts +268 -1
- package/dist/components/field-wrapper/FieldDescription.d.ts +1 -1
- package/dist/components/field-wrapper/FieldWrapper.d.ts +2 -2
- package/dist/components/field-wrapper/InlineFieldWrapper.d.ts +1 -1
- package/dist/components/flex/Flex.d.ts +266 -1
- package/dist/components/form/Form.d.ts +266 -1
- package/dist/components/grid/Grid.d.ts +268 -1
- package/dist/components/heading/Heading.d.ts +270 -2
- package/dist/components/icon/Icon.d.ts +269 -2
- package/dist/components/image/Image.d.ts +269 -2
- package/dist/components/inline-message/InlineMessage.config.d.ts +1 -1
- package/dist/components/inline-message/InlineMessage.d.ts +534 -1
- package/dist/components/input/Input.d.ts +270 -2
- package/dist/components/input-field/InputField.d.ts +2 -2
- package/dist/components/label/Label.d.ts +272 -2
- package/dist/components/link/Link.d.ts +271 -3
- package/dist/components/list/List.d.ts +537 -2
- package/dist/components/loader/Loader.d.ts +1 -1
- package/dist/components/markdown-content/MarkdownContent.d.ts +1 -1
- package/dist/components/markdown-content/components/MarkdownEmphasis.d.ts +266 -1
- package/dist/components/markdown-content/components/MarkdownImage.d.ts +1 -1
- package/dist/components/markdown-content/components/MarkdownList.d.ts +1 -1
- package/dist/components/markdown-content/components/MarkdownThematicBreak.d.ts +1 -1
- package/dist/components/navigation/NavigationMenu.d.ts +1 -1
- package/dist/components/navigation/NavigationMenuDropdown.d.ts +1 -1
- package/dist/components/navigation/NavigationMenuDropdownItem.d.ts +543 -4
- package/dist/components/navigation/NavigationMenuLink.d.ts +1 -1
- package/dist/components/notification-badge/NotificationBadge.d.ts +531 -1
- package/dist/components/number-input/NumberInput.d.ts +1 -1
- package/dist/components/number-input-field/NumberInputField.d.ts +2 -2
- package/dist/components/password-field/PasswordField.d.ts +2 -2
- package/dist/components/password-input/PasswordInput.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +266 -1
- package/dist/components/popover/PopoverContent.d.ts +268 -1
- package/dist/components/progress-bar/ProgressBar.d.ts +269 -1
- package/dist/components/radio-button/RadioButton.d.ts +268 -2
- package/dist/components/radio-button/RadioButtonGroup.d.ts +270 -1
- package/dist/components/radio-button-field/RadioButtonField.d.ts +2 -2
- package/dist/components/radio-button-field/RadioField.d.ts +3 -3
- package/dist/components/radio-card/RadioCard.d.ts +271 -1
- package/dist/components/radio-card/RadioCardGroup.d.ts +1 -1
- package/dist/components/search-field/SearchField.d.ts +2 -2
- package/dist/components/search-input/SearchInput.d.ts +2 -2
- package/dist/components/select/Select.d.ts +270 -2
- package/dist/components/select-field/SelectField.d.ts +2 -2
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionContent.d.ts +266 -1
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionItem.d.ts +267 -1
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionRoot.d.ts +267 -1
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionTrigger.d.ts +268 -1
- package/dist/components/sidedrawer/SidedrawerContent.d.ts +266 -1
- package/dist/components/sidedrawer/SidedrawerFooter.d.ts +266 -1
- package/dist/components/sidedrawer/SidedrawerHeader.d.ts +266 -1
- package/dist/components/sidedrawer/SidedrawerOverlay.d.ts +267 -1
- package/dist/components/sidedrawer/SidedrawerTrigger.d.ts +267 -1
- package/dist/components/slider/Slider.d.ts +268 -1
- package/dist/components/slider-field/SliderField.d.ts +3 -3
- package/dist/components/stack/Stack.d.ts +273 -2
- package/dist/components/stack-content/StackContent.d.ts +267 -2
- package/dist/components/stepper/StepperStepBullet.d.ts +533 -1
- package/dist/components/stepper/StepperStepContainer.d.ts +536 -1
- package/dist/components/stepper/StepperStepLabel.d.ts +544 -1
- package/dist/components/stepper/types.d.ts +1 -1
- package/dist/components/switch/Switch.d.ts +267 -1
- package/dist/components/table/Table.d.ts +269 -1
- package/dist/components/table/TableBody.d.ts +268 -1
- package/dist/components/table/TableCell.d.ts +266 -1
- package/dist/components/table/TableFooter.d.ts +266 -1
- package/dist/components/table/TableFooterCell.d.ts +266 -1
- package/dist/components/table/TableHeader.d.ts +268 -1
- package/dist/components/table/TableHeaderCell.d.ts +266 -1
- package/dist/components/table/TableRow.d.ts +536 -2
- package/dist/components/tabs/TabTrigger.d.ts +268 -1
- package/dist/components/tabs/Tabs.d.ts +536 -2
- package/dist/components/tabs/TabsTriggerList.d.ts +269 -1
- package/dist/components/text/Text.d.ts +271 -3
- package/dist/components/textarea/Textarea.d.ts +268 -1
- package/dist/components/textarea-field/TextareaField.d.ts +2 -2
- package/dist/components/toast/Toast.d.ts +268 -1
- package/dist/components/toggle-group/ToggleGroupButton.d.ts +534 -1
- package/dist/components/toggle-group/ToggleGroupItem.d.ts +534 -2
- package/dist/components/toggle-group/ToggleGroupRoot.d.ts +271 -1
- package/dist/components/toggle-group/index.d.ts +1352 -3
- package/dist/components/tooltip/TooltipContent.d.ts +268 -1
- package/dist/components/top-bar/TopBar.d.ts +270 -2
- package/dist/components/top-bar/TopBarBrand.d.ts +808 -4
- package/dist/components/video/Video.d.ts +535 -4
- package/dist/docgen.json +1 -0
- package/dist/docs/Accordion.mdx +45 -0
- package/dist/docs/ActionIcon.mdx +87 -0
- package/dist/docs/AlertDialog.mdx +40 -0
- package/dist/docs/Avatar.mdx +129 -0
- package/dist/docs/Badge.mdx +55 -0
- package/dist/docs/Box.mdx +52 -0
- package/dist/docs/Button.mdx +76 -0
- package/dist/docs/CONTRIBUTING.md +224 -0
- package/dist/docs/CSSWrapper.mdx +10 -0
- package/dist/docs/Carousel.mdx +88 -0
- package/dist/docs/Checkbox.mdx +19 -0
- package/dist/docs/CheckboxField.mdx +14 -0
- package/dist/docs/Chip.mdx +118 -0
- package/dist/docs/ChipDismissibleGroup.mdx +33 -0
- package/dist/docs/ChipToggleGroup.mdx +27 -0
- package/dist/docs/Combobox.mdx +44 -0
- package/dist/docs/DataTable.mdx +279 -0
- package/dist/docs/DateField.mdx +20 -0
- package/dist/docs/DateInput.mdx +87 -0
- package/dist/docs/Dialog.mdx +68 -0
- package/dist/docs/Dismissible.mdx +48 -0
- package/dist/docs/DismissibleGroup.mdx +29 -0
- package/dist/docs/Divider.mdx +16 -0
- package/dist/docs/DropdownMenu.mdx +30 -0
- package/dist/docs/EmptyState.mdx +23 -0
- package/dist/docs/FieldWrapper.mdx +30 -0
- package/dist/docs/FileInput.mdx +45 -0
- package/dist/docs/Flex.mdx +16 -0
- package/dist/docs/Form.mdx +411 -0
- package/dist/docs/Grid.mdx +28 -0
- package/dist/docs/Heading.mdx +30 -0
- package/dist/docs/Icon.mdx +30 -0
- package/dist/docs/Image.mdx +14 -0
- package/dist/docs/InlineMessage.mdx +52 -0
- package/dist/docs/Input.mdx +24 -0
- package/dist/docs/InputField.mdx +26 -0
- package/dist/docs/Label.mdx +32 -0
- package/dist/docs/Link.mdx +53 -0
- package/dist/docs/List.mdx +38 -0
- package/dist/docs/Loader.mdx +16 -0
- package/dist/docs/MarkdownContent.mdx +77 -0
- package/dist/docs/NavigationMenu.mdx +144 -0
- package/dist/docs/NotificationBadge.mdx +35 -0
- package/dist/docs/NumberInput.mdx +37 -0
- package/dist/docs/NumberInputField.mdx +26 -0
- package/dist/docs/PasswordField.mdx +23 -0
- package/dist/docs/PasswordInput.mdx +15 -0
- package/dist/docs/Popover.mdx +29 -0
- package/dist/docs/ProgressBar.mdx +56 -0
- package/dist/docs/RadioButton.mdx +10 -0
- package/dist/docs/RadioButtonField.mdx +25 -0
- package/dist/docs/RadioCard.mdx +62 -0
- package/dist/docs/SearchField.mdx +26 -0
- package/dist/docs/SearchInput.mdx +13 -0
- package/dist/docs/Select.mdx +56 -0
- package/dist/docs/SelectField.mdx +17 -0
- package/dist/docs/Sidedrawer.mdx +155 -0
- package/dist/docs/Slider.mdx +117 -0
- package/dist/docs/SliderField.mdx +35 -0
- package/dist/docs/Stack.mdx +24 -0
- package/dist/docs/StackContent.mdx +32 -0
- package/dist/docs/Stepper.mdx +154 -0
- package/dist/docs/Styling.mdx +85 -0
- package/dist/docs/Switch.mdx +28 -0
- package/dist/docs/Table.mdx +146 -0
- package/dist/docs/Tabs.mdx +102 -0
- package/dist/docs/Text.mdx +24 -0
- package/dist/docs/Textarea.mdx +12 -0
- package/dist/docs/TextareaField.mdx +21 -0
- package/dist/docs/Toast.mdx +20 -0
- package/dist/docs/ToggleGroup.mdx +88 -0
- package/dist/docs/Tooltip.mdx +25 -0
- package/dist/docs/TopBar.mdx +95 -0
- package/dist/docs/Video.mdx +12 -0
- package/dist/docs/accessibility.mdx +67 -0
- package/dist/docs/coreconcepts.mdx +77 -0
- package/dist/docs/introduction.mdx +33 -0
- package/dist/docs/versioning.mdx +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/stitches.d.ts +1949 -2
- package/dist/utilities/create-theme-variants/createThemeVariants.d.ts +109 -1
- package/dist/utilities/css-wrapper/CSSWrapper.d.ts +1 -1
- package/dist/utilities/style/capsize.d.ts +1 -1
- package/dist/utilities/style/keyframe-animations.d.ts +32 -8
- package/package.json +2 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Radio Card
|
|
3
|
+
component: RadioCardGroup,RadioCard
|
|
4
|
+
description: A Radio Button that enables extra emphasis and descriptive capability
|
|
5
|
+
category: Form primitives
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
A set of `RadioCard`s should be wrapped with a `RadioCardGroup` component to provide the correct HTML structure for our radio buttons. Any text within the card will be used as the label for the radio button, so ensure that you test this content and use `aria-hidden` to remove any unnecessary content from the announced text.
|
|
9
|
+
|
|
10
|
+
```tsx preview
|
|
11
|
+
<RadioCardGroup>
|
|
12
|
+
<RadioCard value="1">
|
|
13
|
+
<Text css={{ mb: '$2' }}>This is a radio card option</Text>
|
|
14
|
+
<Text size="sm" css={{ color: '$tonal300' }}>
|
|
15
|
+
With some additional text
|
|
16
|
+
</Text>
|
|
17
|
+
</RadioCard>
|
|
18
|
+
<RadioCard value="2">
|
|
19
|
+
<Text css={{ mb: '$2' }}>This is another radio card option</Text>
|
|
20
|
+
<Text size="sm" css={{ color: '$tonal300' }}>
|
|
21
|
+
With some additional text
|
|
22
|
+
</Text>
|
|
23
|
+
</RadioCard>
|
|
24
|
+
<RadioCard value="3">
|
|
25
|
+
<Text css={{ mb: '$2' }}>And a further radio card option</Text>
|
|
26
|
+
<Text size="sm" css={{ color: '$tonal300' }}>
|
|
27
|
+
With some additional text
|
|
28
|
+
</Text>
|
|
29
|
+
</RadioCard>
|
|
30
|
+
</RadioCardGroup>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
You can pass props to `RadioCardGroup` to control the styling of every `RadioCard` within. Change the radio button alignment within the card, toggle between two sizes, and render each card at full width.
|
|
34
|
+
|
|
35
|
+
```tsx preview
|
|
36
|
+
<RadioCardGroup align="right" size="lg" isFullWidth defaultValue="1">
|
|
37
|
+
<RadioCard value="1">
|
|
38
|
+
<Flex css={{ flexDirection: 'row', alignContent: 'center' }}>
|
|
39
|
+
<Text css={{ mr: '$4' }} size="sm">
|
|
40
|
+
£99
|
|
41
|
+
</Text>
|
|
42
|
+
<Heading size="xs">This is a radio card option</Heading>
|
|
43
|
+
</Flex>
|
|
44
|
+
</RadioCard>
|
|
45
|
+
<RadioCard value="2">
|
|
46
|
+
<Flex css={{ flexDirection: 'row', alignContent: 'center' }}>
|
|
47
|
+
<Text css={{ mr: '$4' }} size="sm">
|
|
48
|
+
£109
|
|
49
|
+
</Text>
|
|
50
|
+
<Heading size="xs">This is another radio card option</Heading>
|
|
51
|
+
</Flex>
|
|
52
|
+
</RadioCard>
|
|
53
|
+
<RadioCard value="3">
|
|
54
|
+
<Flex css={{ flexDirection: 'row', alignContent: 'center' }}>
|
|
55
|
+
<Text css={{ mr: '$4' }} size="sm">
|
|
56
|
+
£149
|
|
57
|
+
</Text>
|
|
58
|
+
<Heading size="xs">And a further additional radio card option</Heading>
|
|
59
|
+
</Flex>
|
|
60
|
+
</RadioCard>
|
|
61
|
+
</RadioCardGroup>
|
|
62
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Search Field
|
|
3
|
+
component: SearchField
|
|
4
|
+
description: SearchField renders a field composed of an SearchInput, a Label and a InlineMessage
|
|
5
|
+
category: Form fields
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`SearchField` is the preferred way to render a form field for search inputs.
|
|
9
|
+
|
|
10
|
+
In addition to text `Label` (required) and a validation error (optional), `SearchField` accepts all the same props as `SearchInput` and will pass them on to the `SearchInput` it renders. However, as with all our composed components,
|
|
11
|
+
`SearchField`’s `css` prop will be applied to a containing `Box`—the styling of the individual components inside `SearchField` cannot be altered.
|
|
12
|
+
|
|
13
|
+
Err on the side of using consistent form fields, but if you really need something with different styling then consider composing your own field from the
|
|
14
|
+
`SearchInput`, `Label` and `InlineMessage` components.
|
|
15
|
+
|
|
16
|
+
```tsx preview
|
|
17
|
+
<Form>
|
|
18
|
+
<SearchField
|
|
19
|
+
name="Email address"
|
|
20
|
+
label="Email address"
|
|
21
|
+
placeholder="your.name@example.com"
|
|
22
|
+
type="email"
|
|
23
|
+
css={{ width: 320 }}
|
|
24
|
+
/>
|
|
25
|
+
</Form>
|
|
26
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Search Input
|
|
3
|
+
component: SearchInput
|
|
4
|
+
description: A search input with matching search icon
|
|
5
|
+
category: Form primitives
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`SearchInput` wraps `Input` and adds an icon to visualise the specific input type, it's recommended to use this component when the user is performing a search query.
|
|
9
|
+
When the user types into the `SearchInput` the component renders a clear button that clears the typed value.
|
|
10
|
+
|
|
11
|
+
```tsx preview
|
|
12
|
+
<SearchInput name="search" css={{ width: 320 }} placeholder="Search" />
|
|
13
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Select
|
|
3
|
+
component: Select
|
|
4
|
+
description: Select is a light wrapper around the HTML select element
|
|
5
|
+
category: Form primitives
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
It adds default styling and the `css` prop.
|
|
9
|
+
|
|
10
|
+
A `Select` needs to be associated with a label for accessibility purposes, so rather than using the `Select` component directly in a UI, consider using a `SelectField`, which provides a `Label` and displays validation errors. Use this `Select` to compose more complex `Field` type components.
|
|
11
|
+
|
|
12
|
+
```tsx preview
|
|
13
|
+
<Select css={{ width: 300 }}>
|
|
14
|
+
<option value="apples">Apples</option>
|
|
15
|
+
<option value="bananas">Bananas</option>
|
|
16
|
+
</Select>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Accessibility
|
|
20
|
+
|
|
21
|
+
For accessibility purposes the component needs to have the `id` prop set, to link it to the label it is associated with. If a label is not available, please add an `aria-label` to ensure that the component remains accessible
|
|
22
|
+
|
|
23
|
+
## Placeholder
|
|
24
|
+
|
|
25
|
+
The component can display a placeholder without a value by passing the `placeholder` property.
|
|
26
|
+
|
|
27
|
+
```tsx preview
|
|
28
|
+
<Select placeholder="Please select a fruit" css={{ width: 300 }}>
|
|
29
|
+
<option value="apples">Apples</option>
|
|
30
|
+
<option value="bananas">Bananas</option>
|
|
31
|
+
</Select>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Disabled select
|
|
35
|
+
|
|
36
|
+
The component has a `disabled` state, by setting the `disabled` property.
|
|
37
|
+
|
|
38
|
+
```tsx preview
|
|
39
|
+
<Select disabled placeholder="Please select a fruit" css={{ width: 300 }}>
|
|
40
|
+
<option value="apples">Apples</option>
|
|
41
|
+
<option value="bananas">Bananas</option>
|
|
42
|
+
</Select>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Disabled Option
|
|
46
|
+
|
|
47
|
+
The component can show an option as `disabled`, by setting the `disabled` property on the option.
|
|
48
|
+
|
|
49
|
+
```tsx preview
|
|
50
|
+
<Select placeholder="Please select a fruit" css={{ width: 300 }}>
|
|
51
|
+
<option value="apples">Apples</option>
|
|
52
|
+
<option value="bananas" disabled>
|
|
53
|
+
Bananas
|
|
54
|
+
</option>
|
|
55
|
+
</Select>
|
|
56
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Select Field
|
|
3
|
+
component: SelectField
|
|
4
|
+
description: Wraps a Select with a Label and InlineMessage
|
|
5
|
+
category: Form fields
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`SelectField` wraps a `Select` with a `Label` and a `InlineMessage` to provide consistent behaviour and layout.
|
|
9
|
+
|
|
10
|
+
```tsx preview
|
|
11
|
+
<Form>
|
|
12
|
+
<SelectField name="options" label="Options" css={{ width: 320 }}>
|
|
13
|
+
<option value="apples">Apples</option>
|
|
14
|
+
<option value="bananas">Bananas</option>
|
|
15
|
+
</SelectField>
|
|
16
|
+
</Form>
|
|
17
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Sidedrawer
|
|
3
|
+
component: Sidedrawer,Sidedrawer.Accordion,Sidedrawer.AccordionContent,Sidedrawer.AccordionTrigger,Sidedrawer.Body,Sidedrawer.Close,Sidedrawer.Content,Sidedrawer.Footer,Sidedrawer.Header,Sidedrawer.Item,Sidedrawer.Trigger
|
|
4
|
+
description: A collection of items to build flexible sidedrawer
|
|
5
|
+
category: Navigation
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`Sidedrawer` exports components that combine to build complex side navigation.
|
|
9
|
+
|
|
10
|
+
## The `Sidedrawer` root
|
|
11
|
+
|
|
12
|
+
Sidedrawer exposes few main elements to build foundations.
|
|
13
|
+
The core element is a `Sidedrawer` which wraps entire components composition.
|
|
14
|
+
`Sidedrawer` has build-in state, but also allows you to pass props to control if from the outside.
|
|
15
|
+
The Sidedrawer root is made in top of the [radix dialog](https://www.radix-ui.com/docs/primitives/components/dialog)
|
|
16
|
+
|
|
17
|
+
Optional `Sidedrawer` props
|
|
18
|
+
|
|
19
|
+
- `isOpen` property determines if the whole `Sidedrawer` is visible or not.
|
|
20
|
+
- `onOpenChange` prop should be a function which updates `isOpen` state. This function is triggered automatically when click on `Sidedrawer.Overlay`, `Sidedrawer.Close` or press `Escape` key.
|
|
21
|
+
|
|
22
|
+
### Fundamental root componenents
|
|
23
|
+
|
|
24
|
+
- `Sidedrawer.Trigger` - It's the main `trigger element` responsible for opening the whole `Sidedrawer.Content`. This component is build on top of [radix dialog trigger](https://www.radix-ui.com/docs/primitives/components/dialog#trigger)
|
|
25
|
+
- `Sidedrawer.Content` - This is whe wrapper for whole content (`Sidedrawer.Header`, `Sidedrawer.Body`, `Sidedrawer.Footer` and other nested elements). This component is build on top of [radix dialog content](https://www.radix-ui.com/docs/primitives/components/dialog#content)
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Sidedrawer>
|
|
29
|
+
<Sidedrawer.Trigger asChild>
|
|
30
|
+
<Button>Open the navigation</Button>
|
|
31
|
+
</Sidedrawer.Trigger>
|
|
32
|
+
<Sidedrawer.Content>the sidedrawer content</Sidedrawer.Content>
|
|
33
|
+
</Sidedrawer>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### The `Sidedrawer.Content` children building blocks
|
|
37
|
+
|
|
38
|
+
- `Sidedrawer.Header` - It's based on `TopBar` component, so it plays really well with all `TopBar` subcomponents. This component is flexible, so you can render anything you need inside of it (for example app logo, Sidedrawer.Close etc.)
|
|
39
|
+
- `Sidedrawer.Close` - It's an `"close" ActionIcon` which triggers `Sidedrawer.Content` closing.
|
|
40
|
+
- `Sidedrawer.Body` - This is the wrapper for all `Sidedrawer.Item` items. The content is scrollable.
|
|
41
|
+
- `Sidedrawer.Footer` - Optional part of the `Sidedrawer`. It's fixed to the botton. You can pass whatever you need as it's children.
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
<Sidedrawer>
|
|
45
|
+
<Sidedrawer.Trigger asChild>
|
|
46
|
+
<Button>Open the navigation</Button>
|
|
47
|
+
</Sidedrawer.Trigger>
|
|
48
|
+
<Sidedrawer.Content>
|
|
49
|
+
<Sidedrawer.Header>
|
|
50
|
+
<Sidedrawer.Close />
|
|
51
|
+
</Sidedrawer.Header>
|
|
52
|
+
<Sidedrawer.Body>Sidedrawer items and Accordions here</Sidedrawer.Body>
|
|
53
|
+
<Sidedrawer.Footer>Footer items here</Sidedrawer.Footer>
|
|
54
|
+
</Sidedrawer.Content>
|
|
55
|
+
</Sidedrawer>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Sidedrawer.Body children
|
|
59
|
+
|
|
60
|
+
You most likely want to use `Sidedrawer.Item` or `Sidedrawer.Accordion` inside of `Sidedrawer.Body`
|
|
61
|
+
|
|
62
|
+
### Sidedrawer.Item
|
|
63
|
+
|
|
64
|
+
Sidedrawer exposes `Item` component to build a navigation elements.
|
|
65
|
+
`Sidedrawer.Item` is renderes as a `link` or a `button` depends on passed props.
|
|
66
|
+
|
|
67
|
+
- `href` prop determine a link render
|
|
68
|
+
- `onClick` prop determines a button render
|
|
69
|
+
|
|
70
|
+
**Link item:**
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<Sidedrawer.Item href={'/'}>
|
|
74
|
+
<Icon is={Apps} css={{ mr: '$2' }} />
|
|
75
|
+
Dashboard
|
|
76
|
+
</Sidedrawer.Item>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Button item:**
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<Sidedrawer.Item onClick={logout}>
|
|
83
|
+
<Icon is={Exit} css={{ mr: '$2' }} />
|
|
84
|
+
Log out
|
|
85
|
+
</Sidedrawer.Item>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Sidedrawer.Accordion
|
|
89
|
+
|
|
90
|
+
**Accordion item:**
|
|
91
|
+
|
|
92
|
+
Accordion item requires few elements to work properly:
|
|
93
|
+
|
|
94
|
+
- `value` property is a unique identifier needed to expand accordion content. [read more](https://www.radix-ui.com/docs/primitives/components/accordion#item)
|
|
95
|
+
- `Sidedrawer.AccordionTrigger` - This component is a trigger which expand/collapse Accordion content. You can pass a text or components composition as its children.
|
|
96
|
+
- `Sidedrawer.AccordionContent` - This component contains whole accorion content. Most likely you would like to pass few another `Sidedrawer.Item` items inside. Accordion content is collapsed until you click the `Sidedrawer.AccordionTrigger` to expand it.
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<Sidedrawer.Accordion value="your_unique_identifier">
|
|
100
|
+
<Sidedrawer.AccordionTrigger>
|
|
101
|
+
<Icon is={New} css={{ mr: '$2' }} />
|
|
102
|
+
Set work
|
|
103
|
+
</Sidedrawer.AccordionTrigger>
|
|
104
|
+
<Sidedrawer.AccordionContent>
|
|
105
|
+
<Sidedrawer.Item href={'/practice'}>
|
|
106
|
+
<Icon is={Feed} css={{ mr: '$2' }} />
|
|
107
|
+
Practice
|
|
108
|
+
</Sidedrawer.Item>
|
|
109
|
+
<Sidedrawer.Item href={'/test'}>
|
|
110
|
+
<Icon is={Inbox} css={{ mr: '$2' }} />
|
|
111
|
+
Test
|
|
112
|
+
</Sidedrawer.Item>
|
|
113
|
+
</Sidedrawer.AccordionContent>
|
|
114
|
+
</Sidedrawer.Accordion>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Whole Sidedrawer components composition
|
|
118
|
+
|
|
119
|
+
```tsx preview
|
|
120
|
+
<Sidedrawer>
|
|
121
|
+
<Sidedrawer.Trigger asChild>
|
|
122
|
+
<Button>Open the Sidedrawer</Button>
|
|
123
|
+
</Sidedrawer.Trigger>
|
|
124
|
+
<Sidedrawer.Content>
|
|
125
|
+
<Sidedrawer.Header>
|
|
126
|
+
<Sidedrawer.Close />
|
|
127
|
+
<TopBar.BrandLogo
|
|
128
|
+
src={'https://atomlearning.co.uk/_next/static/media/logo.e9276284.svg'}
|
|
129
|
+
/>
|
|
130
|
+
</Sidedrawer.Header>
|
|
131
|
+
<Sidedrawer.Body>
|
|
132
|
+
<Sidedrawer.Item href={'/'} active>
|
|
133
|
+
Dashboard
|
|
134
|
+
</Sidedrawer.Item>
|
|
135
|
+
<Sidedrawer.Accordion value="1" disabled>
|
|
136
|
+
<Sidedrawer.AccordionTrigger>Set work</Sidedrawer.AccordionTrigger>
|
|
137
|
+
<Sidedrawer.AccordionContent>
|
|
138
|
+
<Sidedrawer.Item href={'/'}>Set Practice</Sidedrawer.Item>
|
|
139
|
+
<Sidedrawer.Item href={'/'}>Mock Tests</Sidedrawer.Item>
|
|
140
|
+
</Sidedrawer.AccordionContent>
|
|
141
|
+
</Sidedrawer.Accordion>
|
|
142
|
+
<Sidedrawer.Accordion value="2">
|
|
143
|
+
<Sidedrawer.AccordionTrigger>Resources</Sidedrawer.AccordionTrigger>
|
|
144
|
+
<Sidedrawer.AccordionContent>
|
|
145
|
+
<Sidedrawer.Item onClick={() => console.log('clicked!')}>
|
|
146
|
+
I am a button
|
|
147
|
+
</Sidedrawer.Item>
|
|
148
|
+
<Sidedrawer.Item href="/">I am a link</Sidedrawer.Item>
|
|
149
|
+
</Sidedrawer.AccordionContent>
|
|
150
|
+
</Sidedrawer.Accordion>
|
|
151
|
+
</Sidedrawer.Body>
|
|
152
|
+
<Sidedrawer.Footer>The footer content</Sidedrawer.Footer>
|
|
153
|
+
</Sidedrawer.Content>
|
|
154
|
+
</Sidedrawer>
|
|
155
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Slider
|
|
3
|
+
component: Slider, Slider.Value, Slider.Steps
|
|
4
|
+
description: The slider component implements the Slider component from Radix, with default styling and the CSS prop.
|
|
5
|
+
category: Form primitives
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
The `Slider` is a simple component that renders a form slider.
|
|
9
|
+
|
|
10
|
+
The `Slider` component should be rendered with a label for accesibility reasons. Rather than using the `Slider` component directly, it is best to use the `SliderField` component, which provides a field label, a value label, and easily integrates with the `Form` component.
|
|
11
|
+
|
|
12
|
+
Should you wish to create a more complex UI with `Field` components, you should use this base component.
|
|
13
|
+
|
|
14
|
+
Please note: the `value` or `defaultValue` passed in should always be an array.
|
|
15
|
+
|
|
16
|
+
```tsx preview
|
|
17
|
+
<Slider defaultValue={[50]} css={{ width: '320px' }} />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Multiple Values
|
|
21
|
+
|
|
22
|
+
Should you wish to have more than one control on the slider, you can pass those values in the array.
|
|
23
|
+
|
|
24
|
+
```tsx preview
|
|
25
|
+
<Slider defaultValue={[25, 75]} css={{ width: '320px' }} />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Slider.Steps
|
|
29
|
+
|
|
30
|
+
A separate component exists to output an array of labels which appear at given value points along the slider. These are passed in to the `steps` property using an array objects that contain a label and a value.
|
|
31
|
+
|
|
32
|
+
This is most commonly used within the `SliderField`, but is here in case you need to compose your own complex component.
|
|
33
|
+
|
|
34
|
+
Note: it is likely better to create steps as a constant and pass in with `steps={steps}` or similar, but this preview code cannot see values outside of JSX.
|
|
35
|
+
|
|
36
|
+
```tsx preview
|
|
37
|
+
<Slider defaultValue={[50]} css={{ width: '320px' }}>
|
|
38
|
+
<Slider.Steps
|
|
39
|
+
min={0}
|
|
40
|
+
max={100}
|
|
41
|
+
steps={[
|
|
42
|
+
{ value: 0, label: 'min' },
|
|
43
|
+
{ value: 50, label: 'mid' },
|
|
44
|
+
{ value: 100, label: 'max' }
|
|
45
|
+
]}
|
|
46
|
+
/>
|
|
47
|
+
</Slider>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The component requires min and max values, these should be the same as the optional values that are passed to the Slider component.
|
|
51
|
+
|
|
52
|
+
`Slider.Steps` work well with the built in `step` property, which defaults to 1 and changes the size of each movement. For example, this would limit the slider to three values only.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
<Slider defaultValue={[50]} min={10} max={20} step={5}>
|
|
56
|
+
<Slider.Steps
|
|
57
|
+
min={10}
|
|
58
|
+
max={20}
|
|
59
|
+
steps={[
|
|
60
|
+
{ value: 10, label: 'min' },
|
|
61
|
+
{ value: 15, label: 'mid' },
|
|
62
|
+
{ value: 20, label: 'max' }
|
|
63
|
+
]}
|
|
64
|
+
/>
|
|
65
|
+
</Slider>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Slider.Value
|
|
69
|
+
|
|
70
|
+
A separate component exists to output the value from a slider. This is most commonly used within the `SliderField`, but is here in case you need to compose your own complex component.
|
|
71
|
+
|
|
72
|
+
```tsx preview
|
|
73
|
+
<Slider defaultValue={[50]} css={{ width: '320px' }}>
|
|
74
|
+
{/**
|
|
75
|
+
* The Slider.Value value must be manually controlled using onValueChange
|
|
76
|
+
* from Slider. This is a visual example of how would render Slider.Value
|
|
77
|
+
* and will not update when changed.
|
|
78
|
+
*/}
|
|
79
|
+
<Slider.Value value={[50]} />
|
|
80
|
+
</Slider>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
By default this simply outputs the value, however, this can be customised in a number of ways. The property `outputLabel` accepts a function that passes the value selected in the slider and expects a string returned for the label.
|
|
84
|
+
|
|
85
|
+
You can also use this is in more complex ways, for example to set empty states and pluralisation, like below.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
<Slider defaultValue={[50]} css={{ width: '320px' }}>
|
|
89
|
+
<Slider.Value
|
|
90
|
+
value={[50]}
|
|
91
|
+
outputLabel={(value) =>
|
|
92
|
+
value === 0
|
|
93
|
+
? 'You have no geese'
|
|
94
|
+
: `You have ${value} ${value === 1 ? 'goose' : 'geese'}`
|
|
95
|
+
}
|
|
96
|
+
/>
|
|
97
|
+
</Slider>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Should you wish to use the label with multiple values, you can use `Array.join()` like below.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
<Slider.Value
|
|
104
|
+
value={[25, 75]}
|
|
105
|
+
outputLabel={(value) => `You have between ${value.join(' and ')} geese`}
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Styling
|
|
110
|
+
|
|
111
|
+
Depending on the background of your page, you can change the theme of the track to be either light or tonal using `theme="light"`. Default is `theme="tonal"`.
|
|
112
|
+
|
|
113
|
+
```tsx preview
|
|
114
|
+
<Box css={{ p: '$5', bg: '$tonal100' }}>
|
|
115
|
+
<Slider theme="light" defaultValue={[50]} css={{ width: '320px' }} />
|
|
116
|
+
</Box>
|
|
117
|
+
```
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Slider Field
|
|
3
|
+
component: SliderField
|
|
4
|
+
description: Combines a Slider with a label and form integration.
|
|
5
|
+
category: Form fields
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`SliderField` renders a `Slider` with a label, and easy implementation with `Form`. It also renders a `Slider.Value` label underneath the slider, and a `Slider.Steps` component should steps be passed in.
|
|
9
|
+
|
|
10
|
+
In it's most simple form, a slider allows one value to be set between two given values (default 0 and 100).
|
|
11
|
+
|
|
12
|
+
Please note: the `value` or `defaultValue` passed in should always be an array.
|
|
13
|
+
|
|
14
|
+
```tsx preview
|
|
15
|
+
<Form>
|
|
16
|
+
<SliderField name="slider" label="Select a value" defaultValue={[50]} />
|
|
17
|
+
</Form>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
With optional `Slider.Steps`:
|
|
21
|
+
|
|
22
|
+
```tsx preview
|
|
23
|
+
<Form>
|
|
24
|
+
<SliderField
|
|
25
|
+
name="slider"
|
|
26
|
+
label="Select a value (now with steps)"
|
|
27
|
+
defaultValue={[50]}
|
|
28
|
+
steps={[
|
|
29
|
+
{ value: 0, label: 'min' },
|
|
30
|
+
{ value: 50, label: 'mid' },
|
|
31
|
+
{ value: 100, label: 'max' }
|
|
32
|
+
]}
|
|
33
|
+
/>
|
|
34
|
+
</Form>
|
|
35
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Stack
|
|
3
|
+
component: Stack
|
|
4
|
+
description: Stack is a layout component that provides an abstraction over the flexbox gap property
|
|
5
|
+
category: Layout
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`Stack` is a single axis layout component enabling you to space items evenly within it using the `gap` prop and change the direction of content with `direction`. In an ideal world this component would be redundant as `gap` would be widely supported when used with `display: flex`; unfortunately browser support [isn’t great](https://caniuse.com/flexbox-gap) with Safari being the last major browser yet to implement it. `@supports()` would usually enable us to progressively enable this property but there’s no way to test when it’s used alongside flexbox, as `gap` is also used in `display: grid`. Until we gain greater browser support, this `Stack` component should provide a similar output.
|
|
9
|
+
|
|
10
|
+
```tsx preview
|
|
11
|
+
<Stack gap="2" direction="column">
|
|
12
|
+
<Box css={{ bg: '$primary', size: '$5' }} />
|
|
13
|
+
<Box css={{ bg: '$primary', size: '$5' }} />
|
|
14
|
+
<Box css={{ bg: '$primary', size: '$5' }} />
|
|
15
|
+
</Stack>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```tsx preview
|
|
19
|
+
<Stack gap="2" direction="row">
|
|
20
|
+
<Box css={{ bg: '$primary', size: '$5' }} />
|
|
21
|
+
<Box css={{ bg: '$primary', size: '$5' }} />
|
|
22
|
+
<Box css={{ bg: '$primary', size: '$5' }} />
|
|
23
|
+
</Stack>
|
|
24
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Stack Content
|
|
3
|
+
component: StackContent
|
|
4
|
+
description: A layout component to provide internal spacing between content components
|
|
5
|
+
category: Layout
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`StackContent` applies an opinionated set of spacing rules around our content components, `Heading`, `Text`, `List`, `Divider` and `Image`. It also applies a maximum width to `Heading`, `Text` and `List` to ensure optimal line length is preserved for readability.
|
|
9
|
+
|
|
10
|
+
```tsx preview
|
|
11
|
+
<StackContent>
|
|
12
|
+
<Heading size="sm">This is an example of how the content is spaced</Heading>
|
|
13
|
+
<Text>
|
|
14
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
15
|
+
tempor incididunt ut labore et dolore magna aliqua.
|
|
16
|
+
</Text>
|
|
17
|
+
<List>
|
|
18
|
+
<List.Item>
|
|
19
|
+
Ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
20
|
+
</List.Item>
|
|
21
|
+
<List.Item>
|
|
22
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
23
|
+
dolore eu fugiat nulla pariatur.
|
|
24
|
+
</List.Item>
|
|
25
|
+
</List>
|
|
26
|
+
<Divider />
|
|
27
|
+
<Text>
|
|
28
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
|
29
|
+
tempor incididunt ut labore et dolore magna aliqua.
|
|
30
|
+
</Text>
|
|
31
|
+
</StackContent>
|
|
32
|
+
```
|