@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 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var c=Object.getOwnPropertySymbols;var l=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var o=(e,n,t)=>n in e?p(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,i=(e,n)=>{for(var t in n||(n={}))l.call(n,t)&&o(e,t,n[t]);if(c)for(var t of c(n))u.call(n,t)&&o(e,t,n[t]);return e};var d=(e,n)=>{var t={};for(var r in e)l.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&c)for(var r of c(e))n.indexOf(r)<0&&u.call(e,r)&&(t[r]=e[r]);return t};const f=require("react"),y=require("clsx"),s=require("./Typography.module-2558416b.js");function b(e){const n=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(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const _=b(f),O={xl:"h1",lg:"h2",md:"h3",sm:"h4",xs:"h5","2xs":"h6"},E=j=>{var a=j,{as:e,size:n="md",children:t,className:r,uppercase:g,bold:h}=a,m=d(a,["as","size","children","className","uppercase","bold"]);return _.createElement(e||O[n],i({className:y({[s.styles[`heading-${n}`]]:!0,[s.styles["heading-uppercase"]]:g,[s.styles["heading-bold"]]:h},r)},m),t)};exports.Heading=E;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var t = Object.getOwnPropertySymbols;
|
|
3
|
+
var n = Object.prototype.hasOwnProperty, c = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var h = (e, s, a) => s in e ? x(e, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[s] = a, d = (e, s) => {
|
|
5
|
+
for (var a in s || (s = {}))
|
|
6
|
+
n.call(s, a) && h(e, a, s[a]);
|
|
7
|
+
if (t)
|
|
8
|
+
for (var a of t(s))
|
|
9
|
+
c.call(s, a) && h(e, a, s[a]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
var i = (e, s) => {
|
|
13
|
+
var a = {};
|
|
14
|
+
for (var r in e)
|
|
15
|
+
n.call(e, r) && s.indexOf(r) < 0 && (a[r] = e[r]);
|
|
16
|
+
if (e != null && t)
|
|
17
|
+
for (var r of t(e))
|
|
18
|
+
s.indexOf(r) < 0 && c.call(e, r) && (a[r] = e[r]);
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
import * as E from "react";
|
|
22
|
+
import f from "clsx";
|
|
23
|
+
import { s as m } from "./Typography.module-93efb34d.js";
|
|
24
|
+
const u = {
|
|
25
|
+
xl: "h1",
|
|
26
|
+
lg: "h2",
|
|
27
|
+
md: "h3",
|
|
28
|
+
sm: "h4",
|
|
29
|
+
xs: "h5",
|
|
30
|
+
"2xs": "h6"
|
|
31
|
+
}, T = (_) => {
|
|
32
|
+
var o = _, {
|
|
33
|
+
as: e,
|
|
34
|
+
size: s = "md",
|
|
35
|
+
children: a,
|
|
36
|
+
className: r,
|
|
37
|
+
uppercase: l,
|
|
38
|
+
bold: p
|
|
39
|
+
} = o, g = i(o, [
|
|
40
|
+
"as",
|
|
41
|
+
"size",
|
|
42
|
+
"children",
|
|
43
|
+
"className",
|
|
44
|
+
"uppercase",
|
|
45
|
+
"bold"
|
|
46
|
+
]);
|
|
47
|
+
return E.createElement(
|
|
48
|
+
e || u[s],
|
|
49
|
+
d({
|
|
50
|
+
className: f(
|
|
51
|
+
{
|
|
52
|
+
[m[`heading-${s}`]]: !0,
|
|
53
|
+
[m["heading-uppercase"]]: l,
|
|
54
|
+
[m["heading-bold"]]: p
|
|
55
|
+
},
|
|
56
|
+
r
|
|
57
|
+
)
|
|
58
|
+
}, g),
|
|
59
|
+
a
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
T as H
|
|
64
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var o = Object.getOwnPropertySymbols;
|
|
3
|
+
var p = Object.prototype.hasOwnProperty, c = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var m = (e, a, s) => a in e ? g(e, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[a] = s, i = (e, a) => {
|
|
5
|
+
for (var s in a || (a = {}))
|
|
6
|
+
p.call(a, s) && m(e, s, a[s]);
|
|
7
|
+
if (o)
|
|
8
|
+
for (var s of o(a))
|
|
9
|
+
c.call(a, s) && m(e, s, a[s]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
var n = (e, a) => {
|
|
13
|
+
var s = {};
|
|
14
|
+
for (var r in e)
|
|
15
|
+
p.call(e, r) && a.indexOf(r) < 0 && (s[r] = e[r]);
|
|
16
|
+
if (e != null && o)
|
|
17
|
+
for (var r of o(e))
|
|
18
|
+
a.indexOf(r) < 0 && c.call(e, r) && (s[r] = e[r]);
|
|
19
|
+
return s;
|
|
20
|
+
};
|
|
21
|
+
import * as h from "react";
|
|
22
|
+
import k from "clsx";
|
|
23
|
+
import { s as l } from "./Typography.module-93efb34d.js";
|
|
24
|
+
const P = (y) => {
|
|
25
|
+
var f = y, {
|
|
26
|
+
as: e = "p",
|
|
27
|
+
size: a = "md",
|
|
28
|
+
caps: s = !1,
|
|
29
|
+
uppercase: r = !1,
|
|
30
|
+
bold: $ = !1,
|
|
31
|
+
underline: u = !1,
|
|
32
|
+
strike: x = !1,
|
|
33
|
+
children: d,
|
|
34
|
+
className: b
|
|
35
|
+
} = f, T = n(f, [
|
|
36
|
+
"as",
|
|
37
|
+
"size",
|
|
38
|
+
"caps",
|
|
39
|
+
"uppercase",
|
|
40
|
+
"bold",
|
|
41
|
+
"underline",
|
|
42
|
+
"strike",
|
|
43
|
+
"children",
|
|
44
|
+
"className"
|
|
45
|
+
]);
|
|
46
|
+
const t = "paragraph";
|
|
47
|
+
return h.createElement(
|
|
48
|
+
e,
|
|
49
|
+
i({
|
|
50
|
+
className: k(
|
|
51
|
+
{
|
|
52
|
+
[l[`${t}-${a}`]]: !0,
|
|
53
|
+
[l[`${t}--bold`]]: $,
|
|
54
|
+
[l[`${t}--strike`]]: x,
|
|
55
|
+
[l[`${t}--underline`]]: u,
|
|
56
|
+
[l[`${t}--uppercase`]]: r || s
|
|
57
|
+
},
|
|
58
|
+
b
|
|
59
|
+
)
|
|
60
|
+
}, T),
|
|
61
|
+
d
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
P as T
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var O=Object.defineProperty;var l=Object.getOwnPropertySymbols;var u=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable;var o=(e,s,t)=>s in e?O(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,i=(e,s)=>{for(var t in s||(s={}))u.call(s,t)&&o(e,t,s[t]);if(l)for(var t of l(s))f.call(s,t)&&o(e,t,s[t]);return e};var p=(e,s)=>{var t={};for(var r in e)u.call(e,r)&&s.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&l)for(var r of l(e))s.indexOf(r)<0&&f.call(e,r)&&(t[r]=e[r]);return t};const j=require("react"),x=require("clsx"),c=require("./Typography.module-2558416b.js");function T(e){const s=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(s,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return s.default=e,Object.freeze(s)}const _=T(j),q=P=>{var n=P,{as:e="p",size:s="md",caps:t=!1,uppercase:r=!1,bold:y=!1,underline:d=!1,strike:b=!1,children:m,className:g}=n,$=p(n,["as","size","caps","uppercase","bold","underline","strike","children","className"]);const a="paragraph";return _.createElement(e,i({className:x({[c.styles[`${a}-${s}`]]:!0,[c.styles[`${a}--bold`]]:y,[c.styles[`${a}--strike`]]:b,[c.styles[`${a}--underline`]]:d,[c.styles[`${a}--uppercase`]]:r||t},g)},$),m)};exports.Text=q;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var ao = Object.defineProperty, co = Object.defineProperties;
|
|
2
|
+
var uo = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var P = Object.getOwnPropertySymbols;
|
|
4
|
+
var mo = Object.prototype.hasOwnProperty, fo = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var S = (t, o, e) => o in t ? ao(t, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[o] = e, r = (t, o) => {
|
|
6
|
+
for (var e in o || (o = {}))
|
|
7
|
+
mo.call(o, e) && S(t, e, o[e]);
|
|
8
|
+
if (P)
|
|
9
|
+
for (var e of P(o))
|
|
10
|
+
fo.call(o, e) && S(t, e, o[e]);
|
|
11
|
+
return t;
|
|
12
|
+
}, f = (t, o) => co(t, uo(o));
|
|
13
|
+
import * as i from "react";
|
|
14
|
+
import { useFloating as To, offset as go, shift as yo, flip as vo, arrow as ho, autoUpdate as wo, useHover as xo, safePolygon as Po, useFocus as So, useDismiss as bo, useRole as Fo, useClick as Eo, useTransitionStyles as Mo, useTransitionStatus as Ro, useInteractions as Ao } from "@floating-ui/react";
|
|
15
|
+
import Vo from "clsx";
|
|
16
|
+
import "./Typography.module-93efb34d.js";
|
|
17
|
+
import { T as Do } from "./Text-b31d1e9a.js";
|
|
18
|
+
function Wo(t) {
|
|
19
|
+
switch (t) {
|
|
20
|
+
case "invert":
|
|
21
|
+
return "inverted";
|
|
22
|
+
default:
|
|
23
|
+
return "primary";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function Io(t, o, e, _) {
|
|
27
|
+
if (e)
|
|
28
|
+
return {
|
|
29
|
+
top: t ? e + t : e
|
|
30
|
+
};
|
|
31
|
+
if (_)
|
|
32
|
+
return {
|
|
33
|
+
left: o ? _ + o : _
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const Qo = "lc-Tooltip-module__tooltip___QOOAr", jo = "lc-Tooltip-module__tooltip__arrow___Ov1YW", No = "lc-Tooltip-module__tooltip__interactive___0JawB", n = {
|
|
37
|
+
tooltip: Qo,
|
|
38
|
+
tooltip__arrow: jo,
|
|
39
|
+
"tooltip--invert": "lc-Tooltip-module__tooltip--invert___PVjhE",
|
|
40
|
+
"tooltip--important": "lc-Tooltip-module__tooltip--important___X-IMK",
|
|
41
|
+
tooltip__interactive: No,
|
|
42
|
+
"tooltip__user-guide-step": "lc-Tooltip-module__tooltip__user-guide-step___evexI",
|
|
43
|
+
"tooltip--full-space": "lc-Tooltip-module__tooltip--full-space___wmbaw",
|
|
44
|
+
"tooltip-header": "lc-Tooltip-module__tooltip-header___QV0Vd",
|
|
45
|
+
"tooltip-header--info": "lc-Tooltip-module__tooltip-header--info___zLJ2Z",
|
|
46
|
+
"tooltip-image-container": "lc-Tooltip-module__tooltip-image-container___ySmcd",
|
|
47
|
+
"tooltip-image": "lc-Tooltip-module__tooltip-image___Aorwg",
|
|
48
|
+
"tooltip-text--info": "lc-Tooltip-module__tooltip-text--info___3d2Ql",
|
|
49
|
+
"tooltip-close": "lc-Tooltip-module__tooltip-close___3r3h9",
|
|
50
|
+
"tooltip-step": "lc-Tooltip-module__tooltip-step___-j0n8",
|
|
51
|
+
"tooltip-footer": "lc-Tooltip-module__tooltip-footer___9hxFq",
|
|
52
|
+
"tooltip-footer-secondary": "lc-Tooltip-module__tooltip-footer-secondary___WBgVR",
|
|
53
|
+
"tooltip-footer-secondary-invert": "lc-Tooltip-module__tooltip-footer-secondary-invert___PuAQL",
|
|
54
|
+
"tooltip-footer--interactive": "lc-Tooltip-module__tooltip-footer--interactive___hqMM5",
|
|
55
|
+
"tooltip-footer--user-guide-step": "lc-Tooltip-module__tooltip-footer--user-guide-step___i7z3S",
|
|
56
|
+
"guide-tooltip--slide": "lc-Tooltip-module__guide-tooltip--slide___Uawm2",
|
|
57
|
+
"guide-tooltip__overlay": "lc-Tooltip-module__guide-tooltip__overlay___IyrKK",
|
|
58
|
+
"guide-tooltip__overlay--slide": "lc-Tooltip-module__guide-tooltip__overlay--slide___VW8oq",
|
|
59
|
+
"guide-tooltip__overlay--visible": "lc-Tooltip-module__guide-tooltip__overlay--visible___dbdsZ",
|
|
60
|
+
"reports-tooltip": "lc-Tooltip-module__reports-tooltip___amyTo",
|
|
61
|
+
"reports-tooltip__heading": "lc-Tooltip-module__reports-tooltip__heading___FtjvD",
|
|
62
|
+
"reports-tooltip__heading__title": "lc-Tooltip-module__reports-tooltip__heading__title___6TlzE",
|
|
63
|
+
"reports-tooltip__heading__description": "lc-Tooltip-module__reports-tooltip__heading__description___eOQnc",
|
|
64
|
+
"reports-tooltip__content": "lc-Tooltip-module__reports-tooltip__content___jxis9"
|
|
65
|
+
}, a = "tooltip", ko = ({
|
|
66
|
+
children: t,
|
|
67
|
+
className: o,
|
|
68
|
+
triggerClassName: e,
|
|
69
|
+
triggerRenderer: _,
|
|
70
|
+
theme: c,
|
|
71
|
+
kind: b,
|
|
72
|
+
placement: F = "bottom",
|
|
73
|
+
isVisible: T,
|
|
74
|
+
fullSpaceContent: E,
|
|
75
|
+
onClose: d,
|
|
76
|
+
onOpen: u,
|
|
77
|
+
withFadeAnimation: M = !0,
|
|
78
|
+
transitionDuration: R = 200,
|
|
79
|
+
hoverOnDuration: A,
|
|
80
|
+
hoverOffDuration: V,
|
|
81
|
+
transitionDelay: D = 0,
|
|
82
|
+
hoverOnDelay: I,
|
|
83
|
+
hoverOffDelay: Q,
|
|
84
|
+
triggerOnClick: j = !1,
|
|
85
|
+
offsetMainAxis: N = 8,
|
|
86
|
+
referenceElement: m,
|
|
87
|
+
activationThreshold: $ = 0,
|
|
88
|
+
useDismissHookProps: q,
|
|
89
|
+
useClickHookProps: z,
|
|
90
|
+
hoverOutDelayTimeout: C = 100,
|
|
91
|
+
arrowOffsetY: K,
|
|
92
|
+
arrowOffsetX: W,
|
|
93
|
+
closeOnTriggerBlur: k = !1,
|
|
94
|
+
floatingStrategy: B
|
|
95
|
+
}) => {
|
|
96
|
+
const g = T !== void 0, [J, L] = i.useState(!1), y = i.useRef(null), v = g ? T : J, h = b || c, U = Vo(
|
|
97
|
+
n[a],
|
|
98
|
+
o,
|
|
99
|
+
h && n[`${a}--${h}`],
|
|
100
|
+
E && n[`${a}--full-space`]
|
|
101
|
+
), Z = typeof _ == "function", H = (l) => {
|
|
102
|
+
l !== v && (l ? u == null || u() : d == null || d(), !g && L(l));
|
|
103
|
+
}, w = (l) => M ? l != null ? l : R : 0, x = (l) => l != null ? l : D, {
|
|
104
|
+
floatingStyles: X,
|
|
105
|
+
refs: p,
|
|
106
|
+
context: s,
|
|
107
|
+
middlewareData: { arrow: { x: Y, y: G } = {} },
|
|
108
|
+
placement: O
|
|
109
|
+
} = To({
|
|
110
|
+
middleware: [
|
|
111
|
+
go({ mainAxis: N }),
|
|
112
|
+
yo(),
|
|
113
|
+
vo(),
|
|
114
|
+
ho({ element: y })
|
|
115
|
+
],
|
|
116
|
+
placement: F,
|
|
117
|
+
open: v,
|
|
118
|
+
strategy: B,
|
|
119
|
+
onOpenChange: H,
|
|
120
|
+
whileElementsMounted: wo
|
|
121
|
+
}), oo = xo(s, {
|
|
122
|
+
move: !1,
|
|
123
|
+
restMs: $,
|
|
124
|
+
delay: {
|
|
125
|
+
open: x(I),
|
|
126
|
+
close: x(Q || C)
|
|
127
|
+
},
|
|
128
|
+
enabled: !j,
|
|
129
|
+
handleClose: k ? null : Po()
|
|
130
|
+
}), to = So(s), eo = bo(s, q), lo = Fo(s, { role: "tooltip" }), io = Eo(s, z), { isMounted: _o, styles: so } = Mo(s, {
|
|
131
|
+
duration: {
|
|
132
|
+
open: w(A),
|
|
133
|
+
close: w(V)
|
|
134
|
+
}
|
|
135
|
+
}), { status: ro } = Ro(s), { getReferenceProps: po, getFloatingProps: no } = Ao([
|
|
136
|
+
oo,
|
|
137
|
+
to,
|
|
138
|
+
eo,
|
|
139
|
+
lo,
|
|
140
|
+
io
|
|
141
|
+
]);
|
|
142
|
+
return i.useEffect(() => {
|
|
143
|
+
m && p.setReference(m);
|
|
144
|
+
}, [p.setReference, m]), /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
145
|
+
"div",
|
|
146
|
+
f(r({
|
|
147
|
+
ref: p.setReference
|
|
148
|
+
}, po()), {
|
|
149
|
+
className: e
|
|
150
|
+
}),
|
|
151
|
+
Z ? _() : _
|
|
152
|
+
), _o && /* @__PURE__ */ i.createElement(
|
|
153
|
+
"div",
|
|
154
|
+
f(r({
|
|
155
|
+
ref: p.setFloating,
|
|
156
|
+
style: r(r({}, X), so),
|
|
157
|
+
className: U
|
|
158
|
+
}, no()), {
|
|
159
|
+
"data-status": ro
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ i.createElement(Do, { as: "div" }, t),
|
|
162
|
+
/* @__PURE__ */ i.createElement(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
ref: y,
|
|
166
|
+
className: n[`${a}__arrow`],
|
|
167
|
+
"aria-placement": O,
|
|
168
|
+
style: r({}, Io(
|
|
169
|
+
K,
|
|
170
|
+
W,
|
|
171
|
+
G,
|
|
172
|
+
Y
|
|
173
|
+
))
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
));
|
|
177
|
+
};
|
|
178
|
+
export {
|
|
179
|
+
ko as T,
|
|
180
|
+
Wo as g,
|
|
181
|
+
n as s
|
|
182
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var at=Object.defineProperty,ut=Object.defineProperties;var dt=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var x=(t,o,e)=>o in t?at(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,n=(t,o)=>{for(var e in o||(o={}))mt.call(o,e)&&x(t,e,o[e]);if(S)for(var e of S(o))ft.call(o,e)&&x(t,e,o[e]);return t},g=(t,o)=>ut(t,dt(o));const gt=require("react"),l=require("@floating-ui/react"),Tt=require("clsx");require("./Typography.module-2558416b.js");const yt=require("./Text-df483689.js");function vt(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const _=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(o,e,_.get?_:{enumerable:!0,get:()=>t[e]})}}return o.default=t,Object.freeze(o)}const s=vt(gt);function ht(t){switch(t){case"invert":return"inverted";default:return"primary"}}function wt(t,o,e,_){if(e)return{top:t?e+t:e};if(_)return{left:o?_+o:_}}const bt="lc-Tooltip-module__tooltip___QOOAr",Pt="lc-Tooltip-module__tooltip__arrow___Ov1YW",St="lc-Tooltip-module__tooltip__interactive___0JawB",c={tooltip:bt,tooltip__arrow:Pt,"tooltip--invert":"lc-Tooltip-module__tooltip--invert___PVjhE","tooltip--important":"lc-Tooltip-module__tooltip--important___X-IMK",tooltip__interactive:St,"tooltip__user-guide-step":"lc-Tooltip-module__tooltip__user-guide-step___evexI","tooltip--full-space":"lc-Tooltip-module__tooltip--full-space___wmbaw","tooltip-header":"lc-Tooltip-module__tooltip-header___QV0Vd","tooltip-header--info":"lc-Tooltip-module__tooltip-header--info___zLJ2Z","tooltip-image-container":"lc-Tooltip-module__tooltip-image-container___ySmcd","tooltip-image":"lc-Tooltip-module__tooltip-image___Aorwg","tooltip-text--info":"lc-Tooltip-module__tooltip-text--info___3d2Ql","tooltip-close":"lc-Tooltip-module__tooltip-close___3r3h9","tooltip-step":"lc-Tooltip-module__tooltip-step___-j0n8","tooltip-footer":"lc-Tooltip-module__tooltip-footer___9hxFq","tooltip-footer-secondary":"lc-Tooltip-module__tooltip-footer-secondary___WBgVR","tooltip-footer-secondary-invert":"lc-Tooltip-module__tooltip-footer-secondary-invert___PuAQL","tooltip-footer--interactive":"lc-Tooltip-module__tooltip-footer--interactive___hqMM5","tooltip-footer--user-guide-step":"lc-Tooltip-module__tooltip-footer--user-guide-step___i7z3S","guide-tooltip--slide":"lc-Tooltip-module__guide-tooltip--slide___Uawm2","guide-tooltip__overlay":"lc-Tooltip-module__guide-tooltip__overlay___IyrKK","guide-tooltip__overlay--slide":"lc-Tooltip-module__guide-tooltip__overlay--slide___VW8oq","guide-tooltip__overlay--visible":"lc-Tooltip-module__guide-tooltip__overlay--visible___dbdsZ","reports-tooltip":"lc-Tooltip-module__reports-tooltip___amyTo","reports-tooltip__heading":"lc-Tooltip-module__reports-tooltip__heading___FtjvD","reports-tooltip__heading__title":"lc-Tooltip-module__reports-tooltip__heading__title___6TlzE","reports-tooltip__heading__description":"lc-Tooltip-module__reports-tooltip__heading__description___eOQnc","reports-tooltip__content":"lc-Tooltip-module__reports-tooltip__content___jxis9"},a="tooltip",xt=({children:t,className:o,triggerClassName:e,triggerRenderer:_,theme:u,kind:j,placement:q="bottom",isVisible:T,fullSpaceContent:F,onClose:d,onOpen:m,withFadeAnimation:M=!0,transitionDuration:R=200,hoverOnDuration:D,hoverOffDuration:E,transitionDelay:A=0,hoverOnDelay:I,hoverOffDelay:V,triggerOnClick:N=!1,offsetMainAxis:Q=8,referenceElement:f,activationThreshold:z=0,useDismissHookProps:$,useClickHookProps:k,hoverOutDelayTimeout:C=100,arrowOffsetY:K,arrowOffsetX:W,closeOnTriggerBlur:B=!1,floatingStrategy:J})=>{const y=T!==void 0,[L,O]=s.useState(!1),v=s.useRef(null),h=y?T:L,w=j||u,U=Tt(c[a],o,w&&c[`${a}--${w}`],F&&c[`${a}--full-space`]),Z=typeof _=="function",H=i=>{i!==h&&(i?m==null||m():d==null||d(),!y&&O(i))},b=i=>M?i!=null?i:R:0,P=i=>i!=null?i:A,{floatingStyles:X,refs:p,context:r,middlewareData:{arrow:{x:Y,y:G}={}},placement:tt}=l.useFloating({middleware:[l.offset({mainAxis:Q}),l.shift(),l.flip(),l.arrow({element:v})],placement:q,open:h,strategy:J,onOpenChange:H,whileElementsMounted:l.autoUpdate}),ot=l.useHover(r,{move:!1,restMs:z,delay:{open:P(I),close:P(V||C)},enabled:!N,handleClose:B?null:l.safePolygon()}),et=l.useFocus(r),lt=l.useDismiss(r,$),it=l.useRole(r,{role:"tooltip"}),_t=l.useClick(r,k),{isMounted:st,styles:rt}=l.useTransitionStyles(r,{duration:{open:b(D),close:b(E)}}),{status:nt}=l.useTransitionStatus(r),{getReferenceProps:ct,getFloatingProps:pt}=l.useInteractions([ot,et,lt,it,_t]);return s.useEffect(()=>{f&&p.setReference(f)},[p.setReference,f]),s.createElement(s.Fragment,null,s.createElement("div",g(n({ref:p.setReference},ct()),{className:e}),Z?_():_),st&&s.createElement("div",g(n({ref:p.setFloating,style:n(n({},X),rt),className:U},pt()),{"data-status":nt}),s.createElement(yt.Text,{as:"div"},t),s.createElement("div",{ref:v,className:c[`${a}__arrow`],"aria-placement":tt,style:n({},wt(K,W,G,Y))})))};exports.Tooltip=xt;exports.getIconType=ht;exports.styles=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const _={"heading-xl":"lc-Typography-module__heading-xl___nhr-6","heading-lg":"lc-Typography-module__heading-lg___XYF7l","heading-md":"lc-Typography-module__heading-md___wHOIs","heading-sm":"lc-Typography-module__heading-sm___nBmTV","heading-xs":"lc-Typography-module__heading-xs___VcZBs","heading-2xs":"lc-Typography-module__heading-2xs___tcrVl","heading-uppercase":"lc-Typography-module__heading-uppercase___cpixD","heading-bold":"lc-Typography-module__heading-bold___ZAPzP","paragraph-md":"lc-Typography-module__paragraph-md___UGoqq","paragraph-sm":"lc-Typography-module__paragraph-sm___QIEFL","paragraph-xs":"lc-Typography-module__paragraph-xs___OUooD","paragraph--bold":"lc-Typography-module__paragraph--bold___9I2wL","paragraph--underline":"lc-Typography-module__paragraph--underline___yFDzp","paragraph--strike":"lc-Typography-module__paragraph--strike___ZDWOj","paragraph--uppercase":"lc-Typography-module__paragraph--uppercase___hdEfX","display-md":"lc-Typography-module__display-md___7eFCF","display-sm":"lc-Typography-module__display-sm___kfNES","display-max":"lc-Typography-module__display-max___vR8yn"};exports.styles=_;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const _ = {
|
|
2
|
+
"heading-xl": "lc-Typography-module__heading-xl___nhr-6",
|
|
3
|
+
"heading-lg": "lc-Typography-module__heading-lg___XYF7l",
|
|
4
|
+
"heading-md": "lc-Typography-module__heading-md___wHOIs",
|
|
5
|
+
"heading-sm": "lc-Typography-module__heading-sm___nBmTV",
|
|
6
|
+
"heading-xs": "lc-Typography-module__heading-xs___VcZBs",
|
|
7
|
+
"heading-2xs": "lc-Typography-module__heading-2xs___tcrVl",
|
|
8
|
+
"heading-uppercase": "lc-Typography-module__heading-uppercase___cpixD",
|
|
9
|
+
"heading-bold": "lc-Typography-module__heading-bold___ZAPzP",
|
|
10
|
+
"paragraph-md": "lc-Typography-module__paragraph-md___UGoqq",
|
|
11
|
+
"paragraph-sm": "lc-Typography-module__paragraph-sm___QIEFL",
|
|
12
|
+
"paragraph-xs": "lc-Typography-module__paragraph-xs___OUooD",
|
|
13
|
+
"paragraph--bold": "lc-Typography-module__paragraph--bold___9I2wL",
|
|
14
|
+
"paragraph--underline": "lc-Typography-module__paragraph--underline___yFDzp",
|
|
15
|
+
"paragraph--strike": "lc-Typography-module__paragraph--strike___ZDWOj",
|
|
16
|
+
"paragraph--uppercase": "lc-Typography-module__paragraph--uppercase___hdEfX",
|
|
17
|
+
"display-md": "lc-Typography-module__display-md___7eFCF",
|
|
18
|
+
"display-sm": "lc-Typography-module__display-sm___kfNES",
|
|
19
|
+
"display-max": "lc-Typography-module__display-max___vR8yn"
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
_ as s
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e={esc:"Escape",enter:"Enter",backspace:"Backspace",delete:"Delete",spacebar:" ",tab:"Tab",semicolon:";",comma:",",arrowUp:"ArrowUp",arrowDown:"ArrowDown"};exports.KeyCodes=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var M=Object.defineProperty;var y=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var B=(e,t,n)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||(t={}))O.call(t,n)&&B(e,n,t[n]);if(y)for(var n of y(t))S.call(t,n)&&B(e,n,t[n]);return e};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),h=require("@livechat/design-system-icons"),b=require("clsx"),E=require("../ActionMenu/index.cjs.js"),A=require("../Button/index.cjs.js"),P=require("../Icon/index.cjs.js"),T=require("../../chunks/Tooltip-f9f79274.js");require("../../chunks/Typography.module-2558416b.js");require("@floating-ui/react");require("../../chunks/keyCodes-c4c35e49.js");require("../../chunks/Text-df483689.js");require("../Loader/index.cjs.js");function j(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const r=j(x),_={"action-bar":"lc-ActionBar-module__action-bar___TJitF","action-bar__items":"lc-ActionBar-module__action-bar__items___uhoQA","action-bar__items--scroll":"lc-ActionBar-module__action-bar__items--scroll___f--dN","action-bar__items__button":"lc-ActionBar-module__action-bar__items__button___Vdjl7","action-bar__items__button--active":"lc-ActionBar-module__action-bar__items__button--active___PFLdm","action-bar__items__button--hidden":"lc-ActionBar-module__action-bar__items__button--hidden___C00VA","action-bar__items__tooltip":"lc-ActionBar-module__action-bar__items__tooltip___BuQPo","action-bar__menu-wrapper":"lc-ActionBar-module__action-bar__menu-wrapper___OMWP5","action-bar__menu-wrapper__button":"lc-ActionBar-module__action-bar__menu-wrapper__button___MDsLx","action-bar__menu-wrapper__button__with-item":"lc-ActionBar-module__action-bar__menu-wrapper__button__with-item___FYlqL","fade-in":"lc-ActionBar-module__fade-in___tQvzD","action-bar__menu-wrapper__button--active":"lc-ActionBar-module__action-bar__menu-wrapper__button--active___Hlzoc","action-bar__menu-wrapper__trigger-vertical":"lc-ActionBar-module__action-bar__menu-wrapper__trigger-vertical___84WL1","action-bar--vertical":"lc-ActionBar-module__action-bar--vertical___tMzLJ"},g="action-bar__items",D=({option:e,menuItemsKeys:t,activeOptionKey:n,vertical:o})=>{const d=b(_[`${g}__button`],{[_[`${g}__button--hidden`]]:t.includes(e.key),[_[`${g}__button--active`]]:e.key===n});if(e.showTooltip){const l=t.includes(e.key)&&{isVisible:!1};return r.createElement(T.Tooltip,w({kind:"invert",placement:o?"left":"bottom",triggerClassName:_[`${g}__tooltip`],triggerRenderer:()=>r.createElement(A.Button,{id:e.key,key:e.key,title:e.label,kind:"plain",className:d,onClick:e.onClick,icon:e.element})},l),r.createElement("div",null,e.label))}return r.createElement(A.Button,{id:e.key,key:e.key,title:e.label,kind:"plain",className:d,onClick:e.onClick,icon:e.element})},m="action-bar",L=({className:e,id:t="action-bar-area",type:n="menu",options:o,activeOptionKey:d,vertical:l})=>{const[s,v]=r.useState([]),f=n==="scroll",C=b(_[m],e,l&&_[`${m}--vertical`]),p=`${m}__menu-wrapper`,$={root:document.querySelector(`${t}`),threshold:1},q=!f&&s.length!==0,N=a=>{a.map(c=>{const i=s.includes(c.target.id);if(!c.isIntersecting){c.target.setAttribute("tabindex","-1"),i||v(u=>[...u,c.target.id]);return}c.target.removeAttribute("tabindex"),i&&v(s.filter(u=>u!==c.target.id))})};r.useEffect(()=>{const a=!!window.IntersectionObserver;if(!f&&a){const c=document.querySelectorAll(`.${_[`${m}__items__button`]}`),i=new IntersectionObserver(N,$);return c.forEach(u=>i.observe(u)),()=>i.disconnect()}},[s,f]);const I=a=>o.filter(i=>a.find(u=>u===i.key)).map(i=>({key:i.key,element:r.createElement(E.ActionMenuItem,{leftNode:i.element},i.label),onClick:i.onClick})),k=o.filter(a=>s.find(c=>c===a.key)).find(a=>a.key===d);return r.createElement("div",{id:t,className:C},r.createElement("div",{className:b(_[`${m}__items`],{[_[`${m}__items--scroll`]]:f})},o.map(a=>r.createElement(D,{option:a,menuItemsKeys:s,activeOptionKey:d,vertical:l}))),q&&r.createElement("div",{className:_[p]},r.createElement(E.ActionMenu,{placement:l?"left-end":"bottom-end",options:I(s),triggerClassName:b(l&&_[`${p}__trigger-vertical`]),triggerRenderer:r.createElement(A.Button,{className:b(_[`${p}__button`],k&&_[`${p}__button--active`]),kind:"plain",icon:r.createElement(P.Icon,{source:l?h.ChevronLeft:h.ChevronDown,kind:"primary"}),iconPosition:"right"},k&&r.createElement("div",{className:b(_[`${p}__button__with-item`])},k.element))})))};exports.ActionBar=L;
|
|
@@ -0,0 +1,192 @@
|
|
|
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-1c5cb6fe.js";
|
|
19
|
+
import "../../chunks/Typography.module-93efb34d.js";
|
|
20
|
+
import "@floating-ui/react";
|
|
21
|
+
import "../../chunks/keyCodes-30323e90.js";
|
|
22
|
+
import "../../chunks/Text-b31d1e9a.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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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");require("../../chunks/Typography.module-2558416b.js");const oe=require("../../chunks/Text-df483689.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;
|