@livechat/design-system-react-components 1.17.1-alpha.2 → 1.17.1-alpha.3
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.cjs.js +1 -1
- package/dist/index.es.js +5230 -134
- package/dist/preview-stats.json +1146 -1146
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/chunks/Heading-617540b6.js +0 -1
- package/dist/chunks/Heading-6b95d08b.js +0 -64
- package/dist/chunks/ProgressBar-3e0fd769.js +0 -87
- package/dist/chunks/ProgressBar-62d36b60.js +0 -1
- package/dist/chunks/Text-b31d1e9a.js +0 -66
- package/dist/chunks/Text-df483689.js +0 -1
- package/dist/chunks/Tooltip-8c427780.js +0 -1
- package/dist/chunks/Tooltip-f6f4f9c2.js +0 -181
- package/dist/chunks/Typography.module-2558416b.js +0 -1
- package/dist/chunks/Typography.module-93efb34d.js +0 -23
- package/dist/chunks/keyCodes-30323e90.js +0 -15
- package/dist/chunks/keyCodes-c4c35e49.js +0 -1
- package/dist/components/ActionBar/index.cjs.js +0 -1
- package/dist/components/ActionBar/index.es.js +0 -192
- package/dist/components/ActionMenu/index.cjs.js +0 -1
- package/dist/components/ActionMenu/index.es.js +0 -199
- package/dist/components/Alert/index.cjs.js +0 -1
- package/dist/components/Alert/index.es.js +0 -129
- package/dist/components/Avatar/index.cjs.js +0 -1
- package/dist/components/Avatar/index.es.js +0 -190
- package/dist/components/Badge/index.cjs.js +0 -1
- package/dist/components/Badge/index.es.js +0 -65
- package/dist/components/Button/index.cjs.js +0 -1
- package/dist/components/Button/index.es.js +0 -143
- package/dist/components/Card/index.cjs.js +0 -1
- package/dist/components/Card/index.es.js +0 -96
- package/dist/components/Checkbox/index.cjs.js +0 -1
- package/dist/components/Checkbox/index.es.js +0 -64
- package/dist/components/DatePicker/index.cjs.js +0 -1
- package/dist/components/DatePicker/index.es.js +0 -516
- package/dist/components/DetailsCard/index.cjs.js +0 -1
- package/dist/components/DetailsCard/index.es.js +0 -140
- package/dist/components/DetailsCardInfo/index.cjs.js +0 -1
- package/dist/components/DetailsCardInfo/index.es.js +0 -12
- package/dist/components/FieldDescription/index.cjs.js +0 -1
- package/dist/components/FieldDescription/index.es.js +0 -41
- package/dist/components/FieldError/index.cjs.js +0 -1
- package/dist/components/FieldError/index.es.js +0 -51
- package/dist/components/FieldGroup/index.cjs.js +0 -1
- package/dist/components/FieldGroup/index.es.js +0 -58
- package/dist/components/FileUploadProgress/index.cjs.js +0 -1
- package/dist/components/FileUploadProgress/index.es.js +0 -109
- package/dist/components/Form/index.cjs.js +0 -1
- package/dist/components/Form/index.es.js +0 -50
- package/dist/components/FormField/index.cjs.js +0 -1
- package/dist/components/FormField/index.es.js +0 -116
- package/dist/components/FormGroup/index.cjs.js +0 -1
- package/dist/components/FormGroup/index.es.js +0 -58
- package/dist/components/Icon/index.cjs.js +0 -1
- package/dist/components/Icon/index.es.js +0 -103
- package/dist/components/Input/index.cjs.js +0 -1
- package/dist/components/Input/index.es.js +0 -123
- package/dist/components/Link/index.cjs.js +0 -1
- package/dist/components/Link/index.es.js +0 -47
- package/dist/components/Loader/index.cjs.js +0 -1
- package/dist/components/Loader/index.es.js +0 -39
- package/dist/components/Modal/index.cjs.js +0 -1
- package/dist/components/Modal/index.es.js +0 -250
- package/dist/components/NumericInput/index.cjs.js +0 -1
- package/dist/components/NumericInput/index.es.js +0 -139
- package/dist/components/Picker/index.cjs.js +0 -1
- package/dist/components/Picker/index.es.js +0 -740
- package/dist/components/Popover/index.cjs.js +0 -1
- package/dist/components/Popover/index.es.js +0 -75
- package/dist/components/Progress/index.cjs.js +0 -1
- package/dist/components/Progress/index.es.js +0 -103
- package/dist/components/PromoBanner/index.cjs.js +0 -1
- package/dist/components/PromoBanner/index.es.js +0 -74
- package/dist/components/PromoBannerV2/index.cjs.js +0 -1
- package/dist/components/PromoBannerV2/index.es.js +0 -79
- package/dist/components/RadioButton/index.cjs.js +0 -1
- package/dist/components/RadioButton/index.es.js +0 -58
- package/dist/components/Search/index.cjs.js +0 -1
- package/dist/components/Search/index.es.js +0 -117
- package/dist/components/SegmentedControl/index.cjs.js +0 -1
- package/dist/components/SegmentedControl/index.es.js +0 -55
- package/dist/components/Switch/index.cjs.js +0 -1
- package/dist/components/Switch/index.es.js +0 -145
- package/dist/components/Tab/index.cjs.js +0 -1
- package/dist/components/Tab/index.es.js +0 -93
- package/dist/components/Tag/index.cjs.js +0 -1
- package/dist/components/Tag/index.es.js +0 -143
- package/dist/components/TagInput/index.cjs.js +0 -1
- package/dist/components/TagInput/index.es.js +0 -244
- package/dist/components/Textarea/index.cjs.js +0 -1
- package/dist/components/Textarea/index.es.js +0 -55
- package/dist/components/Toast/index.cjs.js +0 -1
- package/dist/components/Toast/index.es.js +0 -163
- package/dist/components/Tooltip/components/UserGuide/index.cjs.js +0 -1
- package/dist/components/Tooltip/components/UserGuide/index.es.js +0 -196
- package/dist/components/Tooltip/components/index.cjs.js +0 -1
- package/dist/components/Tooltip/components/index.es.js +0 -117
- package/dist/components/Tooltip/index.cjs.js +0 -1
- package/dist/components/Tooltip/index.es.js +0 -21
- package/dist/components/Typography/index.cjs.js +0 -1
- package/dist/components/Typography/index.es.js +0 -48
- package/dist/components/UploadBar/index.cjs.js +0 -1
- package/dist/components/UploadBar/index.es.js +0 -112
- package/dist/foundations/index.cjs.js +0 -1
- package/dist/foundations/index.es.js +0 -353
- package/dist/utils/index.cjs.js +0 -1
- package/dist/utils/index.es.js +0 -4
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
var I = Object.defineProperty;
|
|
2
|
-
var w = Object.getOwnPropertySymbols;
|
|
3
|
-
var M = Object.prototype.hasOwnProperty, x = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var B = (e, t, n) => t in e ? I(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, h = (e, t) => {
|
|
5
|
-
for (var n in t || (t = {}))
|
|
6
|
-
M.call(t, n) && B(e, n, t[n]);
|
|
7
|
-
if (w)
|
|
8
|
-
for (var n of w(t))
|
|
9
|
-
x.call(t, n) && B(e, n, t[n]);
|
|
10
|
-
return e;
|
|
11
|
-
};
|
|
12
|
-
import * as r from "react";
|
|
13
|
-
import { ChevronLeft as L, ChevronDown as O } from "@livechat/design-system-icons";
|
|
14
|
-
import u from "clsx";
|
|
15
|
-
import { ActionMenu as S, ActionMenuItem as T } from "../ActionMenu/index.es.js";
|
|
16
|
-
import { Button as A } from "../Button/index.es.js";
|
|
17
|
-
import { Icon as D } from "../Icon/index.es.js";
|
|
18
|
-
import { T as P } from "../../chunks/Tooltip-f6f4f9c2.js";
|
|
19
|
-
import "@floating-ui/react";
|
|
20
|
-
import "../../chunks/keyCodes-30323e90.js";
|
|
21
|
-
import "../../chunks/Text-b31d1e9a.js";
|
|
22
|
-
import "../../chunks/Typography.module-93efb34d.js";
|
|
23
|
-
import "../Loader/index.es.js";
|
|
24
|
-
const _ = {
|
|
25
|
-
"action-bar": "lc-ActionBar-module__action-bar___TJitF",
|
|
26
|
-
"action-bar__items": "lc-ActionBar-module__action-bar__items___uhoQA",
|
|
27
|
-
"action-bar__items--scroll": "lc-ActionBar-module__action-bar__items--scroll___f--dN",
|
|
28
|
-
"action-bar__items__button": "lc-ActionBar-module__action-bar__items__button___Vdjl7",
|
|
29
|
-
"action-bar__items__button--active": "lc-ActionBar-module__action-bar__items__button--active___PFLdm",
|
|
30
|
-
"action-bar__items__button--hidden": "lc-ActionBar-module__action-bar__items__button--hidden___C00VA",
|
|
31
|
-
"action-bar__items__tooltip": "lc-ActionBar-module__action-bar__items__tooltip___BuQPo",
|
|
32
|
-
"action-bar__menu-wrapper": "lc-ActionBar-module__action-bar__menu-wrapper___OMWP5",
|
|
33
|
-
"action-bar__menu-wrapper__button": "lc-ActionBar-module__action-bar__menu-wrapper__button___MDsLx",
|
|
34
|
-
"action-bar__menu-wrapper__button__with-item": "lc-ActionBar-module__action-bar__menu-wrapper__button__with-item___FYlqL",
|
|
35
|
-
"fade-in": "lc-ActionBar-module__fade-in___tQvzD",
|
|
36
|
-
"action-bar__menu-wrapper__button--active": "lc-ActionBar-module__action-bar__menu-wrapper__button--active___Hlzoc",
|
|
37
|
-
"action-bar__menu-wrapper__trigger-vertical": "lc-ActionBar-module__action-bar__menu-wrapper__trigger-vertical___84WL1",
|
|
38
|
-
"action-bar--vertical": "lc-ActionBar-module__action-bar--vertical___tMzLJ"
|
|
39
|
-
}, g = "action-bar__items", V = ({
|
|
40
|
-
option: e,
|
|
41
|
-
menuItemsKeys: t,
|
|
42
|
-
activeOptionKey: n,
|
|
43
|
-
vertical: b
|
|
44
|
-
}) => {
|
|
45
|
-
const d = u(_[`${g}__button`], {
|
|
46
|
-
[_[`${g}__button--hidden`]]: t.includes(
|
|
47
|
-
e.key
|
|
48
|
-
),
|
|
49
|
-
[_[`${g}__button--active`]]: e.key === n
|
|
50
|
-
});
|
|
51
|
-
if (e.showTooltip) {
|
|
52
|
-
const c = t.includes(e.key) && {
|
|
53
|
-
isVisible: !1
|
|
54
|
-
};
|
|
55
|
-
return /* @__PURE__ */ r.createElement(
|
|
56
|
-
P,
|
|
57
|
-
h({
|
|
58
|
-
kind: "invert",
|
|
59
|
-
placement: b ? "left" : "bottom",
|
|
60
|
-
triggerClassName: _[`${g}__tooltip`],
|
|
61
|
-
triggerRenderer: () => /* @__PURE__ */ r.createElement(
|
|
62
|
-
A,
|
|
63
|
-
{
|
|
64
|
-
id: e.key,
|
|
65
|
-
key: e.key,
|
|
66
|
-
title: e.label,
|
|
67
|
-
kind: "plain",
|
|
68
|
-
className: d,
|
|
69
|
-
onClick: e.onClick,
|
|
70
|
-
icon: e.element
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
}, c),
|
|
74
|
-
/* @__PURE__ */ r.createElement("div", null, e.label)
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ r.createElement(
|
|
78
|
-
A,
|
|
79
|
-
{
|
|
80
|
-
id: e.key,
|
|
81
|
-
key: e.key,
|
|
82
|
-
title: e.label,
|
|
83
|
-
kind: "plain",
|
|
84
|
-
className: d,
|
|
85
|
-
onClick: e.onClick,
|
|
86
|
-
icon: e.element
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}, m = "action-bar", U = ({
|
|
90
|
-
className: e,
|
|
91
|
-
id: t = "action-bar-area",
|
|
92
|
-
type: n = "menu",
|
|
93
|
-
options: b,
|
|
94
|
-
activeOptionKey: d,
|
|
95
|
-
vertical: c
|
|
96
|
-
}) => {
|
|
97
|
-
const [l, v] = r.useState([]), f = n === "scroll", y = u(
|
|
98
|
-
_[m],
|
|
99
|
-
e,
|
|
100
|
-
c && _[`${m}--vertical`]
|
|
101
|
-
), p = `${m}__menu-wrapper`, E = {
|
|
102
|
-
root: document.querySelector(`${t}`),
|
|
103
|
-
threshold: 1
|
|
104
|
-
}, C = !f && l.length !== 0, $ = (i) => {
|
|
105
|
-
i.map((o) => {
|
|
106
|
-
const a = l.includes(o.target.id);
|
|
107
|
-
if (!o.isIntersecting) {
|
|
108
|
-
o.target.setAttribute("tabindex", "-1"), a || v((s) => [
|
|
109
|
-
...s,
|
|
110
|
-
o.target.id
|
|
111
|
-
]);
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
o.target.removeAttribute("tabindex"), a && v(l.filter((s) => s !== o.target.id));
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
r.useEffect(() => {
|
|
118
|
-
const i = !!window.IntersectionObserver;
|
|
119
|
-
if (!f && i) {
|
|
120
|
-
const o = document.querySelectorAll(
|
|
121
|
-
`.${_[`${m}__items__button`]}`
|
|
122
|
-
), a = new IntersectionObserver(
|
|
123
|
-
$,
|
|
124
|
-
E
|
|
125
|
-
);
|
|
126
|
-
return o.forEach((s) => a.observe(s)), () => a.disconnect();
|
|
127
|
-
}
|
|
128
|
-
}, [l, f]);
|
|
129
|
-
const N = (i) => b.filter(
|
|
130
|
-
(a) => i.find((s) => s === a.key)
|
|
131
|
-
).map((a) => ({
|
|
132
|
-
key: a.key,
|
|
133
|
-
element: /* @__PURE__ */ r.createElement(T, { leftNode: a.element }, a.label),
|
|
134
|
-
onClick: a.onClick
|
|
135
|
-
})), k = b.filter((i) => l.find((o) => o === i.key)).find((i) => i.key === d);
|
|
136
|
-
return /* @__PURE__ */ r.createElement("div", { id: t, className: y }, /* @__PURE__ */ r.createElement(
|
|
137
|
-
"div",
|
|
138
|
-
{
|
|
139
|
-
className: u(_[`${m}__items`], {
|
|
140
|
-
[_[`${m}__items--scroll`]]: f
|
|
141
|
-
})
|
|
142
|
-
},
|
|
143
|
-
b.map((i) => /* @__PURE__ */ r.createElement(
|
|
144
|
-
V,
|
|
145
|
-
{
|
|
146
|
-
option: i,
|
|
147
|
-
menuItemsKeys: l,
|
|
148
|
-
activeOptionKey: d,
|
|
149
|
-
vertical: c
|
|
150
|
-
}
|
|
151
|
-
))
|
|
152
|
-
), C && /* @__PURE__ */ r.createElement("div", { className: _[p] }, /* @__PURE__ */ r.createElement(
|
|
153
|
-
S,
|
|
154
|
-
{
|
|
155
|
-
placement: c ? "left-end" : "bottom-end",
|
|
156
|
-
options: N(l),
|
|
157
|
-
triggerClassName: u(
|
|
158
|
-
c && _[`${p}__trigger-vertical`]
|
|
159
|
-
),
|
|
160
|
-
triggerRenderer: /* @__PURE__ */ r.createElement(
|
|
161
|
-
A,
|
|
162
|
-
{
|
|
163
|
-
className: u(
|
|
164
|
-
_[`${p}__button`],
|
|
165
|
-
k && _[`${p}__button--active`]
|
|
166
|
-
),
|
|
167
|
-
kind: "plain",
|
|
168
|
-
icon: /* @__PURE__ */ r.createElement(
|
|
169
|
-
D,
|
|
170
|
-
{
|
|
171
|
-
source: c ? L : O,
|
|
172
|
-
kind: "primary"
|
|
173
|
-
}
|
|
174
|
-
),
|
|
175
|
-
iconPosition: "right"
|
|
176
|
-
},
|
|
177
|
-
k && /* @__PURE__ */ r.createElement(
|
|
178
|
-
"div",
|
|
179
|
-
{
|
|
180
|
-
className: u(
|
|
181
|
-
_[`${p}__button__with-item`]
|
|
182
|
-
)
|
|
183
|
-
},
|
|
184
|
-
k.element
|
|
185
|
-
)
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
)));
|
|
189
|
-
};
|
|
190
|
-
export {
|
|
191
|
-
U as ActionBar
|
|
192
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _e=Object.defineProperty,ce=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;var V=(t,i,n)=>i in t?_e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,f=(t,i)=>{for(var n in i||(i={}))j.call(i,n)&&V(t,n,i[n]);if(k)for(var n of k(i))p.call(i,n)&&V(t,n,i[n]);return t},D=(t,i)=>ce(t,re(i));var H=(t,i)=>{var n={};for(var c in t)j.call(t,c)&&i.indexOf(c)<0&&(n[c]=t[c]);if(t!=null&&k)for(var c of k(t))i.indexOf(c)<0&&p.call(t,c)&&(n[c]=t[c]);return n};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=require("react"),l=require("@floating-ui/react"),le=require("@livechat/design-system-icons"),N=require("clsx"),K=require("../../chunks/keyCodes-c4c35e49.js"),ue=require("../Icon/index.cjs.js"),oe=require("../../chunks/Text-df483689.js");require("../../chunks/Typography.module-2558416b.js");function se(t){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(i,n,c.get?c:{enumerable:!0,get:()=>t[n]})}}return i.default=t,Object.freeze(i)}const _=se(ae),u={"action-menu":"lc-ActionMenu-module__action-menu___K2UwW","action-menu__trigger-button":"lc-ActionMenu-module__action-menu__trigger-button___tBrz5","action-menu__list":"lc-ActionMenu-module__action-menu__list___9pNUX","action-menu__list__group-header":"lc-ActionMenu-module__action-menu__list__group-header___n-DTq","action-menu__list__item":"lc-ActionMenu-module__action-menu__list__item___n-OgH","action-menu__list__item--with-divider":"lc-ActionMenu-module__action-menu__list__item--with-divider___2H3Vm","action-menu__list__item--disabled":"lc-ActionMenu-module__action-menu__list__item--disabled___MgaX8","action-menu__list__item--selected":"lc-ActionMenu-module__action-menu__list__item--selected___eevlJ","action-menu__list__item__icon":"lc-ActionMenu-module__action-menu__list__item__icon___o3ePo"},o="action-menu",me=ge=>{var R=ge,{className:t,triggerClassName:i,options:n,triggerRenderer:c,placement:L="bottom-end",openedOnInit:U=!1,keepOpenOnClick:F,flipOptions:J,visible:x,onClose:m,onOpen:E,floatingStrategy:z,selectedOptions:d}=R,X=H(R,["className","triggerClassName","options","triggerRenderer","placement","openedOnInit","keepOpenOnClick","flipOptions","visible","onClose","onOpen","floatingStrategy","selectedOptions"]);const v=x!==void 0,[Y,A]=_.useState(U),s=_.useRef(-1),S=_.useRef(null),g=v?x:Y,B=()=>{g?(m==null||m(),!v&&A(!1)):(E==null||E(),!v&&A(!0))},{x:I,y:$,strategy:W,refs:T,context:w}=l.useFloating({middleware:[l.offset(4),l.flip(J)],placement:L,open:g,strategy:z,onOpenChange:B,whileElementsMounted:l.autoUpdate}),C=l.useClick(w),G=l.useDismiss(w,{enabled:g}),Q=l.useRole(w),{getReferenceProps:Z,getFloatingProps:O}=l.useInteractions([C,G,Q]),{styles:ee}=l.useTransitionStyles(w,{initial:({side:e})=>f({opacity:0},e==="bottom"&&{marginTop:-10}||e==="top"&&{marginTop:10}||e==="left"&&{marginLeft:10}||e==="right"&&{marginLeft:-10})}),te=e=>{var y,b;const r=s.current;let a=r+e;for(;(y=n[a])!=null&&y.disabled||(b=n[a])!=null&&b.groupHeader;)if(a+=e,a===-1){a=r;break}return a},P=e=>{var y,b;s.current=te(e);const r=(y=S.current)==null?void 0:y.children,a=r&&((b=r[s.current])==null?void 0:b.children[0]);return a==null?void 0:a.focus()},q=e=>{e.key===K.KeyCodes.arrowUp&&s.current>0&&(e.preventDefault(),P(-1)),e.key===K.KeyCodes.arrowDown&&s.current+1<n.length&&(e.preventDefault(),P(1))};_.useEffect(()=>{if(g)return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q);s.current=-1},[g,q]);const ne=(e,r)=>{s.current=e,r==null||r(),!v&&!F&&(A(!1),m==null||m())},ie=(e,r)=>e.groupHeader?_.createElement("li",{key:e.key,role:"none",className:u[`${o}__list__group-header`]},e.element):_.createElement("li",{key:e.key,role:"none"},_.createElement("button",{"data-testid":e.key,tabIndex:-1,key:e.key,disabled:e.disabled,onClick:()=>ne(r,e.onClick),role:"menuitem",className:N(u[`${o}__list__item`],{[u[`${o}__list__item--disabled`]]:e.disabled,[u[`${o}__list__item--with-divider`]]:e.withDivider,[u[`${o}__list__item--selected`]]:d==null?void 0:d.includes(e.key)})},e.element,(d==null?void 0:d.includes(e.key))&&_.createElement("div",{className:u[`${o}__list__item__icon`]},_.createElement(ue.Icon,{source:le.Check,kind:"action-primary"}))));return _.createElement(_.Fragment,null,_.createElement("div",D(f({"aria-label":"Toggle menu","data-testid":"action-menu-trigger-button",ref:T.setReference},Z()),{className:i}),c),g&&_.createElement("div",f({ref:T.setFloating,className:u[o],style:f({position:W,top:$!=null?$:"",left:I!=null?I:""},ee)},O()),_.createElement("ul",D(f({},X),{className:N(u[`${o}__list`],t),role:"menu",ref:S}),n.map(ie))))},M={"action-menu-item":"lc-ActionMenuItem-module__action-menu-item___cT70J","action-menu-item__left-node":"lc-ActionMenuItem-module__action-menu-item__left-node___3R-o1","action-menu-item__right-node":"lc-ActionMenuItem-module__action-menu-item__right-node___uq0Ym","action-menu-item__label":"lc-ActionMenuItem-module__action-menu-item__label___OgJ80","action-menu-item--warning":"lc-ActionMenuItem-module__action-menu-item--warning___DgeYg"},h="action-menu-item",de=({leftNode:t,rightNode:i,children:n,kind:c})=>_.createElement("div",{className:N(M[h],{[M[`${h}--warning`]]:c==="warning"})},t&&_.createElement("div",{className:M[`${h}__left-node`]},t),_.createElement(oe.Text,{as:"div",className:M[`${h}__label`]},n),i&&_.createElement("div",{className:M[`${h}__right-node`]},i));exports.ActionMenu=me;exports.ActionMenuItem=de;
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
var _e = Object.defineProperty, ie = Object.defineProperties;
|
|
2
|
-
var ae = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var M = Object.getOwnPropertySymbols;
|
|
4
|
-
var K = Object.prototype.hasOwnProperty, L = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var H = (t, _, n) => _ in t ? _e(t, _, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[_] = n, g = (t, _) => {
|
|
6
|
-
for (var n in _ || (_ = {}))
|
|
7
|
-
K.call(_, n) && H(t, n, _[n]);
|
|
8
|
-
if (M)
|
|
9
|
-
for (var n of M(_))
|
|
10
|
-
L.call(_, n) && H(t, n, _[n]);
|
|
11
|
-
return t;
|
|
12
|
-
}, N = (t, _) => ie(t, ae(_));
|
|
13
|
-
var S = (t, _) => {
|
|
14
|
-
var n = {};
|
|
15
|
-
for (var a in t)
|
|
16
|
-
K.call(t, a) && _.indexOf(a) < 0 && (n[a] = t[a]);
|
|
17
|
-
if (t != null && M)
|
|
18
|
-
for (var a of M(t))
|
|
19
|
-
_.indexOf(a) < 0 && L.call(t, a) && (n[a] = t[a]);
|
|
20
|
-
return n;
|
|
21
|
-
};
|
|
22
|
-
import * as i from "react";
|
|
23
|
-
import { useFloating as ce, offset as le, flip as me, autoUpdate as re, useClick as ue, useDismiss as oe, useRole as se, useInteractions as de, useTransitionStyles as ge } from "@floating-ui/react";
|
|
24
|
-
import { Check as fe } from "@livechat/design-system-icons";
|
|
25
|
-
import x from "clsx";
|
|
26
|
-
import { K as U } from "../../chunks/keyCodes-30323e90.js";
|
|
27
|
-
import { Icon as ye } from "../Icon/index.es.js";
|
|
28
|
-
import { T as be } from "../../chunks/Text-b31d1e9a.js";
|
|
29
|
-
import "../../chunks/Typography.module-93efb34d.js";
|
|
30
|
-
const m = {
|
|
31
|
-
"action-menu": "lc-ActionMenu-module__action-menu___K2UwW",
|
|
32
|
-
"action-menu__trigger-button": "lc-ActionMenu-module__action-menu__trigger-button___tBrz5",
|
|
33
|
-
"action-menu__list": "lc-ActionMenu-module__action-menu__list___9pNUX",
|
|
34
|
-
"action-menu__list__group-header": "lc-ActionMenu-module__action-menu__list__group-header___n-DTq",
|
|
35
|
-
"action-menu__list__item": "lc-ActionMenu-module__action-menu__list__item___n-OgH",
|
|
36
|
-
"action-menu__list__item--with-divider": "lc-ActionMenu-module__action-menu__list__item--with-divider___2H3Vm",
|
|
37
|
-
"action-menu__list__item--disabled": "lc-ActionMenu-module__action-menu__list__item--disabled___MgaX8",
|
|
38
|
-
"action-menu__list__item--selected": "lc-ActionMenu-module__action-menu__list__item--selected___eevlJ",
|
|
39
|
-
"action-menu__list__item__icon": "lc-ActionMenu-module__action-menu__list__item__icon___o3ePo"
|
|
40
|
-
}, r = "action-menu", Ne = (he) => {
|
|
41
|
-
var R = he, {
|
|
42
|
-
className: t,
|
|
43
|
-
triggerClassName: _,
|
|
44
|
-
options: n,
|
|
45
|
-
triggerRenderer: a,
|
|
46
|
-
placement: F = "bottom-end",
|
|
47
|
-
openedOnInit: J = !1,
|
|
48
|
-
keepOpenOnClick: P,
|
|
49
|
-
flipOptions: q,
|
|
50
|
-
visible: D,
|
|
51
|
-
onClose: o,
|
|
52
|
-
onOpen: v,
|
|
53
|
-
floatingStrategy: X,
|
|
54
|
-
selectedOptions: s
|
|
55
|
-
} = R, Y = S(R, [
|
|
56
|
-
"className",
|
|
57
|
-
"triggerClassName",
|
|
58
|
-
"options",
|
|
59
|
-
"triggerRenderer",
|
|
60
|
-
"placement",
|
|
61
|
-
"openedOnInit",
|
|
62
|
-
"keepOpenOnClick",
|
|
63
|
-
"flipOptions",
|
|
64
|
-
"visible",
|
|
65
|
-
"onClose",
|
|
66
|
-
"onOpen",
|
|
67
|
-
"floatingStrategy",
|
|
68
|
-
"selectedOptions"
|
|
69
|
-
]);
|
|
70
|
-
const w = D !== void 0, [z, k] = i.useState(J), u = i.useRef(-1), T = i.useRef(null), d = w ? D : z, B = () => {
|
|
71
|
-
d ? (o == null || o(), !w && k(!1)) : (v == null || v(), !w && k(!0));
|
|
72
|
-
}, { x: A, y: $, strategy: W, refs: V, context: E } = ce({
|
|
73
|
-
middleware: [le(4), me(q)],
|
|
74
|
-
placement: F,
|
|
75
|
-
open: d,
|
|
76
|
-
strategy: X,
|
|
77
|
-
onOpenChange: B,
|
|
78
|
-
whileElementsMounted: re
|
|
79
|
-
}), j = ue(E), G = oe(E, {
|
|
80
|
-
enabled: d
|
|
81
|
-
}), Q = se(E), { getReferenceProps: Z, getFloatingProps: C } = de([
|
|
82
|
-
j,
|
|
83
|
-
G,
|
|
84
|
-
Q
|
|
85
|
-
]), { styles: O } = ge(E, {
|
|
86
|
-
initial: ({ side: e }) => g({
|
|
87
|
-
opacity: 0
|
|
88
|
-
}, e === "bottom" && {
|
|
89
|
-
marginTop: -10
|
|
90
|
-
} || e === "top" && {
|
|
91
|
-
marginTop: 10
|
|
92
|
-
} || e === "left" && {
|
|
93
|
-
marginLeft: 10
|
|
94
|
-
} || e === "right" && {
|
|
95
|
-
marginLeft: -10
|
|
96
|
-
})
|
|
97
|
-
}), ee = (e) => {
|
|
98
|
-
var f, y;
|
|
99
|
-
const c = u.current;
|
|
100
|
-
let l = c + e;
|
|
101
|
-
for (; (f = n[l]) != null && f.disabled || (y = n[l]) != null && y.groupHeader; )
|
|
102
|
-
if (l += e, l === -1) {
|
|
103
|
-
l = c;
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
return l;
|
|
107
|
-
}, p = (e) => {
|
|
108
|
-
var f, y;
|
|
109
|
-
u.current = ee(e);
|
|
110
|
-
const c = (f = T.current) == null ? void 0 : f.children, l = c && ((y = c[u.current]) == null ? void 0 : y.children[0]);
|
|
111
|
-
return l == null ? void 0 : l.focus();
|
|
112
|
-
}, I = (e) => {
|
|
113
|
-
e.key === U.arrowUp && u.current > 0 && (e.preventDefault(), p(-1)), e.key === U.arrowDown && u.current + 1 < n.length && (e.preventDefault(), p(1));
|
|
114
|
-
};
|
|
115
|
-
i.useEffect(() => {
|
|
116
|
-
if (d)
|
|
117
|
-
return document.addEventListener("keydown", I), () => document.removeEventListener("keydown", I);
|
|
118
|
-
u.current = -1;
|
|
119
|
-
}, [d, I]);
|
|
120
|
-
const te = (e, c) => {
|
|
121
|
-
u.current = e, c == null || c(), !w && !P && (k(!1), o == null || o());
|
|
122
|
-
}, ne = (e, c) => e.groupHeader ? /* @__PURE__ */ i.createElement(
|
|
123
|
-
"li",
|
|
124
|
-
{
|
|
125
|
-
key: e.key,
|
|
126
|
-
role: "none",
|
|
127
|
-
className: m[`${r}__list__group-header`]
|
|
128
|
-
},
|
|
129
|
-
e.element
|
|
130
|
-
) : /* @__PURE__ */ i.createElement("li", { key: e.key, role: "none" }, /* @__PURE__ */ i.createElement(
|
|
131
|
-
"button",
|
|
132
|
-
{
|
|
133
|
-
"data-testid": e.key,
|
|
134
|
-
tabIndex: -1,
|
|
135
|
-
key: e.key,
|
|
136
|
-
disabled: e.disabled,
|
|
137
|
-
onClick: () => te(c, e.onClick),
|
|
138
|
-
role: "menuitem",
|
|
139
|
-
className: x(m[`${r}__list__item`], {
|
|
140
|
-
[m[`${r}__list__item--disabled`]]: e.disabled,
|
|
141
|
-
[m[`${r}__list__item--with-divider`]]: e.withDivider,
|
|
142
|
-
[m[`${r}__list__item--selected`]]: s == null ? void 0 : s.includes(e.key)
|
|
143
|
-
})
|
|
144
|
-
},
|
|
145
|
-
e.element,
|
|
146
|
-
(s == null ? void 0 : s.includes(e.key)) && /* @__PURE__ */ i.createElement("div", { className: m[`${r}__list__item__icon`] }, /* @__PURE__ */ i.createElement(ye, { source: fe, kind: "action-primary" }))
|
|
147
|
-
));
|
|
148
|
-
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
149
|
-
"div",
|
|
150
|
-
N(g({
|
|
151
|
-
"aria-label": "Toggle menu",
|
|
152
|
-
"data-testid": "action-menu-trigger-button",
|
|
153
|
-
ref: V.setReference
|
|
154
|
-
}, Z()), {
|
|
155
|
-
className: _
|
|
156
|
-
}),
|
|
157
|
-
a
|
|
158
|
-
), d && /* @__PURE__ */ i.createElement(
|
|
159
|
-
"div",
|
|
160
|
-
g({
|
|
161
|
-
ref: V.setFloating,
|
|
162
|
-
className: m[r],
|
|
163
|
-
style: g({
|
|
164
|
-
position: W,
|
|
165
|
-
top: $ != null ? $ : "",
|
|
166
|
-
left: A != null ? A : ""
|
|
167
|
-
}, O)
|
|
168
|
-
}, C()),
|
|
169
|
-
/* @__PURE__ */ i.createElement(
|
|
170
|
-
"ul",
|
|
171
|
-
N(g({}, Y), {
|
|
172
|
-
className: x(m[`${r}__list`], t),
|
|
173
|
-
role: "menu",
|
|
174
|
-
ref: T
|
|
175
|
-
}),
|
|
176
|
-
n.map(ne)
|
|
177
|
-
)
|
|
178
|
-
));
|
|
179
|
-
}, b = {
|
|
180
|
-
"action-menu-item": "lc-ActionMenuItem-module__action-menu-item___cT70J",
|
|
181
|
-
"action-menu-item__left-node": "lc-ActionMenuItem-module__action-menu-item__left-node___3R-o1",
|
|
182
|
-
"action-menu-item__right-node": "lc-ActionMenuItem-module__action-menu-item__right-node___uq0Ym",
|
|
183
|
-
"action-menu-item__label": "lc-ActionMenuItem-module__action-menu-item__label___OgJ80",
|
|
184
|
-
"action-menu-item--warning": "lc-ActionMenuItem-module__action-menu-item--warning___DgeYg"
|
|
185
|
-
}, h = "action-menu-item", xe = ({ leftNode: t, rightNode: _, children: n, kind: a }) => /* @__PURE__ */ i.createElement(
|
|
186
|
-
"div",
|
|
187
|
-
{
|
|
188
|
-
className: x(b[h], {
|
|
189
|
-
[b[`${h}--warning`]]: a === "warning"
|
|
190
|
-
})
|
|
191
|
-
},
|
|
192
|
-
t && /* @__PURE__ */ i.createElement("div", { className: b[`${h}__left-node`] }, t),
|
|
193
|
-
/* @__PURE__ */ i.createElement(be, { as: "div", className: b[`${h}__label`] }, n),
|
|
194
|
-
_ && /* @__PURE__ */ i.createElement("div", { className: b[`${h}__right-node`] }, _)
|
|
195
|
-
);
|
|
196
|
-
export {
|
|
197
|
-
Ne as ActionMenu,
|
|
198
|
-
xe as ActionMenuItem
|
|
199
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty,z=Object.defineProperties;var I=Object.getOwnPropertyDescriptors;var s=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var A=(e,_,t)=>_ in e?h(e,_,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[_]=t,m=(e,_)=>{for(var t in _||(_={}))b.call(_,t)&&A(e,t,_[t]);if(s)for(var t of s(_))E.call(_,t)&&A(e,t,_[t]);return e},C=(e,_)=>z(e,I(_));var $=(e,_)=>{var t={};for(var r in e)b.call(e,r)&&_.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&s)for(var r of s(e))_.indexOf(r)<0&&E.call(e,r)&&(t[r]=e[r]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react"),o=require("@livechat/design-system-icons"),S=require("clsx"),T=require("lodash.debounce"),d=require("../Button/index.cjs.js"),v=require("../Icon/index.cjs.js"),D=require("../../chunks/Text-df483689.js");require("../Loader/index.cjs.js");require("../../chunks/Typography.module-2558416b.js");function O(e){const _=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(_,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return _.default=e,Object.freeze(_)}const n=O(q),P="lc-Alert-module__alert___HBTns",R="lc-Alert-module__alert__icon___8TaAH",j="lc-Alert-module__alert__content___9nZdf",y="lc-Alert-module__alert__content__wrapper___aLBkP",M="lc-Alert-module__alert__content__wrapper__text___HDMbR",W="lc-Alert-module__alert__content__wrapper__cta___9L-oE",H="lc-Alert-module__alert__content__wrapper__cta__link___D9Igz",l={alert:P,alert__icon:R,alert__content:j,alert__content__wrapper:y,alert__content__wrapper__text:M,alert__content__wrapper__cta:W,alert__content__wrapper__cta__link:H,"alert__close-icon":"lc-Alert-module__alert__close-icon___rYxVy","alert--small":"lc-Alert-module__alert--small___Fyk-v","alert--medium":"lc-Alert-module__alert--medium___ItZWT","alert--large":"lc-Alert-module__alert--large___IH9yM","alert--info":"lc-Alert-module__alert--info___GmIGN","alert--warning":"lc-Alert-module__alert--warning___MubhD","alert--success":"lc-Alert-module__alert--success___fPtlZ","alert--error":"lc-Alert-module__alert--error___DKPo0"},L={info:{source:o.Info,kind:"link"},warning:{source:o.Warning,kind:"warning"},success:{source:o.CheckCircle,kind:"success"},error:{source:o.Block,kind:"error"}},c="alert",Z=G=>{var w=G,{children:e,className:_,primaryButton:t,secondaryButton:r,kind:p="info",onClose:f}=w,x=$(w,["children","className","primaryButton","secondaryButton","kind","onClose"]);const a=n.useRef(null),[i,u]=n.useState(null),N=S(l[c],l[`${c}--${p}`],i==="large"&&l[`${c}--large`],i==="medium"&&l[`${c}--medium`],i==="small"&&l[`${c}--small`],_);return n.useEffect(()=>{const g=()=>a.current&&a.current.offsetWidth<=400?u("small"):a.current&&a.current.offsetWidth>400&&a.current.offsetWidth<=800?u("medium"):u("large"),k=T(()=>{g()},500);return window.addEventListener("resize",k),g(),()=>window.removeEventListener("resize",k)}),n.createElement("div",m({ref:a,className:N},x),n.createElement("div",{className:l[`${c}__content`]},n.createElement("div",{className:l[`${c}__content__wrapper`]},n.createElement(v.Icon,C(m({},L[p]),{size:"large",className:l[`${c}__icon`]})),n.createElement(D.Text,{as:"div",className:l[`${c}__content__wrapper__text`]},e)),(t||r)&&n.createElement("div",{className:l[`${c}__content__wrapper__cta`]},t&&n.createElement(d.Button,{kind:"high-contrast",onClick:t.handleClick},t.label),r&&n.createElement(d.Button,{className:l[`${c}__content__wrapper__cta__link`],kind:"text",onClick:r.handleClick},r.label))),f&&n.createElement(d.Button,{"aria-label":"Close alert",type:"button",className:l[`${c}__close-icon`],size:"compact",kind:"plain",icon:n.createElement(v.Icon,{source:o.Close}),onClick:f}))};exports.Alert=Z;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
var x = Object.defineProperty, z = Object.defineProperties;
|
|
2
|
-
var b = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var o = Object.getOwnPropertySymbols;
|
|
4
|
-
var g = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var A = (e, t, _) => t in e ? x(e, t, { enumerable: !0, configurable: !0, writable: !0, value: _ }) : e[t] = _, m = (e, t) => {
|
|
6
|
-
for (var _ in t || (t = {}))
|
|
7
|
-
g.call(t, _) && A(e, _, t[_]);
|
|
8
|
-
if (o)
|
|
9
|
-
for (var _ of o(t))
|
|
10
|
-
E.call(t, _) && A(e, _, t[_]);
|
|
11
|
-
return e;
|
|
12
|
-
}, C = (e, t) => z(e, b(t));
|
|
13
|
-
var $ = (e, t) => {
|
|
14
|
-
var _ = {};
|
|
15
|
-
for (var r in e)
|
|
16
|
-
g.call(e, r) && t.indexOf(r) < 0 && (_[r] = e[r]);
|
|
17
|
-
if (e != null && o)
|
|
18
|
-
for (var r of o(e))
|
|
19
|
-
t.indexOf(r) < 0 && E.call(e, r) && (_[r] = e[r]);
|
|
20
|
-
return _;
|
|
21
|
-
};
|
|
22
|
-
import * as l from "react";
|
|
23
|
-
import { Close as I, Info as R, Warning as T, CheckCircle as W, Block as D } from "@livechat/design-system-icons";
|
|
24
|
-
import H from "clsx";
|
|
25
|
-
import L from "lodash.debounce";
|
|
26
|
-
import { Button as p } from "../Button/index.es.js";
|
|
27
|
-
import { Icon as h } from "../Icon/index.es.js";
|
|
28
|
-
import { T as M } from "../../chunks/Text-b31d1e9a.js";
|
|
29
|
-
import "../Loader/index.es.js";
|
|
30
|
-
import "../../chunks/Typography.module-93efb34d.js";
|
|
31
|
-
const P = "lc-Alert-module__alert___HBTns", S = "lc-Alert-module__alert__icon___8TaAH", Z = "lc-Alert-module__alert__content___9nZdf", G = "lc-Alert-module__alert__content__wrapper___aLBkP", F = "lc-Alert-module__alert__content__wrapper__text___HDMbR", K = "lc-Alert-module__alert__content__wrapper__cta___9L-oE", V = "lc-Alert-module__alert__content__wrapper__cta__link___D9Igz", n = {
|
|
32
|
-
alert: P,
|
|
33
|
-
alert__icon: S,
|
|
34
|
-
alert__content: Z,
|
|
35
|
-
alert__content__wrapper: G,
|
|
36
|
-
alert__content__wrapper__text: F,
|
|
37
|
-
alert__content__wrapper__cta: K,
|
|
38
|
-
alert__content__wrapper__cta__link: V,
|
|
39
|
-
"alert__close-icon": "lc-Alert-module__alert__close-icon___rYxVy",
|
|
40
|
-
"alert--small": "lc-Alert-module__alert--small___Fyk-v",
|
|
41
|
-
"alert--medium": "lc-Alert-module__alert--medium___ItZWT",
|
|
42
|
-
"alert--large": "lc-Alert-module__alert--large___IH9yM",
|
|
43
|
-
"alert--info": "lc-Alert-module__alert--info___GmIGN",
|
|
44
|
-
"alert--warning": "lc-Alert-module__alert--warning___MubhD",
|
|
45
|
-
"alert--success": "lc-Alert-module__alert--success___fPtlZ",
|
|
46
|
-
"alert--error": "lc-Alert-module__alert--error___DKPo0"
|
|
47
|
-
}, Y = {
|
|
48
|
-
info: {
|
|
49
|
-
source: R,
|
|
50
|
-
kind: "link"
|
|
51
|
-
},
|
|
52
|
-
warning: {
|
|
53
|
-
source: T,
|
|
54
|
-
kind: "warning"
|
|
55
|
-
},
|
|
56
|
-
success: {
|
|
57
|
-
source: W,
|
|
58
|
-
kind: "success"
|
|
59
|
-
},
|
|
60
|
-
error: {
|
|
61
|
-
source: D,
|
|
62
|
-
kind: "error"
|
|
63
|
-
}
|
|
64
|
-
}, a = "alert", _e = (j) => {
|
|
65
|
-
var f = j, {
|
|
66
|
-
children: e,
|
|
67
|
-
className: t,
|
|
68
|
-
primaryButton: _,
|
|
69
|
-
secondaryButton: r,
|
|
70
|
-
kind: u = "info",
|
|
71
|
-
onClose: d
|
|
72
|
-
} = f, N = $(f, [
|
|
73
|
-
"children",
|
|
74
|
-
"className",
|
|
75
|
-
"primaryButton",
|
|
76
|
-
"secondaryButton",
|
|
77
|
-
"kind",
|
|
78
|
-
"onClose"
|
|
79
|
-
]);
|
|
80
|
-
const c = l.useRef(null), [s, i] = l.useState(null), v = H(
|
|
81
|
-
n[a],
|
|
82
|
-
n[`${a}--${u}`],
|
|
83
|
-
s === "large" && n[`${a}--large`],
|
|
84
|
-
s === "medium" && n[`${a}--medium`],
|
|
85
|
-
s === "small" && n[`${a}--small`],
|
|
86
|
-
t
|
|
87
|
-
);
|
|
88
|
-
return l.useEffect(() => {
|
|
89
|
-
const w = () => c.current && c.current.offsetWidth <= 400 ? i("small") : c.current && c.current.offsetWidth > 400 && c.current.offsetWidth <= 800 ? i("medium") : i("large"), k = L(() => {
|
|
90
|
-
w();
|
|
91
|
-
}, 500);
|
|
92
|
-
return window.addEventListener("resize", k), w(), () => window.removeEventListener("resize", k);
|
|
93
|
-
}), /* @__PURE__ */ l.createElement("div", m({ ref: c, className: v }, N), /* @__PURE__ */ l.createElement("div", { className: n[`${a}__content`] }, /* @__PURE__ */ l.createElement("div", { className: n[`${a}__content__wrapper`] }, /* @__PURE__ */ l.createElement(
|
|
94
|
-
h,
|
|
95
|
-
C(m({}, Y[u]), {
|
|
96
|
-
size: "large",
|
|
97
|
-
className: n[`${a}__icon`]
|
|
98
|
-
})
|
|
99
|
-
), /* @__PURE__ */ l.createElement(
|
|
100
|
-
M,
|
|
101
|
-
{
|
|
102
|
-
as: "div",
|
|
103
|
-
className: n[`${a}__content__wrapper__text`]
|
|
104
|
-
},
|
|
105
|
-
e
|
|
106
|
-
)), (_ || r) && /* @__PURE__ */ l.createElement("div", { className: n[`${a}__content__wrapper__cta`] }, _ && /* @__PURE__ */ l.createElement(p, { kind: "high-contrast", onClick: _.handleClick }, _.label), r && /* @__PURE__ */ l.createElement(
|
|
107
|
-
p,
|
|
108
|
-
{
|
|
109
|
-
className: n[`${a}__content__wrapper__cta__link`],
|
|
110
|
-
kind: "text",
|
|
111
|
-
onClick: r.handleClick
|
|
112
|
-
},
|
|
113
|
-
r.label
|
|
114
|
-
))), d && /* @__PURE__ */ l.createElement(
|
|
115
|
-
p,
|
|
116
|
-
{
|
|
117
|
-
"aria-label": "Close alert",
|
|
118
|
-
type: "button",
|
|
119
|
-
className: n[`${a}__close-icon`],
|
|
120
|
-
size: "compact",
|
|
121
|
-
kind: "plain",
|
|
122
|
-
icon: /* @__PURE__ */ l.createElement(h, { source: I }),
|
|
123
|
-
onClick: d
|
|
124
|
-
}
|
|
125
|
-
));
|
|
126
|
-
};
|
|
127
|
-
export {
|
|
128
|
-
_e as Alert
|
|
129
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var Q=Object.defineProperty;var c=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable;var E=(a,_,t)=>_ in a?Q(a,_,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[_]=t,A=(a,_)=>{for(var t in _||(_={}))S.call(_,t)&&E(a,t,_[t]);if(c)for(var t of c(_))h.call(_,t)&&E(a,t,_[t]);return a};var F=(a,_)=>{var t={};for(var r in a)S.call(a,r)&&_.indexOf(r)<0&&(t[r]=a[r]);if(a!=null&&c)for(var r of c(a))_.indexOf(r)<0&&h.call(a,r)&&(t[r]=a[r]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),T=require("@livechat/design-system-icons"),u=require("clsx"),V=require("../Icon/index.cjs.js"),G=require("../../chunks/Heading-617540b6.js"),K=require("polished");require("../../chunks/Typography.module-2558416b.js");function W(a){const _=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(_,t,r.get?r:{enumerable:!0,get:()=>a[t]})}}return _.default=a,Object.freeze(_)}const m=W(R),I=Array.from({length:10},(a,_)=>`--surface-avatar-${_+1}`);function q(a){if(!a)return;const _=a.split("").reduce((t,r)=>t+r.charCodeAt(0),0);return`var(${I[_%I.length]})`}function X(a="",_=2){const t=a.trim().split(/\s+/),r=t.map(o=>[...o][0]);if(_<1)return"";if(t.length<=_)return r.join("").toUpperCase();const s=[r[0]];for(let o=t.length-_+1;o<t.length;o++)s.push(r[o]);return s.join("").toUpperCase()}function J(a){let _=a;if(a.startsWith("var(--")&&a.endsWith(")")){const t=a.slice(4,-1);_=window.getComputedStyle(document.documentElement).getPropertyValue(t).trim()}return _&&K.getContrast(_,"#FFFFFF")>3?"var(--color-white)":"var(--color-black)"}const Y="lc-Avatar-module__avatar___1zTCE",Z="lc-Avatar-module__avatar__status___nX2Ls",z="lc-Avatar-module__avatar__rim___RCQ8Q",aa="lc-Avatar-module__avatar__image___YqfqE",e={avatar:Y,avatar__status:Z,"avatar__status--available":"lc-Avatar-module__avatar__status--available___tcpFg","avatar__status--unavailable":"lc-Avatar-module__avatar__status--unavailable___ciauF","avatar__status--unknown":"lc-Avatar-module__avatar__status--unknown___MBaGB","avatar__status--xxxsmall":"lc-Avatar-module__avatar__status--xxxsmall___8pkEO","avatar__status--circle":"lc-Avatar-module__avatar__status--circle___doV5H","avatar__status--xxsmall":"lc-Avatar-module__avatar__status--xxsmall___M69lx","avatar__status--xsmall":"lc-Avatar-module__avatar__status--xsmall___RKQiI","avatar__status--small":"lc-Avatar-module__avatar__status--small___cVrA7","avatar__status--medium":"lc-Avatar-module__avatar__status--medium___n5z1H","avatar__status--large":"lc-Avatar-module__avatar__status--large___Lt-0p","avatar__status--xlarge":"lc-Avatar-module__avatar__status--xlarge___RWIcJ","avatar__status--xxlarge":"lc-Avatar-module__avatar__status--xxlarge___crG9D","avatar__status--xxxlarge":"lc-Avatar-module__avatar__status--xxxlarge___Iv61X","avatar__status--rounded-square":"lc-Avatar-module__avatar__status--rounded-square___-My1P",avatar__rim:z,"avatar__rim--xxxsmall":"lc-Avatar-module__avatar__rim--xxxsmall___0CH9D","avatar__rim--xxsmall":"lc-Avatar-module__avatar__rim--xxsmall___Mde0K","avatar__rim--xsmall":"lc-Avatar-module__avatar__rim--xsmall___LAN-b","avatar__rim--small":"lc-Avatar-module__avatar__rim--small___FT8LX","avatar__rim--medium":"lc-Avatar-module__avatar__rim--medium___Dy0pr","avatar__rim--large":"lc-Avatar-module__avatar__rim--large___FPvGp","avatar__rim--xlarge":"lc-Avatar-module__avatar__rim--xlarge___CY0kN","avatar__rim--xxlarge":"lc-Avatar-module__avatar__rim--xxlarge___tE053","avatar__rim--xxxlarge":"lc-Avatar-module__avatar__rim--xxxlarge___amlGP",avatar__image:aa,"avatar__icon--xxxsmall":"lc-Avatar-module__avatar__icon--xxxsmall___KaoMa","avatar__icon--xxsmall":"lc-Avatar-module__avatar__icon--xxsmall___NJJNV","avatar__icon--xsmall":"lc-Avatar-module__avatar__icon--xsmall___yHEZK","avatar__icon--small":"lc-Avatar-module__avatar__icon--small___l6lBu","avatar__icon--medium":"lc-Avatar-module__avatar__icon--medium___LF4w2","avatar__icon--large":"lc-Avatar-module__avatar__icon--large___QntBf","avatar__icon--xlarge":"lc-Avatar-module__avatar__icon--xlarge___bcHbI","avatar__icon--xxlarge":"lc-Avatar-module__avatar__icon--xxlarge___sx8Fq","avatar__icon--xxxlarge":"lc-Avatar-module__avatar__icon--xxxlarge___4144S","avatar--circle":"lc-Avatar-module__avatar--circle___XwEz-","avatar--rounded-square":"lc-Avatar-module__avatar--rounded-square___m7-4I","avatar--xxxsmall":"lc-Avatar-module__avatar--xxxsmall___EHzpP","avatar--xxsmall":"lc-Avatar-module__avatar--xxsmall___EDOVp","avatar--xsmall":"lc-Avatar-module__avatar--xsmall___nI348","avatar--small":"lc-Avatar-module__avatar--small___UuQen","avatar--medium":"lc-Avatar-module__avatar--medium___Bt9Eo","avatar--large":"lc-Avatar-module__avatar--large___OU-08","avatar--xlarge":"lc-Avatar-module__avatar--xlarge___zwgeW","avatar--xxlarge":"lc-Avatar-module__avatar--xxlarge___Ur0ul","avatar--xxxlarge":"lc-Avatar-module__avatar--xxxlarge___Z-54U"},l="avatar",_a=ta=>{var b=ta,{alt:a,className:_,color:t,shape:r="circle",size:s="medium",src:o,status:v,text:p,type:n,withRim:f=!1}=b,k=F(b,["alt","className","color","shape","size","src","status","text","type","withRim"]);const i=n==="image"&&!o,[$,y]=m.useState(i),N=n==="image"&&!!o&&!$,C=n==="text",D=["xxxsmall","xxsmall","xsmall"].includes(s)?1:2,w=X(p,D),x=["xxxsmall","xxsmall","xsmall","small"].includes(s),d=t||q(p),O=d?J(d):void 0,P=C?{backgroundColor:d}:{},H=u(A({[e[l]]:!0,[e[`${l}--${r}`]]:!0,[e[`${l}--${s}`]]:!0,[e[`${l}--with-rim`]]:f},_?{[`${_}`]:_}:{})),j=u(e[`${l}__status`],e[`${l}__status--${r}`],e[`${l}__status--${s}`],...v?[e[`${l}__status--${v}`]]:[]),M=u(e[`${l}__icon`],e[`${l}__icon--${s}`]),B=u(e[`${l}__rim`],e[`${l}__rim--${s}`]),U=g=>x?"2xs":["medium"].includes(g)?"xs":["large","xlarge"].includes(g)?"sm":["xxlarge"].includes(g)?"lg":"xl",L=m.useCallback(()=>y(!0),[]);return m.useEffect(()=>{y(i)},[i]),m.createElement("div",A({className:H,style:P},k),f&&m.createElement("div",{"data-testid":`${l}__rim`,className:B}),v&&m.createElement("div",{"data-testid":`${l}__status`,className:j}),N&&m.createElement("img",{className:e[`${l}__image`],src:o,alt:a,onError:L}),C&&m.createElement(G.Heading,{as:"span",size:U(s),style:{color:O},bold:x,uppercase:x},w),$&&m.createElement(V.Icon,{"data-testid":`${l}__icon`,className:M,source:T.Person}))};exports.Avatar=_a;exports.generateAvatarColor=q;
|