@atom-learning/components 2.32.3-beta.0 → 2.33.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/CHANGELOG.md +60 -0
- package/README.md +11 -5
- package/dist/components/accordion/AccordionItem.js +1 -1
- package/dist/components/accordion/AccordionTrigger.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/carousel/CarouselArrows.js +1 -1
- package/dist/components/carousel/CarouselSlide.js +1 -1
- package/dist/components/checkbox-field/CheckboxField.js +1 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/chip/ChipGroup.js +1 -1
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupRoot.js +1 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/data-table/DataTableBody.js +1 -1
- package/dist/components/data-table/DataTableDataCell.js +1 -1
- package/dist/components/data-table/DataTableGlobalFilter.js +1 -1
- package/dist/components/data-table/DataTableRow.js +1 -1
- package/dist/components/data-table/DataTableTable.js +1 -1
- package/dist/components/data-table/drag-and-drop/DraggableRow.js +1 -1
- package/dist/components/data-table/drag-and-drop/Handle.js +1 -1
- package/dist/components/dismissible/DismissibleRoot.js +1 -1
- package/dist/components/dismissible/DismissibleTrigger.js +1 -1
- package/dist/components/dropdown-menu/DropdownMenuLinkItem.js +1 -1
- package/dist/components/field-wrapper/FieldDescription.js +1 -1
- package/dist/components/field-wrapper/InlineFieldWrapper.js +1 -1
- package/dist/components/file-input/FileInput.js +1 -1
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/heading/Heading.js +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/inline-message/InlineMessage.js +1 -1
- package/dist/components/label/Label.js +1 -1
- package/dist/components/link/Link.js +1 -1
- package/dist/components/list/List.js +1 -1
- package/dist/components/markdown-content/components/MarkdownEmphasis.js +1 -1
- package/dist/components/markdown-content/components/MarkdownHeading.js +1 -1
- package/dist/components/markdown-content/components/MarkdownImage.js +1 -1
- package/dist/components/markdown-content/components/MarkdownInlineCode.js +1 -1
- package/dist/components/markdown-content/components/MarkdownLink.js +1 -1
- package/dist/components/markdown-content/components/MarkdownListItem.js +1 -1
- package/dist/components/markdown-content/components/MarkdownParagraph.js +1 -1
- package/dist/components/markdown-content/components/MarkdownStrong.js +1 -1
- package/dist/components/markdown-content/components/MarkdownThematicBreak.js +1 -1
- package/dist/components/navigation/NavigationMenuDropdownContent.js +1 -1
- package/dist/components/navigation/NavigationMenuLink.js +1 -1
- package/dist/components/notification-badge/NotificationBadge.js +1 -1
- package/dist/components/number-input/NumberInput.js +1 -1
- package/dist/components/number-input-field/NumberInputField.js +1 -1
- package/dist/components/popover/PopoverContent.js +1 -1
- package/dist/components/radio-button/RadioButton.js +1 -1
- package/dist/components/radio-button-field/RadioButtonField.js +1 -1
- package/dist/components/radio-button-field/RadioField.js +1 -1
- package/dist/components/radio-card/RadioCardGroup.js +1 -1
- package/dist/components/search-input/SearchInput.d.ts +2 -0
- package/dist/components/search-input/SearchInput.js +1 -1
- package/dist/components/select-field/SelectField.js +1 -1
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionContent.js +1 -1
- package/dist/components/sidedrawer/SidedrawerContent.js +1 -1
- package/dist/components/slider/Slider.d.ts +2 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/slider-field/SliderField.js +1 -1
- package/dist/components/stack-content/StackContent.js +1 -1
- package/dist/components/stepper/StepperStepBack.js +1 -1
- package/dist/components/table/Table.d.ts +1 -5
- package/dist/components/table/Table.js +1 -1
- package/dist/components/table/TableBody.js +1 -1
- package/dist/components/table/TableHeader.js +1 -1
- package/dist/components/table/TableRow.js +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/tabs/TabsTrigger.js +1 -1
- package/dist/components/tabs/TabsTriggerList.js +1 -1
- package/dist/components/text/Text.js +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toast/ToastProvider.js +1 -1
- package/dist/components/toggle-group/ToggleGroupButton.js +1 -1
- package/dist/components/tooltip/TooltipContent.js +1 -1
- package/dist/components/video/Video.js +1 -1
- package/dist/docgen.json +1 -1
- package/dist/experiments/color-scheme/ColorScheme.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/utilities/hooks/useCallbackRef.js +1 -1
- package/package.json +6 -6
- package/dist/components/table/TableStickyColumnsContainer.d.ts +0 -9
- package/dist/components/table/TableStickyColumnsContainer.js +0 -1
- package/dist/docs/Accordion.mdx +0 -94
- package/dist/docs/ActionIcon.mdx +0 -87
- package/dist/docs/AlertDialog.mdx +0 -40
- package/dist/docs/Avatar.mdx +0 -129
- package/dist/docs/Badge.mdx +0 -55
- package/dist/docs/Box.mdx +0 -52
- package/dist/docs/Button.mdx +0 -68
- package/dist/docs/CONTRIBUTING.md +0 -224
- package/dist/docs/CSSWrapper.mdx +0 -10
- package/dist/docs/Carousel.mdx +0 -88
- package/dist/docs/Checkbox.mdx +0 -19
- package/dist/docs/CheckboxField.mdx +0 -14
- package/dist/docs/Chip.mdx +0 -118
- package/dist/docs/ChipDismissibleGroup.mdx +0 -33
- package/dist/docs/ChipToggleGroup.mdx +0 -27
- package/dist/docs/Combobox.mdx +0 -44
- package/dist/docs/DataTable.mdx +0 -279
- package/dist/docs/DateField.mdx +0 -20
- package/dist/docs/DateInput.mdx +0 -87
- package/dist/docs/Dialog.mdx +0 -68
- package/dist/docs/Dismissible.mdx +0 -48
- package/dist/docs/DismissibleGroup.mdx +0 -29
- package/dist/docs/Divider.mdx +0 -16
- package/dist/docs/DropdownMenu.mdx +0 -30
- package/dist/docs/EmptyState.mdx +0 -23
- package/dist/docs/FieldWrapper.mdx +0 -30
- package/dist/docs/FileInput.mdx +0 -45
- package/dist/docs/Flex.mdx +0 -16
- package/dist/docs/Form.mdx +0 -411
- package/dist/docs/Grid.mdx +0 -28
- package/dist/docs/Heading.mdx +0 -30
- package/dist/docs/Icon.mdx +0 -30
- package/dist/docs/Image.mdx +0 -14
- package/dist/docs/InlineMessage.mdx +0 -52
- package/dist/docs/Input.mdx +0 -24
- package/dist/docs/InputField.mdx +0 -26
- package/dist/docs/Label.mdx +0 -32
- package/dist/docs/Link.mdx +0 -53
- package/dist/docs/List.mdx +0 -38
- package/dist/docs/Loader.mdx +0 -16
- package/dist/docs/MarkdownContent.mdx +0 -77
- package/dist/docs/NavigationMenu.mdx +0 -144
- package/dist/docs/NotificationBadge.mdx +0 -35
- package/dist/docs/NumberInput.mdx +0 -37
- package/dist/docs/NumberInputField.mdx +0 -26
- package/dist/docs/PasswordField.mdx +0 -23
- package/dist/docs/PasswordInput.mdx +0 -15
- package/dist/docs/Popover.mdx +0 -29
- package/dist/docs/ProgressBar.mdx +0 -56
- package/dist/docs/README.mdx +0 -79
- package/dist/docs/RadioButton.mdx +0 -10
- package/dist/docs/RadioButtonField.mdx +0 -25
- package/dist/docs/RadioCard.mdx +0 -62
- package/dist/docs/SearchField.mdx +0 -26
- package/dist/docs/SearchInput.mdx +0 -13
- package/dist/docs/Select.mdx +0 -56
- package/dist/docs/SelectField.mdx +0 -17
- package/dist/docs/Sidedrawer.mdx +0 -155
- package/dist/docs/Slider.mdx +0 -117
- package/dist/docs/SliderField.mdx +0 -35
- package/dist/docs/Stack.mdx +0 -24
- package/dist/docs/StackContent.mdx +0 -32
- package/dist/docs/Stepper.mdx +0 -154
- package/dist/docs/Styling.mdx +0 -85
- package/dist/docs/Switch.mdx +0 -28
- package/dist/docs/Table.mdx +0 -146
- package/dist/docs/Tabs.mdx +0 -76
- package/dist/docs/Text.mdx +0 -24
- package/dist/docs/Textarea.mdx +0 -12
- package/dist/docs/TextareaField.mdx +0 -21
- package/dist/docs/Toast.mdx +0 -20
- package/dist/docs/ToggleGroup.mdx +0 -88
- package/dist/docs/Tooltip.mdx +0 -25
- package/dist/docs/TopBar.mdx +0 -95
- package/dist/docs/Video.mdx +0 -12
- package/dist/docs/accessibility.mdx +0 -67
- package/dist/docs/coreconcepts.mdx +0 -77
- package/dist/docs/introduction.mdx +0 -33
- package/dist/docs/versioning.mdx +0 -40
package/dist/docs/Label.mdx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Label
|
|
3
|
-
component: Label
|
|
4
|
-
description: Label is a light wrapper around the basic HTML label element
|
|
5
|
-
category: Form primitives
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
It adds default styling and the `css` prop.
|
|
9
|
-
|
|
10
|
-
Labels are associated with controls like `input` or `checkbox`, however before using this component consider using one of the provided `Field` components that are available. Use this `Label` to compose more complex `Field` type components.
|
|
11
|
-
|
|
12
|
-
## Accessibility
|
|
13
|
-
|
|
14
|
-
For accessibility purposes the component needs either to have the `htmlFor` prop set to link it to the control it is associated with or to wrap around the component that it is labelling.
|
|
15
|
-
|
|
16
|
-
## Sizes
|
|
17
|
-
|
|
18
|
-
```tsx preview
|
|
19
|
-
<Label size="sm">A small label</Label>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
```tsx preview
|
|
23
|
-
<Label>A normal label</Label>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Required
|
|
27
|
-
|
|
28
|
-
To denote a required field, the `required` prop will add an `*` suffix to the label text.
|
|
29
|
-
|
|
30
|
-
```tsx preview
|
|
31
|
-
<Label required>A normal label</Label>
|
|
32
|
-
```
|
package/dist/docs/Link.mdx
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Link
|
|
3
|
-
component: Link
|
|
4
|
-
description: Link is a light wrapper around the HTML anchor element
|
|
5
|
-
category: Navigation
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
It adds default styling and the `css` prop.
|
|
9
|
-
|
|
10
|
-
## Sizes
|
|
11
|
-
|
|
12
|
-
```tsx preview
|
|
13
|
-
<Link href="http://example.com/" size="sm">
|
|
14
|
-
I'm a link
|
|
15
|
-
</Link>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
```tsx preview
|
|
19
|
-
<Link href="http://example.com/">I'm a link</Link>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
```tsx preview
|
|
23
|
-
<Link href="http://example.com/" size="lg">
|
|
24
|
-
I'm a link
|
|
25
|
-
</Link>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
[Capsize](https://seek-oss.github.io/capsize/) is used to size the text to the height of its capital letters, trimming the space above capital letters and below the baseline. This is removed when `Link` is nested within either `Text`, `Heading` or `List` components to ensure that it renders correctly.
|
|
31
|
-
|
|
32
|
-
```tsx preview
|
|
33
|
-
<Text size="lg">
|
|
34
|
-
<Link href="http://example.com/">Adaptive online learning</Link> for ages
|
|
35
|
-
7-12+. Prepare your child for secondary school entry and beyond.
|
|
36
|
-
</Text>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Polymorphism
|
|
40
|
-
|
|
41
|
-
The `Link` component supports polymorphism, therefore depending on whether it receives an `onClick`/`href` as a prop, it will produce a `button` or `link` respectively
|
|
42
|
-
|
|
43
|
-
```tsx preview
|
|
44
|
-
<Link href="http://example.com/">
|
|
45
|
-
I'm a link
|
|
46
|
-
</Link>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
```tsx preview
|
|
50
|
-
<Link onClick={() => console.log('clicked')}>
|
|
51
|
-
I'm a button
|
|
52
|
-
</Link>
|
|
53
|
-
```
|
package/dist/docs/List.mdx
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: List
|
|
3
|
-
component: List
|
|
4
|
-
description: List renders an unordered or ordered list
|
|
5
|
-
category: Content
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`List` renders a `ul` or `ol` based on the `type` prop and accepts a `theme` prop to change the color of the bullets and allows varying sizes.
|
|
9
|
-
|
|
10
|
-
```tsx preview
|
|
11
|
-
<List>
|
|
12
|
-
<List.Item>Personalised learning journey</List.Item>
|
|
13
|
-
<List.Item>Adaptive learning to maximise engagement</List.Item>
|
|
14
|
-
<List.Item>Comprehensive, teacher-approved content</List.Item>
|
|
15
|
-
<List.Item>Unlimited, adaptive mock tests</List.Item>
|
|
16
|
-
<List.Item>Detailed performance analytics</List.Item>
|
|
17
|
-
</List>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
```tsx preview
|
|
21
|
-
<List ordered>
|
|
22
|
-
<List.Item>Personalised learning journey</List.Item>
|
|
23
|
-
<List.Item>Adaptive learning to maximise engagement</List.Item>
|
|
24
|
-
<List.Item>Comprehensive, teacher-approved content</List.Item>
|
|
25
|
-
<List.Item>Unlimited, adaptive mock tests</List.Item>
|
|
26
|
-
<List.Item>Detailed performance analytics</List.Item>
|
|
27
|
-
</List>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
```tsx preview
|
|
31
|
-
<List theme="primary" size="sm">
|
|
32
|
-
<List.Item>Personalised learning journey</List.Item>
|
|
33
|
-
<List.Item>Adaptive learning to maximise engagement</List.Item>
|
|
34
|
-
<List.Item>Comprehensive, teacher-approved content</List.Item>
|
|
35
|
-
<List.Item>Unlimited, adaptive mock tests</List.Item>
|
|
36
|
-
<List.Item>Detailed performance analytics</List.Item>
|
|
37
|
-
</List>
|
|
38
|
-
```
|
package/dist/docs/Loader.mdx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Loader
|
|
3
|
-
component: Loader
|
|
4
|
-
description: Loader provides feedback that an action is in progress
|
|
5
|
-
category: Feedback
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
Render a `Loader` to show that content is loading or that a user’s action is in progress.
|
|
9
|
-
|
|
10
|
-
```tsx preview
|
|
11
|
-
<>
|
|
12
|
-
<Loader size="sm" />
|
|
13
|
-
<Loader />
|
|
14
|
-
<Loader size="lg" />
|
|
15
|
-
</>
|
|
16
|
-
```
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Markdown Content
|
|
3
|
-
component: MarkdownContent
|
|
4
|
-
description: MarkdownContent is a content component that will transform a Markdown string into Atom Learning design system components.
|
|
5
|
-
category: Content
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
Currently it suppports converts the following Markdown elements into components:
|
|
9
|
-
|
|
10
|
-
| Type | Component | Default component implemented |
|
|
11
|
-
| :----------------- | :------------------ | :---------------------------- |
|
|
12
|
-
| blockquote | | ⛔ |
|
|
13
|
-
| code | `<Box as="pre" />` | ✅ |
|
|
14
|
-
| containerDirective | | ⛔ |
|
|
15
|
-
| emphasis | `<em />` | ✅ |
|
|
16
|
-
| heading | `<Heading />` | ✅ |
|
|
17
|
-
| image | `<Image />` | ✅ |
|
|
18
|
-
| inlineCode | `<Box as="code" />` | ✅ |
|
|
19
|
-
| leafDirective | | ⛔ |
|
|
20
|
-
| link | `<Link />` | ✅ |
|
|
21
|
-
| list | `<List />` | ✅ |
|
|
22
|
-
| listItem | `<List.Item />` | ✅ |
|
|
23
|
-
| paragraph | `<Text />` | ✅ |
|
|
24
|
-
| strong | `<strong />` | ✅ |
|
|
25
|
-
| text | `{value}` | ✅ |
|
|
26
|
-
| textDirective | | ⛔ |
|
|
27
|
-
| thematicBreak | `<Divider />` | ✅ |
|
|
28
|
-
|
|
29
|
-
```tsx live
|
|
30
|
-
<MarkdownContent
|
|
31
|
-
content={`
|
|
32
|
-
## This is a heading 2
|
|
33
|
-
|
|
34
|
-
This will be a paragraph
|
|
35
|
-
|
|
36
|
-
[And this will be a link](https://atomlearning.co.uk)
|
|
37
|
-
`}
|
|
38
|
-
/>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Override with custom components
|
|
42
|
-
|
|
43
|
-
You can override the component `MarkdownContent` will render for each type by passing an object to the `customComponents` prop where each key is the name of a Markdown Type (see the table above) and the value is a reference to the component you want to render:
|
|
44
|
-
|
|
45
|
-
```tsx preview
|
|
46
|
-
<MarkdownContent
|
|
47
|
-
content="This paragraph will have a red color"
|
|
48
|
-
customComponents={{
|
|
49
|
-
paragraph: ({ node, handleNode }) => (
|
|
50
|
-
<Text css={{ color: 'red' }}>{node.children.map(handleNode)}</Text>
|
|
51
|
-
)
|
|
52
|
-
}}
|
|
53
|
-
/>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Markdown directives
|
|
57
|
-
|
|
58
|
-
The `MarkdownContent` component supports [Markdown directives](https://talk.commonmark.org/t/generic-directives-plugins-syntax/444). There are no directives built in by default, but you can define your own directives by using the `customComponents` prop.
|
|
59
|
-
|
|
60
|
-
See the following example that transform the following directive into a `Button` component:
|
|
61
|
-
|
|
62
|
-
```tsx preview
|
|
63
|
-
<MarkdownContent
|
|
64
|
-
content=":button[This is a button]{href=https://atomlearning.co.uk isRounded=true}"
|
|
65
|
-
customComponents={{
|
|
66
|
-
textDirective: ({ node, handleNode }) => {
|
|
67
|
-
const { name, attributes, children } = node
|
|
68
|
-
|
|
69
|
-
if (name === 'button') {
|
|
70
|
-
return <Button {...attributes}>{children.map(handleNode)}</Button>
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return null
|
|
74
|
-
}
|
|
75
|
-
}}
|
|
76
|
-
/>
|
|
77
|
-
```
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: NavigationMenu
|
|
3
|
-
component: NavigationMenu,NavigationMenu.Link,NavigationMenu.Dropdown,NavigationMenu.DropdownContent,NavigationMenu.DropdownItem
|
|
4
|
-
description: A collection of links for navigating apps.
|
|
5
|
-
category: Navigation
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`NavigationMenu` exports many components that combine to form a navigation menu.
|
|
9
|
-
|
|
10
|
-
```tsx preview
|
|
11
|
-
<NavigationMenu>
|
|
12
|
-
<NavigationMenu.Link href="/overview/introduction">
|
|
13
|
-
Introduction
|
|
14
|
-
</NavigationMenu.Link>
|
|
15
|
-
<NavigationMenu.Dropdown id="1">
|
|
16
|
-
<NavigationMenu.DropdownTrigger>Theme</NavigationMenu.DropdownTrigger>
|
|
17
|
-
<NavigationMenu.DropdownContent>
|
|
18
|
-
<NavigationMenu.DropdownItem href="/theme/colours">
|
|
19
|
-
Colours
|
|
20
|
-
</NavigationMenu.DropdownItem>
|
|
21
|
-
<NavigationMenu.DropdownItem href="/theme/effects">
|
|
22
|
-
Effects
|
|
23
|
-
</NavigationMenu.DropdownItem>
|
|
24
|
-
<NavigationMenu.DropdownItem href="/theme/icons">
|
|
25
|
-
Icons
|
|
26
|
-
</NavigationMenu.DropdownItem>
|
|
27
|
-
</NavigationMenu.DropdownContent>
|
|
28
|
-
</NavigationMenu.Dropdown>
|
|
29
|
-
</NavigationMenu>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## With client side routing
|
|
33
|
-
|
|
34
|
-
`NavigationMenu.Dropdown`, `NavigationMenu.DropdownItem` and `NavigationMenu.Link` can be passed an `active` prop for instances when you want to highlight the currently active route. See below for examples using client side routing with the `NavigationMenu.Link` component. The same method can be applied to `NavigationMenu.Dropdown` and `NavigationMenu.DropdownItem`.
|
|
35
|
-
|
|
36
|
-
#### Example using React Router
|
|
37
|
-
|
|
38
|
-
```tsx
|
|
39
|
-
const Link = ({ href, ...props }) => {
|
|
40
|
-
const { pathname } = useLocation()
|
|
41
|
-
const isActive = path === href
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<NavigationMenu.Link active={isActive} {...props}>
|
|
45
|
-
Introduction
|
|
46
|
-
</NavigationMenu.Link>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
#### Example using Next JS
|
|
52
|
-
|
|
53
|
-
```tsx
|
|
54
|
-
const Link = ({ href, ...props }) => {
|
|
55
|
-
const router = useRouter()
|
|
56
|
-
const isActive = router.asPath === href
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<NavigationMenu.Link active={isActive} {...props}>
|
|
60
|
-
Introduction
|
|
61
|
-
</NavigationMenu.Link>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Changing the layout of the dropdown content
|
|
67
|
-
|
|
68
|
-
By default, dropdown items inside of `NavigationMenu.DropdownContent` will stack.
|
|
69
|
-
|
|
70
|
-
If you want to change the way items are displayed, you can add custom styling to `NavigationMenu.DropdownContent`.
|
|
71
|
-
|
|
72
|
-
In the below example the styling of `NavigationMenu.DropdownContent` has been changed to allow a grid layout.
|
|
73
|
-
|
|
74
|
-
```tsx preview
|
|
75
|
-
<NavigationMenu>
|
|
76
|
-
<NavigationMenu.Link href="/overview/introduction">
|
|
77
|
-
Introduction
|
|
78
|
-
</NavigationMenu.Link>
|
|
79
|
-
<NavigationMenu.Dropdown id="1">
|
|
80
|
-
<NavigationMenu.DropdownTrigger>Theme</NavigationMenu.DropdownTrigger>
|
|
81
|
-
<NavigationMenu.DropdownContent
|
|
82
|
-
css={{
|
|
83
|
-
display: 'grid',
|
|
84
|
-
gap: '$1',
|
|
85
|
-
gridAutoFlow: 'column',
|
|
86
|
-
width: 500,
|
|
87
|
-
gridTemplateRows: 'repeat(2, 1fr)'
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
{['colours', 'icons', 'effects', 'typography'].map((item) => (
|
|
91
|
-
<NavigationMenu.DropdownItem href={`/theme/${item}`}>
|
|
92
|
-
<NavigationMenu.DropdownItemTitle>
|
|
93
|
-
{item}
|
|
94
|
-
</NavigationMenu.DropdownItemTitle>
|
|
95
|
-
<Text>This is some example text about {item}</Text>
|
|
96
|
-
</NavigationMenu.DropdownItem>
|
|
97
|
-
))}
|
|
98
|
-
</NavigationMenu.DropdownContent>
|
|
99
|
-
</NavigationMenu.Dropdown>
|
|
100
|
-
</NavigationMenu>
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
## DropdownItem composition example
|
|
104
|
-
|
|
105
|
-
DropdownItem gives a lot of flexibility. It's an easy to compose it for own purposes.
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
<NavigationMenu.DropdownItem href="/" active>
|
|
109
|
-
<Grid
|
|
110
|
-
css={{
|
|
111
|
-
gridTemplateColumns: '1fr 7fr'
|
|
112
|
-
}}
|
|
113
|
-
>
|
|
114
|
-
<Icon is={Feed} size={'md'} />
|
|
115
|
-
<Flex css={{ flexDirection: 'column' }}>
|
|
116
|
-
<NavigationMenu.DropdownItemTitle bold css={{ mb: '$3' }}>
|
|
117
|
-
Example title
|
|
118
|
-
</NavigationMenu.DropdownItemTitle>
|
|
119
|
-
<Text>This is example subtitle</Text>
|
|
120
|
-
</Flex>
|
|
121
|
-
</Grid>
|
|
122
|
-
</NavigationMenu.DropdownItem>
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Dropdown Trigger
|
|
126
|
-
|
|
127
|
-
NavigationMenu.Dropdown gives you the way to pass your own trigger component inside the `NavigationMenu.DropdownTrigger`.
|
|
128
|
-
The children of NavigationMenu.DropdownTrigger can be a plain text or more complex component.
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
<NavigationMenu.Dropdown id="1">
|
|
132
|
-
<NavigationMenu.DropdownTrigger>
|
|
133
|
-
<Avatar />
|
|
134
|
-
</NavigationMenu.DropdownTrigger>
|
|
135
|
-
<NavigationMenu.DropdownContent>// content</NavigationMenu.DropdownContent>
|
|
136
|
-
</NavigationMenu.Dropdown>
|
|
137
|
-
|
|
138
|
-
<NavigationMenu.Dropdown id="2">
|
|
139
|
-
<NavigationMenu.DropdownTrigger>
|
|
140
|
-
Plain text
|
|
141
|
-
</NavigationMenu.DropdownTrigger>
|
|
142
|
-
<NavigationMenu.DropdownContent>// content</NavigationMenu.DropdownContent>
|
|
143
|
-
</NavigationMenu.Dropdown>
|
|
144
|
-
```
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Notification Badge
|
|
3
|
-
component: NotificationBadge
|
|
4
|
-
description: A badge that wraps content and displays a notification
|
|
5
|
-
category: Feedback
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
The NotificationBadge component is a lightweight wrapper for content such as ActionIcons, but can be wrapped around any block-level element.
|
|
9
|
-
|
|
10
|
-
It displays a badge in top right of the content it is wrapping, which displays a `value` passed in as a prop. This could be, for example, the number of filters selected on a select filters badge.
|
|
11
|
-
|
|
12
|
-
```tsx preview
|
|
13
|
-
<NotificationBadge value={3}>
|
|
14
|
-
<ActionIcon appearance="outline" size="lg" isRounded>
|
|
15
|
-
<Icon is={Controls} />
|
|
16
|
-
</ActionIcon>
|
|
17
|
-
</NotificationBadge>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Value
|
|
21
|
-
|
|
22
|
-
Whilst you would normally want to display a number, the `value` prop also supports strings. Here are some usage examples:
|
|
23
|
-
|
|
24
|
-
```tsx preview
|
|
25
|
-
<>
|
|
26
|
-
<NotificationBadge value={88}>
|
|
27
|
-
<ActionIcon appearance="outline" size="lg">
|
|
28
|
-
<Icon is={Controls} />
|
|
29
|
-
</ActionIcon>
|
|
30
|
-
</NotificationBadge>
|
|
31
|
-
<NotificationBadge value="hi">
|
|
32
|
-
<Button theme="warning">I'm a button!</Button>
|
|
33
|
-
</NotificationBadge>
|
|
34
|
-
</>
|
|
35
|
-
```
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Number Input
|
|
3
|
-
component: NumberInput
|
|
4
|
-
description: The NumberInput component is similar to the Input component, but it has controls for incrementing or decrementing numeric values.
|
|
5
|
-
category: Form primitives
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`NumberInput` wraps `Input` set to a numeric value, along with two `ActionIcon` buttons for decrementing and incrementing the value.
|
|
9
|
-
|
|
10
|
-
```tsx preview
|
|
11
|
-
<NumberInput name="age" />
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
When min or max values are set, the corresponding decrement or increment button will become disabled when the min/max values are reached. By default, min is set to 0.
|
|
15
|
-
|
|
16
|
-
A tooltip will display on hover of a disabled button, providing information on why the button is disabled. To override the default tooltip content, pass in a `disabledTooltipContent` object.
|
|
17
|
-
|
|
18
|
-
Note: A `<ToolTipProvider />` must be rendered at the root of the app for this to work.
|
|
19
|
-
|
|
20
|
-
```tsx preview
|
|
21
|
-
<NumberInput
|
|
22
|
-
name="age"
|
|
23
|
-
max={11}
|
|
24
|
-
disabledTooltipContent={{ increment: 'Ages over 11 are not allowed' }}
|
|
25
|
-
/>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Keyboard interactions
|
|
29
|
-
|
|
30
|
-
A negative `tabindex` has been added to the increment and decrement buttons to remove them from the default tabbing order. Instead, users can use the below keys to interact with the component.
|
|
31
|
-
|
|
32
|
-
- When you hit the ⬆️ or ➡️ key, the input value will be increased by step.
|
|
33
|
-
- When you hit the ⬅️ or ⬇️ key, the input value will be decreased by step.
|
|
34
|
-
- When you hit the Home button, the value will jump to the min value.
|
|
35
|
-
- When you hit the End button, the value will jump to the max value.
|
|
36
|
-
|
|
37
|
-
See [MDN docs](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/spinbutton_role#keyboard_interactions) for more information on accessibility.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Number Input Field
|
|
3
|
-
component: NumberInputField
|
|
4
|
-
description: NumberInputField renders a field composed of an NumberInput, a Label and a InlineMessage
|
|
5
|
-
category: Form fields
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`NumberInputField` is the preferred way to render a form field for a number input.
|
|
9
|
-
|
|
10
|
-
In addition to text `Label` (required) and a validation error (optional), `NumberInputField` accepts all the same props as `NumberInput` and will pass them on to the `NumberInput` it renders.
|
|
11
|
-
|
|
12
|
-
```tsx preview
|
|
13
|
-
<Form>
|
|
14
|
-
<NumberInputField
|
|
15
|
-
label="Number of cats"
|
|
16
|
-
name="cats"
|
|
17
|
-
min={3}
|
|
18
|
-
validation={{
|
|
19
|
-
min: {
|
|
20
|
-
value: 3,
|
|
21
|
-
message: 'You must have at least 3 cats!'
|
|
22
|
-
}
|
|
23
|
-
}}
|
|
24
|
-
/>
|
|
25
|
-
</Form>
|
|
26
|
-
```
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Password Field
|
|
3
|
-
component: PasswordField
|
|
4
|
-
description: PasswordField is a specialised field for password input
|
|
5
|
-
category: Form fields
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`PasswordField` is the preferred way to render a form field for a current password (not necessarily for creating a new password).
|
|
9
|
-
|
|
10
|
-
`PasswordField` accepts the same props as `InputField` but provides default values for some of them (e.g. `label` defaults to `"Password"` and `name` defaults to `password`).
|
|
11
|
-
|
|
12
|
-
In addition to the regular `InputField` props and functionality, `PasswordField` accepts an optional `forgotPasswordURL` prop which will be used to render a link to a password reset page. It also provides the ability for the user to toggle visibility of their password.
|
|
13
|
-
|
|
14
|
-
```tsx preview
|
|
15
|
-
<Form>
|
|
16
|
-
<PasswordField
|
|
17
|
-
name="password"
|
|
18
|
-
prompt={{ link: '/forgot-password', label: 'Forgotten your password?' }}
|
|
19
|
-
placeholder="Your password"
|
|
20
|
-
css={{ width: 320 }}
|
|
21
|
-
/>
|
|
22
|
-
</Form>
|
|
23
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Password Input
|
|
3
|
-
component: PasswordInput
|
|
4
|
-
description: An input for passwords with visibility toggle functionality
|
|
5
|
-
category: Form primitives
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`PasswordInput` wraps `Input` with a content visibility toggle, triggered by interaction with an eye Icon.
|
|
9
|
-
|
|
10
|
-
For most use cases it is better to use `PasswordField`, which includes a label, hooks into our `Form` component and shows validation errors where appropriate.
|
|
11
|
-
Only use `PasswordInput` if you need to compose something that behaves differently to the `PasswordField` and be sure to include a label manually.
|
|
12
|
-
|
|
13
|
-
```jsx preview
|
|
14
|
-
<PasswordInput name="password" />
|
|
15
|
-
```
|
package/dist/docs/Popover.mdx
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Popover
|
|
3
|
-
component: Popover,Popover.Trigger,Popover.Content,Popover.Portal
|
|
4
|
-
description: Popover provides a styled actionable popup
|
|
5
|
-
category: Surfaces
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`Popover` exports 3 components that combine to create our popover. The `Popover.Trigger` renders a `<button>` by default, but this can be overridden with the `asChild` prop, which will instead add all the functional and accessibility requirements to the child component instead (see the below example).
|
|
9
|
-
|
|
10
|
-
Also, note that the component must accept a `ref`.
|
|
11
|
-
|
|
12
|
-
Read more about the underlying UI component on the [Radix UI documentation site](https://radix-ui.com/primitives/docs/components/popover).
|
|
13
|
-
|
|
14
|
-
```tsx preview
|
|
15
|
-
<Popover>
|
|
16
|
-
<Popover.Trigger asChild>
|
|
17
|
-
<Button>Click me</Button>
|
|
18
|
-
</Popover.Trigger>
|
|
19
|
-
<Popover.Content>
|
|
20
|
-
<Heading size="xs" css={{ mb: '$3' }}>
|
|
21
|
-
Popover
|
|
22
|
-
</Heading>
|
|
23
|
-
<Text size="sm">
|
|
24
|
-
The `Popover` can display any type of element as a trigger and has the
|
|
25
|
-
content hidden by default
|
|
26
|
-
</Text>
|
|
27
|
-
</Popover.Content>
|
|
28
|
-
</Popover>
|
|
29
|
-
```
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Progress Bar
|
|
3
|
-
component: ProgressBar
|
|
4
|
-
description: ProgressBar provides a styled progress bar
|
|
5
|
-
category: Feedback
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Accessibility
|
|
9
|
-
|
|
10
|
-
A `ProgressBar` needs to be associated with a label for accessibility purposes, therefore the component `id` needs to be set. If a label is not available, please add an `aria-label` to ensure that the component remains accessible.
|
|
11
|
-
For more examples, please read [aria-progressbar-name](https://dequeuniversity.com/rules/axe/4.1/aria-progressbar-name?application=axeAPI)
|
|
12
|
-
|
|
13
|
-
```tsx live
|
|
14
|
-
<ProgressBar value={20} aria-label="Completion rate" />
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Themes
|
|
18
|
-
|
|
19
|
-
These are the available `themes` for this component: `Primary` (default), `Success`, `Warning`, `Danger`
|
|
20
|
-
|
|
21
|
-
```tsx preview
|
|
22
|
-
<>
|
|
23
|
-
<ProgressBar value={20} />
|
|
24
|
-
<ProgressBar theme="success" value={20} aria-label="Completion rate" />
|
|
25
|
-
<ProgressBar theme="warning" value={20} aria-label="Completion rate" />
|
|
26
|
-
<ProgressBar theme="danger" value={20} aria-label="Completion rate" />
|
|
27
|
-
</>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Appearance
|
|
31
|
-
|
|
32
|
-
There two options for the `appearance` property: `solid` and `outline(default)`. These are the available `outline` variations for all the `themes`.
|
|
33
|
-
|
|
34
|
-
```tsx preview
|
|
35
|
-
<>
|
|
36
|
-
<ProgressBar appearance="solid" value={20} aria-label="Completion rate" />
|
|
37
|
-
<ProgressBar
|
|
38
|
-
appearance="solid"
|
|
39
|
-
theme="success"
|
|
40
|
-
value={20}
|
|
41
|
-
aria-label="Completion rate"
|
|
42
|
-
/>
|
|
43
|
-
<ProgressBar
|
|
44
|
-
appearance="solid"
|
|
45
|
-
theme="warning"
|
|
46
|
-
value={20}
|
|
47
|
-
aria-label="Completion rate"
|
|
48
|
-
/>
|
|
49
|
-
<ProgressBar
|
|
50
|
-
appearance="solid"
|
|
51
|
-
theme="danger"
|
|
52
|
-
value={20}
|
|
53
|
-
aria-label="Completion rate"
|
|
54
|
-
/>
|
|
55
|
-
</>
|
|
56
|
-
```
|
package/dist/docs/README.mdx
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
## Color Schemes (v.ALPHA)
|
|
2
|
-
|
|
3
|
-
`color-scheme/`, is an **internal** component in an alpha stage (usable but not finalised) which introduces a `ColorScheme` component. It has been worked on heavily in terms of considering the required options and logic from dev but is **not finished and needs more design input**.
|
|
4
|
-
|
|
5
|
-
The problem that this component was introduced to solve is the difficult way we have approached theming so far in our components.
|
|
6
|
-
In the past we have heavily relied on props drilling and passing down theme related stitches variants to children, which means _(1)_ the colours can easily break when the expected children are nested further than directly under the 'theme providing' parent (The component which has a `theme` prop and tries to prop-drill theme). Moreover, _(2)_ we have inconsistent naming for our themes and _(3)_ inconsistent implementations on active components since _(4)_ the theming need to be documented and coded separately for each new component.
|
|
7
|
-
|
|
8
|
-
This `<ColorScheme />` component allows for `base` (`var(--baseX)`) and `accent` (`var(--accentX)`) theme property, as well as an `interactive` contrast mode to affect all interactable components.
|
|
9
|
-
|
|
10
|
-
The props are:
|
|
11
|
-
|
|
12
|
-
- `base` is used for the base colours of the wrapped component: different tones of background and text. It currently only supports the `slate` (grey) colour but can be extended for different base colors.
|
|
13
|
-
- `accent` is used for highlighted elements and interactive elements of the color scheme. It can be used directly but should be used with an interactive theme for interactive elements - see `<Button />`, `Accordion.Trigger` etc. Currently allowed accents are `slate` and `blue`.
|
|
14
|
-
- `interactive` supports 4 versions `loContrast1` and `loContrast2` which on light color schemes are lighter and on a dark mode they would be darker (so low contrast in comparison to the background), and `hiContrast1`, `hiContrast2` which are used for the opposite.
|
|
15
|
-
|
|
16
|
-
All the color scheme configurations setup used in the component can be found in `color-scheme/src/stitches.colorscheme.config.ts`
|
|
17
|
-
|
|
18
|
-
The ColorScheme itself works by re-declaring the needed CSS variables any time it's used. It is heavily inpired by both [stitches theming guidelines](https://stitches.dev/docs/theming) and particularly by [the radix colors project](https://www.radix-ui.com/colors) of which it's almost a copy of but with our own colours defined and some aliasing to match the current design use requirements.
|
|
19
|
-
|
|
20
|
-
Currently in use by a couple of components in library and the full documentation site. This component is subject to change when the Atom Learning colour theming patterns are properly established and we can make final decisions on the colours and API. **There will be changes to this code in the future.**
|
|
21
|
-
|
|
22
|
-
### Examples
|
|
23
|
-
|
|
24
|
-
```jsx
|
|
25
|
-
<ColorScheme base="slate" accent="blue" interactive="hiContrast1">
|
|
26
|
-
<Box css={{ background: '$background', color: '$foreground' }}>
|
|
27
|
-
Off-black text over a white background
|
|
28
|
-
</Box>
|
|
29
|
-
<Box css={{ background: '$base1', color: '$foreground' }}>
|
|
30
|
-
Off-black text over very slightly grey background
|
|
31
|
-
</Box>
|
|
32
|
-
<Box css={{ background: '$base7', color: '$foreground6plus' }}>
|
|
33
|
-
White text over darker grey background
|
|
34
|
-
</Box>
|
|
35
|
-
<Box css={{ background: '$accent1', color: '$foreground' }}>
|
|
36
|
-
Off-black text over a slightly blue background
|
|
37
|
-
</Box>
|
|
38
|
-
<Box css={{ background: '$accent7', color: '$foreground6plus' }}>
|
|
39
|
-
White text over darker blue background
|
|
40
|
-
</Box>
|
|
41
|
-
<Box css={{ background: '$accent9', color: '$foreground6plus' }}>
|
|
42
|
-
White text over much darker blue background
|
|
43
|
-
</Box>
|
|
44
|
-
<Button
|
|
45
|
-
css={{
|
|
46
|
-
background: '$interactive1',
|
|
47
|
-
color: '$interactiveForeground',
|
|
48
|
-
['&:hover']: { background: '$interactive2' },
|
|
49
|
-
['&:active']: { background: '$interactive3' }
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
Blue button with white text
|
|
53
|
-
</Button>
|
|
54
|
-
<ColorScheme
|
|
55
|
-
interactive="hiContrast2"
|
|
56
|
-
as={Button}
|
|
57
|
-
css={{
|
|
58
|
-
background: '$interactive1',
|
|
59
|
-
color: '$interactiveForeground',
|
|
60
|
-
['&:hover']: { background: '$interactive2' },
|
|
61
|
-
['&:active']: { background: '$interactive3' }
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
64
|
-
Darker blue button with white text
|
|
65
|
-
</ColorScheme>
|
|
66
|
-
<ColorScheme
|
|
67
|
-
interactive="loContrast2"
|
|
68
|
-
as={Button}
|
|
69
|
-
css={{
|
|
70
|
-
background: '$interactive1',
|
|
71
|
-
color: '$interactiveForeground',
|
|
72
|
-
['&:hover']: { background: '$interactive2' },
|
|
73
|
-
['&:active']: { background: '$interactive3' }
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
Light blue button with off-black text
|
|
77
|
-
</ColorScheme>
|
|
78
|
-
</ColorScheme>
|
|
79
|
-
```
|