@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/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Accordion as p}from"./components/accordion/Accordion.js";import{ActionIcon as x}from"./components/action-icon/ActionIcon.js";import{AlertDialog as i}from"./components/alert-dialog/AlertDialog.js";import{AlertProvider as l,useAlert as d}from"./components/alert-dialog/alert-context/AlertContext.js";import{Avatar as n}from"./components/avatar/Avatar.js";import{Badge as c}from"./components/badge/Badge.js";import{Box as
|
|
1
|
+
import{Accordion as p}from"./components/accordion/Accordion.js";import{ActionIcon as x}from"./components/action-icon/ActionIcon.js";import{AlertDialog as i}from"./components/alert-dialog/AlertDialog.js";import{AlertProvider as l,useAlert as d}from"./components/alert-dialog/alert-context/AlertContext.js";import{Avatar as n}from"./components/avatar/Avatar.js";import{Badge as c}from"./components/badge/Badge.js";import{Box as C}from"./components/box/Box.js";import{Button as g,StyledButton as F}from"./components/button/Button.js";import{Carousel as h,useCarousel as I}from"./components/carousel/Carousel.js";import{Checkbox as D}from"./components/checkbox/Checkbox.js";import{CheckboxField as G}from"./components/checkbox-field/CheckboxField.js";import{Chip as w}from"./components/chip/Chip.js";import{ChipGroup as A}from"./components/chip/ChipGroup.js";import{ChipDismissibleGroup as L}from"./components/chip-dismissible-group/index.js";import{ChipToggleGroup as M}from"./components/chip-toggle-group/index.js";import{Combobox as V}from"./components/combobox/Combobox.js";import{useDataTable as E}from"./components/data-table/DataTableContext.js";import{DataTable as j}from"./components/data-table/DataTable.js";import{DateField as z}from"./components/date-field/DateField.js";import{DateInput as K}from"./components/date-input/DateInput.js";import{Dialog as Q}from"./components/dialog/Dialog.js";import{Dismissible as X}from"./components/dismissible/index.js";import{DismissibleGroup as Z}from"./components/dismissible-group/index.js";import{Divider as $}from"./components/divider/Divider.js";import{DropdownMenu as ro}from"./components/dropdown-menu/DropdownMenu.js";import{EmptyState as to}from"./components/empty-state/EmptyState.js";import{FieldWrapper as mo}from"./components/field-wrapper/FieldWrapper.js";import{InlineFieldWrapper as fo}from"./components/field-wrapper/InlineFieldWrapper.js";import{FileInput as ao}from"./components/file-input/FileInput.js";import{Flex as so}from"./components/flex/Flex.js";import{Form as uo}from"./components/form/Form.js";import"dlv";import"react-hook-form";import{Grid as bo}from"./components/grid/Grid.js";import{Heading as So}from"./components/heading/Heading.js";import{Icon as Fo}from"./components/icon/Icon.js";import{Image as ho}from"./components/image/Image.js";import{InlineMessage as Bo}from"./components/inline-message/InlineMessage.js";import{Input as ko}from"./components/input/Input.js";import{InputField as vo}from"./components/input-field/InputField.js";import{Label as yo}from"./components/label/Label.js";import{Link as Po,StyledLink as Lo}from"./components/link/Link.js";import{List as Mo}from"./components/list/List.js";import{Loader as Vo}from"./components/loader/Loader.js";import{MarkdownContent as Eo}from"./components/markdown-content/MarkdownContent.js";import{NavigationMenu as jo}from"./components/navigation/NavigationMenu.js";import{NotificationBadge as zo}from"./components/notification-badge/NotificationBadge.js";import{NumberInput as Ko}from"./components/number-input/NumberInput.js";import{NumberInputField as Qo}from"./components/number-input-field/NumberInputField.js";import{PasswordField as Xo}from"./components/password-field/PasswordField.js";import{PasswordInput as Zo}from"./components/password-input/PasswordInput.js";import{Popover as $o}from"./components/popover/Popover.js";import{ProgressBar as rr}from"./components/progress-bar/ProgressBar.js";import{RadioButton as tr}from"./components/radio-button/RadioButton.js";import{RadioButtonGroup as mr}from"./components/radio-button/RadioButtonGroup.js";import{RadioButtonField as fr}from"./components/radio-button-field/RadioButtonField.js";import{RadioCard as ar}from"./components/radio-card/RadioCard.js";import{RadioCardGroup as dr}from"./components/radio-card/RadioCardGroup.js";import{SearchField as nr}from"./components/search-field/SearchField.js";import{SearchInput as cr}from"./components/search-input/SearchInput.js";import{Select as Cr}from"./components/select/Select.js";import{SelectField as gr}from"./components/select-field/SelectField.js";import{Sidedrawer as Tr}from"./components/sidedrawer/Sidedrawer.js";import{Slider as Ir}from"./components/slider/Slider.js";import{SliderField as Dr}from"./components/slider-field/SliderField.js";import{Stack as Gr}from"./components/stack/Stack.js";import{StackContent as wr}from"./components/stack-content/StackContent.js";import{Stepper as Ar}from"./components/stepper/Stepper.js";import{Switch as Lr}from"./components/switch/Switch.js";import{Table as Mr}from"./components/table/Table.js";import{Tabs as Vr}from"./components/tabs/Tabs.js";import{Text as Er}from"./components/text/Text.js";import{Textarea as jr}from"./components/textarea/Textarea.js";import{TextareaField as zr}from"./components/textarea-field/TextareaField.js";import{ToastProvider as Kr}from"./components/toast/ToastProvider.js";import{ToggleGroup as Qr}from"./components/toggle-group/index.js";import{Tooltip as Xr}from"./components/tooltip/Tooltip.js";import{TopBar as Zr}from"./components/top-bar/TopBar.js";import{Video as $r}from"./components/video/Video.js";import{createTheme as re,css as ee,getCssText as te,globalCss as pe,keyframes as me,media as xe,styled as fe,theme as ie,utils as ae}from"./stitches.js";import{ColorScheme as de}from"./experiments/color-scheme/ColorScheme.js";import{createThemeVariants as ne}from"./utilities/create-theme-variants/createThemeVariants.js";import{focusVisibleStyleBlock as ce}from"./utilities/style/focus-visible-style-block.js";import{default as Ce}from"react-hot-toast";export{p as Accordion,x as ActionIcon,i as AlertDialog,l as AlertProvider,n as Avatar,c as Badge,C as Box,g as Button,h as Carousel,D as Checkbox,G as CheckboxField,w as Chip,L as ChipDismissibleGroup,A as ChipGroup,M as ChipToggleGroup,de as ColorScheme,V as Combobox,j as DataTable,z as DateField,K as DateInput,Q as Dialog,X as Dismissible,Z as DismissibleGroup,$ as Divider,ro as DropdownMenu,to as EmptyState,mo as FieldWrapper,ao as FileInput,so as Flex,uo as Form,bo as Grid,So as Heading,Fo as Icon,ho as Image,fo as InlineFieldWrapper,Bo as InlineMessage,ko as Input,vo as InputField,yo as Label,Po as Link,Mo as List,Vo as Loader,Eo as MarkdownContent,jo as NavigationMenu,zo as NotificationBadge,Ko as NumberInput,Qo as NumberInputField,Xo as PasswordField,Zo as PasswordInput,$o as Popover,rr as ProgressBar,tr as RadioButton,fr as RadioButtonField,mr as RadioButtonGroup,ar as RadioCard,dr as RadioCardGroup,nr as SearchField,cr as SearchInput,Cr as Select,gr as SelectField,Tr as Sidedrawer,Ir as Slider,Dr as SliderField,Gr as Stack,wr as StackContent,Ar as Stepper,F as StyledButton,Lo as StyledLink,Lr as Switch,Mr as Table,Vr as Tabs,Er as Text,jr as Textarea,zr as TextareaField,Kr as ToastProvider,Qr as ToggleGroup,Xr as Tooltip,Zr as TopBar,$r as Video,re as createTheme,ne as createThemeVariants,ee as css,ce as focusVisibleStyleBlock,te as getCssText,pe as globalCss,me as keyframes,xe as media,fe as styled,ie as theme,Ce as toast,d as useAlert,I as useCarousel,E as useDataTable,ae as utils};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as l from"react";const n=()=>{const e=l.useRef(null),u=l.useCallback(t=>{t&&(e.current=t)},[]);return[e,u]},s=()=>{const[e,u]=l.useState(null),t=l.useCallback(a=>{a&&u(a)},[]);return[e,t]};export{n as useCallbackRef,s as useCallbackRefState};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
|
-
"version": "2.
|
|
7
|
+
"version": "2.33.0",
|
|
8
8
|
"description": "",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"dev": "NODE_ENV=development rollup -c -w",
|
|
15
15
|
"build:lib": "NODE_ENV=production rollup -c",
|
|
16
16
|
"build:types": "NODE_ENV=production tsc --emitDeclarationOnly && tsc-alias",
|
|
17
|
-
"build:
|
|
17
|
+
"build:proptypes": "node ./scripts/generate-component-props.mjs",
|
|
18
18
|
"start:sandbox": "vite -c ./sandbox/vite.config.js",
|
|
19
19
|
"add-component": "node ./scripts/add-component.mjs",
|
|
20
|
-
"prepublishOnly": "run-s clean build:lib build:types build:
|
|
20
|
+
"prepublishOnly": "run-s clean build:lib build:types build:proptypes",
|
|
21
21
|
"clean": "del ./dist/",
|
|
22
22
|
"format": "prettier 'src/**/*.{js,ts,tsx}' --write",
|
|
23
23
|
"lint": "eslint 'src/**/*.{js,ts,tsx}' --fix",
|
|
@@ -104,7 +104,6 @@
|
|
|
104
104
|
"npm-run-all": "^4.1.5",
|
|
105
105
|
"prettier": "^2.2.1",
|
|
106
106
|
"prompts": "^2.4.0",
|
|
107
|
-
"react-docgen-typescript": "2.1.0",
|
|
108
107
|
"rollup": "^2.39.0",
|
|
109
108
|
"rollup-plugin-esbuild": "^4.8.2",
|
|
110
109
|
"rollup-plugin-json": "^4.0.0",
|
|
@@ -123,8 +122,8 @@
|
|
|
123
122
|
"peerDependencies": {
|
|
124
123
|
"@atom-learning/icons": "^1.0.0",
|
|
125
124
|
"@atom-learning/theme": "^1.0.0",
|
|
126
|
-
"react": "^
|
|
127
|
-
"react-dom": "^
|
|
125
|
+
"react": "^17",
|
|
126
|
+
"react-dom": "^17"
|
|
128
127
|
},
|
|
129
128
|
"dependencies": {
|
|
130
129
|
"@atom-learning/theme": "1.1.1",
|
|
@@ -161,6 +160,7 @@
|
|
|
161
160
|
"mdast-util-from-markdown": "0.8.5",
|
|
162
161
|
"micromark-extension-directive": "1.4.0",
|
|
163
162
|
"pure-react-carousel": "^1.27.6",
|
|
163
|
+
"react-docgen-typescript": "2.1.0",
|
|
164
164
|
"react-hook-form": "^6.15.4",
|
|
165
165
|
"react-hook-form-persist": "^2.0.0",
|
|
166
166
|
"react-hot-toast": "^1.0.2",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CSS } from '../../stitches';
|
|
3
|
-
interface ITableStickyColumnsContainerProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
numberOfStickyColumns?: number;
|
|
6
|
-
css?: CSS;
|
|
7
|
-
}
|
|
8
|
-
export declare const TableStickyColumnsContainer: React.FC<ITableStickyColumnsContainerProps>;
|
|
9
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import r from"react";import{Box as a}from"../box/Box.js";const i=({children:n,numberOfStickyColumns:t=0,css:l,...c})=>{const[o,p]=r.useState(!1);return r.createElement(a,{onScroll:s=>{const e=s.currentTarget.scrollLeft>0;e!==o&&p(e)},role:"scrollbar",css:{overflow:"auto",maxWidth:"100%",[`& td:nth-of-type(${t}), th:nth-of-type(${t})`]:{...o&&{boxShadow:"$colors$alpha200 -2px -3px 9px 1px",clipPath:"inset(0px -10px 0px 0px)"},...t===1&&{position:"sticky",left:"0",zIndex:"2"}},"& td":{bg:"inherit"},...l},...c},n)};export{i as TableStickyColumnsContainer};
|
package/dist/docs/Accordion.mdx
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Accordion
|
|
3
|
-
component: Accordion,Accordion.Item,Accordion.Trigger,Accordion.Content
|
|
4
|
-
description: A vertically stacked group of interactive headings that reveal an associated section of content when clicked
|
|
5
|
-
category: Layout
|
|
6
|
-
---
|
|
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
|
-
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
|
-
|
|
14
|
-
The `Accordion.Trigger` has been simplified to include a chevron icon. Generally, you would only want to render text inside the rest.
|
|
15
|
-
|
|
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`.
|
|
17
|
-
|
|
18
|
-
```tsx preview
|
|
19
|
-
<Accordion type="single" defaultValue="1">
|
|
20
|
-
<Accordion.Item value="1">
|
|
21
|
-
<Accordion.Trigger>Accordion Header 1</Accordion.Trigger>
|
|
22
|
-
<Accordion.Content css={{ p: '$3' }}>
|
|
23
|
-
<Text>Accordion content 1</Text>
|
|
24
|
-
</Accordion.Content>
|
|
25
|
-
</Accordion.Item>
|
|
26
|
-
<Accordion.Item value="2">
|
|
27
|
-
<Accordion.Trigger>Accordion Header 2</Accordion.Trigger>
|
|
28
|
-
<Accordion.Content css={{ p: '$3' }}>
|
|
29
|
-
<Text>Accordion content 2</Text>
|
|
30
|
-
</Accordion.Content>
|
|
31
|
-
</Accordion.Item>
|
|
32
|
-
</Accordion>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Values
|
|
36
|
-
|
|
37
|
-
Each `Accordion.Item` must have a value, which can either be used as a `defaultValue` on the Accordion, or by setting the `value` of the Accordion so it is a controlled component. If value is set, it must also contain an `onValueChange` function that sets the value to a new value.
|
|
38
|
-
|
|
39
|
-
## Collapsible
|
|
40
|
-
|
|
41
|
-
Accordions can be given the property `collapsible`, which allows all items to be collapsed. Without passing this at least one item must be open.
|
|
42
|
-
|
|
43
|
-
## Type
|
|
44
|
-
|
|
45
|
-
Accordions can have `type` as either `single` or `multiple`. This changes how many items can be expanded at once. The default is `single`.
|
|
46
|
-
|
|
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']}`
|
|
48
|
-
|
|
49
|
-
## Disabled
|
|
50
|
-
|
|
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
|
-
```
|
package/dist/docs/ActionIcon.mdx
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Action Icon
|
|
3
|
-
component: ActionIcon
|
|
4
|
-
description: An accessible interactive wrapper around Icon
|
|
5
|
-
category: Navigation
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`ActionIcon` should be used alongside `Icon` when you require a user interaction.
|
|
9
|
-
|
|
10
|
-
```tsx preview
|
|
11
|
-
<>
|
|
12
|
-
<ActionIcon label="Attach a file" appearance="simple">
|
|
13
|
-
<Icon is={Clip} />
|
|
14
|
-
</ActionIcon>
|
|
15
|
-
<ActionIcon label="Attach a file" appearance="outline">
|
|
16
|
-
<Icon is={Clip} />
|
|
17
|
-
</ActionIcon>
|
|
18
|
-
<ActionIcon label="Attach a file" appearance="solid">
|
|
19
|
-
<Icon is={Clip} />
|
|
20
|
-
</ActionIcon>
|
|
21
|
-
</>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Rounded Variant
|
|
25
|
-
|
|
26
|
-
Setting `isRounded` makes the Action circular when paired with the options "outline" and "solid" for the `appearance` prop
|
|
27
|
-
|
|
28
|
-
```tsx preview
|
|
29
|
-
<>
|
|
30
|
-
<ActionIcon label="Attach a file" appearance="outline" isRounded>
|
|
31
|
-
<Icon is={Bell} />
|
|
32
|
-
</ActionIcon>
|
|
33
|
-
<ActionIcon label="Attach a file" appearance="solid" isRounded>
|
|
34
|
-
<Icon is={Bell} />
|
|
35
|
-
</ActionIcon>
|
|
36
|
-
</>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Disabled state
|
|
40
|
-
|
|
41
|
-
Passing `disabled` makes the Action Icon take a disabled appearance, where any cursor interaction with the component will not render any changes in its UI.
|
|
42
|
-
|
|
43
|
-
```tsx preview
|
|
44
|
-
<>
|
|
45
|
-
<ActionIcon label="Attach a file" appearance="simple" disabled>
|
|
46
|
-
<Icon is={Bell} />
|
|
47
|
-
</ActionIcon>
|
|
48
|
-
<ActionIcon label="Attach a file" appearance="outline" disabled>
|
|
49
|
-
<Icon is={Bell} />
|
|
50
|
-
</ActionIcon>
|
|
51
|
-
<ActionIcon label="Attach a file" appearance="solid" disabled>
|
|
52
|
-
<Icon is={Bell} />
|
|
53
|
-
</ActionIcon>
|
|
54
|
-
</>
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
It is recommended to pair `ActionIcon` with `Tooltip` to provide a clear visual description of the action the user is about to perform.
|
|
58
|
-
|
|
59
|
-
```tsx preview
|
|
60
|
-
// `Tooltip.Provider` is included here to enable the example `Tooltip`, but you should generally place it at the root of your application
|
|
61
|
-
<Tooltip.Provider>
|
|
62
|
-
<Tooltip>
|
|
63
|
-
<Tooltip.Trigger asChild>
|
|
64
|
-
<ActionIcon size="lg" label="Add to basket">
|
|
65
|
-
<Icon is={Basket} size="md" />
|
|
66
|
-
</ActionIcon>
|
|
67
|
-
</Tooltip.Trigger>
|
|
68
|
-
<Tooltip.Content>Add to basket</Tooltip.Content>
|
|
69
|
-
</Tooltip>
|
|
70
|
-
</Tooltip.Provider>
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Polymorphism
|
|
74
|
-
|
|
75
|
-
The `ActionIcon` component supports polymorphism, therefore depending on whether it receives an `onClick`/`href` as a prop, it will produce a `button` or `link` respectively
|
|
76
|
-
|
|
77
|
-
```tsx preview
|
|
78
|
-
<ActionIcon label="Shuffle selection" onClick={() => console.log('clicked')}>
|
|
79
|
-
<Icon is={Shuffle} />
|
|
80
|
-
</ActionIcon>
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```tsx preview
|
|
84
|
-
<ActionIcon label="Add a new folder" href="/directory/add">
|
|
85
|
-
<Icon is={FolderAdd} />
|
|
86
|
-
</ActionIcon>
|
|
87
|
-
```
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Alert Dialog
|
|
3
|
-
component: AlertDialog,AlertDialog.Trigger,AlertDialog.Content
|
|
4
|
-
description: A modal dialog that interrupts the user with important content and expects a response
|
|
5
|
-
category: Feedback
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`AlertDialog` exports a number of components that can be composed together to create a modal pop up that expects a response from the user. `AlertDialog` also exports a custom hook that can be used to dynamically render an alert based on some content and a callback; you can see an example of this below.
|
|
9
|
-
|
|
10
|
-
```tsx
|
|
11
|
-
import { AlertProvider, Button, useAlert } from '@atom-learning/components'
|
|
12
|
-
|
|
13
|
-
const Component = () => {
|
|
14
|
-
const { showAlert } = useAlert()
|
|
15
|
-
|
|
16
|
-
const handleClick = () => {
|
|
17
|
-
showAlert({
|
|
18
|
-
title: 'Are you sure you want to delete this school?',
|
|
19
|
-
description: 'This will remove all restrictions from your school',
|
|
20
|
-
confirmActionText: 'Delete school',
|
|
21
|
-
cancelActionText: 'Cancel',
|
|
22
|
-
onAction: (result) => {
|
|
23
|
-
if (result) console.log('Confirmation')
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return <Button onClick={handleClick}>Delete school</Button>
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const App = () => (
|
|
32
|
-
<AlertProvider>
|
|
33
|
-
<Component />
|
|
34
|
-
</AlertProvider>
|
|
35
|
-
)
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Accessibility
|
|
39
|
-
|
|
40
|
-
Consider pairing the `onAction` function with a method that can announce a message to the user. In the above example a message of "School has been deleted" would be appropriate for screen reader users. [Radix UI Announce](https://radix-ui.com/primitives/docs/utilities/announce) would be a good candidate for this.
|
package/dist/docs/Avatar.mdx
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Avatar
|
|
3
|
-
component: Avatar,Avatar.Image,Avatar.Initial,Avatar.Placeholder,Avatar.Icon
|
|
4
|
-
description: Show a thumbnail representation of an individual or entity.
|
|
5
|
-
category: Media
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
The `Avatar` component can be used to show a visual representation of a user or entity. It helps to quickly identify users or objects.
|
|
9
|
-
|
|
10
|
-
```jsx preview
|
|
11
|
-
<Avatar name="Alice Smith">
|
|
12
|
-
<Avatar.Image
|
|
13
|
-
alt="Alice Smith's avatar"
|
|
14
|
-
src="https://thispersondoesnotexist.com/image"
|
|
15
|
-
/>
|
|
16
|
-
</Avatar>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Instead of an image, the initial of the name or a placeholder icon can be used
|
|
20
|
-
|
|
21
|
-
```jsx preview
|
|
22
|
-
<>
|
|
23
|
-
<Avatar name="Alice Smith">
|
|
24
|
-
<Avatar.Initial />
|
|
25
|
-
</Avatar>
|
|
26
|
-
<Avatar>
|
|
27
|
-
<Avatar.Placeholder />
|
|
28
|
-
</Avatar>
|
|
29
|
-
</>
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
When an image src is missing it will fallback to the initial of the name.
|
|
33
|
-
|
|
34
|
-
```jsx preview
|
|
35
|
-
<Avatar name="Alice Smith">
|
|
36
|
-
<Avatar.Image alt="" src="" />
|
|
37
|
-
</Avatar>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
When the name is also missing it will fallback to the placeholder icon.
|
|
41
|
-
|
|
42
|
-
```jsx preview
|
|
43
|
-
<Avatar name="">
|
|
44
|
-
<Avatar.Image alt="Alice Smith's avatar" src="" />
|
|
45
|
-
</Avatar>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
When `<Avatar.Initial />` is used but the name is missing, it will fallback to the placeholder icon.
|
|
49
|
-
|
|
50
|
-
```jsx preview
|
|
51
|
-
<Avatar name="">
|
|
52
|
-
<Avatar.Initial />
|
|
53
|
-
</Avatar>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
An `onClick` prop can be used, this will make the component focusable using the keyboard, as it uses a `<button>` under the hood.
|
|
57
|
-
|
|
58
|
-
```jsx preview
|
|
59
|
-
<Avatar name="Alice Smith" onClick={() => alert('Thanks for clicking')}>
|
|
60
|
-
<Avatar.Initial />
|
|
61
|
-
</Avatar>
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
When disabled, the onClick won't work.
|
|
65
|
-
|
|
66
|
-
```jsx preview
|
|
67
|
-
<Avatar
|
|
68
|
-
name="Alice Smith"
|
|
69
|
-
disabled
|
|
70
|
-
onClick={() => alert('This message will not appear')}
|
|
71
|
-
>
|
|
72
|
-
<Avatar.Initial />
|
|
73
|
-
</Avatar>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Instead of an image, an icon can be passed.
|
|
77
|
-
|
|
78
|
-
```jsx preview
|
|
79
|
-
<>
|
|
80
|
-
<Avatar>
|
|
81
|
-
<Avatar.Icon is={BatteryMedium} />
|
|
82
|
-
</Avatar>
|
|
83
|
-
</>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Size
|
|
87
|
-
|
|
88
|
-
The available `size`s for this component are: `xs`, `sm`, `md`, `lg`, `xl` and `xxl`. The default is `lg`.
|
|
89
|
-
|
|
90
|
-
```jsx live
|
|
91
|
-
<>
|
|
92
|
-
<Avatar size="xs" name="Alice Smith">
|
|
93
|
-
<Avatar.Image
|
|
94
|
-
alt="Alice Smith's avatar"
|
|
95
|
-
src="https://thispersondoesnotexist.com/image"
|
|
96
|
-
/>
|
|
97
|
-
</Avatar>
|
|
98
|
-
<Avatar size="sm" name="Alice Smith">
|
|
99
|
-
<Avatar.Image
|
|
100
|
-
alt="Alice Smith's avatar"
|
|
101
|
-
src="https://thispersondoesnotexist.com/image"
|
|
102
|
-
/>
|
|
103
|
-
</Avatar>
|
|
104
|
-
<Avatar size="md" name="Alice Smith">
|
|
105
|
-
<Avatar.Image
|
|
106
|
-
alt="Alice Smith's avatar"
|
|
107
|
-
src="https://thispersondoesnotexist.com/image"
|
|
108
|
-
/>
|
|
109
|
-
</Avatar>
|
|
110
|
-
<Avatar size="lg" name="Alice Smith">
|
|
111
|
-
<Avatar.Image
|
|
112
|
-
alt="Alice Smith's avatar"
|
|
113
|
-
src="https://thispersondoesnotexist.com/image"
|
|
114
|
-
/>
|
|
115
|
-
</Avatar>
|
|
116
|
-
<Avatar size="xl" name="Alice Smith">
|
|
117
|
-
<Avatar.Image
|
|
118
|
-
alt="Alice Smith's avatar"
|
|
119
|
-
src="https://thispersondoesnotexist.com/image"
|
|
120
|
-
/>
|
|
121
|
-
</Avatar>
|
|
122
|
-
<Avatar size="xxl" name="Alice Smith">
|
|
123
|
-
<Avatar.Image
|
|
124
|
-
alt="Alice Smith's avatar"
|
|
125
|
-
src="https://thispersondoesnotexist.com/image"
|
|
126
|
-
/>
|
|
127
|
-
</Avatar>
|
|
128
|
-
</>
|
|
129
|
-
```
|
package/dist/docs/Badge.mdx
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Badge
|
|
3
|
-
component: Badge
|
|
4
|
-
description: Highlights a small piece of information
|
|
5
|
-
category: Feedback
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
The `Badge` component can be used to highlight a short piece of information, like a status.
|
|
9
|
-
|
|
10
|
-
```tsx preview live
|
|
11
|
-
<Badge>New Data</Badge>
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Theme
|
|
15
|
-
|
|
16
|
-
These are the available `theme`s for this component: `success`, `warning`, `danger`, `neutral` and `info`. The default is `info`
|
|
17
|
-
|
|
18
|
-
```tsx preview
|
|
19
|
-
<>
|
|
20
|
-
<Badge>Info</Badge>
|
|
21
|
-
<Badge theme="neutral">Neutral</Badge>
|
|
22
|
-
<Badge theme="success">Success</Badge>
|
|
23
|
-
<Badge theme="warning">Warning</Badge>
|
|
24
|
-
<Badge theme="danger">Danger</Badge>
|
|
25
|
-
</>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Size
|
|
29
|
-
|
|
30
|
-
These are the available `size`s for this component: `xs`, `sm` and `md`. The default is `sm`
|
|
31
|
-
|
|
32
|
-
```tsx preview
|
|
33
|
-
<>
|
|
34
|
-
<Badge size="xs">extra small</Badge>
|
|
35
|
-
<Badge size="sm">small</Badge>
|
|
36
|
-
<Badge size="md">medium</Badge>
|
|
37
|
-
</>
|
|
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
|
-
```
|
package/dist/docs/Box.mdx
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Box
|
|
3
|
-
component: Box
|
|
4
|
-
description: Box is our most fundamental layout component
|
|
5
|
-
category: Layout
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
`Box` can largely be seen as an abstraction over the `div` element. It is most useful when used as a generic containing component, and when paired with `as` and `css` allows a high degree of composition and flexibility.
|
|
9
|
-
|
|
10
|
-
`Box` falls back to rendering a `div`, but we should use it to render more sematically relevant container elements e.g. `<Box as="section">`. As an example, a card component could use `Box` to render a `section`, `header` and `footer`.
|
|
11
|
-
|
|
12
|
-
Avoid rendering any of these elements directly in our components — `Box` has all the same flexibility, but with the addition of the powerful `css` prop and various styling utilities based on our themes.
|
|
13
|
-
|
|
14
|
-
## Example
|
|
15
|
-
|
|
16
|
-
To show an example of the benefits of using `Box`, the card below is composed together using `Box` alongside other relevant components:
|
|
17
|
-
|
|
18
|
-
```tsx live
|
|
19
|
-
<Box
|
|
20
|
-
as="article"
|
|
21
|
-
css={{
|
|
22
|
-
border: '1px solid $tonal100',
|
|
23
|
-
borderRadius: '$1',
|
|
24
|
-
overflow: 'hidden',
|
|
25
|
-
width: '320px'
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<Box as="figure" css={{ m: 0, position: 'relative' }}>
|
|
29
|
-
<Image src="http://placekitten.com/320/200" alt="Cats having a nice time" />
|
|
30
|
-
<Text
|
|
31
|
-
as="figcaption"
|
|
32
|
-
size="sm"
|
|
33
|
-
css={{
|
|
34
|
-
bottom: '$3',
|
|
35
|
-
color: 'white',
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
right: '$3'
|
|
38
|
-
}}
|
|
39
|
-
>
|
|
40
|
-
Here is a cute cat
|
|
41
|
-
</Text>
|
|
42
|
-
</Box>
|
|
43
|
-
<Stack gap="4" css={{ px: '$3', py: '$4' }}>
|
|
44
|
-
<Heading as="h2" size="sm">
|
|
45
|
-
Cat
|
|
46
|
-
</Heading>
|
|
47
|
-
<Text>
|
|
48
|
-
The cat (Felis catus) is a domestic species of small carnivorous mammal.
|
|
49
|
-
</Text>
|
|
50
|
-
</Stack>
|
|
51
|
-
</Box>
|
|
52
|
-
```
|
package/dist/docs/Button.mdx
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Button
|
|
3
|
-
component: Button
|
|
4
|
-
description: The Button component is a light wrapper around an HTML button element
|
|
5
|
-
category: Navigation
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
It adds default styling and the `css` prop. By default `primary` theme is displayed with a `solid` appearance.
|
|
9
|
-
|
|
10
|
-
```tsx live
|
|
11
|
-
<Button>Hello world</Button>
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Themes
|
|
15
|
-
|
|
16
|
-
These are the available `themes` for the `Button` component: `primary` (default), `secondary`, `success`, `warning`, `danger`, and `neutral`.
|
|
17
|
-
|
|
18
|
-
```tsx preview
|
|
19
|
-
<>
|
|
20
|
-
<Button>Primary</Button>
|
|
21
|
-
<Button theme="secondary">Secondary</Button>
|
|
22
|
-
<Button theme="success">Success</Button>
|
|
23
|
-
<Button theme="warning">Warning</Button>
|
|
24
|
-
<Button theme="danger">Danger</Button>
|
|
25
|
-
<Button theme="neutral">Neutral</Button>
|
|
26
|
-
</>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Appearance
|
|
30
|
-
|
|
31
|
-
There are two options for the `appearance` property: `solid` and `outline`. There are the available `outline` variations for the `primary`, `secondary` and `neutral` themes.
|
|
32
|
-
|
|
33
|
-
```tsx preview
|
|
34
|
-
<Button appearance="outline">Primary</Button>
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Disabled state
|
|
38
|
-
|
|
39
|
-
Each variation has an `disabled` stated, by setting the `disabled` property.
|
|
40
|
-
|
|
41
|
-
```tsx preview
|
|
42
|
-
<>
|
|
43
|
-
<Button disabled>Disabled button</Button>
|
|
44
|
-
<Button theme="success" disabled>
|
|
45
|
-
Disabled button
|
|
46
|
-
</Button>
|
|
47
|
-
</>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Loading state
|
|
51
|
-
|
|
52
|
-
When using a button to request data or fire an action that has a potential delay, including a loading state to the button can be a useful indicator that stuff is happening. The `isLoading` prop must be a boolean value to activate the loading state.
|
|
53
|
-
|
|
54
|
-
```tsx live
|
|
55
|
-
<Button isLoading> Hello world</Button>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Polymorphism
|
|
59
|
-
|
|
60
|
-
The `Button` component supports polymorphism, therefore depending on whether it receives an `onClick`/`href` as a prop, it will produce a `button` or `link` respectively
|
|
61
|
-
|
|
62
|
-
```tsx preview
|
|
63
|
-
<Button href="http://example.com/">I'm a link</Button>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
```tsx preview
|
|
67
|
-
<Button onClick={() => console.log('clicked')}>I'm a button</Button>
|
|
68
|
-
```
|