@telia-ace/widget-components-close-button 1.0.31 → 1.1.1-rc.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/close-button-13dd4fb3.mjs +55 -0
- package/close-button-7e0fabd8.js +19 -0
- package/index-9afe331a.js +621 -0
- package/index-d8df022f.mjs +7907 -0
- package/index.js +1 -0
- package/index.mjs +7 -0
- package/package.json +14 -39
- package/LICENSE.txt +0 -6
- package/README.md +0 -3
- package/dist/close-button-1dac931a.js +0 -60
- package/dist/close-button-1dac931a.js.map +0 -1
- package/dist/index.js +0 -17
- package/dist/index.js.map +0 -1
- /package/{dist/close-button-component.d.ts → close-button-component.d.ts} +0 -0
- /package/{dist/close-button.d.ts → close-button.d.ts} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { C as h, u as f, a as y, b as C, c as b, n as l, B as x, d as S, S as B } from "./index-d8df022f.mjs";
|
|
3
|
+
import { useContext as p, useState as u, useEffect as $ } from "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
const g = () => p(h), v = () => {
|
|
6
|
+
const e = f(), t = g(), [o, i] = u([]), [d, m] = u();
|
|
7
|
+
return $(() => {
|
|
8
|
+
if (e && t) {
|
|
9
|
+
const r = new y(e).withId(t.id), n = e.actions(r, t.type || C());
|
|
10
|
+
m(n), o !== null && (o.forEach((s) => {
|
|
11
|
+
n.dispatch(s.key, s.data).then((c) => s.resolve(c)).catch((c) => s.reject(c));
|
|
12
|
+
}), i(null));
|
|
13
|
+
}
|
|
14
|
+
}, [e, t.id]), (r, n) => o !== null ? new Promise((s, c) => {
|
|
15
|
+
o.push({
|
|
16
|
+
key: r,
|
|
17
|
+
data: n,
|
|
18
|
+
resolve: s,
|
|
19
|
+
reject: c
|
|
20
|
+
});
|
|
21
|
+
}) : d.dispatch(r, n);
|
|
22
|
+
}, w = () => p(b), T = ({ className: e, ...t }) => {
|
|
23
|
+
const o = v(), { ariaLabel: i = "" } = w();
|
|
24
|
+
return /* @__PURE__ */ a(P, { ...t, className: e, children: /* @__PURE__ */ a(j, { onClick: () => o("close"), "aria-label": i, children: /* @__PURE__ */ a(k, { size: 12, symbol: { type: "Svg", content: "close" } }) }) });
|
|
25
|
+
}, P = l.div`
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: flex-end;
|
|
28
|
+
align-items: flex-start;
|
|
29
|
+
`, j = l(x)`
|
|
30
|
+
&:focus-visible {
|
|
31
|
+
${S}
|
|
32
|
+
padding: ${(e) => {
|
|
33
|
+
var t, o;
|
|
34
|
+
return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small} / 2) ${(o = e.theme.sizes) == null ? void 0 : o.small}`;
|
|
35
|
+
}};
|
|
36
|
+
line,
|
|
37
|
+
path {
|
|
38
|
+
stroke: ${(e) => {
|
|
39
|
+
var t, o;
|
|
40
|
+
return (o = (t = e.theme.accessibility) == null ? void 0 : t.colors) == null ? void 0 : o.inactiveText;
|
|
41
|
+
}};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`, k = l(B)`
|
|
45
|
+
line,
|
|
46
|
+
path {
|
|
47
|
+
stroke: ${(e) => {
|
|
48
|
+
var t;
|
|
49
|
+
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
50
|
+
}};
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
export {
|
|
54
|
+
T as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("./index-9afe331a.js"),i=require("react");require("react-dom");const y=()=>i.useContext(o.ComponentNodeContext),m=()=>{const t=o.useComponentPlatform(),e=y(),[n,u]=i.useState([]),[d,p]=i.useState();return i.useEffect(()=>{if(t&&e){const l=new o.ComponentQuery(t).withId(e.id),c=t.actions(l,e.type||o.uuid());p(c),n!==null&&(n.forEach(s=>{c.dispatch(s.key,s.data).then(r=>s.resolve(r)).catch(r=>s.reject(r))}),u(null))}},[t,e.id]),(l,c)=>n!==null?new Promise((s,r)=>{n.push({key:l,data:c,resolve:s,reject:r})}):d.dispatch(l,c)},h=()=>i.useContext(o.ComponentPropertyContext),f=({className:t,...e})=>{const n=m(),{ariaLabel:u=""}=h();return a.jsx(x,{...e,className:t,children:a.jsx(S,{onClick:()=>n("close"),"aria-label":u,children:a.jsx(C,{size:12,symbol:{type:"Svg",content:"close"}})})})},x=o.newStyled.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: flex-end;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
`,S=o.newStyled(o.Button)`
|
|
6
|
+
&:focus-visible {
|
|
7
|
+
${o.borderTabStyle}
|
|
8
|
+
padding: ${t=>{var e,n;return`calc(${(e=t.theme.sizes)==null?void 0:e.small} / 2) ${(n=t.theme.sizes)==null?void 0:n.small}`}};
|
|
9
|
+
line,
|
|
10
|
+
path {
|
|
11
|
+
stroke: ${t=>{var e,n;return(n=(e=t.theme.accessibility)==null?void 0:e.colors)==null?void 0:n.inactiveText}};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`,C=o.newStyled(o.SymbolBadge)`
|
|
15
|
+
line,
|
|
16
|
+
path {
|
|
17
|
+
stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
|
|
18
|
+
}
|
|
19
|
+
`;exports.default=f;
|