@exponential_app/eui-react 0.8.0 → 0.10.0
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.js +48 -32
- package/dist/index.js.map +5 -5
- package/dist/types/context.d.ts +2 -0
- package/dist/types/natives/overlays.d.ts +1 -1
- package/dist/types/surface.d.ts +6 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -121,7 +121,7 @@ function extensionComponent(extensions, component) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// packages/exponential-ui-react/src/node-view.tsx
|
|
124
|
-
import { Component, Fragment as
|
|
124
|
+
import { Component, Fragment as Fragment9, memo as memo2, useCallback as useCallback10, useContext as useContext6, useEffect as useEffect21, useMemo as useMemo18, useRef as useRef25 } from "react";
|
|
125
125
|
import { UNKNOWN_COMPONENT, instanceSegment, isResponsiveValue, nativeRecipeProps as nativeRecipeProps5, responsiveAt, templateItemKeys, templateSiteKey, withOwnWrites } from "@exponential_app/eui";
|
|
126
126
|
import { dynamicStyleEntries, nodeClass, queryToken, styleDirection } from "@exponential_app/eui/web";
|
|
127
127
|
|
|
@@ -4736,7 +4736,7 @@ function AccordionNative({ node, props, rootProps, emit, scope }) {
|
|
|
4736
4736
|
var asArray = (v) => Array.isArray(v) ? v : v ? v.split(`,`) : [];
|
|
4737
4737
|
|
|
4738
4738
|
// packages/exponential-ui-react/src/natives/overlays.tsx
|
|
4739
|
-
import { forwardRef as forwardRef2, useCallback as useCallback8, useEffect as useEffect16, useRef as useRef21, useState as useState17 } from "react";
|
|
4739
|
+
import { Fragment as Fragment6, forwardRef as forwardRef2, useCallback as useCallback8, useEffect as useEffect16, useRef as useRef21, useState as useState17 } from "react";
|
|
4740
4740
|
import { createPortal } from "react-dom";
|
|
4741
4741
|
import { ContextMenu as ContextPrimitive, Dialog as DialogPrimitive, DropdownMenu as MenuPrimitive, Popover as PopoverPrimitive2, Tooltip as TooltipPrimitive } from "radix-ui";
|
|
4742
4742
|
import { OVERLAY_OFFSET as OVERLAY_OFFSET2, OVERLAY_PADDING as OVERLAY_PADDING2 } from "@exponential_app/eui";
|
|
@@ -4949,7 +4949,18 @@ function SearchListNative({ node, props, rootProps, emit, scope }) {
|
|
|
4949
4949
|
}
|
|
4950
4950
|
|
|
4951
4951
|
// packages/exponential-ui-react/src/natives/overlays.tsx
|
|
4952
|
-
import { jsx as jsx19, jsxs as jsxs15, Fragment as
|
|
4952
|
+
import { jsx as jsx19, jsxs as jsxs15, Fragment as Fragment7 } from "react/jsx-runtime";
|
|
4953
|
+
function OverlayPortal({ as: Portal, children }) {
|
|
4954
|
+
const ctx = useSurfaceContext();
|
|
4955
|
+
if (ctx.inlineOverlays)
|
|
4956
|
+
return /* @__PURE__ */ jsx19(Fragment6, {
|
|
4957
|
+
children
|
|
4958
|
+
});
|
|
4959
|
+
return /* @__PURE__ */ jsx19(Portal, {
|
|
4960
|
+
container: ctx.portal ?? undefined,
|
|
4961
|
+
children
|
|
4962
|
+
});
|
|
4963
|
+
}
|
|
4953
4964
|
function useOpenState(node, scope, external, emit) {
|
|
4954
4965
|
const [open, setOpen] = useBoundState(node, scope, `open`, external);
|
|
4955
4966
|
const change = useCallback8((next) => {
|
|
@@ -5054,8 +5065,8 @@ function ModalNative({ node, props, rootProps, emit, children, slots, scope, kin
|
|
|
5054
5065
|
})
|
|
5055
5066
|
}) : null
|
|
5056
5067
|
}),
|
|
5057
|
-
/* @__PURE__ */ jsxs15(
|
|
5058
|
-
|
|
5068
|
+
/* @__PURE__ */ jsxs15(OverlayPortal, {
|
|
5069
|
+
as: DialogPrimitive.Portal,
|
|
5059
5070
|
children: [
|
|
5060
5071
|
/* @__PURE__ */ jsx19(DialogPrimitive.Overlay, {
|
|
5061
5072
|
...part(`overlay`, open && `open`),
|
|
@@ -5176,8 +5187,8 @@ function PopoverNative({ node, props, rootProps, emit, children, slots, scope })
|
|
|
5176
5187
|
})
|
|
5177
5188
|
})
|
|
5178
5189
|
}),
|
|
5179
|
-
/* @__PURE__ */ jsx19(
|
|
5180
|
-
|
|
5190
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5191
|
+
as: PopoverPrimitive2.Portal,
|
|
5181
5192
|
children: /* @__PURE__ */ jsx19(PopoverPrimitive2.Content, {
|
|
5182
5193
|
ref: contentRef,
|
|
5183
5194
|
...part(`content`, open && `open`),
|
|
@@ -5208,6 +5219,7 @@ function TooltipNative({ node, props, rootProps, children }) {
|
|
|
5208
5219
|
return /* @__PURE__ */ jsx19(TooltipPrimitive.Provider, {
|
|
5209
5220
|
delayDuration: 300,
|
|
5210
5221
|
children: /* @__PURE__ */ jsxs15(TooltipPrimitive.Root, {
|
|
5222
|
+
open: ctx.inlineOverlays || undefined,
|
|
5211
5223
|
children: [
|
|
5212
5224
|
/* @__PURE__ */ jsx19("div", {
|
|
5213
5225
|
...rootProps,
|
|
@@ -5221,8 +5233,8 @@ function TooltipNative({ node, props, rootProps, children }) {
|
|
|
5221
5233
|
})
|
|
5222
5234
|
})
|
|
5223
5235
|
}),
|
|
5224
|
-
/* @__PURE__ */ jsx19(
|
|
5225
|
-
|
|
5236
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5237
|
+
as: TooltipPrimitive.Portal,
|
|
5226
5238
|
children: /* @__PURE__ */ jsx19(TooltipPrimitive.Content, {
|
|
5227
5239
|
...part(`content`),
|
|
5228
5240
|
side,
|
|
@@ -5271,7 +5283,7 @@ function MenuSearch({ item, i, part, emit, close }) {
|
|
|
5271
5283
|
close();
|
|
5272
5284
|
},
|
|
5273
5285
|
rowPart: (_, __, active) => part(`item`, active && `selected`),
|
|
5274
|
-
renderRow: (row) => /* @__PURE__ */ jsxs15(
|
|
5286
|
+
renderRow: (row) => /* @__PURE__ */ jsxs15(Fragment7, {
|
|
5275
5287
|
children: [
|
|
5276
5288
|
row.icon ? /* @__PURE__ */ jsx19(IconGlyph, {
|
|
5277
5289
|
icons: ctx.host.icons,
|
|
@@ -5290,7 +5302,7 @@ function MenuItems({ ns, items, rawItems, part, overlay, emit, scope, path, clos
|
|
|
5290
5302
|
const ctx = useSurfaceContext();
|
|
5291
5303
|
const raws = objects(rawItems);
|
|
5292
5304
|
const N = ns;
|
|
5293
|
-
return /* @__PURE__ */ jsx19(
|
|
5305
|
+
return /* @__PURE__ */ jsx19(Fragment7, {
|
|
5294
5306
|
children: items.map((item, i) => {
|
|
5295
5307
|
const kind = item.separator ? `separator` : item.kind ?? `item`;
|
|
5296
5308
|
const key = `${path}${i}`;
|
|
@@ -5331,8 +5343,8 @@ function MenuItems({ ns, items, rawItems, part, overlay, emit, scope, path, clos
|
|
|
5331
5343
|
})
|
|
5332
5344
|
]
|
|
5333
5345
|
}),
|
|
5334
|
-
/* @__PURE__ */ jsx19(
|
|
5335
|
-
|
|
5346
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5347
|
+
as: N.Portal,
|
|
5336
5348
|
children: /* @__PURE__ */ jsx19(N.SubContent, {
|
|
5337
5349
|
...part(`content`),
|
|
5338
5350
|
sideOffset: 2,
|
|
@@ -5421,7 +5433,7 @@ function PressMenuOpening({ node, props, rootProps, emit, children, scope }) {
|
|
|
5421
5433
|
const items = objects(props.items);
|
|
5422
5434
|
const label = str(props.label);
|
|
5423
5435
|
const icon = str(props.icon);
|
|
5424
|
-
const [open, setOpen] = useState17(
|
|
5436
|
+
const [open, setOpen] = useState17(ctx.inlineOverlays);
|
|
5425
5437
|
const child = node.children[0] ?? null;
|
|
5426
5438
|
return /* @__PURE__ */ jsxs15(MenuPrimitive.Root, {
|
|
5427
5439
|
open,
|
|
@@ -5453,8 +5465,8 @@ function PressMenuOpening({ node, props, rootProps, emit, children, scope }) {
|
|
|
5453
5465
|
})
|
|
5454
5466
|
})
|
|
5455
5467
|
}),
|
|
5456
|
-
/* @__PURE__ */ jsx19(
|
|
5457
|
-
|
|
5468
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5469
|
+
as: MenuPrimitive.Portal,
|
|
5458
5470
|
children: /* @__PURE__ */ jsx19(MenuPrimitive.Content, {
|
|
5459
5471
|
...part(`content`, open && `open`),
|
|
5460
5472
|
align: "start",
|
|
@@ -5505,8 +5517,8 @@ function ContextMenuOpening({ node, props, rootProps, emit, children, scope }) {
|
|
|
5505
5517
|
children
|
|
5506
5518
|
})
|
|
5507
5519
|
}),
|
|
5508
|
-
/* @__PURE__ */ jsx19(
|
|
5509
|
-
|
|
5520
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5521
|
+
as: ContextPrimitive.Portal,
|
|
5510
5522
|
children: /* @__PURE__ */ jsx19(ContextPrimitive.Content, {
|
|
5511
5523
|
...part(`content`, open && `open`),
|
|
5512
5524
|
collisionPadding: OVERLAY_PADDING2,
|
|
@@ -5562,7 +5574,7 @@ function ToastNative({ node, props, rootProps, emit, scope }) {
|
|
|
5562
5574
|
return () => clearTimeout(t);
|
|
5563
5575
|
}, [open]);
|
|
5564
5576
|
useEffect16(() => {
|
|
5565
|
-
if (!open || duration === 0 || paused)
|
|
5577
|
+
if (!open || duration === 0 || paused || ctx.inlineOverlays)
|
|
5566
5578
|
return;
|
|
5567
5579
|
startedAt.current = Date.now();
|
|
5568
5580
|
const t = setTimeout(close, remaining.current);
|
|
@@ -5571,13 +5583,13 @@ function ToastNative({ node, props, rootProps, emit, scope }) {
|
|
|
5571
5583
|
remaining.current = Math.max(0, remaining.current - (Date.now() - startedAt.current));
|
|
5572
5584
|
};
|
|
5573
5585
|
}, [open, duration, paused, close]);
|
|
5574
|
-
if (!shown || !ctx.toastLayer)
|
|
5586
|
+
if (!shown || !(ctx.toastLayer || ctx.inlineOverlays))
|
|
5575
5587
|
return null;
|
|
5576
5588
|
const title = str(props.title);
|
|
5577
5589
|
const description = str(props.description);
|
|
5578
5590
|
const actionLabel = str(props.actionLabel);
|
|
5579
5591
|
const assertive = type === `error`;
|
|
5580
|
-
|
|
5592
|
+
const toast = /* @__PURE__ */ jsxs15("div", {
|
|
5581
5593
|
...rootProps,
|
|
5582
5594
|
role: assertive ? `alert` : `status`,
|
|
5583
5595
|
"aria-live": assertive ? `assertive` : `polite`,
|
|
@@ -5630,7 +5642,8 @@ function ToastNative({ node, props, rootProps, emit, scope }) {
|
|
|
5630
5642
|
})
|
|
5631
5643
|
}) : null
|
|
5632
5644
|
]
|
|
5633
|
-
})
|
|
5645
|
+
});
|
|
5646
|
+
return ctx.inlineOverlays ? toast : createPortal(toast, ctx.toastLayer);
|
|
5634
5647
|
}
|
|
5635
5648
|
|
|
5636
5649
|
// packages/exponential-ui-react/src/natives/qr.tsx
|
|
@@ -6530,7 +6543,7 @@ function RowScope({ rowsPath, row, rowKey, index, tableId, node, onLiteralEdit }
|
|
|
6530
6543
|
import { displayString as displayString3 } from "@exponential_app/eui";
|
|
6531
6544
|
|
|
6532
6545
|
// packages/exponential-ui-react/src/markdown.tsx
|
|
6533
|
-
import { Fragment as
|
|
6546
|
+
import { Fragment as Fragment8, createElement, useMemo as useMemo16 } from "react";
|
|
6534
6547
|
import { linkHref as linkHref3, mediaRequestOf, parseMarkdown } from "@exponential_app/eui/web";
|
|
6535
6548
|
import { MAX_LINK_NESTING, MAX_LINK_DEST, MAX_BLOCK_NESTING, linkAt, wholeImage, parseList } from "@exponential_app/eui/web";
|
|
6536
6549
|
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -6618,7 +6631,7 @@ function renderList(list, host, key) {
|
|
|
6618
6631
|
}),
|
|
6619
6632
|
item.task === undefined ? null : ` `,
|
|
6620
6633
|
inline(item.content, host),
|
|
6621
|
-
item.children.map((c, ci) => /* @__PURE__ */ jsx23(
|
|
6634
|
+
item.children.map((c, ci) => /* @__PURE__ */ jsx23(Fragment8, {
|
|
6622
6635
|
children: renderList(c, host, ci)
|
|
6623
6636
|
}, `c${ci}`))
|
|
6624
6637
|
]
|
|
@@ -6686,7 +6699,7 @@ function block(b, host, key) {
|
|
|
6686
6699
|
}
|
|
6687
6700
|
}
|
|
6688
6701
|
function blocks(tree, host) {
|
|
6689
|
-
return tree.map((b, k) => /* @__PURE__ */ jsx23(
|
|
6702
|
+
return tree.map((b, k) => /* @__PURE__ */ jsx23(Fragment8, {
|
|
6690
6703
|
children: block(b, host, k)
|
|
6691
6704
|
}, k));
|
|
6692
6705
|
}
|
|
@@ -7003,7 +7016,7 @@ var NATIVE_NAMES = Object.keys(NATIVES);
|
|
|
7003
7016
|
|
|
7004
7017
|
// packages/exponential-ui-react/src/node-view.tsx
|
|
7005
7018
|
import { cssValue, isMacroComponent, partClass as partClass4, propAttribute as propAttribute2 } from "@exponential_app/eui/web";
|
|
7006
|
-
import { jsx as jsx26, jsxs as jsxs21, Fragment as
|
|
7019
|
+
import { jsx as jsx26, jsxs as jsxs21, Fragment as Fragment10 } from "react/jsx-runtime";
|
|
7007
7020
|
var CONTAINERS = new Set([`Box`, `List`]);
|
|
7008
7021
|
function styleIdOf(node) {
|
|
7009
7022
|
return node.styleId ?? node.id;
|
|
@@ -7188,7 +7201,7 @@ var BoundNode = memo2(function BoundNode({ node, scope, live }) {
|
|
|
7188
7201
|
});
|
|
7189
7202
|
}
|
|
7190
7203
|
}
|
|
7191
|
-
const children = /* @__PURE__ */ jsxs21(
|
|
7204
|
+
const children = /* @__PURE__ */ jsxs21(Fragment10, {
|
|
7192
7205
|
children: [
|
|
7193
7206
|
node.children.map((child) => /* @__PURE__ */ jsx26(NodeView, {
|
|
7194
7207
|
node: child
|
|
@@ -7327,7 +7340,7 @@ function TemplateChildren({ node, scope }) {
|
|
|
7327
7340
|
}, generation);
|
|
7328
7341
|
}
|
|
7329
7342
|
function TemplateBlock({ items, tpl }) {
|
|
7330
|
-
return /* @__PURE__ */ jsx26(
|
|
7343
|
+
return /* @__PURE__ */ jsx26(Fragment10, {
|
|
7331
7344
|
children: items.map((item) => /* @__PURE__ */ jsx26(TemplateItemView, {
|
|
7332
7345
|
tpl,
|
|
7333
7346
|
item
|
|
@@ -7522,6 +7535,7 @@ function ExponentialSurface({
|
|
|
7522
7535
|
extensions: extensionsProp = EMPTY2,
|
|
7523
7536
|
states = EMPTY2,
|
|
7524
7537
|
measure,
|
|
7538
|
+
inlineOverlays = false,
|
|
7525
7539
|
direction: directionProp,
|
|
7526
7540
|
width,
|
|
7527
7541
|
viewportHeight,
|
|
@@ -7681,6 +7695,7 @@ function ExponentialSurface({
|
|
|
7681
7695
|
measure,
|
|
7682
7696
|
portal,
|
|
7683
7697
|
toastLayer,
|
|
7698
|
+
inlineOverlays,
|
|
7684
7699
|
direction,
|
|
7685
7700
|
functions,
|
|
7686
7701
|
openUrl,
|
|
@@ -7695,7 +7710,7 @@ function ExponentialSurface({
|
|
|
7695
7710
|
hover,
|
|
7696
7711
|
announce,
|
|
7697
7712
|
subscribe
|
|
7698
|
-
}, live), [surfaceId, compiled, theme, hostValue, extensions, extensionDefs, setData, templateNode, budget, states, measure, portal, toastLayer, direction, functions, openUrl, locale, formatter, now, registerScroller, paintFailures, strings, t, reducedMotion, hover, announce, subscribe]);
|
|
7713
|
+
}, live), [surfaceId, compiled, theme, hostValue, extensions, extensionDefs, setData, templateNode, budget, states, measure, portal, toastLayer, inlineOverlays, direction, functions, openUrl, locale, formatter, now, registerScroller, paintFailures, strings, t, reducedMotion, hover, announce, subscribe]);
|
|
7699
7714
|
const nodeEl = useCallback11((id) => rootEl?.querySelector(`[data-xui-id="${typeof CSS !== `undefined` && CSS.escape ? CSS.escape(id) : id.replace(/"/g, `\\"`)}"]`) ?? null, [rootEl]);
|
|
7700
7715
|
useImperativeHandle2(handleRef, () => {
|
|
7701
7716
|
const focus = (id) => {
|
|
@@ -7762,6 +7777,7 @@ ${compiled.css}` }), [compiled.css]);
|
|
|
7762
7777
|
"data-xui-theme": theme.id,
|
|
7763
7778
|
"data-xui-density": density === `default` ? undefined : density,
|
|
7764
7779
|
"data-xui-motion": reducedMotion ? `reduce` : undefined,
|
|
7780
|
+
"data-xui-overlays": inlineOverlays ? `inline` : undefined,
|
|
7765
7781
|
"data-xq": xq || undefined,
|
|
7766
7782
|
dir: direction,
|
|
7767
7783
|
style: width === undefined ? style : { width, ...style },
|
|
@@ -7899,7 +7915,7 @@ import { getPointer as getPointer4, setPointer as setPointer5, absolutePath as a
|
|
|
7899
7915
|
|
|
7900
7916
|
// packages/exponential-ui-react/src/host-surface.tsx
|
|
7901
7917
|
import { useCallback as useCallback13, useMemo as useMemo21, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
7902
|
-
import { jsx as jsx28, Fragment as
|
|
7918
|
+
import { jsx as jsx28, Fragment as Fragment11 } from "react/jsx-runtime";
|
|
7903
7919
|
function hostPlugin(host, base = {}) {
|
|
7904
7920
|
return {
|
|
7905
7921
|
...base,
|
|
@@ -7972,7 +7988,7 @@ function HostSurface({ host, surfaceId, plugin, fallback = null, ...rest }) {
|
|
|
7972
7988
|
const surface = useHostSurface(host, surfaceId);
|
|
7973
7989
|
const p = useMemo21(() => hostPlugin(host, plugin), [host, plugin]);
|
|
7974
7990
|
if (!surface)
|
|
7975
|
-
return /* @__PURE__ */ jsx28(
|
|
7991
|
+
return /* @__PURE__ */ jsx28(Fragment11, {
|
|
7976
7992
|
children: fallback
|
|
7977
7993
|
});
|
|
7978
7994
|
return /* @__PURE__ */ jsx28(ExponentialSurface, {
|
|
@@ -8083,5 +8099,5 @@ export {
|
|
|
8083
8099
|
walkNodes
|
|
8084
8100
|
};
|
|
8085
8101
|
|
|
8086
|
-
//# debugId=
|
|
8102
|
+
//# debugId=EF808DB07BCA693364756E2164756E21
|
|
8087
8103
|
//# sourceMappingURL=index.js.map
|