@telia-ace/widget-components-close-button 1.1.1-rc.0 → 1.1.1-rc.2

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