@atom-learning/components 2.0.0 → 2.2.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 (118) hide show
  1. package/CHANGELOG.md +0 -26
  2. package/dist/components/accordion/Accordion.d.ts +1 -0
  3. package/dist/components/accordion/AccordionContent.d.ts +1 -0
  4. package/dist/components/accordion/AccordionItem.d.ts +1 -0
  5. package/dist/components/accordion/AccordionTrigger.d.ts +1 -0
  6. package/dist/components/action-icon/ActionIcon.d.ts +1 -0
  7. package/dist/components/alert-dialog/AlertDialog.d.ts +1 -0
  8. package/dist/components/alert-dialog/AlertDialogContent.d.ts +1 -0
  9. package/dist/components/badge/Badge.d.ts +2 -0
  10. package/dist/components/box/Box.d.ts +1 -0
  11. package/dist/components/button/Button.d.ts +1 -0
  12. package/dist/components/calendar/Day.d.ts +1 -0
  13. package/dist/components/carousel/CarouselPagination.d.ts +1 -0
  14. package/dist/components/carousel/CarouselSlide.d.ts +1 -0
  15. package/dist/components/carousel/CarouselSlider.d.ts +1 -0
  16. package/dist/components/checkbox/Checkbox.d.ts +1 -0
  17. package/dist/components/combobox/Combobox.d.ts +1 -0
  18. package/dist/components/combobox/ComboboxInput.d.ts +1 -0
  19. package/dist/components/combobox/ComboboxList.d.ts +1 -0
  20. package/dist/components/combobox/ComboboxOption.d.ts +1 -0
  21. package/dist/components/combobox/ComboboxPopover.d.ts +1 -0
  22. package/dist/components/dialog/Dialog.d.ts +1 -0
  23. package/dist/components/dialog/DialogBackground.d.ts +2 -0
  24. package/dist/components/dialog/DialogClose.d.ts +1 -0
  25. package/dist/components/dialog/DialogContent.d.ts +1 -0
  26. package/dist/components/divider/Divider.d.ts +1 -0
  27. package/dist/components/dropdown-menu/DropdownMenu.d.ts +1 -0
  28. package/dist/components/dropdown-menu/DropdownMenuContent.d.ts +1 -0
  29. package/dist/components/dropdown-menu/DropdownMenuItem.d.ts +1 -0
  30. package/dist/components/dropdown-menu/DropdownMenuSeparator.d.ts +1 -0
  31. package/dist/components/dropdown-menu/DropdownMenuTrigger.d.ts +1 -0
  32. package/dist/components/empty-state/EmptyState.d.ts +2 -0
  33. package/dist/components/empty-state/EmptyStateBody.d.ts +2 -0
  34. package/dist/components/empty-state/EmptyStateImage.d.ts +2 -0
  35. package/dist/components/empty-state/EmptyStateTitle.d.ts +1 -0
  36. package/dist/components/field-wrapper/FieldWrapper.js +1 -1
  37. package/dist/components/field-wrapper/InlineFieldWrapper.js +1 -1
  38. package/dist/components/flex/Flex.d.ts +1 -0
  39. package/dist/components/form/Form.d.ts +1 -0
  40. package/dist/components/grid/Grid.d.ts +1 -0
  41. package/dist/components/heading/Heading.d.ts +1 -0
  42. package/dist/components/icon/Icon.d.ts +1 -0
  43. package/dist/components/image/Image.d.ts +1 -0
  44. package/dist/components/index.d.ts +2 -1
  45. package/dist/components/inline-message/InlineMessage.config.d.ts +5 -0
  46. package/dist/components/inline-message/InlineMessage.config.js +1 -0
  47. package/dist/components/inline-message/InlineMessage.d.ts +541 -0
  48. package/dist/components/inline-message/InlineMessage.js +1 -0
  49. package/dist/components/inline-message/InlineMessage.types.d.ts +1 -0
  50. package/dist/components/inline-message/index.d.ts +1 -0
  51. package/dist/components/input/Input.d.ts +1 -0
  52. package/dist/components/label/Label.d.ts +1 -0
  53. package/dist/components/link/Link.d.ts +1 -0
  54. package/dist/components/list/List.d.ts +2 -0
  55. package/dist/components/navigation/NavigationMenu.d.ts +15 -0
  56. package/dist/components/navigation/NavigationMenu.js +1 -0
  57. package/dist/components/navigation/NavigationMenuContext.d.ts +7 -0
  58. package/dist/components/navigation/NavigationMenuContext.js +1 -0
  59. package/dist/components/navigation/NavigationMenuDropdown.d.ts +7 -0
  60. package/dist/components/navigation/NavigationMenuDropdown.js +1 -0
  61. package/dist/components/navigation/NavigationMenuItem.d.ts +287 -0
  62. package/dist/components/navigation/NavigationMenuItem.js +1 -0
  63. package/dist/components/navigation/index.d.ts +1 -0
  64. package/dist/components/notification-badge/NotificationBadge.d.ts +2 -0
  65. package/dist/components/popover/Popover.d.ts +1 -0
  66. package/dist/components/popover/PopoverContent.d.ts +1 -0
  67. package/dist/components/progress-bar/ProgressBar.d.ts +1 -0
  68. package/dist/components/radio-button/RadioButton.d.ts +1 -0
  69. package/dist/components/radio-button/RadioButtonGroup.d.ts +1 -0
  70. package/dist/components/radio-button-field/RadioButtonField.js +1 -1
  71. package/dist/components/radio-card/RadioCard.d.ts +1 -0
  72. package/dist/components/select/Select.d.ts +1 -0
  73. package/dist/components/slider/Slider.d.ts +1 -0
  74. package/dist/components/stack/Stack.d.ts +1 -0
  75. package/dist/components/stack-content/StackContent.d.ts +1 -0
  76. package/dist/components/stepper/StepperStepBullet.d.ts +2 -0
  77. package/dist/components/stepper/StepperStepContainer.d.ts +2 -0
  78. package/dist/components/stepper/StepperStepLabel.d.ts +2 -0
  79. package/dist/components/switch/Switch.d.ts +1 -0
  80. package/dist/components/table/Table.d.ts +1 -0
  81. package/dist/components/table/TableBody.d.ts +1 -0
  82. package/dist/components/table/TableCell.d.ts +1 -0
  83. package/dist/components/table/TableFooter.d.ts +1 -0
  84. package/dist/components/table/TableFooterCell.d.ts +1 -0
  85. package/dist/components/table/TableHeader.d.ts +1 -0
  86. package/dist/components/table/TableHeaderCell.d.ts +1 -0
  87. package/dist/components/table/TableRow.d.ts +1 -0
  88. package/dist/components/tabs/TabTrigger.d.ts +1 -0
  89. package/dist/components/tabs/Tabs.d.ts +2 -0
  90. package/dist/components/tabs/TabsTriggerList.d.ts +1 -0
  91. package/dist/components/text/Text.d.ts +1 -0
  92. package/dist/components/textarea/Textarea.d.ts +1 -0
  93. package/dist/components/toast/Toast.d.ts +1 -0
  94. package/dist/components/toggle-group/ToggleGroupButton.d.ts +2 -0
  95. package/dist/components/toggle-group/ToggleGroupItem.d.ts +2 -0
  96. package/dist/components/toggle-group/ToggleGroupRoot.d.ts +1 -0
  97. package/dist/components/toggle-group/index.d.ts +5 -0
  98. package/dist/components/tooltip/TooltipContent.d.ts +1 -0
  99. package/dist/components/video/Video.d.ts +2 -0
  100. package/dist/docgen.json +1 -1
  101. package/dist/docs/CheckboxField.mdx +1 -1
  102. package/dist/docs/DateField.mdx +2 -2
  103. package/dist/docs/FieldWrapper.mdx +1 -1
  104. package/dist/docs/Form.mdx +3 -3
  105. package/dist/docs/InlineMessage.mdx +52 -0
  106. package/dist/docs/InputField.mdx +2 -2
  107. package/dist/docs/NavigationMenu.mdx +113 -0
  108. package/dist/docs/RadioButtonField.mdx +2 -2
  109. package/dist/docs/SelectField.mdx +2 -2
  110. package/dist/docs/TextareaField.mdx +1 -1
  111. package/dist/index.cjs.js +1 -1
  112. package/dist/index.js +1 -1
  113. package/dist/stitches.d.ts +10 -0
  114. package/package.json +4 -2
  115. package/dist/components/validation-error/ValidationError.d.ts +0 -7
  116. package/dist/components/validation-error/ValidationError.js +0 -1
  117. package/dist/components/validation-error/index.d.ts +0 -1
  118. package/dist/docs/ValidationError.mdx +0 -12
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Checkbox Field
3
3
  component: CheckboxField
4
- description: Combines a Checkbox with a Label and ValidationError
4
+ description: Combines a Checkbox with a Label and InlineMessage
5
5
  category: Form fields
6
6
  ---
7
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Date Field
3
3
  component: DateField
4
- description: DateField renders a field composed of an DateInput, a Label and a ValidationError
4
+ description: DateField renders a field composed of an DateInput, a Label and a InlineMessage
5
5
  category: Form fields
6
6
  ---
7
7
 
@@ -11,7 +11,7 @@ In addition to text `Label` (required) and a validation error (optional), `DateF
11
11
  `DateField`’s `css` prop will be applied to a containing `Box`—the styling of the individual components inside `DateField` cannot be altered.
12
12
 
13
13
  Err on the side of using consistent form fields, but if you really need something with different styling then consider composing your own field from the
14
- `DateInput`, `Label` and `ValidationError` components.
14
+ `DateInput`, `Label` and `InlineMessage` components.
15
15
 
16
16
  ```tsx preview
17
17
  <Form>
@@ -5,7 +5,7 @@ description: A utility component to help with composing consistent form fields
5
5
  category: Form primitives
6
6
  ---
7
7
 
8
- `FieldWrapper` renders a `Label` and (when applicable) a `ValidationError`. Use it to wrap any type of input to create a consistent set of form fields.
8
+ `FieldWrapper` renders a `Label` and (when applicable) a `InlineMessage`. Use it to wrap any type of input to create a consistent set of form fields.
9
9
 
10
10
  ```tsx preview
11
11
  <FieldWrapper label="Example Field" fieldId="example">
@@ -174,7 +174,7 @@ Here's an example using the `persist` prop:
174
174
 
175
175
  ## Composing form field components
176
176
 
177
- It’s easy to compose your own custom form fields from the low-level components in this library (`Input`, `Label`, `ValidationError` etc) but there are some requirements that your new
177
+ It’s easy to compose your own custom form fields from the low-level components in this library (`Input`, `Label`, `InlineMessage` etc) but there are some requirements that your new
178
178
  field must meet in order to be fully compatible with our `Form`.
179
179
 
180
180
  ### Props
@@ -183,7 +183,7 @@ Your custom form field component must take the props specified in [General](#Gen
183
183
 
184
184
  #### error
185
185
 
186
- `error` should be displayed in a `ValidationError` when present. You don’t need to pass `error` to your component manually; the `Form` will pass it in automatically when appropriate.
186
+ `error` should be displayed in a `InlineMessage` when present. You don’t need to pass `error` to your component manually; the `Form` will pass it in automatically when appropriate.
187
187
 
188
188
  To properly retrieve the error in both static and dynamic fields it is necessary to use the `useFieldError` hook stored in the form directory, that accepts a field name parameter.
189
189
 
@@ -258,7 +258,7 @@ const EmailField = ({ css, name, validation, required, ...rest }) => {
258
258
  error={error}
259
259
  {...rest}
260
260
  />
261
- {error && <ValidationError css={{ mt: '$1' }}>{error}</ValidationError>}
261
+ {error && <InlineMessage css={{ mt: '$1' }}>{error}</InlineMessage>}
262
262
  </FieldWrapper>
263
263
  )
264
264
  }
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: Inline Message
3
+ component: InlineMessage
4
+ description: Inline feedback message with an optional icon
5
+ category: Feedback
6
+ ---
7
+
8
+ Inline messages consist of an inline feedback message in the form of simple text that inform the user of relevant information, revealed in context.
9
+
10
+ ```tsx preview
11
+ <InlineMessage>This is an Inline Message</InlineMessage>
12
+ ```
13
+
14
+ ## Theme
15
+
16
+ These are the available `theme`s for this component: `success`, `warning`, `error`, `neutral` and `info`. The default is `error` (due to most frequent context).
17
+
18
+ ```tsx preview
19
+ <>
20
+ <InlineMessage theme="error">This is an error Inline Message</InlineMessage>
21
+ <InlineMessage theme="warning">
22
+ This is a warning Inline Message
23
+ </InlineMessage>
24
+ <InlineMessage theme="success">
25
+ This is a success Inline Message
26
+ </InlineMessage>
27
+ <InlineMessage theme="info">This is an info Inline Message</InlineMessage>
28
+ <InlineMessage theme="neutral">
29
+ This is a neutral Inline Message
30
+ </InlineMessage>
31
+ </>
32
+ ```
33
+
34
+ ## Size
35
+
36
+ These are the available `size`s for this component: `xs`, `sm` and `md`. The default is `sm`
37
+
38
+ ```tsx preview
39
+ <>
40
+ <InlineMessage size="xs">This is an xs Inline Message</InlineMessage>
41
+ <InlineMessage size="sm">This is a sm Inline Message</InlineMessage>
42
+ <InlineMessage size="md">This is a md Inline Message</InlineMessage>
43
+ </>
44
+ ```
45
+
46
+ ## Icon
47
+
48
+ Each theme has a specific icon it should export, so showing or hiding an icon is simply done using the `showIcon` prop. Default is `true`.
49
+
50
+ ```tsx preview
51
+ <InlineMessage showIcon={false}>This is an Inline Message</InlineMessage>
52
+ ```
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Input Field
3
3
  component: InputField
4
- description: InputField renders a field composed of an Input, a Label and a ValidationError
4
+ description: InputField renders a field composed of an Input, a Label and a InlineMessage
5
5
  category: Form fields
6
6
  ---
7
7
 
@@ -11,7 +11,7 @@ In addition to text `Label` (required) and a validation error (optional), `Input
11
11
  `InputField`’s `css` prop will be applied to a containing `Box`—the styling of the individual components inside `InputField` cannot be altered.
12
12
 
13
13
  Err on the side of using consistent form fields, but if you really need something with different styling then consider composing your own field from the
14
- `Input`, `Label` and `ValidationError` components.
14
+ `Input`, `Label` and `InlineMessage` components.
15
15
 
16
16
  ```tsx preview
17
17
  <Form>
@@ -0,0 +1,113 @@
1
+ ---
2
+ title: NavigationMenu
3
+ component: NavigationMenu,NavigationMenu.Link,NavigationMenu.Dropdown,NavigationMenu.DropdownContent,NavigationMenu.DropdownItem
4
+ description: A collection of links for navigating apps.
5
+ category: Navigation
6
+ ---
7
+
8
+ `NavigationMenu` exports many components that combine to form a navigation menu.
9
+
10
+ ```tsx preview
11
+ <NavigationMenu>
12
+ <NavigationMenu.Link href="/overview/introduction">
13
+ Introduction
14
+ </NavigationMenu.Link>
15
+ <NavigationMenu.Dropdown title="Theme">
16
+ <NavigationMenu.DropdownContent>
17
+ <NavigationMenu.DropdownItem href="/theme/colours">
18
+ Colours
19
+ </NavigationMenu.DropdownItem>
20
+ <NavigationMenu.DropdownItem href="/theme/effects">
21
+ Effects
22
+ </NavigationMenu.DropdownItem>
23
+ <NavigationMenu.DropdownItem href="/theme/icons">
24
+ Icons
25
+ </NavigationMenu.DropdownItem>
26
+ </NavigationMenu.DropdownContent>
27
+ </NavigationMenu.Dropdown>
28
+ </NavigationMenu>
29
+ ```
30
+
31
+ ## With client side routing
32
+
33
+ `NavigationMenu.Dropdown`, `NavigationMenu.DropdownItem` and `NavigationMenu.Link` can be passed an `active` prop for instances when you want to highlight the currently active route. See below for examples using client side routing with the `NavigationMenu.Link` component. The same method can be applied to `NavigationMenu.Dropdown` and `NavigationMenu.DropdownItem`.
34
+
35
+ #### Example using React Router
36
+
37
+ ```tsx
38
+ const Link = ({ href, ...props }) => {
39
+ const { pathname } = useLocation()
40
+ const isActive = path === href
41
+
42
+ return (
43
+ <NavigationMenu.Link active={isActive} {...props}>
44
+ Introduction
45
+ </NavigationMenu.Link>
46
+ )
47
+ }
48
+ ```
49
+
50
+ #### Example using Next JS
51
+
52
+ ```tsx
53
+ const Link = ({ href, ...props }) => {
54
+ const router = useRouter()
55
+ const isActive = router.asPath === href
56
+
57
+ return (
58
+ <NavigationMenu.Link active={isActive} {...props}>
59
+ Introduction
60
+ </NavigationMenu.Link>
61
+ )
62
+ }
63
+ ```
64
+
65
+ ## Changing the layout of the dropdown content
66
+
67
+ By default, dropdown items inside of `NavigationMenu.DropdownContent` will stack.
68
+
69
+ If you want to change the way items are displayed, you can add custom styling to `NavigationMenu.DropdownContent`.
70
+
71
+ In the below example the styling of `NavigationMenu.DropdownContent` has been changed to allow a grid layout.
72
+
73
+ ```tsx preview
74
+ <NavigationMenu>
75
+ <NavigationMenu.Link href="/overview/introduction">
76
+ Introduction
77
+ </NavigationMenu.Link>
78
+ <NavigationMenu.Dropdown title="Theme">
79
+ <NavigationMenu.DropdownContent
80
+ css={{
81
+ display: 'grid',
82
+ gap: '$1',
83
+ gridAutoFlow: 'column',
84
+ width: 500,
85
+ gridTemplateRows: 'repeat(2, 1fr)'
86
+ }}
87
+ >
88
+ {['colours', 'icons', 'effects', 'typography'].map((item) => (
89
+ <NavigationMenu.DropdownItem href={`/theme/${item}`}>
90
+ <Text
91
+ css={{
92
+ mb: '0.75rem',
93
+ textTransform: 'capitalize'
94
+ }}
95
+ >
96
+ {item}
97
+ </Text>
98
+ <Text
99
+ css={{
100
+ color: 'inherit',
101
+ lineHeight: 1.5,
102
+ fontWeight: 400,
103
+ fontSize: 14
104
+ }}
105
+ >
106
+ This is some example text about {item}
107
+ </Text>
108
+ </NavigationMenu.DropdownItem>
109
+ ))}
110
+ </NavigationMenu.DropdownContent>
111
+ </NavigationMenu.Dropdown>
112
+ </NavigationMenu>
113
+ ```
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  title: Radio Button Field
3
3
  component: RadioButtonField
4
- description: Combines a RadioButtonGroup and RadioButtons with a Label and ValidationError
4
+ description: Combines a RadioButtonGroup and RadioButtons with a Label and InlineMessage
5
5
  category: Form fields
6
6
  ---
7
7
 
8
- `RadioButtonField` wraps a `RadioButtonGroup` to provide a legend and a `ValidationError`. `RadioButtonField.Item` renders an individual `RadioButton` with an inline `Label`.
8
+ `RadioButtonField` wraps a `RadioButtonGroup` to provide a legend and a `InlineMessage`. `RadioButtonField.Item` renders an individual `RadioButton` with an inline `Label`.
9
9
 
10
10
  **Note**: a `RadioButtonField.Item`’s `value` **must** be a `string`.
11
11
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  title: Select Field
3
3
  component: SelectField
4
- description: Wraps a Select with a Label and ValidationError
4
+ description: Wraps a Select with a Label and InlineMessage
5
5
  category: Form fields
6
6
  ---
7
7
 
8
- `SelectField` wraps a `Select` with a `Label` and a `ValidationError` to provide consistent behaviour and layout.
8
+ `SelectField` wraps a `Select` with a `Label` and a `InlineMessage` to provide consistent behaviour and layout.
9
9
 
10
10
  ```tsx preview
11
11
  <Form>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Textarea Field
3
3
  component: TextareaField
4
- description: TextareaField renders a field composed of a Textarea, a Label and a ValidationError
4
+ description: TextareaField renders a field composed of a Textarea, a Label and a InlineMessage
5
5
  category: Form fields
6
6
  ---
7
7