@overdoser/react-toolkit 0.0.7 → 0.0.8
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/components/Popover/Popover.d.ts +16 -1
- package/index.js +1436 -1411
- package/llms.txt +12 -2
- package/manifest.json +2 -1
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -222,7 +222,8 @@ Mode B example:
|
|
|
222
222
|
Import: `import { Popover } from '@overdoser/react-toolkit'`
|
|
223
223
|
|
|
224
224
|
Props:
|
|
225
|
-
- `trigger: ReactNode` — required.
|
|
225
|
+
- `trigger: ReactNode` — required. By default, wrapped in an internal `<button>` (so a plain `'Help'` string or an icon is fine).
|
|
226
|
+
- `asChild?: boolean` — default `false`. When `true` and `trigger` is a single React element, the trigger is rendered **as-is** with click/aria/ref merged into it via `cloneElement` (no wrapping `<button>`). Use this when you want to pass your own interactive element (e.g. a `<Button>`) without producing `<button>` nested inside `<button>` (a hydration error).
|
|
226
227
|
- `content: ReactNode` — required. Rendered inside an `[role="dialog"]` panel when open.
|
|
227
228
|
- `position?: 'top' | 'bottom' | 'left' | 'right'` — default `'bottom'`
|
|
228
229
|
- `open?: boolean` — controlled.
|
|
@@ -233,11 +234,20 @@ Closes on outside click and Escape. Auto-focuses the first focusable child of `c
|
|
|
233
234
|
|
|
234
235
|
`children` is intentionally typed as `never` — pass via `content`.
|
|
235
236
|
|
|
236
|
-
Example:
|
|
237
|
+
Example — string trigger (default wrapping):
|
|
237
238
|
```tsx
|
|
238
239
|
<Popover trigger="Help" content={<p>Some help text</p>} position="right" />
|
|
239
240
|
```
|
|
240
241
|
|
|
242
|
+
Example — passing a `<Button>` without nested-button warning:
|
|
243
|
+
```tsx
|
|
244
|
+
<Popover
|
|
245
|
+
asChild
|
|
246
|
+
trigger={<Button iconOnly aria-label="Settings"><GearIcon /></Button>}
|
|
247
|
+
content={<Settings />}
|
|
248
|
+
/>
|
|
249
|
+
```
|
|
250
|
+
|
|
241
251
|
### Modal
|
|
242
252
|
Import: `import { Modal } from '@overdoser/react-toolkit'`
|
|
243
253
|
|
package/manifest.json
CHANGED
|
@@ -143,7 +143,8 @@
|
|
|
143
143
|
"import": "import { Popover } from '@overdoser/react-toolkit'",
|
|
144
144
|
"element": "div",
|
|
145
145
|
"props": {
|
|
146
|
-
"trigger": { "type": "ReactNode", "required": true },
|
|
146
|
+
"trigger": { "type": "ReactNode", "required": true, "notes": "Default mode wraps the value in an internal <button>. Set asChild=true to pass your own interactive element instead." },
|
|
147
|
+
"asChild": { "type": "boolean", "default": false, "notes": "When true and trigger is a single React element, the element is rendered as-is with onClick/aria-*/ref cloned onto it (no wrapping <button>). Use to avoid the button-in-button hydration warning when passing <Button> as the trigger." },
|
|
147
148
|
"content": { "type": "ReactNode", "required": true },
|
|
148
149
|
"position": { "type": "enum", "values": ["top", "bottom", "left", "right"], "default": "bottom" },
|
|
149
150
|
"open": { "type": "boolean", "notes": "Controlled mode." },
|