@atom-learning/components 2.28.3-beta.1 → 2.29.0-1
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/AccordionContent.js +1 -1
- package/dist/components/accordion/AccordionItem.js +1 -1
- package/dist/components/accordion/AccordionTrigger.d.ts +4 -5
- package/dist/components/accordion/AccordionTrigger.js +1 -1
- package/dist/components/tabs/{TabsTrigger.d.ts → TabTrigger.d.ts} +6 -3
- package/dist/components/tabs/TabTrigger.js +1 -0
- package/dist/components/tabs/Tabs.d.ts +276 -7
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/tabs/TabsTriggerList.d.ts +9 -5
- package/dist/components/tabs/TabsTriggerList.js +1 -1
- package/dist/components/tabs/utils.d.ts +2 -0
- package/dist/components/tabs/utils.js +1 -0
- package/dist/components/top-bar/TopBar.js +1 -1
- package/dist/docgen.json +1 -1
- package/dist/docs/Accordion.mdx +7 -56
- package/dist/docs/Tabs.mdx +57 -31
- package/dist/index.cjs.js +1 -1
- package/dist/utilities/hooks/useCallbackRef.js +1 -1
- package/dist/utilities/hooks/useScrollPosition.d.ts +3 -6
- package/dist/utilities/hooks/useScrollPosition.js +1 -1
- package/package.json +4 -4
- package/CHANGELOG.md +0 -200
- package/dist/components/tabs/TabsContent.d.ts +0 -267
- package/dist/components/tabs/TabsContent.js +0 -1
- package/dist/components/tabs/TabsTrigger.js +0 -1
- package/dist/docs/README.mdx +0 -79
- package/dist/experiments/color-scheme/ColorScheme.d.ts +0 -201
- package/dist/experiments/color-scheme/ColorScheme.js +0 -1
- package/dist/experiments/color-scheme/blue.json.js +0 -1
- package/dist/experiments/color-scheme/generateAlphaColors.d.ts +0 -1
- package/dist/experiments/color-scheme/generateAlphaColors.js +0 -1
- package/dist/experiments/color-scheme/index.d.ts +0 -1
- package/dist/experiments/color-scheme/slate.json.js +0 -1
- package/dist/experiments/color-scheme/stitches.colorscheme.config.d.ts +0 -452
- package/dist/experiments/color-scheme/stitches.colorscheme.config.js +0 -1
- package/dist/utilities/hooks/useWindowScrollPosition.d.ts +0 -6
- package/dist/utilities/hooks/useWindowScrollPosition.js +0 -1
- package/dist/utilities/hooks/useWindowSize.d.ts +0 -8
- package/dist/utilities/hooks/useWindowSize.js +0 -1
package/dist/docs/Accordion.mdx
CHANGED
|
@@ -5,29 +5,23 @@ description: A vertically stacked group of interactive headings that reveal an a
|
|
|
5
5
|
category: Layout
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Functionality based on the [`Accordion`](https://radix-ui.com/primitives/docs/components/accordion) radix component.
|
|
9
|
-
|
|
10
|
-
Implements experimental ColorScheme component to allow multiple colour setups.
|
|
11
|
-
|
|
12
8
|
The Accordion exports 4 components that combine to make the `Accordion`. The parent Accordion contains `Accordion.Item` components, which themselves must contain `Accordion.Trigger` and `Accordion.Content`.
|
|
13
9
|
|
|
14
10
|
The `Accordion.Trigger` has been simplified to include a chevron icon. Generally, you would only want to render text inside the rest.
|
|
15
11
|
|
|
16
12
|
Default styling has been applied to `Accordion.Trigger`, but `Accordion.Content` is an empty container without styling. Should only text be placed inside, it is highly advisable to apply spacing to align with the styling of the rest of the Accordion. This can be done with either the `css` property, or by placing any other components inside the `Accordion.Content`.
|
|
17
13
|
|
|
14
|
+
You can Read more about the underlying UI component on the [Radix UI documentation site](https://radix-ui.com/primitives/docs/components/accordion).
|
|
15
|
+
|
|
18
16
|
```tsx preview
|
|
19
17
|
<Accordion type="single" defaultValue="1">
|
|
20
18
|
<Accordion.Item value="1">
|
|
21
|
-
<Accordion.Trigger>Accordion Header 1</Accordion.Trigger>
|
|
22
|
-
<Accordion.Content css={{ p: '$
|
|
23
|
-
<Text>Accordion content 1</Text>
|
|
24
|
-
</Accordion.Content>
|
|
19
|
+
<Accordion.Trigger theme="light">Accordion Header 1</Accordion.Trigger>
|
|
20
|
+
<Accordion.Content css={{ p: '$4' }}>Accordion content 1</Accordion.Content>
|
|
25
21
|
</Accordion.Item>
|
|
26
22
|
<Accordion.Item value="2">
|
|
27
23
|
<Accordion.Trigger>Accordion Header 2</Accordion.Trigger>
|
|
28
|
-
<Accordion.Content css={{ p: '$
|
|
29
|
-
<Text>Accordion content 2</Text>
|
|
30
|
-
</Accordion.Content>
|
|
24
|
+
<Accordion.Content css={{ p: '$4' }}>Accordion content 2</Accordion.Content>
|
|
31
25
|
</Accordion.Item>
|
|
32
26
|
</Accordion>
|
|
33
27
|
```
|
|
@@ -46,49 +40,6 @@ Accordions can have `type` as either `single` or `multiple`. This changes how ma
|
|
|
46
40
|
|
|
47
41
|
Note: if `multiple`, `value` and `defaultValue` must be in an array. Even if you want just one item to be visible initially, you must pass something like `defaultValue={['name']}`
|
|
48
42
|
|
|
49
|
-
##
|
|
43
|
+
## Themes
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
The corresponding `Accordion.Content` component's content will be, in this case, permanently in its original state.
|
|
53
|
-
|
|
54
|
-
```tsx preview live
|
|
55
|
-
<Accordion type="single" defaultValue="1">
|
|
56
|
-
<Accordion.Item value="1" disabled>
|
|
57
|
-
<Accordion.Trigger>Accordion Header 1</Accordion.Trigger>
|
|
58
|
-
<Accordion.Content css={{ p: '$3' }}>
|
|
59
|
-
<Text>Accordion content 1</Text>
|
|
60
|
-
</Accordion.Content>
|
|
61
|
-
</Accordion.Item>
|
|
62
|
-
<Accordion.Item value="2">
|
|
63
|
-
<Accordion.Trigger>Accordion Header 2</Accordion.Trigger>
|
|
64
|
-
<Accordion.Content css={{ p: '$3' }}>
|
|
65
|
-
<Text>Accordion content 2</Text>
|
|
66
|
-
</Accordion.Content>
|
|
67
|
-
</Accordion.Item>
|
|
68
|
-
</Accordion>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Color Scheme
|
|
72
|
-
|
|
73
|
-
You can pass in a `colorScheme` object to the Accordion.Trigger to customise the colours of the component.
|
|
74
|
-
Defaults to `{ accent: "slate", interactive: "loContrast1"}`
|
|
75
|
-
ColorScheme is experimental and has been implemented only locally but you can read more about how it
|
|
76
|
-
currently works and available options [on the repository's github](https://github.com/Atom-Learning/components/tree/main/lib/src/experiments/color-scheme#readme).
|
|
77
|
-
|
|
78
|
-
```tsx preview live
|
|
79
|
-
<Accordion type="single" defaultValue="1">
|
|
80
|
-
<Accordion.Item value="1">
|
|
81
|
-
<Accordion.Trigger
|
|
82
|
-
colorScheme={{
|
|
83
|
-
accent: 'blue',
|
|
84
|
-
interactive: 'hiContrast2'
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
Accordion Header 1
|
|
88
|
-
</Accordion.Trigger>
|
|
89
|
-
<Accordion.Content css={{ p: '$3' }}>
|
|
90
|
-
<Text>Accordion content 1</Text>
|
|
91
|
-
</Accordion.Content>
|
|
92
|
-
</Accordion.Item>
|
|
93
|
-
</Accordion>
|
|
94
|
-
```
|
|
45
|
+
`Accordion.Trigger` can have a `theme` property. Possible values are `primaryDark` and `light`. The default is `primaryDark`.
|
package/dist/docs/Tabs.mdx
CHANGED
|
@@ -5,12 +5,10 @@ description: Tabs is a component that provides different sections of content tha
|
|
|
5
5
|
category: Layout
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Implements experimental ColorScheme component to allow multiple colour setups.
|
|
8
|
+
The component provides a set of default styles, which can be overwritten by using the `css` prop. It is composed by combining smaller components, such as `Tabs.TriggerList`, `Tabs.Trigger`, and `Tabs.Content`.
|
|
11
9
|
|
|
12
10
|
```tsx preview
|
|
13
|
-
<Tabs defaultValue="
|
|
11
|
+
<Tabs defaultValue="tab1" css={{ height: '100px' }}>
|
|
14
12
|
<Tabs.TriggerList>
|
|
15
13
|
<Tabs.Trigger value="tab1">
|
|
16
14
|
Nested component under the Tabs.Trigger component
|
|
@@ -29,48 +27,76 @@ Implements experimental ColorScheme component to allow multiple colour setups.
|
|
|
29
27
|
</Tabs>
|
|
30
28
|
```
|
|
31
29
|
|
|
32
|
-
|
|
30
|
+
It takes a `defaultValue` prop that should match one of the triggers' `value` prop.
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
<Tabs defaultValue="tab1">
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
It also takes a `theme` prop that should either be "light" or "dark".
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<Tabs theme="light"></Tabs>
|
|
40
|
+
<Tabs theme="dark"></Tabs>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Tabs.TriggerList
|
|
44
|
+
|
|
45
|
+
The `Tabs.TriggerList` component simply holds the individual `Tabs.Trigger` components. It can also get custom styling via the `css` prop.
|
|
46
|
+
`Tabs.TriggerList` will automatically show `<` & `>` buttons in case the content is overshooting the available space.
|
|
33
47
|
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
The default scroll amount for the scroll buttons on the `Tabs.TriggerList` is 10% of the content width. You can set this to any percentage by setting, for example, `scrollPercentage={25}`.
|
|
49
|
+
|
|
50
|
+
## Tabs.Trigger
|
|
51
|
+
|
|
52
|
+
The `Tabs.Trigger` component holds the content that will be displayed inside the button that the user would click in order to switch tabs. In can hold either a string, or some other component. It needs to be passed a `value` prop, that would be identical to the `value` prop passed to its corresponding `Tabs.Content` component.
|
|
53
|
+
|
|
54
|
+
## Tabs.Content
|
|
55
|
+
|
|
56
|
+
The `Tabs.Content` component, as the name suggests, holds the content for that particular section of the tabs component. It takes a `value` prop that needs to match the `value` prop passed to its corresponding trigger. Its content can be any text or valid component.
|
|
57
|
+
|
|
58
|
+
## Disabled tab
|
|
59
|
+
|
|
60
|
+
A `Tabs.Trigger` component can take a `disabled` prop, which would make it unselectable. The corresponding `Tabs.Content` component's content will be, in this case, permanently hidden.
|
|
36
61
|
|
|
37
62
|
```tsx preview
|
|
38
|
-
<Tabs
|
|
63
|
+
<Tabs>
|
|
39
64
|
<Tabs.TriggerList>
|
|
40
65
|
<Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
|
|
41
|
-
<Tabs.Trigger value="tab2"
|
|
66
|
+
<Tabs.Trigger disabled value="tab2">
|
|
42
67
|
Tab 2
|
|
43
68
|
</Tabs.Trigger>
|
|
44
69
|
</Tabs.TriggerList>
|
|
45
|
-
<Tabs.Content
|
|
46
|
-
|
|
47
|
-
</Tabs.Content>
|
|
48
|
-
<Tabs.Content css={{ p: '$3' }} value="tab2">
|
|
49
|
-
<Text>Content for tab2.</Text>
|
|
50
|
-
</Tabs.Content>
|
|
70
|
+
<Tabs.Content value="tab1">Content for tab 1</Tabs.Content>
|
|
71
|
+
<Tabs.Content value="tab2">Content for the second tab.</Tabs.Content>
|
|
51
72
|
</Tabs>
|
|
52
73
|
```
|
|
53
74
|
|
|
54
|
-
##
|
|
75
|
+
## Styling the `Tabs.TriggerList`
|
|
55
76
|
|
|
56
|
-
|
|
57
|
-
Defaults to `{ base: "slate", accent: "blue", interactive: "hiContrast1"}`
|
|
58
|
-
ColorScheme is experimental and has been implemented only locally but you can read more about how it
|
|
59
|
-
currently works and available options [on the repository's github](https://github.com/Atom-Learning/components/tree/main/lib/src/experiments/color-scheme#readme).
|
|
77
|
+
The trigger list accepts an appearance property to apply uppercase to all tabs. Simply pass `appearance='uppercase'`.
|
|
60
78
|
|
|
61
|
-
```tsx preview
|
|
62
|
-
<Tabs
|
|
63
|
-
<Tabs.TriggerList
|
|
64
|
-
colorScheme={{ base: 'slate', accent: 'slate', interactive: 'hiContrast2' }}
|
|
65
|
-
>
|
|
79
|
+
```tsx preview
|
|
80
|
+
<Tabs>
|
|
81
|
+
<Tabs.TriggerList appearance="uppercase">
|
|
66
82
|
<Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
|
|
67
83
|
<Tabs.Trigger value="tab2">Tab 2</Tabs.Trigger>
|
|
68
84
|
</Tabs.TriggerList>
|
|
69
|
-
<Tabs.Content
|
|
70
|
-
|
|
71
|
-
</Tabs.Content>
|
|
72
|
-
<Tabs.Content css={{ p: '$3' }} value="tab2">
|
|
73
|
-
<Text>Content for tab2.</Text>
|
|
74
|
-
</Tabs.Content>
|
|
85
|
+
<Tabs.Content value="tab1">Content for tab 1</Tabs.Content>
|
|
86
|
+
<Tabs.Content value="tab2">Content for the second tab.</Tabs.Content>
|
|
75
87
|
</Tabs>
|
|
76
88
|
```
|
|
89
|
+
|
|
90
|
+
## Styling the `Tabs.Trigger`
|
|
91
|
+
|
|
92
|
+
In order to style the different states of a trigger, the following CSS selectors need to be used when passed to the `css` prop:
|
|
93
|
+
|
|
94
|
+
`&:hover` to style the hover state of the trigger.
|
|
95
|
+
|
|
96
|
+
`&[data-disabled]` to style a disabled trigger.
|
|
97
|
+
|
|
98
|
+
`&[data-disabled]:hover` to style a disabled trigger's hover state.
|
|
99
|
+
|
|
100
|
+
`&[data-state="active"]` to style an active trigger.
|
|
101
|
+
|
|
102
|
+
If the content of the trigger is, say, a `<Text>` component instead of a string, you can append the `*` symbol or any other child/sibling selectors, to make sure that any nested content is styled accordingly. You can also simply style the nested child component directly via its own `css` prop.
|