@atom-learning/components 2.25.0-beta.1 → 2.25.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +207 -0
  2. package/dist/components/accordion/AccordionContent.js +1 -1
  3. package/dist/components/accordion/AccordionItem.js +1 -1
  4. package/dist/components/alert-dialog/AlertDialogContent.js +1 -1
  5. package/dist/components/avatar/Avatar.js +1 -1
  6. package/dist/components/button/Button.js +1 -1
  7. package/dist/components/calendar/Calendar.js +1 -1
  8. package/dist/components/carousel/CarouselArrows.js +1 -1
  9. package/dist/components/carousel/CarouselSlide.js +1 -1
  10. package/dist/components/checkbox-field/CheckboxField.js +1 -1
  11. package/dist/components/chip/Chip.js +1 -1
  12. package/dist/components/chip/ChipGroup.js +1 -1
  13. package/dist/components/chip-dismissible-group/ChipDismissibleGroupRoot.js +1 -1
  14. package/dist/components/data-table/DataTable.d.ts +24 -2
  15. package/dist/components/data-table/DataTable.js +1 -1
  16. package/dist/components/data-table/DataTable.types.d.ts +28 -0
  17. package/dist/components/data-table/DataTable.types.js +1 -0
  18. package/dist/components/data-table/DataTableBody.js +1 -1
  19. package/dist/components/data-table/DataTableContext.d.ts +13 -11
  20. package/dist/components/data-table/DataTableContext.js +1 -1
  21. package/dist/components/data-table/DataTableDataCell.js +1 -1
  22. package/dist/components/data-table/DataTableError.d.ts +7 -0
  23. package/dist/components/data-table/DataTableError.js +1 -0
  24. package/dist/components/data-table/DataTableGlobalFilter.js +1 -1
  25. package/dist/components/data-table/DataTableLoading.d.ts +273 -0
  26. package/dist/components/data-table/DataTableLoading.js +1 -0
  27. package/dist/components/data-table/DataTableRow.js +1 -1
  28. package/dist/components/data-table/DataTableTable.js +1 -1
  29. package/dist/components/data-table/getNewAsyncData.d.ts +3 -0
  30. package/dist/components/data-table/getNewAsyncData.js +1 -0
  31. package/dist/components/data-table/pagination/Pagination.d.ts +1 -3
  32. package/dist/components/data-table/pagination/Pagination.js +1 -1
  33. package/dist/components/data-table/pagination/PaginationButtons.d.ts +1 -0
  34. package/dist/components/data-table/pagination/PaginationButtons.js +1 -1
  35. package/dist/components/dialog/DialogContent.js +1 -1
  36. package/dist/components/dismissible/DismissibleRoot.js +1 -1
  37. package/dist/components/dismissible/DismissibleTrigger.js +1 -1
  38. package/dist/components/dropdown-menu/DropdownMenuLinkItem.js +1 -1
  39. package/dist/components/field-wrapper/FieldDescription.js +1 -1
  40. package/dist/components/field-wrapper/InlineFieldWrapper.js +1 -1
  41. package/dist/components/file-input/FileInput.js +1 -1
  42. package/dist/components/grid/Grid.js +1 -1
  43. package/dist/components/icon/Icon.js +1 -1
  44. package/dist/components/index.d.ts +11 -11
  45. package/dist/components/inline-message/InlineMessage.js +1 -1
  46. package/dist/components/label/Label.js +1 -1
  47. package/dist/components/link/Link.js +1 -1
  48. package/dist/components/loader/Loader.js +1 -1
  49. package/dist/components/markdown-content/components/MarkdownEmphasis.d.ts +266 -0
  50. package/dist/components/markdown-content/components/MarkdownEmphasis.js +1 -1
  51. package/dist/components/markdown-content/components/MarkdownHeading.js +1 -1
  52. package/dist/components/markdown-content/components/MarkdownImage.js +1 -1
  53. package/dist/components/markdown-content/components/MarkdownInlineCode.js +1 -1
  54. package/dist/components/markdown-content/components/MarkdownLink.js +1 -1
  55. package/dist/components/markdown-content/components/MarkdownListItem.js +1 -1
  56. package/dist/components/markdown-content/components/MarkdownParagraph.js +1 -1
  57. package/dist/components/markdown-content/components/MarkdownStrong.js +1 -1
  58. package/dist/components/markdown-content/components/MarkdownThematicBreak.js +1 -1
  59. package/dist/components/markdown-content/components/index.d.ts +1 -1
  60. package/dist/components/navigation/NavigationMenuDropdownContent.d.ts +2 -7
  61. package/dist/components/navigation/NavigationMenuDropdownContent.js +1 -1
  62. package/dist/components/navigation/NavigationMenuDropdownTrigger.js +1 -1
  63. package/dist/components/navigation/NavigationMenuLink.js +1 -1
  64. package/dist/components/notification-badge/NotificationBadge.js +1 -1
  65. package/dist/components/number-input/NumberInput.js +1 -1
  66. package/dist/components/number-input-field/NumberInputField.js +1 -1
  67. package/dist/components/popover/PopoverContent.js +1 -1
  68. package/dist/components/radio-button/RadioButton.js +1 -1
  69. package/dist/components/radio-button-field/RadioButtonField.js +1 -1
  70. package/dist/components/radio-button-field/RadioField.js +1 -1
  71. package/dist/components/radio-card/RadioCardGroup.js +1 -1
  72. package/dist/components/search-input/SearchInput.js +1 -1
  73. package/dist/components/select-field/SelectField.js +1 -1
  74. package/dist/components/sidedrawer/SidedrawerAccordion/SidedrawerAccordionContent.js +1 -1
  75. package/dist/components/sidedrawer/SidedrawerContent.js +1 -1
  76. package/dist/components/slider-field/SliderField.js +1 -1
  77. package/dist/components/stack-content/StackContent.js +1 -1
  78. package/dist/components/stepper/StepperStepBack.js +1 -1
  79. package/dist/components/table/TableHeader.js +1 -1
  80. package/dist/components/tabs/Tabs.js +1 -1
  81. package/dist/components/tabs/utils.js +1 -1
  82. package/dist/components/toast/Toast.js +1 -1
  83. package/dist/components/toast/ToastProvider.js +1 -1
  84. package/dist/components/toggle-group/ToggleGroupButton.js +1 -1
  85. package/dist/components/tooltip/TooltipContent.js +1 -1
  86. package/dist/components/video/Video.js +1 -1
  87. package/dist/docgen.json +1 -1
  88. package/dist/docs/Avatar.mdx +1 -1
  89. package/dist/docs/ChipDismissibleGroup.mdx +1 -1
  90. package/dist/docs/ChipToggleGroup.mdx +1 -1
  91. package/dist/docs/DataTable.mdx +86 -1
  92. package/dist/docs/Dismissible.mdx +1 -1
  93. package/dist/docs/DismissibleGroup.mdx +1 -1
  94. package/dist/docs/Tabs.mdx +1 -1
  95. package/dist/docs/Toast.mdx +1 -0
  96. package/dist/docs/ToggleGroup.mdx +1 -1
  97. package/dist/index.cjs.js +1 -1
  98. package/dist/index.js +1 -1
  99. package/dist/utilities/hooks/useCallbackRef.js +1 -1
  100. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Avatar
3
- component: Avatar
3
+ component: Avatar,Avatar.Image,Avatar.Initial,Avatar.Placeholder,Avatar.Icon
4
4
  description: Show a thumbnail representation of an individual or entity.
5
5
  category: Media
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Chip Dismissible Group
3
- component: ChipDismissibleGroup
3
+ component: ChipDismissibleGroupRoot,ChipDismissibleGroup.Item
4
4
  description: Combines the DismissibleGroup logic together with the Chip primitive styling
5
5
  category: Feedback
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Chip Toggle Group
3
- component: ChipToggleGroup
3
+ component: ChipToggleGroupRoot,ChipToggleGroup.Item
4
4
  description: Combines the Toggle Group radix component with the Chip primitive styling
5
5
  category: Feedback
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: DataTable
3
- component: DataTable, DataTable.Table, DataTable.Head, DataTable.HeaderCell, DataTable.Body, DataTable.Row, DataTable.DataCell, DataTable.GlobalFilter
3
+ component: DataTable, DataTable.Table, DataTable.Head, DataTable.HeaderCell, DataTable.Body, DataTable.Row, DataTable.DataCell, DataTable.GlobalFilter, DataTable.Loading, DataTable.Error
4
4
  description: Displays tabular data with features such as sorting and pagination
5
5
  category: Content
6
6
  ---
@@ -133,6 +133,91 @@ Note also that `useDataTable` can only be called by a child component of `DataTa
133
133
  </DataTable>
134
134
  ```
135
135
 
136
+ ### Server-side pagination and sorting
137
+
138
+ `DataTable` can be used with local pagination or server-side pagination (getting only the data needed for the current page). To use one or the other, you have to use the `data` or `getAsyncData` prop respectively.
139
+
140
+ The `getAsyncData` function accepts an object with the necessary parameters to get the relevant piece of data for the current page and order. All the parameters are optional, with these defaults:
141
+
142
+ ```
143
+ {
144
+ pageIndex: 0,
145
+ pageSize: 10,
146
+ sortBy: undefined,
147
+ sortDirection: undefined,
148
+ globalFilter: ''
149
+ }
150
+ ```
151
+
152
+ The response from the `getAsyncData` function must match the following schema:
153
+
154
+ ```ts
155
+ {
156
+ results: Array<Record<string, unknown>> // your current page data, sorted if specified
157
+ total: number // the total number of elements in your data
158
+ }
159
+ ```
160
+
161
+ A loading state using `<DataTable.Loading>` is automatically included in `DataTable` which is visible while the `getAsyncData` promise is pending.
162
+
163
+ You can use `DataTable.Error` to display your own error component when the `getAsyncData` function promise rejects. Notice `DataTable.Error` doesn't render anything on its own, but whatever is passed as childern.
164
+
165
+ ```tsx
166
+ <DataTable
167
+ columns={columns}
168
+ defaultPageSize={10}
169
+ defaultSort={{ column: 'name', direction: 'asc' }}
170
+ initialState={{ pagination: { pageIndex: 0, pageSize: 10 } }}
171
+ getAsyncData={async ({
172
+ pageIndex,
173
+ pageSize,
174
+ sortBy,
175
+ sortDirection,
176
+ globalFilter
177
+ }) => {
178
+ const params = new URLSearchParams({
179
+ page: pageIndex,
180
+ pageSize,
181
+ order: sortBy,
182
+ dir: sortDirection,
183
+ search: globalFilter
184
+ })
185
+ const response = await fetch(`https://your-api?${params.toString()}`)
186
+ const { results, total } = await response.json()
187
+
188
+ return { results, total }
189
+ }}
190
+ >
191
+ <DataTable.Table sortable css={{ mb: '$4', minWidth: '500px' }} />
192
+ <DataTable.Error>
193
+ {(retry) => <Button onClick={retry}>Try again</Button>}
194
+ </DataTable.Error>
195
+ <DataTable.Pagination />
196
+ </DataTable>
197
+ ```
198
+
199
+ `DataTable.Error` provides a `retry` function to the children which allows you to recall the `getAsyncData` function. The `retry` function can be called with all the paginated parameters as an optional object. If no parameters are provided, `retry` will be called with the last paginated options.
200
+
201
+ ```tsx
202
+ <DataTable.Error>
203
+ {(retry) => (
204
+ <Button
205
+ onClick={() =>
206
+ retry?.({
207
+ pageIndex: 5,
208
+ pageSize: 10,
209
+ sortBy: 'name',
210
+ sortDirection: 'asc',
211
+ globalFilter: ''
212
+ })
213
+ }
214
+ >
215
+ Retry
216
+ </Button>
217
+ )}
218
+ </DataTable.Error>
219
+ ```
220
+
136
221
  ## Features
137
222
 
138
223
  ### Search
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Dismissible
3
- component: Dismissible
3
+ component: DismissibleRoot,Dismissible.Trigger
4
4
  description: An element with a dismiss button which removes it from the view
5
5
  category: Primitives
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Dismissible Group
3
- component: DismissibleGroup
3
+ component: DismissibleGroupRoot,DismissibleGroup.Item,DismissibleGroup.Trigger
4
4
  description: A set of dismissible elements.
5
5
  category: Primitives
6
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Tabs
3
- component: Tabs
3
+ component: Tabs,TriggerListWrapper,TabTrigger
4
4
  description: Tabs is a component that provides different sections of content that are displayed one at a time.
5
5
  category: Layout
6
6
  ---
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  title: Toast
3
+ component: ToastProvider
3
4
  description: A toast notification that gives non-intrusive feedback to the user and times out automatically
4
5
  category: Feedback
5
6
  ---
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Toggle Group
3
- component: ToggleGroup
3
+ component: ToggleGroupRoot,ToggleGroup.Button,ToggleGroup.Item
4
4
  description: Extends functionality the Toggle Group radix component
5
5
  category: Content
6
6
  ---