@atom-learning/components 2.2.0 → 2.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/CHANGELOG.md +7 -0
- package/dist/components/accordion/AccordionContent.js +1 -1
- package/dist/components/accordion/AccordionItem.js +1 -1
- package/dist/components/alert-dialog/AlertDialogContent.js +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/calendar/Calendar.js +1 -1
- package/dist/components/carousel/CarouselArrows.js +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/chip/Chip.d.ts +1898 -0
- package/dist/components/chip/Chip.js +1 -0
- package/dist/components/chip/ChipGroup.d.ts +7 -0
- package/dist/components/chip/ChipGroup.js +1 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupItem.d.ts +553 -0
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupItem.js +1 -0
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupRoot.d.ts +6 -0
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupRoot.js +1 -0
- package/dist/components/chip-dismissible-group/index.d.ts +7 -0
- package/dist/components/chip-dismissible-group/index.js +1 -0
- package/dist/components/chip-toggle-group/ChipToggleGroupItem.d.ts +551 -0
- package/dist/components/chip-toggle-group/ChipToggleGroupItem.js +1 -0
- package/dist/components/chip-toggle-group/ChipToggleGroupRoot.d.ts +563 -0
- package/dist/components/chip-toggle-group/ChipToggleGroupRoot.js +1 -0
- package/dist/components/chip-toggle-group/index.d.ts +7 -0
- package/dist/components/chip-toggle-group/index.js +1 -0
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/dialog/DialogContent.js +1 -1
- package/dist/components/dismissible/DismissibleRoot.d.ts +17 -0
- package/dist/components/dismissible/DismissibleRoot.js +1 -0
- package/dist/components/dismissible/DismissibleTrigger.d.ts +5 -0
- package/dist/components/dismissible/DismissibleTrigger.js +1 -0
- package/dist/components/dismissible/index.d.ts +7 -0
- package/dist/components/dismissible/index.js +1 -0
- package/dist/components/dismissible-group/DismissibleGroupItem.d.ts +6 -0
- package/dist/components/dismissible-group/DismissibleGroupItem.js +1 -0
- package/dist/components/dismissible-group/DismissibleGroupRoot.d.ts +15 -0
- package/dist/components/dismissible-group/DismissibleGroupRoot.js +1 -0
- package/dist/components/dismissible-group/index.d.ts +9 -0
- package/dist/components/dismissible-group/index.js +1 -0
- package/dist/components/divider/Divider.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/FieldWrapper.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/index.d.ts +6 -0
- 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/markdown-content/MarkdownContent.js +1 -1
- package/dist/components/markdown-content/components/MarkdownCode.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/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/NavigationMenu.js +1 -1
- package/dist/components/navigation/NavigationMenuDropdown.js +1 -1
- package/dist/components/notification-badge/NotificationBadge.js +1 -1
- package/dist/components/radio-button-field/RadioButtonField.js +1 -1
- package/dist/components/radio-card/RadioCardGroup.js +1 -1
- package/dist/components/search-input/SearchInput.js +1 -1
- package/dist/components/slider-field/SliderField.js +1 -1
- package/dist/components/stack/Stack.d.ts +2 -1
- package/dist/components/stack/Stack.js +1 -1
- package/dist/components/stack-content/StackContent.js +1 -1
- package/dist/components/stepper/StepperStepForward.js +1 -1
- package/dist/components/stepper/StepperSteps.js +1 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/table/TableBody.js +1 -1
- package/dist/components/table/TableHeader.js +1 -1
- package/dist/components/tabs/TabTrigger.js +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/tabs/utils.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/top-bar/TopBar.d.ts +17 -0
- package/dist/components/top-bar/TopBar.js +1 -0
- package/dist/components/top-bar/TopBarActionIcon.d.ts +8 -0
- package/dist/components/top-bar/TopBarActionIcon.js +1 -0
- package/dist/components/top-bar/TopBarBrand.d.ts +814 -0
- package/dist/components/top-bar/TopBarBrand.js +1 -0
- package/dist/components/top-bar/index.d.ts +1 -0
- package/dist/constants/zIndices.d.ts +3 -0
- package/dist/constants/zIndices.js +1 -0
- package/dist/docgen.json +1 -1
- package/dist/docs/Chip.mdx +118 -0
- package/dist/docs/ChipDismissibleGroup.mdx +33 -0
- package/dist/docs/ChipToggleGroup.mdx +27 -0
- package/dist/docs/Dismissible.mdx +48 -0
- package/dist/docs/DismissibleGroup.mdx +29 -0
- package/dist/docs/TopBar.mdx +59 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.js +1 -1
- package/dist/utilities/hooks/useCallbackRef.js +1 -1
- package/dist/utilities/hooks/useScrollPosition.d.ts +4 -0
- package/dist/utilities/hooks/useScrollPosition.js +1 -0
- package/dist/utilities/override-stitches-variant-value/overrideStitchesVariantValue.d.ts +1 -0
- package/dist/utilities/override-stitches-variant-value/overrideStitchesVariantValue.js +1 -0
- package/package.json +2 -1
- package/dist/constants/dialog.d.ts +0 -1
- package/dist/constants/dialog.js +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Chip
|
|
3
|
+
component: Chip, ChipGroup
|
|
4
|
+
description: A component in the shape of a pill providing visual cues to prompt users to enter information or filter content.
|
|
5
|
+
category: Feedback
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`Chip` itself is a primitive. It has no functional logic in itself, however, it is used to provide common styles for all the `Chip`-based components.
|
|
9
|
+
|
|
10
|
+
```tsx preview
|
|
11
|
+
<Chip>
|
|
12
|
+
<Chip.Content>Not the tasty kind</Chip.Content>
|
|
13
|
+
</Chip>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Gap
|
|
17
|
+
|
|
18
|
+
`gap={ 1 | 2 | 3}`
|
|
19
|
+
|
|
20
|
+
We provide three options for gap space between chips. `1` will be typically used within Input fields (multiselect) or when space is limited. `2` is the default option that provides a comfortable distance for the set.
|
|
21
|
+
|
|
22
|
+
```tsx preview
|
|
23
|
+
<ChipGroup gap={1}>
|
|
24
|
+
<Chip>
|
|
25
|
+
<Chip.Content>A</Chip.Content>
|
|
26
|
+
</Chip>
|
|
27
|
+
<Chip>
|
|
28
|
+
<Chip.Content>B</Chip.Content>
|
|
29
|
+
</Chip>
|
|
30
|
+
<Chip>
|
|
31
|
+
<Chip.Content>C</Chip.Content>
|
|
32
|
+
</Chip>
|
|
33
|
+
</ChipGroup>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Size
|
|
37
|
+
|
|
38
|
+
`size="sm | md | lg"`
|
|
39
|
+
|
|
40
|
+
```tsx preview
|
|
41
|
+
<ChipGroup align="center">
|
|
42
|
+
<Chip size="sm">
|
|
43
|
+
<Chip.Content>
|
|
44
|
+
<Icon is={Upload} />A
|
|
45
|
+
</Chip.Content>
|
|
46
|
+
</Chip>
|
|
47
|
+
<Chip size="md">
|
|
48
|
+
<Chip.Content>
|
|
49
|
+
<Icon is={Upload} />B
|
|
50
|
+
</Chip.Content>
|
|
51
|
+
</Chip>
|
|
52
|
+
<Chip size="lg">
|
|
53
|
+
<Chip.Content>
|
|
54
|
+
<Icon is={Upload} />C
|
|
55
|
+
</Chip.Content>
|
|
56
|
+
</Chip>
|
|
57
|
+
<Chip
|
|
58
|
+
size={{
|
|
59
|
+
'@initial': 'lg',
|
|
60
|
+
'@md': 'md',
|
|
61
|
+
'@lg': 'sm'
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Chip.Content>
|
|
65
|
+
<Icon is={Upload} />C
|
|
66
|
+
</Chip.Content>
|
|
67
|
+
</Chip>
|
|
68
|
+
</ChipGroup>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Icon
|
|
72
|
+
|
|
73
|
+
When an `<Icon />` is used as an immediate child of `<Chip.Content />` we automatically transform it to
|
|
74
|
+
a `<Chip.Icon />` which applies the correct styles and sizing to it.
|
|
75
|
+
|
|
76
|
+
```tsx preview
|
|
77
|
+
<ChipGroup>
|
|
78
|
+
<Chip>
|
|
79
|
+
<Chip.Content>
|
|
80
|
+
<Icon is={Upload} /> Icon
|
|
81
|
+
</Chip.Content>
|
|
82
|
+
</Chip>
|
|
83
|
+
<Chip>
|
|
84
|
+
<Chip.Content>
|
|
85
|
+
<Chip.Icon is={Upload} /> Chip.Icon
|
|
86
|
+
</Chip.Content>
|
|
87
|
+
</Chip>
|
|
88
|
+
</ChipGroup>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If additional nesting is needed; you can use the `<Chip.Icon />` component directly.
|
|
92
|
+
|
|
93
|
+
```tsx preview
|
|
94
|
+
<ChipGroup>
|
|
95
|
+
<Chip>
|
|
96
|
+
<Chip.Content>
|
|
97
|
+
<div>
|
|
98
|
+
<Icon is={Upload} /> Icon (wrong sizing)
|
|
99
|
+
</div>
|
|
100
|
+
</Chip.Content>
|
|
101
|
+
</Chip>
|
|
102
|
+
<Chip>
|
|
103
|
+
<Chip.Content>
|
|
104
|
+
<div>
|
|
105
|
+
<Chip.Icon is={Upload} /> Chip.Icon
|
|
106
|
+
</div>
|
|
107
|
+
</Chip.Content>
|
|
108
|
+
</Chip>
|
|
109
|
+
</ChipGroup>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Disabled
|
|
113
|
+
|
|
114
|
+
```tsx preview
|
|
115
|
+
<Chip data-disabled>
|
|
116
|
+
<Chip.Content>Not the tasty kind</Chip.Content>
|
|
117
|
+
</Chip>
|
|
118
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Chip Dismissible Group
|
|
3
|
+
component: ChipDismissibleGroup
|
|
4
|
+
description: Combines the DismissibleGroup logic together with the Chip primitive styling
|
|
5
|
+
category: Feedback
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Used to visualise groups of dismissible information, in fields such as an entity or different attributes. Can also be used to represent removable filtering criteria.
|
|
9
|
+
|
|
10
|
+
```tsx preview
|
|
11
|
+
<ChipDismissibleGroup
|
|
12
|
+
onDismiss={(value) => {
|
|
13
|
+
alert(`dismiss ${value}`)
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<ChipDismissibleGroup.Item value="a" dismissActionLabel="Dismiss 'A'">
|
|
17
|
+
<Icon is={Person} />
|
|
18
|
+
Dismissible
|
|
19
|
+
</ChipDismissibleGroup.Item>
|
|
20
|
+
<ChipDismissibleGroup.Item value="b" dismissActionLabel="Dismiss 'B'">
|
|
21
|
+
<Icon is={Person} />
|
|
22
|
+
Dismissible
|
|
23
|
+
</ChipDismissibleGroup.Item>
|
|
24
|
+
<ChipDismissibleGroup.Item
|
|
25
|
+
value="c"
|
|
26
|
+
dismissActionLabel="Dismiss 'C'"
|
|
27
|
+
disabled
|
|
28
|
+
>
|
|
29
|
+
<Icon is={Person} />
|
|
30
|
+
Dismissible
|
|
31
|
+
</ChipDismissibleGroup.Item>
|
|
32
|
+
</ChipDismissibleGroup>
|
|
33
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Chip Toggle Group
|
|
3
|
+
component: ChipToggleGroup
|
|
4
|
+
description: Combines the Toggle Group radix component with the Chip primitive styling
|
|
5
|
+
category: Feedback
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Used as a method for filtering a collection of data. Acts like multiple or single selection. Each chip toggles between selected and unselected. When selected, a checkmark appears as the leading icon.
|
|
9
|
+
|
|
10
|
+
```tsx preview
|
|
11
|
+
<ChipToggleGroup
|
|
12
|
+
type="multiple"
|
|
13
|
+
defaultValue={['a', 'b']}
|
|
14
|
+
onValueChange={(value) => {
|
|
15
|
+
console.log(value)
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<ChipToggleGroup.Item value="a">A</ChipToggleGroup.Item>
|
|
19
|
+
<ChipToggleGroup.Item value="b" disabled>
|
|
20
|
+
B
|
|
21
|
+
</ChipToggleGroup.Item>
|
|
22
|
+
<ChipToggleGroup.Item value="c">C</ChipToggleGroup.Item>
|
|
23
|
+
<ChipToggleGroup.Item value="d" disabled>
|
|
24
|
+
D
|
|
25
|
+
</ChipToggleGroup.Item>
|
|
26
|
+
</ChipToggleGroup>
|
|
27
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dismissible
|
|
3
|
+
component: Dismissible
|
|
4
|
+
description: An element with a dismiss button which removes it from the view
|
|
5
|
+
category: Primitives
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`Dismissible` itself is a primitive. It has not been designed so it should not be used out-of-the-box as a user facing component.
|
|
9
|
+
Test the component is accessible depending on each implementation use case.
|
|
10
|
+
|
|
11
|
+
```tsx preview
|
|
12
|
+
<Dismissible
|
|
13
|
+
value="a"
|
|
14
|
+
onDismiss={(value) => {
|
|
15
|
+
alert(`dismiss ${value}`)
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
Press the trigger to dismiss this ->
|
|
19
|
+
<Dismissible.Trigger aria-label="Dismiss 'a'" />
|
|
20
|
+
</Dismissible>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```tsx preview
|
|
24
|
+
<Dismissible
|
|
25
|
+
value="custom"
|
|
26
|
+
onDismiss={(value) => {
|
|
27
|
+
alert(`dismiss ${value}`)
|
|
28
|
+
}}
|
|
29
|
+
asChild
|
|
30
|
+
>
|
|
31
|
+
<Box
|
|
32
|
+
css={{
|
|
33
|
+
width: '100%',
|
|
34
|
+
fontFamily: 'system-ui',
|
|
35
|
+
border: '1px solid',
|
|
36
|
+
borderRadius: 4,
|
|
37
|
+
display: 'flex',
|
|
38
|
+
justifyContent: 'space-between',
|
|
39
|
+
padding: 8
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
Basic custom implementation example
|
|
43
|
+
<Dismissible.Trigger asChild>
|
|
44
|
+
<button type="button">Custom Dismiss Trigger</button>
|
|
45
|
+
</Dismissible.Trigger>
|
|
46
|
+
</Box>
|
|
47
|
+
</Dismissible>
|
|
48
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dismissible Group
|
|
3
|
+
component: DismissibleGroup
|
|
4
|
+
description: A set of dismissible elements.
|
|
5
|
+
category: Primitives
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`DismissibleGroup` itself is a primitive. It has not been designed so it should not be used out-of-the-box as a user facing component.
|
|
9
|
+
Test the component is accessible depending on each implementation use case.
|
|
10
|
+
|
|
11
|
+
```tsx preview
|
|
12
|
+
<DismissibleGroup
|
|
13
|
+
onDismiss={(value) => {
|
|
14
|
+
alert(`dismiss ${value}`)
|
|
15
|
+
}}
|
|
16
|
+
>
|
|
17
|
+
<DismissibleGroup.Item value="a">
|
|
18
|
+
A
|
|
19
|
+
<DismissibleGroup.Trigger aria-label="Dismiss A" />
|
|
20
|
+
</DismissibleGroup.Item>
|
|
21
|
+
<DismissibleGroup.Item value="b" disabled>
|
|
22
|
+
B
|
|
23
|
+
<DismissibleGroup.Trigger />
|
|
24
|
+
</DismissibleGroup.Item>
|
|
25
|
+
<DismissibleGroup.Item value="c" disabled>
|
|
26
|
+
C
|
|
27
|
+
</DismissibleGroup.Item>
|
|
28
|
+
</DismissibleGroup>
|
|
29
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: TopBar
|
|
3
|
+
component: TopBar,TopBar.Brand,TopBar.BrandLogo,TopBar.BrandText,TopBar.ActionIcon
|
|
4
|
+
description: The top bar provides content and actions related to the current screen. It is used for branding, screen titles, navigation, and actions.
|
|
5
|
+
category: Surfaces
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`TopBar` exports components that combine to form the elements that you would expect to commonly see in a TopBar. However, the `TopBar` is not limited to these components, as any components may sit within the `TopBar` to create a flexible and custom UI.
|
|
9
|
+
|
|
10
|
+
By default, `TopBar` uses a flex layout with flex items placed immediately after each other. To align flex items, an optional css prop with `justifyContent` can be passed.
|
|
11
|
+
|
|
12
|
+
Alternatively, if you want to avoid wrapping groups of items with a `div` purely for alignment purposes, you could use a spacer. In this example, the styling of the `Flex` component has been extended so that it stretches to fill the available space.
|
|
13
|
+
|
|
14
|
+
```tsx preview
|
|
15
|
+
<TopBar>
|
|
16
|
+
<TopBar.Brand href="atomlearning.co.uk">
|
|
17
|
+
<TopBar.BrandName>Admin Panel</TopBar.BrandName>
|
|
18
|
+
</TopBar.Brand>
|
|
19
|
+
<Flex css={{ flex: 1, justifySelf: 'stretch', alignSelf: 'stretch' }} />
|
|
20
|
+
<Stack gap="2" direction="row">
|
|
21
|
+
<TopBar.ActionIcon icon={Search} label="Search" />
|
|
22
|
+
<TopBar.Divider />
|
|
23
|
+
<TopBar.ActionIcon icon={SwitchOff} label="Light/Dark mode" />
|
|
24
|
+
</Stack>
|
|
25
|
+
</TopBar>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## TopBar.Brand
|
|
29
|
+
|
|
30
|
+
`TopBar.Brand` renders a styled link.
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import logo from '@atom-learning/theme/lib/assets/logo.svg'
|
|
34
|
+
|
|
35
|
+
const App = () => {
|
|
36
|
+
return (
|
|
37
|
+
<TopBar>
|
|
38
|
+
<TopBar.Brand href="atomlearning.co.uk">
|
|
39
|
+
<TopBar.BrandLogo src={logo} />
|
|
40
|
+
<TopBar.BrandName>Admin Panel</TopBar.BrandName>
|
|
41
|
+
</TopBar.Brand>
|
|
42
|
+
</TopBar>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## TopBar.BrandLogo
|
|
48
|
+
|
|
49
|
+
`TopBar.BrandLogo` renders an image with set styles and is primarily intended for the Atom logo.
|
|
50
|
+
|
|
51
|
+
## TopBar.BrandName
|
|
52
|
+
|
|
53
|
+
`TopBar.BrandName` renders a `Text` component with set styles and is primarily intended to display the name of the current app.
|
|
54
|
+
|
|
55
|
+
## TopBar.ActionIcon
|
|
56
|
+
|
|
57
|
+
`TopBar.ActionIcon` extends the base `ActionIcon` component with set props.
|
|
58
|
+
|
|
59
|
+
Note that instead of needing to include a seperate `Icon` component as children, an icon can be passed directly to this component as a prop.
|