@edux-design/popovers 0.0.4 → 0.0.5
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/CHANGELOG.md +6 -0
- package/dist/index.js +9483 -23
- package/dist/index.mjs +9505 -22
- package/package.json +1 -1
- package/src/demos/Popover.stories.jsx +49 -0
package/package.json
CHANGED
|
@@ -197,3 +197,52 @@ export const Sides = {
|
|
|
197
197
|
},
|
|
198
198
|
},
|
|
199
199
|
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* ───────────────────────────────────────────────
|
|
203
|
+
* 🧭 No Auto Focus Example
|
|
204
|
+
* ───────────────────────────────────────────────
|
|
205
|
+
*/
|
|
206
|
+
export const NoAutoFocus = {
|
|
207
|
+
render: (args) => (
|
|
208
|
+
<Popover>
|
|
209
|
+
<PopoverTrigger asChild>
|
|
210
|
+
<Button variant="primary">Open Non-Focusing Popover</Button>
|
|
211
|
+
</PopoverTrigger>
|
|
212
|
+
|
|
213
|
+
<PopoverContent
|
|
214
|
+
{...args}
|
|
215
|
+
onOpenAutoFocus={(event) => {
|
|
216
|
+
// Prevent Radix from automatically moving focus into the popover
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
}}
|
|
219
|
+
trapFocus={false}
|
|
220
|
+
disableOutsidePointerEvents={false}
|
|
221
|
+
className="w-[220px]"
|
|
222
|
+
>
|
|
223
|
+
<p className="text-sm mb-4">
|
|
224
|
+
This popover <strong>does not steal focus</strong>. The trigger (or
|
|
225
|
+
other input) remains focused.
|
|
226
|
+
</p>
|
|
227
|
+
<PopoverClose asChild>
|
|
228
|
+
<Button variant="secondary" size="sm">
|
|
229
|
+
Close
|
|
230
|
+
</Button>
|
|
231
|
+
</PopoverClose>
|
|
232
|
+
</PopoverContent>
|
|
233
|
+
</Popover>
|
|
234
|
+
),
|
|
235
|
+
args: {
|
|
236
|
+
side: "bottom",
|
|
237
|
+
align: "center",
|
|
238
|
+
sideOffset: 8,
|
|
239
|
+
},
|
|
240
|
+
parameters: {
|
|
241
|
+
docs: {
|
|
242
|
+
description: {
|
|
243
|
+
story:
|
|
244
|
+
"Demonstrates disabling Radix’s default auto-focus behaviour using `onOpenAutoFocus={(e) => e.preventDefault()}`. The editor or trigger element retains focus when the popover opens.",
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
};
|