@exponential_app/eui-react 0.7.1 → 0.9.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 +53 -34
- 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 +9 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
themeOrDefault,
|
|
19
19
|
mediaMatches,
|
|
20
20
|
parseMediaCondition,
|
|
21
|
+
readOnlyTemplates,
|
|
22
|
+
readOnlyTree,
|
|
21
23
|
resolveMode,
|
|
22
24
|
stringTable,
|
|
23
25
|
templateBudget,
|
|
@@ -119,7 +121,7 @@ function extensionComponent(extensions, component) {
|
|
|
119
121
|
}
|
|
120
122
|
|
|
121
123
|
// packages/exponential-ui-react/src/node-view.tsx
|
|
122
|
-
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";
|
|
123
125
|
import { UNKNOWN_COMPONENT, instanceSegment, isResponsiveValue, nativeRecipeProps as nativeRecipeProps5, responsiveAt, templateItemKeys, templateSiteKey, withOwnWrites } from "@exponential_app/eui";
|
|
124
126
|
import { dynamicStyleEntries, nodeClass, queryToken, styleDirection } from "@exponential_app/eui/web";
|
|
125
127
|
|
|
@@ -4734,7 +4736,7 @@ function AccordionNative({ node, props, rootProps, emit, scope }) {
|
|
|
4734
4736
|
var asArray = (v) => Array.isArray(v) ? v : v ? v.split(`,`) : [];
|
|
4735
4737
|
|
|
4736
4738
|
// packages/exponential-ui-react/src/natives/overlays.tsx
|
|
4737
|
-
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";
|
|
4738
4740
|
import { createPortal } from "react-dom";
|
|
4739
4741
|
import { ContextMenu as ContextPrimitive, Dialog as DialogPrimitive, DropdownMenu as MenuPrimitive, Popover as PopoverPrimitive2, Tooltip as TooltipPrimitive } from "radix-ui";
|
|
4740
4742
|
import { OVERLAY_OFFSET as OVERLAY_OFFSET2, OVERLAY_PADDING as OVERLAY_PADDING2 } from "@exponential_app/eui";
|
|
@@ -4947,7 +4949,18 @@ function SearchListNative({ node, props, rootProps, emit, scope }) {
|
|
|
4947
4949
|
}
|
|
4948
4950
|
|
|
4949
4951
|
// packages/exponential-ui-react/src/natives/overlays.tsx
|
|
4950
|
-
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
|
+
}
|
|
4951
4964
|
function useOpenState(node, scope, external, emit) {
|
|
4952
4965
|
const [open, setOpen] = useBoundState(node, scope, `open`, external);
|
|
4953
4966
|
const change = useCallback8((next) => {
|
|
@@ -5052,8 +5065,8 @@ function ModalNative({ node, props, rootProps, emit, children, slots, scope, kin
|
|
|
5052
5065
|
})
|
|
5053
5066
|
}) : null
|
|
5054
5067
|
}),
|
|
5055
|
-
/* @__PURE__ */ jsxs15(
|
|
5056
|
-
|
|
5068
|
+
/* @__PURE__ */ jsxs15(OverlayPortal, {
|
|
5069
|
+
as: DialogPrimitive.Portal,
|
|
5057
5070
|
children: [
|
|
5058
5071
|
/* @__PURE__ */ jsx19(DialogPrimitive.Overlay, {
|
|
5059
5072
|
...part(`overlay`, open && `open`),
|
|
@@ -5174,8 +5187,8 @@ function PopoverNative({ node, props, rootProps, emit, children, slots, scope })
|
|
|
5174
5187
|
})
|
|
5175
5188
|
})
|
|
5176
5189
|
}),
|
|
5177
|
-
/* @__PURE__ */ jsx19(
|
|
5178
|
-
|
|
5190
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5191
|
+
as: PopoverPrimitive2.Portal,
|
|
5179
5192
|
children: /* @__PURE__ */ jsx19(PopoverPrimitive2.Content, {
|
|
5180
5193
|
ref: contentRef,
|
|
5181
5194
|
...part(`content`, open && `open`),
|
|
@@ -5206,6 +5219,7 @@ function TooltipNative({ node, props, rootProps, children }) {
|
|
|
5206
5219
|
return /* @__PURE__ */ jsx19(TooltipPrimitive.Provider, {
|
|
5207
5220
|
delayDuration: 300,
|
|
5208
5221
|
children: /* @__PURE__ */ jsxs15(TooltipPrimitive.Root, {
|
|
5222
|
+
open: ctx.inlineOverlays || undefined,
|
|
5209
5223
|
children: [
|
|
5210
5224
|
/* @__PURE__ */ jsx19("div", {
|
|
5211
5225
|
...rootProps,
|
|
@@ -5219,8 +5233,8 @@ function TooltipNative({ node, props, rootProps, children }) {
|
|
|
5219
5233
|
})
|
|
5220
5234
|
})
|
|
5221
5235
|
}),
|
|
5222
|
-
/* @__PURE__ */ jsx19(
|
|
5223
|
-
|
|
5236
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5237
|
+
as: TooltipPrimitive.Portal,
|
|
5224
5238
|
children: /* @__PURE__ */ jsx19(TooltipPrimitive.Content, {
|
|
5225
5239
|
...part(`content`),
|
|
5226
5240
|
side,
|
|
@@ -5269,7 +5283,7 @@ function MenuSearch({ item, i, part, emit, close }) {
|
|
|
5269
5283
|
close();
|
|
5270
5284
|
},
|
|
5271
5285
|
rowPart: (_, __, active) => part(`item`, active && `selected`),
|
|
5272
|
-
renderRow: (row) => /* @__PURE__ */ jsxs15(
|
|
5286
|
+
renderRow: (row) => /* @__PURE__ */ jsxs15(Fragment7, {
|
|
5273
5287
|
children: [
|
|
5274
5288
|
row.icon ? /* @__PURE__ */ jsx19(IconGlyph, {
|
|
5275
5289
|
icons: ctx.host.icons,
|
|
@@ -5288,7 +5302,7 @@ function MenuItems({ ns, items, rawItems, part, overlay, emit, scope, path, clos
|
|
|
5288
5302
|
const ctx = useSurfaceContext();
|
|
5289
5303
|
const raws = objects(rawItems);
|
|
5290
5304
|
const N = ns;
|
|
5291
|
-
return /* @__PURE__ */ jsx19(
|
|
5305
|
+
return /* @__PURE__ */ jsx19(Fragment7, {
|
|
5292
5306
|
children: items.map((item, i) => {
|
|
5293
5307
|
const kind = item.separator ? `separator` : item.kind ?? `item`;
|
|
5294
5308
|
const key = `${path}${i}`;
|
|
@@ -5329,8 +5343,8 @@ function MenuItems({ ns, items, rawItems, part, overlay, emit, scope, path, clos
|
|
|
5329
5343
|
})
|
|
5330
5344
|
]
|
|
5331
5345
|
}),
|
|
5332
|
-
/* @__PURE__ */ jsx19(
|
|
5333
|
-
|
|
5346
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5347
|
+
as: N.Portal,
|
|
5334
5348
|
children: /* @__PURE__ */ jsx19(N.SubContent, {
|
|
5335
5349
|
...part(`content`),
|
|
5336
5350
|
sideOffset: 2,
|
|
@@ -5419,7 +5433,7 @@ function PressMenuOpening({ node, props, rootProps, emit, children, scope }) {
|
|
|
5419
5433
|
const items = objects(props.items);
|
|
5420
5434
|
const label = str(props.label);
|
|
5421
5435
|
const icon = str(props.icon);
|
|
5422
|
-
const [open, setOpen] = useState17(
|
|
5436
|
+
const [open, setOpen] = useState17(ctx.inlineOverlays);
|
|
5423
5437
|
const child = node.children[0] ?? null;
|
|
5424
5438
|
return /* @__PURE__ */ jsxs15(MenuPrimitive.Root, {
|
|
5425
5439
|
open,
|
|
@@ -5451,8 +5465,8 @@ function PressMenuOpening({ node, props, rootProps, emit, children, scope }) {
|
|
|
5451
5465
|
})
|
|
5452
5466
|
})
|
|
5453
5467
|
}),
|
|
5454
|
-
/* @__PURE__ */ jsx19(
|
|
5455
|
-
|
|
5468
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5469
|
+
as: MenuPrimitive.Portal,
|
|
5456
5470
|
children: /* @__PURE__ */ jsx19(MenuPrimitive.Content, {
|
|
5457
5471
|
...part(`content`, open && `open`),
|
|
5458
5472
|
align: "start",
|
|
@@ -5503,8 +5517,8 @@ function ContextMenuOpening({ node, props, rootProps, emit, children, scope }) {
|
|
|
5503
5517
|
children
|
|
5504
5518
|
})
|
|
5505
5519
|
}),
|
|
5506
|
-
/* @__PURE__ */ jsx19(
|
|
5507
|
-
|
|
5520
|
+
/* @__PURE__ */ jsx19(OverlayPortal, {
|
|
5521
|
+
as: ContextPrimitive.Portal,
|
|
5508
5522
|
children: /* @__PURE__ */ jsx19(ContextPrimitive.Content, {
|
|
5509
5523
|
...part(`content`, open && `open`),
|
|
5510
5524
|
collisionPadding: OVERLAY_PADDING2,
|
|
@@ -5560,7 +5574,7 @@ function ToastNative({ node, props, rootProps, emit, scope }) {
|
|
|
5560
5574
|
return () => clearTimeout(t);
|
|
5561
5575
|
}, [open]);
|
|
5562
5576
|
useEffect16(() => {
|
|
5563
|
-
if (!open || duration === 0 || paused)
|
|
5577
|
+
if (!open || duration === 0 || paused || ctx.inlineOverlays)
|
|
5564
5578
|
return;
|
|
5565
5579
|
startedAt.current = Date.now();
|
|
5566
5580
|
const t = setTimeout(close, remaining.current);
|
|
@@ -5569,13 +5583,13 @@ function ToastNative({ node, props, rootProps, emit, scope }) {
|
|
|
5569
5583
|
remaining.current = Math.max(0, remaining.current - (Date.now() - startedAt.current));
|
|
5570
5584
|
};
|
|
5571
5585
|
}, [open, duration, paused, close]);
|
|
5572
|
-
if (!shown || !ctx.toastLayer)
|
|
5586
|
+
if (!shown || !(ctx.toastLayer || ctx.inlineOverlays))
|
|
5573
5587
|
return null;
|
|
5574
5588
|
const title = str(props.title);
|
|
5575
5589
|
const description = str(props.description);
|
|
5576
5590
|
const actionLabel = str(props.actionLabel);
|
|
5577
5591
|
const assertive = type === `error`;
|
|
5578
|
-
|
|
5592
|
+
const toast = /* @__PURE__ */ jsxs15("div", {
|
|
5579
5593
|
...rootProps,
|
|
5580
5594
|
role: assertive ? `alert` : `status`,
|
|
5581
5595
|
"aria-live": assertive ? `assertive` : `polite`,
|
|
@@ -5628,7 +5642,8 @@ function ToastNative({ node, props, rootProps, emit, scope }) {
|
|
|
5628
5642
|
})
|
|
5629
5643
|
}) : null
|
|
5630
5644
|
]
|
|
5631
|
-
})
|
|
5645
|
+
});
|
|
5646
|
+
return ctx.inlineOverlays ? toast : createPortal(toast, ctx.toastLayer);
|
|
5632
5647
|
}
|
|
5633
5648
|
|
|
5634
5649
|
// packages/exponential-ui-react/src/natives/qr.tsx
|
|
@@ -6528,7 +6543,7 @@ function RowScope({ rowsPath, row, rowKey, index, tableId, node, onLiteralEdit }
|
|
|
6528
6543
|
import { displayString as displayString3 } from "@exponential_app/eui";
|
|
6529
6544
|
|
|
6530
6545
|
// packages/exponential-ui-react/src/markdown.tsx
|
|
6531
|
-
import { Fragment as
|
|
6546
|
+
import { Fragment as Fragment8, createElement, useMemo as useMemo16 } from "react";
|
|
6532
6547
|
import { linkHref as linkHref3, mediaRequestOf, parseMarkdown } from "@exponential_app/eui/web";
|
|
6533
6548
|
import { MAX_LINK_NESTING, MAX_LINK_DEST, MAX_BLOCK_NESTING, linkAt, wholeImage, parseList } from "@exponential_app/eui/web";
|
|
6534
6549
|
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -6616,7 +6631,7 @@ function renderList(list, host, key) {
|
|
|
6616
6631
|
}),
|
|
6617
6632
|
item.task === undefined ? null : ` `,
|
|
6618
6633
|
inline(item.content, host),
|
|
6619
|
-
item.children.map((c, ci) => /* @__PURE__ */ jsx23(
|
|
6634
|
+
item.children.map((c, ci) => /* @__PURE__ */ jsx23(Fragment8, {
|
|
6620
6635
|
children: renderList(c, host, ci)
|
|
6621
6636
|
}, `c${ci}`))
|
|
6622
6637
|
]
|
|
@@ -6684,7 +6699,7 @@ function block(b, host, key) {
|
|
|
6684
6699
|
}
|
|
6685
6700
|
}
|
|
6686
6701
|
function blocks(tree, host) {
|
|
6687
|
-
return tree.map((b, k) => /* @__PURE__ */ jsx23(
|
|
6702
|
+
return tree.map((b, k) => /* @__PURE__ */ jsx23(Fragment8, {
|
|
6688
6703
|
children: block(b, host, k)
|
|
6689
6704
|
}, k));
|
|
6690
6705
|
}
|
|
@@ -7001,7 +7016,7 @@ var NATIVE_NAMES = Object.keys(NATIVES);
|
|
|
7001
7016
|
|
|
7002
7017
|
// packages/exponential-ui-react/src/node-view.tsx
|
|
7003
7018
|
import { cssValue, isMacroComponent, partClass as partClass4, propAttribute as propAttribute2 } from "@exponential_app/eui/web";
|
|
7004
|
-
import { jsx as jsx26, jsxs as jsxs21, Fragment as
|
|
7019
|
+
import { jsx as jsx26, jsxs as jsxs21, Fragment as Fragment10 } from "react/jsx-runtime";
|
|
7005
7020
|
var CONTAINERS = new Set([`Box`, `List`]);
|
|
7006
7021
|
function styleIdOf(node) {
|
|
7007
7022
|
return node.styleId ?? node.id;
|
|
@@ -7186,7 +7201,7 @@ var BoundNode = memo2(function BoundNode({ node, scope, live }) {
|
|
|
7186
7201
|
});
|
|
7187
7202
|
}
|
|
7188
7203
|
}
|
|
7189
|
-
const children = /* @__PURE__ */ jsxs21(
|
|
7204
|
+
const children = /* @__PURE__ */ jsxs21(Fragment10, {
|
|
7190
7205
|
children: [
|
|
7191
7206
|
node.children.map((child) => /* @__PURE__ */ jsx26(NodeView, {
|
|
7192
7207
|
node: child
|
|
@@ -7325,7 +7340,7 @@ function TemplateChildren({ node, scope }) {
|
|
|
7325
7340
|
}, generation);
|
|
7326
7341
|
}
|
|
7327
7342
|
function TemplateBlock({ items, tpl }) {
|
|
7328
|
-
return /* @__PURE__ */ jsx26(
|
|
7343
|
+
return /* @__PURE__ */ jsx26(Fragment10, {
|
|
7329
7344
|
children: items.map((item) => /* @__PURE__ */ jsx26(TemplateItemView, {
|
|
7330
7345
|
tpl,
|
|
7331
7346
|
item
|
|
@@ -7515,10 +7530,12 @@ function ExponentialSurface({
|
|
|
7515
7530
|
locale = DEFAULT_LOCALE,
|
|
7516
7531
|
timeZone,
|
|
7517
7532
|
strings: stringOverrides,
|
|
7533
|
+
readOnly = false,
|
|
7518
7534
|
host,
|
|
7519
7535
|
extensions: extensionsProp = EMPTY2,
|
|
7520
7536
|
states = EMPTY2,
|
|
7521
7537
|
measure,
|
|
7538
|
+
inlineOverlays = false,
|
|
7522
7539
|
direction: directionProp,
|
|
7523
7540
|
width,
|
|
7524
7541
|
viewportHeight,
|
|
@@ -7569,9 +7586,9 @@ function ExponentialSurface({
|
|
|
7569
7586
|
}, []);
|
|
7570
7587
|
const lastTree = useRef26({ root: null, templates: NO_TEMPLATES });
|
|
7571
7588
|
const rawRoot = surface ? surface.root : rootProp ?? null;
|
|
7572
|
-
const root = useMemo19(() => lastTree.current.root = share(lastTree.current.root, rawRoot), [rawRoot]);
|
|
7589
|
+
const root = useMemo19(() => lastTree.current.root = share(lastTree.current.root, readOnly && rawRoot ? readOnlyTree(rawRoot) : rawRoot), [rawRoot, readOnly]);
|
|
7573
7590
|
const rawTemplates = (surface ? surface.templates : templatesProp) ?? NO_TEMPLATES;
|
|
7574
|
-
const templates = useMemo19(() => lastTree.current.templates = share(lastTree.current.templates, rawTemplates), [rawTemplates]);
|
|
7591
|
+
const templates = useMemo19(() => lastTree.current.templates = share(lastTree.current.templates, readOnly ? readOnlyTemplates(rawTemplates) : rawTemplates), [rawTemplates, readOnly]);
|
|
7575
7592
|
const templateNode = useCallback11((componentId) => templates[componentId], [templates]);
|
|
7576
7593
|
const templateRoots = useMemo19(() => Object.values(templates), [templates]);
|
|
7577
7594
|
const lastBudget = useRef26(undefined);
|
|
@@ -7678,6 +7695,7 @@ function ExponentialSurface({
|
|
|
7678
7695
|
measure,
|
|
7679
7696
|
portal,
|
|
7680
7697
|
toastLayer,
|
|
7698
|
+
inlineOverlays,
|
|
7681
7699
|
direction,
|
|
7682
7700
|
functions,
|
|
7683
7701
|
openUrl,
|
|
@@ -7692,7 +7710,7 @@ function ExponentialSurface({
|
|
|
7692
7710
|
hover,
|
|
7693
7711
|
announce,
|
|
7694
7712
|
subscribe
|
|
7695
|
-
}, 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]);
|
|
7696
7714
|
const nodeEl = useCallback11((id) => rootEl?.querySelector(`[data-xui-id="${typeof CSS !== `undefined` && CSS.escape ? CSS.escape(id) : id.replace(/"/g, `\\"`)}"]`) ?? null, [rootEl]);
|
|
7697
7715
|
useImperativeHandle2(handleRef, () => {
|
|
7698
7716
|
const focus = (id) => {
|
|
@@ -7759,6 +7777,7 @@ ${compiled.css}` }), [compiled.css]);
|
|
|
7759
7777
|
"data-xui-theme": theme.id,
|
|
7760
7778
|
"data-xui-density": density === `default` ? undefined : density,
|
|
7761
7779
|
"data-xui-motion": reducedMotion ? `reduce` : undefined,
|
|
7780
|
+
"data-xui-overlays": inlineOverlays ? `inline` : undefined,
|
|
7762
7781
|
"data-xq": xq || undefined,
|
|
7763
7782
|
dir: direction,
|
|
7764
7783
|
style: width === undefined ? style : { width, ...style },
|
|
@@ -7896,7 +7915,7 @@ import { getPointer as getPointer4, setPointer as setPointer5, absolutePath as a
|
|
|
7896
7915
|
|
|
7897
7916
|
// packages/exponential-ui-react/src/host-surface.tsx
|
|
7898
7917
|
import { useCallback as useCallback13, useMemo as useMemo21, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
7899
|
-
import { jsx as jsx28, Fragment as
|
|
7918
|
+
import { jsx as jsx28, Fragment as Fragment11 } from "react/jsx-runtime";
|
|
7900
7919
|
function hostPlugin(host, base = {}) {
|
|
7901
7920
|
return {
|
|
7902
7921
|
...base,
|
|
@@ -7969,7 +7988,7 @@ function HostSurface({ host, surfaceId, plugin, fallback = null, ...rest }) {
|
|
|
7969
7988
|
const surface = useHostSurface(host, surfaceId);
|
|
7970
7989
|
const p = useMemo21(() => hostPlugin(host, plugin), [host, plugin]);
|
|
7971
7990
|
if (!surface)
|
|
7972
|
-
return /* @__PURE__ */ jsx28(
|
|
7991
|
+
return /* @__PURE__ */ jsx28(Fragment11, {
|
|
7973
7992
|
children: fallback
|
|
7974
7993
|
});
|
|
7975
7994
|
return /* @__PURE__ */ jsx28(ExponentialSurface, {
|
|
@@ -8080,5 +8099,5 @@ export {
|
|
|
8080
8099
|
walkNodes
|
|
8081
8100
|
};
|
|
8082
8101
|
|
|
8083
|
-
//# debugId=
|
|
8102
|
+
//# debugId=EF808DB07BCA693364756E2164756E21
|
|
8084
8103
|
//# sourceMappingURL=index.js.map
|