@seamapi/react 1.58.1 → 1.59.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.
package/README.md CHANGED
@@ -87,7 +87,7 @@ export function App() {
87
87
  <seam-device-table publishable-key="your_publishable_key"></seam-device-table>
88
88
  <script
89
89
  type="module"
90
- src="https://react.seam.co/v/1.58.1/dist/elements.js"
90
+ src="https://react.seam.co/v/1.59.1/dist/elements.js"
91
91
  ></script>
92
92
  </body>
93
93
  ```
@@ -185,6 +185,55 @@ This makes them compatible with native CSS and most CSS-in-JS systems, e.g., [Em
185
185
  [Emotion]: https://emotion.sh/
186
186
  [styled-components]: https://styled-components.com/
187
187
 
188
+ #### Using inside a modal dialog
189
+
190
+ A Seam Component must be a child of a DOM element with the `seam-components` class name
191
+ for the CSS styles to work properly.
192
+ Normally, all Seam Components are rendered as child of the `<SeamProvider />`
193
+ which ensures this condition.
194
+
195
+ React implementations of the modal dialog pattern often allow specifying
196
+ the contents of the modal as a child element, yet render the contents of the modal
197
+ in the DOM under a different parent element outside of the current branch of the DOM tree.
198
+ Thus, even when a Seam Component is logically rendered as a child of the `<SeamProvider />`
199
+ in the React tree, it will be rendered outside of that branch of tree in the actual DOM.
200
+
201
+ > This concern does not apply when using the Seam Components as web components.
202
+ > Each custom element already wraps the underlying component inside a container element with the correct class name.
203
+ > The lack of a default container element for each React component
204
+ > is an intentional decision to align with the standard React provider design pattern.
205
+
206
+ To handle this special case, use the `seamComponentsClassName` on the container that will
207
+ wrap the dialog content, e.g.,
208
+
209
+ ```ts
210
+ import { useState } from "react"
211
+ import { Button, Dialog } from "@mui/material"
212
+ import { seamComponentsClassName, DeviceTable } from "@seam/react"
213
+
214
+ function DeviceTableInsideModal() {
215
+ const [open, setOpen] = useState(false)
216
+ const handleOpen = () => {
217
+ setOpen(true)
218
+ }
219
+ const handleClose = () => {
220
+ setOpen(false)
221
+ }
222
+ return (
223
+ <>
224
+ <Button onClick={handleOpen}>Open</Button>
225
+ <Dialog
226
+ className={seamComponentsClassName}
227
+ open={open}
228
+ onClose={handleClose}
229
+ >
230
+ <DeviceTable />
231
+ </Dialog>
232
+ </>
233
+ )
234
+ }
235
+ ```
236
+
188
237
  ### Fonts
189
238
 
190
239
  > Fonts are automatically included unless using `<SeamProvider disableFontInjection />`.