@livechat/design-system-react-components 1.16.9 → 1.17.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/ProgressBar.css +1 -0
- package/dist/Tooltip.css +1 -0
- package/dist/Typography.css +1 -0
- package/dist/chunks/Heading-1f13e793.js +1 -0
- package/dist/chunks/Heading-a4742030.js +64 -0
- package/dist/chunks/ProgressBar-753197bf.js +89 -0
- package/dist/chunks/ProgressBar-ab20b908.js +1 -0
- package/dist/chunks/Text-2356ec2a.js +1 -0
- package/dist/chunks/Text-3504b7ce.js +66 -0
- package/dist/chunks/Tooltip-2c65102c.js +1 -0
- package/dist/chunks/Tooltip-e472934d.js +182 -0
- package/dist/chunks/Typography.module-7abc3bc2.js +1 -0
- package/dist/chunks/Typography.module-be5c667f.js +24 -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 +188 -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 +128 -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 +66 -0
- package/dist/components/Button/index.cjs.js +1 -0
- package/dist/components/Button/index.es.js +142 -0
- package/dist/components/Card/index.cjs.js +1 -0
- package/dist/components/Card/index.es.js +95 -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 +517 -0
- package/dist/components/DetailsCard/index.cjs.js +1 -0
- package/dist/components/DetailsCard/index.es.js +138 -0
- package/dist/components/DetailsCardInfo/index.cjs.js +1 -0
- package/dist/components/DetailsCardInfo/index.es.js +13 -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 +55 -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 +114 -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 +104 -0
- package/dist/components/Input/index.cjs.js +1 -0
- package/dist/components/Input/index.es.js +122 -0
- package/dist/components/Link/index.cjs.js +1 -0
- package/dist/components/Link/index.es.js +48 -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 +248 -0
- package/dist/components/NumericInput/index.cjs.js +1 -0
- package/dist/components/NumericInput/index.es.js +140 -0
- package/dist/components/Picker/index.cjs.js +1 -0
- package/dist/components/Picker/index.es.js +738 -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.d.ts +1 -0
- package/dist/components/Progress/index.es.js +105 -0
- package/dist/components/PromoBanner/index.cjs.js +1 -0
- package/dist/components/PromoBanner/index.es.js +73 -0
- package/dist/components/PromoBannerV2/index.cjs.js +1 -0
- package/dist/components/PromoBannerV2/index.es.js +77 -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 +53 -0
- package/dist/components/Switch/index.cjs.js +1 -0
- package/dist/components/Switch/index.es.js +144 -0
- package/dist/components/Tab/Tab.d.ts +1 -1
- 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 +241 -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 +162 -0
- package/dist/components/Tooltip/components/UserGuide/index.cjs.js +1 -0
- package/dist/components/Tooltip/components/UserGuide/index.es.js +193 -0
- package/dist/components/Tooltip/components/index.cjs.js +1 -0
- package/dist/components/Tooltip/components/index.es.js +114 -0
- package/dist/components/Tooltip/index.cjs.js +1 -0
- package/dist/components/Tooltip/index.es.js +11 -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.d.ts +5 -0
- package/dist/foundations/index.es.js +353 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -7
- package/dist/index.es.js +123 -0
- package/dist/index10.css +1 -0
- package/dist/index11.css +1 -0
- package/dist/index12.css +1 -0
- package/dist/index13.css +1 -0
- package/dist/index14.css +1 -0
- package/dist/index15.css +1 -0
- package/dist/index16.css +1 -0
- package/dist/index17.css +1 -0
- package/dist/index18.css +1 -0
- package/dist/index19.css +1 -0
- package/dist/index2.css +1 -0
- package/dist/index20.css +1 -0
- package/dist/index21.css +1 -0
- package/dist/index22.css +1 -0
- package/dist/index23.css +1 -0
- package/dist/index24.css +1 -0
- package/dist/index25.css +1 -0
- package/dist/index26.css +1 -0
- package/dist/index27.css +1 -0
- package/dist/index28.css +1 -0
- package/dist/index29.css +1 -0
- package/dist/index3.css +1 -0
- package/dist/index30.css +1 -0
- package/dist/index31.css +1 -0
- package/dist/index32.css +1 -0
- package/dist/index33.css +1 -0
- package/dist/index34.css +1 -0
- package/dist/index35.css +1 -0
- package/dist/index36.css +1 -0
- package/dist/index37.css +1 -0
- package/dist/index38.css +1 -0
- package/dist/index39.css +1 -0
- package/dist/index4.css +1 -0
- package/dist/index5.css +1 -0
- package/dist/index6.css +1 -0
- package/dist/index7.css +1 -0
- package/dist/index8.css +1 -0
- package/dist/index9.css +1 -0
- package/dist/preview-stats.json +1136 -1124
- 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 +15 -10
- package/dist/components/ActionBar/ActionBar.spec.d.ts +0 -1
- package/dist/components/ActionBar/ActionBar.stories.d.ts +0 -10
- package/dist/components/ActionMenu/ActionMenu.spec.d.ts +0 -1
- package/dist/components/ActionMenu/ActionMenu.stories.d.ts +0 -12
- package/dist/components/Alert/Alert.spec.d.ts +0 -1
- package/dist/components/Alert/Alert.stories.d.ts +0 -9
- package/dist/components/Avatar/Avatar.helpers.spec.d.ts +0 -1
- package/dist/components/Avatar/Avatar.spec.d.ts +0 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +0 -22
- package/dist/components/Badge/Badge.spec.d.ts +0 -1
- package/dist/components/Badge/Badge.stories.d.ts +0 -12
- package/dist/components/Button/Button.spec.d.ts +0 -1
- package/dist/components/Button/Button.stories.d.ts +0 -43
- package/dist/components/Card/Card.spec.d.ts +0 -1
- package/dist/components/Card/Card.stories.d.ts +0 -11
- package/dist/components/Checkbox/Checkbox.spec.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -13
- package/dist/components/DatePicker/DatePicker.spec.d.ts +0 -1
- package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -7
- package/dist/components/DatePicker/RangeDatePicker.spec.d.ts +0 -1
- package/dist/components/DatePicker/RangeDatePicker.stories.d.ts +0 -4
- package/dist/components/DetailsCard/DetailsCard.spec.d.ts +0 -1
- package/dist/components/DetailsCard/DetailsCard.stories.d.ts +0 -17
- package/dist/components/FieldGroup/FieldGroup.spec.d.ts +0 -1
- package/dist/components/FieldGroup/FieldGroup.stories.d.ts +0 -10
- package/dist/components/FileUploadProgress/FileUploadProgress.stories.d.ts +0 -7
- package/dist/components/Form/Form.spec.d.ts +0 -1
- package/dist/components/Form/Form.stories.d.ts +0 -8
- package/dist/components/FormField/FormField.spec.d.ts +0 -1
- package/dist/components/FormField/FormField.stories.d.ts +0 -9
- package/dist/components/FormGroup/FormGroup.spec.d.ts +0 -1
- package/dist/components/FormGroup/FormGroup.stories.d.ts +0 -10
- package/dist/components/Icon/Icon.stories.d.ts +0 -15
- package/dist/components/Input/Input.spec.d.ts +0 -1
- package/dist/components/Input/Input.stories.d.ts +0 -10
- package/dist/components/Link/Link.stories.d.ts +0 -12
- package/dist/components/Loader/Loader.spec.d.ts +0 -1
- package/dist/components/Loader/Loader.stories.d.ts +0 -10
- package/dist/components/Modal/Modal.spec.d.ts +0 -1
- package/dist/components/Modal/Modal.stories.d.ts +0 -14
- package/dist/components/Modal/components/ModalBase.spec.d.ts +0 -1
- package/dist/components/NumericInput/NumericInput.spec.d.ts +0 -1
- package/dist/components/NumericInput/NumericInput.stories.d.ts +0 -20
- package/dist/components/Picker/Picker.spec.d.ts +0 -1
- package/dist/components/Picker/Picker.stories.d.ts +0 -11
- package/dist/components/Picker/components/PickerList.spec.d.ts +0 -1
- package/dist/components/Picker/components/PickerTrigger.spec.d.ts +0 -1
- package/dist/components/Picker/components/PickerTriggerBody.spec.d.ts +0 -1
- package/dist/components/Popover/Popover.spec.d.ts +0 -1
- package/dist/components/Popover/Popover.stories.d.ts +0 -16
- package/dist/components/Progress/ProgressBar.spec.d.ts +0 -1
- package/dist/components/Progress/ProgressBar.stories.d.ts +0 -12
- package/dist/components/Progress/ProgressCircle.spec.d.ts +0 -1
- package/dist/components/Progress/ProgressCircle.stories.d.ts +0 -12
- package/dist/components/PromoBanner/PromoBanner.spec.d.ts +0 -1
- package/dist/components/PromoBanner/PromoBanner.stories.d.ts +0 -11
- package/dist/components/PromoBannerV2/PromoBannerV2.spec.d.ts +0 -1
- package/dist/components/PromoBannerV2/PromoBannerV2.stories.d.ts +0 -51
- package/dist/components/RadioButton/RadioButton.spec.d.ts +0 -1
- package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -13
- package/dist/components/Search/Search.spec.d.ts +0 -1
- package/dist/components/Search/Search.stories.d.ts +0 -19
- package/dist/components/SegmentedControl/SegmentedControl.spec.d.ts +0 -1
- package/dist/components/SegmentedControl/SegmentedControl.stories.d.ts +0 -9
- package/dist/components/Switch/Switch.spec.d.ts +0 -1
- package/dist/components/Switch/Switch.stories.d.ts +0 -11
- package/dist/components/Tab/Tab.spec.d.ts +0 -1
- package/dist/components/Tab/Tab.stories.d.ts +0 -11
- package/dist/components/Tab/TabsWrapper.spec.d.ts +0 -1
- package/dist/components/Tab/TabsWrapper.stories.d.ts +0 -18
- package/dist/components/Tag/Tag.spec.d.ts +0 -1
- package/dist/components/Tag/Tag.stories.d.ts +0 -26
- package/dist/components/TagInput/TagInput.spec.d.ts +0 -1
- package/dist/components/TagInput/TagInput.stories.d.ts +0 -10
- package/dist/components/Textarea/Textarea.spec.d.ts +0 -1
- package/dist/components/Textarea/Textarea.stories.d.ts +0 -7
- package/dist/components/Toast/Toast.spec.d.ts +0 -1
- package/dist/components/Toast/Toast.stories.d.ts +0 -14
- package/dist/components/Toast/ToastWrapper.spec.d.ts +0 -1
- package/dist/components/Toast/ToastWrapper.stories.d.ts +0 -34
- package/dist/components/Tooltip/Tooltip.spec.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -52
- package/dist/components/UploadBar/UploadBar.stories.d.ts +0 -7
- package/dist/dsrc.cjs.js +0 -1
- package/dist/dsrc.es.js +0 -5235
- package/dist/stories/components/BlockColumns/BlockColumns.d.ts +0 -8
- package/dist/stories/components/StoryDescriptor.d.ts +0 -7
- package/dist/stories/components/Table/Table.d.ts +0 -13
- package/dist/stories/foundations/Color/ColorTable.d.ts +0 -7
- package/dist/stories/foundations/Color/constants.d.ts +0 -2
- package/dist/stories/foundations/Color/data.d.ts +0 -7
- package/dist/stories/foundations/Color/helpers.d.ts +0 -2
- package/dist/stories/foundations/Color/types.d.ts +0 -43
- package/dist/stories/foundations/Radius/RadiusTable.d.ts +0 -7
- package/dist/stories/foundations/Radius/constants.d.ts +0 -2
- package/dist/stories/foundations/Radius/types.d.ts +0 -8
- package/dist/stories/foundations/Shadow/ShadowTable.d.ts +0 -7
- package/dist/stories/foundations/Shadow/constants.d.ts +0 -2
- package/dist/stories/foundations/Shadow/types.d.ts +0 -6
- package/dist/stories/foundations/Spacing/SpacingTable.d.ts +0 -7
- package/dist/stories/foundations/Spacing/constants.d.ts +0 -2
- package/dist/stories/foundations/Spacing/types.d.ts +0 -7
- package/dist/stories/foundations/Transition/TransitionTable.d.ts +0 -7
- package/dist/stories/foundations/Transition/components/TransitionDelayExample.d.ts +0 -2
- package/dist/stories/foundations/Transition/components/TransitionDurationExample.d.ts +0 -2
- package/dist/stories/foundations/Transition/components/TransitionTimingExample.d.ts +0 -2
- package/dist/stories/foundations/Transition/constants.d.ts +0 -4
- package/dist/stories/foundations/Transition/types.d.ts +0 -16
- package/dist/stories/foundations/Typography/components/DisplayExamples.d.ts +0 -2
- package/dist/stories/foundations/Typography/components/HeadingExamples.d.ts +0 -2
- package/dist/stories/foundations/Typography/components/TextExamples.d.ts +0 -2
- package/dist/stories/helpers.d.ts +0 -6
- package/dist/test/setup.d.ts +0 -0
- package/dist/test/utils.d.ts +0 -3
|
@@ -0,0 +1,188 @@
|
|
|
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, _) => t in e ? I(e, t, { enumerable: !0, configurable: !0, writable: !0, value: _ }) : e[t] = _, h = (e, t) => {
|
|
5
|
+
for (var _ in t || (t = {}))
|
|
6
|
+
M.call(t, _) && B(e, _, t[_]);
|
|
7
|
+
if (w)
|
|
8
|
+
for (var _ of w(t))
|
|
9
|
+
x.call(t, _) && B(e, _, t[_]);
|
|
10
|
+
return e;
|
|
11
|
+
};
|
|
12
|
+
import "../../index39.css";
|
|
13
|
+
import * as n from "react";
|
|
14
|
+
import { ChevronLeft as L, ChevronDown as O } from "@livechat/design-system-icons";
|
|
15
|
+
import u from "clsx";
|
|
16
|
+
import { ActionMenu as S, ActionMenuItem as T } from "../ActionMenu/index.es.js";
|
|
17
|
+
import { Button as A } from "../Button/index.es.js";
|
|
18
|
+
import { Icon as D } from "../Icon/index.es.js";
|
|
19
|
+
import { T as P } from "../../chunks/Tooltip-e472934d.js";
|
|
20
|
+
const r = {
|
|
21
|
+
"action-bar": "lc-ActionBar-module__action-bar___TJitF",
|
|
22
|
+
"action-bar__items": "lc-ActionBar-module__action-bar__items___uhoQA",
|
|
23
|
+
"action-bar__items--scroll": "lc-ActionBar-module__action-bar__items--scroll___f--dN",
|
|
24
|
+
"action-bar__items__button": "lc-ActionBar-module__action-bar__items__button___Vdjl7",
|
|
25
|
+
"action-bar__items__button--active": "lc-ActionBar-module__action-bar__items__button--active___PFLdm",
|
|
26
|
+
"action-bar__items__button--hidden": "lc-ActionBar-module__action-bar__items__button--hidden___C00VA",
|
|
27
|
+
"action-bar__items__tooltip": "lc-ActionBar-module__action-bar__items__tooltip___BuQPo",
|
|
28
|
+
"action-bar__menu-wrapper": "lc-ActionBar-module__action-bar__menu-wrapper___OMWP5",
|
|
29
|
+
"action-bar__menu-wrapper__button": "lc-ActionBar-module__action-bar__menu-wrapper__button___MDsLx",
|
|
30
|
+
"action-bar__menu-wrapper__button__with-item": "lc-ActionBar-module__action-bar__menu-wrapper__button__with-item___FYlqL",
|
|
31
|
+
"fade-in": "lc-ActionBar-module__fade-in___tQvzD",
|
|
32
|
+
"action-bar__menu-wrapper__button--active": "lc-ActionBar-module__action-bar__menu-wrapper__button--active___Hlzoc",
|
|
33
|
+
"action-bar__menu-wrapper__trigger-vertical": "lc-ActionBar-module__action-bar__menu-wrapper__trigger-vertical___84WL1",
|
|
34
|
+
"action-bar--vertical": "lc-ActionBar-module__action-bar--vertical___tMzLJ"
|
|
35
|
+
}, g = "action-bar__items", V = ({
|
|
36
|
+
option: e,
|
|
37
|
+
menuItemsKeys: t,
|
|
38
|
+
activeOptionKey: _,
|
|
39
|
+
vertical: b
|
|
40
|
+
}) => {
|
|
41
|
+
const d = u(r[`${g}__button`], {
|
|
42
|
+
[r[`${g}__button--hidden`]]: t.includes(
|
|
43
|
+
e.key
|
|
44
|
+
),
|
|
45
|
+
[r[`${g}__button--active`]]: e.key === _
|
|
46
|
+
});
|
|
47
|
+
if (e.showTooltip) {
|
|
48
|
+
const c = t.includes(e.key) && {
|
|
49
|
+
isVisible: !1
|
|
50
|
+
};
|
|
51
|
+
return /* @__PURE__ */ n.createElement(
|
|
52
|
+
P,
|
|
53
|
+
h({
|
|
54
|
+
kind: "invert",
|
|
55
|
+
placement: b ? "left" : "bottom",
|
|
56
|
+
triggerClassName: r[`${g}__tooltip`],
|
|
57
|
+
triggerRenderer: () => /* @__PURE__ */ n.createElement(
|
|
58
|
+
A,
|
|
59
|
+
{
|
|
60
|
+
id: e.key,
|
|
61
|
+
key: e.key,
|
|
62
|
+
title: e.label,
|
|
63
|
+
kind: "plain",
|
|
64
|
+
className: d,
|
|
65
|
+
onClick: e.onClick,
|
|
66
|
+
icon: e.element
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}, c),
|
|
70
|
+
/* @__PURE__ */ n.createElement("div", null, e.label)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return /* @__PURE__ */ n.createElement(
|
|
74
|
+
A,
|
|
75
|
+
{
|
|
76
|
+
id: e.key,
|
|
77
|
+
key: e.key,
|
|
78
|
+
title: e.label,
|
|
79
|
+
kind: "plain",
|
|
80
|
+
className: d,
|
|
81
|
+
onClick: e.onClick,
|
|
82
|
+
icon: e.element
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
}, m = "action-bar", H = ({
|
|
86
|
+
className: e,
|
|
87
|
+
id: t = "action-bar-area",
|
|
88
|
+
type: _ = "menu",
|
|
89
|
+
options: b,
|
|
90
|
+
activeOptionKey: d,
|
|
91
|
+
vertical: c
|
|
92
|
+
}) => {
|
|
93
|
+
const [l, v] = n.useState([]), f = _ === "scroll", y = u(
|
|
94
|
+
r[m],
|
|
95
|
+
e,
|
|
96
|
+
c && r[`${m}--vertical`]
|
|
97
|
+
), p = `${m}__menu-wrapper`, E = {
|
|
98
|
+
root: document.querySelector(`${t}`),
|
|
99
|
+
threshold: 1
|
|
100
|
+
}, C = !f && l.length !== 0, $ = (i) => {
|
|
101
|
+
i.map((o) => {
|
|
102
|
+
const a = l.includes(o.target.id);
|
|
103
|
+
if (!o.isIntersecting) {
|
|
104
|
+
o.target.setAttribute("tabindex", "-1"), a || v((s) => [
|
|
105
|
+
...s,
|
|
106
|
+
o.target.id
|
|
107
|
+
]);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
o.target.removeAttribute("tabindex"), a && v(l.filter((s) => s !== o.target.id));
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
n.useEffect(() => {
|
|
114
|
+
const i = !!window.IntersectionObserver;
|
|
115
|
+
if (!f && i) {
|
|
116
|
+
const o = document.querySelectorAll(
|
|
117
|
+
`.${r[`${m}__items__button`]}`
|
|
118
|
+
), a = new IntersectionObserver(
|
|
119
|
+
$,
|
|
120
|
+
E
|
|
121
|
+
);
|
|
122
|
+
return o.forEach((s) => a.observe(s)), () => a.disconnect();
|
|
123
|
+
}
|
|
124
|
+
}, [l, f]);
|
|
125
|
+
const N = (i) => b.filter(
|
|
126
|
+
(a) => i.find((s) => s === a.key)
|
|
127
|
+
).map((a) => ({
|
|
128
|
+
key: a.key,
|
|
129
|
+
element: /* @__PURE__ */ n.createElement(T, { leftNode: a.element }, a.label),
|
|
130
|
+
onClick: a.onClick
|
|
131
|
+
})), k = b.filter((i) => l.find((o) => o === i.key)).find((i) => i.key === d);
|
|
132
|
+
return /* @__PURE__ */ n.createElement("div", { id: t, className: y }, /* @__PURE__ */ n.createElement(
|
|
133
|
+
"div",
|
|
134
|
+
{
|
|
135
|
+
className: u(r[`${m}__items`], {
|
|
136
|
+
[r[`${m}__items--scroll`]]: f
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
b.map((i) => /* @__PURE__ */ n.createElement(
|
|
140
|
+
V,
|
|
141
|
+
{
|
|
142
|
+
option: i,
|
|
143
|
+
menuItemsKeys: l,
|
|
144
|
+
activeOptionKey: d,
|
|
145
|
+
vertical: c
|
|
146
|
+
}
|
|
147
|
+
))
|
|
148
|
+
), C && /* @__PURE__ */ n.createElement("div", { className: r[p] }, /* @__PURE__ */ n.createElement(
|
|
149
|
+
S,
|
|
150
|
+
{
|
|
151
|
+
placement: c ? "left-end" : "bottom-end",
|
|
152
|
+
options: N(l),
|
|
153
|
+
triggerClassName: u(
|
|
154
|
+
c && r[`${p}__trigger-vertical`]
|
|
155
|
+
),
|
|
156
|
+
triggerRenderer: /* @__PURE__ */ n.createElement(
|
|
157
|
+
A,
|
|
158
|
+
{
|
|
159
|
+
className: u(
|
|
160
|
+
r[`${p}__button`],
|
|
161
|
+
k && r[`${p}__button--active`]
|
|
162
|
+
),
|
|
163
|
+
kind: "plain",
|
|
164
|
+
icon: /* @__PURE__ */ n.createElement(
|
|
165
|
+
D,
|
|
166
|
+
{
|
|
167
|
+
source: c ? L : O,
|
|
168
|
+
kind: "primary"
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
iconPosition: "right"
|
|
172
|
+
},
|
|
173
|
+
k && /* @__PURE__ */ n.createElement(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: u(
|
|
177
|
+
r[`${p}__button__with-item`]
|
|
178
|
+
)
|
|
179
|
+
},
|
|
180
|
+
k.element
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
)));
|
|
185
|
+
};
|
|
186
|
+
export {
|
|
187
|
+
H as ActionBar
|
|
188
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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},N=(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};var ye=require("../../index38.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=require("react"),l=require("@floating-ui/react"),le=require("@livechat/design-system-icons"),q=require("clsx"),K=require("../../chunks/keyCodes-c4c35e49.js"),ue=require("../Icon/index.cjs.js"),oe=require("../../chunks/Text-2356ec2a.js");function me(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 _=me(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",se=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:s,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),m=_.useRef(-1),S=_.useRef(null),g=v?x:Y,B=()=>{g?(s==null||s(),!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=m.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;m.current=te(e);const r=(y=S.current)==null?void 0:y.children,a=r&&((b=r[m.current])==null?void 0:b.children[0]);return a==null?void 0:a.focus()},D=e=>{e.key===K.KeyCodes.arrowUp&&m.current>0&&(e.preventDefault(),P(-1)),e.key===K.KeyCodes.arrowDown&&m.current+1<n.length&&(e.preventDefault(),P(1))};_.useEffect(()=>{if(g)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D);m.current=-1},[g,D]);const ne=(e,r)=>{m.current=e,r==null||r(),!v&&!F&&(A(!1),s==null||s())},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:q(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",N(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",N(f({},X),{className:q(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:q(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=se;exports.ActionMenuItem=de;
|
|
@@ -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 "../../index38.css";
|
|
23
|
+
import * as i from "react";
|
|
24
|
+
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";
|
|
25
|
+
import { Check as fe } from "@livechat/design-system-icons";
|
|
26
|
+
import x from "clsx";
|
|
27
|
+
import { K as U } from "../../chunks/keyCodes-30323e90.js";
|
|
28
|
+
import { Icon as ye } from "../Icon/index.es.js";
|
|
29
|
+
import { T as be } from "../../chunks/Text-3504b7ce.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
|
+
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};var F=require("../../index37.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react"),o=require("@livechat/design-system-icons"),q=require("clsx"),T=require("lodash.debounce"),d=require("../Button/index.cjs.js"),v=require("../Icon/index.cjs.js"),D=require("../../chunks/Text-2356ec2a.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(S),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=q(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,128 @@
|
|
|
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 "../../index37.css";
|
|
23
|
+
import * as l from "react";
|
|
24
|
+
import { Close as I, Info as R, Warning as T, CheckCircle as W, Block as D } from "@livechat/design-system-icons";
|
|
25
|
+
import H from "clsx";
|
|
26
|
+
import L from "lodash.debounce";
|
|
27
|
+
import { Button as u } from "../Button/index.es.js";
|
|
28
|
+
import { Icon as h } from "../Icon/index.es.js";
|
|
29
|
+
import { T as M } from "../../chunks/Text-3504b7ce.js";
|
|
30
|
+
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 = {
|
|
31
|
+
alert: P,
|
|
32
|
+
alert__icon: S,
|
|
33
|
+
alert__content: Z,
|
|
34
|
+
alert__content__wrapper: G,
|
|
35
|
+
alert__content__wrapper__text: F,
|
|
36
|
+
alert__content__wrapper__cta: K,
|
|
37
|
+
alert__content__wrapper__cta__link: V,
|
|
38
|
+
"alert__close-icon": "lc-Alert-module__alert__close-icon___rYxVy",
|
|
39
|
+
"alert--small": "lc-Alert-module__alert--small___Fyk-v",
|
|
40
|
+
"alert--medium": "lc-Alert-module__alert--medium___ItZWT",
|
|
41
|
+
"alert--large": "lc-Alert-module__alert--large___IH9yM",
|
|
42
|
+
"alert--info": "lc-Alert-module__alert--info___GmIGN",
|
|
43
|
+
"alert--warning": "lc-Alert-module__alert--warning___MubhD",
|
|
44
|
+
"alert--success": "lc-Alert-module__alert--success___fPtlZ",
|
|
45
|
+
"alert--error": "lc-Alert-module__alert--error___DKPo0"
|
|
46
|
+
}, Y = {
|
|
47
|
+
info: {
|
|
48
|
+
source: R,
|
|
49
|
+
kind: "link"
|
|
50
|
+
},
|
|
51
|
+
warning: {
|
|
52
|
+
source: T,
|
|
53
|
+
kind: "warning"
|
|
54
|
+
},
|
|
55
|
+
success: {
|
|
56
|
+
source: W,
|
|
57
|
+
kind: "success"
|
|
58
|
+
},
|
|
59
|
+
error: {
|
|
60
|
+
source: D,
|
|
61
|
+
kind: "error"
|
|
62
|
+
}
|
|
63
|
+
}, a = "alert", ee = (j) => {
|
|
64
|
+
var f = j, {
|
|
65
|
+
children: e,
|
|
66
|
+
className: t,
|
|
67
|
+
primaryButton: _,
|
|
68
|
+
secondaryButton: r,
|
|
69
|
+
kind: d = "info",
|
|
70
|
+
onClose: p
|
|
71
|
+
} = f, N = $(f, [
|
|
72
|
+
"children",
|
|
73
|
+
"className",
|
|
74
|
+
"primaryButton",
|
|
75
|
+
"secondaryButton",
|
|
76
|
+
"kind",
|
|
77
|
+
"onClose"
|
|
78
|
+
]);
|
|
79
|
+
const c = l.useRef(null), [s, i] = l.useState(null), v = H(
|
|
80
|
+
n[a],
|
|
81
|
+
n[`${a}--${d}`],
|
|
82
|
+
s === "large" && n[`${a}--large`],
|
|
83
|
+
s === "medium" && n[`${a}--medium`],
|
|
84
|
+
s === "small" && n[`${a}--small`],
|
|
85
|
+
t
|
|
86
|
+
);
|
|
87
|
+
return l.useEffect(() => {
|
|
88
|
+
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(() => {
|
|
89
|
+
w();
|
|
90
|
+
}, 500);
|
|
91
|
+
return window.addEventListener("resize", k), w(), () => window.removeEventListener("resize", k);
|
|
92
|
+
}), /* @__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(
|
|
93
|
+
h,
|
|
94
|
+
C(m({}, Y[d]), {
|
|
95
|
+
size: "large",
|
|
96
|
+
className: n[`${a}__icon`]
|
|
97
|
+
})
|
|
98
|
+
), /* @__PURE__ */ l.createElement(
|
|
99
|
+
M,
|
|
100
|
+
{
|
|
101
|
+
as: "div",
|
|
102
|
+
className: n[`${a}__content__wrapper__text`]
|
|
103
|
+
},
|
|
104
|
+
e
|
|
105
|
+
)), (_ || r) && /* @__PURE__ */ l.createElement("div", { className: n[`${a}__content__wrapper__cta`] }, _ && /* @__PURE__ */ l.createElement(u, { kind: "high-contrast", onClick: _.handleClick }, _.label), r && /* @__PURE__ */ l.createElement(
|
|
106
|
+
u,
|
|
107
|
+
{
|
|
108
|
+
className: n[`${a}__content__wrapper__cta__link`],
|
|
109
|
+
kind: "text",
|
|
110
|
+
onClick: r.handleClick
|
|
111
|
+
},
|
|
112
|
+
r.label
|
|
113
|
+
))), p && /* @__PURE__ */ l.createElement(
|
|
114
|
+
u,
|
|
115
|
+
{
|
|
116
|
+
"aria-label": "Close alert",
|
|
117
|
+
type: "button",
|
|
118
|
+
className: n[`${a}__close-icon`],
|
|
119
|
+
size: "compact",
|
|
120
|
+
kind: "plain",
|
|
121
|
+
icon: /* @__PURE__ */ l.createElement(h, { source: I }),
|
|
122
|
+
onClick: p
|
|
123
|
+
}
|
|
124
|
+
));
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
ee as Alert
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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};var la=require("../../index36.css");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-1f13e793.js"),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 k(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,q=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||k(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},q),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=k;
|