@atom-learning/components 2.15.0 → 2.17.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.
@@ -11,7 +11,7 @@ category: Content
11
11
 
12
12
  ## Anatomy
13
13
 
14
- The root `DataTable` component manages the table's state and exposes it via the React Context API. This state can be accessed by any child components by calling `useDataTable`.
14
+ The root `DataTable` component manages the table's state and exposes it via the React Context API. This state can be accessed by any child components by calling `useDataTable`. You can pass an `initialState` prop to `DataTable` as described in the [`@tanstack/react-table` docs](https://tanstack.com/table/v8/docs/api/core/table#initialstate).
15
15
 
16
16
  Other `DataTable` components call `useDataTable` and provide useful default implementations for common patterns. For example, `DataTable.Head` will render a header for every column defined in the parent `DataTable`. `DataTable.Body` will render a row for every data item. `DataTable.Table` combines both `DataTable.Head` and `DataTable.Body`.
17
17
 
@@ -153,4 +153,4 @@ If `DataTable`'s `isSortable` state is `true`, then `DataTable.Header` will be c
153
153
 
154
154
  ### Pagination
155
155
 
156
- `DataTable.Pagination` can be passed as a child to `DataTable` to render the pagination UI and configure the parent `DataTable` to paginate its data.
156
+ `DataTable.Pagination` can be passed as a child to `DataTable` to render the pagination UI and configure the parent `DataTable` to paginate its data. Note: there is currently a bug where `DataTable` will render all rows on the initial render, even when paginated. There is no visible effect, but it can cause performance issues on large tables. The workaround for this is to pass an `initialState` prop to `DataTable`. E.g. `initialState={pagination: {pageSize: 5, pageIndex: 0}}`. This will force pagination to apply properly on the initial render. Make sure the `pagination` prop matches the config you use in `DataTable.Pagination`, as the latter will take precedence after the initial render.
@@ -12,7 +12,8 @@ category: Navigation
12
12
  <NavigationMenu.Link href="/overview/introduction">
13
13
  Introduction
14
14
  </NavigationMenu.Link>
15
- <NavigationMenu.Dropdown title="Theme">
15
+ <NavigationMenu.Dropdown id="1">
16
+ <NavigationMenu.DropdownTrigger>Theme</NavigationMenu.DropdownTrigger>
16
17
  <NavigationMenu.DropdownContent>
17
18
  <NavigationMenu.DropdownItem href="/theme/colours">
18
19
  Colours
@@ -75,7 +76,8 @@ In the below example the styling of `NavigationMenu.DropdownContent` has been ch
75
76
  <NavigationMenu.Link href="/overview/introduction">
76
77
  Introduction
77
78
  </NavigationMenu.Link>
78
- <NavigationMenu.Dropdown title="Theme">
79
+ <NavigationMenu.Dropdown id="1">
80
+ <NavigationMenu.DropdownTrigger>Theme</NavigationMenu.DropdownTrigger>
79
81
  <NavigationMenu.DropdownContent
80
82
  css={{
81
83
  display: 'grid',
@@ -102,7 +104,7 @@ In the below example the styling of `NavigationMenu.DropdownContent` has been ch
102
104
 
103
105
  DropdownItem gives a lot of flexibility. It's an easy to compose it for own purposes.
104
106
 
105
- ```
107
+ ```tsx
106
108
  <NavigationMenu.DropdownItem href="/" active>
107
109
  <Grid
108
110
  css={{
@@ -119,3 +121,24 @@ DropdownItem gives a lot of flexibility. It's an easy to compose it for own purp
119
121
  </Grid>
120
122
  </NavigationMenu.DropdownItem>
121
123
  ```
124
+
125
+ ## Dropdown Trigger
126
+
127
+ NavigationMenu.Dropdown gives you the way to pass your own trigger component inside the `NavigationMenu.DropdownTrigger`.
128
+ The children of NavigationMenu.DropdownTrigger can be a plain text or more complex component.
129
+
130
+ ```tsx
131
+ <NavigationMenu.Dropdown id="1">
132
+ <NavigationMenu.DropdownTrigger>
133
+ <Avatar />
134
+ </NavigationMenu.DropdownTrigger>
135
+ <NavigationMenu.DropdownContent>// content</NavigationMenu.DropdownContent>
136
+ </NavigationMenu.Dropdown>
137
+
138
+ <NavigationMenu.Dropdown id="2">
139
+ <NavigationMenu.DropdownTrigger>
140
+ Plain text
141
+ </NavigationMenu.DropdownTrigger>
142
+ <NavigationMenu.DropdownContent>// content</NavigationMenu.DropdownContent>
143
+ </NavigationMenu.Dropdown>
144
+ ```