@firecms/ui 3.0.0-tw4.16 → 3.0.0-tw4.18
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/dist/index.es.js +58 -52
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +57 -51
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Dialog.tsx +1 -1
- package/src/components/Menu.tsx +1 -1
- package/src/components/Menubar.tsx +1 -1
- package/src/components/MultiSelect.tsx +1 -1
- package/src/components/Popover.tsx +1 -1
- package/src/components/Select.tsx +1 -1
- package/src/components/Sheet.tsx +1 -1
- package/src/components/Tooltip.tsx +1 -1
- package/src/hooks/useInjectStyles.tsx +12 -3
package/dist/index.es.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import React__default, {
|
|
5
|
+
import React__default, { createContext, useContext, useEffect, useState, useRef, Children, forwardRef, useLayoutEffect, useDeferredValue } from "react";
|
|
6
6
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { twMerge } from "tailwind-merge";
|
|
@@ -247,31 +247,69 @@ function keyToIconComponent(key) {
|
|
|
247
247
|
}).join("") + "Icon";
|
|
248
248
|
return componentName;
|
|
249
249
|
}
|
|
250
|
+
const PortalContainerContext = createContext(void 0);
|
|
251
|
+
function PortalContainerProvider(t0) {
|
|
252
|
+
const $ = c(5);
|
|
253
|
+
const {
|
|
254
|
+
container,
|
|
255
|
+
children
|
|
256
|
+
} = t0;
|
|
257
|
+
let t1;
|
|
258
|
+
if ($[0] !== container) {
|
|
259
|
+
t1 = {
|
|
260
|
+
container
|
|
261
|
+
};
|
|
262
|
+
$[0] = container;
|
|
263
|
+
$[1] = t1;
|
|
264
|
+
} else {
|
|
265
|
+
t1 = $[1];
|
|
266
|
+
}
|
|
267
|
+
let t2;
|
|
268
|
+
if ($[2] !== children || $[3] !== t1) {
|
|
269
|
+
t2 = /* @__PURE__ */ jsx(PortalContainerContext.Provider, { value: t1, children });
|
|
270
|
+
$[2] = children;
|
|
271
|
+
$[3] = t1;
|
|
272
|
+
$[4] = t2;
|
|
273
|
+
} else {
|
|
274
|
+
t2 = $[4];
|
|
275
|
+
}
|
|
276
|
+
return t2;
|
|
277
|
+
}
|
|
278
|
+
function usePortalContainer() {
|
|
279
|
+
const context = useContext(PortalContainerContext);
|
|
280
|
+
return context?.container ?? null;
|
|
281
|
+
}
|
|
250
282
|
function useInjectStyles(key, styles2) {
|
|
251
|
-
const $ = c(
|
|
283
|
+
const $ = c(5);
|
|
284
|
+
const portalContainer = usePortalContainer();
|
|
252
285
|
let t0;
|
|
253
|
-
if ($[0] !== key || $[1] !== styles2) {
|
|
286
|
+
if ($[0] !== key || $[1] !== portalContainer || $[2] !== styles2) {
|
|
254
287
|
t0 = () => {
|
|
255
|
-
|
|
256
|
-
|
|
288
|
+
if (typeof document === "undefined") {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const targetContainer = portalContainer ?? document.head;
|
|
292
|
+
const existingStyle = targetContainer.querySelector?.(`#${key}`);
|
|
293
|
+
if (!existingStyle) {
|
|
257
294
|
const style = document.createElement("style");
|
|
258
295
|
style.id = key;
|
|
259
296
|
style.innerHTML = styles2;
|
|
260
|
-
document.head.appendChild(style);
|
|
297
|
+
(targetContainer || document.head).appendChild(style);
|
|
261
298
|
}
|
|
262
299
|
};
|
|
263
300
|
$[0] = key;
|
|
264
|
-
$[1] =
|
|
265
|
-
$[2] =
|
|
301
|
+
$[1] = portalContainer;
|
|
302
|
+
$[2] = styles2;
|
|
303
|
+
$[3] = t0;
|
|
266
304
|
} else {
|
|
267
|
-
t0 = $[
|
|
305
|
+
t0 = $[3];
|
|
268
306
|
}
|
|
269
307
|
let t1;
|
|
270
|
-
if ($[
|
|
308
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
271
309
|
t1 = [];
|
|
272
|
-
$[
|
|
310
|
+
$[4] = t1;
|
|
273
311
|
} else {
|
|
274
|
-
t1 = $[
|
|
312
|
+
t1 = $[4];
|
|
275
313
|
}
|
|
276
314
|
useEffect(t0, t1);
|
|
277
315
|
}
|
|
@@ -360,38 +398,6 @@ function useIconStyles(t0) {
|
|
|
360
398
|
font-variation-settings: 'FILL' ${fill ? 1 : 0}, 'wght' ${weight}, 'GRAD' ${grad}, 'opsz' ${opticalSize};
|
|
361
399
|
}`);
|
|
362
400
|
}
|
|
363
|
-
const PortalContainerContext = createContext(void 0);
|
|
364
|
-
function PortalContainerProvider(t0) {
|
|
365
|
-
const $ = c(5);
|
|
366
|
-
const {
|
|
367
|
-
container,
|
|
368
|
-
children
|
|
369
|
-
} = t0;
|
|
370
|
-
let t1;
|
|
371
|
-
if ($[0] !== container) {
|
|
372
|
-
t1 = {
|
|
373
|
-
container
|
|
374
|
-
};
|
|
375
|
-
$[0] = container;
|
|
376
|
-
$[1] = t1;
|
|
377
|
-
} else {
|
|
378
|
-
t1 = $[1];
|
|
379
|
-
}
|
|
380
|
-
let t2;
|
|
381
|
-
if ($[2] !== children || $[3] !== t1) {
|
|
382
|
-
t2 = /* @__PURE__ */ jsx(PortalContainerContext.Provider, { value: t1, children });
|
|
383
|
-
$[2] = children;
|
|
384
|
-
$[3] = t1;
|
|
385
|
-
$[4] = t2;
|
|
386
|
-
} else {
|
|
387
|
-
t2 = $[4];
|
|
388
|
-
}
|
|
389
|
-
return t2;
|
|
390
|
-
}
|
|
391
|
-
function usePortalContainer() {
|
|
392
|
-
const context = useContext(PortalContainerContext);
|
|
393
|
-
return context?.container ?? null;
|
|
394
|
-
}
|
|
395
401
|
const Collapse = React__default.memo((t0) => {
|
|
396
402
|
const $ = c(9);
|
|
397
403
|
const {
|
|
@@ -32829,7 +32835,7 @@ const Dialog = (t0) => {
|
|
|
32829
32835
|
const disableInitialFocus = t5 === void 0 ? true : t5;
|
|
32830
32836
|
const [displayed, setDisplayed] = useState(false);
|
|
32831
32837
|
const contextContainer = usePortalContainer();
|
|
32832
|
-
const finalContainer = portalContainer
|
|
32838
|
+
const finalContainer = portalContainer ?? contextContainer ?? void 0;
|
|
32833
32839
|
let t6;
|
|
32834
32840
|
let t7;
|
|
32835
32841
|
if ($[0] !== open) {
|
|
@@ -33694,7 +33700,7 @@ const Menu = React__default.forwardRef((t0, ref) => {
|
|
|
33694
33700
|
} = t0;
|
|
33695
33701
|
const sideOffset = t1 === void 0 ? 4 : t1;
|
|
33696
33702
|
const contextContainer = usePortalContainer();
|
|
33697
|
-
const finalContainer = portalContainer
|
|
33703
|
+
const finalContainer = portalContainer ?? contextContainer ?? void 0;
|
|
33698
33704
|
let t2;
|
|
33699
33705
|
if ($[0] !== ref || $[1] !== trigger) {
|
|
33700
33706
|
t2 = /* @__PURE__ */ jsx(DropdownMenu.Trigger, { ref, asChild: true, children: trigger });
|
|
@@ -33861,7 +33867,7 @@ function MenubarPortal(t0) {
|
|
|
33861
33867
|
portalContainer
|
|
33862
33868
|
} = t0;
|
|
33863
33869
|
const contextContainer = usePortalContainer();
|
|
33864
|
-
const finalContainer = portalContainer
|
|
33870
|
+
const finalContainer = portalContainer ?? contextContainer ?? void 0;
|
|
33865
33871
|
let t1;
|
|
33866
33872
|
if ($[0] !== children || $[1] !== finalContainer) {
|
|
33867
33873
|
t1 = /* @__PURE__ */ jsx(MenubarPrimitive.Portal, { container: finalContainer, children });
|
|
@@ -34545,7 +34551,7 @@ const MultiSelect = React.forwardRef((t0, ref) => {
|
|
|
34545
34551
|
}
|
|
34546
34552
|
const [selectedValues, setSelectedValues] = useState(t6);
|
|
34547
34553
|
const contextContainer = usePortalContainer();
|
|
34548
|
-
const finalContainer = portalContainer
|
|
34554
|
+
const finalContainer = portalContainer ?? contextContainer ?? void 0;
|
|
34549
34555
|
let t7;
|
|
34550
34556
|
let t8;
|
|
34551
34557
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
@@ -35542,7 +35548,7 @@ const Select = forwardRef((t0, ref) => {
|
|
|
35542
35548
|
}
|
|
35543
35549
|
useEffect(t6, t7);
|
|
35544
35550
|
const contextContainer = usePortalContainer();
|
|
35545
|
-
const finalContainer = manualContainer
|
|
35551
|
+
const finalContainer = manualContainer ?? contextContainer ?? void 0;
|
|
35546
35552
|
let t8;
|
|
35547
35553
|
if ($[30] !== dataType || $[31] !== name || $[32] !== onChange || $[33] !== onValueChange) {
|
|
35548
35554
|
t8 = (newValue) => {
|
|
@@ -36228,7 +36234,7 @@ const Sheet = (t0) => {
|
|
|
36228
36234
|
const includeBackgroundOverlay = t3 === void 0 ? true : t3;
|
|
36229
36235
|
const [displayed, setDisplayed] = useState(false);
|
|
36230
36236
|
const contextContainer = usePortalContainer();
|
|
36231
|
-
const finalContainer = portalContainer
|
|
36237
|
+
const finalContainer = portalContainer ?? contextContainer ?? void 0;
|
|
36232
36238
|
let t4;
|
|
36233
36239
|
let t5;
|
|
36234
36240
|
if ($[15] !== open) {
|
|
@@ -36696,7 +36702,7 @@ const Tooltip = (t0) => {
|
|
|
36696
36702
|
const asChild = t3 === void 0 ? false : t3;
|
|
36697
36703
|
useInjectStyles("Tooltip", styles);
|
|
36698
36704
|
const contextContainer = usePortalContainer();
|
|
36699
|
-
const finalContainer = container
|
|
36705
|
+
const finalContainer = container ?? contextContainer ?? void 0;
|
|
36700
36706
|
if (!title) {
|
|
36701
36707
|
let t42;
|
|
36702
36708
|
if ($[0] !== children) {
|
|
@@ -37172,7 +37178,7 @@ function Popover(t0) {
|
|
|
37172
37178
|
const modal = t3 === void 0 ? false : t3;
|
|
37173
37179
|
useInjectStyles("Popover", popoverStyles);
|
|
37174
37180
|
const contextContainer = usePortalContainer();
|
|
37175
|
-
const finalContainer = portalContainer
|
|
37181
|
+
const finalContainer = portalContainer ?? contextContainer ?? void 0;
|
|
37176
37182
|
if (!enabled) {
|
|
37177
37183
|
let t42;
|
|
37178
37184
|
if ($[0] !== trigger) {
|