@atom-learning/components 2.17.0 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +25 -3
  2. package/dist/components/badge/Badge.js +1 -1
  3. package/dist/components/divider/Divider.js +1 -1
  4. package/dist/components/index.d.ts +1 -0
  5. package/dist/components/sidedrawer/Sidedrawer.d.ts +24 -0
  6. package/dist/components/sidedrawer/Sidedrawer.js +1 -0
  7. package/dist/components/sidedrawer/Sidedrawer.styles.d.ts +44 -0
  8. package/dist/components/sidedrawer/Sidedrawer.styles.js +1 -0
  9. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionContent.d.ts +2 -0
  10. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionContent.js +1 -0
  11. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionItem.d.ts +267 -0
  12. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionItem.js +1 -0
  13. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionRoot.d.ts +267 -0
  14. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionRoot.js +1 -0
  15. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionTrigger.d.ts +2 -0
  16. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionTrigger.js +1 -0
  17. package/dist/components/sidedrawer/SidedrawerAccordion/index.d.ts +4 -0
  18. package/dist/components/sidedrawer/SidedrawerBody.d.ts +2 -0
  19. package/dist/components/sidedrawer/SidedrawerBody.js +1 -0
  20. package/dist/components/sidedrawer/SidedrawerClose.d.ts +2 -0
  21. package/dist/components/sidedrawer/SidedrawerClose.js +1 -0
  22. package/dist/components/sidedrawer/SidedrawerContent.d.ts +2 -0
  23. package/dist/components/sidedrawer/SidedrawerContent.js +1 -0
  24. package/dist/components/sidedrawer/SidedrawerFooter.d.ts +266 -0
  25. package/dist/components/sidedrawer/SidedrawerFooter.js +1 -0
  26. package/dist/components/sidedrawer/SidedrawerHeader.d.ts +2 -0
  27. package/dist/components/sidedrawer/SidedrawerHeader.js +1 -0
  28. package/dist/components/sidedrawer/SidedrawerItem.d.ts +9 -0
  29. package/dist/components/sidedrawer/SidedrawerItem.js +1 -0
  30. package/dist/components/sidedrawer/SidedrawerOverlay.d.ts +267 -0
  31. package/dist/components/sidedrawer/SidedrawerOverlay.js +1 -0
  32. package/dist/components/sidedrawer/SidedrawerTrigger.d.ts +267 -0
  33. package/dist/components/sidedrawer/SidedrawerTrigger.js +1 -0
  34. package/dist/components/sidedrawer/index.d.ts +1 -0
  35. package/dist/components/stack-content/StackContent.js +1 -1
  36. package/dist/docgen.json +1 -1
  37. package/dist/docs/Badge.mdx +20 -3
  38. package/dist/docs/Sidedrawer.mdx +155 -0
  39. package/dist/index.cjs.js +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/utilities/style/keyframe-animations.d.ts +8 -0
  42. package/dist/utilities/style/keyframe-animations.js +1 -1
  43. package/package.json +1 -1
@@ -7,7 +7,7 @@ category: Feedback
7
7
 
8
8
  The `Badge` component can be used to highlight a short piece of information, like a status.
9
9
 
10
- ```jsx preview
10
+ ```tsx preview
11
11
  <Badge>New Data</Badge>
12
12
  ```
13
13
 
@@ -15,7 +15,7 @@ The `Badge` component can be used to highlight a short piece of information, lik
15
15
 
16
16
  These are the available `theme`s for this component: `success`, `warning`, `danger`, `neutral` and `info`. The default is `info`
17
17
 
18
- ```jsx preview
18
+ ```tsx preview
19
19
  <>
20
20
  <Badge>Info</Badge>
21
21
  <Badge theme="neutral">Neutral</Badge>
@@ -29,10 +29,27 @@ These are the available `theme`s for this component: `success`, `warning`, `dang
29
29
 
30
30
  These are the available `size`s for this component: `xs`, `sm` and `md`. The default is `sm`
31
31
 
32
- ```jsx preview
32
+ ```tsx preview
33
33
  <>
34
34
  <Badge size="xs">extra small</Badge>
35
35
  <Badge size="sm">small</Badge>
36
36
  <Badge size="md">medium</Badge>
37
37
  </>
38
38
  ```
39
+
40
+ ## With icons
41
+
42
+ An `<Icon />` can be passed as a child to show alongside text.
43
+
44
+ ```tsx preview
45
+ <>
46
+ <Badge>
47
+ <Icon is={Wifi} />
48
+ Info with icon
49
+ </Badge>
50
+ <Badge theme="neutral">
51
+ Info with icon
52
+ <Icon is={Wifi} />
53
+ </Badge>
54
+ </>
55
+ ```
@@ -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
+ ```