@solibo/solibo-ui 2.0.2 → 2.1.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/assets/index.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index21.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index35.css +1 -1
- package/dist/assets/index36.css +1 -1
- package/dist/assets/index37.css +1 -1
- package/dist/assets/index38.css +1 -1
- package/dist/assets/index39.css +1 -1
- package/dist/assets/index40.css +1 -1
- package/dist/assets/index41.css +1 -1
- package/dist/assets/index42.css +1 -1
- package/dist/assets/index43.css +1 -1
- package/dist/assets/index44.css +1 -1
- package/dist/assets/index45.css +1 -1
- package/dist/assets/index46.css +1 -1
- package/dist/assets/index47.css +1 -1
- package/dist/assets/index48.css +1 -1
- package/dist/assets/index49.css +1 -1
- package/dist/assets/index50.css +1 -1
- package/dist/assets/index51.css +1 -1
- package/dist/assets/index52.css +1 -1
- package/dist/assets/index53.css +1 -1
- package/dist/assets/index54.css +1 -1
- package/dist/assets/index55.css +1 -0
- package/dist/assets/index6.css +1 -1
- package/dist/components/badge/index.cjs +1 -1
- package/dist/components/badge/index.js +38 -38
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/clipboard/index.cjs +2 -0
- package/dist/components/clipboard/index.cjs.map +1 -0
- package/dist/components/clipboard/index.js +29 -0
- package/dist/components/clipboard/index.js.map +1 -0
- package/dist/components/collapsible/index.cjs +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/controls/index.cjs +1 -1
- package/dist/components/controls/index.js +2 -2
- package/dist/components/croppable/index.cjs +1 -1
- package/dist/components/croppable/index.js +1 -1
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.js +35 -35
- package/dist/components/divider/index.cjs +1 -1
- package/dist/components/divider/index.js +3 -3
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.js +4 -4
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +1 -1
- package/dist/components/editor/index.cjs +1 -1
- package/dist/components/editor/index.js +2 -2
- package/dist/components/empty-state/index.cjs +1 -1
- package/dist/components/empty-state/index.cjs.map +1 -1
- package/dist/components/empty-state/index.js +16 -11
- package/dist/components/empty-state/index.js.map +1 -1
- package/dist/components/fieldset/index.cjs +1 -1
- package/dist/components/fieldset/index.js +1 -1
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +1 -1
- package/dist/components/file/index.cjs +1 -1
- package/dist/components/file/index.js +1 -1
- package/dist/components/graph/index.cjs +1 -1
- package/dist/components/graph/index.js +26 -26
- package/dist/components/group/index.cjs +1 -1
- package/dist/components/group/index.js +3 -3
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.cjs.map +1 -1
- package/dist/components/header/index.js +22 -22
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.cjs.map +1 -1
- package/dist/components/icon/index.js +28 -26
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/iframe/index.cjs +1 -1
- package/dist/components/iframe/index.cjs.map +1 -1
- package/dist/components/iframe/index.js +45 -44
- package/dist/components/iframe/index.js.map +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +1 -1
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.cjs.map +1 -1
- package/dist/components/list/index.js +72 -44
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/loading/index.cjs +1 -1
- package/dist/components/loading/index.js +1 -1
- package/dist/components/menu/index.cjs +1 -1
- package/dist/components/menu/index.cjs.map +1 -1
- package/dist/components/menu/index.js +23 -22
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/message/index.cjs +1 -1
- package/dist/components/message/index.cjs.map +1 -1
- package/dist/components/message/index.js +33 -33
- package/dist/components/message/index.js.map +1 -1
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.js +30 -30
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.cjs.map +1 -1
- package/dist/components/popover/index.js +81 -69
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +2 -2
- package/dist/components/sortable/index.cjs.map +1 -1
- package/dist/components/sortable/index.js.map +1 -1
- package/dist/components/table/index.cjs.map +1 -1
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/textarea/index.cjs +1 -1
- package/dist/components/textarea/index.js +12 -12
- package/dist/components/toolbar/index.cjs +1 -1
- package/dist/components/toolbar/index.js +1 -1
- package/dist/components/widget/index.cjs +1 -1
- package/dist/components/widget/index.cjs.map +1 -1
- package/dist/components/widget/index.js +13 -8
- package/dist/components/widget/index.js.map +1 -1
- package/dist/icons-BTif0nDb.cjs +2 -0
- package/dist/icons-BTif0nDb.cjs.map +1 -0
- package/dist/{icons-dUP7sKyt.js → icons-CBbpxsJF.js} +32 -5
- package/dist/icons-CBbpxsJF.js.map +1 -0
- package/dist/{index-Bt7vnwji.cjs → index-5qUTKX7P.cjs} +2 -2
- package/dist/{index-Bt7vnwji.cjs.map → index-5qUTKX7P.cjs.map} +1 -1
- package/dist/{index-BLb3JiCr.js → index-BuSfz4qx.js} +3 -3
- package/dist/{index-BLb3JiCr.js.map → index-BuSfz4qx.js.map} +1 -1
- package/dist/index-CeHwRKAg.cjs +2 -0
- package/dist/{index-CQlMdqOp.cjs.map → index-CeHwRKAg.cjs.map} +1 -1
- package/dist/index-DBWgRXp9.js +83 -0
- package/dist/{index-CbJ2-IPc.js.map → index-DBWgRXp9.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +45 -7
- package/dist/index.js +97 -95
- package/dist/index.js.map +1 -1
- package/dist/menu-popover-CdhAgSQb.cjs +2 -0
- package/dist/menu-popover-CdhAgSQb.cjs.map +1 -0
- package/dist/menu-popover-D-Ax5zzy.js +77 -0
- package/dist/menu-popover-D-Ax5zzy.js.map +1 -0
- package/dist/tokens.json +1 -1
- package/package.json +1 -1
- package/dist/icons-Dv_p0bUF.cjs +0 -2
- package/dist/icons-Dv_p0bUF.cjs.map +0 -1
- package/dist/icons-dUP7sKyt.js.map +0 -1
- package/dist/index-CQlMdqOp.cjs +0 -2
- package/dist/index-CbJ2-IPc.js +0 -83
- package/dist/menu-popover-CM3v5s-5.cjs +0 -2
- package/dist/menu-popover-CM3v5s-5.cjs.map +0 -1
- package/dist/menu-popover-DOkciab5.js +0 -74
- package/dist/menu-popover-DOkciab5.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index45.css');const s=require("react/jsx-runtime"),i=require("../../classix-5H4IWnMA.cjs"),l="_fieldset_f5vpp_1",d={fieldset:l},o=({className:e,...t})=>s.jsx("fieldset",{className:i.t(d.fieldset,e),...t,"data-component":"fieldset"});exports.Fieldset=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { t as o } from "../../classix-DG18itHa.js";
|
|
3
|
-
import '../../assets/
|
|
3
|
+
import '../../assets/index45.css';const f = "_fieldset_f5vpp_1", i = {
|
|
4
4
|
fieldset: f
|
|
5
5
|
}, m = ({
|
|
6
6
|
className: e,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index46.css');const r=require("react/jsx-runtime"),s=require("../../classix-5H4IWnMA.cjs"),n="_figure_spygr_1",u={figure:n},c=({accessibleLabel:e,children:t,className:i})=>r.jsxs("figure",{className:s.t(u.figure,i),"data-component":"figure",children:[t,e&&r.jsx("figcaption",{"data-content":"screen-reader",children:e})]});exports.Figure=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { t as n } from "../../classix-DG18itHa.js";
|
|
3
|
-
import '../../assets/
|
|
3
|
+
import '../../assets/index46.css';const s = "_figure_spygr_1", f = {
|
|
4
4
|
figure: s
|
|
5
5
|
}, u = ({
|
|
6
6
|
accessibleLabel: r,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index47.css');const e=require("react/jsx-runtime"),j=require("../figure/index.cjs"),x=require("../icon/index.cjs"),f=require("../button/index.cjs"),N="_file_1uuq9_1",q="_action_1uuq9_14",F="_details_1uuq9_61",b="_name_1uuq9_68",g="_extension_1uuq9_80",I="_subtitle_1uuq9_90",t={file:N,action:q,delete:"_delete_1uuq9_15",details:F,"name-line":"_name-line_1uuq9_68",name:b,extension:g,subtitle:I},P={".doc":"FileDoc",".docx":"FileDoc",".pdf":"FilePdf",".ppt":"FilePpt",".pptx":"FilePpt",".xls":"FileXls",".xlsx":"FileXls"},y=({deleteAccessibleLabel:_,name:s,onClick:n,onDelete:a,ref:m,subtitle:r,url:u})=>{const i=s.lastIndexOf("."),d=i>0&&i<s.length-1,p=d?s.slice(0,i):s,c=d?s.slice(i):"",h=P[c.toLowerCase()]??"FileText",o=e.jsxs(e.Fragment,{children:[e.jsx(j.Figure,{children:e.jsx(x.Icon,{name:h})}),e.jsxs("span",{className:t.details,children:[e.jsxs("span",{className:t["name-line"],children:[e.jsx("span",{className:t.name,children:p}),c&&e.jsx("span",{className:t.extension,children:c})]}),r&&e.jsx("span",{className:t.subtitle,children:r})]})]});return e.jsxs("div",{className:t.file,ref:m,"data-component":"file",children:[u?e.jsx("a",{className:t.action,href:u,onClick:l=>{l.stopPropagation(),n&&(l.preventDefault(),n())},title:s,children:o}):n?e.jsx("button",{"aria-label":s,className:t.action,"data-actionable":"true",onClick:l=>{l.stopPropagation(),n()},title:s,type:"button",children:o}):e.jsx("div",{className:t.action,title:s,children:o}),a&&e.jsx(f.Button,{"aria-label":_??`Delete ${s}`,className:t.delete,onClick:()=>a(),variant:"tertiary",children:e.jsx(x.Icon,{name:"Trash",size:"small"})})]})};exports.File=y;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,7 +2,7 @@ import { jsxs as a, jsx as t, Fragment as N } from "react/jsx-runtime";
|
|
|
2
2
|
import { Figure as F } from "../figure/index.js";
|
|
3
3
|
import { Icon as p } from "../icon/index.js";
|
|
4
4
|
import { Button as b } from "../button/index.js";
|
|
5
|
-
import '../../assets/
|
|
5
|
+
import '../../assets/index47.css';const q = "_file_1uuq9_1", g = "_action_1uuq9_14", I = "_details_1uuq9_61", P = "_name_1uuq9_68", v = "_extension_1uuq9_80", y = "_subtitle_1uuq9_90", n = {
|
|
6
6
|
file: q,
|
|
7
7
|
action: g,
|
|
8
8
|
delete: "_delete_1uuq9_15",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index21.css');const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index21.css');const a=require("react/jsx-runtime"),b=require("../../classix-5H4IWnMA.cjs"),j=require("../loading/index.cjs"),q="_graph_plhqd_11",v="_plot_plhqd_20",N="_item_plhqd_34",y="_column_plhqd_40",f="_value_plhqd_48",k="_track_plhqd_58",M="_bar_plhqd_65",V="_label_plhqd_87",l={graph:q,plot:v,item:N,column:y,value:f,track:k,bar:M,label:V,"is-loading":"_is-loading_plhqd_96"},h=e=>Number.isFinite(e)?Math.max(0,e):0,S=({accessibleLabel:e,className:i,height:r,items:n=[],style:p,valueFormatter:d=t=>t.toLocaleString(),...u})=>{const t=n.reduce((s,c)=>Math.max(s,h(c.value)),0),_={...p,"--graph-columns":Math.max(n.length,1),"--graph-height":r||"calc(var(--utils-tokens-unit) * 16)"};return a.jsxs("figure",{className:b.t(l.graph,i),style:_,...u,"data-component":"graph",children:[e&&a.jsx("figcaption",{"data-content":"screen-reader",children:e}),n.length>0?a.jsx("ul",{className:l.plot,children:n.map((s,c)=>{const o=h(s.value),m=t>0?o/t*100:0,g=o>0?Math.max(m,6):0,x={"--bar-color":s.color,"--bar-delay":c*50+"ms","--bar-height":g+"%"};return a.jsxs("li",{className:l.item,"data-component":"graph",children:[a.jsxs("div",{className:l.column,children:[a.jsx("span",{className:l.value,children:d(s.value)}),a.jsx("span",{className:l.track,children:a.jsx("span",{className:l.bar,style:x})})]}),a.jsx("span",{className:l.label,title:s.label,children:s.label})]},s.label+c)})}):a.jsx("div",{className:l["is-loading"],children:a.jsx(j.Loading,{})})]})};exports.Graph=S;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { jsxs as s, jsx as
|
|
2
|
-
import { t as
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { t as q } from "../../classix-DG18itHa.js";
|
|
3
3
|
import { Loading as v } from "../loading/index.js";
|
|
4
|
-
import '../../assets/index21.css';const f = "
|
|
4
|
+
import '../../assets/index21.css';const f = "_graph_plhqd_11", x = "_plot_plhqd_20", k = "_item_plhqd_34", V = "_column_plhqd_40", y = "_value_plhqd_48", M = "_track_plhqd_58", w = "_bar_plhqd_65", j = "_label_plhqd_87", a = {
|
|
5
5
|
graph: f,
|
|
6
6
|
plot: x,
|
|
7
7
|
item: k,
|
|
8
8
|
column: V,
|
|
9
9
|
value: y,
|
|
10
10
|
track: M,
|
|
11
|
-
bar:
|
|
12
|
-
label:
|
|
13
|
-
"is-loading": "_is-
|
|
14
|
-
},
|
|
15
|
-
accessibleLabel:
|
|
16
|
-
className:
|
|
11
|
+
bar: w,
|
|
12
|
+
label: j,
|
|
13
|
+
"is-loading": "_is-loading_plhqd_96"
|
|
14
|
+
}, p = (e) => Number.isFinite(e) ? Math.max(0, e) : 0, G = ({
|
|
15
|
+
accessibleLabel: e,
|
|
16
|
+
className: d,
|
|
17
17
|
height: o,
|
|
18
18
|
items: n = [],
|
|
19
|
-
style:
|
|
20
|
-
valueFormatter:
|
|
21
|
-
...
|
|
19
|
+
style: i,
|
|
20
|
+
valueFormatter: _ = (r) => r.toLocaleString(),
|
|
21
|
+
...m
|
|
22
22
|
}) => {
|
|
23
|
-
const r = n.reduce((
|
|
24
|
-
...
|
|
23
|
+
const r = n.reduce((l, c) => Math.max(l, p(c.value)), 0), u = {
|
|
24
|
+
...i,
|
|
25
25
|
"--graph-columns": Math.max(n.length, 1),
|
|
26
26
|
"--graph-height": o || "calc(var(--utils-tokens-unit) * 16)"
|
|
27
27
|
};
|
|
28
|
-
return /* @__PURE__ */ s("figure", { className:
|
|
29
|
-
|
|
30
|
-
n.length > 0 ? /* @__PURE__ */
|
|
31
|
-
const
|
|
32
|
-
"--bar-color":
|
|
28
|
+
return /* @__PURE__ */ s("figure", { className: q(a.graph, d), style: u, ...m, "data-component": "graph", children: [
|
|
29
|
+
e && /* @__PURE__ */ t("figcaption", { "data-content": "screen-reader", children: e }),
|
|
30
|
+
n.length > 0 ? /* @__PURE__ */ t("ul", { className: a.plot, children: n.map((l, c) => {
|
|
31
|
+
const h = p(l.value), g = r > 0 ? h / r * 100 : 0, b = h > 0 ? Math.max(g, 6) : 0, N = {
|
|
32
|
+
"--bar-color": l.color,
|
|
33
33
|
"--bar-delay": c * 50 + "ms",
|
|
34
|
-
"--bar-height":
|
|
34
|
+
"--bar-height": b + "%"
|
|
35
35
|
};
|
|
36
36
|
return /* @__PURE__ */ s("li", { className: a.item, "data-component": "graph", children: [
|
|
37
37
|
/* @__PURE__ */ s("div", { className: a.column, children: [
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ t("span", { className: a.value, children: _(l.value) }),
|
|
39
|
+
/* @__PURE__ */ t("span", { className: a.track, children: /* @__PURE__ */ t("span", { className: a.bar, style: N }) })
|
|
40
40
|
] }),
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
] },
|
|
43
|
-
}) }) : /* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ t("span", { className: a.label, title: l.label, children: l.label })
|
|
42
|
+
] }, l.label + c);
|
|
43
|
+
}) }) : /* @__PURE__ */ t("div", { className: a["is-loading"], children: /* @__PURE__ */ t(v, {}) })
|
|
44
44
|
] });
|
|
45
45
|
};
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
G as Graph
|
|
48
48
|
};
|
|
49
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index20.css');const s=require("react/jsx-runtime"),u=require("../../classix-5H4IWnMA.cjs"),a="
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index20.css');const s=require("react/jsx-runtime"),u=require("../../classix-5H4IWnMA.cjs"),a="_group_8bgfi_1",n={group:a},i=({animation:t,children:r,className:o,...e})=>s.jsx("div",{className:u.t(o,n.group),"data-animation":t,"data-wrapper":!0,...e,"data-component":"group",children:r});exports.Group=i;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { t as n } from "../../classix-DG18itHa.js";
|
|
3
|
-
import '../../assets/index20.css';const s = "
|
|
3
|
+
import '../../assets/index20.css';const s = "_group_8bgfi_1", u = {
|
|
4
4
|
group: s
|
|
5
|
-
},
|
|
5
|
+
}, g = ({
|
|
6
6
|
animation: o,
|
|
7
7
|
children: r,
|
|
8
8
|
className: t,
|
|
9
9
|
...p
|
|
10
10
|
}) => /* @__PURE__ */ a("div", { className: n(t, u.group), "data-animation": o, "data-wrapper": !0, ...p, "data-component": "group", children: r });
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
g as Group
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index19.css');const t=require("react/jsx-runtime"),u=require("../../classix-5H4IWnMA.cjs"),_="
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index19.css');const t=require("react/jsx-runtime"),u=require("../../classix-5H4IWnMA.cjs"),_="_header_1p43o_1",m="_controls_1p43o_58",j="_cta_1p43o_85",p="_jumbo_1p43o_135",e={header:_,controls:m,cta:j,"header-content":"_header-content_1p43o_97",jumbo:p},b={default:e.default,jumbo:e.jumbo},x=({backButton:n,capitalize:r=!1,children:d,controls:s,cta:o,header:l,subHeader:i,variant:h="default"})=>{const a=t.jsxs("div",{className:e["header-content"],children:[n,l,i]}),c=s?t.jsxs("div",{className:e.controls,children:[a,s]}):a;return t.jsxs("header",{className:u.t(e.header,b[h],r&&e.capitalize),"data-component":"header",children:[o?t.jsxs("div",{className:e.cta,children:[c,o]}):c,d]})};exports.Header=x;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/header/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nconst variants = {\n default: styles.default,\n jumbo: styles.jumbo,\n};\n\nexport type HeaderProps = {\n backButton?: React.ReactNode;\n capitalize?: boolean;\n children?: React.ReactNode;\n controls?: React.ReactNode;\n cta?: React.ReactNode;\n header?: React.ReactNode;\n subHeader?: React.ReactNode;\n variant?: keyof typeof variants;\n};\n\nexport const Header = ({\n backButton,\n capitalize = false,\n children,\n controls,\n cta,\n header,\n subHeader,\n variant = 'default',\n}: HeaderProps) => {\n const headerElement = (\n <div className={styles['header-content']}>\n {backButton}\n {header}\n {subHeader}\n </div>\n );\n\n const headerWithControls = controls ? (\n <div className={styles.controls}>\n {headerElement}\n {controls}\n </div>\n ) : (\n headerElement\n );\n\n return (\n <header className={cx(styles.header, variants[variant], capitalize && styles.capitalize)}>\n {cta ? (\n <div className={styles.cta}>\n {headerWithControls}\n {cta}\n </div>\n ) : (\n headerWithControls\n )}\n {children}\n </header>\n );\n};\n"],"names":["variants","default","styles","jumbo","Header","backButton","capitalize","children","controls","cta","header","subHeader","variant","headerElement","jsxs","headerWithControls","cx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/header/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nconst variants = {\n default: styles.default,\n jumbo: styles.jumbo,\n};\n\nexport type HeaderProps = {\n backButton?: React.ReactNode;\n capitalize?: boolean;\n children?: React.ReactNode;\n controls?: React.ReactNode;\n cta?: React.ReactNode;\n header?: React.ReactNode;\n subHeader?: React.ReactNode;\n variant?: keyof typeof variants;\n};\n\nexport const Header = ({\n backButton,\n capitalize = false,\n children,\n controls,\n cta,\n header,\n subHeader,\n variant = 'default',\n}: HeaderProps) => {\n const headerElement = (\n <div className={styles['header-content']}>\n {backButton}\n {header}\n {subHeader}\n </div>\n );\n\n const headerWithControls = controls ? (\n <div className={styles.controls}>\n {headerElement}\n {controls}\n </div>\n ) : (\n headerElement\n );\n\n return (\n <header className={cx(styles.header, variants[variant], capitalize && styles.capitalize)}>\n {cta ? (\n <div className={styles.cta}>\n {headerWithControls}\n {cta}\n </div>\n ) : (\n headerWithControls\n )}\n {children}\n </header>\n );\n};\n"],"names":["variants","default","styles","jumbo","Header","backButton","capitalize","children","controls","cta","header","subHeader","variant","headerElement","jsxs","headerWithControls","cx"],"mappings":"iUAIMA,EAAW,CACfC,QAASC,EAAOD,QAChBE,MAAOD,EAAOC,KAChB,EAaaC,EAASA,CAAC,CACrBC,WAAAA,EACAC,WAAAA,EAAa,GACbC,SAAAA,EACAC,SAAAA,EACAC,IAAAA,EACAC,OAAAA,EACAC,UAAAA,EACAC,QAAAA,EAAU,SACC,IAAM,CACjB,MAAMC,EACJC,EAAAA,KAAC,MAAA,CAAI,UAAWZ,EAAO,gBAAgB,EACpCG,SAAAA,CAAAA,EACAK,EACAC,CAAAA,EACH,EAGII,EAAqBP,EACzBM,OAAC,MAAA,CAAI,UAAWZ,EAAOM,SACpBK,SAAAA,CAAAA,EACAL,CAAAA,CAAAA,CACH,EAEAK,EAGF,OACEC,EAAAA,KAAC,SAAA,CAAO,UAAWE,EAAAA,EAAGd,EAAOQ,OAAQV,EAASY,CAAO,EAAGN,GAAcJ,EAAOI,UAAU,EAAE,iBAAA,SACtFG,SAAAA,CAAAA,EACCK,EAAAA,KAAC,MAAA,CAAI,UAAWZ,EAAOO,IACpBM,SAAAA,CAAAA,EACAN,CAAAA,CAAAA,CACH,EAEAM,EAEDR,CAAAA,EACH,CAEJ"}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o } from "react/jsx-runtime";
|
|
2
2
|
import { t as _ } from "../../classix-DG18itHa.js";
|
|
3
|
-
import '../../assets/index19.css';const i = "
|
|
3
|
+
import '../../assets/index19.css';const i = "_header_1p43o_1", p = "_controls_1p43o_58", u = "_cta_1p43o_85", f = "_jumbo_1p43o_135", e = {
|
|
4
4
|
header: i,
|
|
5
|
-
controls:
|
|
5
|
+
controls: p,
|
|
6
6
|
cta: u,
|
|
7
|
-
"header-content": "_header-
|
|
8
|
-
jumbo:
|
|
9
|
-
},
|
|
7
|
+
"header-content": "_header-content_1p43o_97",
|
|
8
|
+
jumbo: f
|
|
9
|
+
}, j = {
|
|
10
10
|
default: e.default,
|
|
11
11
|
jumbo: e.jumbo
|
|
12
|
-
},
|
|
13
|
-
backButton:
|
|
12
|
+
}, N = ({
|
|
13
|
+
backButton: r,
|
|
14
14
|
capitalize: s = !1,
|
|
15
15
|
children: d,
|
|
16
|
-
controls:
|
|
17
|
-
cta:
|
|
16
|
+
controls: t,
|
|
17
|
+
cta: a,
|
|
18
18
|
header: l,
|
|
19
19
|
subHeader: h,
|
|
20
20
|
variant: m = "default"
|
|
21
21
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const c = /* @__PURE__ */ o("div", { className: e["header-content"], children: [
|
|
23
|
+
r,
|
|
24
24
|
l,
|
|
25
25
|
h
|
|
26
|
-
] }),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
] }) :
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
] }) :
|
|
26
|
+
] }), n = t ? /* @__PURE__ */ o("div", { className: e.controls, children: [
|
|
27
|
+
c,
|
|
28
|
+
t
|
|
29
|
+
] }) : c;
|
|
30
|
+
return /* @__PURE__ */ o("header", { className: _(e.header, j[m], s && e.capitalize), "data-component": "header", children: [
|
|
31
|
+
a ? /* @__PURE__ */ o("div", { className: e.cta, children: [
|
|
32
|
+
n,
|
|
33
|
+
a
|
|
34
|
+
] }) : n,
|
|
35
35
|
d
|
|
36
36
|
] });
|
|
37
37
|
};
|
|
38
38
|
export {
|
|
39
|
-
|
|
39
|
+
N as Header
|
|
40
40
|
};
|
|
41
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index48.css');const c=require("react/jsx-runtime"),r=require("../../classix-5H4IWnMA.cjs"),l=require("../../icons-BTif0nDb.cjs"),_="_icon_23h6o_1",m="_large_23h6o_10",g="_medium_23h6o_15",d="_small_23h6o_20",u="_tiny_23h6o_25",h="_danger_23h6o_30",n={icon:_,large:m,medium:g,small:d,tiny:u,danger:h,"gap-right":"_gap-right_23h6o_34","gap-left":"_gap-left_23h6o_38"},y={large:n.large,medium:n.medium,small:n.small,tiny:n.tiny},p={danger:n.danger},S=({gap:e="none",name:t,size:s="medium",variant:o,weight:i})=>{const a={maskImage:l.iconSVG(t,void 0,i)};return c.jsx("span",{"aria-hidden":"true",className:r.t(e!=="none"&&n[`gap-${e}`],y[s],n.icon,o&&p[o]),style:a,"data-component":"icon"})};exports.Icon=S;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/icon/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { type IconName, iconSVG, type IconWeight } from './icons';\nimport styles from './styles.module.css';\n\nexport type { IconName, IconWeight } from './icons';\n\nconst sizes = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n};\n\nconst variants = {\n danger: styles.danger,\n};\n\nexport type IconProps = {\n gap?: 'left' | 'none' | 'right';\n name: IconName;\n size?: keyof typeof sizes;\n variant?: keyof typeof variants;\n weight?: IconWeight;\n};\n\nexport const Icon = ({ gap = 'none', name, size = 'medium', variant, weight }: IconProps) => {\n const iconStyle = {\n maskImage: iconSVG(name, undefined, weight),\n } as React.CSSProperties;\n\n return (\n <span\n aria-hidden='true'\n className={cx(\n gap !== 'none' && styles[`gap-${gap}`],\n sizes[size],\n styles.icon,\n variant && variants[variant]\n )}\n style={iconStyle}\n />\n );\n};\n"],"names":["sizes","large","styles","medium","small","variants","danger","Icon","gap","name","size","variant","weight","iconStyle","maskImage","iconSVG","undefined","jsx","cx","icon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/icon/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { type IconName, iconSVG, type IconWeight } from './icons';\nimport styles from './styles.module.css';\n\nexport type { IconName, IconWeight } from './icons';\n\nconst sizes = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n tiny: styles.tiny,\n};\n\nconst variants = {\n danger: styles.danger,\n};\n\nexport type IconProps = {\n gap?: 'left' | 'none' | 'right';\n name: IconName;\n size?: keyof typeof sizes;\n variant?: keyof typeof variants;\n weight?: IconWeight;\n};\n\nexport const Icon = ({ gap = 'none', name, size = 'medium', variant, weight }: IconProps) => {\n const iconStyle = {\n maskImage: iconSVG(name, undefined, weight),\n } as React.CSSProperties;\n\n return (\n <span\n aria-hidden='true'\n className={cx(\n gap !== 'none' && styles[`gap-${gap}`],\n sizes[size],\n styles.icon,\n variant && variants[variant]\n )}\n style={iconStyle}\n />\n );\n};\n"],"names":["sizes","large","styles","medium","small","tiny","variants","danger","Icon","gap","name","size","variant","weight","iconStyle","maskImage","iconSVG","undefined","jsx","cx","icon"],"mappings":"gbAOMA,EAAQ,CACZC,MAAOC,EAAOD,MACdE,OAAQD,EAAOC,OACfC,MAAOF,EAAOE,MACdC,KAAMH,EAAOG,IACf,EAEMC,EAAW,CACfC,OAAQL,EAAOK,MACjB,EAUaC,EAAOA,CAAC,CAAEC,IAAAA,EAAM,OAAQC,KAAAA,EAAMC,KAAAA,EAAO,SAAUC,QAAAA,EAASC,OAAAA,CAAkB,IAAM,CAC3F,MAAMC,EAAY,CAChBC,UAAWC,EAAAA,QAAQN,EAAMO,OAAWJ,CAAM,CAAA,EAG5C,OACEK,EAAAA,IAAC,OAAA,CACC,cAAY,OACZ,UAAWC,IACTV,IAAQ,QAAUP,EAAO,OAAOO,CAAG,EAAE,EACrCT,EAAMW,CAAI,EACVT,EAAOkB,KACPR,GAAWN,EAASM,CAAO,CAC7B,EACA,MAAOE,EAAU,iBAAA,MAAA,CAAA,CAGvB"}
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { t as
|
|
3
|
-
import { i as r } from "../../icons-
|
|
4
|
-
import '../../assets/
|
|
5
|
-
icon:
|
|
6
|
-
|
|
7
|
-
medium:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"gap-
|
|
12
|
-
|
|
13
|
-
large: n.large,
|
|
14
|
-
medium: n.medium,
|
|
15
|
-
small: n.small
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { t as _ } from "../../classix-DG18itHa.js";
|
|
3
|
+
import { i as r } from "../../icons-CBbpxsJF.js";
|
|
4
|
+
import '../../assets/index48.css';const c = "_icon_23h6o_1", l = "_large_23h6o_10", g = "_medium_23h6o_15", d = "_small_23h6o_20", h = "_tiny_23h6o_25", p = "_danger_23h6o_30", o = {
|
|
5
|
+
icon: c,
|
|
6
|
+
large: l,
|
|
7
|
+
medium: g,
|
|
8
|
+
small: d,
|
|
9
|
+
tiny: h,
|
|
10
|
+
danger: p,
|
|
11
|
+
"gap-right": "_gap-right_23h6o_34",
|
|
12
|
+
"gap-left": "_gap-left_23h6o_38"
|
|
16
13
|
}, u = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
large: o.large,
|
|
15
|
+
medium: o.medium,
|
|
16
|
+
small: o.small,
|
|
17
|
+
tiny: o.tiny
|
|
18
|
+
}, y = {
|
|
19
|
+
danger: o.danger
|
|
20
|
+
}, S = ({
|
|
21
|
+
gap: n = "none",
|
|
22
|
+
name: e,
|
|
23
|
+
size: a = "medium",
|
|
24
|
+
variant: t,
|
|
25
|
+
weight: i
|
|
24
26
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
maskImage: r(
|
|
27
|
+
const s = {
|
|
28
|
+
maskImage: r(e, void 0, i)
|
|
27
29
|
};
|
|
28
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ m("span", { "aria-hidden": "true", className: _(n !== "none" && o[`gap-${n}`], u[a], o.icon, t && y[t]), style: s, "data-component": "icon" });
|
|
29
31
|
};
|
|
30
32
|
export {
|
|
31
|
-
|
|
33
|
+
S as Icon
|
|
32
34
|
};
|
|
33
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/icon/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { type IconName, iconSVG, type IconWeight } from './icons';\nimport styles from './styles.module.css';\n\nexport type { IconName, IconWeight } from './icons';\n\nconst sizes = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n};\n\nconst variants = {\n danger: styles.danger,\n};\n\nexport type IconProps = {\n gap?: 'left' | 'none' | 'right';\n name: IconName;\n size?: keyof typeof sizes;\n variant?: keyof typeof variants;\n weight?: IconWeight;\n};\n\nexport const Icon = ({ gap = 'none', name, size = 'medium', variant, weight }: IconProps) => {\n const iconStyle = {\n maskImage: iconSVG(name, undefined, weight),\n } as React.CSSProperties;\n\n return (\n <span\n aria-hidden='true'\n className={cx(\n gap !== 'none' && styles[`gap-${gap}`],\n sizes[size],\n styles.icon,\n variant && variants[variant]\n )}\n style={iconStyle}\n />\n );\n};\n"],"names":["sizes","large","styles","medium","small","variants","danger","Icon","gap","name","size","variant","weight","iconStyle","maskImage","iconSVG","undefined","jsx","cx","icon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/icon/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { type IconName, iconSVG, type IconWeight } from './icons';\nimport styles from './styles.module.css';\n\nexport type { IconName, IconWeight } from './icons';\n\nconst sizes = {\n large: styles.large,\n medium: styles.medium,\n small: styles.small,\n tiny: styles.tiny,\n};\n\nconst variants = {\n danger: styles.danger,\n};\n\nexport type IconProps = {\n gap?: 'left' | 'none' | 'right';\n name: IconName;\n size?: keyof typeof sizes;\n variant?: keyof typeof variants;\n weight?: IconWeight;\n};\n\nexport const Icon = ({ gap = 'none', name, size = 'medium', variant, weight }: IconProps) => {\n const iconStyle = {\n maskImage: iconSVG(name, undefined, weight),\n } as React.CSSProperties;\n\n return (\n <span\n aria-hidden='true'\n className={cx(\n gap !== 'none' && styles[`gap-${gap}`],\n sizes[size],\n styles.icon,\n variant && variants[variant]\n )}\n style={iconStyle}\n />\n );\n};\n"],"names":["sizes","large","styles","medium","small","tiny","variants","danger","Icon","gap","name","size","variant","weight","iconStyle","maskImage","iconSVG","undefined","jsx","cx","icon"],"mappings":";;;;;;;;;;;;GAOMA,IAAQ;AAAA,EACZC,OAAOC,EAAOD;AAAAA,EACdE,QAAQD,EAAOC;AAAAA,EACfC,OAAOF,EAAOE;AAAAA,EACdC,MAAMH,EAAOG;AACf,GAEMC,IAAW;AAAA,EACfC,QAAQL,EAAOK;AACjB,GAUaC,IAAOA,CAAC;AAAA,EAAEC,KAAAA,IAAM;AAAA,EAAQC,MAAAA;AAAAA,EAAMC,MAAAA,IAAO;AAAA,EAAUC,SAAAA;AAAAA,EAASC,QAAAA;AAAkB,MAAM;AAC3F,QAAMC,IAAY;AAAA,IAChBC,WAAWC,EAAQN,GAAMO,QAAWJ,CAAM;AAAA,EAAA;AAG5C,SACE,gBAAAK,EAAC,QAAA,EACC,eAAY,QACZ,WAAWC,EACTV,MAAQ,UAAUP,EAAO,OAAOO,CAAG,EAAE,GACrCT,EAAMW,CAAI,GACVT,EAAOkB,MACPR,KAAWN,EAASM,CAAO,CAC7B,GACA,OAAOE,GAAU,kBAAA,OAAA,CAAA;AAGvB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index18.css');const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index18.css');const l=require("react/jsx-runtime"),C=require("../../classix-5H4IWnMA.cjs"),s=require("react"),S=require("../button/index.cjs"),N=require("../controls/index.cjs"),G=require("../dialog/index.cjs"),V=require("../header/index.cjs"),$="_wrapper_s1xgg_3",R="_toolbar_s1xgg_8",L="_iframe_s1xgg_14",X="_scrollable_s1xgg_25",o={wrapper:$,toolbar:R,iframe:L,"fullscreen-iframe":"_fullscreen-iframe_s1xgg_20",scrollable:X},d=120,J=12e3,K=8,P=({accessibleLabel:f,autoResize:n=!1,className:v,closeFullscreenLabel:A="Close fullscreen",fullscreenLabel:F="View in fullscreen",hasFullscreenView:I=!0,loading:O="lazy",onLoad:h,referrerPolicy:H="no-referrer",sandbox:y="",srcDoc:g,style:E,...j})=>{const _=s.useRef(null),i=s.useRef(null),c=s.useRef(null),[k,b]=s.useState(d),[M,w]=s.useState(!1),p=s.useCallback(()=>{i.current!==null&&(window.cancelAnimationFrame(i.current),i.current=null),c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),x=s.useCallback(()=>{if(!n)return;const t=_.current,e=t==null?void 0:t.contentDocument;if(!t||!e)return;const m=t.style.height;try{t.style.height=`${d}px`;const a=e.querySelector("[data-iframe-content]")??e.body,u=a.getBoundingClientRect(),{body:T,documentElement:q}=e,B=Math.min(Math.max(Math.ceil(Math.max(a.scrollHeight,a.offsetHeight,u.height,T.scrollHeight,T.offsetHeight,q.scrollHeight,q.offsetHeight)+K),d),J);b(B)}catch{}finally{t.style.height=m}},[n]),r=s.useCallback(()=>{!n||i.current!==null||(i.current=window.requestAnimationFrame(()=>{i.current=null,x(),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{c.current=null,x()},250)}))},[n,x]),U=t=>{var m,a;r();const e=(m=_.current)==null?void 0:m.contentDocument;Array.from((e==null?void 0:e.images)??[]).forEach(u=>{u.complete||(u.addEventListener("load",r,{once:!0}),u.addEventListener("error",r,{once:!0}))}),(a=e==null?void 0:e.fonts)==null||a.ready.then(r).catch(()=>{}),h==null||h(t)};return s.useEffect(()=>{if(n)return p(),b(d),r(),p},[n,p,r,g]),s.useEffect(()=>{var t;if(n)return window.addEventListener("resize",r),(t=window.visualViewport)==null||t.addEventListener("resize",r),()=>{var e;window.removeEventListener("resize",r),(e=window.visualViewport)==null||e.removeEventListener("resize",r)}},[n,r]),l.jsxs("div",{className:o.wrapper,"data-component":"iframe",children:[I&&l.jsx("div",{className:o.toolbar,children:l.jsx(S.Button,{"aria-expanded":M,"aria-haspopup":"dialog",onClick:()=>w(!0),variant:"tertiary",children:F})}),l.jsx("iframe",{...j,className:C.t(o.iframe,!n&&o.scrollable,v),loading:O,onLoad:U,ref:_,referrerPolicy:H,sandbox:y,srcDoc:g,style:n?{...E,height:k,minHeight:d}:E,title:f}),M&&l.jsx(G.Dialog,{"aria-label":`${f} fullscreen`,controls:l.jsx(N.Controls,{children:l.jsx(S.Button,{onClick:()=>w(!1),children:A})}),fullscreen:!0,header:l.jsx(V.Header,{children:l.jsx("h2",{children:f})}),open:!0,setOpen:w,children:l.jsx("iframe",{...j,className:C.t(o.iframe,o["fullscreen-iframe"],o.scrollable,v),loading:"eager",referrerPolicy:H,sandbox:y,srcDoc:g,title:`${f} fullscreen`})})]})};exports.Iframe=P;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/iframe/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { type ComponentPropsWithoutRef, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Button } from '../button';\nimport { Controls } from '../controls';\nimport { Dialog } from '../dialog';\nimport { Header } from '../header';\nimport styles from './styles.module.css';\n\nconst MIN_AUTO_HEIGHT = 120;\nconst MAX_AUTO_HEIGHT = 12000;\nconst AUTO_HEIGHT_BUFFER = 8;\n\nexport type IframeProps = Omit<ComponentPropsWithoutRef<'iframe'>, 'src' | 'srcDoc' | 'title'> & {\n accessibleLabel: string;\n autoResize?: boolean;\n closeFullscreenLabel?: string;\n fullscreenLabel?: string;\n hasFullscreenView?: boolean;\n srcDoc: string;\n};\n\nexport const Iframe = ({\n accessibleLabel,\n autoResize = false,\n className,\n closeFullscreenLabel = 'Close fullscreen',\n fullscreenLabel = 'View in fullscreen',\n hasFullscreenView = true,\n loading = 'lazy',\n onLoad,\n referrerPolicy = 'no-referrer',\n sandbox = '',\n srcDoc,\n style,\n ...props\n}: IframeProps) => {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const measurementFrameRef = useRef<number | null>(null);\n const followUpMeasurementTimeoutRef = useRef<number | null>(null);\n const [measuredHeight, setMeasuredHeight] = useState(MIN_AUTO_HEIGHT);\n const [isFullscreenOpen, setIsFullscreenOpen] = useState(false);\n\n const clearScheduledMeasurements = useCallback(() => {\n if (measurementFrameRef.current !== null) {\n window.cancelAnimationFrame(measurementFrameRef.current);\n measurementFrameRef.current = null;\n }\n\n if (followUpMeasurementTimeoutRef.current !== null) {\n window.clearTimeout(followUpMeasurementTimeoutRef.current);\n followUpMeasurementTimeoutRef.current = null;\n }\n }, []);\n\n const measureSize = useCallback(() => {\n if (!autoResize) return;\n\n const iframe = iframeRef.current;\n const iframeDocument = iframe?.contentDocument;\n if (!iframe || !iframeDocument) return;\n\n const renderedHeight = iframe.style.height;\n\n try {\n // measure from a stable viewport height so content sized with percentages or\n // viewport units cannot feed the iframe's previous height back into itself\n iframe.style.height = `${MIN_AUTO_HEIGHT}px`;\n\n const content =\n iframeDocument.querySelector<HTMLElement>('[data-iframe-content]') ?? iframeDocument.body;\n const contentRect = content.getBoundingClientRect();\n const { body, documentElement } = iframeDocument;\n const height = Math.min(\n Math.max(\n Math.ceil(\n Math.max(\n content.scrollHeight,\n content.offsetHeight,\n contentRect.height,\n body.scrollHeight,\n body.offsetHeight,\n documentElement.scrollHeight,\n documentElement.offsetHeight\n ) + AUTO_HEIGHT_BUFFER\n ),\n MIN_AUTO_HEIGHT\n ),\n MAX_AUTO_HEIGHT\n );\n\n setMeasuredHeight(height);\n } catch {\n // cross-origin iframe content cannot be measured; retain minimum height\n } finally {\n iframe.style.height = renderedHeight;\n }\n }, [autoResize]);\n\n const scheduleSizeMeasurement = useCallback(() => {\n if (!autoResize || measurementFrameRef.current !== null) return;\n\n measurementFrameRef.current = window.requestAnimationFrame(() => {\n measurementFrameRef.current = null;\n measureSize();\n\n if (followUpMeasurementTimeoutRef.current !== null) {\n window.clearTimeout(followUpMeasurementTimeoutRef.current);\n }\n\n followUpMeasurementTimeoutRef.current = window.setTimeout(() => {\n followUpMeasurementTimeoutRef.current = null;\n measureSize();\n }, 250);\n });\n }, [autoResize, measureSize]);\n\n const handleLoad: NonNullable<IframeProps['onLoad']> = (event) => {\n scheduleSizeMeasurement();\n\n const iframeDocument = iframeRef.current?.contentDocument;\n Array.from(iframeDocument?.images ?? []).forEach((image) => {\n if (image.complete) return;\n image.addEventListener('load', scheduleSizeMeasurement, { once: true });\n image.addEventListener('error', scheduleSizeMeasurement, { once: true });\n });\n iframeDocument?.fonts?.ready.then(scheduleSizeMeasurement).catch(() => undefined);\n\n onLoad?.(event);\n };\n\n useEffect(() => {\n if (!autoResize) return undefined;\n\n clearScheduledMeasurements();\n setMeasuredHeight(MIN_AUTO_HEIGHT);\n scheduleSizeMeasurement();\n\n return clearScheduledMeasurements;\n }, [autoResize, clearScheduledMeasurements, scheduleSizeMeasurement, srcDoc]);\n\n useEffect(() => {\n if (!autoResize) return undefined;\n\n window.addEventListener('resize', scheduleSizeMeasurement);\n window.visualViewport?.addEventListener('resize', scheduleSizeMeasurement);\n\n return () => {\n window.removeEventListener('resize', scheduleSizeMeasurement);\n window.visualViewport?.removeEventListener('resize', scheduleSizeMeasurement);\n };\n }, [autoResize, scheduleSizeMeasurement]);\n\n return (\n <div className={styles.wrapper}>\n {hasFullscreenView && (\n <div className={styles.toolbar}>\n <Button\n aria-expanded={isFullscreenOpen}\n aria-haspopup='dialog'\n onClick={() => setIsFullscreenOpen(true)}\n variant='tertiary'\n >\n {fullscreenLabel}\n </Button>\n </div>\n )}\n <iframe\n {...props}\n className={cx(styles.iframe, className)}\n loading={loading}\n onLoad={handleLoad}\n ref={iframeRef}\n referrerPolicy={referrerPolicy}\n sandbox={sandbox}\n srcDoc={srcDoc}\n style={\n autoResize\n ? {\n ...style,\n height: measuredHeight,\n minHeight: MIN_AUTO_HEIGHT,\n }\n : style\n }\n title={accessibleLabel}\n />\n {isFullscreenOpen && (\n <Dialog\n aria-label={`${accessibleLabel} fullscreen`}\n controls={\n <Controls>\n <Button onClick={() => setIsFullscreenOpen(false)}>{closeFullscreenLabel}</Button>\n </Controls>\n }\n fullscreen\n header={\n <Header>\n <h2>{accessibleLabel}</h2>\n </Header>\n }\n open\n setOpen={setIsFullscreenOpen}\n >\n <iframe\n {...props}\n className={cx(styles.iframe, styles['fullscreen-iframe'], className)}\n loading='eager'\n referrerPolicy={referrerPolicy}\n sandbox={sandbox}\n srcDoc={srcDoc}\n title={`${accessibleLabel} fullscreen`}\n />\n </Dialog>\n )}\n </div>\n );\n};\n"],"names":["MIN_AUTO_HEIGHT","MAX_AUTO_HEIGHT","AUTO_HEIGHT_BUFFER","Iframe","accessibleLabel","autoResize","className","closeFullscreenLabel","fullscreenLabel","hasFullscreenView","loading","onLoad","referrerPolicy","sandbox","srcDoc","style","props","iframeRef","useRef","measurementFrameRef","followUpMeasurementTimeoutRef","measuredHeight","setMeasuredHeight","useState","isFullscreenOpen","setIsFullscreenOpen","clearScheduledMeasurements","useCallback","current","window","cancelAnimationFrame","clearTimeout","measureSize","iframe","iframeDocument","contentDocument","renderedHeight","height","content","querySelector","body","contentRect","getBoundingClientRect","documentElement","Math","min","max","ceil","scrollHeight","offsetHeight","scheduleSizeMeasurement","requestAnimationFrame","setTimeout","handleLoad","event","Array","from","images","forEach","image","complete","addEventListener","once","fonts","ready","then","catch","useEffect","visualViewport","removeEventListener","styles","wrapper","toolbar","jsx","Button","cx","minHeight","Dialog","Controls","Header"],"mappings":"wcASMA,EAAkB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J,UAAW2D,EAAAA,EAAGL,EAAOrC,OAAQqC,EAAO,mBAAmB,EAAGhE,CAAS,EACnE,QAAQ,QACR,eAAAM,EACA,QAAAC,EACA,OAAAC,EACA,MAAO,GAAGV,CAAe,aAAA,CAAc,CAAA,CAE3C,CAAA,EAEJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/iframe/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { type ComponentPropsWithoutRef, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Button } from '../button';\nimport { Controls } from '../controls';\nimport { Dialog } from '../dialog';\nimport { Header } from '../header';\nimport styles from './styles.module.css';\n\nconst MIN_AUTO_HEIGHT = 120;\nconst MAX_AUTO_HEIGHT = 12000;\nconst AUTO_HEIGHT_BUFFER = 8;\n\nexport type IframeProps = Omit<ComponentPropsWithoutRef<'iframe'>, 'src' | 'srcDoc' | 'title'> & {\n accessibleLabel: string;\n autoResize?: boolean;\n closeFullscreenLabel?: string;\n fullscreenLabel?: string;\n hasFullscreenView?: boolean;\n srcDoc: string;\n};\n\nexport const Iframe = ({\n accessibleLabel,\n autoResize = false,\n className,\n closeFullscreenLabel = 'Close fullscreen',\n fullscreenLabel = 'View in fullscreen',\n hasFullscreenView = true,\n loading = 'lazy',\n onLoad,\n referrerPolicy = 'no-referrer',\n sandbox = '',\n srcDoc,\n style,\n ...props\n}: IframeProps) => {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const measurementFrameRef = useRef<number | null>(null);\n const followUpMeasurementTimeoutRef = useRef<number | null>(null);\n const [measuredHeight, setMeasuredHeight] = useState(MIN_AUTO_HEIGHT);\n const [isFullscreenOpen, setIsFullscreenOpen] = useState(false);\n\n const clearScheduledMeasurements = useCallback(() => {\n if (measurementFrameRef.current !== null) {\n window.cancelAnimationFrame(measurementFrameRef.current);\n measurementFrameRef.current = null;\n }\n\n if (followUpMeasurementTimeoutRef.current !== null) {\n window.clearTimeout(followUpMeasurementTimeoutRef.current);\n followUpMeasurementTimeoutRef.current = null;\n }\n }, []);\n\n const measureSize = useCallback(() => {\n if (!autoResize) return;\n\n const iframe = iframeRef.current;\n const iframeDocument = iframe?.contentDocument;\n if (!iframe || !iframeDocument) return;\n\n const renderedHeight = iframe.style.height;\n\n try {\n iframe.style.height = `${MIN_AUTO_HEIGHT}px`;\n\n const content =\n iframeDocument.querySelector<HTMLElement>('[data-iframe-content]') ?? iframeDocument.body;\n const contentRect = content.getBoundingClientRect();\n const { body, documentElement } = iframeDocument;\n const height = Math.min(\n Math.max(\n Math.ceil(\n Math.max(\n content.scrollHeight,\n content.offsetHeight,\n contentRect.height,\n body.scrollHeight,\n body.offsetHeight,\n documentElement.scrollHeight,\n documentElement.offsetHeight\n ) + AUTO_HEIGHT_BUFFER\n ),\n MIN_AUTO_HEIGHT\n ),\n MAX_AUTO_HEIGHT\n );\n\n setMeasuredHeight(height);\n } catch {\n /* 🌝 */\n } finally {\n iframe.style.height = renderedHeight;\n }\n }, [autoResize]);\n\n const scheduleSizeMeasurement = useCallback(() => {\n if (!autoResize || measurementFrameRef.current !== null) return;\n\n measurementFrameRef.current = window.requestAnimationFrame(() => {\n measurementFrameRef.current = null;\n measureSize();\n\n if (followUpMeasurementTimeoutRef.current !== null) {\n window.clearTimeout(followUpMeasurementTimeoutRef.current);\n }\n\n followUpMeasurementTimeoutRef.current = window.setTimeout(() => {\n followUpMeasurementTimeoutRef.current = null;\n measureSize();\n }, 250);\n });\n }, [autoResize, measureSize]);\n\n const handleLoad: NonNullable<IframeProps['onLoad']> = (event) => {\n scheduleSizeMeasurement();\n\n const iframeDocument = iframeRef.current?.contentDocument;\n Array.from(iframeDocument?.images ?? []).forEach((image) => {\n if (image.complete) return;\n image.addEventListener('load', scheduleSizeMeasurement, { once: true });\n image.addEventListener('error', scheduleSizeMeasurement, { once: true });\n });\n iframeDocument?.fonts?.ready.then(scheduleSizeMeasurement).catch(() => undefined);\n\n onLoad?.(event);\n };\n\n useEffect(() => {\n if (!autoResize) return undefined;\n\n clearScheduledMeasurements();\n setMeasuredHeight(MIN_AUTO_HEIGHT);\n scheduleSizeMeasurement();\n\n return clearScheduledMeasurements;\n }, [autoResize, clearScheduledMeasurements, scheduleSizeMeasurement, srcDoc]);\n\n useEffect(() => {\n if (!autoResize) return undefined;\n\n window.addEventListener('resize', scheduleSizeMeasurement);\n window.visualViewport?.addEventListener('resize', scheduleSizeMeasurement);\n\n return () => {\n window.removeEventListener('resize', scheduleSizeMeasurement);\n window.visualViewport?.removeEventListener('resize', scheduleSizeMeasurement);\n };\n }, [autoResize, scheduleSizeMeasurement]);\n\n return (\n <div className={styles.wrapper}>\n {hasFullscreenView && (\n <div className={styles.toolbar}>\n <Button\n aria-expanded={isFullscreenOpen}\n aria-haspopup='dialog'\n onClick={() => setIsFullscreenOpen(true)}\n variant='tertiary'\n >\n {fullscreenLabel}\n </Button>\n </div>\n )}\n <iframe\n {...props}\n className={cx(styles.iframe, !autoResize && styles.scrollable, className)}\n loading={loading}\n onLoad={handleLoad}\n ref={iframeRef}\n referrerPolicy={referrerPolicy}\n sandbox={sandbox}\n srcDoc={srcDoc}\n style={\n autoResize\n ? {\n ...style,\n height: measuredHeight,\n minHeight: MIN_AUTO_HEIGHT,\n }\n : style\n }\n title={accessibleLabel}\n />\n {isFullscreenOpen && (\n <Dialog\n aria-label={`${accessibleLabel} fullscreen`}\n controls={\n <Controls>\n <Button onClick={() => setIsFullscreenOpen(false)}>{closeFullscreenLabel}</Button>\n </Controls>\n }\n fullscreen\n header={\n <Header>\n <h2>{accessibleLabel}</h2>\n </Header>\n }\n open\n setOpen={setIsFullscreenOpen}\n >\n <iframe\n {...props}\n className={cx(styles.iframe, styles['fullscreen-iframe'], styles.scrollable, className)}\n loading='eager'\n referrerPolicy={referrerPolicy}\n sandbox={sandbox}\n srcDoc={srcDoc}\n title={`${accessibleLabel} fullscreen`}\n />\n </Dialog>\n )}\n </div>\n );\n};\n"],"names":["MIN_AUTO_HEIGHT","MAX_AUTO_HEIGHT","AUTO_HEIGHT_BUFFER","Iframe","accessibleLabel","autoResize","className","closeFullscreenLabel","fullscreenLabel","hasFullscreenView","loading","onLoad","referrerPolicy","sandbox","srcDoc","style","props","iframeRef","useRef","measurementFrameRef","followUpMeasurementTimeoutRef","measuredHeight","setMeasuredHeight","useState","isFullscreenOpen","setIsFullscreenOpen","clearScheduledMeasurements","useCallback","current","window","cancelAnimationFrame","clearTimeout","measureSize","iframe","iframeDocument","contentDocument","renderedHeight","height","content","querySelector","body","contentRect","getBoundingClientRect","documentElement","Math","min","max","ceil","scrollHeight","offsetHeight","scheduleSizeMeasurement","requestAnimationFrame","setTimeout","handleLoad","event","Array","from","images","forEach","image","complete","addEventListener","once","fonts","ready","then","catch","useEffect","visualViewport","removeEventListener","styles","wrapper","toolbar","jsx","Button","cx","scrollable","minHeight","Dialog","Controls","Header"],"mappings":"8eASMA,EAAkB,IAClBC,EAAkB,KAClBC,EAAqB,EAWdC,EAASA,CAAC,CACrBC,gBAAAA,EACAC,WAAAA,EAAa,GACbC,UAAAA,EACAC,qBAAAA,EAAuB,mBACvBC,gBAAAA,EAAkB,qBAClBC,kBAAAA,EAAoB,GACpBC,QAAAA,EAAU,OACVC,OAAAA,EACAC,eAAAA,EAAiB,cACjBC,QAAAA,EAAU,GACVC,OAAAA,EACAC,MAAAA,EACA,GAAGC,CACQ,IAAM,CACjB,MAAMC,EAAYC,EAAAA,OAA0B,IAAI,EAC1CC,EAAsBD,EAAAA,OAAsB,IAAI,EAChDE,EAAgCF,EAAAA,OAAsB,IAAI,EAC1D,CAACG,EAAgBC,CAAiB,EAAIC,EAAAA,SAASvB,CAAe,EAC9D,CAACwB,EAAkBC,CAAmB,EAAIF,EAAAA,SAAS,EAAK,EAExDG,EAA6BC,EAAAA,YAAY,IAAM,CAC/CR,EAAoBS,UAAY,OAClCC,OAAOC,qBAAqBX,EAAoBS,OAAO,EACvDT,EAAoBS,QAAU,MAG5BR,EAA8BQ,UAAY,OAC5CC,OAAOE,aA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CAAS,EACxE,QAAAI,EACA,OAAQ2C,EACR,IAAKpC,EACL,eAAAL,EACA,QAAAC,EACA,OAAAC,EACA,MACET,EACI,CACE,GAAGU,EACHsB,OAAQhB,EACRwD,UAAW7E,CAAAA,EAEbe,EAEN,MAAOX,EAAgB,EAExBoB,GACCiD,EAAAA,IAACK,EAAAA,OAAA,CACC,aAAY,GAAG1E,CAAe,cAC9B,SACEqE,EAAAA,IAACM,EAAAA,SAAA,CACC,SAAAN,EAAAA,IAACC,EAAAA,OAAA,CAAO,QAAS,IAAMjD,EAAoB,EAAK,EAAIlB,SAAAA,CAAAA,CAAqB,CAAA,CAC3E,EAEF,WAAU,GACV,OACEkE,EAAAA,IAACO,EAAAA,OAAA,CACC,SAAAP,EAAAA,IAAC,KAAA,CAAIrE,SAAAA,CAAAA,CAAgB,CAAA,CACvB,EAEF,KAAI,GACJ,QAASqB,EAET,SAAAgD,EAAAA,IAAC,SAAA,CACC,GAAIzD,EACJ,UAAW2D,EAAAA,EAAGL,EAAOrC,OAAQqC,EAAO,mBAAmB,EAAGA,EAAOM,WAAYtE,CAAS,EACtF,QAAQ,QACR,eAAAM,EACA,QAAAC,EACA,OAAAC,EACA,MAAO,GAAGV,CAAe,aAAA,CAAc,CAAA,CAE3C,CAAA,EAEJ,CAEJ"}
|
|
@@ -1,88 +1,89 @@
|
|
|
1
1
|
import { jsxs as q, jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { t as
|
|
3
|
-
import { useRef as H, useState as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Controls as
|
|
6
|
-
import { Dialog as
|
|
7
|
-
import { Header as
|
|
8
|
-
import '../../assets/index18.css';const
|
|
9
|
-
wrapper:
|
|
10
|
-
toolbar:
|
|
11
|
-
iframe:
|
|
12
|
-
"fullscreen-iframe": "_fullscreen-
|
|
13
|
-
|
|
2
|
+
import { t as I } from "../../classix-DG18itHa.js";
|
|
3
|
+
import { useRef as H, useState as O, useCallback as v, useEffect as S } from "react";
|
|
4
|
+
import { Button as U } from "../button/index.js";
|
|
5
|
+
import { Controls as L } from "../controls/index.js";
|
|
6
|
+
import { Dialog as X } from "../dialog/index.js";
|
|
7
|
+
import { Header as J } from "../header/index.js";
|
|
8
|
+
import '../../assets/index18.css';const K = "_wrapper_s1xgg_3", Q = "_toolbar_s1xgg_8", W = "_iframe_s1xgg_14", Y = "_scrollable_s1xgg_25", i = {
|
|
9
|
+
wrapper: K,
|
|
10
|
+
toolbar: Q,
|
|
11
|
+
iframe: W,
|
|
12
|
+
"fullscreen-iframe": "_fullscreen-iframe_s1xgg_20",
|
|
13
|
+
scrollable: Y
|
|
14
|
+
}, u = 120, Z = 12e3, D = 8, le = ({
|
|
14
15
|
accessibleLabel: f,
|
|
15
16
|
autoResize: n = !1,
|
|
16
17
|
className: E,
|
|
17
|
-
closeFullscreenLabel:
|
|
18
|
-
fullscreenLabel:
|
|
18
|
+
closeFullscreenLabel: N = "Close fullscreen",
|
|
19
|
+
fullscreenLabel: k = "View in fullscreen",
|
|
19
20
|
hasFullscreenView: B = !0,
|
|
20
21
|
loading: G = "lazy",
|
|
21
22
|
onLoad: d,
|
|
22
23
|
referrerPolicy: y = "no-referrer",
|
|
23
|
-
sandbox:
|
|
24
|
+
sandbox: x = "",
|
|
24
25
|
srcDoc: h,
|
|
25
|
-
style:
|
|
26
|
-
...
|
|
26
|
+
style: M,
|
|
27
|
+
...T
|
|
27
28
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
|
|
29
|
+
const g = H(null), c = H(null), o = H(null), [V, A] = O(u), [F, p] = O(!1), w = v(() => {
|
|
30
|
+
c.current !== null && (window.cancelAnimationFrame(c.current), c.current = null), o.current !== null && (window.clearTimeout(o.current), o.current = null);
|
|
30
31
|
}, []), _ = v(() => {
|
|
31
32
|
if (!n) return;
|
|
32
|
-
const r =
|
|
33
|
+
const r = g.current, e = r == null ? void 0 : r.contentDocument;
|
|
33
34
|
if (!r || !e) return;
|
|
34
35
|
const m = r.style.height;
|
|
35
36
|
try {
|
|
36
37
|
r.style.height = `${u}px`;
|
|
37
|
-
const
|
|
38
|
-
body:
|
|
39
|
-
documentElement:
|
|
40
|
-
} = e, j = Math.min(Math.max(Math.ceil(Math.max(
|
|
41
|
-
|
|
38
|
+
const s = e.querySelector("[data-iframe-content]") ?? e.body, a = s.getBoundingClientRect(), {
|
|
39
|
+
body: b,
|
|
40
|
+
documentElement: C
|
|
41
|
+
} = e, j = Math.min(Math.max(Math.ceil(Math.max(s.scrollHeight, s.offsetHeight, a.height, b.scrollHeight, b.offsetHeight, C.scrollHeight, C.offsetHeight) + D), u), Z);
|
|
42
|
+
A(j);
|
|
42
43
|
} catch {
|
|
43
44
|
} finally {
|
|
44
45
|
r.style.height = m;
|
|
45
46
|
}
|
|
46
47
|
}, [n]), t = v(() => {
|
|
47
|
-
!n ||
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
!n || c.current !== null || (c.current = window.requestAnimationFrame(() => {
|
|
49
|
+
c.current = null, _(), o.current !== null && window.clearTimeout(o.current), o.current = window.setTimeout(() => {
|
|
50
|
+
o.current = null, _();
|
|
50
51
|
}, 250);
|
|
51
52
|
}));
|
|
52
53
|
}, [n, _]), $ = (r) => {
|
|
53
|
-
var m,
|
|
54
|
+
var m, s;
|
|
54
55
|
t();
|
|
55
|
-
const e = (m =
|
|
56
|
-
Array.from((e == null ? void 0 : e.images) ?? []).forEach((
|
|
57
|
-
|
|
56
|
+
const e = (m = g.current) == null ? void 0 : m.contentDocument;
|
|
57
|
+
Array.from((e == null ? void 0 : e.images) ?? []).forEach((a) => {
|
|
58
|
+
a.complete || (a.addEventListener("load", t, {
|
|
58
59
|
once: !0
|
|
59
|
-
}),
|
|
60
|
+
}), a.addEventListener("error", t, {
|
|
60
61
|
once: !0
|
|
61
62
|
}));
|
|
62
|
-
}), (
|
|
63
|
+
}), (s = e == null ? void 0 : e.fonts) == null || s.ready.then(t).catch(() => {
|
|
63
64
|
}), d == null || d(r);
|
|
64
65
|
};
|
|
65
|
-
return
|
|
66
|
+
return S(() => {
|
|
66
67
|
if (n)
|
|
67
|
-
return
|
|
68
|
-
}, [n,
|
|
68
|
+
return w(), A(u), t(), w;
|
|
69
|
+
}, [n, w, t, h]), S(() => {
|
|
69
70
|
var r;
|
|
70
71
|
if (n)
|
|
71
72
|
return window.addEventListener("resize", t), (r = window.visualViewport) == null || r.addEventListener("resize", t), () => {
|
|
72
73
|
var e;
|
|
73
74
|
window.removeEventListener("resize", t), (e = window.visualViewport) == null || e.removeEventListener("resize", t);
|
|
74
75
|
};
|
|
75
|
-
}, [n, t]), /* @__PURE__ */ q("div", { className:
|
|
76
|
-
B && /* @__PURE__ */ l("div", { className:
|
|
77
|
-
/* @__PURE__ */ l("iframe", { ...
|
|
78
|
-
...
|
|
76
|
+
}, [n, t]), /* @__PURE__ */ q("div", { className: i.wrapper, "data-component": "iframe", children: [
|
|
77
|
+
B && /* @__PURE__ */ l("div", { className: i.toolbar, children: /* @__PURE__ */ l(U, { "aria-expanded": F, "aria-haspopup": "dialog", onClick: () => p(!0), variant: "tertiary", children: k }) }),
|
|
78
|
+
/* @__PURE__ */ l("iframe", { ...T, className: I(i.iframe, !n && i.scrollable, E), loading: G, onLoad: $, ref: g, referrerPolicy: y, sandbox: x, srcDoc: h, style: n ? {
|
|
79
|
+
...M,
|
|
79
80
|
height: V,
|
|
80
81
|
minHeight: u
|
|
81
|
-
} :
|
|
82
|
-
|
|
82
|
+
} : M, title: f }),
|
|
83
|
+
F && /* @__PURE__ */ l(X, { "aria-label": `${f} fullscreen`, controls: /* @__PURE__ */ l(L, { children: /* @__PURE__ */ l(U, { onClick: () => p(!1), children: N }) }), fullscreen: !0, header: /* @__PURE__ */ l(J, { children: /* @__PURE__ */ l("h2", { children: f }) }), open: !0, setOpen: p, children: /* @__PURE__ */ l("iframe", { ...T, className: I(i.iframe, i["fullscreen-iframe"], i.scrollable, E), loading: "eager", referrerPolicy: y, sandbox: x, srcDoc: h, title: `${f} fullscreen` }) })
|
|
83
84
|
] });
|
|
84
85
|
};
|
|
85
86
|
export {
|
|
86
|
-
|
|
87
|
+
le as Iframe
|
|
87
88
|
};
|
|
88
89
|
//# sourceMappingURL=index.js.map
|