@protonradio/proton-ui 0.11.25 → 0.11.26-beta.1
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/components/Text/TextEmphasis/TextEmphasis.cjs.js +1 -1
- package/dist/components/Text/TextEmphasis/TextEmphasis.cjs.js.map +1 -1
- package/dist/components/Text/TextEmphasis/TextEmphasis.es.js +14 -14
- package/dist/components/Text/TextEmphasis/TextEmphasis.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../node_modules/react/jsx-runtime.cjs.js");;/* empty css */const m=require("../../ThemeProvider.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../../../node_modules/react/jsx-runtime.cjs.js");;/* empty css */const m=require("../../ThemeProvider.cjs.js"),u=require("../../Tooltip/Tooltip.cjs.js"),x=require("../../../utils/navigation.cjs.js"),c=require("../../../utils/string.cjs.js"),p=({to:e,children:r,tooltipProps:s,"data-testid":i})=>{const{className:a}=m.useTheme(),o=s?t.jsxRuntimeExports.jsx(u.Tooltip,{delay:50,...s,children:r}):r;if(e){const n=x.isUrlExternal(e);return t.jsxRuntimeExports.jsx("span",{className:c.csx("proton-TextEmphasis",s&&"proton-TextEmphasis--tooltip",a),children:t.jsxRuntimeExports.jsx("a",{"data-testid":i,href:e,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,onClick:n?void 0:l=>x.handleInternalNavigation(l,e),children:o})})}return t.jsxRuntimeExports.jsx("span",{className:c.csx("proton-TextEmphasis",s&&"proton-TextEmphasis--tooltip",a),"data-testid":i,children:o})};exports.TextEmphasis=p;
|
|
2
2
|
//# sourceMappingURL=TextEmphasis.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEmphasis.cjs.js","sources":["../../../../src/components/Text/TextEmphasis/TextEmphasis.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode } from \"react\";\nimport \"./TextEmphasis.css\";\n\nimport { csx } from \"../../../utils\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { TooltipProps } from \"../../Tooltip/Tooltip\";\nimport {\n handleInternalNavigation,\n isUrlExternal,\n} from \"../../../utils/navigation\";\
|
|
1
|
+
{"version":3,"file":"TextEmphasis.cjs.js","sources":["../../../../src/components/Text/TextEmphasis/TextEmphasis.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode } from \"react\";\nimport \"./TextEmphasis.css\";\n\nimport { csx } from \"../../../utils\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { Tooltip, TooltipProps } from \"../../Tooltip/Tooltip\";\nimport {\n handleInternalNavigation,\n isUrlExternal,\n} from \"../../../utils/navigation\";\n\ninterface TextEmphasisProps {\n /**\n * The URL that the text emphasis should link to. Turns the element into an `a` tag.\n */\n to?: string;\n /**\n * The content to display within the text emphasis.\n */\n children: ReactNode;\n /**\n * Props to pass to the tooltip trigger. When provided, the text emphasis will be wrapped in a tooltip trigger.\n * @see {@link TooltipProps}\n */\n tooltipProps?: Omit<TooltipProps, \"children\">;\n /**\n * A test ID.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A component that displays text with emphasis. Provide tooltipProps to wrap the text in a tooltip trigger.\n *\n * API:\n * - {@link TextEmphasisProps}\n */\nexport const TextEmphasis = ({\n to,\n children,\n tooltipProps,\n \"data-testid\": testId,\n}: TextEmphasisProps) => {\n const { className: themeClassName } = useTheme();\n\n const content = tooltipProps ? (\n <Tooltip delay={50} {...tooltipProps}>\n {children}\n </Tooltip>\n ) : (\n children\n );\n\n if (to) {\n const isExternal = isUrlExternal(to);\n return (\n <span\n className={csx(\n \"proton-TextEmphasis\",\n tooltipProps && \"proton-TextEmphasis--tooltip\",\n themeClassName\n )}\n >\n <a\n data-testid={testId}\n href={to}\n target={isExternal ? \"_blank\" : undefined}\n rel={isExternal ? \"noopener noreferrer\" : undefined}\n onClick={\n !isExternal ? (e) => handleInternalNavigation(e, to) : undefined\n }\n >\n {content}\n </a>\n </span>\n );\n }\n\n return (\n <span\n className={csx(\n \"proton-TextEmphasis\",\n tooltipProps && \"proton-TextEmphasis--tooltip\",\n themeClassName\n )}\n data-testid={testId}\n >\n {content}\n </span>\n );\n};\n"],"names":["TextEmphasis","to","children","tooltipProps","testId","themeClassName","useTheme","content","jsx","Tooltip","isExternal","isUrlExternal","csx","e","handleInternalNavigation"],"mappings":"uWAuCaA,EAAe,CAAC,CAC3B,GAAAC,EACA,SAAAC,EACA,aAAAC,EACA,cAAeC,CACjB,IAAyB,CACvB,KAAM,CAAE,UAAWC,CAAe,EAAIC,EAAS,SAAA,EAEzCC,EAAUJ,EACbK,EAAA,kBAAA,IAAAC,EAAA,QAAA,CAAQ,MAAO,GAAK,GAAGN,EACrB,SAAAD,CACH,CAAA,EAEAA,EAGF,GAAID,EAAI,CACA,MAAAS,EAAaC,gBAAcV,CAAE,EAEjC,OAAAO,EAAA,kBAAA,IAAC,OAAA,CACC,UAAWI,EAAA,IACT,sBACAT,GAAgB,+BAChBE,CACF,EAEA,SAAAG,EAAA,kBAAA,IAAC,IAAA,CACC,cAAaJ,EACb,KAAMH,EACN,OAAQS,EAAa,SAAW,OAChC,IAAKA,EAAa,sBAAwB,OAC1C,QACGA,EAAsD,OAAxCG,GAAMC,EAAyB,yBAAAD,EAAGZ,CAAE,EAGpD,SAAAM,CAAA,CACH,CAAA,CAAA,CAGN,CAGE,OAAAC,EAAA,kBAAA,IAAC,OAAA,CACC,UAAWI,EAAA,IACT,sBACAT,GAAgB,+BAChBE,CACF,EACA,cAAaD,EAEZ,SAAAG,CAAA,CAAA,CAGP"}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as s } from "../../../node_modules/react/jsx-runtime.es.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { useTheme as l } from "../../ThemeProvider.es.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Tooltip as x } from "../../Tooltip/Tooltip.es.js";
|
|
5
|
+
import { isUrlExternal as c, handleInternalNavigation as d } from "../../../utils/navigation.es.js";
|
|
6
6
|
import { csx as m } from "../../../utils/string.es.js";
|
|
7
|
-
const
|
|
7
|
+
const u = ({
|
|
8
8
|
to: e,
|
|
9
9
|
children: r,
|
|
10
|
-
tooltipProps:
|
|
10
|
+
tooltipProps: t,
|
|
11
11
|
"data-testid": n
|
|
12
12
|
}) => {
|
|
13
|
-
const { className: o } = l(), i =
|
|
13
|
+
const { className: o } = l(), i = t ? /* @__PURE__ */ s.jsx(x, { delay: 50, ...t, children: r }) : r;
|
|
14
14
|
if (e) {
|
|
15
|
-
const a =
|
|
16
|
-
return /* @__PURE__ */
|
|
15
|
+
const a = c(e);
|
|
16
|
+
return /* @__PURE__ */ s.jsx(
|
|
17
17
|
"span",
|
|
18
18
|
{
|
|
19
19
|
className: m(
|
|
20
20
|
"proton-TextEmphasis",
|
|
21
|
-
|
|
21
|
+
t && "proton-TextEmphasis--tooltip",
|
|
22
22
|
o
|
|
23
23
|
),
|
|
24
|
-
children: /* @__PURE__ */
|
|
24
|
+
children: /* @__PURE__ */ s.jsx(
|
|
25
25
|
"a",
|
|
26
26
|
{
|
|
27
27
|
"data-testid": n,
|
|
28
28
|
href: e,
|
|
29
29
|
target: a ? "_blank" : void 0,
|
|
30
30
|
rel: a ? "noopener noreferrer" : void 0,
|
|
31
|
-
onClick: a ? void 0 : (p) =>
|
|
31
|
+
onClick: a ? void 0 : (p) => d(p, e),
|
|
32
32
|
children: i
|
|
33
33
|
}
|
|
34
34
|
)
|
|
35
35
|
}
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ s.jsx(
|
|
39
39
|
"span",
|
|
40
40
|
{
|
|
41
41
|
className: m(
|
|
42
42
|
"proton-TextEmphasis",
|
|
43
|
-
|
|
43
|
+
t && "proton-TextEmphasis--tooltip",
|
|
44
44
|
o
|
|
45
45
|
),
|
|
46
46
|
"data-testid": n,
|
|
@@ -49,6 +49,6 @@ const N = ({
|
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
51
|
export {
|
|
52
|
-
|
|
52
|
+
u as TextEmphasis
|
|
53
53
|
};
|
|
54
54
|
//# sourceMappingURL=TextEmphasis.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEmphasis.es.js","sources":["../../../../src/components/Text/TextEmphasis/TextEmphasis.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode } from \"react\";\nimport \"./TextEmphasis.css\";\n\nimport { csx } from \"../../../utils\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { TooltipProps } from \"../../Tooltip/Tooltip\";\nimport {\n handleInternalNavigation,\n isUrlExternal,\n} from \"../../../utils/navigation\";\
|
|
1
|
+
{"version":3,"file":"TextEmphasis.es.js","sources":["../../../../src/components/Text/TextEmphasis/TextEmphasis.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode } from \"react\";\nimport \"./TextEmphasis.css\";\n\nimport { csx } from \"../../../utils\";\nimport { useTheme } from \"../../ThemeProvider\";\nimport { Tooltip, TooltipProps } from \"../../Tooltip/Tooltip\";\nimport {\n handleInternalNavigation,\n isUrlExternal,\n} from \"../../../utils/navigation\";\n\ninterface TextEmphasisProps {\n /**\n * The URL that the text emphasis should link to. Turns the element into an `a` tag.\n */\n to?: string;\n /**\n * The content to display within the text emphasis.\n */\n children: ReactNode;\n /**\n * Props to pass to the tooltip trigger. When provided, the text emphasis will be wrapped in a tooltip trigger.\n * @see {@link TooltipProps}\n */\n tooltipProps?: Omit<TooltipProps, \"children\">;\n /**\n * A test ID.\n */\n \"data-testid\"?: string;\n}\n\n/**\n * A component that displays text with emphasis. Provide tooltipProps to wrap the text in a tooltip trigger.\n *\n * API:\n * - {@link TextEmphasisProps}\n */\nexport const TextEmphasis = ({\n to,\n children,\n tooltipProps,\n \"data-testid\": testId,\n}: TextEmphasisProps) => {\n const { className: themeClassName } = useTheme();\n\n const content = tooltipProps ? (\n <Tooltip delay={50} {...tooltipProps}>\n {children}\n </Tooltip>\n ) : (\n children\n );\n\n if (to) {\n const isExternal = isUrlExternal(to);\n return (\n <span\n className={csx(\n \"proton-TextEmphasis\",\n tooltipProps && \"proton-TextEmphasis--tooltip\",\n themeClassName\n )}\n >\n <a\n data-testid={testId}\n href={to}\n target={isExternal ? \"_blank\" : undefined}\n rel={isExternal ? \"noopener noreferrer\" : undefined}\n onClick={\n !isExternal ? (e) => handleInternalNavigation(e, to) : undefined\n }\n >\n {content}\n </a>\n </span>\n );\n }\n\n return (\n <span\n className={csx(\n \"proton-TextEmphasis\",\n tooltipProps && \"proton-TextEmphasis--tooltip\",\n themeClassName\n )}\n data-testid={testId}\n >\n {content}\n </span>\n );\n};\n"],"names":["TextEmphasis","to","children","tooltipProps","testId","themeClassName","useTheme","content","jsx","Tooltip","isExternal","isUrlExternal","csx","e","handleInternalNavigation"],"mappings":";;;;;;AAuCO,MAAMA,IAAe,CAAC;AAAA,EAC3B,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAeC;AACjB,MAAyB;AACvB,QAAM,EAAE,WAAWC,EAAe,IAAIC,EAAS,GAEzCC,IAAUJ,IACbK,gBAAAA,EAAA,IAAAC,GAAA,EAAQ,OAAO,IAAK,GAAGN,GACrB,UAAAD,EACH,CAAA,IAEAA;AAGF,MAAID,GAAI;AACA,UAAAS,IAAaC,EAAcV,CAAE;AAEjC,WAAAO,gBAAAA,EAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWI;AAAA,UACT;AAAA,UACAT,KAAgB;AAAA,UAChBE;AAAA,QACF;AAAA,QAEA,UAAAG,gBAAAA,EAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAaJ;AAAA,YACb,MAAMH;AAAA,YACN,QAAQS,IAAa,WAAW;AAAA,YAChC,KAAKA,IAAa,wBAAwB;AAAA,YAC1C,SACGA,IAAsD,SAAzC,CAACG,MAAMC,EAAyBD,GAAGZ,CAAE;AAAA,YAGpD,UAAAM;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AAGE,SAAAC,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWI;AAAA,QACT;AAAA,QACAT,KAAgB;AAAA,QAChBE;AAAA,MACF;AAAA,MACA,eAAaD;AAAA,MAEZ,UAAAG;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|