@atom-learning/components 2.29.1 → 2.31.0-beta.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/dist/components/accordion/Accordion.d.ts +37 -127
- package/dist/components/accordion/AccordionContent.d.ts +37 -127
- package/dist/components/accordion/AccordionContent.js +1 -1
- package/dist/components/accordion/AccordionItem.d.ts +37 -127
- package/dist/components/accordion/AccordionItem.js +1 -1
- package/dist/components/accordion/AccordionTrigger.d.ts +42 -131
- package/dist/components/accordion/AccordionTrigger.js +1 -1
- package/dist/components/action-icon/ActionIcon.d.ts +37 -127
- package/dist/components/alert-dialog/AlertDialog.d.ts +37 -127
- package/dist/components/alert-dialog/AlertDialogContent.d.ts +37 -127
- package/dist/components/alert-dialog/AlertDialogContent.js +1 -1
- package/dist/components/avatar/Avatar.d.ts +104 -284
- package/dist/components/badge/Badge.d.ts +104 -284
- package/dist/components/box/Box.d.ts +37 -127
- package/dist/components/button/Button.d.ts +37 -127
- package/dist/components/calendar/Day.d.ts +37 -127
- package/dist/components/carousel/CarouselPagination.d.ts +37 -127
- package/dist/components/carousel/CarouselSlide.d.ts +37 -127
- package/dist/components/carousel/CarouselSlider.d.ts +37 -127
- package/dist/components/checkbox/Checkbox.d.ts +37 -127
- package/dist/components/chip/Chip.d.ts +304 -934
- package/dist/components/chip-dismissible-group/ChipDismissibleGroupItem.d.ts +74 -254
- package/dist/components/chip-toggle-group/ChipToggleGroupItem.d.ts +74 -254
- package/dist/components/chip-toggle-group/ChipToggleGroupRoot.d.ts +104 -284
- package/dist/components/combobox/Combobox.d.ts +37 -127
- package/dist/components/combobox/ComboboxInput.d.ts +37 -127
- package/dist/components/combobox/ComboboxList.d.ts +37 -127
- package/dist/components/combobox/ComboboxOption.d.ts +37 -127
- package/dist/components/combobox/ComboboxPopover.d.ts +37 -127
- package/dist/components/data-table/DataTableLoading.d.ts +37 -127
- package/dist/components/data-table/drag-and-drop/Handle.d.ts +74 -254
- package/dist/components/data-table/pagination/Pagination.d.ts +37 -127
- package/dist/components/dialog/Dialog.d.ts +37 -127
- package/dist/components/dialog/DialogBackground.d.ts +104 -284
- package/dist/components/dialog/DialogClose.d.ts +37 -127
- package/dist/components/dialog/DialogContent.d.ts +37 -127
- package/dist/components/dialog/DialogContent.js +1 -1
- package/dist/components/divider/Divider.d.ts +37 -127
- package/dist/components/dropdown-menu/DropdownMenu.d.ts +37 -127
- package/dist/components/dropdown-menu/DropdownMenuContent.d.ts +37 -127
- package/dist/components/dropdown-menu/DropdownMenuItem.d.ts +37 -127
- package/dist/components/dropdown-menu/DropdownMenuSeparator.d.ts +37 -127
- package/dist/components/dropdown-menu/DropdownMenuTrigger.d.ts +37 -127
- package/dist/components/empty-state/EmptyState.d.ts +104 -284
- package/dist/components/empty-state/EmptyStateBody.d.ts +74 -254
- package/dist/components/empty-state/EmptyStateImage.d.ts +74 -254
- package/dist/components/empty-state/EmptyStateTitle.d.ts +37 -127
- package/dist/components/flex/Flex.d.ts +37 -127
- package/dist/components/form/Form.d.ts +37 -127
- package/dist/components/grid/Grid.d.ts +37 -127
- package/dist/components/heading/Heading.d.ts +37 -127
- package/dist/components/icon/Icon.d.ts +37 -127
- package/dist/components/image/Image.d.ts +37 -127
- package/dist/components/inline-message/InlineMessage.d.ts +104 -284
- package/dist/components/input/Input.d.ts +37 -127
- package/dist/components/label/Label.d.ts +37 -127
- package/dist/components/link/Link.d.ts +37 -127
- package/dist/components/list/List.d.ts +104 -284
- package/dist/components/markdown-content/components/MarkdownEmphasis.d.ts +37 -127
- package/dist/components/navigation/NavigationMenuDropdownItem.d.ts +74 -254
- package/dist/components/notification-badge/NotificationBadge.d.ts +104 -284
- package/dist/components/popover/Popover.d.ts +37 -127
- package/dist/components/popover/PopoverContent.d.ts +37 -127
- package/dist/components/progress-bar/ProgressBar.d.ts +37 -127
- package/dist/components/radio-button/RadioButton.d.ts +37 -127
- package/dist/components/radio-button/RadioButtonGroup.d.ts +37 -127
- package/dist/components/radio-card/RadioCard.d.ts +37 -127
- package/dist/components/select/Select.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionContent.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionItem.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionRoot.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionTrigger.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerContent.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerFooter.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerHeader.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerOverlay.d.ts +37 -127
- package/dist/components/sidedrawer/SidedrawerTrigger.d.ts +37 -127
- package/dist/components/slider/Slider.d.ts +37 -127
- package/dist/components/stack/Stack.d.ts +37 -127
- package/dist/components/stack-content/StackContent.d.ts +37 -127
- package/dist/components/stepper/StepperStepBullet.d.ts +104 -284
- package/dist/components/stepper/StepperStepContainer.d.ts +104 -284
- package/dist/components/stepper/StepperStepLabel.d.ts +74 -254
- package/dist/components/switch/Switch.d.ts +37 -127
- package/dist/components/table/Table.d.ts +37 -127
- package/dist/components/table/TableBody.d.ts +37 -127
- package/dist/components/table/TableCell.d.ts +37 -127
- package/dist/components/table/TableFooter.d.ts +37 -127
- package/dist/components/table/TableFooterCell.d.ts +37 -127
- package/dist/components/table/TableHeader.d.ts +37 -127
- package/dist/components/table/TableHeaderCell.d.ts +37 -127
- package/dist/components/table/TableRow.d.ts +74 -254
- package/dist/components/tabs/Tabs.d.ts +44 -403
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/tabs/TabsContent.d.ts +177 -0
- package/dist/components/tabs/TabsContent.js +1 -0
- package/dist/components/tabs/TabsTrigger.d.ts +182 -0
- package/dist/components/tabs/TabsTrigger.js +1 -0
- package/dist/components/tabs/TabsTriggerList.d.ts +42 -136
- package/dist/components/tabs/TabsTriggerList.js +1 -1
- package/dist/components/text/Text.d.ts +37 -127
- package/dist/components/textarea/Textarea.d.ts +37 -127
- package/dist/components/toast/Toast.d.ts +37 -127
- package/dist/components/toggle-group/ToggleGroupButton.d.ts +104 -284
- package/dist/components/toggle-group/ToggleGroupItem.d.ts +104 -284
- package/dist/components/toggle-group/ToggleGroupRoot.d.ts +37 -127
- package/dist/components/toggle-group/index.d.ts +245 -695
- package/dist/components/tooltip/TooltipContent.d.ts +37 -127
- package/dist/components/top-bar/TopBar.d.ts +37 -127
- package/dist/components/top-bar/TopBarBrand.d.ts +111 -381
- package/dist/components/video/Video.d.ts +104 -284
- package/dist/docgen.json +1 -1
- package/dist/docs/Accordion.mdx +56 -7
- package/dist/docs/README.mdx +79 -0
- package/dist/docs/Tabs.mdx +31 -57
- package/dist/experiments/color-scheme/ColorScheme.d.ts +111 -0
- package/dist/experiments/color-scheme/ColorScheme.js +1 -0
- package/dist/experiments/color-scheme/blue.json.js +1 -0
- package/dist/experiments/color-scheme/generateAlphaColors.d.ts +1 -0
- package/dist/experiments/color-scheme/generateAlphaColors.js +1 -0
- package/dist/experiments/color-scheme/index.d.ts +1 -0
- package/dist/experiments/color-scheme/slate.json.js +1 -0
- package/dist/experiments/color-scheme/stitches.colorscheme.config.d.ts +256 -0
- package/dist/experiments/color-scheme/stitches.colorscheme.config.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/stitches.d.ts +474 -786
- package/dist/stitches.js +1 -1
- package/dist/utilities/hooks/useCallbackRef.js +1 -1
- package/dist/utilities/hooks/useWindowSize.d.ts +8 -0
- package/dist/utilities/hooks/useWindowSize.js +1 -0
- package/package.json +4 -3
- package/CHANGELOG.md +0 -210
- package/dist/components/tabs/TabTrigger.d.ts +0 -275
- package/dist/components/tabs/TabTrigger.js +0 -1
- package/dist/components/tabs/utils.d.ts +0 -2
- package/dist/components/tabs/utils.js +0 -1
package/dist/docs/Accordion.mdx
CHANGED
|
@@ -5,23 +5,29 @@ 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
|
+
|
|
8
12
|
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`.
|
|
9
13
|
|
|
10
14
|
The `Accordion.Trigger` has been simplified to include a chevron icon. Generally, you would only want to render text inside the rest.
|
|
11
15
|
|
|
12
16
|
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`.
|
|
13
17
|
|
|
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
|
-
|
|
16
18
|
```tsx preview
|
|
17
19
|
<Accordion type="single" defaultValue="1">
|
|
18
20
|
<Accordion.Item value="1">
|
|
19
|
-
<Accordion.Trigger
|
|
20
|
-
<Accordion.Content css={{ p: '$
|
|
21
|
+
<Accordion.Trigger>Accordion Header 1</Accordion.Trigger>
|
|
22
|
+
<Accordion.Content css={{ p: '$3' }}>
|
|
23
|
+
<Text>Accordion content 1</Text>
|
|
24
|
+
</Accordion.Content>
|
|
21
25
|
</Accordion.Item>
|
|
22
26
|
<Accordion.Item value="2">
|
|
23
27
|
<Accordion.Trigger>Accordion Header 2</Accordion.Trigger>
|
|
24
|
-
<Accordion.Content css={{ p: '$
|
|
28
|
+
<Accordion.Content css={{ p: '$3' }}>
|
|
29
|
+
<Text>Accordion content 2</Text>
|
|
30
|
+
</Accordion.Content>
|
|
25
31
|
</Accordion.Item>
|
|
26
32
|
</Accordion>
|
|
27
33
|
```
|
|
@@ -40,6 +46,49 @@ Accordions can have `type` as either `single` or `multiple`. This changes how ma
|
|
|
40
46
|
|
|
41
47
|
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']}`
|
|
42
48
|
|
|
43
|
-
##
|
|
49
|
+
## Disabled
|
|
44
50
|
|
|
45
|
-
`Accordion.
|
|
51
|
+
An `Accordion.Item` component can take a `disabled` prop, which would make it untoggleable.
|
|
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
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
```
|
package/dist/docs/Tabs.mdx
CHANGED
|
@@ -5,10 +5,12 @@ description: Tabs is a component that provides different sections of content tha
|
|
|
5
5
|
category: Layout
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Functionality based on the [`Tab`](https://www.radix-ui.com/docs/primitives/components/tabs) radix component, which already allows for: controlled/uncontrolled tabbing, disabling or partly disabling options, adds keyboard navigation and orientation and more.
|
|
9
|
+
|
|
10
|
+
Implements experimental ColorScheme component to allow multiple colour setups.
|
|
9
11
|
|
|
10
12
|
```tsx preview
|
|
11
|
-
<Tabs defaultValue="
|
|
13
|
+
<Tabs defaultValue="tab2">
|
|
12
14
|
<Tabs.TriggerList>
|
|
13
15
|
<Tabs.Trigger value="tab1">
|
|
14
16
|
Nested component under the Tabs.Trigger component
|
|
@@ -27,76 +29,48 @@ The component provides a set of default styles, which can be overwritten by usin
|
|
|
27
29
|
</Tabs>
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-
|
|
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.
|
|
32
|
+
## Disabled
|
|
47
33
|
|
|
48
|
-
|
|
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.
|
|
34
|
+
A `Tabs.Trigger` component can take a `disabled` prop, which would make it unselectable.
|
|
35
|
+
The corresponding `Tabs.Content` component's content will be, in this case, permanently hidden.
|
|
61
36
|
|
|
62
37
|
```tsx preview
|
|
63
|
-
<Tabs>
|
|
38
|
+
<Tabs defaultValue="tab1">
|
|
64
39
|
<Tabs.TriggerList>
|
|
65
40
|
<Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
|
|
66
|
-
<Tabs.Trigger
|
|
41
|
+
<Tabs.Trigger value="tab2" disabled>
|
|
67
42
|
Tab 2
|
|
68
43
|
</Tabs.Trigger>
|
|
69
44
|
</Tabs.TriggerList>
|
|
70
|
-
<Tabs.Content value="tab1">
|
|
71
|
-
|
|
45
|
+
<Tabs.Content css={{ p: '$3' }} value="tab1">
|
|
46
|
+
<Text>Content for tab1.</Text>
|
|
47
|
+
</Tabs.Content>
|
|
48
|
+
<Tabs.Content css={{ p: '$3' }} value="tab2">
|
|
49
|
+
<Text>Content for tab2.</Text>
|
|
50
|
+
</Tabs.Content>
|
|
72
51
|
</Tabs>
|
|
73
52
|
```
|
|
74
53
|
|
|
75
|
-
##
|
|
54
|
+
## Color Scheme
|
|
76
55
|
|
|
77
|
-
|
|
56
|
+
You can pass in a `colorScheme` object to the TriggerList to customise the colours of the component.
|
|
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).
|
|
78
60
|
|
|
79
|
-
```tsx preview
|
|
80
|
-
<Tabs>
|
|
81
|
-
<Tabs.TriggerList
|
|
61
|
+
```tsx preview live
|
|
62
|
+
<Tabs defaultValue="tab2">
|
|
63
|
+
<Tabs.TriggerList
|
|
64
|
+
colorScheme={{ base: 'slate', accent: 'slate', interactive: 'hiContrast2' }}
|
|
65
|
+
>
|
|
82
66
|
<Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
|
|
83
67
|
<Tabs.Trigger value="tab2">Tab 2</Tabs.Trigger>
|
|
84
68
|
</Tabs.TriggerList>
|
|
85
|
-
<Tabs.Content value="tab1">
|
|
86
|
-
|
|
69
|
+
<Tabs.Content css={{ p: '$3' }} value="tab1">
|
|
70
|
+
<Text>Content for tab1.</Text>
|
|
71
|
+
</Tabs.Content>
|
|
72
|
+
<Tabs.Content css={{ p: '$3' }} value="tab2">
|
|
73
|
+
<Text>Content for tab2.</Text>
|
|
74
|
+
</Tabs.Content>
|
|
87
75
|
</Tabs>
|
|
88
76
|
```
|
|
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.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { bases, accents } from './stitches.colorscheme.config';
|
|
3
|
+
declare type TColorSchemeOwnProps = {
|
|
4
|
+
base?: keyof typeof bases;
|
|
5
|
+
accent?: keyof typeof accents;
|
|
6
|
+
interactive?: 'loContrast1' | 'loContrast2' | 'hiContrast1' | 'hiContrast2';
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const StyledColorScheme: import("@stitches/react/types/styled-component").StyledComponent<"div", {}, {
|
|
10
|
+
sm: string;
|
|
11
|
+
md: string;
|
|
12
|
+
lg: string;
|
|
13
|
+
xl: string;
|
|
14
|
+
reducedMotion: string;
|
|
15
|
+
allowMotion: string;
|
|
16
|
+
hover: string;
|
|
17
|
+
}, import("@stitches/react/types/css-util").CSS<{
|
|
18
|
+
sm: string;
|
|
19
|
+
md: string;
|
|
20
|
+
lg: string;
|
|
21
|
+
xl: string;
|
|
22
|
+
reducedMotion: string;
|
|
23
|
+
allowMotion: string;
|
|
24
|
+
hover: string;
|
|
25
|
+
}, {
|
|
26
|
+
colors: {
|
|
27
|
+
slate1: any;
|
|
28
|
+
slate2: any;
|
|
29
|
+
slate3: any;
|
|
30
|
+
slate4: any;
|
|
31
|
+
slate5: any;
|
|
32
|
+
slate6: any;
|
|
33
|
+
slate7: any;
|
|
34
|
+
slate8: any;
|
|
35
|
+
slate9: any;
|
|
36
|
+
slate10: any;
|
|
37
|
+
blue1: any;
|
|
38
|
+
blue2: any;
|
|
39
|
+
blue3: any;
|
|
40
|
+
blue4: any;
|
|
41
|
+
blue5: any;
|
|
42
|
+
blue6: any;
|
|
43
|
+
blue7: any;
|
|
44
|
+
blue8: any;
|
|
45
|
+
blue9: any;
|
|
46
|
+
blue10: any;
|
|
47
|
+
background: any;
|
|
48
|
+
foreground: any;
|
|
49
|
+
foreground6plus: any;
|
|
50
|
+
};
|
|
51
|
+
}, import("@stitches/react/types/config").DefaultThemeMap, {
|
|
52
|
+
bg: (value: import("@stitches/react/types/css-util").WithPropertyValue<"background">) => {
|
|
53
|
+
background: import("@stitches/react/types/css-util").WithPropertyValue<"background">;
|
|
54
|
+
};
|
|
55
|
+
size: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"size">) => {
|
|
56
|
+
height: string | number | import("@stitches/react/types/css-util").WithScaleValue<"size">;
|
|
57
|
+
width: string | number | import("@stitches/react/types/css-util").WithScaleValue<"size">;
|
|
58
|
+
};
|
|
59
|
+
p: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
60
|
+
padding: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
61
|
+
};
|
|
62
|
+
pt: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
63
|
+
paddingTop: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
64
|
+
};
|
|
65
|
+
pr: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
66
|
+
paddingRight: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
67
|
+
};
|
|
68
|
+
pb: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
69
|
+
paddingBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
70
|
+
};
|
|
71
|
+
pl: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
72
|
+
paddingLeft: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
73
|
+
};
|
|
74
|
+
px: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
75
|
+
paddingLeft: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
76
|
+
paddingRight: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
77
|
+
};
|
|
78
|
+
py: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
79
|
+
paddingTop: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
80
|
+
paddingBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
81
|
+
};
|
|
82
|
+
m: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
83
|
+
margin: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
84
|
+
};
|
|
85
|
+
mt: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
86
|
+
marginTop: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
87
|
+
};
|
|
88
|
+
mr: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
89
|
+
marginRight: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
90
|
+
};
|
|
91
|
+
mb: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
92
|
+
marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
93
|
+
};
|
|
94
|
+
ml: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
95
|
+
marginLeft: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
96
|
+
};
|
|
97
|
+
mx: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
98
|
+
marginLeft: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
99
|
+
marginRight: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
100
|
+
};
|
|
101
|
+
my: (value: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">) => {
|
|
102
|
+
marginTop: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
103
|
+
marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
104
|
+
};
|
|
105
|
+
}>>;
|
|
106
|
+
declare type TColorSchemeProps = React.ComponentProps<typeof StyledColorScheme> & TColorSchemeOwnProps;
|
|
107
|
+
/**
|
|
108
|
+
* @experimental Component has not been finalised. Further design input required. Use with caution.
|
|
109
|
+
*/
|
|
110
|
+
export declare const ColorScheme: React.ForwardRefExoticComponent<Pick<TColorSchemeProps, "css" | "key" | keyof React.HTMLAttributes<HTMLDivElement> | keyof TColorSchemeOwnProps> & React.RefAttributes<HTMLDivElement>>;
|
|
111
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as o from"react";import{styled as f,colorSchemes as e}from"./stitches.colorscheme.config.js";import{Slot as d}from"@radix-ui/react-slot";const p=f("div"),r=o.forwardRef(({base:t="",accent:a="",interactive:c="",className:m,asChild:s=!1,...i},l)=>{const n=[m,e[`interactive-${c}`],e[`accent-${a}`],e[`base-${t}`]].filter(Boolean).join(" ");return o.createElement(s?d:p,{ref:l,className:n,...i})});r.displayName="ColorScheme";export{r as ColorScheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="#F3F8FF",l="#E5F1FF",u="#D6EAFF",b="#C2DEFF",F="#B3D4FA",a="#057AFF",r="#0F67F5",v="#194DCC",D="#102DA3",A="#15235E",E={blue1:e,blue2:l,blue3:u,blue4:b,blue5:F,blue6:a,blue7:r,blue8:v,blue9:D,blue10:A};export{e as blue1,A as blue10,l as blue2,u as blue3,b as blue4,F as blue5,a as blue6,r as blue7,v as blue8,D as blue9,E as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateAlphaColors: (colorName: string, colors: Record<string, string>) => Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseToRgba as u}from"color2k";const M=[255,255,255,1],r=[.05,.1,.15,.2,.27,.35,.5,.7,.8,.95],n=a=>Math.round(Math.max(Math.min(a,255),0)),$=(a,h)=>{const e={};return Object.entries(h).forEach(([f,i],o)=>{const[m,p,b]=u(i),[t,s,c]=M,g=[n((m-t)/r[o]+t),n((p-s)/r[o]+s),n((b-c)/r[o]+c),r[o]];e[`${a}A${o+1}`]=`rgba(${g.join(",")})`}),e};export{$ as generateAlphaColors};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColorScheme } from './ColorScheme';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var a="#F6F6F6",e="#EBEBEB",t="#E0E0E0",l="#CECECE",s="#C2C2C2",r="#757575",v="#545454",C="#333333",E="#1F1F1F",F="#1C1C1C",B={slate1:a,slate2:e,slate3:t,slate4:l,slate5:s,slate6:r,slate7:v,slate8:C,slate9:E,slate10:F};export{B as default,a as slate1,F as slate10,e as slate2,t as slate3,l as slate4,s as slate5,r as slate6,v as slate7,C as slate8,E as slate9};
|