@livechat/design-system-react-components 1.17.1-alpha.3 → 1.17.1-alpha.4
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/chunks/Heading-617540b6.js +1 -0
- package/dist/chunks/Heading-6b95d08b.js +64 -0
- package/dist/chunks/Text-b31d1e9a.js +66 -0
- package/dist/chunks/Text-df483689.js +1 -0
- package/dist/chunks/Tooltip-1c5cb6fe.js +182 -0
- package/dist/chunks/Tooltip-f9f79274.js +1 -0
- package/dist/chunks/Typography.module-2558416b.js +1 -0
- package/dist/chunks/Typography.module-93efb34d.js +23 -0
- package/dist/chunks/keyCodes-30323e90.js +15 -0
- package/dist/chunks/keyCodes-c4c35e49.js +1 -0
- package/dist/components/ActionBar/index.cjs.js +1 -0
- package/dist/components/ActionBar/index.es.js +192 -0
- package/dist/components/ActionMenu/index.cjs.js +1 -0
- package/dist/components/ActionMenu/index.es.js +199 -0
- package/dist/components/Alert/index.cjs.js +1 -0
- package/dist/components/Alert/index.es.js +129 -0
- package/dist/components/Avatar/index.cjs.js +1 -0
- package/dist/components/Avatar/index.es.js +190 -0
- package/dist/components/Badge/index.cjs.js +1 -0
- package/dist/components/Badge/index.es.js +65 -0
- package/dist/components/Button/index.cjs.js +1 -0
- package/dist/components/Button/index.es.js +143 -0
- package/dist/components/Card/index.cjs.js +1 -0
- package/dist/components/Card/index.es.js +96 -0
- package/dist/components/Checkbox/index.cjs.js +1 -0
- package/dist/components/Checkbox/index.es.js +64 -0
- package/dist/components/DatePicker/index.cjs.js +1 -0
- package/dist/components/DatePicker/index.es.js +516 -0
- package/dist/components/DetailsCard/index.cjs.js +1 -0
- package/dist/components/DetailsCard/index.es.js +140 -0
- package/dist/components/DetailsCardInfo/index.cjs.js +1 -0
- package/dist/components/DetailsCardInfo/index.es.js +12 -0
- package/dist/components/FieldDescription/index.cjs.js +1 -0
- package/dist/components/FieldDescription/index.es.js +41 -0
- package/dist/components/FieldError/index.cjs.js +1 -0
- package/dist/components/FieldError/index.es.js +51 -0
- package/dist/components/FieldGroup/index.cjs.js +1 -0
- package/dist/components/FieldGroup/index.es.js +58 -0
- package/dist/components/FileUploadProgress/index.cjs.js +1 -0
- package/dist/components/FileUploadProgress/index.es.js +109 -0
- package/dist/components/Form/index.cjs.js +1 -0
- package/dist/components/Form/index.es.js +50 -0
- package/dist/components/FormField/index.cjs.js +1 -0
- package/dist/components/FormField/index.es.js +116 -0
- package/dist/components/FormGroup/index.cjs.js +1 -0
- package/dist/components/FormGroup/index.es.js +58 -0
- package/dist/components/Icon/index.cjs.js +1 -0
- package/dist/components/Icon/index.es.js +103 -0
- package/dist/components/Input/index.cjs.js +1 -0
- package/dist/components/Input/index.es.js +123 -0
- package/dist/components/Link/index.cjs.js +1 -0
- package/dist/components/Link/index.es.js +47 -0
- package/dist/components/Loader/index.cjs.js +1 -0
- package/dist/components/Loader/index.es.js +39 -0
- package/dist/components/Modal/index.cjs.js +1 -0
- package/dist/components/Modal/index.es.js +249 -0
- package/dist/components/NumericInput/index.cjs.js +1 -0
- package/dist/components/NumericInput/index.es.js +139 -0
- package/dist/components/Picker/index.cjs.js +1 -0
- package/dist/components/Picker/index.es.js +740 -0
- package/dist/components/Popover/index.cjs.js +1 -0
- package/dist/components/Popover/index.es.js +75 -0
- package/dist/components/Progress/index.cjs.js +1 -0
- package/dist/components/Progress/index.es.js +160 -0
- package/dist/components/PromoBanner/index.cjs.js +1 -0
- package/dist/components/PromoBanner/index.es.js +74 -0
- package/dist/components/PromoBannerV2/index.cjs.js +1 -0
- package/dist/components/PromoBannerV2/index.es.js +79 -0
- package/dist/components/RadioButton/index.cjs.js +1 -0
- package/dist/components/RadioButton/index.es.js +58 -0
- package/dist/components/Search/index.cjs.js +1 -0
- package/dist/components/Search/index.es.js +117 -0
- package/dist/components/SegmentedControl/index.cjs.js +1 -0
- package/dist/components/SegmentedControl/index.es.js +55 -0
- package/dist/components/Switch/index.cjs.js +1 -0
- package/dist/components/Switch/index.es.js +145 -0
- package/dist/components/Tab/index.cjs.js +1 -0
- package/dist/components/Tab/index.es.js +93 -0
- package/dist/components/Tag/index.cjs.js +1 -0
- package/dist/components/Tag/index.es.js +143 -0
- package/dist/components/TagInput/index.cjs.js +1 -0
- package/dist/components/TagInput/index.es.js +244 -0
- package/dist/components/Textarea/index.cjs.js +1 -0
- package/dist/components/Textarea/index.es.js +55 -0
- package/dist/components/Toast/index.cjs.js +1 -0
- package/dist/components/Toast/index.es.js +163 -0
- package/dist/components/Tooltip/components/UserGuide/index.cjs.js +1 -0
- package/dist/components/Tooltip/components/UserGuide/index.es.js +196 -0
- package/dist/components/Tooltip/components/index.cjs.js +1 -0
- package/dist/components/Tooltip/components/index.es.js +117 -0
- package/dist/components/Tooltip/index.cjs.js +1 -0
- package/dist/components/Tooltip/index.es.js +21 -0
- package/dist/components/Typography/index.cjs.js +1 -0
- package/dist/components/Typography/index.es.js +48 -0
- package/dist/components/UploadBar/index.cjs.js +1 -0
- package/dist/components/UploadBar/index.es.js +111 -0
- package/dist/foundations/index.cjs.js +1 -0
- package/dist/foundations/index.es.js +353 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +133 -5231
- package/dist/preview-stats.json +1231 -1237
- package/dist/style.css +1 -1
- package/dist/utils/index.cjs.js +1 -0
- package/dist/utils/index.es.js +4 -0
- package/package.json +2 -6
|
@@ -0,0 +1,199 @@
|
|
|
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 "../../chunks/Typography.module-93efb34d.js";
|
|
29
|
+
import { T as be } from "../../chunks/Text-b31d1e9a.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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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");require("../../chunks/Typography.module-2558416b.js");const D=require("../../chunks/Text-df483689.js");require("../Loader/index.cjs.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;
|
|
@@ -0,0 +1,129 @@
|
|
|
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 "../../chunks/Typography.module-93efb34d.js";
|
|
29
|
+
import { T as M } from "../../chunks/Text-b31d1e9a.js";
|
|
30
|
+
import "../Loader/index.es.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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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");require("../../chunks/Typography.module-2558416b.js");const K=require("polished");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;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var v = Object.getOwnPropertySymbols;
|
|
3
|
+
var F = Object.prototype.hasOwnProperty, h = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var y = (_, a, t) => a in _ ? V(_, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[a] = t, A = (_, a) => {
|
|
5
|
+
for (var t in a || (a = {}))
|
|
6
|
+
F.call(a, t) && y(_, t, a[t]);
|
|
7
|
+
if (v)
|
|
8
|
+
for (var t of v(a))
|
|
9
|
+
h.call(a, t) && y(_, t, a[t]);
|
|
10
|
+
return _;
|
|
11
|
+
};
|
|
12
|
+
var I = (_, a) => {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var r in _)
|
|
15
|
+
F.call(_, r) && a.indexOf(r) < 0 && (t[r] = _[r]);
|
|
16
|
+
if (_ != null && v)
|
|
17
|
+
for (var r of v(_))
|
|
18
|
+
a.indexOf(r) < 0 && h.call(_, r) && (t[r] = _[r]);
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import * as o from "react";
|
|
22
|
+
import { Person as G } from "@livechat/design-system-icons";
|
|
23
|
+
import u from "clsx";
|
|
24
|
+
import { Icon as K } from "../Icon/index.es.js";
|
|
25
|
+
import { H as R } from "../../chunks/Heading-6b95d08b.js";
|
|
26
|
+
import "../../chunks/Typography.module-93efb34d.js";
|
|
27
|
+
import { getContrast as W } from "polished";
|
|
28
|
+
const k = Array.from(
|
|
29
|
+
{ length: 10 },
|
|
30
|
+
(_, a) => `--surface-avatar-${a + 1}`
|
|
31
|
+
);
|
|
32
|
+
function X(_) {
|
|
33
|
+
if (!_)
|
|
34
|
+
return;
|
|
35
|
+
const a = _.split("").reduce((t, r) => t + r.charCodeAt(0), 0);
|
|
36
|
+
return `var(${k[a % k.length]})`;
|
|
37
|
+
}
|
|
38
|
+
function J(_ = "", a = 2) {
|
|
39
|
+
const t = _.trim().split(/\s+/), r = t.map((m) => [...m][0]);
|
|
40
|
+
if (a < 1)
|
|
41
|
+
return "";
|
|
42
|
+
if (t.length <= a)
|
|
43
|
+
return r.join("").toUpperCase();
|
|
44
|
+
const s = [r[0]];
|
|
45
|
+
for (let m = t.length - a + 1; m < t.length; m++)
|
|
46
|
+
s.push(r[m]);
|
|
47
|
+
return s.join("").toUpperCase();
|
|
48
|
+
}
|
|
49
|
+
function O(_) {
|
|
50
|
+
let a = _;
|
|
51
|
+
if (_.startsWith("var(--") && _.endsWith(")")) {
|
|
52
|
+
const t = _.slice(4, -1);
|
|
53
|
+
a = window.getComputedStyle(document.documentElement).getPropertyValue(t).trim();
|
|
54
|
+
}
|
|
55
|
+
return a && W(a, "#FFFFFF") > 3 ? "var(--color-white)" : "var(--color-black)";
|
|
56
|
+
}
|
|
57
|
+
const T = "lc-Avatar-module__avatar___1zTCE", j = "lc-Avatar-module__avatar__status___nX2Ls", Y = "lc-Avatar-module__avatar__rim___RCQ8Q", Z = "lc-Avatar-module__avatar__image___YqfqE", e = {
|
|
58
|
+
avatar: T,
|
|
59
|
+
avatar__status: j,
|
|
60
|
+
"avatar__status--available": "lc-Avatar-module__avatar__status--available___tcpFg",
|
|
61
|
+
"avatar__status--unavailable": "lc-Avatar-module__avatar__status--unavailable___ciauF",
|
|
62
|
+
"avatar__status--unknown": "lc-Avatar-module__avatar__status--unknown___MBaGB",
|
|
63
|
+
"avatar__status--xxxsmall": "lc-Avatar-module__avatar__status--xxxsmall___8pkEO",
|
|
64
|
+
"avatar__status--circle": "lc-Avatar-module__avatar__status--circle___doV5H",
|
|
65
|
+
"avatar__status--xxsmall": "lc-Avatar-module__avatar__status--xxsmall___M69lx",
|
|
66
|
+
"avatar__status--xsmall": "lc-Avatar-module__avatar__status--xsmall___RKQiI",
|
|
67
|
+
"avatar__status--small": "lc-Avatar-module__avatar__status--small___cVrA7",
|
|
68
|
+
"avatar__status--medium": "lc-Avatar-module__avatar__status--medium___n5z1H",
|
|
69
|
+
"avatar__status--large": "lc-Avatar-module__avatar__status--large___Lt-0p",
|
|
70
|
+
"avatar__status--xlarge": "lc-Avatar-module__avatar__status--xlarge___RWIcJ",
|
|
71
|
+
"avatar__status--xxlarge": "lc-Avatar-module__avatar__status--xxlarge___crG9D",
|
|
72
|
+
"avatar__status--xxxlarge": "lc-Avatar-module__avatar__status--xxxlarge___Iv61X",
|
|
73
|
+
"avatar__status--rounded-square": "lc-Avatar-module__avatar__status--rounded-square___-My1P",
|
|
74
|
+
avatar__rim: Y,
|
|
75
|
+
"avatar__rim--xxxsmall": "lc-Avatar-module__avatar__rim--xxxsmall___0CH9D",
|
|
76
|
+
"avatar__rim--xxsmall": "lc-Avatar-module__avatar__rim--xxsmall___Mde0K",
|
|
77
|
+
"avatar__rim--xsmall": "lc-Avatar-module__avatar__rim--xsmall___LAN-b",
|
|
78
|
+
"avatar__rim--small": "lc-Avatar-module__avatar__rim--small___FT8LX",
|
|
79
|
+
"avatar__rim--medium": "lc-Avatar-module__avatar__rim--medium___Dy0pr",
|
|
80
|
+
"avatar__rim--large": "lc-Avatar-module__avatar__rim--large___FPvGp",
|
|
81
|
+
"avatar__rim--xlarge": "lc-Avatar-module__avatar__rim--xlarge___CY0kN",
|
|
82
|
+
"avatar__rim--xxlarge": "lc-Avatar-module__avatar__rim--xxlarge___tE053",
|
|
83
|
+
"avatar__rim--xxxlarge": "lc-Avatar-module__avatar__rim--xxxlarge___amlGP",
|
|
84
|
+
avatar__image: Z,
|
|
85
|
+
"avatar__icon--xxxsmall": "lc-Avatar-module__avatar__icon--xxxsmall___KaoMa",
|
|
86
|
+
"avatar__icon--xxsmall": "lc-Avatar-module__avatar__icon--xxsmall___NJJNV",
|
|
87
|
+
"avatar__icon--xsmall": "lc-Avatar-module__avatar__icon--xsmall___yHEZK",
|
|
88
|
+
"avatar__icon--small": "lc-Avatar-module__avatar__icon--small___l6lBu",
|
|
89
|
+
"avatar__icon--medium": "lc-Avatar-module__avatar__icon--medium___LF4w2",
|
|
90
|
+
"avatar__icon--large": "lc-Avatar-module__avatar__icon--large___QntBf",
|
|
91
|
+
"avatar__icon--xlarge": "lc-Avatar-module__avatar__icon--xlarge___bcHbI",
|
|
92
|
+
"avatar__icon--xxlarge": "lc-Avatar-module__avatar__icon--xxlarge___sx8Fq",
|
|
93
|
+
"avatar__icon--xxxlarge": "lc-Avatar-module__avatar__icon--xxxlarge___4144S",
|
|
94
|
+
"avatar--circle": "lc-Avatar-module__avatar--circle___XwEz-",
|
|
95
|
+
"avatar--rounded-square": "lc-Avatar-module__avatar--rounded-square___m7-4I",
|
|
96
|
+
"avatar--xxxsmall": "lc-Avatar-module__avatar--xxxsmall___EHzpP",
|
|
97
|
+
"avatar--xxsmall": "lc-Avatar-module__avatar--xxsmall___EDOVp",
|
|
98
|
+
"avatar--xsmall": "lc-Avatar-module__avatar--xsmall___nI348",
|
|
99
|
+
"avatar--small": "lc-Avatar-module__avatar--small___UuQen",
|
|
100
|
+
"avatar--medium": "lc-Avatar-module__avatar--medium___Bt9Eo",
|
|
101
|
+
"avatar--large": "lc-Avatar-module__avatar--large___OU-08",
|
|
102
|
+
"avatar--xlarge": "lc-Avatar-module__avatar--xlarge___zwgeW",
|
|
103
|
+
"avatar--xxlarge": "lc-Avatar-module__avatar--xxlarge___Ur0ul",
|
|
104
|
+
"avatar--xxxlarge": "lc-Avatar-module__avatar--xxxlarge___Z-54U"
|
|
105
|
+
}, l = "avatar", ma = (z) => {
|
|
106
|
+
var $ = z, {
|
|
107
|
+
alt: _,
|
|
108
|
+
className: a,
|
|
109
|
+
color: t,
|
|
110
|
+
shape: r = "circle",
|
|
111
|
+
size: s = "medium",
|
|
112
|
+
src: m,
|
|
113
|
+
status: c,
|
|
114
|
+
text: p,
|
|
115
|
+
type: i,
|
|
116
|
+
withRim: f = !1
|
|
117
|
+
} = $, N = I($, [
|
|
118
|
+
"alt",
|
|
119
|
+
"className",
|
|
120
|
+
"color",
|
|
121
|
+
"shape",
|
|
122
|
+
"size",
|
|
123
|
+
"src",
|
|
124
|
+
"status",
|
|
125
|
+
"text",
|
|
126
|
+
"type",
|
|
127
|
+
"withRim"
|
|
128
|
+
]);
|
|
129
|
+
const n = i === "image" && !m, [C, E] = o.useState(n), S = i === "image" && !!m && !C, b = i === "text", w = ["xxxsmall", "xxsmall", "xsmall"].includes(s) ? 1 : 2, D = J(p, w), x = ["xxxsmall", "xxsmall", "xsmall", "small"].includes(s), d = t || X(p), H = d ? O(d) : void 0, q = b ? { backgroundColor: d } : {}, B = u(A({
|
|
130
|
+
[e[l]]: !0,
|
|
131
|
+
[e[`${l}--${r}`]]: !0,
|
|
132
|
+
[e[`${l}--${s}`]]: !0,
|
|
133
|
+
[e[`${l}--with-rim`]]: f
|
|
134
|
+
}, a ? { [`${a}`]: a } : {})), P = u(
|
|
135
|
+
e[`${l}__status`],
|
|
136
|
+
e[`${l}__status--${r}`],
|
|
137
|
+
e[`${l}__status--${s}`],
|
|
138
|
+
...c ? [e[`${l}__status--${c}`]] : []
|
|
139
|
+
), U = u(
|
|
140
|
+
e[`${l}__icon`],
|
|
141
|
+
e[`${l}__icon--${s}`]
|
|
142
|
+
), L = u(
|
|
143
|
+
e[`${l}__rim`],
|
|
144
|
+
e[`${l}__rim--${s}`]
|
|
145
|
+
), M = (g) => x ? "2xs" : ["medium"].includes(g) ? "xs" : ["large", "xlarge"].includes(g) ? "sm" : ["xxlarge"].includes(g) ? "lg" : "xl", Q = o.useCallback(() => E(!0), []);
|
|
146
|
+
return o.useEffect(() => {
|
|
147
|
+
E(n);
|
|
148
|
+
}, [n]), /* @__PURE__ */ o.createElement("div", A({ className: B, style: q }, N), f && /* @__PURE__ */ o.createElement(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
"data-testid": `${l}__rim`,
|
|
152
|
+
className: L
|
|
153
|
+
}
|
|
154
|
+
), c && /* @__PURE__ */ o.createElement(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
"data-testid": `${l}__status`,
|
|
158
|
+
className: P
|
|
159
|
+
}
|
|
160
|
+
), S && /* @__PURE__ */ o.createElement(
|
|
161
|
+
"img",
|
|
162
|
+
{
|
|
163
|
+
className: e[`${l}__image`],
|
|
164
|
+
src: m,
|
|
165
|
+
alt: _,
|
|
166
|
+
onError: Q
|
|
167
|
+
}
|
|
168
|
+
), b && /* @__PURE__ */ o.createElement(
|
|
169
|
+
R,
|
|
170
|
+
{
|
|
171
|
+
as: "span",
|
|
172
|
+
size: M(s),
|
|
173
|
+
style: { color: H },
|
|
174
|
+
bold: x,
|
|
175
|
+
uppercase: x
|
|
176
|
+
},
|
|
177
|
+
D
|
|
178
|
+
), C && /* @__PURE__ */ o.createElement(
|
|
179
|
+
K,
|
|
180
|
+
{
|
|
181
|
+
"data-testid": `${l}__icon`,
|
|
182
|
+
className: U,
|
|
183
|
+
source: G
|
|
184
|
+
}
|
|
185
|
+
));
|
|
186
|
+
};
|
|
187
|
+
export {
|
|
188
|
+
ma as Avatar,
|
|
189
|
+
X as generateAvatarColor
|
|
190
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var B=Object.defineProperty;var _=Object.getOwnPropertySymbols;var g=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var n=(e,a,t)=>a in e?B(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,s=(e,a)=>{for(var t in a||(a={}))g.call(a,t)&&n(e,t,a[t]);if(_)for(var t of _(a))l.call(a,t)&&n(e,t,a[t]);return e};var u=(e,a)=>{var t={};for(var d in e)g.call(e,d)&&a.indexOf(d)<0&&(t[d]=e[d]);if(e!=null&&_)for(var d of _(e))a.indexOf(d)<0&&l.call(e,d)&&(t[d]=e[d]);return t};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),$=require("clsx");function j(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const d=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,d.get?d:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const m=j(O);function N(e,a){return e>a?`${a}+`:`${e}`}const R="lc-Badge-module__badge___GhLnu",S="lc-Badge-module__badge__dot___z6RO6",c={badge:R,badge__dot:S,"badge--large":"lc-Badge-module__badge--large___B131q","badge--medium":"lc-Badge-module__badge--medium___TDU8a","badge--compact":"lc-Badge-module__badge--compact___9xJ4y","badge--primary":"lc-Badge-module__badge--primary___8LRpp","badge--secondary":"lc-Badge-module__badge--secondary___JjNIJ","badge--tertiary":"lc-Badge-module__badge--tertiary___e83wV"},o="badge",q=C=>{var r=C,{className:e,count:a=0,max:t=99,kind:d="primary",size:b="medium",type:i="counter"}=r,p=u(r,["className","count","max","kind","size","type"]);const y=$(e,c[o],c[`${o}--${d}`],c[`${o}--${b}`]),f={counter:N(a,t),alert:"!",dot:m.createElement("span",{className:c[`${o}__dot`]})}[i];return m.createElement("span",s({className:y},p),f)};exports.Badge=q;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var t = Object.getOwnPropertySymbols;
|
|
3
|
+
var m = Object.prototype.hasOwnProperty, l = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var r = (e, a, _) => a in e ? $(e, a, { enumerable: !0, configurable: !0, writable: !0, value: _ }) : e[a] = _, s = (e, a) => {
|
|
5
|
+
for (var _ in a || (a = {}))
|
|
6
|
+
m.call(a, _) && r(e, _, a[_]);
|
|
7
|
+
if (t)
|
|
8
|
+
for (var _ of t(a))
|
|
9
|
+
l.call(a, _) && r(e, _, a[_]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
var n = (e, a) => {
|
|
13
|
+
var _ = {};
|
|
14
|
+
for (var d in e)
|
|
15
|
+
m.call(e, d) && a.indexOf(d) < 0 && (_[d] = e[d]);
|
|
16
|
+
if (e != null && t)
|
|
17
|
+
for (var d of t(e))
|
|
18
|
+
a.indexOf(d) < 0 && l.call(e, d) && (_[d] = e[d]);
|
|
19
|
+
return _;
|
|
20
|
+
};
|
|
21
|
+
import * as b from "react";
|
|
22
|
+
import f from "clsx";
|
|
23
|
+
function N(e, a) {
|
|
24
|
+
return e > a ? `${a}+` : `${e}`;
|
|
25
|
+
}
|
|
26
|
+
const C = "lc-Badge-module__badge___GhLnu", J = "lc-Badge-module__badge__dot___z6RO6", o = {
|
|
27
|
+
badge: C,
|
|
28
|
+
badge__dot: J,
|
|
29
|
+
"badge--large": "lc-Badge-module__badge--large___B131q",
|
|
30
|
+
"badge--medium": "lc-Badge-module__badge--medium___TDU8a",
|
|
31
|
+
"badge--compact": "lc-Badge-module__badge--compact___9xJ4y",
|
|
32
|
+
"badge--primary": "lc-Badge-module__badge--primary___8LRpp",
|
|
33
|
+
"badge--secondary": "lc-Badge-module__badge--secondary___JjNIJ",
|
|
34
|
+
"badge--tertiary": "lc-Badge-module__badge--tertiary___e83wV"
|
|
35
|
+
}, g = "badge", L = (R) => {
|
|
36
|
+
var c = R, {
|
|
37
|
+
className: e,
|
|
38
|
+
count: a = 0,
|
|
39
|
+
max: _ = 99,
|
|
40
|
+
kind: d = "primary",
|
|
41
|
+
size: u = "medium",
|
|
42
|
+
type: p = "counter"
|
|
43
|
+
} = c, i = n(c, [
|
|
44
|
+
"className",
|
|
45
|
+
"count",
|
|
46
|
+
"max",
|
|
47
|
+
"kind",
|
|
48
|
+
"size",
|
|
49
|
+
"type"
|
|
50
|
+
]);
|
|
51
|
+
const B = f(
|
|
52
|
+
e,
|
|
53
|
+
o[g],
|
|
54
|
+
o[`${g}--${d}`],
|
|
55
|
+
o[`${g}--${u}`]
|
|
56
|
+
), y = {
|
|
57
|
+
counter: N(a, _),
|
|
58
|
+
alert: "!",
|
|
59
|
+
dot: /* @__PURE__ */ b.createElement("span", { className: o[`${g}__dot`] })
|
|
60
|
+
}[p];
|
|
61
|
+
return /* @__PURE__ */ b.createElement("span", s({ className: B }, i), y);
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
L as Badge
|
|
65
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var N=Object.defineProperty;var r=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var p=(t,_,n)=>_ in t?N(t,_,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[_]=n,a=(t,_)=>{for(var n in _||(_={}))y.call(_,n)&&p(t,n,_[n]);if(r)for(var n of r(_))v.call(_,n)&&p(t,n,_[n]);return t};var h=(t,_)=>{var n={};for(var e in t)y.call(t,e)&&_.indexOf(e)<0&&(n[e]=t[e]);if(t!=null&&r)for(var e of r(t))_.indexOf(e)<0&&v.call(t,e)&&(n[e]=t[e]);return n};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),$=require("clsx"),q=require("../Loader/index.cjs.js");require("../../chunks/Typography.module-2558416b.js");require("../../chunks/Text-df483689.js");function D(t){const _=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const e=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(_,n,e.get?e:{enumerable:!0,get:()=>t[n]})}}return _.default=t,Object.freeze(_)}const u=D(S),L=t=>{if(t==="primary"||t==="destructive")return{primaryColor:"var(--action-primary-default)",secondaryColor:"var(--border-invert-primary)"};if(t==="link-inverted")return{primaryColor:"var(--content-invert-primary)",secondaryColor:"var(--surface-invert-secondary)"}},Z="lc-Button-module__btn___aijZJ",A="lc-Button-module__btn__loader___c8zZz",J="lc-Button-module__btn__icon___GVExB",o={btn:Z,"btn--disabled":"lc-Button-module__btn--disabled___lXBav","btn--full-width":"lc-Button-module__btn--full-width___kdbAr","btn--xcompact":"lc-Button-module__btn--xcompact___s-zG-","btn--with-left-icon":"lc-Button-module__btn--with-left-icon___MOLWC","btn--with-right-icon":"lc-Button-module__btn--with-right-icon___R0Xum","btn--compact":"lc-Button-module__btn--compact___4eptQ","btn--medium":"lc-Button-module__btn--medium___wfUJA","btn--large":"lc-Button-module__btn--large___lb-z6","btn--basic":"lc-Button-module__btn--basic___Jc2gD","btn--primary":"lc-Button-module__btn--primary___ajbjQ","btn--secondary":"lc-Button-module__btn--secondary___iWzE0","btn--destructive":"lc-Button-module__btn--destructive___-kLCl","btn--destructive-outline":"lc-Button-module__btn--destructive-outline___dexc3","btn--text":"lc-Button-module__btn--text___WA8OL","btn--link":"lc-Button-module__btn--link___51ZgF","btn--link-light":"lc-Button-module__btn--link-light___iitZ6","btn--link-inverted":"lc-Button-module__btn--link-inverted___5zdGg","btn--plain":"lc-Button-module__btn--plain___eOPui","btn--float":"lc-Button-module__btn--float___J4lTs","btn--dotted":"lc-Button-module__btn--dotted___y1EEP","btn--high-contrast":"lc-Button-module__btn--high-contrast___zHSVM","btn--loading":"lc-Button-module__btn--loading___ZAgjv",btn__loader:A,btn__icon:J,"btn__icon--left":"lc-Button-module__btn__icon--left___H68zu","btn__icon--right":"lc-Button-module__btn__icon--right___fHr3D","btn--icon-only":"lc-Button-module__btn--icon-only___bF5pW","btn--icon-only--bg":"lc-Button-module__btn--icon-only--bg___X-4V2"},l="btn",M=u.forwardRef((P,j)=>{var f=P,{loading:t=!1,disabled:_=!1,type:n="button",fullWidth:e=!1,kind:b="basic",size:w="medium",icon:c=null,iconPosition:s="left",loaderLabel:x,className:z,children:m,href:B,onClick:C}=f,O=h(f,["loading","disabled","type","fullWidth","kind","size","icon","iconPosition","loaderLabel","className","children","href","onClick"]);const i=t||_,d=!m&&c,g=["text","link","link-light"].includes(b),k=B?"a":"button",E=$(z,o[l],o[`${l}--${b}`],o[`${l}--${w}`],{[o[`${l}--loading`]]:t,[o[`${l}--full-width`]]:e,[o[`${l}--with-${s}-icon`]]:c&&!d&&!g,[o[`${l}--icon-only`]]:d,[o[`${l}--icon-only--bg`]]:d&&g,[o[`${l}--disabled`]]:i});return u.createElement(k,a(a({ref:j,className:E,"aria-disabled":i,type:n,disabled:i},!i&&{href:B,onClick:C}),O),t&&u.createElement(q.Loader,a({size:"small",label:x,className:o[`${l}__loader`]},L(b))),c&&u.cloneElement(c,{className:$(c.props.className,o[`${l}__icon`],o[`${l}__icon--${s}`]),disabled:_}),u.createElement("div",{className:o[`${l}__content`]},m))});exports.Button=M;
|