@exponential_app/eui-react 0.13.0 → 0.15.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 +30 -5
- package/dist/index.js.map +6 -6
- package/dist/types/natives/text.d.ts +6 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -678,6 +678,8 @@ function ButtonNative({ node, props, rootProps, emit, children }) {
|
|
|
678
678
|
e.stopPropagation();
|
|
679
679
|
if (hold || inert)
|
|
680
680
|
return;
|
|
681
|
+
if (str(props.href))
|
|
682
|
+
ctx.openUrl(str(props.href));
|
|
681
683
|
track(emit(`press`));
|
|
682
684
|
if (submit)
|
|
683
685
|
form.submit();
|
|
@@ -3741,18 +3743,25 @@ var WindowedList = forwardRef(function WindowedList({ count, itemKey, renderItem
|
|
|
3741
3743
|
// packages/exponential-ui-react/src/natives/layout.tsx
|
|
3742
3744
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3743
3745
|
function BoxNative({ node, props, rootProps, emit, children }) {
|
|
3744
|
-
const
|
|
3746
|
+
const ctx = useSurfaceContext();
|
|
3747
|
+
const href = str(props.href);
|
|
3748
|
+
const pressable = bool(props.pressable) || Boolean(node.on?.press) || Boolean(href);
|
|
3745
3749
|
if (!pressable)
|
|
3746
3750
|
return /* @__PURE__ */ jsx15("div", {
|
|
3747
3751
|
...rootProps,
|
|
3748
3752
|
children
|
|
3749
3753
|
});
|
|
3754
|
+
const press = () => {
|
|
3755
|
+
if (href)
|
|
3756
|
+
ctx.openUrl(href);
|
|
3757
|
+
emit(`press`);
|
|
3758
|
+
};
|
|
3750
3759
|
const onKey = (e) => {
|
|
3751
3760
|
if (e.target !== e.currentTarget)
|
|
3752
3761
|
return;
|
|
3753
3762
|
if (e.key === `Enter` || e.key === ` `) {
|
|
3754
3763
|
e.preventDefault();
|
|
3755
|
-
|
|
3764
|
+
press();
|
|
3756
3765
|
}
|
|
3757
3766
|
};
|
|
3758
3767
|
return /* @__PURE__ */ jsx15("div", {
|
|
@@ -3760,7 +3769,7 @@ function BoxNative({ node, props, rootProps, emit, children }) {
|
|
|
3760
3769
|
"data-pressable": "true",
|
|
3761
3770
|
role: "button",
|
|
3762
3771
|
tabIndex: 0,
|
|
3763
|
-
onClick:
|
|
3772
|
+
onClick: press,
|
|
3764
3773
|
onKeyDown: onKey,
|
|
3765
3774
|
children
|
|
3766
3775
|
});
|
|
@@ -6538,6 +6547,7 @@ function RowScope({ rowsPath, row, rowKey, index, tableId, node, onLiteralEdit }
|
|
|
6538
6547
|
|
|
6539
6548
|
// packages/exponential-ui-react/src/natives/text.tsx
|
|
6540
6549
|
import { displayString as displayString3 } from "@exponential_app/eui";
|
|
6550
|
+
import { textLinkSegments } from "@exponential_app/eui/web";
|
|
6541
6551
|
|
|
6542
6552
|
// packages/exponential-ui-react/src/markdown.tsx
|
|
6543
6553
|
import { Fragment as Fragment8, createElement, useMemo as useMemo16 } from "react";
|
|
@@ -6713,7 +6723,10 @@ function BuiltinMarkdown({ text, className, host }) {
|
|
|
6713
6723
|
|
|
6714
6724
|
// packages/exponential-ui-react/src/natives/text.tsx
|
|
6715
6725
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
6726
|
+
var TEXT_LINK_STYLE = { color: `inherit`, textDecoration: `underline` };
|
|
6716
6727
|
function TextNative({ props, rootProps }) {
|
|
6728
|
+
const ctx = useSurfaceContext();
|
|
6729
|
+
const segments = props.hostLinks === true ? textLinkSegments(ctx.host, displayString3(props.text)) : null;
|
|
6717
6730
|
const lines = num(props.lines, 0);
|
|
6718
6731
|
const align = props.align === `end` ? `end` : props.align === `center` ? `center` : props.align === `start` ? `start` : undefined;
|
|
6719
6732
|
const style = {};
|
|
@@ -6729,7 +6742,18 @@ function TextNative({ props, rootProps }) {
|
|
|
6729
6742
|
"data-clamp": lines > 1 ? `` : undefined,
|
|
6730
6743
|
"data-xui-shimmer": props.shimmer === true ? `` : undefined,
|
|
6731
6744
|
style: mergeStyle(rootProps, Object.keys(style).length ? style : undefined),
|
|
6732
|
-
children:
|
|
6745
|
+
children: segments ? segments.map((segment, i) => segment.href ? /* @__PURE__ */ jsx24("a", {
|
|
6746
|
+
href: segment.href,
|
|
6747
|
+
"data-xui-text-link": "",
|
|
6748
|
+
style: TEXT_LINK_STYLE,
|
|
6749
|
+
onClick: (e) => {
|
|
6750
|
+
e.preventDefault();
|
|
6751
|
+
e.stopPropagation();
|
|
6752
|
+
ctx.openUrl(segment.href);
|
|
6753
|
+
},
|
|
6754
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
6755
|
+
children: segment.text
|
|
6756
|
+
}, i) : segment.text) : displayString3(props.text)
|
|
6733
6757
|
});
|
|
6734
6758
|
}
|
|
6735
6759
|
function MarkdownNative({ props, rootProps }) {
|
|
@@ -7929,6 +7953,7 @@ function hostPlugin(host, base = {}) {
|
|
|
7929
7953
|
openUrl: (url) => {
|
|
7930
7954
|
host.openUrl(url);
|
|
7931
7955
|
},
|
|
7956
|
+
textLinks: (text) => host.textLinks(text),
|
|
7932
7957
|
urls: host.urlPolicy(),
|
|
7933
7958
|
media: host.mediaOptions(),
|
|
7934
7959
|
mediaRequest: base.mediaRequest ?? ((src) => host.mediaRequest(src)),
|
|
@@ -8097,5 +8122,5 @@ export {
|
|
|
8097
8122
|
walkNodes
|
|
8098
8123
|
};
|
|
8099
8124
|
|
|
8100
|
-
//# debugId=
|
|
8125
|
+
//# debugId=7933C1446ED0A0FC64756E2164756E21
|
|
8101
8126
|
//# sourceMappingURL=index.js.map
|