@edux-design/popovers 0.0.4 → 0.0.6
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 +12 -0
- package/package.json +3 -3
- package/src/demos/Popover.stories.jsx +49 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edux-design/popovers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"lint": "eslint . --max-warnings 0",
|
|
18
|
-
"build": "tsup src/index.js --format esm,cjs
|
|
19
|
-
"dev": "tsup src/index.js --
|
|
18
|
+
"build": "tsup src/index.js --format esm,cjs --external react,react-dom,@radix-ui/react-popover",
|
|
19
|
+
"dev": "tsup src/index.js --format esm,cjs --external react,react-dom,@radix-ui/react-popover",
|
|
20
20
|
"generate:component": "turbo gen react-component",
|
|
21
21
|
"check-types": "tsc --noEmit"
|
|
22
22
|
},
|
|
@@ -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
|
+
};
|